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::ZMuMuOverlap ( const edm::ParameterSet )
inline

Definition at line 7 of file ZMuMuOverlapExclusion.cc.

7 {}

Member Function Documentation

◆ operator()()

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

Definition at line 8 of file ZMuMuOverlapExclusion.cc.

8  {
9  using namespace std;
10  using namespace reco;
11  // check if a candidate z is different from zMuMu
12  // (for example a Z can be done with two global muons, or with a global muon plus a standalone muon.
13  // if the standalone muon is part of the second global muon in fact this is the same Z)
14 
15  unsigned int nd1 = zMuMu.numberOfDaughters();
16  unsigned int nd2 = z.numberOfDaughters();
17 
18  assert(nd1 == 2 && nd2 == 2);
19  const int maxd = 2;
20  const Candidate* daughters1[maxd];
21  const Candidate* daughters2[maxd];
22  TrackRef trackerTrack1[maxd];
23  TrackRef stAloneTrack1[maxd];
24  TrackRef globalTrack1[maxd];
25  TrackRef trackerTrack2[maxd];
26  TrackRef stAloneTrack2[maxd];
27  TrackRef globalTrack2[maxd];
28  bool flag;
29  unsigned int matched = 0;
30 
31  for (unsigned int i = 0; i < nd1; ++i) {
32  daughters1[i] = zMuMu.daughter(i);
33  trackerTrack1[i] = daughters1[i]->get<TrackRef>();
34  stAloneTrack1[i] = daughters1[i]->get<TrackRef, reco::StandAloneMuonTag>();
35  globalTrack1[i] = daughters1[i]->get<TrackRef, reco::CombinedMuonTag>();
36 
37  /*********************************************** just used for debug ********************
38  if (trackerTrack1[i].isNull())
39  cout << "in ZMuMu daughter " << i << " tracker ref non found " << endl;
40  else
41  cout << "in ZMuMu daughter " << i << " tracker ref FOUND"
42  << " id: " << trackerTrack1[i].id() << ", index: " << trackerTrack1[i].key()
43  << endl;
44  if (stAloneTrack1[i].isNull())
45  cout << "in ZMuMu daughter " << i << " stalone ref non found " << endl;
46  else
47  cout << "in ZMuMu daughter " << i << " stalone ref FOUND"
48  << " id: " << stAloneTrack1[i].id() << ", index: " << stAloneTrack1[i].key()
49  << endl;
50 
51  if (globalTrack1[i].isNull())
52  cout << "in ZMuMu daughter " << i << " global ref non found " << endl;
53  else
54  cout << "in ZMuMu daughter " << i << " global ref FOUND"
55  << " id: " << globalTrack1[i].id() << ", index: " << globalTrack1[i].key()
56  << endl;
57  */
58  }
59  for (unsigned int i = 0; i < nd2; ++i) {
60  daughters2[i] = z.daughter(i);
61  trackerTrack2[i] = daughters2[i]->get<TrackRef>();
62  stAloneTrack2[i] = daughters2[i]->get<TrackRef, reco::StandAloneMuonTag>();
63  globalTrack2[i] = daughters2[i]->get<TrackRef, reco::CombinedMuonTag>();
64 
65  /******************************************** just used for debug ************
66  if (trackerTrack2[i].isNull())
67  cout << "in ZMuSta daughter " << i << " tracker ref non found " << endl;
68  else
69  cout << "in ZMuSta daughter " << i << " tracker ref FOUND"
70  << " id: " << trackerTrack2[i].id() << ", index: " << trackerTrack2[i].key()
71  << endl;
72  if (stAloneTrack2[i].isNull())
73  cout << "in ZMuSta daughter " << i << " standalone ref non found " << endl;
74  else
75  cout << "in ZMuSta daughter " << i << " standalone ref FOUND"
76  << " id: " << stAloneTrack2[i].id() << ", index: " << stAloneTrack2[i].key()
77  << endl;
78 
79  if (globalTrack2[i].isNull())
80  cout << "in ZMuSta daughter " << i << " global ref non found " << endl;
81  else
82  cout << "in ZMuSta daughter " << i << " global ref FOUND"
83  << " id: " << globalTrack2[i].id() << ", index: " << globalTrack2[i].key()
84  << endl;
85 
86  */
87  }
88  for (unsigned int i = 0; i < nd1; i++) {
89  flag = false;
90  for (unsigned int j = 0; j < nd2;
91  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)
98  matched++;
99  }
100  if (matched == nd1) // return true if all the childrens of the ZMuMu have a children matched in ZMuXX
101  return true;
102  else
103  return false;
104  }

References cms::cuda::assert(), RemoveAddSevLevel::flag, reco::Candidate::get(), mps_fire::i, edm::Ref< C, T, F >::id(), dqmiolumiharvest::j, crabWrapper::key, edm::Ref< C, T, F >::key(), muonTagProbeFilters_cff::matched, z, and ZMuMuAnalysisNtupler_cff::zMuMu.

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
reco::CombinedMuonTag
conbined muon component tag
Definition: RecoCandidate.h:79
mps_fire.i
i
Definition: mps_fire.py:428
ZMuMuAnalysisNtupler_cff.zMuMu
zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
Definition: ZMuMuAnalysisNtupler_cff.py:340
cms::cuda::assert
assert(be >=bs)
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Ref< TrackCollection >
reco::StandAloneMuonTag
stand alone muon component tag
Definition: RecoCandidate.h:77
DDAxes::z
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
reco::Candidate
Definition: Candidate.h:27
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
std
Definition: JetResolutionObject.h:76
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
crabWrapper.key
key
Definition: crabWrapper.py:19
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116