CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalIsoTrkAnalyzer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 
4 // Root objects
5 #include "TROOT.h"
6 #include "TSystem.h"
7 #include "TFile.h"
8 #include "TProfile.h"
9 #include "TDirectory.h"
10 #include "TTree.h"
11 #include "TLorentzVector.h"
12 #include "TInterpreter.h"
13 
14 //Tracks
19 // Vertices
23 
24 //Triggers
32 
35 
43 
49 
62 
63 //#define DebugLog
64 
66 
67 public:
68  explicit HcalIsoTrkAnalyzer(const edm::ParameterSet&);
70 
71  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
72 
73 private:
74  virtual void beginJob() ;
75  virtual void analyze(const edm::Event&, const edm::EventSetup&);
76  virtual void endJob() ;
77  virtual void beginRun(edm::Run const&, edm::EventSetup const&);
78  virtual void endRun(edm::Run const&, edm::EventSetup const&);
79  virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
80  virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
81 
83 
84  bool changed;
87  std::vector<std::string> trigNames, HLTNames;
88  std::vector<int> trigKount, trigPass;
92  int nRun, nAll, nGood;
99 
106 
107  TTree *tree;
113  std::vector<unsigned int> *t_DetIds;
114  std::vector<double> *t_HitEnergies, pbin;
115  std::vector<bool> *t_trgbits;
116  std::vector<std::string> trgnames;
117 };
118 
120  changed(false), nRun(0), nAll(0), nGood(0) {
121  //now do whatever initialization is needed
122  trigNames = iConfig.getParameter<std::vector<std::string> >("Triggers");
123  theTrackQuality = iConfig.getParameter<std::string>("TrackQuality");
124  processName = iConfig.getParameter<std::string>("ProcessName");
125  l1Filter = iConfig.getParameter<std::string>("L1Filter");
126  l2Filter = iConfig.getParameter<std::string>("L2Filter");
127  l3Filter = iConfig.getParameter<std::string>("L3Filter");
128  reco::TrackBase::TrackQuality trackQuality_=reco::TrackBase::qualityByName(theTrackQuality);
129  selectionParameters.minPt = iConfig.getParameter<double>("MinTrackPt");
130  selectionParameters.minQuality = trackQuality_;
131  selectionParameters.maxDxyPV = iConfig.getParameter<double>("MaxDxyPV");
132  selectionParameters.maxDzPV = iConfig.getParameter<double>("MaxDzPV");
133  selectionParameters.maxChi2 = iConfig.getParameter<double>("MaxChi2");
134  selectionParameters.maxDpOverP = iConfig.getParameter<double>("MaxDpOverP");
135  selectionParameters.minOuterHit = iConfig.getParameter<int>("MinOuterHit");
136  selectionParameters.minLayerCrossed = iConfig.getParameter<int>("MinLayerCrossed");
137  selectionParameters.maxInMiss = iConfig.getParameter<int>("MaxInMiss");
138  selectionParameters.maxOutMiss = iConfig.getParameter<int>("MaxOutMiss");
139  a_coneR = iConfig.getParameter<double>("ConeRadius");
140  a_charIsoR = a_coneR + 28.9;
141  a_mipR = iConfig.getParameter<double>("ConeRadiusMIP");
142  pTrackMin_ = iConfig.getParameter<double>("MinimumTrackP");
143  eEcalMax_ = iConfig.getParameter<double>("MaximumEcalEnergy");
144  eIsolation_ = iConfig.getParameter<double>("IsolationEnergy");
145  triggerEvent_ = iConfig.getParameter<edm::InputTag>("TriggerEventLabel");
146  theTriggerResultsLabel = iConfig.getParameter<edm::InputTag>("TriggerResultLabel");
147  labelGenTrack_ = iConfig.getParameter<std::string>("TrackLabel");
148  labelRecVtx_ = iConfig.getParameter<std::string>("VertexLabel");
149  labelEB_ = iConfig.getParameter<std::string>("EBRecHitLabel");
150  labelEE_ = iConfig.getParameter<std::string>("EERecHitLabel");
151  labelHBHE_ = iConfig.getParameter<std::string>("HBHERecHitLabel");
152  edm::InputTag labelBS = iConfig.getParameter<edm::InputTag>("BeamSpotLabel");
153  std::string modnam = iConfig.getUntrackedParameter<std::string>("ModuleName","");
154  std::string prdnam = iConfig.getUntrackedParameter<std::string>("ProducerName","");
155 
156  // define tokens for access
157  tok_trigEvt = consumes<trigger::TriggerEvent>(triggerEvent_);
158  tok_trigRes = consumes<edm::TriggerResults>(theTriggerResultsLabel);
159  tok_bs_ = consumes<reco::BeamSpot>(labelBS);
160  tok_genTrack_ = consumes<reco::TrackCollection>(labelGenTrack_);
161  if (modnam == "") {
162  tok_recVtx_ = consumes<reco::VertexCollection>(labelRecVtx_);
163  tok_EB_ = consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit",labelEB_));
164  tok_EE_ = consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit",labelEE_));
165  tok_hbhe_ = consumes<HBHERecHitCollection>(labelHBHE_);
166  edm::LogInfo("HcalIsoTrack") << "Labels used " << triggerEvent_ << " "
167  << theTriggerResultsLabel << " "
168  << labelBS << " " << labelRecVtx_ << " "
169  << labelGenTrack_ << " "
170  << edm::InputTag("ecalRecHit",labelEB_) << " "
171  << edm::InputTag("ecalRecHit",labelEE_) << " "
172  << labelHBHE_;
173  } else {
174  tok_recVtx_ = consumes<reco::VertexCollection>(edm::InputTag(modnam,labelRecVtx_,prdnam));
175  tok_EB_ = consumes<EcalRecHitCollection>(edm::InputTag(modnam,labelEB_,prdnam));
176  tok_EE_ = consumes<EcalRecHitCollection>(edm::InputTag(modnam,labelEE_,prdnam));
177  tok_hbhe_ = consumes<HBHERecHitCollection>(edm::InputTag(modnam,labelHBHE_,prdnam));
178  edm::LogInfo("HcalIsoTrack") << "Labels used " << triggerEvent_
179  << "\n " << theTriggerResultsLabel
180  << "\n " << labelBS
181  << "\n " << edm::InputTag(modnam,labelRecVtx_,prdnam)
182  << "\n " << labelGenTrack_
183  << "\n " << edm::InputTag(modnam,labelEB_,prdnam)
184  << "\n " << edm::InputTag(modnam,labelEE_,prdnam)
185  << "\n " << edm::InputTag(modnam,labelHBHE_,prdnam);
186  }
187 
188  std::vector<int> dummy(trigNames.size(),0);
189  trigKount = trigPass = dummy;
190  edm::LogInfo("HcalIsoTrack") <<"Parameters read from config file \n"
191  <<"\t minPt " << selectionParameters.minPt
192  <<"\t theTrackQuality " << theTrackQuality
193  <<"\t minQuality " << selectionParameters.minQuality
194  <<"\t maxDxyPV " << selectionParameters.maxDxyPV
195  <<"\t maxDzPV " << selectionParameters.maxDzPV
196  <<"\t maxChi2 " << selectionParameters.maxChi2
197  <<"\t maxDpOverP " << selectionParameters.maxDpOverP
198  <<"\t minOuterHit " << selectionParameters.minOuterHit
199  <<"\t minLayerCrossed " << selectionParameters.minLayerCrossed
200  <<"\t maxInMiss " << selectionParameters.maxInMiss
201  <<"\t maxOutMiss " << selectionParameters.maxOutMiss
202  <<"\t a_coneR " << a_coneR
203  <<"\t a_charIsoR " << a_charIsoR
204  <<"\t a_mipR " << a_mipR;
205  edm::LogInfo("HcalIsoTrack") << "Process " << processName << " L1Filter:"
206  << l1Filter << " L2Filter:" << l2Filter
207  << " L3Filter:" << l3Filter;
208  for (unsigned int k=0; k<trigNames.size(); ++k)
209  edm::LogInfo("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames[k];
210 }
211 
213  // do anything here that needs to be done at desctruction time
214  // (e.g. close files, deallocate resources etc.)
215 }
216 
218 
219  t_Run = iEvent.id().run();
220  t_Event = iEvent.id().event();
221  nAll++;
222 #ifdef DebugLog
223  edm::LogInfo("HcalIsoTrack") << "Run " << t_Run << " Event " << t_Event
224  << " Luminosity " << iEvent.luminosityBlock()
225  << " Bunch " << iEvent.bunchCrossing();
226 #endif
227  //Get magnetic field and ECAL channel status
229  iSetup.get<IdealMagneticFieldRecord>().get(bFieldH);
230  const MagneticField *bField = bFieldH.product();
231 
232  // get handles to calogeometry and calotopology
234  iSetup.get<CaloGeometryRecord>().get(pG);
235  const CaloGeometry* geo = pG.product();
236 
237  bool okC(true);
238  //Get track collection
240  iEvent.getByToken(tok_genTrack_, trkCollection);
241  reco::TrackCollection::const_iterator trkItr;
242  if (!trkCollection.isValid()) {
243  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelGenTrack_;
244  okC = false;
245  }
246 
247  //event weight for FLAT sample
248  t_EventWeight = 1.0;
249 
250  //Define the best vertex and the beamspot
252  iEvent.getByToken(tok_recVtx_, recVtxs);
253  edm::Handle<reco::BeamSpot> beamSpotH;
254  iEvent.getByToken(tok_bs_, beamSpotH);
255  math::XYZPoint leadPV(0,0,0);
256  if (recVtxs.isValid() && recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
257  leadPV = math::XYZPoint( (*recVtxs)[0].x(),(*recVtxs)[0].y(), (*recVtxs)[0].z() );
258  } else if (beamSpotH.isValid()) {
259  leadPV = beamSpotH->position();
260  }
261 #ifdef DebugLog
262  edm::LogInfo("HcalIsoTrack") << "Primary Vertex " << leadPV;
263  if (beamSpotH.isValid()) edm::LogInfo("HcalIsoTrack") << "Beam Spot "
264  << beamSpotH->position();
265 #endif
266  // RecHits
267  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
268  iEvent.getByToken(tok_EB_, barrelRecHitsHandle);
269  if (!barrelRecHitsHandle.isValid()) {
270  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEB_;
271  okC = false;
272  }
273  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
274  iEvent.getByToken(tok_EE_, endcapRecHitsHandle);
275  if (!endcapRecHitsHandle.isValid()) {
276  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelEE_;
277  okC = false;
278  }
280  iEvent.getByToken(tok_hbhe_, hbhe);
281  if (!hbhe.isValid()) {
282  edm::LogWarning("HcalIsoTrack") << "Cannot access the collection " << labelHBHE_;
283  okC = false;
284  }
285 
286  //Propagate tracks to calorimeter surface)
287  std::vector<spr::propagatedTrackDirection> trkCaloDirections;
288  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality,
289  trkCaloDirections, false);
290  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
291 
292  //Trigger
293  trgnames.clear();
294  t_trgbits->clear();
295  for (unsigned int i=0; i<trigNames.size(); ++i) t_trgbits->push_back(false);
296 
297  trigger::TriggerEvent triggerEvent;
298  edm::Handle<trigger::TriggerEvent> triggerEventHandle;
299  iEvent.getByToken(tok_trigEvt, triggerEventHandle);
300  if (!triggerEventHandle.isValid()) {
301  edm::LogWarning("HcalIsoTrack") << "Error! Can't get the product "
302  << triggerEvent_.label() ;
303  } else if (okC) {
304  triggerEvent = *(triggerEventHandle.product());
305 
306  const trigger::TriggerObjectCollection& TOC(triggerEvent.getObjects());
309  iEvent.getByToken(tok_trigRes, triggerResults);
310  if (triggerResults.isValid()) {
311  std::vector<std::string> modules;
312  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
313  const std::vector<std::string> & triggerNames_ = triggerNames.triggerNames();
314  for (unsigned int iHLT=0; iHLT<triggerResults->size(); iHLT++) {
315  bool ok(false);
316  int hlt = triggerResults->accept(iHLT);
317  for (unsigned int i=0; i<trigNames.size(); ++i) {
318  if (triggerNames_[iHLT].find(trigNames[i].c_str())!=std::string::npos) {
319  t_trgbits->at(i) = (hlt>0);
320  trigKount[i]++;
321  if (hlt > 0) {
322  ok = true;
323  trigPass[i]++;
324  }
325 #ifdef DebugLog
326  edm::LogInfo("HcalIsoTrack") << "This trigger "
327  << triggerNames_[iHLT] << " Flag "
328  << hlt << ":" << ok;
329 #endif
330  }
331  }
332 
333  if (ok) {
334  unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[iHLT]);
335  const std::vector<std::string>& moduleLabels(hltConfig_.moduleLabels(triggerindx));
336  std::vector<math::XYZTLorentzVector> vec[3];
337  //loop over all trigger filters in event (i.e. filters passed)
338  for (unsigned int ifilter=0; ifilter<triggerEvent.sizeFilters();
339  ++ifilter) {
340  std::vector<int> Keys;
341  std::string label = triggerEvent.filterTag(ifilter).label();
342  //loop over keys to objects passing this filter
343  for (unsigned int imodule=0; imodule<moduleLabels.size();
344  imodule++) {
345  if (label.find(moduleLabels[imodule]) != std::string::npos) {
346 #ifdef DebugLog
347  edm::LogInfo("HcalIsoTrack") << "FilterName " << label;
348 #endif
349  for (unsigned int ifiltrKey=0; ifiltrKey<triggerEvent.filterKeys(ifilter).size(); ++ifiltrKey) {
350  Keys.push_back(triggerEvent.filterKeys(ifilter)[ifiltrKey]);
351  const trigger::TriggerObject& TO(TOC[Keys[ifiltrKey]]);
352  math::XYZTLorentzVector v4(TO.px(), TO.py(), TO.pz(), TO.energy());
353  if (label.find(l2Filter) != std::string::npos) {
354  vec[1].push_back(v4);
355  } else if (label.find(l3Filter) != std::string::npos) {
356  vec[2].push_back(v4);
357  } else if (label.find(l1Filter) != std::string::npos ||
358  l1Filter == "") {
359  vec[0].push_back(v4);
360  }
361 #ifdef DebugLog
362  edm::LogInfo("HcalIsoTrack") << "key " << ifiltrKey<<" : pt "
363  << TO.pt() << " eta "<< TO.eta()
364  << " phi " << TO.phi()<<" mass "
365  << TO.mass() << " Id "<<TO.id();
366 #endif
367  }
368 #ifdef DebugLog
369  edm::LogInfo("HcalIsoTrack") << "sizes " << vec[0].size() << ":"
370  << vec[1].size() <<":" <<vec[2].size();
371 #endif
372  }
373  }
374  }
375  double dr;
377  math::XYZTLorentzVector mindRvec1;
378  double mindR1(999);
379  for (int lvl=1; lvl<3; lvl++) {
380  for (unsigned int i=0; i<vec[lvl].size(); i++) {
381  dr = dR(vec[0][0],vec[lvl][i]);
382 #ifdef DebugLog
383  edm::LogInfo("HcalIsoTrack") << "lvl " << lvl << " i " << i
384  << " dR " << dr;
385 #endif
386  if (dr<mindR1) {
387  mindR1 = dr;
388  mindRvec1 = vec[lvl][i];
389  }
390  }
391  }
392 
393  t_l1pt = vec[0][0].pt();
394  t_l1eta = vec[0][0].eta();
395  t_l1phi = vec[0][0].phi();
396  if (vec[2].size()>0) {
397  t_l3pt = vec[2][0].pt();
398  t_l3eta = vec[2][0].eta();
399  t_l3phi = vec[2][0].phi();
400  }
401  //Loop over tracks
402  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
403  unsigned int nTracks(0), nselTracks(0);
404  for (trkDetItr = trkCaloDirections.begin(),nTracks=0;
405  trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++) {
406  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
407  math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(),
408  pTrack->pz(), pTrack->p());
409 #ifdef DebugLog
410  edm::LogInfo("HcalIsoTrack") << "This track : " << nTracks
411  << " (pt|eta|phi|p) :" << pTrack->pt()
412  << "|" << pTrack->eta() << "|"
413  << pTrack->phi() << "|" <<pTrack->p();
414 #endif
415  math::XYZTLorentzVector mindRvec2;
416  t_mindR2 = 999;
417 
418  for (unsigned int k=0; k<vec[2].size(); ++k) {
419  dr = dR(vec[2][k],v4); //changed 1 to 2
420  if (dr<t_mindR2) {
421  t_mindR2 = dr;
422  mindRvec2 = vec[2][k];
423  }
424  }
425  t_mindR1 = dR(vec[0][0],v4);
426 #ifdef DebugLog
427  edm::LogInfo("HcalIsoTrack") << "Closest L3 object at mindr :"
428  << t_mindR2 << " is " << mindRvec2
429  << " and from L1 " << t_mindR1;
430 #endif
431  //Selection of good track
432  t_selectTk = spr::goodTrack(pTrack,leadPV,selectionParameters,false);
434  oneCutParameters.maxDxyPV = 10;
435  oneCutParameters.maxDzPV = 100;
436  oneCutParameters.maxInMiss = 2;
437  oneCutParameters.maxOutMiss= 2;
438  bool qltyFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,false);
439  oneCutParameters = selectionParameters;
440  oneCutParameters.maxDxyPV = 10;
441  oneCutParameters.maxDzPV = 100;
442  t_qltyMissFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,false);
443  oneCutParameters = selectionParameters;
444  oneCutParameters.maxInMiss = 2;
445  oneCutParameters.maxOutMiss= 2;
446  t_qltyPVFlag = spr::goodTrack(pTrack,leadPV,oneCutParameters,false);
447  t_ieta = 0;
448  if (trkDetItr->okHCAL) {
449  HcalDetId detId = (HcalDetId)(trkDetItr->detIdHCAL);
450  t_ieta = detId.ieta();
451  }
452 #ifdef DebugLog
453  edm::LogInfo("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : "
454  << qltyFlag << "|" << trkDetItr->okECAL
455  << "|" << trkDetItr->okHCAL;
456 #endif
457  t_qltyFlag = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL);
458  t_p = pTrack->p();
459  if (t_qltyFlag) {
460  nselTracks++;
461  int nRH_eMipDR(0), nNearTRKs(0), nRecHits(-999);
462  t_eMipDR = spr::eCone_ecal(geo, barrelRecHitsHandle,
463  endcapRecHitsHandle,
464  trkDetItr->pointHCAL,
465  trkDetItr->pointECAL,
466  a_mipR, trkDetItr->directionECAL,
467  nRH_eMipDR);
468  t_DetIds->clear(); t_HitEnergies->clear();
469  std::vector<DetId> ids;
470  t_eHcal = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
471  trkDetItr->pointECAL, a_coneR,
472  trkDetItr->directionHCAL,nRecHits,
473  ids, *t_HitEnergies);
474  for (unsigned int k=0; k<ids.size(); ++k) {
475  t_DetIds->push_back(ids[k].rawId());
476  }
477  t_hmaxNearP = spr::chargeIsolationCone(nTracks,trkCaloDirections,
478  a_charIsoR, nNearTRKs,
479  false);
480 #ifdef DebugLog
481  edm::LogInfo("HcalIsoTrack") << "This track : " << nTracks
482  << " (pt|eta|phi|p) :" << pTrack->pt()
483  << "|" << pTrack->eta() << "|"
484  << pTrack->phi() << "|" << t_p;
485  edm::LogInfo("HcalIsoTrack") << "e_MIP " << t_eMipDR
486  << " Chg Isolation " << t_hmaxNearP
487  << " eHcal" << t_eHcal << " ieta "
488  << t_ieta << " Quality "
489  << t_qltyMissFlag << ":"
490  << t_qltyPVFlag << ":" << t_selectTk;
491  for (unsigned int lll=0;lll<t_DetIds->size();lll++) {
492  edm::LogInfo("HcalIsoTrack") << "det id is = " <<t_DetIds->at(lll)
493  << " hit enery is = "
494  << t_HitEnergies->at(lll) ;
495  }
496 #endif
497  if (t_p>pTrackMin_ && t_eMipDR<eEcalMax_ &&
499  tree->Fill();
500  nGood++;
501 #ifdef DebugLog
502  for (unsigned int k=0; k<t_trgbits->size(); k++)
503  edm::LogInfo("HcalIsoTrack") << "trigger bit is = "
504  << t_trgbits->at(k);
505 #endif
506  }
507  }
508  }
509  }
510  }
511  // check if trigger names in (new) config
512  if (changed) {
513  changed = false;
514 #ifdef DebugLog
515  edm::LogInfo("HcalIsoTrack") << "New trigger menu found !!!";
516 #endif
517  const unsigned int n(hltConfig_.size());
518  for (unsigned itrig=0; itrig<triggerNames_.size(); itrig++) {
519  unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[itrig]);
520  if (triggerindx >= n)
521  edm::LogInfo("HcalIsoTrack") << triggerNames_[itrig] << " "
522  << triggerindx << " does not exist in "
523  << "the current menu";
524 #ifdef DebugLog
525  else
526  edm::LogInfo("HcalIsoTrack") << triggerNames_[itrig] << " "
527  << triggerindx << " exists";
528 #endif
529  }
530  }
531  }
532  }
533 }
534 
536 
537  tree = fs->make<TTree>("CalibTree", "CalibTree");
538 
539  tree->Branch("t_Run", &t_Run, "t_Run/I");
540  tree->Branch("t_Event", &t_Event, "t_Event/I");
541  tree->Branch("t_ieta", &t_ieta, "t_ieta/I");
542  tree->Branch("t_EventWeight", &t_EventWeight, "t_EventWeight/D");
543  tree->Branch("t_l1pt", &t_l1pt, "t_l1pt/D");
544  tree->Branch("t_l1eta", &t_l1eta, "t_l1eta/D");
545  tree->Branch("t_l1phi", &t_l1phi, "t_l1phi/D");
546  tree->Branch("t_l3pt", &t_l3pt, "t_l3pt/D");
547  tree->Branch("t_l3eta", &t_l3eta, "t_l3eta/D");
548  tree->Branch("t_l3phi", &t_l3phi, "t_l3phi/D");
549  tree->Branch("t_p", &t_p, "t_p/D");
550  tree->Branch("t_mindR1", &t_mindR1, "t_mindR1/D");
551  tree->Branch("t_mindR2", &t_mindR2, "t_mindR2/D");
552  tree->Branch("t_eMipDR", &t_eMipDR, "t_eMipDR/D");
553  tree->Branch("t_eHcal", &t_eHcal, "t_eHcal/D");
554  tree->Branch("t_hmaxNearP", &t_hmaxNearP, "t_hmaxNearP/D");
555  tree->Branch("t_selectTk", &t_selectTk, "t_selectTk/O");
556  tree->Branch("t_qltyFlag", &t_qltyFlag, "t_qltyFlag/O");
557  tree->Branch("t_qltyMissFlag",&t_qltyMissFlag,"t_qltyMissFlag/O");
558  tree->Branch("t_qltyPVFlag", &t_qltyPVFlag, "t_qltyPVFlag/O)");
559 
560  t_DetIds = new std::vector<unsigned int>();
561  t_HitEnergies = new std::vector<double>();
562  t_trgbits = new std::vector<bool>();
563  tree->Branch("t_DetIds", "std::vector<unsigned int>", &t_DetIds);
564  tree->Branch("t_HitEnergies", "std::vector<double>", &t_HitEnergies);
565  tree->Branch("t_trgbits","std::vector<bool>", &t_trgbits);
566 }
567 
568 // ------------ method called once each job just after ending the event loop ------------
570  edm::LogInfo("HcalIsoTrack") << "Finds " << nGood << " good tracks in "
571  << nAll << " events from " << nRun << " runs";
572  for (unsigned int k=0; k<trigNames.size(); ++k)
573  edm::LogInfo("HcalIsoTrack") << "Trigger[" << k << "]: " << trigNames[k]
574  << " Events " << trigKount[k] << " Passed "
575  << trigPass[k];
576 }
577 
578 // ------------ method called when starting to processes a run ------------
579 void HcalIsoTrkAnalyzer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
580  edm::LogInfo("HcalIsoTrack") << "Run[" << nRun << "] " << iRun.run()
581  << " hltconfig.init " << hltConfig_.init(iRun,iSetup,processName,changed);
582 }
583 
584 // ------------ method called when ending the processing of a run ------------
586  nRun++;
587  edm::LogInfo("HcalIsoTrack") << "endRun[" << nRun << "] " << iRun.run();
588 }
589 
590 // ------------ method called when starting to processes a luminosity block ------------
592 // ------------ method called when ending the processing of a luminosity block ------------
594 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
596  //The following says we do not know what parameters are allowed so do no validation
597  // Please change this to state exactly what you do use, even if it is no parameters
599  desc.setUnknown();
600  descriptions.addDefault(desc);
601 }
602 
604  return reco::deltaR(vec1.eta(),vec1.phi(),vec2.eta(),vec2.phi());
605 }
606 
607 //define this as a plug-in
609 
RunNumber_t run() const
Definition: EventID.h:39
unsigned int size() const
number of trigger paths in trigger table
double p() const
momentum vector magnitude
Definition: TrackBase.h:568
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
T getUntrackedParameter(std::string const &, T const &) const
virtual void endRun(edm::Run const &, edm::EventSetup const &)
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:208
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
int id() const
getters
Definition: TriggerObject.h:55
RunNumber_t run() const
Definition: RunBase.h:42
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
std::vector< std::string > HLTNames
std::vector< int > trigKount
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
float phi() const
Definition: TriggerObject.h:58
TrackQuality
track quality
Definition: TrackBase.h:139
HcalIsoTrkAnalyzer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
int bunchCrossing() const
Definition: EventBase.h:66
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:598
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
std::vector< std::string > trgnames
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
float energy() const
Definition: TriggerObject.h:65
std::vector< double > * t_HitEnergies
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double deltaR(const T1 &t1, const T2 &t2)
Definition: deltaR.h:48
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
float eta() const
Definition: TriggerObject.h:57
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:580
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
std::vector< unsigned int > * t_DetIds
float float float z
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
std::vector< double > pbin
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
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int iEvent
Definition: GenABIO.cc:230
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
void addDefault(ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
edm::Service< TFileService > fs
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
std::vector< double > vec1
Definition: HCALResponse.h:15
double pt() const
track transverse momentum
Definition: TrackBase.h:574
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
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)
static std::string const triggerResults
Definition: EdmProvDump.cc:40
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
HLTConfigProvider hltConfig_
bool isValid() const
Definition: HandleBase.h:75
virtual void analyze(const edm::Event &, const edm::EventSetup &)
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:592
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< bool > * t_trgbits
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:103
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:114
T const * product() const
Definition: Handle.h:81
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 debug=false)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const T & get() const
Definition: EventSetup.h:55
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
T const * product() const
Definition: ESHandle.h:86
double dR(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
std::string const & label() const
Definition: InputTag.h:42
edm::EventID id() const
Definition: EventBase.h:60
std::vector< int > trigPass
reco::TrackBase::TrackQuality minQuality
edm::InputTag theTriggerResultsLabel
std::vector< std::string > trigNames
spr::trackSelectionParameters selectionParameters
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes
volatile std::atomic< bool > shutdown_flag false
Definition: DDAxes.h:10
float mass() const
Definition: TriggerObject.h:59
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
edm::InputTag triggerEvent_
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
tuple size
Write out results.
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:586
Definition: Run.h:41