Public Member Functions | |
bool | operator() (const reco::Candidate &zMuMu, const reco::Candidate &z) const |
ZMuMuOverlap (const edm::ParameterSet &) |
Definition at line 6 of file ZMuMuOverlapExclusion.cc.
ZMuMuOverlap::ZMuMuOverlap | ( | const edm::ParameterSet & | ) | [inline] |
bool ZMuMuOverlap::operator() | ( | const reco::Candidate & | zMuMu, | |
const reco::Candidate & | z | |||
) | const [inline] |
Definition at line 8 of file ZMuMuOverlapExclusion.cc.
References reco::Candidate::daughter(), i, j, reco::Candidate::numberOfDaughters(), HcalSimpleRecAlgoImpl::reco(), and std.
00008 { 00009 00010 using namespace std; 00011 using namespace reco; 00012 // check if a candidate z is different from zMuMu 00013 // (for example a Z can be done with two global muons, or with a global muon plus a standalone muon. 00014 // if the standalone muon is part of the second global muon in fact this is the same Z) 00015 00016 size_t nd1 = zMuMu.numberOfDaughters(); 00017 size_t nd2 = z.numberOfDaughters(); 00018 00019 assert(nd1==2 && nd2==2); 00020 const int maxd = 2; 00021 const Candidate * daughters1[maxd]; 00022 const Candidate * daughters2[maxd]; 00023 TrackRef trackerTrack1[maxd]; 00024 TrackRef stAloneTrack1[maxd]; 00025 TrackRef globalTrack1[maxd]; 00026 TrackRef trackerTrack2[maxd]; 00027 TrackRef stAloneTrack2[maxd]; 00028 TrackRef globalTrack2[maxd]; 00029 bool flag; 00030 size_t matched=0; 00031 00032 for( size_t i = 0; i < nd1; ++ i ) { 00033 daughters1[i] = zMuMu.daughter( i ); 00034 trackerTrack1[i] = daughters1[i]->get<TrackRef>(); 00035 stAloneTrack1[i] = daughters1[i]->get<TrackRef,reco::StandAloneMuonTag>(); 00036 globalTrack1[i] = daughters1[i]->get<TrackRef,reco::CombinedMuonTag>(); 00037 00038 /*********************************************** just used for debug ******************** 00039 if (trackerTrack1[i].isNull()) 00040 cout << "in ZMuMu daughter " << i << " tracker ref non found " << endl; 00041 else 00042 cout << "in ZMuMu daughter " << i << " tracker ref FOUND" 00043 << " id: " << trackerTrack1[i].id() << ", index: " << trackerTrack1[i].key() 00044 << endl; 00045 if (stAloneTrack1[i].isNull()) 00046 cout << "in ZMuMu daughter " << i << " stalone ref non found " << endl; 00047 else 00048 cout << "in ZMuMu daughter " << i << " stalone ref FOUND" 00049 << " id: " << stAloneTrack1[i].id() << ", index: " << stAloneTrack1[i].key() 00050 << endl; 00051 00052 if (globalTrack1[i].isNull()) 00053 cout << "in ZMuMu daughter " << i << " global ref non found " << endl; 00054 else 00055 cout << "in ZMuMu daughter " << i << " global ref FOUND" 00056 << " id: " << globalTrack1[i].id() << ", index: " << globalTrack1[i].key() 00057 << endl; 00058 */ 00059 } 00060 for( size_t i = 0; i < nd2; ++ i ) { 00061 daughters2[i] = z.daughter( i ); 00062 trackerTrack2[i] = daughters2[i]->get<TrackRef>(); 00063 stAloneTrack2[i] = daughters2[i]->get<TrackRef,reco::StandAloneMuonTag>(); 00064 globalTrack2[i] = daughters2[i]->get<TrackRef,reco::CombinedMuonTag>(); 00065 00066 /******************************************** just used for debug ************ 00067 if (trackerTrack2[i].isNull()) 00068 cout << "in ZMuSta daughter " << i << " tracker ref non found " << endl; 00069 else 00070 cout << "in ZMuSta daughter " << i << " tracker ref FOUND" 00071 << " id: " << trackerTrack2[i].id() << ", index: " << trackerTrack2[i].key() 00072 << endl; 00073 if (stAloneTrack2[i].isNull()) 00074 cout << "in ZMuSta daughter " << i << " standalone ref non found " << endl; 00075 else 00076 cout << "in ZMuSta daughter " << i << " standalone ref FOUND" 00077 << " id: " << stAloneTrack2[i].id() << ", index: " << stAloneTrack2[i].key() 00078 << endl; 00079 00080 if (globalTrack2[i].isNull()) 00081 cout << "in ZMuSta daughter " << i << " global ref non found " << endl; 00082 else 00083 cout << "in ZMuSta daughter " << i << " global ref FOUND" 00084 << " id: " << globalTrack2[i].id() << ", index: " << globalTrack2[i].key() 00085 << endl; 00086 00087 */ 00088 } 00089 for (size_t i = 0; i < nd1; i++) { 00090 flag = false; 00091 for (size_t j = 0; j < nd2; j++) { // if the obj2 is a standalone the trackref is alwais in the trackerTRack position 00092 if (trackerTrack2[i].id()==trackerTrack1[j].id() && trackerTrack2[i].key()==trackerTrack1[j].key() || 00093 trackerTrack2[i].id()==stAloneTrack1[j].id() && trackerTrack2[i].key()==stAloneTrack1[j].key()) { 00094 flag = true; 00095 } 00096 } 00097 if (flag) matched++; 00098 } 00099 if (matched==nd1) // return true if all the childrens of the ZMuMu have a children matched in ZMuXX 00100 return true; 00101 else 00102 return false; 00103 }