CMS 3D CMS Logo

IsoTrig.cc
Go to the documentation of this file.
1 // -*- C++ -*-//
2 // Package: IsoTrig
3 // Class: IsoTrig
4 //
12 //
13 // Original Author: Ruchi Gupta
14 // Created: Fri May 25 12:02:48 CDT 2012
15 // $Id$
16 //
17 //
18 //#define DebugLog
19 #include "IsoTrig.h"
20 
21 
28 
30  hltPrescaleProvider_(iConfig, consumesCollector(), *this),
31  changed(false), t_timeL2Prod(0), t_nPixCand(0), t_nPixSeed(0), t_nGoodTk(0),
32  t_TrkhCone(0), t_TrkP(0), t_TrkselTkFlag(0), t_TrkqltyFlag(0),
33  t_TrkMissFlag(0), t_TrkPVFlag(0), t_TrkNuIsolFlag(0),
34  t_PixcandP(0), t_PixcandPt(0), t_PixcandEta(0), t_PixcandPhi(0),
35  t_PixcandMaxP(0), t_PixTrkcandP(0), t_PixTrkcandPt(0), t_PixTrkcandEta(0),
36  t_PixTrkcandPhi(0), t_PixTrkcandMaxP(0), t_PixTrkcandselTk(0),
37  t_NFcandP(0), t_NFcandPt(0), t_NFcandEta(0), t_NFcandPhi(0),
38  t_NFcandEmip(0), t_NFTrkcandP(0), t_NFTrkcandPt(0), t_NFTrkcandEta(0),
39  t_NFTrkcandPhi(0), t_NFTrkcandEmip(0), t_NFTrkMinDR(0), t_NFTrkMinDP1(0),
40  t_NFTrkselTkFlag(0), t_NFTrkqltyFlag(0), t_NFTrkMissFlag(0),
41  t_NFTrkPVFlag(0), t_NFTrkPropFlag(0), t_NFTrkChgIsoFlag(0),
42  t_NFTrkNeuIsoFlag(0), t_NFTrkMipFlag(0), t_ECone(0) {
43  //now do whatever initialization is neededOA
44  trigNames = iConfig.getUntrackedParameter<std::vector<std::string> >("Triggers");
45  PixcandTag_ = iConfig.getParameter<edm::InputTag> ("PixcandTag");
46  L1candTag_ = iConfig.getParameter<edm::InputTag> ("L1candTag");
47  L2candTag_ = iConfig.getParameter<edm::InputTag> ("L2candTag");
48  doL2L3 = iConfig.getUntrackedParameter<bool>("DoL2L3",true);
49  doTiming = iConfig.getUntrackedParameter<bool>("DoTimingTree",true);
50  doMipCutTree = iConfig.getUntrackedParameter<bool>("DoMipCutTree",true);
51  doTrkResTree = iConfig.getUntrackedParameter<bool>("DoTrkResTree",true);
52  doChgIsolTree = iConfig.getUntrackedParameter<bool>("DoChgIsolTree",true);
53  doStudyIsol = iConfig.getUntrackedParameter<bool>("DoStudyIsol",true);
54  verbosity = iConfig.getUntrackedParameter<int>("Verbosity",0);
55  theTrackQuality = iConfig.getUntrackedParameter<std::string>("TrackQuality","highPurity");
56  processName = iConfig.getUntrackedParameter<std::string>("ProcessName","HLT");
58  selectionParameters.minPt = iConfig.getUntrackedParameter<double>("MinTrackPt", 10.0);
59  selectionParameters.minQuality = trackQuality_;
60  selectionParameters.maxDxyPV = iConfig.getUntrackedParameter<double>("MaxDxyPV", 0.2);
61  selectionParameters.maxDzPV = iConfig.getUntrackedParameter<double>("MaxDzPV", 5.0);
62  selectionParameters.maxChi2 = iConfig.getUntrackedParameter<double>("MaxChi2", 5.0);
63  selectionParameters.maxDpOverP = iConfig.getUntrackedParameter<double>("MaxDpOverP", 0.1);
64  selectionParameters.minOuterHit = iConfig.getUntrackedParameter<int>("MinOuterHit", 4);
65  selectionParameters.minLayerCrossed = iConfig.getUntrackedParameter<int>("MinLayerCrossed", 8);
66  selectionParameters.maxInMiss = iConfig.getUntrackedParameter<int>("MaxInMiss", 0);
67  selectionParameters.maxOutMiss = iConfig.getUntrackedParameter<int>("MaxOutMiss", 0);
68  dr_L1 = iConfig.getUntrackedParameter<double>("IsolationL1",1.0);
69  a_coneR = iConfig.getUntrackedParameter<double>("ConeRadius",34.98);
70  a_charIsoR = a_coneR + 28.9;
71  a_neutIsoR = a_charIsoR*0.726;
72  a_mipR = iConfig.getUntrackedParameter<double>("ConeRadiusMIP",14.0);
73  a_neutR1 = iConfig.getUntrackedParameter<double>("ConeRadiusNeut1",21.0);
74  a_neutR2 = iConfig.getUntrackedParameter<double>("ConeRadiusNeut2",29.0);
75  cutMip = iConfig.getUntrackedParameter<double>("MIPCut", 1.0);
76  cutCharge = iConfig.getUntrackedParameter<double>("ChargeIsolation", 2.0);
77  cutNeutral = iConfig.getUntrackedParameter<double>("NeutralIsolation", 2.0);
78  minRunNo = iConfig.getUntrackedParameter<int>("minRun");
79  maxRunNo = iConfig.getUntrackedParameter<int>("maxRun");
80  pixelTracksSources_ = iConfig.getUntrackedParameter<std::vector<edm::InputTag> >("PixelTracksSources");
81  pixelIsolationConeSizeAtEC_ = iConfig.getUntrackedParameter<std::vector<double> >("PixelIsolationConeSizeAtEC");
82  minPTrackValue_ = iConfig.getUntrackedParameter<double>("MinPTrackValue");
83  vtxCutSeed_ = iConfig.getUntrackedParameter<double>("VertexCutSeed");
84  vtxCutIsol_ = iConfig.getUntrackedParameter<double>("VertexCutIsol");
85  tauUnbiasCone_ = iConfig.getUntrackedParameter<double>("TauUnbiasCone");
86  prelimCone_ = iConfig.getUntrackedParameter<double>("PrelimCone");
87  // define tokens for access
88  tok_lumi = consumes<LumiDetails, edm::InLumi>(edm::InputTag("lumiProducer"));
89  edm::InputTag triggerEvent_ ("hltTriggerSummaryAOD","",processName);
90  tok_trigEvt = consumes<trigger::TriggerEvent>(triggerEvent_);
91  edm::InputTag theTriggerResultsLabel ("TriggerResults","",processName);
92  tok_trigRes = consumes<edm::TriggerResults>(theTriggerResultsLabel);
93  tok_genTrack_ = consumes<reco::TrackCollection>(edm::InputTag("generalTracks"));
94  tok_recVtx_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
95  tok_bs_ = consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"));
96  tok_EB_ = consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit","EcalRecHitsEB"));
97  tok_EE_ = consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit","EcalRecHitsEE"));
98  tok_hbhe_ = consumes<HBHERecHitCollection>(edm::InputTag("hbhereco"));
99  tok_pixtk_ = consumes<reco::IsolatedPixelTrackCandidateCollection>(PixcandTag_);
100  tok_l1cand_ = consumes<trigger::TriggerFilterObjectWithRefs>(L1candTag_);
101  tok_l2cand_ = consumes<reco::IsolatedPixelTrackCandidateCollection>(L2candTag_);
102  if (doTiming) {
103  tok_verthb_ = consumes<reco::VertexCollection>(edm::InputTag("hltHITPixelVerticesHB"));
104  tok_verthe_ = consumes<reco::VertexCollection>(edm::InputTag("hltHITPixelVerticesHB"));
105  tok_hlt_ = consumes<trigger::TriggerFilterObjectWithRefs>(edm::InputTag("hltL1sL1SingleJet68"));
106  tok_SeedingLayerhb = consumes<SeedingLayerSetsHits>(edm::InputTag("hltPixelLayerTripletsHITHB"));
107  tok_SeedingLayerhe = consumes<SeedingLayerSetsHits>(edm::InputTag("hltPixelLayerTripletsHITHE"));
108  tok_SiPixelRecHits = consumes<SiPixelRecHitCollection>(edm::InputTag("hltSiPixelRecHits"));
109  }
110  if(doChgIsolTree) {
111  for (unsigned int k=0; k<pixelTracksSources_.size(); ++k) {
112  // edm::InputTag pix (pixelTracksSources_[k],"",processName);
113  // tok_pixtks_.push_back(consumes<reco::TrackCollection>(pix));
114  tok_pixtks_.push_back(consumes<reco::TrackCollection>(pixelTracksSources_[k]));
115  }
116  }
117 #ifdef DebugLog
118  if (verbosity>=0) {
119  std::cout <<"Parameters read from config file \n"
120  <<"\t minPt " << selectionParameters.minPt
121  <<"\t theTrackQuality " << theTrackQuality
122  <<"\t minQuality " << selectionParameters.minQuality
123  <<"\t maxDxyPV " << selectionParameters.maxDxyPV
124  <<"\t maxDzPV " << selectionParameters.maxDzPV
125  <<"\t maxChi2 " << selectionParameters.maxChi2
126  <<"\t maxDpOverP " << selectionParameters.maxDpOverP
127  <<"\t minOuterHit " << selectionParameters.minOuterHit
128  <<"\t minLayerCrossed " << selectionParameters.minLayerCrossed
129  <<"\t maxInMiss " << selectionParameters.maxInMiss
130  <<"\t maxOutMiss " << selectionParameters.maxOutMiss
131  <<"\t a_coneR " << a_coneR
132  <<"\t a_charIsoR " << a_charIsoR
133  <<"\t a_neutIsoR " << a_neutIsoR
134  <<"\t a_mipR " << a_mipR
135  <<"\t a_neutR " << a_neutR1 << ":" << a_neutR2
136  <<"\t cuts (MIP " << cutMip << " : Charge " << cutCharge
137  <<" : Neutral " << cutNeutral << ")"
138  << std::endl;
139  std::cout <<"Charge Isolation parameters:"
140  <<"\t minPTrackValue " << minPTrackValue_
141  <<"\t vtxCutSeed " << vtxCutSeed_
142  <<"\t vtxCutIsol " << vtxCutIsol_
143  <<"\t tauUnbiasCone " << tauUnbiasCone_
144  <<"\t prelimCone " << prelimCone_
145  <<"\t pixelIsolationConeSizeAtEC";
146  for (unsigned int k=0; k<pixelIsolationConeSizeAtEC_.size(); ++k)
147  std::cout << " " << pixelIsolationConeSizeAtEC_[k];
148  std::cout << std::endl;
149  }
150 #endif
151  double pl[] = {20,30,40,60,80,120};
152  for (int i=0; i<6; ++i) pLimits[i] = pl[i];
153  rEB_ = 123.8;
154  zEE_ = 317.0;
155 }
156 
158  // do anything here that needs to be done at desctruction time
159  // (e.g. close files, deallocate resources etc.)
160  if (t_timeL2Prod) delete t_timeL2Prod;
161  if (t_nPixCand) delete t_nPixCand;
162  if (t_nPixSeed) delete t_nPixSeed;
163  if (t_nGoodTk) delete t_nGoodTk;
164  if (t_TrkhCone) delete t_TrkhCone;
165  if (t_TrkP) delete t_TrkP;
166  if (t_TrkselTkFlag) delete t_TrkselTkFlag;
167  if (t_TrkqltyFlag) delete t_TrkqltyFlag;
168  if (t_TrkMissFlag) delete t_TrkMissFlag;
169  if (t_TrkPVFlag) delete t_TrkPVFlag;
170  if (t_TrkNuIsolFlag) delete t_TrkNuIsolFlag;
171  if (t_PixcandP) delete t_PixcandP;
172  if (t_PixcandPt) delete t_PixcandPt;
173  if (t_PixcandEta) delete t_PixcandEta;
174  if (t_PixcandPhi) delete t_PixcandPhi;
175  if (t_PixcandMaxP) delete t_PixcandMaxP;
176  if (t_PixTrkcandP) delete t_PixTrkcandP;
177  if (t_PixTrkcandPt) delete t_PixTrkcandPt;
178  if (t_PixTrkcandEta) delete t_PixTrkcandEta;
179  if (t_PixTrkcandPhi) delete t_PixTrkcandPhi;
182  if (t_NFcandP) delete t_NFcandP;
183  if (t_NFcandPt) delete t_NFcandPt;
184  if (t_NFcandEta) delete t_NFcandEta;
185  if (t_NFcandPhi) delete t_NFcandPhi;
186  if (t_NFcandEmip) delete t_NFcandEmip;
187  if (t_NFTrkcandP) delete t_NFTrkcandP;
188  if (t_NFTrkcandPt) delete t_NFTrkcandPt;
189  if (t_NFTrkcandEta) delete t_NFTrkcandEta;
190  if (t_NFTrkcandPhi) delete t_NFTrkcandPhi;
191  if (t_NFTrkcandEmip) delete t_NFTrkcandEmip;
192  if (t_NFTrkMinDR) delete t_NFTrkMinDR;
193  if (t_NFTrkMinDP1) delete t_NFTrkMinDP1;
195  if (t_NFTrkqltyFlag) delete t_NFTrkqltyFlag;
196  if (t_NFTrkMissFlag) delete t_NFTrkMissFlag;
197  if (t_NFTrkPVFlag) delete t_NFTrkPVFlag;
198  if (t_NFTrkPropFlag) delete t_NFTrkPropFlag;
201  if (t_NFTrkMipFlag) delete t_NFTrkMipFlag;
202  if (t_ECone) delete t_ECone;
203 }
204 
206  //The following says we do not know what parameters are allowed so do no validation
207  // Please change this to state exactly what you do use, even if it is no parameters
209  desc.setUnknown();
210  descriptions.addDefault(desc);
211 }
212 
213 void IsoTrig::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
214 #ifdef DebugLog
215  if (verbosity%10 > 0) std::cout << "Event starts====================================" << std::endl;
216 #endif
217  int RunNo = iEvent.id().run();
218 
220 
221  iSetup.get<IdealMagneticFieldRecord>().get(bFieldH);
222  iSetup.get<CaloGeometryRecord>().get(pG);
223  const MagneticField *bField = bFieldH.product();
224  GlobalVector BField=bField->inTesla(GlobalPoint(0,0,0));
225  bfVal = BField.mag();
226 
227  trigger::TriggerEvent triggerEvent;
228  edm::Handle<trigger::TriggerEvent> triggerEventHandle;
229  iEvent.getByToken(tok_trigEvt, triggerEventHandle);
230  if (!triggerEventHandle.isValid()) {
231  edm::LogWarning("IsoTrack") << "Error! Can't get the product hltTriggerSummaryAOD";
232 
233  } else {
234  triggerEvent = *(triggerEventHandle.product());
235  }
236  const trigger::TriggerObjectCollection& TOC(triggerEvent.getObjects());
239  iEvent.getByToken(tok_trigRes, triggerResults);
240 
242  iEvent.getByToken(tok_genTrack_, trkCollection);
243 
246 
247  iEvent.getByToken(tok_hbhe_, hbhe);
248 
249  iEvent.getByToken(tok_recVtx_, recVtxs);
250  iEvent.getByToken(tok_bs_, beamSpotH);
251  if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
252  leadPV = math::XYZPoint( (*recVtxs)[0].x(),(*recVtxs)[0].y(), (*recVtxs)[0].z() );
253  } else if (beamSpotH.isValid()) {
255  }
256 #ifdef DebugLog
257  if ((verbosity/100)%10>0) {
258  std::cout << "Primary Vertex " << leadPV;
259  if (beamSpotH.isValid()) std::cout << " Beam Spot "
260  << beamSpotH->position();
261  std::cout << std::endl;
262  }
263 #endif
264  pixelTrackRefsHE.clear(); pixelTrackRefsHB.clear();
265  for (unsigned int iPix=0; iPix<pixelTracksSources_.size(); iPix++) {
267  iEvent.getByToken(tok_pixtks_[iPix],iPixCol);
268  if(iPixCol.isValid()){
269  for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
270  if(iPix==0)
271  pixelTrackRefsHB.push_back(reco::TrackRef(iPixCol,pit-iPixCol->begin()));
272  pixelTrackRefsHE.push_back(reco::TrackRef(iPixCol,pit-iPixCol->begin()));
273  }
274  }
275  }
276  if (doTiming) getGoodTracks(iEvent, trkCollection);
277 
278  for (unsigned int ifilter=0; ifilter<triggerEvent.sizeFilters();
279  ++ifilter) {
280  std::string FilterNames[7] = {"hltL1sL1SingleJet68", "hltIsolPixelTrackL2FilterHE", "ecalIsolPixelTrackFilterHE", "hltIsolPixelTrackL3FilterHE",
281  "hltIsolPixelTrackL2FilterHB", "ecalIsolPixelTrackFilterHB", "hltIsolPixelTrackL3FilterHB"};
282  std::string label = triggerEvent.filterTag(ifilter).label();
283  for(int i=0; i<7; i++) {
284  if(label==FilterNames[i]) h_Filters->Fill(i);
285  }
286  }
287  edm::InputTag lumiProducer("LumiProducer", "", "RECO");
289  iEvent.getLuminosityBlock().getByToken(tok_lumi, Lumid);
290  float mybxlumi=-1;
291  if (Lumid.isValid())
292  mybxlumi=Lumid->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37;
293 #ifdef DebugLog
294  if (verbosity%10 > 0)
295  std::cout << "RunNo " << RunNo << " EvtNo " << iEvent.id().event()
296  << " Lumi " << iEvent.luminosityBlock() << " Bunch "
297  << iEvent.bunchCrossing() << " mybxlumi " << mybxlumi
298  << std::endl;
299 #endif
300  if (!triggerResults.isValid()) {
301  edm::LogWarning("IsoTrack") << "Error! Can't get the product triggerResults";
302  // boost::shared_ptr<cms::Exception> const & error = triggerResults.whyFailed();
303  // edm::LogWarning(error->category()) << error->what();
304  } else {
305  std::vector<std::string> modules;
306  h_nHLT->Fill(triggerResults->size());
307  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
308 
309  const std::vector<std::string> & triggerNames_ = triggerNames.triggerNames();
310 #ifdef DebugLog
311  if (verbosity%10 > 1)
312  std::cout << "number of HLTs " << triggerNames_.size() << std::endl;
313 #endif
314  int hlt(-1), preL1(-1), preHLT(-1), prescale(-1);
315  for (unsigned int i=0; i<triggerResults->size(); i++) {
316  unsigned int triggerindx = hltConfig.triggerIndex(triggerNames_[i]);
317  const std::vector<std::string>& moduleLabels(hltConfig.moduleLabels(triggerindx));
318 
319  for (unsigned int in=0; in<trigNames.size(); ++in) {
320  // if (triggerNames_[i].find(trigNames[in].c_str())!=std::string::npos || triggerNames_[i]==" ") {
321  if (triggerNames_[i].find(trigNames[in].c_str())!=std::string::npos) {
322 #ifdef DebugLog
323  if (verbosity%10 > 0) std::cout << "trigger that i want " << triggerNames_[i] << " accept " << triggerResults->accept(i) << std::endl;
324 #endif
325  hlt = triggerResults->accept(i);
326  h_HLT -> Fill(hlt);
327  // if (hlt>0 || triggerNames_[i]==" ") {
328  if (hlt>0) {
330  iEvent.getByToken(tok_pixtk_,Pixcands);
332  iEvent.getByToken(tok_l1cand_, L1cands);
333 
334  const std::pair<int,int> prescales(hltPrescaleProvider_.prescaleValues(iEvent,iSetup,triggerNames_[i]));
335  preL1 = prescales.first;
336  preHLT = prescales.second;
337  prescale = preL1*preHLT;
338 #ifdef DebugLog
339  if (verbosity%10 > 0)
340  std::cout << triggerNames_[i] << " accept " << hlt << " preL1 "
341  << preL1 << " preHLT " << preHLT << std::endl;
342 #endif
343  for (int iv=0; iv<3; ++iv) vec[iv].clear();
344  if (TrigList.find(RunNo) != TrigList.end() ) {
345  TrigList[RunNo] += 1;
346  } else {
347  TrigList.insert(std::pair<unsigned int, unsigned int>(RunNo,1));
348  TrigPreList.insert(std::pair<unsigned int, std::pair<int, int>>(RunNo,prescales));
349  }
350  //loop over all trigger filters in event (i.e. filters passed)
351  for (unsigned int ifilter=0; ifilter<triggerEvent.sizeFilters();
352  ++ifilter) {
353  std::vector<int> Keys;
354  std::string label = triggerEvent.filterTag(ifilter).label();
355  //loop over keys to objects passing this filter
356  for (unsigned int imodule=0; imodule<moduleLabels.size();
357  imodule++) {
358  if (label.find(moduleLabels[imodule]) != std::string::npos) {
359 #ifdef DebugLog
360  if (verbosity%10 > 0) std::cout << "FILTERNAME " << label << std::endl;
361 #endif
362  for (unsigned int ifiltrKey=0; ifiltrKey<triggerEvent.filterKeys(ifilter).size(); ++ifiltrKey) {
363  Keys.push_back(triggerEvent.filterKeys(ifilter)[ifiltrKey]);
364  const trigger::TriggerObject& TO(TOC[Keys[ifiltrKey]]);
365  math::XYZTLorentzVector v4(TO.px(), TO.py(), TO.pz(), TO.energy());
366  if (label.find("L2Filter") != std::string::npos) {
367  vec[1].push_back(v4);
368  } else if (label.find("L3Filter") != std::string::npos) {
369  vec[2].push_back(v4);
370  } else {
371  vec[0].push_back(v4);
372  h_L1ObjEnergy->Fill(TO.energy());
373  }
374 #ifdef DebugLog
375  if (verbosity%10 > 0)
376  std::cout << "key " << ifiltrKey << " : pt " << TO.pt() << " eta " << TO.eta() << " phi " << TO.phi() << " mass " << TO.mass() << " Id " << TO.id() << std::endl;
377 #endif
378  }
379  }
380  }
381  }
382  std::vector<reco::TrackCollection::const_iterator> goodTks;
383  if (doL2L3) {
384  h_nL3Objs -> Fill(vec[2].size());
385  studyTrigger(trkCollection, goodTks);
386  } else {
387  if (trkCollection.isValid()) {
388  reco::TrackCollection::const_iterator trkItr;
389  for (trkItr=trkCollection->begin();
390  trkItr!=trkCollection->end(); trkItr++)
391  goodTks.push_back(trkItr);
392  }
393  }
394  // Now study isolation etc
395  if (doStudyIsol) studyIsolation(trkCollection, goodTks);
396  if (doTrkResTree) StudyTrkEbyP(trkCollection);
397 
398  std::pair<double,double> etaphi = etaPhiTrigger();
400  iEvent.getByToken(tok_l2cand_,L2cands);
401  if (!L2cands.isValid()) {
402 #ifdef DebugLog
403  if (verbosity%10 > 0) std::cout << " trigCand is not valid " << std::endl;
404 #endif
405  } else {
406  if(doMipCutTree) studyMipCut(trkCollection, L2cands);
407  }
408  if (pixelTracksSources_.size()>0)
409  if(doChgIsolTree && pixelTrackRefsHE.size()>0) chgIsolation(etaphi.first, etaphi.second, trkCollection, iEvent);
410  }
411  break;
412  }
413  }
414  }
415  h_PreL1 -> Fill(preL1);
416  h_PreHLT -> Fill(preHLT);
417  h_Pre -> Fill(prescale);
418  h_PreL1wt -> Fill(preL1, mybxlumi);
419  h_PreHLTwt -> Fill(preHLT, mybxlumi);
420 
421  // check if trigger names in (new) config
422  // std::cout << "changed " <<changed << std::endl;
423  if (changed) {
424  changed = false;
425 #ifdef DebugLog
426  if ((verbosity/10)%10 > 1) {
427  std::cout << "New trigger menu found !!!" << std::endl;
428  const unsigned int n(hltConfig.size());
429  for (unsigned itrig=0; itrig<triggerNames_.size(); itrig++) {
430  unsigned int triggerindx = hltConfig.triggerIndex(triggerNames_[itrig]);
431  std::cout << triggerNames_[itrig] << " " << triggerindx << " ";
432  if (triggerindx >= n)
433  std::cout << "does not exist in the current menu" << std::endl;
434  else
435  std::cout << "exists" << std::endl;
436  }
437  }
438 #endif
439  }
440  }
441  if (doTiming) studyTiming(iEvent);
442 }
443 
445  t_PixcandP ->clear();
446  t_PixcandPt ->clear();
447  t_PixcandEta ->clear();
448  t_PixcandPhi ->clear();
449  for(unsigned int i=0; i< t_PixcandMaxP->size(); i++)
450  t_PixcandMaxP[i].clear();
451  t_PixcandMaxP ->clear();
452  t_PixTrkcandP ->clear();
453  t_PixTrkcandPt ->clear();
454  t_PixTrkcandEta ->clear();
455  t_PixTrkcandPhi ->clear();
456  t_PixTrkcandMaxP ->clear();
457  t_PixTrkcandselTk ->clear();
458 }
459 
461  t_NFcandP ->clear();
462  t_NFcandPt ->clear();
463  t_NFcandEta ->clear();
464  t_NFcandPhi ->clear();
465  t_NFcandEmip ->clear();
466  t_NFTrkcandP ->clear();
467  t_NFTrkcandPt ->clear();
468  t_NFTrkcandEta ->clear();
469  t_NFTrkcandPhi ->clear();
470  t_NFTrkcandEmip ->clear();
471  t_NFTrkMinDR ->clear();
472  t_NFTrkMinDP1 ->clear();
473  t_NFTrkselTkFlag ->clear();
474  t_NFTrkqltyFlag ->clear();
475  t_NFTrkMissFlag ->clear();
476  t_NFTrkPVFlag ->clear();
477  t_NFTrkPropFlag ->clear();
478  t_NFTrkChgIsoFlag->clear();
479  t_NFTrkNeuIsoFlag->clear();
480  t_NFTrkMipFlag ->clear();
481  t_ECone ->clear();
482 }
483 
485  std::vector<double> &PixMaxP, double &TrkMaxP,
486  bool &selTk) {
487  t_PixcandP ->push_back(Pixcand.r());
488  t_PixcandPt ->push_back(Pixcand.pt());
489  t_PixcandEta ->push_back(Pixcand.eta());
490  t_PixcandPhi ->push_back(Pixcand.phi());
491  t_PixcandMaxP ->push_back(PixMaxP);
492  t_PixTrkcandP ->push_back(Trkcand.r());
493  t_PixTrkcandPt ->push_back(Trkcand.pt());
494  t_PixTrkcandEta ->push_back(Trkcand.eta());
495  t_PixTrkcandPhi ->push_back(Trkcand.phi());
496  t_PixTrkcandMaxP ->push_back(TrkMaxP);
497  t_PixTrkcandselTk ->push_back(selTk);
498 
499 }
500 
502  math::XYZTLorentzVector &Trkcand,
503  double &EmipNFcand, double &EmipTrkcand,
504  double &mindR, double &mindP1,
505  std::vector<bool> &Flags, double hCone) {
506  t_NFcandP ->push_back(NFcand.r());
507  t_NFcandPt ->push_back(NFcand.pt());
508  t_NFcandEta ->push_back(NFcand.eta());
509  t_NFcandPhi ->push_back(NFcand.phi());
510  t_NFcandEmip ->push_back(EmipNFcand);
511  t_NFTrkcandP ->push_back(Trkcand.r());
512  t_NFTrkcandPt ->push_back(Trkcand.pt());
513  t_NFTrkcandEta ->push_back(Trkcand.eta());
514  t_NFTrkcandPhi ->push_back(Trkcand.phi());
515  t_NFTrkcandEmip ->push_back(EmipTrkcand);
516  t_NFTrkMinDR ->push_back(mindR);
517  t_NFTrkMinDP1 ->push_back(mindP1);
518  t_NFTrkselTkFlag ->push_back(Flags[0]);
519  t_NFTrkqltyFlag ->push_back(Flags[1]);
520  t_NFTrkMissFlag ->push_back(Flags[2]);
521  t_NFTrkPVFlag ->push_back(Flags[3]);
522  t_NFTrkPropFlag ->push_back(Flags[4]);
523  t_NFTrkChgIsoFlag->push_back(Flags[5]);
524  t_NFTrkNeuIsoFlag->push_back(Flags[6]);
525  t_NFTrkMipFlag ->push_back(Flags[7]);
526  t_ECone ->push_back(hCone);
527 }
528 
530  char hname[100], htit[100];
531  std::string levels[20] = {"L1", "L2", "L3",
532  "Reco", "RecoMatch", "RecoNoMatch",
533  "L2Match", "L2NoMatch", "L3Match", "L3NoMatch",
534  "HLTTrk", "HLTGoodTrk", "HLTIsoTrk", "HLTMip", "HLTSelect",
535  "nonHLTTrk", "nonHLTGoodTrk", "nonHLTIsoTrk", "nonHLTMip", "nonHLTSelect"};
536  if (doTiming) {
537  TimingTree = fs->make<TTree>("TimingTree", "TimingTree");
538  t_timeL2Prod = new std::vector<double>();
539  t_nPixCand = new std::vector<int>();
540  t_nPixSeed = new std::vector<int>();
541  t_nGoodTk = new std::vector<int>();
542 
543  TimingTree->Branch("t_timeL2Prod", "std::vector<double>", &t_timeL2Prod);
544  TimingTree->Branch("t_nPixCand", "std::vector<int>", &t_nPixCand);
545  TimingTree->Branch("t_nPixSeed", "std::vector<int>", &t_nPixSeed);
546  TimingTree->Branch("t_nGoodTk", "std::vector<int>", &t_nGoodTk);
547  }
548  if (doTrkResTree) {
549  TrkResTree = fs->make<TTree>("TrkRestree", "TrkRestree");
550  t_TrkhCone = new std::vector<double>();
551  t_TrkP = new std::vector<double>();
552  t_TrkselTkFlag = new std::vector<bool>();
553  t_TrkqltyFlag = new std::vector<bool>();
554  t_TrkMissFlag = new std::vector<bool>();
555  t_TrkPVFlag = new std::vector<bool>();
556  t_TrkNuIsolFlag= new std::vector<bool>();
557 
558  TrkResTree->Branch("t_TrkhCone", "std::vector<double>", &t_TrkhCone);
559  TrkResTree->Branch("t_TrkP", "std::vector<double>", &t_TrkP);
560  TrkResTree->Branch("t_TrkselTkFlag", "std::vector<bool>", &t_TrkselTkFlag);
561  TrkResTree->Branch("t_TrkqltyFlag", "std::vector<bool>", &t_TrkqltyFlag);
562  TrkResTree->Branch("t_TrkMissFlag", "std::vector<bool>", &t_TrkMissFlag);
563  TrkResTree->Branch("t_TrkPVFlag", "std::vector<bool>", &t_TrkPVFlag);
564  TrkResTree->Branch("t_TrkNuIsolFlag","std::vector<bool>", &t_TrkNuIsolFlag);
565  }
566  if (doChgIsolTree) {
567  ChgIsolnTree = fs->make<TTree>("ChgIsolnTree", "ChgIsolntree");
568  t_PixcandP = new std::vector<double>();
569  t_PixcandPt = new std::vector<double>();
570  t_PixcandEta = new std::vector<double>();
571  t_PixcandPhi = new std::vector<double>();
572  t_PixcandMaxP = new std::vector<std::vector<double> >();
573  t_PixTrkcandP = new std::vector<double>();
574  t_PixTrkcandPt = new std::vector<double>();
575  t_PixTrkcandEta = new std::vector<double>();
576  t_PixTrkcandPhi = new std::vector<double>();
577  t_PixTrkcandMaxP = new std::vector<double>();
578  t_PixTrkcandselTk = new std::vector<bool>();
579 
580  ChgIsolnTree->Branch("t_PixcandP", "std::vector<double>", &t_PixcandP);
581  ChgIsolnTree->Branch("t_PixcandPt", "std::vector<double>", &t_PixcandPt);
582  ChgIsolnTree->Branch("t_PixcandEta", "std::vector<double>", &t_PixcandEta);
583  ChgIsolnTree->Branch("t_PixcandPhi", "std::vector<double>", &t_PixcandPhi);
584  ChgIsolnTree->Branch("t_PixcandMaxP", "std::vector<std::vector<double> >", &t_PixcandMaxP);
585  ChgIsolnTree->Branch("t_PixTrkcandP", "std::vector<double>", &t_PixTrkcandP);
586  ChgIsolnTree->Branch("t_PixTrkcandPt", "std::vector<double>", &t_PixTrkcandPt );
587  ChgIsolnTree->Branch("t_PixTrkcandEta", "std::vector<double>", &t_PixTrkcandEta );
588  ChgIsolnTree->Branch("t_PixTrkcandPhi", "std::vector<double>", &t_PixTrkcandPhi );
589  ChgIsolnTree->Branch("t_PixTrkcandMaxP", "std::vector<double>", &t_PixTrkcandMaxP);
590  ChgIsolnTree->Branch("t_PixTrkcandselTk","std::vector<bool>", &t_PixTrkcandselTk);
591  }
592  if (doMipCutTree) {
593  MipCutTree = fs->make<TTree>("MipCutTree", "MipCuttree");
594  t_NFcandP = new std::vector<double>();
595  t_NFcandPt = new std::vector<double>();
596  t_NFcandEta = new std::vector<double>();
597  t_NFcandPhi = new std::vector<double>();
598  t_NFcandEmip = new std::vector<double>();
599  t_NFTrkcandP = new std::vector<double>();
600  t_NFTrkcandPt = new std::vector<double>();
601  t_NFTrkcandEta = new std::vector<double>();
602  t_NFTrkcandPhi = new std::vector<double>();
603  t_NFTrkcandEmip = new std::vector<double>();
604  t_NFTrkMinDR = new std::vector<double>();
605  t_NFTrkMinDP1 = new std::vector<double>();
606  t_NFTrkselTkFlag = new std::vector<bool>();
607  t_NFTrkqltyFlag = new std::vector<bool>();
608  t_NFTrkMissFlag = new std::vector<bool>();
609  t_NFTrkPVFlag = new std::vector<bool>();
610  t_NFTrkPropFlag = new std::vector<bool>();
611  t_NFTrkChgIsoFlag= new std::vector<bool>();
612  t_NFTrkNeuIsoFlag= new std::vector<bool>();
613  t_NFTrkMipFlag = new std::vector<bool>();
614  t_ECone = new std::vector<double>();
615 
616  MipCutTree->Branch("t_NFcandP", "std::vector<double>", &t_NFcandP);
617  MipCutTree->Branch("t_NFcandPt", "std::vector<double>", &t_NFcandPt);
618  MipCutTree->Branch("t_NFcandEta", "std::vector<double>", &t_NFcandEta);
619  MipCutTree->Branch("t_NFcandPhi", "std::vector<double>", &t_NFcandPhi);
620  MipCutTree->Branch("t_NFcandEmip", "std::vector<double>", &t_NFcandEmip);
621  MipCutTree->Branch("t_NFTrkcandP", "std::vector<double>", &t_NFTrkcandP);
622  MipCutTree->Branch("t_NFTrkcandPt", "std::vector<double>", &t_NFTrkcandPt );
623  MipCutTree->Branch("t_NFTrkcandEta", "std::vector<double>", &t_NFTrkcandEta );
624  MipCutTree->Branch("t_NFTrkcandPhi", "std::vector<double>", &t_NFTrkcandPhi );
625  MipCutTree->Branch("t_NFTrkcandEmip", "std::vector<double>", &t_NFTrkcandEmip);
626  MipCutTree->Branch("t_NFTrkMinDR", "std::vector<double>", &t_NFTrkMinDR);
627  MipCutTree->Branch("t_NFTrkMinDP1", "std::vector<double>", &t_NFTrkMinDP1);
628  MipCutTree->Branch("t_NFTrkselTkFlag", "std::vector<bool>", &t_NFTrkselTkFlag);
629  MipCutTree->Branch("t_NFTrkqltyFlag", "std::vector<bool>", &t_NFTrkqltyFlag);
630  MipCutTree->Branch("t_NFTrkMissFlag", "std::vector<bool>", &t_NFTrkMissFlag);
631  MipCutTree->Branch("t_NFTrkPVFlag", "std::vector<bool>", &t_NFTrkPVFlag);
632  MipCutTree->Branch("t_NFTrkPropFlag", "std::vector<bool>", &t_NFTrkPropFlag);
633  MipCutTree->Branch("t_NFTrkChgIsoFlag","std::vector<bool>", &t_NFTrkChgIsoFlag);
634  MipCutTree->Branch("t_NFTrkNeuIsoFlag","std::vector<bool>", &t_NFTrkNeuIsoFlag);
635  MipCutTree->Branch("t_NFTrkMipFlag", "std::vector<bool>", &t_NFTrkMipFlag);
636  MipCutTree->Branch("t_ECone", "std::vector<double>", &t_ECone);
637  }
638  h_Filters = fs->make<TH1I>("h_Filters", "Filter Accepts", 10, 0, 10);
639  std::string FilterNames[7] = {"hltL1sL1SingleJet68", "hltIsolPixelTrackL2FilterHE", "ecalIsolPixelTrackFilterHE", "hltIsolPixelTrackL3FilterHE",
640  "hltIsolPixelTrackL2FilterHB", "ecalIsolPixelTrackFilterHB", "hltIsolPixelTrackL3FilterHB"};
641  for(int i=0; i<7; i++) {
642  h_Filters->GetXaxis()->SetBinLabel(i+1, FilterNames[i].c_str());
643  }
644 
645  h_nHLT = fs->make<TH1I>("h_nHLT" , "Size of trigger Names", 1000, 1, 1000);
646  h_HLT = fs->make<TH1I>("h_HLT" , "HLT accept", 3, -1, 2);
647  h_PreL1 = fs->make<TH1I>("h_PreL1", "L1 Prescale", 500, 0, 500);
648  h_PreHLT = fs->make<TH1I>("h_PreHLT", "HLT Prescale", 50, 0, 50);
649  h_Pre = fs->make<TH1I>("h_Pre", "Prescale", 3000, 0, 3000);
650 
651  h_PreL1wt = fs->make<TH1D>("h_PreL1wt", "Weighted L1 Prescale", 500, 0, 500);
652  h_PreHLTwt = fs->make<TH1D>("h_PreHLTwt", "Weighted HLT Prescale", 500, 0, 100);
653  h_L1ObjEnergy = fs->make<TH1D>("h_L1ObjEnergy", "Energy of L1Object", 500, 0.0, 500.0);
654 
655  h_EnIn = fs->make<TH1D>("h_EnInEcal", "EnergyIn Ecal", 200, 0.0, 20.0);
656  h_EnOut = fs->make<TH1D>("h_EnOutEcal", "EnergyOut Ecal", 200, 0.0, 20.0);
657  h_MipEnMatch = fs->make<TH2D>("h_MipEnMatch", "MipEn: HLT level vs Reco Level (Matched)", 200, 0.0, 20.0, 200, 0.0, 20.0);
658  h_MipEnNoMatch = fs->make<TH2D>("h_MipEnNoMatch", "MipEn: HLT level vs Reco Level (No Match Found)", 200, 0.0, 20.0, 200, 0.0, 20.0);
659 
660  if (doL2L3) {
661  h_nL3Objs = fs->make<TH1I>("h_nL3Objs", "Number of L3 objects", 10, 0, 10);
662 
663  std::string pairs[9] = {"L2L3", "L2L3Match", "L2L3NoMatch", "L3Reco", "L3RecoMatch", "L3RecoNoMatch", "NewFilterReco", "NewFilterRecoMatch", "NewFilterRecoNoMatch"};
664  for (int ipair=0; ipair<9; ipair++) {
665  sprintf(hname, "h_dEta%s", pairs[ipair].c_str());
666  sprintf(htit, "#Delta#eta for %s", pairs[ipair].c_str());
667  h_dEta[ipair] = fs->make<TH1D>(hname, htit, 200, -10.0, 10.0);
668  h_dEta[ipair]->GetXaxis()->SetTitle("d#eta");
669 
670  sprintf(hname, "h_dPhi%s", pairs[ipair].c_str());
671  sprintf(htit, "#Delta#phi for %s", pairs[ipair].c_str());
672  h_dPhi[ipair] = fs->make<TH1D>(hname, htit, 140, -7.0, 7.0);
673  h_dPhi[ipair]->GetXaxis()->SetTitle("d#phi");
674 
675  sprintf(hname, "h_dPt%s", pairs[ipair].c_str());
676  sprintf(htit, "#Delta dp_{T} for %s objects", pairs[ipair].c_str());
677  h_dPt[ipair] = fs->make<TH1D>(hname, htit, 400, -200.0, 200.0);
678  h_dPt[ipair]->GetXaxis()->SetTitle("dp_{T} (GeV)");
679 
680  sprintf(hname, "h_dP%s", pairs[ipair].c_str());
681  sprintf(htit, "#Delta p for %s objects", pairs[ipair].c_str());
682  h_dP[ipair] = fs->make<TH1D>(hname, htit, 400, -200.0, 200.0);
683  h_dP[ipair]->GetXaxis()->SetTitle("dP (GeV)");
684 
685  sprintf(hname, "h_dinvPt%s", pairs[ipair].c_str());
686  sprintf(htit, "#Delta (1/p_{T}) for %s objects", pairs[ipair].c_str());
687  h_dinvPt[ipair] = fs->make<TH1D>(hname, htit, 500, -0.4, 0.1);
688  h_dinvPt[ipair]->GetXaxis()->SetTitle("d(1/p_{T})");
689  sprintf(hname, "h_mindR%s", pairs[ipair].c_str());
690  sprintf(htit, "min(#Delta R) for %s objects", pairs[ipair].c_str());
691  h_mindR[ipair] = fs->make<TH1D>(hname, htit, 500, 0.0, 1.0);
692  h_mindR[ipair]->GetXaxis()->SetTitle("dR");
693  }
694 
695  for (int lvl=0; lvl<2; lvl++) {
696  sprintf(hname, "h_dEtaL1%s", levels[lvl+1].c_str());
697  sprintf(htit, "#Delta#eta for L1 and %s objects", levels[lvl+1].c_str());
698  h_dEtaL1[lvl] = fs->make<TH1D>(hname, htit, 400, -10.0, 10.0);
699 
700  sprintf(hname, "h_dPhiL1%s", levels[lvl+1].c_str());
701  sprintf(htit, "#Delta#phi for L1 and %s objects", levels[lvl+1].c_str());
702  h_dPhiL1[lvl] = fs->make<TH1D>(hname, htit, 280, -7.0, 7.0);
703 
704  sprintf(hname, "h_dRL1%s", levels[lvl+1].c_str());
705  sprintf(htit, "#Delta R for L1 and %s objects", levels[lvl+1].c_str());
706  h_dRL1[lvl] = fs->make<TH1D>(hname, htit, 100, 0.0, 10.0);
707  }
708  }
709 
710  int levmin = (doL2L3 ? 0 : 10);
711  for (int ilevel=levmin; ilevel<20; ilevel++) {
712  sprintf(hname, "h_p%s", levels[ilevel].c_str());
713  sprintf(htit, "p for %s objects", levels[ilevel].c_str());
714  h_p[ilevel] = fs->make<TH1D>(hname, htit, 100, 0.0, 500.0);
715  h_p[ilevel]->GetXaxis()->SetTitle("p (GeV)");
716 
717  sprintf(hname, "h_pt%s", levels[ilevel].c_str());
718  sprintf(htit, "p_{T} for %s objects", levels[ilevel].c_str());
719  h_pt[ilevel] = fs->make<TH1D>(hname, htit, 100, 0.0, 500.0);
720  h_pt[ilevel]->GetXaxis()->SetTitle("p_{T} (GeV)");
721 
722  sprintf(hname, "h_eta%s", levels[ilevel].c_str());
723  sprintf(htit, "#eta for %s objects", levels[ilevel].c_str());
724  h_eta[ilevel] = fs->make<TH1D>(hname, htit, 100, -5.0, 5.0);
725  h_eta[ilevel]->GetXaxis()->SetTitle("#eta");
726 
727  sprintf(hname, "h_phi%s", levels[ilevel].c_str());
728  sprintf(htit, "#phi for %s objects", levels[ilevel].c_str());
729  h_phi[ilevel] = fs->make<TH1D>(hname, htit, 70, -3.5, 3.50);
730  h_phi[ilevel]->GetXaxis()->SetTitle("#phi");
731  }
732 
733  std::string cuts[2] = {"HLTMatched", "HLTNotMatched"};
734  std::string cuts2[2] = {"All", "Away from L1"};
735  for (int icut=0; icut<2; icut++) {
736  sprintf(hname, "h_eMip%s", cuts[icut].c_str());
737  sprintf(htit, "eMip for %s tracks", cuts[icut].c_str());
738  h_eMip[icut] =fs->make<TH1D>(hname, htit, 200, 0.0, 10.0);
739  h_eMip[icut]->GetXaxis()->SetTitle("E_{Mip} (GeV)");
740 
741  sprintf(hname, "h_eMaxNearP%s", cuts[icut].c_str());
742  sprintf(htit, "eMaxNearP for %s tracks", cuts[icut].c_str());
743  h_eMaxNearP[icut]=fs->make<TH1D>(hname, htit, 240, -2.0, 10.0);
744  h_eMaxNearP[icut]->GetXaxis()->SetTitle("E_{MaxNearP} (GeV)");
745 
746  sprintf(hname, "h_eNeutIso%s", cuts[icut].c_str());
747  sprintf(htit, "eNeutIso for %s ", cuts[icut].c_str());
748  h_eNeutIso[icut] =fs->make<TH1D>(hname, htit, 200, 0.0, 10.0);
749  h_eNeutIso[icut]->GetXaxis()->SetTitle("E_{NeutIso} (GeV)");
750 
751  for (int kcut=0; kcut<2; ++kcut) {
752  for (int lim=0; lim<5; ++lim) {
753  sprintf(hname, "h_etaCalibTracks%sCut%dLim%d", cuts[icut].c_str(), kcut, lim);
754  sprintf(htit, "#eta for %s isolated MIP tracks (%4.1f < p < %5.1f Gev/c %s)", cuts[icut].c_str(), pLimits[lim], pLimits[lim+1], cuts2[kcut].c_str());
755  h_etaCalibTracks[lim][icut][kcut]=fs->make<TH1D>(hname, htit, 60, -30.0, 30.0);
756  h_etaCalibTracks[lim][icut][kcut]->GetXaxis()->SetTitle("i#eta");
757 
758  sprintf(hname, "h_etaMipTracks%sCut%dLim%d", cuts[icut].c_str(), kcut, lim);
759  sprintf(htit, "#eta for %s charge isolated MIP tracks (%4.1f < p < %5.1f Gev/c %s)", cuts[icut].c_str(), pLimits[lim], pLimits[lim+1], cuts2[kcut].c_str());
760  h_etaMipTracks[lim][icut][kcut]=fs->make<TH1D>(hname, htit, 60, -30.0, 30.0);
761  h_etaMipTracks[lim][icut][kcut]->GetXaxis()->SetTitle("i#eta");
762  }
763  }
764  }
765 
766  std::string ecut1[3] = {"all","HLTMatched","HLTNotMatched"};
767  std::string ecut2[2] = {"without","with"};
768  int etac[48] = {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,
769  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
770  for (int icut=0; icut<6; icut++) {
771  // int i1 = (icut>3 ? 1 : 0);
772  int i1 = (icut>2 ? 1 : 0);
773  int i2 = icut - i1*3;
774  for (int kcut=0; kcut<48; kcut++) {
775  for (int lim=0; lim<5; ++lim) {
776  sprintf(hname, "h_eta%dEnHcal%s%s%d", etac[kcut], ecut1[i2].c_str(), ecut2[i1].c_str(), lim);
777  sprintf(htit, "HCAL energy for #eta=%d for %s tracks (p=%4.1f:%5.1f Gev) %s neutral isolation", etac[kcut], ecut1[i2].c_str(), pLimits[lim], pLimits[lim+1], ecut2[i1].c_str());
778  h_eHcal[lim][icut][kcut]=fs->make<TH1D>(hname, htit, 750, 0.0, 150.0);
779  h_eHcal[lim][icut][kcut]->GetXaxis()->SetTitle("Energy (GeV)");
780  sprintf(hname, "h_eta%dEnCalo%s%s%d", etac[kcut], ecut1[i2].c_str(), ecut2[i1].c_str(), lim);
781  sprintf(htit, "Calorimter energy for #eta=%d for %s tracks (p=%4.1f:%5.1f Gev) %s neutral isolation", etac[kcut], ecut1[i2].c_str(), pLimits[lim], pLimits[lim+1], ecut2[i1].c_str());
782  h_eCalo[lim][icut][kcut]=fs->make<TH1D>(hname, htit, 750, 0.0, 150.0);
783  h_eCalo[lim][icut][kcut]->GetXaxis()->SetTitle("Energy (GeV)");
784  }
785  }
786  }
787 }
788 
789 // ------------ method called once each job just after ending the event loop ------------
791  unsigned int preL1, preHLT;
792  std::map<unsigned int, unsigned int>::iterator itr;
793  std::map<unsigned int, const std::pair<int, int>>::iterator itrPre;
794  edm::LogWarning ("IsoTrack") << trigNames.size() << "Triggers were run. RunNo vs HLT accepts for";
795  for (unsigned int i=0; i<trigNames.size(); ++i)
796  edm::LogWarning("IsoTrack") << "[" << i << "]: " << trigNames[i];
797  unsigned int n = maxRunNo - minRunNo +1;
798  g_Pre = fs->make<TH1I>("h_PrevsRN", "PreScale Vs Run Number", n, minRunNo, maxRunNo);
799  g_PreL1 = fs->make<TH1I>("h_PreL1vsRN", "L1 PreScale Vs Run Number", n, minRunNo, maxRunNo);
800  g_PreHLT = fs->make<TH1I>("h_PreHLTvsRN", "HLT PreScale Vs Run Number", n, minRunNo, maxRunNo);
801  g_Accepts = fs->make<TH1I>("h_HLTAcceptsvsRN", "HLT Accepts Vs Run Number", n, minRunNo, maxRunNo);
802 
803  for (itr=TrigList.begin(), itrPre=TrigPreList.begin(); itr!=TrigList.end(); itr++, itrPre++) {
804  preL1 = (itrPre->second).first;
805  preHLT = (itrPre->second).second;
806 #ifdef DebugLog
807  std::cout << itr->first << " " << itr->second << " " << itrPre->first << " " << preL1 << " " << preHLT << std::endl;
808 #endif
809  g_Accepts->Fill(itr->first, itr->second);
810  g_PreL1->Fill(itr->first, preL1);
811  g_PreHLT->Fill(itr->first, preHLT);
812  g_Pre->Fill(itr->first, preL1*preHLT);
813  }
814 }
815 
816 // ------------ method called when starting to processes a run ------------
817 void IsoTrig::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
818  edm::LogWarning ("IsoTrack") << "Run " << iRun.run() << " hltconfig.init "
820 }
821 
822 // ------------ method called when ending the processing of a run ------------
823 void IsoTrig::endRun(edm::Run const&, edm::EventSetup const&) {}
824 
825 // ------------ method called when starting to processes a luminosity block ------------
827 // ------------ method called when ending the processing of a luminosity block ------------
829 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
830 
832 
833  t_TrkselTkFlag->clear();
834  t_TrkqltyFlag->clear();
835  t_TrkMissFlag->clear();
836  t_TrkPVFlag->clear();
837  t_TrkNuIsolFlag->clear();
838  t_TrkhCone->clear();
839  t_TrkP->clear();
840 
841  if (!trkCollection.isValid()) {
842 #ifdef DebugLog
843  std::cout << "trkCollection.isValid is false" << std::endl;
844 #endif
845  } else {
846  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
847  const MagneticField *bField = bFieldH.product();
848  const CaloGeometry* geo = pG.product();
849  std::vector<spr::propagatedTrackDirection> trkCaloDirections1;
850  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality, trkCaloDirections1, ((verbosity/100)%10>2));
851  unsigned int nTracks=0;
852  int nRH_eMipDR=0, nNearTRKs=0;
853  std::vector<bool> selFlags;
854  for (trkDetItr = trkCaloDirections1.begin(); trkDetItr != trkCaloDirections1.end(); trkDetItr++,nTracks++) {
855  double conehmaxNearP = 0, hCone=0, eMipDR=0.0;
856  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
857 #ifdef DebugLog
858  if (verbosity%10>0) std::cout << "track no. " << nTracks << " p(): " << pTrack->p() << std::endl;
859 #endif
860  if (pTrack->p() > 20) {
861  math::XYZTLorentzVector v2(pTrack->px(), pTrack->py(),
862  pTrack->pz(), pTrack->p());
864  trkDetItr->pointHCAL, trkDetItr->pointECAL,
865  a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
866  bool selectTk = spr::goodTrack(pTrack,leadPV,selectionParameters,((verbosity/100)%10>1));
868  oneCutParameters.maxDxyPV = 10;
869  oneCutParameters.maxDzPV = 100;
870  oneCutParameters.maxInMiss = 2;
871  oneCutParameters.maxOutMiss= 2;
872  bool qltyFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,((verbosity/100)%10>1));
873  oneCutParameters = selectionParameters;
874  oneCutParameters.maxDxyPV = 10;
875  oneCutParameters.maxDzPV = 100;
876  bool qltyMissFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,((verbosity/100)%10>1));
877  oneCutParameters = selectionParameters;
878  oneCutParameters.maxInMiss = 2;
879  oneCutParameters.maxOutMiss= 2;
880  bool qltyPVFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,((verbosity/100)%10>1));
881 #ifdef DebugLog
882  /*
883  std::cout << "sel " << selectTk << std::endl;
884  std::cout << "ntracks " << nTracks;
885  std::cout << " a_charIsoR " << a_charIsoR;
886  std::cout << " nNearTRKs " << nNearTRKs << std::endl;
887  */
888 #endif
889  conehmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections1, a_charIsoR, nNearTRKs, ((verbosity/100)%10>1));
890 #ifdef DebugLog
891  /*
892  std::cout << "coneh " << conehmaxNearP << std::endl;
893  std::cout << "ok " << trkDetItr->okECAL << " " << trkDetItr->okHCAL << std::endl;
894  */
895 #endif
897  trkDetItr->pointHCAL, trkDetItr->pointECAL,
898  a_neutR1, trkDetItr->directionECAL, nRH_eMipDR);
900  trkDetItr->pointHCAL, trkDetItr->pointECAL,
901  a_neutR2, trkDetItr->directionECAL, nRH_eMipDR);
902  double e_inCone = e2 - e1;
903  bool chgIsolFlag = (conehmaxNearP < cutCharge);
904  bool mipFlag = (eMipDR < cutMip);
905  bool neuIsolFlag = (e_inCone < cutNeutral);
906  bool trkpropFlag = ((trkDetItr->okECAL) && (trkDetItr->okHCAL));
907  selFlags.clear();
908  selFlags.push_back(selectTk); selFlags.push_back(qltyFlag);
909  selFlags.push_back(qltyMissFlag); selFlags.push_back(qltyPVFlag);
910 #ifdef DebugLog
911  if (verbosity%10>0) std::cout << "emip: " << eMipDR << "<" << cutMip << "(" << mipFlag << ")"
912  << " ; ok: " << trkDetItr->okECAL << "/" << trkDetItr->okHCAL
913  << " ; chgiso: " << conehmaxNearP << "<" << cutCharge << "(" << chgIsolFlag << ")" << std::endl;
914 #endif
915 
916  if(chgIsolFlag && mipFlag && trkpropFlag) {
917  double distFromHotCell=-99.0;
918  int nRecHitsCone=-99, ietaHotCell=-99, iphiHotCell=-99;
919  GlobalPoint gposHotCell(0.,0.,0.);
920  std::vector<DetId> coneRecHitDetIds;
921  hCone = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
922  trkDetItr->pointECAL,
923  a_coneR, trkDetItr->directionHCAL,
924  nRecHitsCone, coneRecHitDetIds,
925  distFromHotCell, ietaHotCell, iphiHotCell,
926  gposHotCell, -1);
927  // push vectors into the Tree
928  t_TrkselTkFlag ->push_back(selFlags[0]);
929  t_TrkqltyFlag ->push_back(selFlags[1]);
930  t_TrkMissFlag ->push_back(selFlags[2]);
931  t_TrkPVFlag ->push_back(selFlags[3]);
932  t_TrkNuIsolFlag->push_back(neuIsolFlag);
933  t_TrkhCone ->push_back(hCone);
934  t_TrkP ->push_back(pTrack->p());
935  }
936  }
937  }
938 #ifdef DebugLog
939  if (verbosity%10>0) std::cout << "Filling " << t_TrkP->size() << " tracks in TrkRestree out of " << nTracks << std::endl;
940 #endif
941  }
942  TrkResTree->Fill();
943 }
944 
945 void IsoTrig::studyTiming(const edm::Event& theEvent) {
946  t_timeL2Prod->clear(); t_nPixCand->clear(); t_nPixSeed->clear();
947 
948 #ifdef DebugLog
949  edm::Handle<SeedingLayerSetsHits> hblayers, helayers;
950  theEvent.getByToken(tok_SeedingLayerhb, hblayers);
951  theEvent.getByToken(tok_SeedingLayerhe, helayers);
952  const SeedingLayerSetsHits* layershb = hblayers.product();
953  const SeedingLayerSetsHits* layershe = helayers.product();
954  std::cout << "size of Seeding TripletLayers hb/he " << layershb->size() << "/" << layershe->size() << std::endl;
956  theEvent.getByToken(tok_SiPixelRecHits, rchts);
957  const SiPixelRecHitCollection* rechits = rchts.product();
958  std::cout << "size of SiPixelRechits " << rechits->size() << std::endl;;
959 #endif
960  double tHB=0.0, tHE=0.0;
961  int nCandHB=pixelTrackRefsHB.size(), nCandHE=pixelTrackRefsHE.size();
962  int nSeedHB=0, nSeedHE=0;
963 
964  if(nCandHE>0) {
965  edm::Handle<reco::VertexCollection> pVertHB, pVertHE;
966  theEvent.getByToken(tok_verthb_,pVertHB);
967  theEvent.getByToken(tok_verthe_,pVertHE);
969  theEvent.getByToken(tok_l1cand_, l1trigobj);
970 
971  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
972  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
973  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
974 
975  l1trigobj->getObjects(trigger::TriggerL1TauJet, l1tauobjref);
976  l1trigobj->getObjects(trigger::TriggerL1CenJet, l1jetobjref);
977  l1trigobj->getObjects(trigger::TriggerL1ForJet, l1forjetobjref);
978 
979  double ptTriggered = -10;
980  double etaTriggered = -100;
981  double phiTriggered = -100;
982  for (unsigned int p=0; p<l1tauobjref.size(); p++) {
983  if (l1tauobjref[p]->pt()>ptTriggered) {
984  ptTriggered = l1tauobjref[p]->pt();
985  phiTriggered = l1tauobjref[p]->phi();
986  etaTriggered = l1tauobjref[p]->eta();
987  }
988  }
989  for (unsigned int p=0; p<l1jetobjref.size(); p++) {
990  if (l1jetobjref[p]->pt()>ptTriggered) {
991  ptTriggered = l1jetobjref[p]->pt();
992  phiTriggered = l1jetobjref[p]->phi();
993  etaTriggered = l1jetobjref[p]->eta();
994  }
995  }
996  for (unsigned int p=0; p<l1forjetobjref.size(); p++) {
997  if (l1forjetobjref[p]->pt()>ptTriggered) {
998  ptTriggered=l1forjetobjref[p]->pt();
999  phiTriggered=l1forjetobjref[p]->phi();
1000  etaTriggered=l1forjetobjref[p]->eta();
1001  }
1002  }
1003  for(unsigned iS=0; iS<pixelTrackRefsHE.size(); iS++) {
1004  reco::VertexCollection::const_iterator vitSel;
1005  double minDZ = 100;
1006  bool vtxMatch;
1007  for (reco::VertexCollection::const_iterator vit=pVertHE->begin(); vit!=pVertHE->end(); vit++) {
1008  if (fabs(pixelTrackRefsHE[iS]->dz(vit->position()))<minDZ) {
1009  minDZ = fabs(pixelTrackRefsHE[iS]->dz(vit->position()));
1010  vitSel = vit;
1011  }
1012  }
1013  //cut on dYX:
1014  if (minDZ!=100&&fabs(pixelTrackRefsHE[iS]->dxy(vitSel->position()))<vtxCutSeed_) vtxMatch=true;
1015  if (minDZ==100) vtxMatch=true;
1016 
1017  //select tracks not matched to triggered L1 jet
1018  double R=deltaR(etaTriggered, phiTriggered, pixelTrackRefsHE[iS]->eta(), pixelTrackRefsHE[iS]->phi());
1019  if (R>tauUnbiasCone_ && vtxMatch) nSeedHE++;
1020  }
1021  for(unsigned iS=0; iS<pixelTrackRefsHB.size(); iS++) {
1022  reco::VertexCollection::const_iterator vitSel;
1023  double minDZ = 100;
1024  bool vtxMatch;
1025  for (reco::VertexCollection::const_iterator vit=pVertHB->begin(); vit!=pVertHB->end(); vit++) {
1026  if (fabs(pixelTrackRefsHB[iS]->dz(vit->position()))<minDZ) {
1027  minDZ = fabs(pixelTrackRefsHB[iS]->dz(vit->position()));
1028  vitSel = vit;
1029  }
1030  }
1031  //cut on dYX:
1032  if (minDZ!=100&&fabs(pixelTrackRefsHB[iS]->dxy(vitSel->position()))<101.0) vtxMatch=true;
1033  if (minDZ==100) vtxMatch=true;
1034 
1035  //select tracks not matched to triggered L1 jet
1036  double R=deltaR(etaTriggered, phiTriggered, pixelTrackRefsHB[iS]->eta(), pixelTrackRefsHB[iS]->phi());
1037  if (R>1.2 && vtxMatch) nSeedHB++;
1038  }
1039 
1041  tHE = ft->queryModuleTimeByLabel(theEvent.streamID(),"hltIsolPixelTrackProdHE") ;
1042  tHB = ft->queryModuleTimeByLabel(theEvent.streamID(),"hltIsolPixelTrackProdHB");
1043 #ifdef DebugLog
1044  if (verbosity%10>0) std::cout << "(HB/HE) time: " << tHB <<"/" << tHE
1045  << " nCand: " << nCandHB << "/" << nCandHE
1046  << "nSeed: " << nSeedHB << "/" << nSeedHE
1047  << std::endl;
1048 #endif
1049  }
1050  t_timeL2Prod->push_back(tHB); t_timeL2Prod->push_back(tHE);
1051  t_nPixSeed->push_back(nSeedHB); t_nPixSeed->push_back(nSeedHE);
1052  t_nPixCand->push_back(nCandHB); t_nPixCand->push_back(nCandHE);
1053 
1054  TimingTree->Fill();
1055 }
1058 
1060 #ifdef DebugLog
1061  if (verbosity%10>0) std::cout << "inside studymipcut" << std::endl;
1062 #endif
1063  if (!trkCollection.isValid()) {
1064  edm::LogWarning("IsoTrack") << "trkCollection.isValid is false";
1065  } else {
1066  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
1067  const MagneticField *bField = bFieldH.product();
1068  const CaloGeometry* geo = pG.product();
1069  std::vector<spr::propagatedTrackDirection> trkCaloDirections1;
1070  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality, trkCaloDirections1, ((verbosity/100)%10>2));
1071 #ifdef DebugLog
1072  if (verbosity%10>0) std::cout << "Number of L2cands:" << L2cands->size()
1073  << " to be matched to something out of "
1074  << trkCaloDirections1.size() << " reco tracks" << std::endl;
1075 #endif
1076  for (unsigned int i=0; i<L2cands->size(); i++) {
1079  double enIn = candref->energyIn();
1080  h_EnIn->Fill(candref->energyIn());
1081  h_EnOut->Fill(candref->energyOut());
1082  math::XYZTLorentzVector v1(candref->track()->px(),candref->track()->py(),
1083  candref->track()->pz(),candref->track()->p());
1084 #ifdef DebugLog
1085  if (verbosity%10>1)
1086  std::cout << "HLT Level Candidate eta/phi/pt/enIn:"
1087  << candref->track()->eta() << "/" << candref->track()->phi()
1088  << "/" << candref->track()->pt() << "/" << candref->energyIn()
1089  << std::endl;
1090 #endif
1091  math::XYZTLorentzVector mindRvec;
1092  double mindR=999.9, mindP1=999.9, eMipDR=0.0;
1093  std::vector<bool> selFlags;
1094  unsigned int nTracks=0;
1095  double conehmaxNearP = 0, hCone=0;
1096  for (trkDetItr = trkCaloDirections1.begin(); trkDetItr != trkCaloDirections1.end(); trkDetItr++,nTracks++){
1097  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
1098  math::XYZTLorentzVector v2(pTrack->px(), pTrack->py(),
1099  pTrack->pz(), pTrack->p());
1100  double dr = dR(v1,v2);
1101  double dp1 = std::abs(1./v1.r() - 1./v2.r());
1102  // std::cout <<"This recotrack(eta/phi/pt) " << pTrack->eta() << "/"
1103  // << pTrack->phi() << "/" << pTrack->pt() << " has dr/dp= "
1104  // << dr << "/" << dp << "/" << dp1 << std::endl;
1105  if (dr<mindR) {
1106  mindR = dr;
1107  mindP1= dp1;
1108  mindRvec=v2;
1109  int nRH_eMipDR=0, nNearTRKs=0;
1111  trkDetItr->pointHCAL, trkDetItr->pointECAL,
1112  a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
1113  bool selectTk = spr::goodTrack(pTrack,leadPV,selectionParameters,((verbosity/100)%10>1));
1115  oneCutParameters.maxDxyPV = 10;
1116  oneCutParameters.maxDzPV = 100;
1117  oneCutParameters.maxInMiss = 2;
1118  oneCutParameters.maxOutMiss= 2;
1119  bool qltyFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,((verbosity/100)%10>1));
1120  oneCutParameters = selectionParameters;
1121  oneCutParameters.maxDxyPV = 10;
1122  oneCutParameters.maxDzPV = 100;
1123  bool qltyMissFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,((verbosity/100)%10>1));
1124  oneCutParameters = selectionParameters;
1125  oneCutParameters.maxInMiss = 2;
1126  oneCutParameters.maxOutMiss= 2;
1127  bool qltyPVFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,((verbosity/100)%10>1));
1128  conehmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections1, a_charIsoR, nNearTRKs, ((verbosity/100)%10>1));
1130  trkDetItr->pointHCAL, trkDetItr->pointECAL,
1131  a_neutR1, trkDetItr->directionECAL, nRH_eMipDR);
1133  trkDetItr->pointHCAL, trkDetItr->pointECAL,
1134  a_neutR2, trkDetItr->directionECAL, nRH_eMipDR);
1135  double e_inCone = e2 - e1;
1136  bool chgIsolFlag = (conehmaxNearP < cutCharge);
1137  bool mipFlag = (eMipDR < cutMip);
1138  bool neuIsolFlag = (e_inCone < cutNeutral);
1139  bool trkpropFlag = ((trkDetItr->okECAL) && (trkDetItr->okHCAL));
1140  selFlags.clear();
1141  selFlags.push_back(selectTk); selFlags.push_back(qltyFlag);
1142  selFlags.push_back(qltyMissFlag); selFlags.push_back(qltyPVFlag);
1143  selFlags.push_back(trkpropFlag); selFlags.push_back(chgIsolFlag);
1144  selFlags.push_back(neuIsolFlag); selFlags.push_back(mipFlag);
1145  double distFromHotCell=-99.0;
1146  int nRecHitsCone=-99, ietaHotCell=-99, iphiHotCell=-99;
1147  GlobalPoint gposHotCell(0.,0.,0.);
1148  std::vector<DetId> coneRecHitDetIds;
1149  hCone = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
1150  trkDetItr->pointECAL,
1151  a_coneR, trkDetItr->directionHCAL,
1152  nRecHitsCone, coneRecHitDetIds,
1153  distFromHotCell, ietaHotCell, iphiHotCell,
1154  gposHotCell, -1);
1155  }
1156  }
1157  pushMipCutTreeVecs(v1, mindRvec, enIn, eMipDR, mindR, mindP1, selFlags, hCone);
1158  fillDifferences(6, v1, mindRvec, (verbosity%10 >0));
1159  if (mindR>=0.05) {
1160  fillDifferences(8, v1, mindRvec, (verbosity%10 >0));
1161  h_MipEnNoMatch->Fill(candref->energyIn(), eMipDR);
1162  } else {
1163  fillDifferences(7, v1, mindRvec, (verbosity%10 >0));
1164  h_MipEnMatch->Fill(candref->energyIn(), eMipDR);
1165  }
1166  }
1167  }
1168  MipCutTree->Fill();
1169 }
1170 
1172  std::vector<reco::TrackCollection::const_iterator>& goodTks) {
1173 
1174 #ifdef DebugLog
1175  if (verbosity%10 > 0) std::cout << "Inside StudyTrigger" << std::endl;
1176 #endif
1177  for (int j=0; j<3; j++) {
1179  for (unsigned int k=0; k<vec[j].size(); k++) {
1180 #ifdef DebugLog
1181  if (verbosity%10 > 0) std::cout << "vec[" << j << "][" << k << "] pt " << vec[j][k].pt() << " eta " << vec[j][k].eta() << " phi " << vec[j][k].phi() << std::endl;
1182 #endif
1183  fillHist(j, vec[j][k]);
1184  }
1185  }
1186 
1187  double deta, dphi, dr;
1189  for (int lvl=1; lvl<3; lvl++) {
1190  for (unsigned int i=0; i<vec[lvl].size(); i++) {
1191  deta = dEta(vec[0][0],vec[lvl][i]);
1192  dphi = dPhi(vec[0][0],vec[lvl][i]);
1193  dr = dR(vec[0][0],vec[lvl][i]);
1194 #ifdef DebugLog
1195  if (verbosity%10 > 1) std::cout << "lvl " <<lvl << " i " << i << " deta " << deta << " dphi " << dphi << " dR " << dr << std::endl;
1196 #endif
1197  h_dEtaL1[lvl-1] -> Fill(deta);
1198  h_dPhiL1[lvl-1] -> Fill(dphi);
1199  h_dRL1[lvl-1] -> Fill(std::sqrt(dr));
1200  }
1201  }
1202 
1203  math::XYZTLorentzVector mindRvec;
1204  double mindR;
1205  for (unsigned int k=0; k<vec[2].size(); ++k) {
1207  mindR=999.9;
1208 #ifdef DebugLog
1209  if (verbosity%10 > 1) std::cout << "L3obj: pt " << vec[2][k].pt() << " eta " << vec[2][k].eta() << " phi " << vec[2][k].phi() << std::endl;
1210 #endif
1211  for (unsigned int j=0; j<vec[1].size(); j++) {
1212  dr = dR(vec[2][k],vec[1][j]);
1213  if (dr<mindR) {
1214  mindR=dr;
1215  mindRvec=vec[1][j];
1216  }
1217  }
1218  fillDifferences(0, vec[2][k], mindRvec, (verbosity%10 >0));
1219  if (mindR < 0.03) {
1220  fillDifferences(1, vec[2][k], mindRvec, (verbosity%10 >0));
1221  fillHist(6, mindRvec);
1222  fillHist(8, vec[2][k]);
1223  } else {
1224  fillDifferences(2, vec[2][k], mindRvec, (verbosity%10 >0));
1225  fillHist(7, mindRvec);
1226  fillHist(9, vec[2][k]);
1227  }
1228 
1230  mindR=999.9;
1231 #ifdef DebugLog
1232  if (verbosity%10 > 0)
1233  std::cout << "Now Matching L3 track with reco: L3 Track (eta, phi) "
1234  << vec[2][k].eta() << ":" << vec[2][k].phi() << " L2 Track "
1235  << mindRvec.eta() << ":" << mindRvec.phi() << " dR "
1236  << mindR << std::endl;
1237 #endif
1238  reco::TrackCollection::const_iterator goodTk = trkCollection->end();
1239  if (trkCollection.isValid()) {
1240  double mindP(9999.9);
1241  reco::TrackCollection::const_iterator trkItr;
1242  for (trkItr=trkCollection->begin();
1243  trkItr!=trkCollection->end(); trkItr++) {
1244  math::XYZTLorentzVector v4(trkItr->px(), trkItr->py(),
1245  trkItr->pz(), trkItr->p());
1246  double deltaR = dR(v4, vec[2][k]);
1247  double dp = std::abs(v4.r()/vec[2][k].r()-1.0);
1248  if (deltaR<mindR) {
1249  mindR = deltaR;
1250  mindP = dp;
1251  mindRvec = v4;
1252  goodTk = trkItr;
1253  }
1254 #ifdef DebugLog
1255  if ((verbosity/10)%10>1 && deltaR<1.0) {
1256  std::cout << "reco track: pt " << v4.pt() << " eta " << v4.eta()
1257  << " phi " << v4.phi() << " DR " << deltaR
1258  << std::endl;
1259  }
1260 #endif
1261  }
1262 #ifdef DebugLog
1263  if (verbosity%10 > 0)
1264  std::cout << "Now Matching at Reco level in step 1 DR: " << mindR
1265  << ":" << mindP << " eta:phi " << mindRvec.eta() << ":"
1266  << mindRvec.phi() << std::endl;
1267 #endif
1268  if (mindR < 0.03 && mindP > 0.1) {
1269  for (trkItr=trkCollection->begin();
1270  trkItr!=trkCollection->end(); trkItr++) {
1271  math::XYZTLorentzVector v4(trkItr->px(), trkItr->py(),
1272  trkItr->pz(), trkItr->p());
1273  double deltaR = dR(v4, vec[2][k]);
1274  double dp = std::abs(v4.r()/vec[2][k].r()-1.0);
1275  if (dp<mindP && deltaR<0.03) {
1276  mindR = deltaR;
1277  mindP = dp;
1278  mindRvec = v4;
1279  goodTk = trkItr;
1280  }
1281  }
1282 #ifdef DebugLog
1283  if (verbosity%10 > 0)
1284  std::cout << "Now Matching at Reco level in step 2 DR: " << mindR
1285  << ":" << mindP << " eta:phi " << mindRvec.eta() << ":"
1286  << mindRvec.phi() << std::endl;
1287 #endif
1288  }
1289  fillDifferences(3, vec[2][k], mindRvec, (verbosity%10 >0));
1290  fillHist(3, mindRvec);
1291  if(mindR < 0.03) {
1292  fillDifferences(4, vec[2][k], mindRvec, (verbosity%10 >0));
1293  fillHist(4, mindRvec);
1294  } else {
1295  fillDifferences(5, vec[2][k], mindRvec, (verbosity%10 >0));
1296  fillHist(5, mindRvec);
1297  }
1298  if (goodTk != trkCollection->end()) goodTks.push_back(goodTk);
1299  }
1300  }
1301 }
1302 
1304  std::vector<reco::TrackCollection::const_iterator>& goodTks) {
1305 
1306  if (trkCollection.isValid()) {
1307  // get handles to calogeometry and calotopology
1308  const CaloGeometry* geo = pG.product();
1309  const MagneticField *bField = bFieldH.product();
1310  std::vector<spr::propagatedTrackDirection> trkCaloDirections;
1311  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality, trkCaloDirections, ((verbosity/100)%10>2));
1312 
1313  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
1314 #ifdef DebugLog
1315  if ((verbosity/1000)%10 > 1) {
1316  std::cout << "n of barrelRecHitsHandle " << barrelRecHitsHandle->size() << std::endl;
1318  std::cout << "hit : detid(ieta,iphi) " << (EBDetId)(hit->id()) << " time " << hit->time() << " energy " << hit->energy() << std::endl;
1319  }
1320  std::cout << "n of endcapRecHitsHandle " << endcapRecHitsHandle->size() << std::endl;
1322  std::cout << "hit : detid(ieta,iphi) " << (EEDetId)(hit->id()) << " time " << hit->time() << " energy " << hit->energy() << std::endl;
1323  }
1324  std::cout << "n of hbhe " << hbhe->size() << std::endl;
1325  for (HBHERecHitCollection::const_iterator hit = hbhe->begin(); hit != hbhe->end(); ++hit) {
1326  std::cout << "hit : detid(ieta,iphi) " << hit->id() << " time " << hit->time() << " energy " << hit->energy() << std::endl;
1327  }
1328  }
1329 #endif
1330  unsigned int nTracks=0, ngoodTk=0, nselTk=0;
1331  int ieta=999;
1332  for (trkDetItr = trkCaloDirections.begin(); trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
1333  bool l3Track = (std::find(goodTks.begin(),goodTks.end(),trkDetItr->trkItr) != goodTks.end());
1334  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
1335  math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(),
1336  pTrack->pz(), pTrack->p());
1337  bool selectTk = spr::goodTrack(pTrack,leadPV,selectionParameters,((verbosity/100)%10>1));
1338  double eMipDR=9999., e_inCone=0, conehmaxNearP=0, mindR=999.9, hCone=0;
1339  if (trkDetItr->okHCAL) {
1340  HcalDetId detId = (HcalDetId)(trkDetItr->detIdHCAL);
1341  ieta = detId.ieta();
1342  }
1343  for (unsigned k=0; k<vec[0].size(); ++k) {
1344  double deltaR = dR(v4, vec[0][k]);
1345  if (deltaR<mindR) mindR = deltaR;
1346  }
1347 #ifdef DebugLog
1348  if ((verbosity/100)%10 > 1) std::cout << "Track ECAL " << trkDetItr->okECAL << " HCAL " << trkDetItr->okHCAL << " Flag " << selectTk << std::endl;
1349 #endif
1350  if (selectTk && trkDetItr->okECAL && trkDetItr->okHCAL) {
1351  ngoodTk++;
1352  int nRH_eMipDR=0, nNearTRKs=0;
1354  trkDetItr->pointHCAL, trkDetItr->pointECAL,
1355  a_neutR1, trkDetItr->directionECAL, nRH_eMipDR);
1357  trkDetItr->pointHCAL, trkDetItr->pointECAL,
1358  a_neutR2, trkDetItr->directionECAL, nRH_eMipDR);
1360  trkDetItr->pointHCAL, trkDetItr->pointECAL,
1361  a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
1362  conehmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR, nNearTRKs, ((verbosity/100)%10>1));
1363  e_inCone = e2 - e1;
1364  double distFromHotCell=-99.0;
1365  int nRecHitsCone=-99, ietaHotCell=-99, iphiHotCell=-99;
1366  GlobalPoint gposHotCell(0.,0.,0.);
1367  std::vector<DetId> coneRecHitDetIds;
1368  hCone = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
1369  trkDetItr->pointECAL,
1370  a_coneR, trkDetItr->directionHCAL,
1371  nRecHitsCone, coneRecHitDetIds,
1372  distFromHotCell, ietaHotCell, iphiHotCell,
1373  gposHotCell, -1);
1374  if (eMipDR<1.0) nselTk++;
1375  }
1376  if (l3Track) {
1377  fillHist(10,v4);
1378  if (selectTk) {
1379  fillHist(11,v4);
1380  fillCuts(0, eMipDR, conehmaxNearP, e_inCone, v4, ieta, (mindR>dr_L1));
1381  if (conehmaxNearP < cutCharge) {
1382  fillHist(12,v4);
1383  if (eMipDR < cutMip) {
1384  fillHist(13,v4);
1385  fillEnergy(1, ieta, hCone, eMipDR, v4);
1386  fillEnergy(0, ieta, hCone, eMipDR, v4);
1387  if (e_inCone < cutNeutral) {
1388  fillHist(14, v4);
1389  fillEnergy(4, ieta, hCone, eMipDR, v4);
1390  fillEnergy(3, ieta, hCone, eMipDR, v4);
1391  }
1392  }
1393  }
1394  }
1395  } else if (doL2L3) {
1396  fillHist(15,v4);
1397  if (selectTk) {
1398  fillHist(16,v4);
1399  fillCuts(1, eMipDR, conehmaxNearP, e_inCone, v4, ieta, (mindR>dr_L1));
1400  if (conehmaxNearP < cutCharge) {
1401  fillHist(17,v4);
1402  if (eMipDR < cutMip) {
1403  fillHist(18,v4);
1404  fillEnergy(2, ieta, hCone, eMipDR, v4);
1405  fillEnergy(0, ieta, hCone, eMipDR, v4);
1406  if (e_inCone < cutNeutral) {
1407  fillHist(19, v4);
1408  fillEnergy(5, ieta, hCone, eMipDR, v4);
1409  fillEnergy(3, ieta, hCone, eMipDR, v4);
1410  }
1411  }
1412  }
1413  }
1414  }
1415  }
1416  // std::cout << "Number of tracks selected offline " << nselTk << std::endl;
1417  }
1418 }
1419 
1420 void IsoTrig::chgIsolation(double& etaTriggered, double& phiTriggered,
1421  edm::Handle<reco::TrackCollection>& trkCollection,
1422  const edm::Event& theEvent) {
1424 #ifdef DebugLog
1425  if (verbosity%10>0) std::cout << "Inside chgIsolation() with eta/phi Triggered: " << etaTriggered << "/" << phiTriggered << std::endl;
1426 #endif
1427  std::vector<double> maxP;
1428 
1429  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
1430  const MagneticField *bField = bFieldH.product();
1431  const CaloGeometry* geo = pG.product();
1432  std::vector<spr::propagatedTrackDirection> trkCaloDirections1;
1433  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality, trkCaloDirections1, ((verbosity/100)%10>2));
1434 #ifdef DebugLog
1435  if (verbosity%10>0) std::cout << "Propagated TrkCollection" << std::endl;
1436 #endif
1437  for (unsigned int k=0; k<pixelIsolationConeSizeAtEC_.size(); ++k)
1438  maxP.push_back(0);
1439  unsigned i = pixelTrackRefsHE.size();
1440  std::vector<std::pair<unsigned int, std::pair<double, double>>> VecSeedsatEC;
1441  //loop to select isolated tracks
1442  for (unsigned iS=0; iS<pixelTrackRefsHE.size(); iS++) {
1443  if (pixelTrackRefsHE[iS]->p() > minPTrackValue_) {
1444  bool vtxMatch = false;
1445  //associate to vertex (in Z)
1446  unsigned int ivSel = recVtxs->size();
1447  double minDZ = 100;
1448  for (unsigned int iv = 0; iv < recVtxs->size(); ++iv) {
1449  if (fabs(pixelTrackRefsHE[iS]->dz((*recVtxs)[iv].position()))<minDZ) {
1450  minDZ = fabs(pixelTrackRefsHE[iS]->dz((*recVtxs)[iv].position()));
1451  ivSel = iv;
1452  }
1453  }
1454  //cut on dYX:
1455  if (ivSel == recVtxs->size()) {
1456  vtxMatch = true;
1457  } else if (fabs(pixelTrackRefsHE[iS]->dxy((*recVtxs)[ivSel].position()))<vtxCutSeed_){
1458  vtxMatch = true;
1459  }
1460  //select tracks not matched to triggered L1 jet
1461  double R = deltaR(etaTriggered, phiTriggered, pixelTrackRefsHE[iS]->eta(),
1462  pixelTrackRefsHE[iS]->phi());
1463  if (R > tauUnbiasCone_ && vtxMatch) {
1464  //propagate seed track to ECAL surface:
1465  std::pair<double,double> seedCooAtEC;
1466  // in case vertex is found:
1467  if (minDZ!=100) seedCooAtEC=GetEtaPhiAtEcal(pixelTrackRefsHE[iS]->eta(), pixelTrackRefsHE[iS]->phi(), pixelTrackRefsHE[iS]->pt(), pixelTrackRefsHE[iS]->charge(), (*recVtxs)[ivSel].z());
1468  //in case vertex is not found:
1469  else seedCooAtEC=GetEtaPhiAtEcal(pixelTrackRefsHE[iS]->eta(), pixelTrackRefsHE[iS]->phi(), pixelTrackRefsHE[iS]->pt(), pixelTrackRefsHE[iS]->charge(), 0);
1470  VecSeedsatEC.push_back(std::make_pair(iS, seedCooAtEC));
1471  }
1472  }
1473  }
1474  for (unsigned int l=0; l<VecSeedsatEC.size(); l++) {
1475  unsigned int iSeed = VecSeedsatEC[l].first;
1476  math::XYZTLorentzVector v1(pixelTrackRefsHE[iSeed]->px(),pixelTrackRefsHE[iSeed]->py(),
1477  pixelTrackRefsHE[iSeed]->pz(),pixelTrackRefsHE[iSeed]->p());
1478 
1479  for (unsigned int j=0; j<VecSeedsatEC.size(); j++) {
1480  unsigned int iSurr = VecSeedsatEC[j].first;
1481  if (iSeed != iSurr) {
1482  //define preliminary cone around seed track impact point from which tracks will be extrapolated:
1483  // edm::Ref<reco::IsolatedPixelTrackCandidateCollection> cand2ref =
1484  // edm::Ref<reco::IsolatedPixelTrackCandidateCollection>(L2cands, iSurr);
1485  if (deltaR(pixelTrackRefsHE[iSeed]->eta(), pixelTrackRefsHE[iSeed]->phi(), pixelTrackRefsHE[iSurr]->eta(),
1486  pixelTrackRefsHE[iSurr]->phi()) < prelimCone_) {
1487  unsigned int ivSel = recVtxs->size();
1488  double minDZ2=100;
1489  for (unsigned int iv = 0; iv < recVtxs->size(); ++iv) {
1490  if (fabs(pixelTrackRefsHE[iSurr]->dz((*recVtxs)[iv].position()))<minDZ2) {
1491  minDZ2 = fabs(pixelTrackRefsHE[iSurr]->dz((*recVtxs)[iv].position()));
1492  ivSel = iv;
1493  }
1494  }
1495  //cut ot dXY:
1496  if (minDZ2==100 || fabs(pixelTrackRefsHE[iSurr]->dxy((*recVtxs)[ivSel].position()))<vtxCutIsol_) {
1497  //calculate distance at ECAL surface and update isolation:
1498  double dist = getDistInCM(VecSeedsatEC[i].second.first, VecSeedsatEC[i].second.second, VecSeedsatEC[j].second.first, VecSeedsatEC[j].second.second);
1499  for (unsigned int k=0; k<pixelIsolationConeSizeAtEC_.size(); ++k) {
1500  if (dist<pixelIsolationConeSizeAtEC_[k]) {
1501  if (pixelTrackRefsHE[iSurr]->p() > maxP[k])
1502  maxP[k] = pixelTrackRefsHE[iSurr]->p();
1503  }
1504  }
1505  }
1506  }
1507  }
1508  }
1509 
1510  double conehmaxNearP = -1; bool selectTk=false;
1511  double mindR=999.9; int nTracks=0;
1512  math::XYZTLorentzVector mindRvec;
1513  for (trkDetItr = trkCaloDirections1.begin(); trkDetItr != trkCaloDirections1.end(); trkDetItr++, nTracks++){
1514  int nNearTRKs=0;
1515  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
1516  math::XYZTLorentzVector v2(pTrack->px(), pTrack->py(),
1517  pTrack->pz(), pTrack->p());
1518  double dr = dR(v1,v2);
1519  if (dr<mindR) {
1520  selectTk = spr::goodTrack(pTrack,leadPV,selectionParameters,((verbosity/100)%10>1));
1521  conehmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections1, a_charIsoR, nNearTRKs, ((verbosity/100)%10>1));
1522  mindR = dr;
1523  mindRvec = v2;
1524  }
1525  }
1526  pushChgIsolnTreeVecs(v1, mindRvec, maxP, conehmaxNearP, selectTk);
1527  }
1528  ChgIsolnTree->Fill();
1529 }
1530 
1532  edm::Handle<reco::TrackCollection>& trkCollection){
1533 
1534  t_nGoodTk->clear();
1535  std::vector<int> nGood(4,0);
1536  if (trkCollection.isValid()) {
1537  // get handles to calogeometry and calotopology
1538  const CaloGeometry* geo = pG.product();
1539  const MagneticField *bField = bFieldH.product();
1540  std::vector<spr::propagatedTrackDirection> trkCaloDirections;
1541  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality, trkCaloDirections, ((verbosity/100)%10>2));
1542 
1543  // get the trigger jet
1545  iEvent.getByToken(tok_l1cand_, l1trigobj);
1546 
1547  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
1548  l1trigobj->getObjects(trigger::TriggerL1TauJet, l1tauobjref);
1549  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
1550  l1trigobj->getObjects(trigger::TriggerL1CenJet, l1jetobjref);
1551  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
1552  l1trigobj->getObjects(trigger::TriggerL1ForJet, l1forjetobjref);
1553 
1554  double ptTriggered(-10), etaTriggered(-100), phiTriggered(-100);
1555  for (unsigned int p=0; p<l1tauobjref.size(); p++) {
1556  if (l1tauobjref[p]->pt()>ptTriggered) {
1557  ptTriggered = l1tauobjref[p]->pt();
1558  phiTriggered = l1tauobjref[p]->phi();
1559  etaTriggered = l1tauobjref[p]->eta();
1560  }
1561  }
1562  for (unsigned int p=0; p<l1jetobjref.size(); p++) {
1563  if (l1jetobjref[p]->pt()>ptTriggered) {
1564  ptTriggered = l1jetobjref[p]->pt();
1565  phiTriggered = l1jetobjref[p]->phi();
1566  etaTriggered = l1jetobjref[p]->eta();
1567  }
1568  }
1569  for (unsigned int p=0; p<l1forjetobjref.size(); p++) {
1570  if (l1forjetobjref[p]->pt()>ptTriggered) {
1571  ptTriggered=l1forjetobjref[p]->pt();
1572  phiTriggered=l1forjetobjref[p]->phi();
1573  etaTriggered=l1forjetobjref[p]->eta();
1574  }
1575  }
1576  double pTriggered = ptTriggered*cosh(etaTriggered);
1577  math::XYZTLorentzVector pTrigger(ptTriggered*cos(phiTriggered),
1578  ptTriggered*sin(phiTriggered),
1579  pTriggered*tanh(etaTriggered), pTriggered);
1580 
1581  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
1582  unsigned int nTracks(0);
1583  for (trkDetItr = trkCaloDirections.begin(); trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
1584  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
1585  math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(),
1586  pTrack->pz(), pTrack->p());
1587  bool selectTk = spr::goodTrack(pTrack,leadPV,selectionParameters,((verbosity/100)%10>1));
1588  double mindR = dR(v4, pTrigger);
1589 #ifdef DebugLog
1590  if ((verbosity/100)%10 > 1) std::cout << "Track ECAL " << trkDetItr->okECAL << " HCAL " << trkDetItr->okHCAL << " Flag " << selectTk << std::endl;
1591 #endif
1592  if (selectTk && trkDetItr->okECAL && trkDetItr->okHCAL && mindR > 1.0) {
1593  int nRH_eMipDR(0), nNearTRKs(0);
1594  double eMipDR = spr::eCone_ecal(geo, barrelRecHitsHandle,
1596  trkDetItr->pointHCAL,
1597  trkDetItr->pointECAL, a_mipR,
1598  trkDetItr->directionECAL, nRH_eMipDR);
1599  double conehmaxNearP = spr::chargeIsolationCone(nTracks,
1600  trkCaloDirections,
1601  a_charIsoR, nNearTRKs,
1602  ((verbosity/100)%10>1));
1603  if (conehmaxNearP < 2.0 && eMipDR<1.0) {
1604  if (pTrack->p() >= 20 && pTrack->p() < 30) {
1605  ++nGood[0];
1606  } else if (pTrack->p() >= 30 && pTrack->p() < 40) {
1607  ++nGood[1];
1608  } else if (pTrack->p() >= 40 && pTrack->p() < 60) {
1609  ++nGood[2];
1610  } else if (pTrack->p() >= 60 && pTrack->p() < 100) {
1611  ++nGood[3];
1612  }
1613  }
1614  }
1615  }
1616  }
1617 
1618  for (unsigned int ii=0; ii<nGood.size(); ++ii)
1619  t_nGoodTk->push_back(nGood[ii]);
1620 }
1621 
1623  h_p[indx]->Fill(vec.r());
1624  h_pt[indx]->Fill(vec.pt());
1625  h_eta[indx]->Fill(vec.eta());
1626  h_phi[indx]->Fill(vec.phi());
1627 }
1628 
1631  double dr = dR(vec1,vec2);
1632  double deta = dEta(vec1, vec2);
1633  double dphi = dPhi(vec1, vec2);
1634  double dpt = dPt(vec1, vec2);
1635  double dp = dP(vec1, vec2);
1636  double dinvpt = dinvPt(vec1, vec2);
1637  h_dEta[indx] ->Fill(deta);
1638  h_dPhi[indx] ->Fill(dphi);
1639  h_dPt[indx] ->Fill(dpt);
1640  h_dP[indx] ->Fill(dp);
1641  h_dinvPt[indx]->Fill(dinvpt);
1642  h_mindR[indx] ->Fill(dr);
1643 #ifdef DebugLog
1644  if (debug) std::cout << "mindR for index " << indx << " is " << dr << " deta " << deta << " dphi " << dphi << " dpt " << dpt << " dinvpt " << dinvpt <<std::endl;
1645 #endif
1646 }
1647 
1648 void IsoTrig::fillCuts(int indx, double eMipDR, double conehmaxNearP, double e_inCone, math::XYZTLorentzVector& vec, int ieta, bool cut) {
1649  h_eMip[indx] ->Fill(eMipDR);
1650  h_eMaxNearP[indx]->Fill(conehmaxNearP);
1651  h_eNeutIso[indx] ->Fill(e_inCone);
1652  if ((conehmaxNearP < cutCharge) && (eMipDR < cutMip)) {
1653  for (int lim=0; lim<5; ++lim) {
1654  if ((vec.r()>pLimits[lim]) && (vec.r()<=pLimits[lim+1])) {
1655  h_etaMipTracks[lim][indx][0]->Fill((double)(ieta));
1656  if (cut) h_etaMipTracks[lim][indx][1]->Fill((double)(ieta));
1657  if (e_inCone < cutNeutral) {
1658  h_etaCalibTracks[lim][indx][0]->Fill((double)(ieta));
1659  if (cut) h_etaCalibTracks[lim][indx][1]->Fill((double)(ieta));
1660  }
1661  }
1662  }
1663  }
1664 }
1665 
1666 void IsoTrig::fillEnergy(int indx, int ieta, double hCone, double eMipDR, math::XYZTLorentzVector& vec) {
1667  int kk(-1);
1668  if (ieta > 0 && ieta < 25) kk = 23 + ieta;
1669  else if (ieta > -25 && ieta < 0) kk = -(ieta + 1);
1670  if (kk >= 0 && eMipDR > 0.01 && hCone > 1.0) {
1671  for (int lim=0; lim<5; ++lim) {
1672  if ((vec.r()>pLimits[lim]) && (vec.r()<=pLimits[lim+1])) {
1673  h_eHcal[lim][indx][kk] ->Fill(hCone);
1674  h_eCalo[lim][indx][kk] ->Fill(hCone+eMipDR);
1675  }
1676  }
1677  }
1678 }
1679 
1681  return (vec1.eta()-vec2.eta());
1682 }
1683 
1685 
1686  double phi1 = vec1.phi();
1687  if (phi1 < 0) phi1 += 2.0*M_PI;
1688  double phi2 = vec2.phi();
1689  if (phi2 < 0) phi2 += 2.0*M_PI;
1690  double dphi = phi1-phi2;
1691  if (dphi > M_PI) dphi -= 2.*M_PI;
1692  else if (dphi < -M_PI) dphi += 2.*M_PI;
1693  return dphi;
1694 }
1695 
1697  double deta = dEta(vec1,vec2);
1698  double dphi = dPhi(vec1,vec2);
1699  return std::sqrt(deta*deta + dphi*dphi);
1700 }
1701 
1703  return (vec1.pt()-vec2.pt());
1704 }
1705 
1707  return (std::abs(vec1.r()-vec2.r()));
1708 }
1709 
1711  return ((1/vec1.pt())-(1/vec2.pt()));
1712 }
1713 
1714 std::pair<double,double> IsoTrig::etaPhiTrigger() {
1715  double eta(0), phi(0), ptmax(0);
1716  for (unsigned int k=0; k<vec[0].size(); ++k) {
1717  if (k == 0) {
1718  eta = vec[0][k].eta();
1719  phi = vec[0][k].phi();
1720  ptmax = vec[0][k].pt();
1721  } else if (vec[0][k].pt() > ptmax) {
1722  eta = vec[0][k].eta();
1723  phi = vec[0][k].phi();
1724  ptmax = vec[0][k].pt();
1725  }
1726  }
1727  return std::pair<double,double>(eta,phi);
1728 }
1729 
1730 std::pair<double,double> IsoTrig::GetEtaPhiAtEcal(double etaIP, double phiIP,
1731  double pT, int charge,
1732  double vtxZ) {
1733 
1734  double deltaPhi=0;
1735  double etaEC = 100;
1736  double phiEC = 100;
1737 
1738  double Rcurv = 9999999;
1739  if (bfVal!=0) Rcurv=pT*33.3*100/(bfVal*10); //r(m)=pT(GeV)*33.3/B(kG)
1740 
1741  double ecDist = zEE_;
1742  double ecRad = rEB_; //radius of ECAL barrel (cm)
1743  double theta = 2*atan(exp(-etaIP));
1744  double zNew = 0;
1745  if (theta>0.5*M_PI) theta=M_PI-theta;
1746  if (fabs(etaIP)<1.479) {
1747  if ((0.5*ecRad/Rcurv)>1) {
1748  etaEC = 10000;
1749  deltaPhi = 0;
1750  } else {
1751  deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
1752  double alpha1 = 2*asin(0.5*ecRad/Rcurv);
1753  double z = ecRad/tan(theta);
1754  if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
1755  else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
1756  double zAbs=fabs(zNew);
1757  if (zAbs<ecDist) {
1758  etaEC = -log(tan(0.5*atan(ecRad/zAbs)));
1759  deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
1760  }
1761  if (zAbs>ecDist) {
1762  zAbs = (fabs(etaIP)/etaIP)*ecDist;
1763  double Zflight = fabs(zAbs-vtxZ);
1764  double alpha = (Zflight*ecRad)/(z*Rcurv);
1765  double Rec = 2*Rcurv*sin(alpha/2);
1766  deltaPhi =-charge*alpha/2;
1767  etaEC =-log(tan(0.5*atan(Rec/ecDist)));
1768  }
1769  }
1770  } else {
1771  zNew = (fabs(etaIP)/etaIP)*ecDist;
1772  double Zflight = fabs(zNew-vtxZ);
1773  double Rvirt = fabs(Zflight*tan(theta));
1774  double Rec = 2*Rcurv*sin(Rvirt/(2*Rcurv));
1775  deltaPhi =-(charge)*(Rvirt/(2*Rcurv));
1776  etaEC =-log(tan(0.5*atan(Rec/ecDist)));
1777  }
1778 
1779  if (zNew<0) etaEC=-etaEC;
1780  phiEC = phiIP+deltaPhi;
1781 
1782  if (phiEC<-M_PI) phiEC += 2*M_PI;
1783  if (phiEC>M_PI) phiEC -= 2*M_PI;
1784 
1785  std::pair<double,double> retVal(etaEC,phiEC);
1786  return retVal;
1787 }
1788 
1789 double IsoTrig::getDistInCM(double eta1,double phi1, double eta2,double phi2) {
1790  double Rec;
1791  double theta1=2*atan(exp(-eta1));
1792  double theta2=2*atan(exp(-eta2));
1793  if (fabs(eta1)<1.479) Rec=rEB_; //radius of ECAL barrel
1794  else if (fabs(eta1)>1.479&&fabs(eta1)<7.0) Rec=tan(theta1)*zEE_; //distance from IP to ECAL endcap
1795  else return 1000;
1796 
1797  //|vect| times tg of acos(scalar product)
1798  double angle=acos((sin(theta1)*sin(theta2)*(sin(phi1)*sin(phi2)+cos(phi1)*cos(phi2))+cos(theta1)*cos(theta2)));
1799  if (angle<0.5*M_PI) return fabs((Rec/sin(theta1))*tan(angle));
1800  else return 1000;
1801 }
1802 
1803 //define this as a plug-in
RunNumber_t run() const
Definition: EventID.h:39
unsigned int size() const
number of trigger paths in trigger table
size
Write out results.
double prelimCone_
Definition: IsoTrig.h:133
double p() const
momentum vector magnitude
Definition: TrackBase.h:615
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
std::vector< bool > * t_NFTrkPVFlag
Definition: IsoTrig.h:213
std::vector< double > * t_PixTrkcandPhi
Definition: IsoTrig.h:194
std::vector< double > * t_PixTrkcandP
Definition: IsoTrig.h:191
T getUntrackedParameter(std::string const &, T const &) const
double tauUnbiasCone_
Definition: IsoTrig.h:133
edm::EDGetTokenT< reco::IsolatedPixelTrackCandidateCollection > tok_l2cand_
Definition: IsoTrig.h:155
float alpha
Definition: AMPTWrapper.h:95
const unsigned int nTracks(const reco::Vertex &sv)
double a_coneR
Definition: IsoTrig.h:136
edm::InputTag L1candTag_
Definition: IsoTrig.h:125
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
std::vector< double > * t_NFTrkMinDR
Definition: IsoTrig.h:208
int id() const
getters
Definition: TriggerObject.h:55
RunNumber_t run() const
Definition: RunBase.h:40
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
void chgIsolation(double &etaTriggered, double &phiTriggered, edm::Handle< reco::TrackCollection > &trkCollection, const edm::Event &theEvent)
Definition: IsoTrig.cc:1420
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: IsoTrig.cc:828
std::vector< bool > * t_NFTrkMissFlag
Definition: IsoTrig.h:212
std::vector< reco::TrackRef > pixelTrackRefsHE
Definition: IsoTrig.h:158
double dr_L1
Definition: IsoTrig.h:136
edm::EDGetTokenT< LumiDetails > tok_lumi
Definition: IsoTrig.h:140
TH1D * h_phi[20]
Definition: IsoTrig.h:225
std::vector< bool > * t_PixTrkcandselTk
Definition: IsoTrig.h:196
TH1D * h_EnIn
Definition: IsoTrig.h:220
bool doStudyIsol
Definition: IsoTrig.h:128
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
TH1D * h_dEta[9]
Definition: IsoTrig.h:227
edm::EDGetTokenT< SiPixelRecHitCollection > tok_SiPixelRecHits
Definition: IsoTrig.h:152
float phi() const
Definition: TriggerObject.h:58
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
Definition: TrackBase.h:151
void studyIsolation(edm::Handle< reco::TrackCollection > &, std::vector< reco::TrackCollection::const_iterator > &)
Definition: IsoTrig.cc:1303
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< double > * t_NFTrkcandEta
Definition: IsoTrig.h:205
std::vector< double > * t_NFcandP
Definition: IsoTrig.h:198
edm::Handle< EcalRecHitCollection > barrelRecHitsHandle
Definition: IsoTrig.h:162
TH1D * h_dEtaL1[2]
Definition: IsoTrig.h:226
bool doTiming
Definition: IsoTrig.h:127
std::string theTrackQuality
Definition: IsoTrig.h:135
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
Definition: IsoTrig.h:147
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
TH1I * g_PreHLT
Definition: IsoTrig.h:232
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
math::XYZPoint leadPV
Definition: IsoTrig.h:166
std::vector< EcalRecHit >::const_iterator const_iterator
Geom::Theta< T > theta() const
std::vector< reco::TrackRef > pixelTrackRefsHB
Definition: IsoTrig.h:158
int bunchCrossing() const
Definition: EventBase.h:66
bool changed
Definition: IsoTrig.h:170
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
std::vector< math::XYZTLorentzVector > vec[3]
Definition: IsoTrig.h:233
std::vector< int > * t_nPixSeed
Definition: IsoTrig.h:175
std::vector< double > * t_TrkhCone
Definition: IsoTrig.h:178
double rEB_
Definition: IsoTrig.h:130
edm::EDGetTokenT< reco::IsolatedPixelTrackCandidateCollection > tok_pixtk_
Definition: IsoTrig.h:153
std::vector< bool > * t_NFTrkqltyFlag
Definition: IsoTrig.h:211
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
bool doTrkResTree
Definition: IsoTrig.h:128
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
Definition: IsoTrig.cc:1730
std::vector< double > * t_PixTrkcandMaxP
Definition: IsoTrig.h:195
float energy() const
Definition: TriggerObject.h:65
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
float eta() const
Definition: TriggerObject.h:57
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:627
std::vector< bool > * t_NFTrkselTkFlag
Definition: IsoTrig.h:210
TH1I * h_HLT
Definition: IsoTrig.h:222
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
double dP(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1706
std::vector< double > * t_PixcandP
Definition: IsoTrig.h:186
std::vector< std::string > trigNames
Definition: IsoTrig.h:124
std::pair< double, double > etaPhiTrigger()
Definition: IsoTrig.cc:1714
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
TH1D * h_dP[9]
Definition: IsoTrig.h:227
virtual void beginJob()
Definition: IsoTrig.cc:529
float lumiValue(AlgoType algo, unsigned int bx) const
Definition: LumiDetails.cc:92
double vtxCutIsol_
Definition: IsoTrig.h:132
std::vector< bool > * t_NFTrkMipFlag
Definition: IsoTrig.h:217
double a_neutIsoR
Definition: IsoTrig.h:136
void pushMipCutTreeVecs(math::XYZTLorentzVector &NFcand, math::XYZTLorentzVector &Trkcand, double &EmipNFcand, double &EmipTrkcand, double &mindR, double &mindP1, std::vector< bool > &Flags, double hCone)
Definition: IsoTrig.cc:501
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
U second(std::pair< T, U > const &p)
std::vector< double > * t_NFTrkMinDP1
Definition: IsoTrig.h:209
TH1D * h_EnOut
Definition: IsoTrig.h:220
TH1D * h_dPhiL1[2]
Definition: IsoTrig.h:226
TH1D * h_L1ObjEnergy
Definition: IsoTrig.h:224
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::InputTag PixcandTag_
Definition: IsoTrig.h:125
void studyMipCut(edm::Handle< reco::TrackCollection > &trkCollection, edm::Handle< reco::IsolatedPixelTrackCandidateCollection > &L2cands)
Definition: IsoTrig.cc:1056
HLTPrescaleProvider hltPrescaleProvider_
Definition: IsoTrig.h:123
double dinvPt(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1710
int maxRunNo
Definition: IsoTrig.h:138
double bfVal
Definition: IsoTrig.h:130
int verbosity
Definition: IsoTrig.h:129
TH1D * h_dPhi[9]
Definition: IsoTrig.h:227
edm::ESHandle< CaloGeometry > pG
Definition: IsoTrig.h:160
int iEvent
Definition: GenABIO.cc:230
T mag() const
Definition: PV3DBase.h:67
void studyTrigger(edm::Handle< reco::TrackCollection > &, std::vector< reco::TrackCollection::const_iterator > &)
Definition: IsoTrig.cc:1171
void fillHist(int, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1622
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< double > * t_NFTrkcandP
Definition: IsoTrig.h:203
edm::Handle< HBHERecHitCollection > hbhe
Definition: IsoTrig.h:161
std::vector< bool > * t_TrkNuIsolFlag
Definition: IsoTrig.h:184
TH1I * h_nHLT
Definition: IsoTrig.h:222
double a_mipR
Definition: IsoTrig.h:136
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
Definition: IsoTrig.h:146
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
std::vector< bool > * t_TrkPVFlag
Definition: IsoTrig.h:183
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< double > * t_ECone
Definition: IsoTrig.h:218
std::vector< double > vec1
Definition: HCALResponse.h:15
T sqrt(T t)
Definition: SSEVec.h:18
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
Definition: IsoTrig.h:144
double cutNeutral
Definition: IsoTrig.h:137
TTree * ChgIsolnTree
Definition: IsoTrig.h:172
TH1I * h_Pre
Definition: IsoTrig.h:223
TH1I * h_PreHLT
Definition: IsoTrig.h:222
TH1D * h_dinvPt[9]
Definition: IsoTrig.h:228
void fillEnergy(int, int, double, double, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1666
double a_charIsoR
Definition: IsoTrig.h:136
edm::Handle< reco::VertexCollection > recVtxs
Definition: IsoTrig.h:165
double zEE_
Definition: IsoTrig.h:130
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< bool > * t_NFTrkChgIsoFlag
Definition: IsoTrig.h:215
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tok_pixtks_
Definition: IsoTrig.h:156
std::vector< double > * t_TrkP
Definition: IsoTrig.h:179
double minPTrackValue_
Definition: IsoTrig.h:132
TH1D * h_eta[20]
Definition: IsoTrig.h:225
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double cutCharge
Definition: IsoTrig.h:137
std::pair< T, T > etaphi(T x, T y, T z)
Definition: FastMath.h:128
TH1I * h_Filters
Definition: IsoTrig.h:223
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > * t_NFcandEta
Definition: IsoTrig.h:200
std::vector< double > * t_timeL2Prod
Definition: IsoTrig.h:173
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: IsoTrig.cc:213
TH1D * h_eHcal[5][6][48]
Definition: IsoTrig.h:231
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:86
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
Definition: IsoTrig.h:148
TTree * MipCutTree
Definition: IsoTrig.h:172
bool doL2L3
Definition: IsoTrig.h:127
static std::string const triggerResults
Definition: EdmProvDump.cc:41
IsoTrig(const edm::ParameterSet &)
Definition: IsoTrig.cc:29
virtual void endJob()
Definition: IsoTrig.cc:790
std::vector< double > * t_PixcandPt
Definition: IsoTrig.h:187
bool isValid() const
Definition: HandleBase.h:74
double a_neutR2
Definition: IsoTrig.h:137
TH1D * h_PreL1wt
Definition: IsoTrig.h:224
std::map< unsigned int, const std::pair< int, int > > TrigPreList
Definition: IsoTrig.h:169
std::vector< double > * t_NFcandEmip
Definition: IsoTrig.h:202
TH1D * h_eMaxNearP[2]
Definition: IsoTrig.h:229
double dPhi(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1684
void studyTiming(const edm::Event &theEvent)
Definition: IsoTrig.cc:945
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
void clearChgIsolnTreeVectors()
Definition: IsoTrig.cc:444
ii
Definition: cuy.py:588
#define M_PI
std::vector< bool > * t_NFTrkPropFlag
Definition: IsoTrig.h:214
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:639
std::vector< double > * t_NFTrkcandPhi
Definition: IsoTrig.h:206
int k[5][pyjets_maxn]
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
unsigned int id
TH2D * h_MipEnMatch
Definition: IsoTrig.h:221
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
TH1D * h_p[20]
Definition: IsoTrig.h:225
TH1D * h_eNeutIso[2]
Definition: IsoTrig.h:229
TH1I * h_PreL1
Definition: IsoTrig.h:222
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes
Definition: IsoTrig.h:142
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
Float e1
Definition: deltaR.h:20
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:103
int minRunNo
Definition: IsoTrig.h:138
edm::InputTag L2candTag_
Definition: IsoTrig.h:125
std::vector< bool > * t_TrkMissFlag
Definition: IsoTrig.h:182
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
Definition: IsoTrig.cc:1789
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
Definition: IsoTrig.h:145
std::vector< int > * t_nPixCand
Definition: IsoTrig.h:174
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
#define debug
Definition: HDRShower.cc:19
void StudyTrkEbyP(edm::Handle< reco::TrackCollection > &trkCollection)
Definition: IsoTrig.cc:831
std::vector< double > * t_NFTrkcandPt
Definition: IsoTrig.h:204
TH1D * h_eCalo[5][6][48]
Definition: IsoTrig.h:231
T const * product() const
Definition: Handle.h:81
TH1I * g_Pre
Definition: IsoTrig.h:232
virtual void endRun(edm::Run const &, edm::EventSetup const &)
Definition: IsoTrig.cc:823
auto dp
Definition: deltaR.h:22
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< size_type > Keys
edm::Handle< reco::BeamSpot > beamSpotH
Definition: IsoTrig.h:164
std::vector< double > * t_PixTrkcandPt
Definition: IsoTrig.h:192
double dEta(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1680
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< reco::VertexCollection > tok_verthb_
Definition: IsoTrig.h:150
bool doChgIsolTree
Definition: IsoTrig.h:128
std::vector< double > * t_NFcandPt
Definition: IsoTrig.h:199
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: IsoTrig.cc:205
std::pair< int, int > prescaleValues(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
spr::trackSelectionParameters selectionParameters
Definition: IsoTrig.h:134
Float e2
Definition: deltaR.h:21
TH1D * h_pt[20]
Definition: IsoTrig.h:225
std::map< unsigned int, unsigned int > TrigList
Definition: IsoTrig.h:168
std::vector< bool > * t_TrkqltyFlag
Definition: IsoTrig.h:181
HLTConfigProvider const & hltConfigProvider() const
TH1D * h_etaMipTracks[5][2][2]
Definition: IsoTrig.h:230
std::string const & label() const
Definition: InputTag.h:36
std::vector< std::vector< double > > * t_PixcandMaxP
Definition: IsoTrig.h:190
std::vector< double > * t_NFTrkcandEmip
Definition: IsoTrig.h:207
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_l1cand_
Definition: IsoTrig.h:154
std::vector< edm::InputTag > pixelTracksSources_
Definition: IsoTrig.h:126
size_type size() const
edm::EDGetTokenT< SeedingLayerSetsHits > tok_SeedingLayerhb
Definition: IsoTrig.h:151
edm::EventID id() const
Definition: EventBase.h:60
double dR(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1696
TH1D * h_mindR[9]
Definition: IsoTrig.h:228
double a_neutR1
Definition: IsoTrig.h:137
void clearMipCutTreeVectors()
Definition: IsoTrig.cc:460
std::vector< double > * t_PixcandEta
Definition: IsoTrig.h:188
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
Definition: IsoTrig.h:149
static int position[264][3]
Definition: ReadPGInfo.cc:509
reco::TrackBase::TrackQuality minQuality
double vtxCutSeed_
Definition: IsoTrig.h:132
StreamID streamID() const
Definition: Event.h:81
edm::EDGetTokenT< SeedingLayerSetsHits > tok_SeedingLayerhe
Definition: IsoTrig.h:151
void fillDifferences(int, math::XYZTLorentzVector &, math::XYZTLorentzVector &, bool)
Definition: IsoTrig.cc:1629
TH1D * h_dPt[9]
Definition: IsoTrig.h:227
TH2D * h_MipEnNoMatch
Definition: IsoTrig.h:221
double dPt(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
Definition: IsoTrig.cc:1702
std::vector< bool > * t_NFTrkNeuIsoFlag
Definition: IsoTrig.h:216
edm::Handle< EcalRecHitCollection > endcapRecHitsHandle
Definition: IsoTrig.h:163
TTree * TrkResTree
Definition: IsoTrig.h:172
const Point & position() const
position
Definition: BeamSpot.h:62
std::vector< double > * t_PixcandPhi
Definition: IsoTrig.h:189
std::vector< double > * t_PixTrkcandEta
Definition: IsoTrig.h:193
bool doMipCutTree
Definition: IsoTrig.h:127
edm::Service< TFileService > fs
Definition: IsoTrig.h:171
std::vector< int > * t_nGoodTk
Definition: IsoTrig.h:176
TTree * TimingTree
Definition: IsoTrig.h:172
double pLimits[6]
Definition: IsoTrig.h:139
TH1I * g_PreL1
Definition: IsoTrig.h:232
edm::ESHandle< MagneticField > bFieldH
Definition: IsoTrig.h:159
float mass() const
Definition: TriggerObject.h:59
edm::EDGetTokenT< reco::VertexCollection > tok_verthe_
Definition: IsoTrig.h:150
double queryModuleTimeByLabel(edm::StreamID, std::string const &module) const
TH1I * h_nL3Objs
Definition: IsoTrig.h:223
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
Definition: IsoTrig.h:143
~IsoTrig()
Definition: IsoTrig.cc:157
void getGoodTracks(const edm::Event &, edm::Handle< reco::TrackCollection > &)
Definition: IsoTrig.cc:1531
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
TH1D * h_dRL1[2]
Definition: IsoTrig.h:226
TH1D * h_etaCalibTracks[5][2][2]
Definition: IsoTrig.h:230
unsigned short size() const
Get the number of SeedingLayerSets.
std::vector< bool > * t_TrkselTkFlag
Definition: IsoTrig.h:180
T const * product() const
Definition: ESHandle.h:86
double cutMip
Definition: IsoTrig.h:137
std::string processName
Definition: IsoTrig.h:135
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:239
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
void fillCuts(int, double, double, double, math::XYZTLorentzVector &, int, bool)
Definition: IsoTrig.cc:1648
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:633
Definition: Run.h:42
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: IsoTrig.cc:826
TH1D * h_PreHLTwt
Definition: IsoTrig.h:224
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt
Definition: IsoTrig.h:141
levels
correction levels
std::vector< double > pixelIsolationConeSizeAtEC_
Definition: IsoTrig.h:131
double eCone_hcal(const CaloGeometry *geo, edm::Handle< T > &hits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int detOnly=-1, bool useRaw=false, bool debug=false)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: IsoTrig.cc:817
void pushChgIsolnTreeVecs(math::XYZTLorentzVector &Pixcand, math::XYZTLorentzVector &Trkcand, std::vector< double > &PixMaxP, double &TrkMaxP, bool &selTk)
Definition: IsoTrig.cc:484
TH1I * g_Accepts
Definition: IsoTrig.h:232
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
TH1D * h_eMip[2]
Definition: IsoTrig.h:228
std::vector< double > * t_NFcandPhi
Definition: IsoTrig.h:201