Namespaces | |
namespace | D0RunIIconeJets_CONEJETINFO |
namespace | inline_maths |
Classes | |
class | ProtoJet_ET_seedET_order |
class | ConeSplitMerge |
class | HepEntity |
class | ILConeAlgorithm |
class | ProtoJet |
Functions | |
template<class Item > | |
void | ILConeAlgorithm< Item >makeClusters (std::list< Item > &jets, std::list< const Item * > &ilist, const float Item_ET_Threshold) |
int | main () |
float | RD2 (float y1, float phi1, float y2, float phi2) |
float | RDelta (float y1, float phi1, float y2, float phi2) |
float | P2y (float *p4vec) |
float | P2phi (float *p4vec) |
void fastjet::d0::ILConeAlgorithm< Item >makeClusters | ( | std::list< Item > & | jets, | |
std::list< const Item * > & | ilist, | |||
const float | Item_ET_Threshold | |||
) | [inline] |
Item_ET_Threshold | /stdlist<const Item*>& ilist) |
Definition at line 343 of file ILConeAlgorithm.hpp.
References P2phi(), P2y(), fastjet::d0::inline_maths::phi(), RD2(), fastjet::d0::ConeSplitMerge< Item >::split_merge(), and fastjet::d0::inline_maths::y().
00351 { 00352 // remove items below threshold 00353 for ( typename std::list<const Item*>::iterator it = ilist.begin(); 00354 00355 it != ilist.end(); ) 00356 { 00357 if ( (*it)->pT() < Item_ET_Threshold ) 00358 { 00359 it = ilist.erase(it); 00360 } 00361 else ++it; 00362 } 00363 00364 // create an energy cluster collection for jets 00365 //EnergyClusterCollection<ItemAddress>* ptrcol; 00366 //Item* ptrcol; 00367 //r->createClusterCollection(chunkptr,ptrcol); 00369 std::vector<const Item*> ecv; 00370 for ( typename std::list<const Item*>::iterator it = ilist.begin(); 00371 it != ilist.end(); it++) { 00372 ecv.push_back(*it); 00373 } 00374 00375 00376 //preclu.getClusters(ecv); 00377 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% need to fill here vector ecv 00378 00379 //std::cout << " number of seed clusters: " << ecv.size() << std::endl; 00380 00381 // skip precluster close to jets 00382 float far_def = _FAR_RATIO*_CONE_RADIUS * _FAR_RATIO*_CONE_RADIUS; 00383 00384 // skip if jet Et is below some value 00385 float ratio= _MIN_JET_ET*_ET_MIN_RATIO; 00386 00387 00388 #ifdef ILCA_USE_ORDERED_LIST 00389 // sort the list in rapidity order 00390 ilist.sort(rapidity_order<Item>()); 00391 #else 00392 #ifdef ILCA_USE_MMAP 00393 // create a y ordered list of items 00394 std::multimap<float,const Item*> items; 00395 std::list<const Item*>::const_iterator it; 00396 for(it = ilist.begin(); it != ilist.end(); ++it) 00397 { 00398 pair<float,const Item*> p((*it)->y(),*it); 00399 items.insert(p); 00400 } 00401 #endif 00402 #endif 00403 00404 std::vector<ProtoJet<Item> > mcoll; 00405 std::vector<TemporaryJet> scoll; 00406 00407 00408 // find stable jets around seeds 00409 //typename std::vector<const EnergyCluster<ItemAddress>* >::iterator jclu; 00410 typename std::vector<const Item*>::iterator jclu; 00411 for(jclu = ecv.begin(); jclu != ecv.end(); ++jclu) 00412 { 00413 //const EnergyCluster<ItemAddress>* ptr= *jclu; 00414 const Item* ptr= *jclu; 00415 float p[4]; 00416 ptr->p4vec(p); 00417 float Yst = P2y(p); 00418 float PHIst= P2phi(p); 00419 00420 // don't keep preclusters close to jet 00421 bool is_far= true; 00422 // ?? if(_Kill_Far_Clusters) { 00423 for(unsigned int i = 0; i < scoll.size(); ++i) 00424 { 00425 float y = scoll[i].y(); 00426 float phi= scoll[i].phi(); 00427 if(RD2(Yst,PHIst,y,phi) < far_def) 00428 { 00429 is_far= false; 00430 break; 00431 } 00432 } 00433 // ?? } 00434 00435 if(is_far) 00436 { 00437 TemporaryJet jet(ptr->pT(),Yst,PHIst); 00438 //cout << "temporary jet: pt=" << ptr->pT() << " y=" << Yst << " phi=" << PHIst << endl; 00439 00440 // Search cones are smaller, so contain less jet Et 00441 // Don't throw out too many little jets during search phase! 00442 // Strategy: check Et first with full cone, then search with low-GeV min_et thresh 00443 #ifdef ILCA_USE_MMAP 00444 if(jet.is_stable(items,_CONE_RADIUS,ratio,0) && jet.is_stable(items,_SEARCH_CONE,3.0)) 00445 #else 00446 if(jet.is_stable(ilist,_CONE_RADIUS,ratio,0) && jet.is_stable(ilist,_SEARCH_CONE,3.0)) 00447 #endif 00448 { 00449 00450 //cout << "temporary jet is stable" << endl; 00451 00452 // jpk Resize the found jets 00453 #ifdef ILCA_USE_MMAP 00454 jet.is_stable(items,_CONE_RADIUS,ratio,0) ; 00455 #else 00456 jet.is_stable(ilist,_CONE_RADIUS,ratio,0) ; 00457 #endif 00458 //cout << "found jet has been resized if any" << endl; 00459 00460 if ( _KILL_DUPLICATE ) 00461 { 00462 // check if we are not finding the same jet again 00463 float distmax = 999.; int imax = -1; 00464 for(unsigned int i = 0; i < scoll.size(); ++i) 00465 { 00466 float dist = jet.dist(scoll[i]); 00467 if ( dist < distmax ) 00468 { 00469 distmax = dist; 00470 imax = i; 00471 } 00472 } 00473 if ( distmax > _DUPLICATE_DR || 00474 fabs((jet.pT()-scoll[imax].pT())/scoll[imax].pT())>_DUPLICATE_DPT ) 00475 { 00476 scoll.push_back(jet); 00477 mcoll.push_back(jet); 00478 //std::cout << " stable cone " << jet.y() << " " << jet.phi() << " " << jet.pT() << std::endl; 00479 } 00480 /* 00481 else 00482 { 00483 std::cout << " jet too close to a found jet " << distmax << " " << 00484 fabs((jet.pT()-scoll[imax].pT())/scoll[imax].pT()) << std::endl; 00485 } 00486 */ 00487 } 00488 else 00489 { 00490 scoll.push_back(jet); 00491 mcoll.push_back(jet); 00492 //std::cout << " stable cone " << jet.y() << " " << jet.phi() << " " << jet.pT() << std::endl; 00493 } 00494 00495 } 00496 } 00497 } 00498 00499 // find stable jets around midpoints 00500 for(unsigned int i = 0; i < scoll.size(); ++i) 00501 { 00502 for(unsigned int k = i+1; k < scoll.size(); ++k) 00503 { 00504 float djet= scoll[i].dist(scoll[k]); 00505 if(djet > _CONE_RADIUS && djet < 2.*_CONE_RADIUS) 00506 { 00507 float y_mid,phi_mid; 00508 scoll[i].midpoint(scoll[k],y_mid,phi_mid); 00509 TemporaryJet jet(-999999.,y_mid,phi_mid); 00510 //std::cout << " midpoint: " << scoll[i].pT() << " " << scoll[i].info().seedET() << " " << scoll[k].pT() << " " << scoll[k].info().seedET() << " " << y_mid << " " << phi_mid << std::endl; 00511 00512 // midpoint jets are full size 00513 #ifdef ILCA_USE_MMAP 00514 if(jet.is_stable(items,_CONE_RADIUS,ratio)) 00515 #else 00516 if(jet.is_stable(ilist,_CONE_RADIUS,ratio)) 00517 #endif 00518 { 00519 mcoll.push_back(jet); 00520 //std::cout << " stable midpoint cone " << jet.y() << " " << jet.phi() << " " << jet.pT() << std::endl; 00521 } 00522 } 00523 } 00524 } 00525 00526 00527 // do a pT ordered splitting/merging 00528 ConeSplitMerge<Item> pjets(mcoll); 00529 ilcv.clear(); 00530 pjets.split_merge(ilcv,_SPLIT_RATIO, _PT_MIN_LEADING_PROTOJET, _PT_MIN_SECOND_PROTOJET, _MERGE_MAX, _PT_MIN_noMERGE_MAX); 00531 00532 00533 for(unsigned int i = 0; i < ilcv.size(); ++i) 00534 { 00535 if ( ilcv[i].pT() > _MIN_JET_ET ) 00536 { 00537 //EnergyCluster<ItemAddress>* ptrclu; 00538 Item ptrclu; 00539 //r->createCluster(ptrcol,ptrclu); 00540 00541 std::list<const Item*> tlist=ilcv[i].LItems(); 00542 typename std::list<const Item*>::iterator tk; 00543 for(tk = tlist.begin(); tk != tlist.end(); ++tk) 00544 { 00545 //ItemAddress addr= (*tk)->address(); 00546 float pk[4]; 00547 (*tk)->p4vec(pk); 00548 //std::cout << (*tk)->index <<" " << (*tk) << std::endl; 00549 //float emE= (*tk)->emE(); 00550 //r->addClusterItem(ptrclu,addr,pk,emE); 00551 //ptrclu->Add(*tk); 00552 ptrclu.Add(**tk); 00553 } 00554 // print out 00555 //ptrclu->print(cout); 00556 00557 //infochunkptr->addInfo(ilcv[i].info()); 00558 jets.push_back(ptrclu); 00559 } 00560 } 00561 }
int fastjet::d0::main | ( | ) |
Definition at line 13 of file main.C.
References fastjet::d0::HepEntity::Fill(), and fastjet::d0::ILConeAlgorithm< Item >::makeClusters().
00013 { 00014 00015 00016 HepEntity el; 00017 list<const HepEntity*> *ensemble = new list<const HepEntity*>; 00018 //list<const HepEntity*> ensemble; 00019 00020 //fill with E, px, py, pz 00021 el.Fill(100., 25., 25., 25., 0); 00022 ensemble->push_back(new HepEntity(el)); 00023 el.Fill(105., 20., 30., 30., 1); 00024 ensemble->push_back(new HepEntity(el)); 00025 el.Fill(60., 20., 20., 20., 2); 00026 ensemble->push_back(new HepEntity(el)); 00027 el.Fill(95., 65., 10., 20., 3); 00028 ensemble->push_back(new HepEntity(el)); 00029 00030 el.Fill(110., 25., -25., -25., 4); 00031 ensemble->push_back(new HepEntity(el)); 00032 el.Fill(100., 23., -25., -25., 5); 00033 ensemble->push_back(new HepEntity(el)); 00034 el.Fill(101., 25., -20., -25., 6); 00035 ensemble->push_back(new HepEntity(el)); 00036 el.Fill(102., 25., -25., -23., 7); 00037 ensemble->push_back(new HepEntity(el)); 00038 00039 00040 00041 cout << "list->size()=" << ensemble->size() << endl; 00042 int i=1; 00043 for (list<const HepEntity*>::iterator it = ensemble->begin(); it != ensemble->end(); ++it) { 00044 cout << "4-vector " << i++ << " : E=" << (*it)->E << " pT=" << (*it)->pT() << " y=" << (*it)->y() << " phi=" << (*it)->phi() << endl; 00045 cout << (*it) << endl; 00046 } 00047 00048 00049 float cone_radius = 0.5; 00050 float min_jet_Et = 8.0; 00051 float split_ratio = 0.5; 00052 00053 //the parameters below have been found to be set to the values given below 00054 //in the original implementation, shouldn't be altered 00055 float far_ratio=0.5; 00056 float Et_min_ratio=0.5; 00057 bool kill_duplicate=true; 00058 float duplicate_dR=0.005; 00059 float duplicate_dPT=0.01; 00060 float search_factor=1.0; 00061 float pT_min_leading_protojet=0.; 00062 float pT_min_second_protojet=0.; 00063 int merge_max=10000; 00064 float pT_min_nomerge=0.; 00065 00066 ILConeAlgorithm<HepEntity> 00067 ilegac(cone_radius, min_jet_Et, split_ratio, 00068 far_ratio, Et_min_ratio, kill_duplicate, duplicate_dR, 00069 duplicate_dPT, search_factor, pT_min_leading_protojet, 00070 pT_min_second_protojet, merge_max, pT_min_nomerge); 00071 00072 float Item_ET_Threshold = 0.; 00073 float Zvertex = 0.; 00074 00075 float* Item_ET_Threshold_ptr = &Item_ET_Threshold; 00076 00077 00078 list<HepEntity> jets; 00079 ilegac.makeClusters(jets, *ensemble, Item_ET_Threshold); 00080 00081 00082 list<HepEntity>::iterator it; 00083 cout << "Number of jets = " << jets.size() << endl; 00084 for (it=jets.begin(); it!=jets.end(); ++it) { 00085 cout << "jet: E=" << (*it).E << " pT=" << (*it).pT() << " y=" << (*it).y() << " phi=" << (*it).phi() << endl; 00086 } 00087 00088 //delete elements of the ensemble particle list 00089 //relevant to prevent memory leakage when running over many events 00090 for (list<const HepEntity*>::iterator it = ensemble->begin(); it != ensemble->end(); ++it) { 00091 delete *it; 00092 } 00093 delete ensemble; 00094 00095 return 0; 00096 00097 }
float fastjet::d0::P2phi | ( | float * | p4vec | ) | [inline] |
Definition at line 52 of file ProtoJet.hpp.
References fastjet::d0::inline_maths::phi().
Referenced by ILConeAlgorithm< Item >makeClusters(), and fastjet::d0::ProtoJet< Item >::updateJet().
00052 { 00053 return phi(p4vec[0],p4vec[1]); 00054 }
float fastjet::d0::P2y | ( | float * | p4vec | ) | [inline] |
Definition at line 48 of file ProtoJet.hpp.
References fastjet::d0::inline_maths::y().
Referenced by ILConeAlgorithm< Item >makeClusters(), and fastjet::d0::ProtoJet< Item >::updateJet().
00048 { 00049 return y(p4vec[3],p4vec[2]); 00050 }
float fastjet::d0::RD2 | ( | float | y1, | |
float | phi1, | |||
float | y2, | |||
float | phi2 | |||
) | [inline] |
Definition at line 36 of file ProtoJet.hpp.
References fastjet::d0::inline_maths::delta_phi().
Referenced by ILConeAlgorithm< Item >makeClusters(), fastjet::d0::ILConeAlgorithm< Item >::TemporaryJet::is_stable(), and fastjet::d0::ConeSplitMerge< Item >::split_merge().
00037 { 00038 float dphi= delta_phi(phi1,phi2); 00039 return (y1-y2)*(y1-y2)+dphi*dphi; 00040 }
float fastjet::d0::RDelta | ( | float | y1, | |
float | phi1, | |||
float | y2, | |||
float | phi2 | |||
) | [inline] |
Definition at line 42 of file ProtoJet.hpp.
References fastjet::d0::inline_maths::delta_phi().
Referenced by fastjet::d0::ILConeAlgorithm< Item >::TemporaryJet::dist().
00043 { 00044 float dphi= delta_phi(phi1,phi2); 00045 return sqrt((y1-y2)*(y1-y2)+dphi*dphi); 00046 }