#include <RecoParticleFlow/PFRootEvent/interface/PFJetAlgorithm.h>
Public Types | |
typedef std::map< double, PFJetAlgorithm::Jet, std::greater< double > >::iterator | IJ |
typedef std::map< double, int, std::greater< double > >::const_iterator | IV |
Public Member Functions | |
void | CleanUp () |
void | Clear () |
const std::vector < PFJetAlgorithm::Jet > & | FindJets (const std::vector< TLorentzVector > *vecs) |
double | GetConeAngle () const |
const std::vector < PFJetAlgorithm::Jet > & | GetJets () const |
void | MergeJets (std::map< double, PFJetAlgorithm::Jet, std::greater< double > > &etjets) |
PFJetAlgorithm (double cone, double et, double conemerge) | |
PFJetAlgorithm () | |
void | SetConeAngle (double coneAngle) |
void | SetConeMerge (double coneMerge) |
void | SetSeedEt (double et) |
void | Update () |
virtual | ~PFJetAlgorithm () |
Static Public Member Functions | |
static double | DeltaR (double eta1, double phi1, double eta2, double phi2) |
Private Attributes | |
const std::vector < TLorentzVector > * | fAllVecs |
std::vector< int > | fAssignedVecs |
double | fConeAngle |
double | fConeMerge |
std::map< double, int, std::greater< double > > | fEtOrderedSeeds |
std::vector< PFJetAlgorithm::Jet > | fJets |
double | fSeedEt |
Classes | |
class | Jet |
Definition at line 11 of file PFJetAlgorithm.h.
typedef std::map< double, PFJetAlgorithm::Jet, std::greater<double> >::iterator PFJetAlgorithm::IJ |
Definition at line 66 of file PFJetAlgorithm.h.
typedef std::map<double, int, std::greater<double> >::const_iterator PFJetAlgorithm::IV |
Definition at line 67 of file PFJetAlgorithm.h.
PFJetAlgorithm::PFJetAlgorithm | ( | ) | [inline] |
Definition at line 69 of file PFJetAlgorithm.h.
00069 : fConeAngle(0.5), fSeedEt(2), fConeMerge(0.5) {}
PFJetAlgorithm::PFJetAlgorithm | ( | double | cone, | |
double | et, | |||
double | conemerge | |||
) | [inline] |
Definition at line 71 of file PFJetAlgorithm.h.
00071 : 00072 fConeAngle(cone), 00073 fSeedEt(et), 00074 fConeMerge(conemerge) 00075 {}
virtual PFJetAlgorithm::~PFJetAlgorithm | ( | ) | [inline, virtual] |
void PFJetAlgorithm::CleanUp | ( | ) |
Definition at line 141 of file PFJetAlgorithm.cc.
References fJets, i, MergeJets(), tmp, and tmp2.
00141 { 00142 00143 // cout<<"CleanUp : -----------------------------------------"<<endl; 00144 00145 // for(unsigned i=0; i<fJets.size(); i++) { 00146 // cout<<fJets[i]<<endl; 00147 // } 00148 00149 vector< PFJetAlgorithm::Jet > tmp = fJets; 00150 00151 map< double, PFJetAlgorithm::Jet, greater<double> > etjets; 00152 // typedef map< double, PFJetAlgorithm::Jet, greater<double> >::iterator IJ; 00153 00154 vector< PFJetAlgorithm::Jet > tmp2; 00155 fJets.clear(); 00156 00157 for(unsigned i=0; i<tmp.size(); i++) { 00158 if( tmp[i].GetMomentum().Et() > 0 ) 00159 // tmp2.push_back( tmp[i]); 00160 etjets.insert( make_pair(tmp[i].GetMomentum().Et(), tmp[i]) ); 00161 } 00162 00163 // cout<<"et map : "<<endl; 00164 // for(IJ ij = etjets.begin(); ij != etjets.end(); ij++) { 00165 // cout<<ij->second<<endl; 00166 // } 00167 00168 MergeJets( etjets ); 00169 00170 // for(IJ ij = etjets.begin(); ij != etjets.end(); ij++) { 00171 00172 // const TLorentzVector& mom1 = ij->second.GetMomentum(); 00173 00174 // double eta1 = mom1.Eta(); 00175 // double phi1 = mom1.Phi(); 00176 00177 // IJ closest = etjets.end(); 00178 // double drmin = 99999; 00179 // for(IJ jj = etjets.begin(); jj != etjets.end(); jj++) { 00180 00181 // if( jj == ij ) continue; 00182 00183 // const TLorentzVector& mom2 = jj->second.GetMomentum(); 00184 00185 // double eta2 = mom2.Eta(); 00186 // double phi2 = mom2.Phi(); 00187 00188 // double dr = DeltaR(eta1, phi1, eta2, phi2); 00189 00190 // if(dr<drmin) { 00191 // drmin = dr; 00192 // closest = jj; 00193 // } 00194 00195 // if(closest != etjets.end() ) { 00196 // if ( dr < fConeMerge ) { 00197 // ij->second += jj->second; 00198 // } 00199 // } 00200 // } 00201 // } 00202 00203 // cout<<"et map 2: "<<endl; 00204 for(IJ ij = etjets.begin(); ij != etjets.end(); ij++) { 00205 // cout<<ij->second<<endl; 00206 fJets.push_back(ij->second); 00207 } 00208 00209 // set<int> used; 00210 // for(unsigned i=0; i<tmp2.size(); i++) { 00211 00212 00213 // set<int>::iterator isused = used.find(i); 00214 // if( isused != used.end() ) continue; 00215 00216 // Jet& jet1 = tmp2[i]; 00217 00218 // // cout<<"\t jet "<<jet1<<endl; 00219 00220 00221 // TLorentzVector mom1 = jet1.GetMomentum(); 00222 00223 // double eta1 = mom1.Eta(); 00224 // double phi1 = mom1.Phi(); 00225 00226 // // merge close jets 00227 // for(unsigned j=0; j<tmp2.size(); j++) { 00228 // if(i==j) continue; 00229 // Jet& jet2 = tmp2[j]; 00230 00231 00232 // TLorentzVector mom2 = jet2.GetMomentum(); 00233 00234 // double eta2 = mom2.Eta(); 00235 // double phi2 = mom2.Phi(); 00236 00237 // double dr = DeltaR(eta1, phi1, eta2, phi2); 00238 00239 // // cout<<"\t\t test merge with "<<jet2<<", dr = "<<dr<<endl; 00240 00241 // if ( dr < fConeMerge ) { 00242 // jet1 += jet2; 00243 // used.insert( j ); 00244 // // cout<<"\t\t yes "<<endl; 00245 // } 00246 // else { 00247 // // cout<<"\t\t no "<<endl; 00248 // } 00249 // } 00250 00251 // used.insert( i ); 00252 // fJets.push_back(jet1); 00253 // } 00254 }
void PFJetAlgorithm::Clear | ( | ) | [inline] |
Definition at line 92 of file PFJetAlgorithm.h.
References fAssignedVecs, fEtOrderedSeeds, and fJets.
Referenced by PFRootEventManager::tauBenchmark().
00092 { 00093 fJets.clear(); 00094 fAssignedVecs.clear(); 00095 fEtOrderedSeeds.clear(); 00096 }
double PFJetAlgorithm::DeltaR | ( | double | eta1, | |
double | phi1, | |||
double | eta2, | |||
double | phi2 | |||
) | [static] |
Definition at line 78 of file PFJetAlgorithm.cc.
References Phi_mpi_pi(), and funct::sqrt().
Referenced by Update().
00078 { 00079 double deta = eta1 - eta2; 00080 double dphi = TVector2::Phi_mpi_pi(phi1 - phi2); 00081 return sqrt(deta*deta + dphi*dphi); 00082 }
const std::vector< PFJetAlgorithm::Jet >& PFJetAlgorithm::FindJets | ( | const std::vector< TLorentzVector > * | vecs | ) |
Referenced by PFRootEventManager::tauBenchmark().
double PFJetAlgorithm::GetConeAngle | ( | ) | const [inline] |
const std::vector< PFJetAlgorithm::Jet >& PFJetAlgorithm::GetJets | ( | ) | const [inline] |
void PFJetAlgorithm::MergeJets | ( | std::map< double, PFJetAlgorithm::Jet, std::greater< double > > & | etjets | ) |
Referenced by CleanUp().
void PFJetAlgorithm::SetConeAngle | ( | double | coneAngle | ) | [inline] |
Definition at line 83 of file PFJetAlgorithm.h.
References fConeAngle.
Referenced by PFRootEventManager::readOptions().
00083 {fConeAngle = coneAngle;}
void PFJetAlgorithm::SetConeMerge | ( | double | coneMerge | ) | [inline] |
Definition at line 85 of file PFJetAlgorithm.h.
References fConeMerge.
Referenced by PFRootEventManager::readOptions().
00085 {fConeMerge = coneMerge;}
void PFJetAlgorithm::SetSeedEt | ( | double | et | ) | [inline] |
Definition at line 84 of file PFJetAlgorithm.h.
References fSeedEt.
Referenced by PFRootEventManager::readOptions().
00084 {fSeedEt = et;}
void PFJetAlgorithm::Update | ( | ) |
Definition at line 85 of file PFJetAlgorithm.cc.
References PFJetAlgorithm::Jet::Add(), PFJetAlgorithm::Jet::Clear(), DeltaR(), fAllVecs, fAssignedVecs, fConeAngle, fEtOrderedSeeds, fJets, fSeedEt, PFJetAlgorithm::Jet::GetMomentum(), and i.
00085 { 00086 // use existing jets as seeds 00087 // cout<<"clearing seeds"<<endl; 00088 fEtOrderedSeeds.clear(); 00089 for(unsigned ij = 0; ij<fJets.size(); ij++ ) { 00090 double et = fJets[ij].GetMomentum().Et(); 00091 if(et >= fSeedEt) 00092 fEtOrderedSeeds.insert( make_pair(et, ij) ); 00093 } 00094 00095 // loop on seeds and add particles 00096 // cout<<"clearing assigned"<<endl; 00097 for(unsigned i = 0; i<fAssignedVecs.size(); i++) { 00098 fAssignedVecs[i] = -1; 00099 } 00100 00101 // cout<<"loop on seeds"<<endl; 00102 bool needupdate = false; 00103 for(IV iv = fEtOrderedSeeds.begin(); iv != fEtOrderedSeeds.end(); iv++ ) { 00104 00105 Jet& currentjet = fJets[iv->second]; 00106 00107 TLorentzVector seedmom = currentjet.GetMomentum(); 00108 00109 double etaseed = seedmom.Eta(); 00110 double phiseed = seedmom.Phi(); 00111 // cout<<"SEED\t"<<etaseed<<" "<<phiseed<<endl; 00112 00113 currentjet.Clear(); 00114 00115 // adding particles 00116 for(unsigned i = 0; i<fAllVecs->size(); i++) { 00117 00118 if( fAssignedVecs[i] > -1 ) continue; 00119 00120 double dr = DeltaR(etaseed, phiseed, 00121 (*fAllVecs)[i].Eta(), (*fAllVecs)[i].Phi()); 00122 // cout<<"\t\tparticle "<<i<<" "<<dr<<" "<<(*fAllVecs)[i].Et()<<endl; 00123 00124 if( dr < fConeAngle) { 00125 // cout<<"\t\tadding"<<endl; 00126 currentjet.Add(i); 00127 fAssignedVecs[i] = iv->second; 00128 } 00129 } 00130 00131 TLorentzVector deltav = currentjet.GetMomentum(); 00132 deltav -= seedmom; 00133 if(deltav.M() > 0.001) needupdate = true; 00134 } 00135 00136 if(needupdate) Update(); 00137 }
const std::vector<TLorentzVector>* PFJetAlgorithm::fAllVecs [private] |
std::vector< int > PFJetAlgorithm::fAssignedVecs [private] |
double PFJetAlgorithm::fConeAngle [private] |
Definition at line 58 of file PFJetAlgorithm.h.
Referenced by GetConeAngle(), SetConeAngle(), and Update().
double PFJetAlgorithm::fConeMerge [private] |
std::map<double, int, std::greater<double> > PFJetAlgorithm::fEtOrderedSeeds [private] |
std::vector< PFJetAlgorithm::Jet > PFJetAlgorithm::fJets [private] |
double PFJetAlgorithm::fSeedEt [private] |