CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTMuon.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <sstream>
3 #include <istream>
4 #include <fstream>
5 #include <iomanip>
6 #include <string>
7 #include <cmath>
8 #include <functional>
9 #include <stdlib.h>
10 #include <string.h>
11 
13 
15  evtCounter=0;
16 
17  //set parameter defaults
18  _Monte=false;
19  _Debug=false;
20 }
21 
22 /* Setup the analysis to put the branch-variables into the tree. */
23 void HLTMuon::setup(const edm::ParameterSet& pSet, TTree* HltTree) {
24 
25  edm::ParameterSet myEmParams = pSet.getParameter<edm::ParameterSet>("RunParameters") ;
26  std::vector<std::string> parameterNames = myEmParams.getParameterNames() ;
27 
28  for ( std::vector<std::string>::iterator iParam = parameterNames.begin();
29  iParam != parameterNames.end(); iParam++ ){
30  if ( (*iParam) == "Monte" ) _Monte = myEmParams.getParameter<bool>( *iParam );
31  else if ( (*iParam) == "Debug" ) _Debug = myEmParams.getParameter<bool>( *iParam );
32  }
33 
34  const int kMaxMuon = 10000;
35  muonpt = new float[kMaxMuon];
36  muonphi = new float[kMaxMuon];
37  muoneta = new float[kMaxMuon];
38  muonet = new float[kMaxMuon];
39  muone = new float[kMaxMuon];
40  muonchi2NDF = new float[kMaxMuon];
41  muoncharge = new float[kMaxMuon];
42  muonTrkIsoR03 = new float[kMaxMuon];
43  muonECalIsoR03 = new float[kMaxMuon];
44  muonHCalIsoR03 = new float[kMaxMuon];
45  muonD0 = new float[kMaxMuon];
46  muontype = new int[kMaxMuon];
47  muonNValidTrkHits = new int[kMaxMuon];
48  muonNValidMuonHits = new int[kMaxMuon];
49  const int kMaxMuonL2 = 500;
50  muonl2pt = new float[kMaxMuonL2];
51  muonl2phi = new float[kMaxMuonL2];
52  muonl2eta = new float[kMaxMuonL2];
53  muonl2dr = new float[kMaxMuonL2];
54  muonl2dz = new float[kMaxMuonL2];
55  muonl2chg = new int[kMaxMuonL2];
56  muonl2pterr = new float[kMaxMuonL2];
57  muonl2iso = new int[kMaxMuonL2];
58  muonl21idx = new int[kMaxMuonL2];
59  const int kMaxMuonL3 = 500;
60  muonl3pt = new float[kMaxMuonL3];
61  muonl3phi = new float[kMaxMuonL3];
62  muonl3eta = new float[kMaxMuonL3];
63  muonl3dr = new float[kMaxMuonL3];
64  muonl3dz = new float[kMaxMuonL3];
65  muonl3chg = new int[kMaxMuonL3];
66  muonl3pterr = new float[kMaxMuonL3];
67  muonl3iso = new int[kMaxMuonL3];
68  muonl32idx = new int[kMaxMuonL3];
69  const int kMaxOniaPixel = 500;
70  oniaPixelpt = new float[kMaxOniaPixel];
71  oniaPixelphi = new float[kMaxOniaPixel];
72  oniaPixeleta = new float[kMaxOniaPixel];
73  oniaPixeldr = new float[kMaxOniaPixel];
74  oniaPixeldz = new float[kMaxOniaPixel];
75  oniaPixelchg = new int[kMaxOniaPixel];
76  oniaPixelHits = new int[kMaxOniaPixel];
77  oniaPixelNormChi2 = new float[kMaxOniaPixel];
78  const int kMaxTrackPixel = 500;
79  oniaTrackpt = new float[kMaxTrackPixel];
80  oniaTrackphi = new float[kMaxTrackPixel];
81  oniaTracketa = new float[kMaxTrackPixel];
82  oniaTrackdr = new float[kMaxTrackPixel];
83  oniaTrackdz = new float[kMaxTrackPixel];
84  oniaTrackchg = new int[kMaxTrackPixel];
85  oniaTrackHits = new int[kMaxTrackPixel];
86  oniaTrackNormChi2 = new float[kMaxTrackPixel];
87  const int kMaxMuonL2NoVtx = 500;
88  muonl2novtxpt = new float[kMaxMuonL2NoVtx];
89  muonl2novtxphi = new float[kMaxMuonL2NoVtx];
90  muonl2novtxeta = new float[kMaxMuonL2NoVtx];
91  muonl2novtxdr = new float[kMaxMuonL2NoVtx];
92  muonl2novtxdz = new float[kMaxMuonL2NoVtx];
93  muonl2novtxchg = new int[kMaxMuonL2NoVtx];
94  muonl2novtxpterr = new float[kMaxMuonL2NoVtx];
95  muonl2novtx1idx = new int[kMaxMuonL2NoVtx];
96 
97  // Muon-specific branches of the tree
98  HltTree->Branch("NrecoMuon",&nmuon,"NrecoMuon/I");
99  HltTree->Branch("recoMuonPt",muonpt,"recoMuonPt[NrecoMuon]/F");
100  HltTree->Branch("recoMuonPhi",muonphi,"recoMuonPhi[NrecoMuon]/F");
101  HltTree->Branch("recoMuonEta",muoneta,"recoMuonEta[NrecoMuon]/F");
102  HltTree->Branch("recoMuonEt",muonet,"recoMuonEt[NrecoMuon]/F");
103  HltTree->Branch("recoMuonE",muone,"recoMuonE[NrecoMuon]/F");
104  HltTree->Branch("recoMuonChi2NDF", muonchi2NDF, "recoMuonChi2NDF[NrecoMuon]/F");
105  HltTree->Branch("recoMuonCharge", muoncharge , "recoMuonCharge[NrecoMuon]/F");
106  HltTree->Branch("recoMuonTrkIsoR03", muonTrkIsoR03 , "recoMuonTrkIsoR03[NrecoMuon]/F");
107  HltTree->Branch("recoMuonECalIsoR03", muonECalIsoR03 , "recoMuonECalIsoR03[NrecoMuon]/F");
108  HltTree->Branch("recoMuonHCalIsoR03", muonHCalIsoR03 , "recoMuonHCalIsoR03[NrecoMuon]/F");
109  HltTree->Branch("recoMuonD0", muonD0 , "recoMuonD0[NrecoMuon]/F");
110  HltTree->Branch("recoMuonType", muontype , "recoMuonType[NrecoMuon]/I");
111  HltTree->Branch("recoMuonNValidTrkHits", muonNValidTrkHits, "recoMuonNValidTrkHits[NrecoMuon]/I");
112  HltTree->Branch("recoMuonNValidMuonHits", muonNValidMuonHits,"recoMuonNValidMuonHits[NrecoMuon]/I");
113 
114  HltTree->Branch("NohMuL2",&nmu2cand,"NohMuL2/I");
115  HltTree->Branch("ohMuL2Pt",muonl2pt,"ohMuL2Pt[NohMuL2]/F");
116  HltTree->Branch("ohMuL2Phi",muonl2phi,"ohMuL2Phi[NohMuL2]/F");
117  HltTree->Branch("ohMuL2Eta",muonl2eta,"ohMuL2Eta[NohMuL2]/F");
118  HltTree->Branch("ohMuL2Chg",muonl2chg,"ohMuL2Chg[NohMuL2]/I");
119  HltTree->Branch("ohMuL2PtErr",muonl2pterr,"ohMuL2PtErr[NohMuL2]/F");
120  HltTree->Branch("ohMuL2Iso",muonl2iso,"ohMuL2Iso[NohMuL2]/I");
121  HltTree->Branch("ohMuL2Dr",muonl2dr,"ohMuL2Dr[NohMuL2]/F");
122  HltTree->Branch("ohMuL2Dz",muonl2dz,"ohMuL2Dz[NohMuL2]/F");
123  HltTree->Branch("ohMuL2L1idx",muonl21idx,"ohMuL2L1idx[NohMuL2]/I");
124  HltTree->Branch("NohMuL3",&nmu3cand,"NohMuL3/I");
125  HltTree->Branch("ohMuL3Pt",muonl3pt,"ohMuL3Pt[NohMuL3]/F");
126  HltTree->Branch("ohMuL3Phi",muonl3phi,"ohMuL3Phi[NohMuL3]/F");
127  HltTree->Branch("ohMuL3Eta",muonl3eta,"ohMuL3Eta[NohMuL3]/F");
128  HltTree->Branch("ohMuL3Chg",muonl3chg,"ohMuL3Chg[NohMuL3]/I");
129  HltTree->Branch("ohMuL3PtErr",muonl3pterr,"ohMuL3PtErr[NohMuL3]/F");
130  HltTree->Branch("ohMuL3Iso",muonl3iso,"ohMuL3Iso[NohMuL3]/I");
131  HltTree->Branch("ohMuL3Dr",muonl3dr,"ohMuL3Dr[NohMuL3]/F");
132  HltTree->Branch("ohMuL3Dz",muonl3dz,"ohMuL3Dz[NohMuL3]/F");
133  HltTree->Branch("ohMuL3L2idx",muonl32idx,"ohMuL3L2idx[NohMuL3]/I");
134  HltTree->Branch("NohOniaPixel",&nOniaPixelCand,"NohOniaPixel/I");
135  HltTree->Branch("ohOniaPixelPt",oniaPixelpt,"ohOniaPixelPt[NohOniaPixel]/F");
136  HltTree->Branch("ohOniaPixelPhi",oniaPixelphi,"ohOniaPixelPhi[NohOniaPixel]/F");
137  HltTree->Branch("ohOniaPixelEta",oniaPixeleta,"ohOniaPixelEta[NohOniaPixel]/F");
138  HltTree->Branch("ohOniaPixelChg",oniaPixelchg,"ohOniaPixelChg[NohOniaPixel]/I");
139  HltTree->Branch("ohOniaPixelDr",oniaPixeldr,"ohOniaPixelDr[NohOniaPixel]/F");
140  HltTree->Branch("ohOniaPixelDz",oniaPixeldz,"ohOniaPixelDz[NohOniaPixel]/F");
141  HltTree->Branch("ohOniaPixelHits",oniaPixelHits,"ohOniaPixelHits[NohOniaPixel]/I");
142  HltTree->Branch("ohOniaPixelNormChi2",oniaPixelNormChi2,"ohOniaPixelNormChi2[NohOniaPixel]/F");
143  HltTree->Branch("NohOniaTrack",&nOniaTrackCand,"NohOniaTrack/I");
144  HltTree->Branch("ohOniaTrackPt",oniaTrackpt,"ohOniaTrackPt[NohOniaTrack]/F");
145  HltTree->Branch("ohOniaTrackPhi",oniaTrackphi,"ohOniaTrackPhi[NohOniaTrack]/F");
146  HltTree->Branch("ohOniaTrackEta",oniaTracketa,"ohOniaTrackEta[NohOniaTrack]/F");
147  HltTree->Branch("ohOniaTrackChg",oniaTrackchg,"ohOniaTrackChg[NohOniaTrack]/I");
148  HltTree->Branch("ohOniaTrackDr",oniaTrackdr,"ohOniaTrackDr[NohOniaTrack]/F");
149  HltTree->Branch("ohOniaTrackDz",oniaTrackdz,"ohOniaTrackDz[NohOniaTrack]/F");
150  HltTree->Branch("ohOniaTrackHits",oniaTrackHits,"ohOniaTrackHits[NohOniaTrack]/I");
151  HltTree->Branch("ohOniaTrackNormChi2",oniaTrackNormChi2,"ohOniaTrackNormChi2[NohOniaTrack]/F");
152  HltTree->Branch("NohMuL2NoVtx",&nmu2cand,"NohMuL2NoVtx/I");
153  HltTree->Branch("ohMuL2NoVtxPt",muonl2novtxpt,"ohMuL2NoVtxPt[NohMuL2NoVtx]/F");
154  HltTree->Branch("ohMuL2NoVtxPhi",muonl2novtxphi,"ohMuL2NoVtxPhi[NohMuL2NoVtx]/F");
155  HltTree->Branch("ohMuL2NoVtxEta",muonl2novtxeta,"ohMuL2NoVtxEta[NohMuL2NoVtx]/F");
156  HltTree->Branch("ohMuL2NoVtxChg",muonl2novtxchg,"ohMuL2NoVtxChg[NohMuL2NoVtx]/I");
157  HltTree->Branch("ohMuL2NoVtxPtErr",muonl2novtxpterr,"ohMuL2NoVtxPtErr[NohMuL2NoVtx]/F");
158  HltTree->Branch("ohMuL2NoVtxDr",muonl2novtxdr,"ohMuL2NoVtxDr[NohMuL2NoVtx]/F");
159  HltTree->Branch("ohMuL2NoVtxDz",muonl2novtxdz,"ohMuL2NoVtxDz[NohMuL2NoVtx]/F");
160  HltTree->Branch("ohMuL2NoVtxL1idx",muonl2novtx1idx,"ohMuL2NoVtxL1idx[NohMuL2NoVtx]/I");
161 
162 }
163 
164 /* **Analyze the event** */
168  const edm::Handle<edm::ValueMap<bool> > & isoMap2,
170  const edm::Handle<edm::ValueMap<bool> > & isoMap3,
174  const reco::BeamSpot::Point & BSPosition,
175  TTree* HltTree) {
176 
177  //std::cout << " Beginning HLTMuon " << std::endl;
178 
179  if (Muon.isValid()) {
180  reco::MuonCollection mymuons;
181  mymuons = * Muon;
182  std::sort(mymuons.begin(),mymuons.end(),PtGreater());
183  nmuon = mymuons.size();
184  typedef reco::MuonCollection::const_iterator muiter;
185  int imu=0;
186  for (muiter i=mymuons.begin(); i!=mymuons.end(); i++)
187  {
188  muonpt[imu] = i->pt();
189  muonphi[imu] = i->phi();
190  muoneta[imu] = i->eta();
191  muonet[imu] = i->et();
192  muone[imu] = i->energy();
193  muontype[imu] = i->type();
194  muoncharge[imu] = i->charge();
195  muonTrkIsoR03[imu] = i->isolationR03().sumPt;
196  muonECalIsoR03[imu] = i->isolationR03().emEt;
197  muonHCalIsoR03[imu] = i->isolationR03().hadEt;
198 
199 
200  if (i->globalTrack().isNonnull())
201  {
202  muonchi2NDF[imu] = i->globalTrack()->normalizedChi2();
203  muonD0[imu] = i->globalTrack()->dxy(BSPosition);
204  }
205  else
206  {
207  muonchi2NDF[imu] = -99.;
208  muonD0[imu] = -99.;}
209 
210  if (i->innerTrack().isNonnull()) muonNValidTrkHits[imu] = i->innerTrack()->numberOfValidHits();
211  else muonNValidTrkHits[imu] = -99;
212 
213  if (i->isGlobalMuon()!=0) muonNValidMuonHits[imu] = i->globalTrack()->hitPattern().numberOfValidMuonHits();
214  else muonNValidMuonHits[imu] = -99;
215 
216  imu++;
217  }
218  }
219  else {nmuon = 0;}
220 
222  myMucands1 = * MuCands1;
223  // reco::RecoChargedCandidateCollection myMucands1;
224  std::sort(myMucands1.begin(),myMucands1.end(),PtGreater());
225 
227 
228  // Dealing with L2 muons
230  if (MuCands2.isValid()) {
231 // reco::RecoChargedCandidateCollection myMucands2;
232  myMucands2 = * MuCands2;
233  std::sort(myMucands2.begin(),myMucands2.end(),PtGreater());
234  nmu2cand = myMucands2.size();
235  typedef reco::RecoChargedCandidateCollection::const_iterator cand;
236  int imu2c=0;
237  for (cand i=myMucands2.begin(); i!=myMucands2.end(); i++) {
238  reco::TrackRef tk = i->get<reco::TrackRef>();
239 
240  muonl2pt[imu2c] = tk->pt();
241  // eta (we require |eta|<2.5 in all filters
242  muonl2eta[imu2c] = tk->eta();
243  muonl2phi[imu2c] = tk->phi();
244 
245  // Dr (transverse distance to (0,0,0))
246  // For baseline triggers, we do no cut at L2 (|dr|<9999 cm)
247  // However, we use |dr|<200 microns at L3, which it probably too tough for LHC startup
248  muonl2dr[imu2c] = fabs(tk->dxy(BSPosition));
249 
250  // Dz (longitudinal distance to z=0 when at minimum transverse distance)
251  // For baseline triggers, we do no cut (|dz|<9999 cm), neither at L2 nor at L3
252  muonl2dz[imu2c] = tk->dz(BSPosition);
253 
254  // At present we do not cut on this, but on a 90% CL value "ptLx" defined here below
255  // We should change this in the future and cut directly on "pt", to avoid unnecessary complications and risks
256  // Baseline cuts (HLT exercise):
257  // Relaxed Single muon: ptLx>16 GeV
258  // Isolated Single muon: ptLx>11 GeV
259  // Relaxed Double muon: ptLx>3 GeV
260  double l2_err0 = tk->error(0); // error on q/p
261  double l2_abspar0 = fabs(tk->parameter(0)); // |q/p|
262 // double ptLx = tk->pt();
263  // convert 50% efficiency threshold to 90% efficiency threshold
264  // For L2 muons: nsigma_Pt_ = 3.9
265 // double nsigma_Pt_ = 3.9;
266  // For L3 muons: nsigma_Pt_ = 2.2
267  // these are the old TDR values for nsigma_Pt_
268  // We know that these values are slightly smaller for CMSSW
269  // But as quoted above, we want to get rid of this gymnastics in the future
270 // if (abspar0>0) ptLx += nsigma_Pt_*err0/abspar0*tk->pt();
271 
272  // Charge
273  // We use the charge in some dimuon paths
274  muonl2pterr[imu2c] = l2_err0/l2_abspar0;
275  muonl2chg[imu2c] = tk->charge();
276 
277  if (isoMap2.isValid()){
278  // Isolation flag (this is a bool value: true => isolated)
279  edm::ValueMap<bool> ::value_type muon1IsIsolated = (*isoMap2)[tk];
280  muonl2iso[imu2c] = muon1IsIsolated;
281  }
282  else {muonl2iso[imu2c] = -999;}
283 
284  //JH
286  int il2 = 0;
287  //find the corresponding L1
288  l1 = tk->seedRef().castTo<edm::Ref< L2MuonTrajectorySeedCollection> >()->l1Particle();
289  il2++;
290  int imu1idx = 0;
291  if (MuCands1.isValid()) {
292  typedef l1extra::L1MuonParticleCollection::const_iterator candl1;
293  for (candl1 j=myMucands1.begin(); j!=myMucands1.end(); j++) {
294  if((j->pt() == l1->pt()) &&
295  (j->eta() == l1->eta()) &&
296  (j->phi() == l1->phi()) &&
297  (j->gmtMuonCand().quality() == l1->gmtMuonCand().quality()))
298  {break;}
299  // std::cout << << std::endl;
300  // if ( tkl1 == l1 ) {break;}
301  imu1idx++;
302  }
303  }
304  else {imu1idx = -999;}
305  muonl21idx[imu2c] = imu1idx; // Index of the L1 muon having matched with the L2 muon with index imu2c
306  //end JH
307 
308  imu2c++;
309  }
310  }
311  else {nmu2cand = 0;}
312 
313  // Dealing with L3 muons
315  if (MuCands3.isValid()) {
316  myMucands3 = * MuCands3;
317  std::sort(myMucands3.begin(),myMucands3.end(),PtGreater());
318  nmu3cand = myMucands3.size();
319  typedef reco::RecoChargedCandidateCollection::const_iterator cand;
320  int imu3c=0;
321  for (cand i=myMucands3.begin(); i!=myMucands3.end(); i++) {
322  reco::TrackRef tk = i->get<reco::TrackRef>();
323 
324  reco::TrackRef staTrack;
325  typedef reco::MuonTrackLinksCollection::const_iterator l3muon;
326  int il3 = 0;
327  //find the corresponding L2 track
328  staTrack = tk->seedRef().castTo<edm::Ref< L3MuonTrajectorySeedCollection> >()->l2Track();
329  il3++;
330  int imu2idx = 0;
331  if (MuCands2.isValid()) {
332  typedef reco::RecoChargedCandidateCollection::const_iterator candl2;
333  for (candl2 i=myMucands2.begin(); i!=myMucands2.end(); i++) {
334  reco::TrackRef tkl2 = i->get<reco::TrackRef>();
335  if ( tkl2 == staTrack ) {break;}
336  imu2idx++;
337  }
338  }
339  else {imu2idx = -999;}
340  muonl32idx[imu3c] = imu2idx; // Index of the L2 muon having matched with the L3 muon with index imu3c
341 
342  muonl3pt[imu3c] = tk->pt();
343  // eta (we require |eta|<2.5 in all filters
344  muonl3eta[imu3c] = tk->eta();
345  muonl3phi[imu3c] = tk->phi();
346 
347 // // Dr (transverse distance to (0,0,0))
348 // // For baseline triggers, we do no cut at L2 (|dr|<9999 cm)
349 // // However, we use |dr|<300 microns at L3, which it probably too tough for LHC startup
350  muonl3dr[imu3c] = fabs(tk->dxy(BSPosition));
351 
352 // // Dz (longitudinal distance to z=0 when at minimum transverse distance)
353 // // For baseline triggers, we do no cut (|dz|<9999 cm), neither at L2 nor at L3
354  muonl3dz[imu3c] = tk->dz(BSPosition);
355 
356 // // At present we do not cut on this, but on a 90% CL value "ptLx" defined here below
357 // // We should change this in the future and cut directly on "pt", to avoid unnecessary complications and risks
358 // // Baseline cuts (HLT exercise):
359 // // Relaxed Single muon: ptLx>16 GeV
360 // // Isolated Single muon: ptLx>11 GeV
361 // // Relaxed Double muon: ptLx>3 GeV
362  double l3_err0 = tk->error(0); // error on q/p
363  double l3_abspar0 = fabs(tk->parameter(0)); // |q/p|
364 // // double ptLx = tk->pt();
365 // // convert 50% efficiency threshold to 90% efficiency threshold
366 // // For L2 muons: nsigma_Pt_ = 3.9
367 // // For L3 muons: nsigma_Pt_ = 2.2
368 // // double nsigma_Pt_ = 2.2;
369 // // these are the old TDR values for nsigma_Pt_
370 // // We know that these values are slightly smaller for CMSSW
371 // // But as quoted above, we want to get rid of this gymnastics in the future
372 // // if (abspar0>0) ptLx += nsigma_Pt_*err0/abspar0*tk->pt();
373 
374  // Charge
375  // We use the charge in some dimuon paths
376  muonl3pterr[imu3c] = l3_err0/l3_abspar0;
377  muonl3chg[imu3c] = tk->charge();
378 
379  if (isoMap3.isValid()){
380  // Isolation flag (this is a bool value: true => isolated)
381  edm::ValueMap<bool> ::value_type muon1IsIsolated = (*isoMap3)[tk];
382  muonl3iso[imu3c] = muon1IsIsolated;
383  }
384  else {muonl3iso[imu3c] = -999;}
385 
386  imu3c++;
387  }
388  }
389  else {nmu3cand = 0;}
390 
391  // Dealing with L2 no-Vertex muons
392  reco::RecoChargedCandidateCollection muNoVtxMucands2;
393  if (MuNoVtxCands2.isValid()) {
394  muNoVtxMucands2 = * MuNoVtxCands2;
395  std::sort(muNoVtxMucands2.begin(),muNoVtxMucands2.end(),PtGreater());
396  nmu2cand = muNoVtxMucands2.size();
397  typedef reco::RecoChargedCandidateCollection::const_iterator cand;
398  int imu2c=0;
399  for (cand i=muNoVtxMucands2.begin(); i!=muNoVtxMucands2.end(); i++) {
400  reco::TrackRef tk = i->get<reco::TrackRef>();
401 
402  muonl2novtxpt[imu2c] = tk->pt();
403  muonl2novtxeta[imu2c] = tk->eta();
404  muonl2novtxphi[imu2c] = tk->phi();
405  muonl2novtxdr[imu2c] = fabs(tk->dxy(BSPosition));
406  muonl2novtxdz[imu2c] = tk->dz(BSPosition);
407 
408  double l2_err0 = tk->error(0); // error on q/p
409  double l2_abspar0 = fabs(tk->parameter(0)); // |q/p|
410 
411  muonl2novtxpterr[imu2c] = l2_err0/l2_abspar0;
412  muonl2novtxchg[imu2c] = tk->charge();
413 
415  int il2 = 0;
416  //find the corresponding L1
417  l1 = tk->seedRef().castTo<edm::Ref< L2MuonTrajectorySeedCollection> >()->l1Particle();
418  il2++;
419  int imu1idx = 0;
420  if (MuCands1.isValid()) {
421  typedef l1extra::L1MuonParticleCollection::const_iterator candl1;
422  for (candl1 j=myMucands1.begin(); j!=myMucands1.end(); j++) {
423  if((j->pt() == l1->pt()) &&
424  (j->eta() == l1->eta()) &&
425  (j->phi() == l1->phi()) &&
426  (j->gmtMuonCand().quality() == l1->gmtMuonCand().quality()))
427  {break;}
428  imu1idx++;
429  }
430  }
431  else {imu1idx = -999;}
432  muonl2novtx1idx[imu2c] = imu1idx; // Index of the L1 muon having matched with the L2 muon with index imu2c
433 
434  imu2c++;
435  }
436  }
437  else {nmu2cand = 0;}
438 
439 
440 
441  // Dealing with Onia Pixel tracks
442  reco::RecoChargedCandidateCollection myOniaPixelCands;
443  if (oniaPixelCands.isValid()) {
444  myOniaPixelCands = * oniaPixelCands;
445  std::sort(myOniaPixelCands.begin(),myOniaPixelCands.end(),PtGreater());
446  nOniaPixelCand = myOniaPixelCands.size();
447  typedef reco::RecoChargedCandidateCollection::const_iterator cand;
448  int ic=0;
449  for (cand i=myOniaPixelCands.begin(); i!=myOniaPixelCands.end(); i++) {
450  reco::TrackRef tk = i->get<reco::TrackRef>();
451 
452  oniaPixelpt[ic] = tk->pt();
453  oniaPixeleta[ic] = tk->eta();
454  oniaPixelphi[ic] = tk->phi();
455  oniaPixeldr[ic] = tk->dxy(BSPosition);
456  oniaPixeldz[ic] = tk->dz(BSPosition);
457  oniaPixelchg[ic] = tk->charge();
458  oniaPixelHits[ic] = tk->numberOfValidHits();
459  oniaPixelNormChi2[ic] = tk->normalizedChi2();
460 
461  ic++;
462  }
463  }
464  else {nOniaPixelCand = 0;}
465 
466  // Dealing with Onia Tracks
467  reco::RecoChargedCandidateCollection myOniaTrackCands;
468  if (oniaTrackCands.isValid()) {
469  myOniaTrackCands = * oniaTrackCands;
470  std::sort(myOniaTrackCands.begin(),myOniaTrackCands.end(),PtGreater());
471  nOniaTrackCand = myOniaTrackCands.size();
472  typedef reco::RecoChargedCandidateCollection::const_iterator cand;
473  int ic=0;
474  for (cand i=myOniaTrackCands.begin(); i!=myOniaTrackCands.end(); i++) {
475  reco::TrackRef tk = i->get<reco::TrackRef>();
476 
477  oniaTrackpt[ic] = tk->pt();
478  oniaTracketa[ic] = tk->eta();
479  oniaTrackphi[ic] = tk->phi();
480  oniaTrackdr[ic] = tk->dxy(BSPosition);
481  oniaTrackdz[ic] = tk->dz(BSPosition);
482  oniaTrackchg[ic] = tk->charge();
483  oniaTrackHits[ic] = tk->numberOfValidHits();
484  oniaTrackNormChi2[ic] = tk->normalizedChi2();
485 
486  ic++;
487  }
488  }
489  else {nOniaTrackCand = 0;}
490 
491 
493 
494 
495 
496 }
int * muonl32idx
Definition: HLTMuon.h:79
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
int * muonl2iso
Definition: HLTMuon.h:79
float * muonl2novtxdr
Definition: HLTMuon.h:76
float * muonchi2NDF
Definition: HLTMuon.h:71
int * muonl2chg
Definition: HLTMuon.h:79
float * oniaPixelNormChi2
Definition: HLTMuon.h:81
float * oniaTrackdr
Definition: HLTMuon.h:82
float * muonl2novtxpterr
Definition: HLTMuon.h:77
float * oniaTrackpt
Definition: HLTMuon.h:82
int * muonNValidTrkHits
Definition: HLTMuon.h:73
float * muonl2pt
Definition: HLTMuon.h:74
int * oniaTrackHits
Definition: HLTMuon.h:83
int * muonl21idx
Definition: HLTMuon.h:79
float * oniaTrackdz
Definition: HLTMuon.h:82
float * muonl3phi
Definition: HLTMuon.h:75
int nmu2cand
Definition: HLTMuon.h:78
float * muonl2eta
Definition: HLTMuon.h:74
float * muonl3pterr
Definition: HLTMuon.h:77
float * oniaPixelpt
Definition: HLTMuon.h:81
int nOniaTrackCand
Definition: HLTMuon.h:80
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:30
float * oniaTrackNormChi2
Definition: HLTMuon.h:82
float * muone
Definition: HLTMuon.h:71
int * muontype
Definition: HLTMuon.h:73
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
int nmu3cand
Definition: HLTMuon.h:78
float * muoncharge
Definition: HLTMuon.h:71
int * muonl2novtxchg
Definition: HLTMuon.h:79
float * oniaTracketa
Definition: HLTMuon.h:82
float * oniaPixeldr
Definition: HLTMuon.h:81
void setup(const edm::ParameterSet &pSet, TTree *tree)
Definition: HLTMuon.cc:23
float * muonl2dz
Definition: HLTMuon.h:74
float * muonHCalIsoR03
Definition: HLTMuon.h:71
float * muonl2pterr
Definition: HLTMuon.h:77
void analyze(const edm::Handle< reco::MuonCollection > &muon, const edm::Handle< l1extra::L1MuonParticleCollection > &mucands1, const edm::Handle< reco::RecoChargedCandidateCollection > &mucands2, const edm::Handle< edm::ValueMap< bool > > &isoMap2, const edm::Handle< reco::RecoChargedCandidateCollection > &mucands3, const edm::Handle< edm::ValueMap< bool > > &isoMap3, const edm::Handle< reco::RecoChargedCandidateCollection > &oniaPixelCands, const edm::Handle< reco::RecoChargedCandidateCollection > &oniaTrackCands, const edm::Handle< reco::RecoChargedCandidateCollection > &munovtxcands2, const reco::BeamSpot::Point &BSPosition, TTree *tree)
Definition: HLTMuon.cc:165
bool _Monte
Definition: HLTMuon.h:87
int * muonl2novtx1idx
Definition: HLTMuon.h:79
int * muonNValidMuonHits
Definition: HLTMuon.h:73
int j
Definition: DBlmapReader.cc:9
float * muonl3pt
Definition: HLTMuon.h:75
std::vector< std::string > getParameterNames() const
bool isValid() const
Definition: HandleBase.h:76
Container::value_type value_type
float * muonl2novtxeta
Definition: HLTMuon.h:76
float * muonpt
Definition: HLTMuon.h:71
float * muonTrkIsoR03
Definition: HLTMuon.h:71
float * muonl2novtxpt
Definition: HLTMuon.h:76
float * oniaPixeleta
Definition: HLTMuon.h:81
int * muonl3chg
Definition: HLTMuon.h:79
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
bool _Debug
Definition: HLTMuon.h:87
float * muonl2novtxdz
Definition: HLTMuon.h:76
float * muonphi
Definition: HLTMuon.h:71
float * muonl3dr
Definition: HLTMuon.h:75
float * muonl2phi
Definition: HLTMuon.h:74
float * oniaPixeldz
Definition: HLTMuon.h:81
HLTMuon()
Definition: HLTMuon.cc:14
float * oniaTrackphi
Definition: HLTMuon.h:82
float * muonl3dz
Definition: HLTMuon.h:75
int nOniaPixelCand
Definition: HLTMuon.h:80
float * muonD0
Definition: HLTMuon.h:71
float * muonECalIsoR03
Definition: HLTMuon.h:71
int * oniaPixelchg
Definition: HLTMuon.h:83
float * muonl3eta
Definition: HLTMuon.h:75
int * muonl3iso
Definition: HLTMuon.h:79
float * muonl2dr
Definition: HLTMuon.h:74
float * muonet
Definition: HLTMuon.h:71
float * oniaPixelphi
Definition: HLTMuon.h:81
float * muonl2novtxphi
Definition: HLTMuon.h:76
int * oniaPixelHits
Definition: HLTMuon.h:83
int * oniaTrackchg
Definition: HLTMuon.h:83
float * muoneta
Definition: HLTMuon.h:71
std::vector< L1MuonParticle > L1MuonParticleCollection
int evtCounter
Definition: HLTMuon.h:89
int nmuon
Definition: HLTMuon.h:78