CMS 3D CMS Logo

List of all members | Public Member Functions
ZMuMuOverlap Struct Reference

Public Member Functions

bool operator() (const reco::Candidate &zMuMu, const reco::Candidate &z) const
 
 ZMuMuOverlap (const edm::ParameterSet &)
 

Detailed Description

Definition at line 6 of file ZMuMuOverlapExclusion.cc.

Constructor & Destructor Documentation

ZMuMuOverlap::ZMuMuOverlap ( const edm::ParameterSet )
inline

Definition at line 7 of file ZMuMuOverlapExclusion.cc.

7 { }

Member Function Documentation

bool ZMuMuOverlap::operator() ( const reco::Candidate zMuMu,
const reco::Candidate z 
) const
inline

Definition at line 8 of file ZMuMuOverlapExclusion.cc.

References configurableAnalysis::Candidate, reco::Candidate::daughter(), RemoveAddSevLevel::flag, reco::Candidate::get(), mps_fire::i, edm::Ref< C, T, F >::id(), crabWrapper::key, edm::Ref< C, T, F >::key(), electrons_cff::matched, and reco::Candidate::numberOfDaughters().

8  {
9 
10  using namespace std;
11  using namespace reco;
12  // check if a candidate z is different from zMuMu
13  // (for example a Z can be done with two global muons, or with a global muon plus a standalone muon.
14  // if the standalone muon is part of the second global muon in fact this is the same Z)
15 
16  unsigned int nd1 = zMuMu.numberOfDaughters();
17  unsigned int nd2 = z.numberOfDaughters();
18 
19  assert(nd1==2 && nd2==2);
20  const int maxd = 2;
21  const Candidate * daughters1[maxd];
22  const Candidate * daughters2[maxd];
23  TrackRef trackerTrack1[maxd];
24  TrackRef stAloneTrack1[maxd];
25  TrackRef globalTrack1[maxd];
26  TrackRef trackerTrack2[maxd];
27  TrackRef stAloneTrack2[maxd];
28  TrackRef globalTrack2[maxd];
29  bool flag;
30  unsigned int matched=0;
31 
32  for( unsigned int i = 0; i < nd1; ++ i ) {
33  daughters1[i] = zMuMu.daughter( i );
34  trackerTrack1[i] = daughters1[i]->get<TrackRef>();
35  stAloneTrack1[i] = daughters1[i]->get<TrackRef,reco::StandAloneMuonTag>();
36  globalTrack1[i] = daughters1[i]->get<TrackRef,reco::CombinedMuonTag>();
37 
38  /*********************************************** just used for debug ********************
39  if (trackerTrack1[i].isNull())
40  cout << "in ZMuMu daughter " << i << " tracker ref non found " << endl;
41  else
42  cout << "in ZMuMu daughter " << i << " tracker ref FOUND"
43  << " id: " << trackerTrack1[i].id() << ", index: " << trackerTrack1[i].key()
44  << endl;
45  if (stAloneTrack1[i].isNull())
46  cout << "in ZMuMu daughter " << i << " stalone ref non found " << endl;
47  else
48  cout << "in ZMuMu daughter " << i << " stalone ref FOUND"
49  << " id: " << stAloneTrack1[i].id() << ", index: " << stAloneTrack1[i].key()
50  << endl;
51 
52  if (globalTrack1[i].isNull())
53  cout << "in ZMuMu daughter " << i << " global ref non found " << endl;
54  else
55  cout << "in ZMuMu daughter " << i << " global ref FOUND"
56  << " id: " << globalTrack1[i].id() << ", index: " << globalTrack1[i].key()
57  << endl;
58  */
59  }
60  for( unsigned int i = 0; i < nd2; ++ i ) {
61  daughters2[i] = z.daughter( i );
62  trackerTrack2[i] = daughters2[i]->get<TrackRef>();
63  stAloneTrack2[i] = daughters2[i]->get<TrackRef,reco::StandAloneMuonTag>();
64  globalTrack2[i] = daughters2[i]->get<TrackRef,reco::CombinedMuonTag>();
65 
66  /******************************************** just used for debug ************
67  if (trackerTrack2[i].isNull())
68  cout << "in ZMuSta daughter " << i << " tracker ref non found " << endl;
69  else
70  cout << "in ZMuSta daughter " << i << " tracker ref FOUND"
71  << " id: " << trackerTrack2[i].id() << ", index: " << trackerTrack2[i].key()
72  << endl;
73  if (stAloneTrack2[i].isNull())
74  cout << "in ZMuSta daughter " << i << " standalone ref non found " << endl;
75  else
76  cout << "in ZMuSta daughter " << i << " standalone ref FOUND"
77  << " id: " << stAloneTrack2[i].id() << ", index: " << stAloneTrack2[i].key()
78  << endl;
79 
80  if (globalTrack2[i].isNull())
81  cout << "in ZMuSta daughter " << i << " global ref non found " << endl;
82  else
83  cout << "in ZMuSta daughter " << i << " global ref FOUND"
84  << " id: " << globalTrack2[i].id() << ", index: " << globalTrack2[i].key()
85  << endl;
86 
87  */
88  }
89  for (unsigned int i = 0; i < nd1; i++) {
90  flag = false;
91  for (unsigned int j = 0; j < nd2; j++) { // if the obj2 is a standalone the trackref is alwais in the trackerTRack position
92  if ( ((trackerTrack2[i].id()==trackerTrack1[j].id()) && (trackerTrack2[i].key()==trackerTrack1[j].key())) ||
93  ((trackerTrack2[i].id()==stAloneTrack1[j].id()) && (trackerTrack2[i].key()==stAloneTrack1[j].key())) ) {
94  flag = true;
95  }
96  }
97  if (flag) matched++;
98  }
99  if (matched==nd1) // return true if all the childrens of the ZMuMu have a children matched in ZMuXX
100  return true;
101  else
102  return false;
103  }
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
stand alone muon component tag
Definition: RecoCandidate.h:78
key_type key() const
Accessor for product key.
Definition: Ref.h:265
ProductID id() const
Accessor for product ID.
Definition: Ref.h:259
conbined muon component tag
Definition: RecoCandidate.h:80
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
fixed size matrix
T get() const
get a component
Definition: Candidate.h:217
virtual size_type numberOfDaughters() const =0
number of daughters