CMS 3D CMS Logo

IsolatedTracksHcalScale.cc
Go to the documentation of this file.
1 // System include files
2 #include <cmath>
3 #include <string>
4 #include <map>
5 #include <vector>
6 
7 
8 // root objects
9 #include "TROOT.h"
10 #include "TSystem.h"
11 #include "TFile.h"
12 #include "TH1F.h"
13 #include "TH2F.h"
14 #include "TProfile.h"
15 #include "TDirectory.h"
16 #include "TTree.h"
17 
18 #include <Math/GenVector/VectorUtil.h>
19 
30 
32 
37 
38 // muons and tracks
43 // Vertices
47 // Calorimeters
56 
57 // Jets in the event
61 
69 
70 // TFile Service
73 
81 
87 
88 // SimHit
94 
95 // track associator
100 
101 class IsolatedTracksHcalScale : public edm::one::EDAnalyzer<edm::one::SharedResources> {
102 
103 public:
106 
107  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
108 
109 private:
110  void beginJob() override ;
111  void analyze(const edm::Event&, const edm::EventSetup&) override;
112  void endJob() override ;
113 
114  void clearTreeVectors();
115 
116 private:
117 
118  bool doMC_;
123  double tMinE_, tMaxE_;
124 
126 
133 
139 
141 
142  TTree* tree_;
143 
145  std::vector<double> *t_trackP, *t_trackPt, *t_trackEta, *t_trackPhi;
146  std::vector<double> *t_trackHcalEta, *t_trackHcalPhi, *t_eHCALDR;
147  std::vector<double> *t_hCone, *t_conehmaxNearP, *t_eMipDR, *t_eECALDR;
148  std::vector<double> *t_e11x11_20Sig, *t_e15x15_20Sig;
149  std::vector<double> *t_eMipDR_1, *t_eECALDR_1, *t_eMipDR_2, *t_eECALDR_2;
150  std::vector<double> *t_hConeHB, *t_eHCALDRHB;
153  std::vector<double> *t_hsimInfoTotal, *t_hsim;
156  std::vector<int> *t_nSimHits;
157 };
158 
160  doMC_(iConfig.getUntrackedParameter<bool>("DoMC",false)),
161  myverbose_(iConfig.getUntrackedParameter<int>("Verbosity",5)),
162  theTrackQuality_(iConfig.getUntrackedParameter<std::string>("TrackQuality","highPurity")),
163  a_mipR_(iConfig.getUntrackedParameter<double>("ConeRadiusMIP",14.0)),
164  a_coneR_(iConfig.getUntrackedParameter<double>("ConeRadius",34.98)),
165  tMinE_(iConfig.getUntrackedParameter<double>("TimeMinCutECAL",-500.)),
166  tMaxE_(iConfig.getUntrackedParameter<double>("TimeMaxCutECAL",500.)),
168 
169  usesResource(TFileService::kSharedResource);
170 
171  //now do what ever initialization is needed
173  selectionParameters_.minPt = iConfig.getUntrackedParameter<double>("MinTrackPt", 10.0);
175  selectionParameters_.maxDxyPV = iConfig.getUntrackedParameter<double>("MaxDxyPV", 0.2);
176  selectionParameters_.maxDzPV = iConfig.getUntrackedParameter<double>("MaxDzPV", 5.0);
177  selectionParameters_.maxChi2 = iConfig.getUntrackedParameter<double>("MaxChi2", 5.0);
178  selectionParameters_.maxDpOverP = iConfig.getUntrackedParameter<double>("MaxDpOverP", 0.1);
179  selectionParameters_.minOuterHit = iConfig.getUntrackedParameter<int>("MinOuterHit", 4);
180  selectionParameters_.minLayerCrossed = iConfig.getUntrackedParameter<int>("MinLayerCrossed", 8);
181  selectionParameters_.maxInMiss = iConfig.getUntrackedParameter<int>("MaxInMiss", 0);
182  selectionParameters_.maxOutMiss = iConfig.getUntrackedParameter<int>("MaxOutMiss", 0);
183  a_charIsoR_ = a_coneR_ + 28.9;
184  a_neutIsoR_ = a_charIsoR_*0.726;
185 
186  tok_genTrack_ = consumes<reco::TrackCollection>(edm::InputTag("generalTracks"));
187  tok_recVtx_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
188  tok_bs_ = consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"));
189  tok_EB_ = consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit","EcalRecHitsEB"));
190  tok_EE_ = consumes<EcalRecHitCollection>(edm::InputTag("ecalRecHit","EcalRecHitsEE"));
191  tok_hbhe_ = consumes<HBHERecHitCollection>(edm::InputTag("hbhereco"));
192  tok_simTk_ = consumes<edm::SimTrackContainer>(edm::InputTag("g4SimHits"));
193  tok_simVtx_ = consumes<edm::SimVertexContainer>(edm::InputTag("g4SimHits"));
194  tok_caloEB_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "EcalHitsEB"));
195  tok_caloEE_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "EcalHitsEE"));
196  tok_caloHH_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "HcalHits"));
197 
198  if (myverbose_>=0) {
199  edm::LogVerbatim("IsoTrack") <<"Parameters read from config file \n"
200  <<" doMC " << doMC_
201  <<"\t myverbose " << myverbose_
202  <<"\t minPt " << selectionParameters_.minPt
203  <<"\t theTrackQuality " << theTrackQuality_
204  <<"\t minQuality " << selectionParameters_.minQuality
205  <<"\t maxDxyPV " << selectionParameters_.maxDxyPV
206  <<"\t maxDzPV " << selectionParameters_.maxDzPV
207  <<"\t maxChi2 " << selectionParameters_.maxChi2
208  <<"\t maxDpOverP " << selectionParameters_.maxDpOverP
209  <<"\t minOuterHit " << selectionParameters_.minOuterHit
210  <<"\t minLayerCrossed " << selectionParameters_.minLayerCrossed
211  <<"\t maxInMiss " << selectionParameters_.maxInMiss
212  <<"\t maxOutMiss " << selectionParameters_.maxOutMiss
213  <<"\t a_coneR " << a_coneR_
214  <<"\t a_charIsoR " << a_charIsoR_
215  <<"\t a_neutIsoR " << a_neutIsoR_
216  <<"\t a_mipR " << a_mipR_
217  <<"\t time Range (" << tMinE_
218  << ":" << tMaxE_ << ")";
219  }
220 }
221 
223 
225  desc.addUntracked<bool>("doMC", false);
226  desc.addUntracked<int>("Verbosity", 0);
227  desc.addUntracked<std::string>("TrackQuality", "highPurity");
228  desc.addUntracked<double>("MinTrackPt", 10.0);
229  desc.addUntracked<double>("MaxDxyPV", 0.02);
230  desc.addUntracked<double>("MaxDzPV", 0.02);
231  desc.addUntracked<double>("MaxChi2", 5.0);
232  desc.addUntracked<double>("MaxDpOverP", 0.1);
233  desc.addUntracked<int>("MinOuterHit", 4);
234  desc.addUntracked<int>("MinLayerCrossed", 8);
235  desc.addUntracked<int>("MaxInMiss", 0);
236  desc.addUntracked<int>("MaxOutMiss", 0);
237  desc.addUntracked<double>("ConeRadius", 34.98);
238  desc.addUntracked<double>("ConeRadiusMIP", 14.0);
239  desc.addUntracked<double>("TimeMinCutECAL", -500.0);
240  desc.addUntracked<double>("TimeMaxCutECAL", 500.0);
241  descriptions.add("isolatedTracksHcalScale",desc);
242 }
243 
245 
247  iSetup.get<IdealMagneticFieldRecord>().get(bFieldH);
248  const MagneticField *bField = bFieldH.product();
249 
250  // get handles to calogeometry and calotopology
252  iSetup.get<CaloGeometryRecord>().get(pG);
253  const CaloGeometry* geo = pG.product();
254 
255  edm::ESHandle<CaloTopology> theCaloTopology;
256  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
257  const CaloTopology *caloTopology = theCaloTopology.product();
258 
259  // Retrieve the good/bad ECAL channels from the DB
261  iSetup.get<EcalChannelStatusRcd>().get(ecalChStatus);
262  const EcalChannelStatus* theEcalChStatus = ecalChStatus.product();
263 
265 
266  ++nEventProc_;
267 
268  t_RunNo = iEvent.id().run();
269  t_EvtNo = iEvent.id().event();
270  t_Lumi = iEvent.luminosityBlock();
271  t_Bunch = iEvent.bunchCrossing();
272  if (myverbose_>0)
273  edm::LogVerbatim("IsoTrack") << nEventProc_ << " Run " << t_RunNo
274  << " Event " << t_EvtNo << " Lumi " << t_Lumi
275  << " Bunch " << t_Bunch;
276 
278  iEvent.getByToken(tok_genTrack_, trkCollection);
279 
281  iEvent.getByToken(tok_recVtx_,recVtxs);
282 
283  // Get the beamspot
284  edm::Handle<reco::BeamSpot> beamSpotH;
285  iEvent.getByToken(tok_bs_, beamSpotH);
286 
287  math::XYZPoint leadPV(0,0,0);
288  if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
289  leadPV = math::XYZPoint( (*recVtxs)[0].x(),(*recVtxs)[0].y(), (*recVtxs)[0].z() );
290  } else if (beamSpotH.isValid()) {
291  leadPV = beamSpotH->position();
292  }
293 
294  if (myverbose_>0) {
295  edm::LogVerbatim("IsoTrack") << "Primary Vertex " << leadPV;
296  if (beamSpotH.isValid()) edm::LogVerbatim("IsoTrack") << "Beam Spot "
297  << beamSpotH->position();
298  }
299 
300  std::vector<spr::propagatedTrackDirection> trkCaloDirections;
301  spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, (myverbose_>2));
302  std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
303 
304  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
305  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
306  iEvent.getByToken(tok_EB_,barrelRecHitsHandle);
307  iEvent.getByToken(tok_EE_,endcapRecHitsHandle);
308 
310  iEvent.getByToken(tok_hbhe_, hbhe);
311  const HBHERecHitCollection Hithbhe = *(hbhe.product());
312 
313  //get Handles to SimTracks and SimHits
316 
317  //get Handles to PCaloHitContainers of eb/ee/hbhe
321 
322  //associates tracker rechits/simhits to a track
323  std::unique_ptr<TrackerHitAssociator> associate;
324 
325  if (doMC_) {
326  iEvent.getByToken(tok_simTk_,SimTk);
327  iEvent.getByToken(tok_simVtx_,SimVtx);
328  iEvent.getByToken(tok_caloEB_, pcaloeb);
329  iEvent.getByToken(tok_caloEE_, pcaloee);
330  iEvent.getByToken(tok_caloHH_, pcalohh);
331  associate.reset(new TrackerHitAssociator(iEvent, trackerHitAssociatorConfig_));
332  }
333 
334  unsigned int nTracks=0;
335  for (trkDetItr = trkCaloDirections.begin(),nTracks=0; trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
336  const reco::Track* pTrack = &(*(trkDetItr->trkItr));
337  if (spr::goodTrack(pTrack,leadPV,selectionParameters_,(myverbose_>2)) && trkDetItr->okECAL && trkDetItr->okHCAL) {
338  int nRH_eMipDR=0, nRH_eDR=0, nNearTRKs=0, nRecHitsCone=-99;
339  double distFromHotCell=-99.0, distFromHotCell2=-99.0;
340  int ietaHotCell=-99, iphiHotCell=-99;
341  int ietaHotCell2=-99, iphiHotCell2=-99;
342  GlobalPoint gposHotCell(0.,0.,0.), gposHotCell2(0.,0.,0.);
343  std::vector<DetId> coneRecHitDetIds, coneRecHitDetIds2;
344  std::pair<double, bool> e11x11_20SigP, e15x15_20SigP;
345  double hCone = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
346  trkDetItr->pointECAL,
347  a_coneR_, trkDetItr->directionHCAL,
348  nRecHitsCone, coneRecHitDetIds,
349  distFromHotCell, ietaHotCell, iphiHotCell,
350  gposHotCell, -1);
351  double hConeHB = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
352  trkDetItr->pointECAL,
353  a_coneR_, trkDetItr->directionHCAL,
354  nRecHitsCone, coneRecHitDetIds,
355  distFromHotCell, ietaHotCell,
356  iphiHotCell, gposHotCell,
357  (int)(HcalBarrel));
358  double eHCALDR = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
359  trkDetItr->pointECAL, a_charIsoR_,
360  trkDetItr->directionHCAL, nRecHitsCone,
361  coneRecHitDetIds2, distFromHotCell2,
362  ietaHotCell2, iphiHotCell2, gposHotCell2,
363  -1);
364  double eHCALDRHB = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL,
365  trkDetItr->pointECAL, a_charIsoR_,
366  trkDetItr->directionHCAL, nRecHitsCone,
367  coneRecHitDetIds2, distFromHotCell2,
368  ietaHotCell2, iphiHotCell2,
369  gposHotCell2, (int)(HcalBarrel));
370 
371  double conehmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, nNearTRKs, (myverbose_>3));
372 
373  double eMipDR = spr::eCone_ecal(geo, barrelRecHitsHandle,
374  endcapRecHitsHandle,trkDetItr->pointHCAL,
375  trkDetItr->pointECAL, a_mipR_,
376  trkDetItr->directionECAL, nRH_eMipDR);
377  double eECALDR = spr::eCone_ecal(geo, barrelRecHitsHandle,
378  endcapRecHitsHandle,trkDetItr->pointHCAL,
379  trkDetItr->pointECAL, a_neutIsoR_,
380  trkDetItr->directionECAL, nRH_eDR);
381  double eMipDR_1= spr::eCone_ecal(geo, barrelRecHitsHandle,
382  endcapRecHitsHandle,trkDetItr->pointHCAL,
383  trkDetItr->pointECAL, a_mipR_,
384  trkDetItr->directionECAL, nRH_eMipDR,
385  0.030, 0.150);
386  double eECALDR_1=spr::eCone_ecal(geo, barrelRecHitsHandle,
387  endcapRecHitsHandle,trkDetItr->pointHCAL,
388  trkDetItr->pointECAL, a_neutIsoR_,
389  trkDetItr->directionECAL, nRH_eDR,
390  0.030, 0.150);
391  double eMipDR_2= spr::eCone_ecal(geo, barrelRecHitsHandle,
392  endcapRecHitsHandle,trkDetItr->pointHCAL,
393  trkDetItr->pointECAL, a_mipR_,
394  trkDetItr->directionECAL, nRH_eMipDR,
395  0.060, 0.300);
396  double eECALDR_2=spr::eCone_ecal(geo, barrelRecHitsHandle,
397  endcapRecHitsHandle,trkDetItr->pointHCAL,
398  trkDetItr->pointECAL, a_neutIsoR_,
399  trkDetItr->directionECAL, nRH_eDR,
400  0.060, 0.300);
401 
402  HcalDetId closestCell = (HcalDetId)(trkDetItr->detIdHCAL);
403 
405  iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
406 
407  e11x11_20SigP = spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.product(),5,5, 0.060, 0.300, tMinE_,tMaxE_);
408  e15x15_20SigP = spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.product(),7,7, 0.060, 0.300, tMinE_,tMaxE_);
409 
410  // Fill the tree Branches here
411  t_trackP ->push_back( pTrack->p() );
412  t_trackPt ->push_back( pTrack->pt() );
413  t_trackEta ->push_back( pTrack->momentum().eta() );
414  t_trackPhi ->push_back( pTrack->momentum().phi() );
415  t_trackHcalEta ->push_back( closestCell.ieta() );
416  t_trackHcalPhi ->push_back( closestCell.iphi() );
417  t_hCone ->push_back( hCone);
418  t_conehmaxNearP ->push_back( conehmaxNearP);
419  t_eMipDR ->push_back( eMipDR);
420  t_eECALDR ->push_back( eECALDR);
421  t_eHCALDR ->push_back( eHCALDR);
422  t_e11x11_20Sig ->push_back( e11x11_20SigP.first );
423  t_e15x15_20Sig ->push_back( e15x15_20SigP.first );
424  t_eMipDR_1 ->push_back( eMipDR_1);
425  t_eECALDR_1 ->push_back( eECALDR_1);
426  t_eMipDR_2 ->push_back( eMipDR_2);
427  t_eECALDR_2 ->push_back( eECALDR_2);
428  t_hConeHB ->push_back( hConeHB);
429  t_eHCALDRHB ->push_back( eHCALDRHB);
430 
431  if (myverbose_ > 0) {
432  edm::LogVerbatim("IsoTrack") << "Track p " << pTrack->p() << " pt "
433  << pTrack->pt() << " eta "
434  << pTrack->momentum().eta() << " phi "
435  << pTrack->momentum().phi()
436  << " ieta/iphi (" << closestCell.ieta()
437  << ", " << closestCell.iphi()
438  << ") Energy in cone " << hCone
439  << " Charge Isolation " << conehmaxNearP
440  << " eMIP (" << eMipDR << ", " << eMipDR_1
441  << ", " << eMipDR_2 << ")"
442  << " Neutral isolation (ECAL) ("
443  << eECALDR-eMipDR << ", "
444  << eECALDR_1-eMipDR_1 << ", "
445  << eECALDR_2-eMipDR_2 << ") (ECAL NxN) "
446  << e15x15_20SigP.first-e11x11_20SigP.first
447  << " (HCAL) " << eHCALDR-hCone;
448  }
449 
450  if (doMC_) {
451  int nSimHits = -999;
452  double hsim;
453  std::map<std::string, double> hsimInfo;
454  std::vector<int> multiplicity;
455  hsim = spr::eCone_hcal(geo, pcalohh, trkDetItr->pointHCAL,
456  trkDetItr->pointECAL, a_coneR_,
457  trkDetItr->directionHCAL, nSimHits);
458  hsimInfo = spr::eHCALSimInfoCone(iEvent, pcalohh, SimTk, SimVtx,
459  pTrack, *associate, geo,
460  trkDetItr->pointHCAL,
461  trkDetItr->pointECAL, a_coneR_,
462  trkDetItr->directionHCAL,
463  multiplicity);
464 
465  t_hsimInfoMatched ->push_back(hsimInfo["eMatched" ]);
466  t_hsimInfoRest ->push_back(hsimInfo["eRest" ]);
467  t_hsimInfoPhoton ->push_back(hsimInfo["eGamma" ]);
468  t_hsimInfoNeutHad ->push_back(hsimInfo["eNeutralHad"]);
469  t_hsimInfoCharHad ->push_back(hsimInfo["eChargedHad"]);
470  t_hsimInfoPdgMatched->push_back(hsimInfo["pdgMatched" ]);
471  t_hsimInfoTotal ->push_back(hsimInfo["eTotal" ]);
472 
473  t_hsimInfoNMatched ->push_back(multiplicity.at(0));
474  t_hsimInfoNTotal ->push_back(multiplicity.at(1));
475  t_hsimInfoNNeutHad ->push_back(multiplicity.at(2));
476  t_hsimInfoNCharHad ->push_back(multiplicity.at(3));
477  t_hsimInfoNPhoton ->push_back(multiplicity.at(4));
478  t_hsimInfoNRest ->push_back(multiplicity.at(5));
479 
480  t_hsim ->push_back(hsim );
481  t_nSimHits ->push_back(nSimHits );
482 
483  if (myverbose_ > 0) {
484  edm::LogVerbatim("IsoTrack") << "Matched (E) " << hsimInfo["eMatched"]
485  << " (N) " << multiplicity.at(0)
486  << " Rest (E) " << hsimInfo["eRest"]
487  << " (N) " << multiplicity.at(1)
488  << " Gamma (E) " << hsimInfo["eGamma"]
489  << " (N) " << multiplicity.at(2)
490  << " Neutral Had (E) "
491  << hsimInfo["eNeutralHad"] << " (N) "
492  << multiplicity.at(3)
493  << " Charged Had (E) "
494  << hsimInfo["eChargedHad"] << " (N) "
495  << multiplicity.at(4) << " Total (E) "
496  << hsimInfo["eTotal"] << " (N) "
497  << multiplicity.at(5) << " PDG "
498  << hsimInfo["pdgMatched"] << " Total E "
499  << hsim << " NHit " << nSimHits;
500  }
501  }
502  }
503  }
504 
505  tree_->Fill();
506 }
507 
509 
510  nEventProc_=0;
512 
514  tree_ = fs->make<TTree>("tree", "tree");
515  tree_->SetAutoSave(10000);
516 
517  tree_->Branch("t_RunNo" ,&t_RunNo ,"t_RunNo/I");
518  tree_->Branch("t_Lumi" ,&t_Lumi ,"t_Lumi/I");
519  tree_->Branch("t_Bunch" ,&t_Bunch ,"t_Bunch/I");
520 
521  t_trackP = new std::vector<double>();
522  t_trackPt = new std::vector<double>();
523  t_trackEta = new std::vector<double>();
524  t_trackPhi = new std::vector<double>();
525  t_trackHcalEta = new std::vector<double>();
526  t_trackHcalPhi = new std::vector<double>();
527  t_hCone = new std::vector<double>();
528  t_conehmaxNearP = new std::vector<double>();
529  t_eMipDR = new std::vector<double>();
530  t_eECALDR = new std::vector<double>();
531  t_eHCALDR = new std::vector<double>();
532  t_e11x11_20Sig = new std::vector<double>();
533  t_e15x15_20Sig = new std::vector<double>();
534  t_eMipDR_1 = new std::vector<double>();
535  t_eECALDR_1 = new std::vector<double>();
536  t_eMipDR_2 = new std::vector<double>();
537  t_eECALDR_2 = new std::vector<double>();
538  t_hConeHB = new std::vector<double>();
539  t_eHCALDRHB = new std::vector<double>();
540 
541  tree_->Branch("t_trackP", "std::vector<double>", &t_trackP);
542  tree_->Branch("t_trackPt", "std::vector<double>", &t_trackPt);
543  tree_->Branch("t_trackEta", "std::vector<double>", &t_trackEta);
544  tree_->Branch("t_trackPhi", "std::vector<double>", &t_trackPhi);
545  tree_->Branch("t_trackHcalEta", "std::vector<double>", &t_trackHcalEta);
546  tree_->Branch("t_trackHcalPhi", "std::vector<double>", &t_trackHcalPhi);
547  tree_->Branch("t_hCone", "std::vector<double>", &t_hCone);
548  tree_->Branch("t_conehmaxNearP", "std::vector<double>", &t_conehmaxNearP);
549  tree_->Branch("t_eMipDR", "std::vector<double>", &t_eMipDR);
550  tree_->Branch("t_eECALDR", "std::vector<double>", &t_eECALDR);
551  tree_->Branch("t_eHCALDR", "std::vector<double>", &t_eHCALDR);
552  tree_->Branch("t_e11x11_20Sig", "std::vector<double>", &t_e11x11_20Sig);
553  tree_->Branch("t_e15x15_20Sig", "std::vector<double>", &t_e15x15_20Sig);
554  tree_->Branch("t_eMipDR_1", "std::vector<double>", &t_eMipDR_1);
555  tree_->Branch("t_eECALDR_1", "std::vector<double>", &t_eECALDR_1);
556  tree_->Branch("t_eMipDR_2", "std::vector<double>", &t_eMipDR_2);
557  tree_->Branch("t_eECALDR_2", "std::vector<double>", &t_eECALDR_2);
558  tree_->Branch("t_hConeHB", "std::vector<double>", &t_hConeHB);
559  tree_->Branch("t_eHCALDRHB", "std::vector<double>", &t_eHCALDRHB);
560 
561  if (doMC_) {
562  t_hsimInfoMatched = new std::vector<double>();
563  t_hsimInfoRest = new std::vector<double>();
564  t_hsimInfoPhoton = new std::vector<double>();
565  t_hsimInfoNeutHad = new std::vector<double>();
566  t_hsimInfoCharHad = new std::vector<double>();
567  t_hsimInfoPdgMatched = new std::vector<double>();
568  t_hsimInfoTotal = new std::vector<double>();
569  t_hsimInfoNMatched = new std::vector<int>();
570  t_hsimInfoNTotal = new std::vector<int>();
571  t_hsimInfoNNeutHad = new std::vector<int>();
572  t_hsimInfoNCharHad = new std::vector<int>();
573  t_hsimInfoNPhoton = new std::vector<int>();
574  t_hsimInfoNRest = new std::vector<int>();
575  t_hsim = new std::vector<double>();
576  t_nSimHits = new std::vector<int>();
577 
578  tree_->Branch("t_hsimInfoMatched", "std::vector<double>", &t_hsimInfoMatched);
579  tree_->Branch("t_hsimInfoRest", "std::vector<double>", &t_hsimInfoRest);
580  tree_->Branch("t_hsimInfoPhoton", "std::vector<double>", &t_hsimInfoPhoton);
581  tree_->Branch("t_hsimInfoNeutHad", "std::vector<double>", &t_hsimInfoNeutHad);
582  tree_->Branch("t_hsimInfoCharHad", "std::vector<double>", &t_hsimInfoCharHad);
583  tree_->Branch("t_hsimInfoPdgMatched", "std::vector<double>", &t_hsimInfoPdgMatched);
584  tree_->Branch("t_hsimInfoTotal", "std::vector<double>", &t_hsimInfoTotal);
585  tree_->Branch("t_hsimInfoNMatched", "std::vector<int>", &t_hsimInfoNMatched);
586  tree_->Branch("t_hsimInfoNTotal", "std::vector<int>", &t_hsimInfoNTotal);
587  tree_->Branch("t_hsimInfoNNeutHad", "std::vector<int>", &t_hsimInfoNNeutHad);
588  tree_->Branch("t_hsimInfoNCharHad", "std::vector<int>", &t_hsimInfoNCharHad);
589  tree_->Branch("t_hsimInfoNPhoton", "std::vector<int>", &t_hsimInfoNPhoton);
590  tree_->Branch("t_hsimInfoNRest", "std::vector<int>", &t_hsimInfoNRest);
591  tree_->Branch("t_hsim", "std::vector<double>", &t_hsim);
592  tree_->Branch("t_nSimHits", "std::vector<int>", &t_nSimHits);
593  }
594 }
595 
597  edm::LogVerbatim("IsoTrack") << "Number of Events Processed " << nEventProc_;
598 }
599 
601 
602  t_trackP ->clear();
603  t_trackPt ->clear();
604  t_trackEta ->clear();
605  t_trackPhi ->clear();
606  t_trackHcalEta ->clear();
607  t_trackHcalPhi ->clear();
608  t_hCone ->clear();
609  t_conehmaxNearP ->clear();
610  t_eMipDR ->clear();
611  t_eECALDR ->clear();
612  t_eHCALDR ->clear();
613  t_e11x11_20Sig ->clear();
614  t_e15x15_20Sig ->clear();
615  t_eMipDR_1 ->clear();
616  t_eECALDR_1 ->clear();
617  t_eMipDR_2 ->clear();
618  t_eECALDR_2 ->clear();
619  t_hConeHB ->clear();
620  t_eHCALDRHB ->clear();
621 
622  if (doMC_) {
623  t_hsimInfoMatched ->clear();
624  t_hsimInfoRest ->clear();
625  t_hsimInfoPhoton ->clear();
626  t_hsimInfoNeutHad ->clear();
627  t_hsimInfoCharHad ->clear();
628  t_hsimInfoPdgMatched ->clear();
629  t_hsimInfoTotal ->clear();
630  t_hsimInfoNMatched ->clear();
631  t_hsimInfoNTotal ->clear();
632  t_hsimInfoNNeutHad ->clear();
633  t_hsimInfoNCharHad ->clear();
634  t_hsimInfoNPhoton ->clear();
635  t_hsimInfoNRest ->clear();
636  t_hsim ->clear();
637  t_nSimHits ->clear();
638  }
639 }
640 
641 
642 //define this as a plug-in
RunNumber_t run() const
Definition: EventID.h:39
static const std::string kSharedResource
Definition: TFileService.h:76
double p() const
momentum vector magnitude
Definition: TrackBase.h:615
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, int useRaw=0, bool debug=false)
std::vector< double > * t_hsimInfoMatched
EventNumber_t event() const
Definition: EventID.h:41
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > * t_eHCALDR
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
const unsigned int nTracks(const reco::Vertex &sv)
std::vector< int > * t_hsimInfoNRest
std::vector< double > * t_hCone
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
IsolatedTracksHcalScale(const edm::ParameterSet &)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< int > * t_hsimInfoNTotal
std::vector< int > * t_hsimInfoNCharHad
edm::EDGetTokenT< edm::PCaloHitContainer > tok_caloEE_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< int > * t_hsimInfoNMatched
TrackQuality
track quality
Definition: TrackBase.h:151
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< double > * t_hsim
int bunchCrossing() const
Definition: EventBase.h:66
std::vector< double > * t_hsimInfoNeutHad
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< double > * t_eMipDR_2
std::vector< int > * t_hsimInfoNPhoton
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:675
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< double > * t_e11x11_20Sig
std::vector< int > * t_hsimInfoNNeutHad
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_caloEB_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
spr::trackSelectionParameters selectionParameters_
double pt() const
track transverse momentum
Definition: TrackBase.h:621
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
std::vector< double > * t_trackEta
int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
std::vector< double > * t_eECALDR_2
edm::EDGetTokenT< edm::SimTrackContainer > tok_simTk_
std::vector< double > * t_eECALDR
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)
bool isValid() const
Definition: HandleBase.h:74
std::vector< double > * t_eMipDR_1
int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
std::vector< double > * t_trackPt
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
T const * product() const
Definition: Handle.h:81
std::vector< double > * t_trackHcalEta
std::vector< double > * t_trackP
std::vector< double > * t_eECALDR_1
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< double > * t_trackHcalPhi
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< double > * t_hsimInfoPhoton
std::vector< double > * t_hsimInfoTotal
edm::EventID id() const
Definition: EventBase.h:60
edm::EDGetTokenT< edm::PCaloHitContainer > tok_caloHH_
T get() const
Definition: EventSetup.h:62
std::vector< double > * t_hsimInfoCharHad
reco::TrackBase::TrackQuality minQuality
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
std::vector< double > * t_trackPhi
const Point & position() const
position
Definition: BeamSpot.h:62
std::vector< double > * t_eHCALDRHB
std::vector< double > * t_hsimInfoPdgMatched
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
edm::EDGetTokenT< edm::SimVertexContainer > tok_simVtx_
T const * product() const
Definition: ESHandle.h:86
std::vector< double > * t_hConeHB
std::vector< double > * t_hsimInfoRest
std::vector< double > * t_conehmaxNearP
std::vector< double > * t_e15x15_20Sig
std::vector< double > * t_eMipDR
double eECALmatrix(const DetId &detId, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)