CMS 3D CMS Logo

HGCalTBAnalyzer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <iostream>
4 #include <fstream>
5 #include <vector>
6 #include <map>
7 #include <string>
8 
9 // user include files
16 
27 
40 
42 
43 // Root objects
44 #include "TROOT.h"
45 #include "TSystem.h"
46 #include "TFile.h"
47 #include "TH1.h"
48 #include "TH2.h"
49 #include "TProfile.h"
50 #include "TProfile2D.h"
51 #include "TTree.h"
52 
53 //#define EDM_ML_DEBUG
54 
55 class HGCalTBAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns,edm::one::SharedResources> {
56 
57 public:
58  explicit HGCalTBAnalyzer(edm::ParameterSet const&);
60 
61  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
62 
63 private:
64  virtual void beginJob() override ;
65  virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
66  virtual void endRun(edm::Run const&, edm::EventSetup const&) override {}
67  virtual void analyze(edm::Event const&, edm::EventSetup const&) override;
68  void analyzeSimHits(int type, std::vector<PCaloHit>& hits, double zFront);
71  template<class T1> void analyzeDigi(int type, const T1& detId, uint16_t adc);
72  void analyzeRecHits(int type, edm::Handle<HGCRecHitCollection> & hits);
73 
75 
78  const HGCalGeometry *hgeom_[2];
87  std::vector<int> idBeams_;
96 
97  TTree *tree_;
98  TH1D *hSimHitE_[4], *hSimHitT_[4];
99  TH1D *hDigiADC_[3], *hDigiLng_[2];
100  TH1D *hRecHitE_[3], *hSimHitEn_[4], *hBeam_;
101  TH2D *hDigiOcc_[3], *hRecHitOcc_[3];
102  TProfile *hSimHitLng_[3], *hSimHitLng1_[3];
103  TProfile *hSimHitLng2_[3];
104  TProfile *hRecHitLng_[3], *hRecHitLng1_[3];
105  TProfile2D *hSimHitLat_[3], *hRecHitLat_[3];
106  std::vector<TH1D*> hSimHitLayEn1EE_, hSimHitLayEn2EE_;
107  std::vector<TH1D*> hSimHitLayEn1FH_, hSimHitLayEn2FH_;
108  std::vector<TH1D*> hSimHitLayEn1BH_, hSimHitLayEn2BH_;
109  std::vector<TH1D*> hSimHitLayEnBeam_;
110  std::vector<float> simHitLayEn1EE, simHitLayEn2EE;
111  std::vector<float> simHitLayEn1FH, simHitLayEn2FH;
112  std::vector<float> simHitLayEn1BH, simHitLayEn2BH;
113  std::vector<float> simHitLayEnBeam;
114  std::vector<uint32_t> simHitCellIdEE, simHitCellIdFH;
115  std::vector<uint32_t> simHitCellIdBH, simHitCellIdBeam;
116  std::vector<float> simHitCellEnEE, simHitCellEnFH;
117  std::vector<float> simHitCellEnBH, simHitCellEnBeam;
118 
122 
123  double xBeam, yBeam, zBeam, pBeam;
124 };
125 
127 
128  usesResource("TFileService");
129 
130  //now do whatever initialization is needed
131  detectorEE_ = iConfig.getParameter<std::string>("DetectorEE");
132  detectorFH_ = iConfig.getParameter<std::string>("DetectorFH");
133  detectorBH_ = iConfig.getParameter<std::string>("DetectorBH");
134  detectorBeam_= iConfig.getParameter<std::string>("DetectorBeam");
135  ifEE_ = iConfig.getParameter<bool>("UseEE");
136  ifFH_ = iConfig.getParameter<bool>("UseFH");
137  ifBH_ = iConfig.getParameter<bool>("UseBH");
138  ifBeam_ = iConfig.getParameter<bool>("UseBeam");
139  zFrontEE_ = iConfig.getParameter<double>("ZFrontEE");
140  zFrontFH_ = iConfig.getParameter<double>("ZFrontFH");
141  zFrontBH_ = iConfig.getParameter<double>("ZFrontBH");
142  idBeams_ = iConfig.getParameter<std::vector<int>>("IDBeams");
143  doSimHits_ = iConfig.getParameter<bool>("DoSimHits");
144  doDigis_ = iConfig.getParameter<bool>("DoDigis");
145  sampleIndex_ = iConfig.getParameter<int>("SampleIndex");
146  doRecHits_ = iConfig.getParameter<bool>("DoRecHits");
147  doTree_ = iConfig.getUntrackedParameter<bool>("DoTree",false);
148  doTreeCell_ = iConfig.getUntrackedParameter<bool>("DoTreeCell",false);
149  doPassiveEE_ = iConfig.getUntrackedParameter<bool>("DoPassiveEE",false);
150  doPassiveFH_ = iConfig.getUntrackedParameter<bool>("DoPassiveFH",false);
151  doPassiveBH_ = iConfig.getUntrackedParameter<bool>("DoPassiveBH",false);
152 
153 
154 #ifdef EDM_ML_DEBUG
155  std::cout << "HGCalTBAnalyzer:: SimHits = " << doSimHits_ << " Digis = "
156  << doDigis_ << ":" << sampleIndex_ << " RecHits = " << doRecHits_
157  << " useDets " << ifEE_ << ":" << ifFH_ << ":" << ifBH_ << ":"
158  << ifBeam_ << " zFront " << zFrontEE_ << ":" << zFrontFH_ << ":"
159  << zFrontBH_ << " IdBeam " << idBeams_.size() << ":";
160  for (auto id : idBeams_) std::cout << " " << id;
161  std::cout << std::endl;
162 #endif
163  if (idBeams_.size() == 0) idBeams_.push_back(1001);
164 
165  edm::InputTag tmp0 = iConfig.getParameter<edm::InputTag>("GeneratorSrc");
166  tok_hepMC_ = consumes<edm::HepMCProduct>(tmp0);
167 
168 #ifdef EDM_ML_DEBUG
169  std::cout << "HGCalTBAnalyzer:: GeneratorSource = " << tmp0 << std::endl;
170 #endif
171  std::string tmp1 = iConfig.getParameter<std::string>("CaloHitSrcEE");
172  tok_hitsEE_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",tmp1));
173  tok_simTk_ = consumes<edm::SimTrackContainer>(edm::InputTag("g4SimHits"));
174  tok_simVtx_ = consumes<edm::SimVertexContainer>(edm::InputTag("g4SimHits"));
175  edm::InputTag tmp2 = iConfig.getParameter<edm::InputTag>("DigiSrcEE");
176  tok_digiEE_ = consumes<HGCEEDigiCollection>(tmp2);
177  edm::InputTag tmp3 = iConfig.getParameter<edm::InputTag>("RecHitSrcEE");
178  tok_hitrEE_ = consumes<HGCRecHitCollection>(tmp3);
179 #ifdef EDM_ML_DEBUG
180  if (ifEE_) {
181  std::cout << "HGCalTBAnalyzer:: Detector " << detectorEE_ << " with tags "
182  << tmp1 << ", " << tmp2 << ", " << tmp3 << std::endl;
183  }
184 #endif
185  tmp1 = iConfig.getParameter<std::string>("CaloHitSrcFH");
186  tok_hitsFH_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",tmp1));
187  tmp2 = iConfig.getParameter<edm::InputTag>("DigiSrcFH");
188  tok_digiFH_ = consumes<HGCHEDigiCollection>(tmp2);
189  tmp3 = iConfig.getParameter<edm::InputTag>("RecHitSrcFH");
190  tok_hitrFH_ = consumes<HGCRecHitCollection>(tmp3);
191 #ifdef EDM_ML_DEBUG
192  if (ifFH_) {
193  std::cout << "HGCalTBAnalyzer:: Detector " << detectorFH_ << " with tags "
194  << tmp1 << ", " << tmp2 << ", " << tmp3 << std::endl;
195  }
196 #endif
197  tmp1 = iConfig.getParameter<std::string>("CaloHitSrcBH");
198  tok_hitsBH_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",tmp1));
199  tmp2 = iConfig.getParameter<edm::InputTag>("DigiSrcBH");
200  tok_digiBH_ = consumes<HGCBHDigiCollection>(tmp2);
201  tmp3 = iConfig.getParameter<edm::InputTag>("RecHitSrcBH");
202  tok_hitrBH_ = consumes<HGCRecHitCollection>(tmp3);
203 
205  edm::InputTag tmp = iConfig.getParameter<edm::InputTag>("HGCPassiveEE");
206  tok_hgcPHEE_ = consumes<edm::PassiveHitContainer>(tmp);
207 
208  tmp = iConfig.getParameter<edm::InputTag>("HGCPassiveFH");
209  tok_hgcPHFH_ = consumes<edm::PassiveHitContainer>(tmp);
210 
211  tmp = iConfig.getParameter<edm::InputTag>("HGCPassiveBH");
212  tok_hgcPHBH_ = consumes<edm::PassiveHitContainer>(tmp);
213 
214 
215 #ifdef EDM_ML_DEBUG
216  if (ifBH_) {
217  std::cout << "HGCalTBAnalyzer:: Detector " << detectorBH_ << " with tags "
218  << tmp1 << ", " << tmp2 << ", " << tmp3 << std::endl;
219  }
220 #endif
221  tmp1 = iConfig.getParameter<std::string>("CaloHitSrcBeam");
222  tok_hitsBeam_= consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",tmp1));
223 #ifdef EDM_ML_DEBUG
224  if (ifBeam_) {
225  std::cout << "HGCalTBAnalyzer:: Detector " << detectorBeam_ << " with tags "
226  << tmp1 << std::endl;
227  }
228 #endif
229 }
230 
232 
235  desc.setUnknown();
236  desc.add<std::string>("DetectorEE","HGCalEESensitive");
237  desc.add<bool>("UseEE",true);
238  desc.add<double>("ZFrontEE",0.0);
239  desc.add<std::string>("CaloHitSrcEE","HGCHitsEE");
240  desc.add<edm::InputTag>("DigiSrcEE",edm::InputTag("mix","HGCDigisEE"));
241  desc.add<edm::InputTag>("RecHitSrcEE",edm::InputTag("HGCalRecHit","HGCEERecHits"));
242  desc.add<std::string>("DetectorFH","HGCalHESiliconSensitive");
243  desc.add<bool>("UseFH",false);
244  desc.add<double>("ZFrontFH",0.0);
245  desc.add<std::string>("CaloHitSrcFH","HGCHitsHEfront");
246  desc.add<edm::InputTag>("DigiSrcFH",edm::InputTag("mix","HGCDigisHEfront"));
247  desc.add<edm::InputTag>("RecHitSrcFH",edm::InputTag("HGCalRecHit","HGCHEFRecHits"));
248  desc.add<std::string>("DetectorBH","AHCal");
249  desc.add<bool>("UseBH",false);
250  desc.add<double>("ZFrontBH",0.0);
251  desc.add<std::string>("CaloHitSrcBH","HcalHits");
252  desc.add<edm::InputTag>("DigiSrcBH",edm::InputTag("mix","HGCDigisHEback"));
253  desc.add<edm::InputTag>("RecHitSrcBH",edm::InputTag("HGCalRecHit","HGCHEBRecHits"));
254  desc.add<std::string>("DetectorBeam","HcalTB06BeamDetectorl");
255  desc.add<bool>("UseBeam",false);
256  desc.add<std::string>("CaloHitSrcBeam","HcalTB06BeamHits");
257  std::vector<int> ids = {1000,1001,1002,1003,1004,1005,1006,1007,1008,1011,1012,1013,1014,2001,2002,2003,2004,2005};
258  desc.add<std::vector<int>>("IDBeams",ids);
259  desc.add<edm::InputTag>("GeneratorSrc",edm::InputTag("generatorSmeared"));
260  desc.add<edm::InputTag>("HGCPassiveEE",edm::InputTag("g4SimHits","HGCalEEPassiveHits"));
261  desc.add<edm::InputTag>("HGCPassiveFH",edm::InputTag("g4SimHits","HGCalHEPassiveHits"));
262  desc.add<edm::InputTag>("HGCPassiveBH",edm::InputTag("g4SimHits","HGCalAHPassiveHits"));
263  desc.add<bool>("DoSimHits",true);
264  desc.add<bool>("DoDigis",true);
265  desc.add<bool>("DoRecHits",true);
266  desc.add<int>("SampleIndex",0);
267  desc.addUntracked<bool>("DoTree",true);
268  desc.addUntracked<bool>("DoTreeCell",true);
269  desc.addUntracked<bool>("DoPassiveEE",false);
270  desc.addUntracked<bool>("DoPassiveFH",false);
271  desc.addUntracked<bool>("DoPassiveBH",false);
272 
273  descriptions.add("HGCalTBAnalyzer",desc);
274 }
275 
277 
278  char name[40], title[100];
279  hBeam_ = fs_->make<TH1D>("BeamP", "Beam Momentum", 1000, 0, 1000.0);
280  for (int i=0; i<3; ++i) {
281  bool book(ifEE_);
282  std::string det(detectorEE_);
283  if (i == 1) {
284  book = ifFH_;
285  det = detectorFH_;
286  } else if (i == 2) {
287  book = ifBH_;
288  det = detectorBH_;
289  }
290 
291  if (doSimHits_ && book) {
292  sprintf (name, "SimHitEn%s", det.c_str());
293  sprintf (title,"Sim Hit Energy for %s", det.c_str());
294  hSimHitE_[i] = fs_->make<TH1D>(name,title,100000,0.,0.2);
295  sprintf (name, "SimHitEnX%s", det.c_str());
296  sprintf (title,"Sim Hit Energy for %s", det.c_str());
297  hSimHitEn_[i] = fs_->make<TH1D>(name,title,100000,0.,0.2);
298  sprintf (name, "SimHitTm%s", det.c_str());
299  sprintf (title,"Sim Hit Timing for %s", det.c_str());
300  hSimHitT_[i] = fs_->make<TH1D>(name,title,5000,0.,500.0);
301  sprintf (name, "SimHitLat%s", det.c_str());
302  sprintf (title,"Lateral Shower profile (Sim Hit) for %s", det.c_str());
303  hSimHitLat_[i] = fs_->make<TProfile2D>(name,title,100,-100.,100.,100,-100.,100.);
304  sprintf (name, "SimHitLng%s", det.c_str());
305  sprintf (title,"Longitudinal Shower profile (Sim Hit) for %s",det.c_str());
306  hSimHitLng_[i] = fs_->make<TProfile>(name,title,50,0.,100.);
307  sprintf (name, "SimHitLng1%s", det.c_str());
308  sprintf (title,"Longitudinal Shower profile (Layer) for %s",det.c_str());
309  hSimHitLng1_[i] = fs_->make<TProfile>(name,title,200,0.,100.);
310  sprintf (name, "SimHitLng2%s", det.c_str());
311  sprintf (title,"Longitudinal Shower profile (Layer) for %s",det.c_str());
312  hSimHitLng2_[i] = fs_->make<TProfile>(name,title,200,0.,100.);
313  }
314 
315  if (doDigis_ && book) {
316  sprintf (name, "DigiADC%s", det.c_str());
317  sprintf (title,"ADC at Digi level for %s", det.c_str());
318  hDigiADC_[i] = fs_->make<TH1D>(name,title,100,0.,100.0);
319  sprintf (name, "DigiOcc%s", det.c_str());
320  sprintf (title,"Occupancy (Digi)for %s", det.c_str());
321  hDigiOcc_[i] = fs_->make<TH2D>(name,title,100,-10.,10.,100,-10.,10.);
322  sprintf (name, "DigiLng%s", det.c_str());
323  sprintf (title,"Longitudinal Shower profile (Digi) for %s",det.c_str());
324  hDigiLng_[i] = fs_->make<TH1D>(name,title,100,0.,10.);
325  }
326 
327  if (doRecHits_ && book) {
328  sprintf (name, "RecHitEn%s", det.c_str());
329  sprintf (title,"Rec Hit Energy for %s", det.c_str());
330  hRecHitE_[i] = fs_->make<TH1D>(name,title,1000,0.,10.0);
331  sprintf (name, "RecHitOcc%s", det.c_str());
332  sprintf (title,"Occupancy (Rec Hit)for %s", det.c_str());
333  hRecHitOcc_[i] = fs_->make<TH2D>(name,title,100,-10.,10.,100,-10.,10.);
334  sprintf (name, "RecHitLat%s", det.c_str());
335  sprintf (title,"Lateral Shower profile (Rec Hit) for %s", det.c_str());
336  hRecHitLat_[i] = fs_->make<TProfile2D>(name,title,100,-10.,10.,100,-10.,10.);
337  sprintf (name, "RecHitLng%s", det.c_str());
338  sprintf (title,"Longitudinal Shower profile (Rec Hit) for %s",det.c_str());
339  hRecHitLng_[i] = fs_->make<TProfile>(name,title,100,0.,10.);
340  sprintf (name, "RecHitLng1%s", det.c_str());
341  sprintf (title,"Longitudinal Shower profile vs Layer for %s",det.c_str());
342  hRecHitLng1_[i] = fs_->make<TProfile>(name,title,120,0.,60.);
343  }
344  }
345  if (ifBeam_ && doSimHits_) {
346  sprintf (name, "SimHitEn%s", detectorBeam_.c_str());
347  sprintf (title,"Sim Hit Energy for %s", detectorBeam_.c_str());
348  hSimHitE_[3] = fs_->make<TH1D>(name,title,100000,0.,0.2);
349  sprintf (name, "SimHitEnX%s", detectorBeam_.c_str());
350  sprintf (title,"Sim Hit Energy for %s", detectorBeam_.c_str());
351  hSimHitEn_[3] = fs_->make<TH1D>(name,title,100000,0.,0.2);
352  sprintf (name, "SimHitTm%s", detectorBeam_.c_str());
353  sprintf (title,"Sim Hit Timing for %s", detectorBeam_.c_str());
354  hSimHitT_[3] = fs_->make<TH1D>(name,title,5000,0.,500.0);
355  }
356  if (doSimHits_ && doTree_) {
357  tree_ = fs_->make<TTree>("HGCTB","SimHitEnergy");
358  tree_->Branch("simHitLayEn1EE", &simHitLayEn1EE);
359  tree_->Branch("simHitLayEn2EE", &simHitLayEn2EE);
360  tree_->Branch("simHitLayEn1FH", &simHitLayEn1FH);
361  tree_->Branch("simHitLayEn2FH", &simHitLayEn2FH);
362  tree_->Branch("simHitLayEn1BH", &simHitLayEn1BH);
363  tree_->Branch("simHitLayEn2BH", &simHitLayEn2BH);
364  tree_->Branch("xBeam", &xBeam, "xBeam/D");
365  tree_->Branch("yBeam", &yBeam, "yBeam/D");
366  tree_->Branch("zBeam", &zBeam, "zBeam/D");
367  tree_->Branch("pBeam", &pBeam, "pBeam/D");
368  if (doTreeCell_) {
369  tree_->Branch("simHitCellIdEE", &simHitCellIdEE);
370  tree_->Branch("simHitCellEnEE", &simHitCellEnEE);
371  tree_->Branch("simHitCellIdFH", &simHitCellIdFH);
372  tree_->Branch("simHitCellEnFH", &simHitCellEnFH);
373  tree_->Branch("simHitCellIdBH", &simHitCellIdBH);
374  tree_->Branch("simHitCellEnBH", &simHitCellEnBH);
375  tree_->Branch("simHitCellIdBeam", &simHitCellIdBeam);
376  tree_->Branch("simHitCellEnBeam", &simHitCellEnBeam);
377  }
378  }
379 
380  if (doPassiveEE_ && doTree_) {
381  tree_->Branch("hgcPassiveEEEnergy", &hgcPassiveEEEnergy);
382  tree_->Branch("hgcPassiveEEName", &hgcPassiveEEName);
383  tree_->Branch("hgcPassiveEEID", &hgcPassiveEEID);
384  }
385  if (doPassiveFH_ && doTree_) {
386  tree_->Branch("hgcPassiveFHEnergy", &hgcPassiveFHEnergy);
387  tree_->Branch("hgcPassiveFHName", &hgcPassiveFHName);
388  tree_->Branch("hgcPassiveFHID", &hgcPassiveFHID);
389  }
390  if (doPassiveBH_ && doTree_) {
391  tree_->Branch("hgcPassiveBHEnergy", &hgcPassiveBHEnergy);
392  tree_->Branch("hgcPassiveBHName", &hgcPassiveBHName);
393  tree_->Branch("hgcPassiveBHID", &hgcPassiveBHID);
394  }
395 }
396 
398 
399  char name[40], title[100];
400  if (ifEE_) {
402  iSetup.get<IdealGeometryRecord>().get(detectorEE_, pHGDC);
403  hgcons_[0] = &(*pHGDC);
404  if (doDigis_ || doRecHits_) {
406  iSetup.get<IdealGeometryRecord>().get(detectorEE_, geom);
407  hgeom_[0] = geom.product();
408  } else {
409  hgeom_[0] = 0;
410  }
411  for (unsigned int l=0; l<hgcons_[0]->layers(false); ++l) {
412  sprintf (name, "SimHitEnA%d%s", l, detectorEE_.c_str());
413  sprintf (title,"Sim Hit Energy in SIM layer %d for %s",l+1,
414  detectorEE_.c_str());
415  hSimHitLayEn1EE_.push_back(fs_->make<TH1D>(name,title,100000,0.,0.2));
416  if (l%3 == 0) {
417  sprintf (name, "SimHitEnB%d%s", (l/3+1), detectorEE_.c_str());
418  sprintf (title,"Sim Hit Energy in layer %d for %s",(l/3+1),
419  detectorEE_.c_str());
420  hSimHitLayEn2EE_.push_back(fs_->make<TH1D>(name,title,100000,0.,0.2));
421  }
422  }
423 #ifdef EDM_ML_DEBUG
424  std::cout << "HGCalTBAnalyzer::" << detectorEE_ << " defined with "
425  << hgcons_[0]->layers(false) << " layers" << std::endl;
426 #endif
427  } else {
428  hgcons_[0] = 0;
429  hgeom_[0] = 0;
430  }
431 
432  if (ifFH_) {
434  iSetup.get<IdealGeometryRecord>().get(detectorFH_, pHGDC);
435  hgcons_[1] = &(*pHGDC);
436  if (doDigis_ || doRecHits_) {
438  iSetup.get<IdealGeometryRecord>().get(detectorFH_, geom);
439  hgeom_[1] = geom.product();
440  } else {
441  hgeom_[1] = 0;
442  }
443  for (unsigned int l=0; l<hgcons_[1]->layers(false); ++l) {
444  sprintf (name, "SimHitEnA%d%s", l, detectorFH_.c_str());
445  sprintf (title,"Sim Hit Energy in layer %d for %s",l+1,
446  detectorFH_.c_str());
447  hSimHitLayEn1FH_.push_back(fs_->make<TH1D>(name,title,100000,0.,0.2));
448  if (l%3 == 0) {
449  sprintf (name, "SimHitEnB%d%s", (l/3+1), detectorFH_.c_str());
450  sprintf (title,"Sim Hit Energy in layer %d for %s",(l/3+1),
451  detectorFH_.c_str());
452  hSimHitLayEn2FH_.push_back(fs_->make<TH1D>(name,title,100000,0.,0.2));
453  }
454  }
455 #ifdef EDM_ML_DEBUG
456  std::cout << "HGCalTBAnalyzer::" << detectorFH_ << " defined with "
457  << hgcons_[1]->layers(false) << " layers" << std::endl;
458 #endif
459  } else {
460  hgcons_[1] = 0;
461  hgeom_[1] = 0;
462  }
463 
464  if (ifBH_) {
465  for (int l=0; l<AHCalDetId::MaxDepth; ++l) {
466  sprintf (name, "SimHitEnA%d%s", l, detectorBH_.c_str());
467  sprintf (title,"Sim Hit Energy in layer %d for %s",l+1,
468  detectorBH_.c_str());
469  hSimHitLayEn1BH_.push_back(fs_->make<TH1D>(name,title,100000,0.,0.2));
470  sprintf (name, "SimHitEnB%d%s", l, detectorBH_.c_str());
471  sprintf (title,"Sim Hit Energy in layer %d for %s",l+1,
472  detectorBH_.c_str());
473  hSimHitLayEn2BH_.push_back(fs_->make<TH1D>(name,title,100000,0.,0.2));
474  }
475  }
476 
477  if (ifBeam_) {
478  for (unsigned int l=0; l<idBeams_.size(); ++l) {
479  sprintf (name, "SimHitEna%d%s", l, detectorBeam_.c_str());
480  sprintf (title, "Sim Hit Energy in type %d for %s",idBeams_[l],
481  detectorBeam_.c_str());
482  hSimHitLayEnBeam_.push_back(fs_->make<TH1D>(name,title,100000,0.,0.2));
483  }
484  }
485 }
486 
488  const edm::EventSetup& iSetup) {
489 
490  //Generator input
492  iEvent.getByToken(tok_hepMC_,evtMC);
493  if (!evtMC.isValid()) {
494  edm::LogWarning("HGCal") << "no HepMCProduct found";
495  } else {
496  const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
497  unsigned int k(0);
498  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
499  p != myGenEvent->particles_end(); ++p, ++k) {
500  if (k == 0) hBeam_->Fill((*p)->momentum().rho());
501 #ifdef EDM_ML_DEBUG
502  std::cout << "Particle[" << k << "] with p " << (*p)->momentum().rho()
503  << " theta " << (*p)->momentum().theta() << " phi "
504  << (*p)->momentum().phi() << std::endl;
505 #endif
506  }
507  }
508 
509  //Now the Simhits
510  if (doSimHits_) {
512  iEvent.getByToken(tok_simTk_, SimTk);
514  iEvent.getByToken(tok_simVtx_, SimVtx);
515  analyzeSimTracks(SimTk, SimVtx);
516 
517  simHitLayEn1EE.clear(); simHitLayEn2EE.clear();
518  simHitLayEn1FH.clear(); simHitLayEn2FH.clear();
519  simHitLayEn1BH.clear(); simHitLayEn2BH.clear();
520  simHitLayEnBeam.clear();
521  simHitCellIdEE.clear(); simHitCellEnEE.clear();
522  simHitCellIdFH.clear(); simHitCellEnFH.clear();
523  simHitCellIdBH.clear(); simHitCellEnBH.clear();
524  simHitCellIdBeam.clear(); simHitCellEnBeam.clear();
525  edm::Handle<edm::PCaloHitContainer> theCaloHitContainers;
526  std::vector<PCaloHit> caloHits;
527  if (ifEE_) {
528  simHitLayEn1EE = std::vector<float>(hgcons_[0]->layers(false),0);
529  simHitLayEn2EE = std::vector<float>(hgcons_[0]->layers(true),0);
530  iEvent.getByToken(tok_hitsEE_, theCaloHitContainers);
531  if (theCaloHitContainers.isValid()) {
532 #ifdef EDM_ML_DEBUG
533  std::cout << "PcalohitContainer for " << detectorEE_ << " has "
534  << theCaloHitContainers->size() << " hits" << std::endl;
535 #endif
536  caloHits.clear();
537  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(),
538  theCaloHitContainers->end());
539  analyzeSimHits(0, caloHits, zFrontEE_);
540  } else {
541 #ifdef EDM_ML_DEBUG
542  std::cout << "PCaloHitContainer does not exist for " << detectorEE_
543  << " !!!" << std::endl;
544 #endif
545  }
546  }
547  if (ifFH_) {
548  simHitLayEn1FH = std::vector<float>(hgcons_[1]->layers(false),0);
549  simHitLayEn2FH = std::vector<float>(hgcons_[1]->layers(true),0);
550  iEvent.getByToken(tok_hitsFH_, theCaloHitContainers);
551  if (theCaloHitContainers.isValid()) {
552 #ifdef EDM_ML_DEBUG
553  std::cout << "PcalohitContainer for " << detectorFH_ << " has "
554  << theCaloHitContainers->size() << " hits" << std::endl;
555 #endif
556  caloHits.clear();
557  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(),
558  theCaloHitContainers->end());
559  analyzeSimHits(1, caloHits, zFrontFH_);
560  } else {
561 #ifdef EDM_ML_DEBUG
562  std::cout << "PCaloHitContainer does not exist for " << detectorFH_
563  << " !!!" << std::endl;
564 #endif
565  }
566  }
567  if (ifBH_) {
568  simHitLayEn1BH = std::vector<float>(AHCalDetId::MaxDepth,0);
569  simHitLayEn2BH = std::vector<float>(AHCalDetId::MaxDepth,0);
570  iEvent.getByToken(tok_hitsBH_, theCaloHitContainers);
571  if (theCaloHitContainers.isValid()) {
572 #ifdef EDM_ML_DEBUG
573  std::cout << "PcalohitContainer for " << detectorBH_ << " has "
574  << theCaloHitContainers->size() << " hits" << std::endl;
575 #endif
576  caloHits.clear();
577  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(),
578  theCaloHitContainers->end());
579  analyzeSimHits(2, caloHits, zFrontBH_);
580  } else {
581 #ifdef EDM_ML_DEBUG
582  std::cout << "PCaloHitContainer does not exist for " << detectorBH_
583  << " !!!" << std::endl;
584 #endif
585  }
586  }
587  if (ifBeam_) {
588  simHitLayEnBeam= std::vector<float>(idBeams_.size(),0);
589  iEvent.getByToken(tok_hitsBeam_, theCaloHitContainers);
590  if (theCaloHitContainers.isValid()) {
591 #ifdef EDM_ML_DEBUG
592  std::cout << "PcalohitContainer for " << detectorBeam_ << " has "
593  << theCaloHitContainers->size() << " hits" << std::endl;
594 #endif
595  caloHits.clear();
596  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(),
597  theCaloHitContainers->end());
598  analyzeSimHits(3, caloHits, 0.0);
599  } else {
600 #ifdef EDM_ML_DEBUG
601  std::cout << "PCaloHitContainer does not exist for " << detectorBeam_
602  << " !!!" << std::endl;
603 #endif
604  }
605  }
606  //if (doTree_) tree_->Fill();
607  }//if (doSimHits_)
608 
610  if (doPassiveEE_) {
613  iEvent.getByToken(tok_hgcPHEE_,hgcPH);
614  analyzePassiveHits(hgcPH, "EE");
615  }
616 
617  if (doPassiveFH_) {
620  iEvent.getByToken(tok_hgcPHFH_,hgcPH);
621  analyzePassiveHits(hgcPH, "FH");
622  }
623 
624  if (doPassiveBH_) {
627  iEvent.getByToken(tok_hgcPHBH_,hgcPH);
628  analyzePassiveHits(hgcPH, "BH");
629  }
630  if ((doSimHits_ || doPassiveEE_) && (doTree_)) tree_->Fill();
631 
632  //Now the Digis
633  if (doDigis_) {
634  if (ifEE_) {
635  edm::Handle<HGCEEDigiCollection> theDigiContainers;
636  iEvent.getByToken(tok_digiEE_, theDigiContainers);
637  if (theDigiContainers.isValid()) {
638 #ifdef EDM_ML_DEBUG
639  std::cout << "HGCDigiCintainer for " << detectorEE_ << " with "
640  << theDigiContainers->size() << " element(s)" << std::endl;
641 #endif
642  for (auto it : *theDigiContainers) {
643  HGCEEDetId detId = (it.id());
644  HGCSample hgcSample = it.sample(sampleIndex_);
645  uint16_t adc = hgcSample.data();
646  analyzeDigi(0, detId, adc);
647  }
648  }
649  }
650  if (ifFH_) {
651  edm::Handle<HGCHEDigiCollection> theDigiContainers;
652  iEvent.getByToken(tok_digiFH_, theDigiContainers);
653  if (theDigiContainers.isValid()) {
654 #ifdef EDM_ML_DEBUG
655  std::cout << "HGCDigiContainer for " << detectorFH_ << " with "
656  << theDigiContainers->size() << " element(s)" << std::endl;
657 #endif
658  for (auto it : *theDigiContainers) {
659  HGCHEDetId detId = (it.id());
660  HGCSample hgcSample = it.sample(sampleIndex_);
661  uint16_t adc = hgcSample.data();
662  analyzeDigi(1, detId, adc);
663  }
664  }
665  }
666  }
667 
668  //The Rechits
669  if (doRecHits_) {
670  edm::Handle<HGCRecHitCollection> theCaloHitContainers;
671  if (ifEE_) {
672  iEvent.getByToken(tok_hitrEE_, theCaloHitContainers);
673  if (theCaloHitContainers.isValid()) {
674 #ifdef EDM_ML_DEBUG
675  std::cout << "HGCRecHitCollection for " << detectorEE_ << " has "
676  << theCaloHitContainers->size() << " hits" << std::endl;
677 #endif
678  analyzeRecHits(0, theCaloHitContainers);
679  } else {
680 #ifdef EDM_ML_DEBUG
681  std::cout << "HGCRecHitCollection does not exist for " << detectorEE_
682  << " !!!" << std::endl;
683 #endif
684  }
685  }
686  if (ifFH_) {
687  iEvent.getByToken(tok_hitrFH_, theCaloHitContainers);
688  if (theCaloHitContainers.isValid()) {
689 #ifdef EDM_ML_DEBUG
690  std::cout << "HGCRecHitCollection for " << detectorFH_ << " has "
691  << theCaloHitContainers->size() << " hits" << std::endl;
692 #endif
693  analyzeRecHits(1, theCaloHitContainers);
694  } else {
695 #ifdef EDM_ML_DEBUG
696  std::cout << "HGCRecHitCollection does not exist for " << detectorFH_
697  << " !!!" << std::endl;
698 #endif
699  }//else
700  }//if (ifFH_)
701  }//if (doRecHits_)
702 
703 }//void HGCalTBAnalyzer::analyze
704 
705 void HGCalTBAnalyzer::analyzeSimHits (int type, std::vector<PCaloHit>& hits,
706  double zFront) {
707 
708  std::map<uint32_t,double> map_hits, map_hitn;
709  std::map<int,double> map_hitDepth;
710  std::map<int,std::pair<uint32_t,double> > map_hitLayer, map_hitCell;
711  double entot(0);
712  for (unsigned int i=0; i<hits.size(); i++) {
713  double energy = hits[i].energy();
714  double time = hits[i].time();
715  uint32_t id = hits[i].id();
716  entot += energy;
717  int subdet, zside, layer, sector, subsector(0), cell, depth(0), idx(0);
718  if (type == 2) {
719  subdet = HcalDetId(id).subdet();
720  if (subdet != HcalOther) continue;
721  AHCalDetId hid(id);
722  layer = depth = hid.depth();
723  zside = hid.zside();
724  sector = hid.irow();
725  cell = hid.icol();
726  idx = ((hid.irowAbs()*100) + (hid.icolAbs()));
727  } else if (type == 3) {
728  HcalTestBeamNumbering::unpackIndex(id, subdet, layer, sector, cell);
729  depth = layer; zside = 1;
730  idx = subdet*1000 + layer;
731  layer = idx;
732  } else {
733  HGCalTestNumbering::unpackHexagonIndex(id, subdet, zside, layer, sector,
734  subsector, cell);
735  depth = hgcons_[type]->simToReco(cell,layer,sector,true).second;
736  idx = sector*1000+cell;
737  }
738 #ifdef EDM_ML_DEBUG
739  std::cout << "SimHit:Hit[" << i << "] Id " << subdet << ":" << zside << ":"
740  << layer << ":" << sector << ":" << subsector << ":" << cell
741  << ":" << depth << " Energy " << energy << " Time " << time
742  << std::endl;
743 #endif
744  if (map_hits.count(id) != 0) {
745  map_hits[id] += energy;
746  } else {
747  map_hits[id] = energy;
748  }
749  if (map_hitLayer.count(layer) != 0) {
750  double ee = energy + map_hitLayer[layer].second;
751  map_hitLayer[layer] = std::pair<uint32_t,double>(id,ee);
752  } else {
753  map_hitLayer[layer] = std::pair<uint32_t,double>(id,energy);
754  }
755  if (depth >= 0) {
756  if (map_hitCell.count(idx) != 0) {
757  double ee = energy + map_hitCell[idx].second;
758  map_hitCell[idx] = std::pair<uint32_t,double>(id,ee);
759  } else {
760  map_hitCell[idx] = std::pair<uint32_t,double>(id,energy);
761  }
762  if (map_hitDepth.count(depth) != 0) {
763  map_hitDepth[depth] += energy;
764  } else {
765  map_hitDepth[depth] = energy;
766  }
767  uint32_t idn = (type >= 2) ? id :
768  HGCalTestNumbering::packHexagonIndex(subdet, zside, depth, sector,
769  subsector, cell);
770  if (map_hitn.count(idn) != 0) {
771  map_hitn[idn] += energy;
772  } else {
773  map_hitn[idn] = energy;
774  }
775  }
776  hSimHitT_[type]->Fill(time,energy);
777  }
778 
779  hSimHitEn_[type]->Fill(entot);
780  for (auto itr : map_hits) {
781  hSimHitE_[type]->Fill(itr.second);
782  }
783 
784  for (auto itr : map_hitLayer) {
785  int layer = itr.first - 1;
786  double energy = (itr.second).second;
787  double zp(0);
788  if (type < 2) zp = hgcons_[type]->waferZ(layer+1,false);
789  else if (type == 2) zp = AHCalDetId((itr.second).first).getZ();
790 #ifdef EDM_ML_DEBUG
791  std::cout << "SimHit:Layer " << layer+1 << " Z " << zp << ":" << zp-zFront
792  << " E " << energy << std::endl;
793 #endif
794  if (type < 3) {
795  hSimHitLng_[type]->Fill(zp-zFront,energy);
796  hSimHitLng2_[type]->Fill(layer+1,energy);
797  }
798  if (type == 0) {
799  if (layer < (int)(hSimHitLayEn1EE_.size())) {
800  simHitLayEn1EE[layer] = energy;
801  hSimHitLayEn1EE_[layer]->Fill(energy);
802  }
803  } else if (type == 1) {
804  if (layer < (int)(hSimHitLayEn1FH_.size())) {
805  simHitLayEn1FH[layer] = energy;
806  hSimHitLayEn1FH_[layer]->Fill(energy);
807  }
808  } else if (type == 2) {
809  if (layer < (int)(hSimHitLayEn1BH_.size())) {
810  simHitLayEn1BH[layer] = energy;
811  hSimHitLayEn1BH_[layer]->Fill(energy);
812  }
813  } else {
814  for (unsigned int k=0; k<idBeams_.size(); ++k) {
815  if (layer+1 == idBeams_[k]) {
816  simHitLayEnBeam[k] = energy;
817  hSimHitLayEnBeam_[k]->Fill(energy);
818  break;
819  }
820  }
821  }
822  }
823  for (auto itr : map_hitDepth) {
824  int layer = itr.first - 1;
825  double energy = itr.second;
826 #ifdef EDM_ML_DEBUG
827  std::cout << "SimHit:Layer " << layer+1 << " " << energy << std::endl;
828 #endif
829  hSimHitLng1_[type]->Fill(layer+1,energy);
830  if (type == 0) {
831  if (layer < (int)(hSimHitLayEn2EE_.size())) {
832  simHitLayEn2EE[layer] = energy;
833  hSimHitLayEn2EE_[layer]->Fill(energy);
834  }
835  } else if (type == 1) {
836  if (layer < (int)(hSimHitLayEn2FH_.size())) {
837  simHitLayEn2FH[layer] = energy;
838  hSimHitLayEn2FH_[layer]->Fill(energy);
839  }
840  } else if (type == 2) {
841  if (layer < (int)(hSimHitLayEn2BH_.size())) {
842  simHitLayEn2BH[layer] = energy;
843  hSimHitLayEn2BH_[layer]->Fill(energy);
844  }
845  }
846  }
847 
848  if (type < 3) {
849  for (auto itr : map_hitCell) {
850  uint32_t id = ((itr.second).first);
851  double energy = ((itr.second).second);
852  std::pair<float,float> xy(0,0);
853  double xx(0);
854  if (type == 2) {
855  xy = AHCalDetId(id).getXY();
856  xx = xy.first;
857  } else {
858  int subdet, zside, layer, sector, subsector, cell;
859  HGCalTestNumbering::unpackHexagonIndex(id, subdet, zside, layer, sector,
860  subsector, cell);
861  xy = hgcons_[type]->locateCell(cell,layer,sector,false);
862  double zp = hgcons_[type]->waferZ(layer,false);
863  xx = (zp < 0) ? -xy.first : xy.first;
864  }
865  hSimHitLat_[type]->Fill(xx,xy.second,energy);
866  }
867  }
868 
869  for (auto itr : map_hitn) {
870  uint32_t id = itr.first;
871  double energy = itr.second;
872  if (type == 0) {
873  simHitCellIdEE.push_back(id); simHitCellEnEE.push_back(energy);
874  } else if (type == 1) {
875  simHitCellIdFH.push_back(id); simHitCellEnFH.push_back(energy);
876  } else if (type == 2) {
877  simHitCellIdBH.push_back(id); simHitCellEnBH.push_back(energy);
878  } else if (type == 3) {
879  simHitCellIdBeam.push_back(id); simHitCellEnBeam.push_back(energy);
880  }
881  }
882 }
883 
885  edm::Handle<edm::SimVertexContainer> const& SimVtx) {
886 
887  xBeam = yBeam = zBeam = pBeam = -1000000;
888  int vertIndex(-1);
889  for (auto simTrkItr : *SimTk) {
890 #ifdef EDM_ML_DEBUG
891  std::cout << "Track " << simTrkItr.trackId() << " Vertex "
892  << simTrkItr.vertIndex() << " Type " << simTrkItr.type()
893  << " Charge " << simTrkItr.charge() << " momentum "
894  << simTrkItr.momentum() << " " << simTrkItr.momentum().P()
895  << std::endl;
896 #endif
897  if (vertIndex == -1) {
898  vertIndex = simTrkItr.vertIndex();
899  pBeam = simTrkItr.momentum().P();
900  }
901  }
902  if (vertIndex != -1 && vertIndex < (int)SimVtx->size()) {
903  edm::SimVertexContainer::const_iterator simVtxItr= SimVtx->begin();
904  for (int iv=0; iv<vertIndex; iv++) simVtxItr++;
905 #ifdef EDM_ML_DEBUG
906  std::cout << "Vertex " << vertIndex << " position "
907  << simVtxItr->position() << std::endl;
908 #endif
909  xBeam = simVtxItr->position().X();
910  yBeam = simVtxItr->position().Y();
911  zBeam = simVtxItr->position().Z();
912  }
913 
914 }
915 
916 template<class T1>
917 void HGCalTBAnalyzer::analyzeDigi (int type, const T1& detId, uint16_t adc) {
918 
919  DetId id1 = DetId(detId.rawId());
920  GlobalPoint global = hgeom_[type]->getPosition(id1);
921  hDigiOcc_[type]->Fill(global.x(),global.y());
922  hDigiLng_[type]->Fill(global.z());
923  hDigiADC_[type]->Fill(adc);
924 }
925 
928 
929  std::map<int,double> map_hitLayer;
930  std::map<int,std::pair<DetId,double> > map_hitCell;
931  for (auto it : *hits) {
932  DetId detId = it.id();
933  GlobalPoint global = hgeom_[type]->getPosition(detId);
934  double energy = it.energy();
935  int layer = HGCalDetId(detId).layer();
936  int cell = HGCalDetId(detId).cell();
937  hRecHitOcc_[type]->Fill(global.x(),global.y(),energy);
938  hRecHitE_[type]->Fill(energy);
939  if (map_hitLayer.count(layer) != 0) {
940  map_hitLayer[layer] += energy;
941  } else {
942  map_hitLayer[layer] = energy;
943  }
944  if (map_hitCell.count(cell) != 0) {
945  double ee = energy + map_hitCell[cell].second;
946  map_hitCell[cell] = std::pair<uint32_t,double>(detId,ee);
947  } else {
948  map_hitCell[cell] = std::pair<uint32_t,double>(detId,energy);
949  }
950 #ifdef EDM_ML_DEBUG
951  std::cout << "RecHit: " << layer << " " << global.x() << " " << global.y()
952  << " " << global.z() << " " << energy << std::endl;
953 #endif
954  }
955 
956  for (auto itr : map_hitLayer) {
957  int layer = itr.first;
958  double energy = itr.second;
959  double zp = hgcons_[type]->waferZ(layer,true);
960 #ifdef EDM_ML_DEBUG
961  std::cout << "SimHit:Layer " << layer << " " << zp << " " << energy
962  << std::endl;
963 #endif
964  hRecHitLng_[type]->Fill(zp,energy);
965  hRecHitLng1_[type]->Fill(layer,energy);
966  }
967 
968  for (auto itr : map_hitCell) {
969  DetId detId = ((itr.second).first);
970  double energy = ((itr.second).second);
971  GlobalPoint global = hgeom_[type]->getPosition(detId);
972  hRecHitLat_[type]->Fill(global.x(),global.y(),energy);
973  }
974 }
975 
977 
978  for (auto v : *hgcPH) {
979  double energy = v.energy();
980 #ifdef EDM_ML_DEBUG
981  double time = v.time();
982 #endif
983  std::string name = v.vname();
984  unsigned int id = v.id();
985 
986 #ifdef EDM_ML_DEBUG
987  std::cout << "HGCalTBAnalyzer::analyzePassiveHits:Energy:Time:Name:Id : "
988  << energy << ":" << time << ":" << name << ":" << id << std::endl;
989 #endif
990  if (subdet=="EE") {
991  hgcPassiveEEEnergy.push_back(energy);
992  hgcPassiveEEName.push_back(name);
993  hgcPassiveEEID.push_back(id);
994  } else if (subdet=="FH") {
995  hgcPassiveFHEnergy.push_back(energy);
996  hgcPassiveFHName.push_back(name);
997  hgcPassiveFHID.push_back(id);
998  } else if (subdet=="BH") {
999  hgcPassiveBHEnergy.push_back(energy);
1000  hgcPassiveBHName.push_back(name);
1001  hgcPassiveBHID.push_back(id);
1002  }
1003  }
1004 }
1005 
1006 //define this as a plug-in
std::vector< TH1D * > hSimHitLayEn2EE_
int adc(sample_type sample)
get the ADC sample (12 bits)
std::string detectorEE_
type
Definition: HCALResponse.h:21
std::vector< float > simHitLayEn2BH
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
uint32_t data() const
Definition: HGCSample.h:57
std::vector< float > simHitCellEnBeam
std::string detectorBH_
void analyzeSimTracks(edm::Handle< edm::SimTrackContainer > const &SimTk, edm::Handle< edm::SimVertexContainer > const &SimVtx)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
int icolAbs() const
Definition: AHCalDetId.h:39
std::vector< int > hgcPassiveEEID
edm::EDGetToken tok_hitrBH_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
TProfile * hSimHitLng1_[3]
std::vector< float > simHitLayEn1BH
TProfile * hSimHitLng2_[3]
TProfile * hRecHitLng_[3]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< uint32_t > simHitCellIdFH
static const int MaxDepth
get the layer number
Definition: AHCalDetId.h:41
static uint32_t packHexagonIndex(int subdet, int z, int lay, int wafer, int celltyp, int cell)
std::vector< std::string > hgcPassiveEEName
std::string detectorFH_
T y() const
Definition: PV3DBase.h:63
edm::Service< TFileService > fs_
HGCalTBAnalyzer(edm::ParameterSet const &)
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetToken tok_digiFH_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hitsFH_
double getZ() const
Definition: AHCalDetId.cc:57
int irow() const
get the row number
Definition: AHCalDetId.cc:33
std::vector< float > simHitCellEnEE
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
GlobalPoint getPosition(const DetId &id) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::vector< float > simHitLayEn1EE
wrapper for a data word
Definition: HGCSample.h:13
int depth() const
Definition: AHCalDetId.cc:45
TProfile2D * hSimHitLat_[3]
std::vector< float > simHitCellEnFH
U second(std::pair< T, U > const &p)
std::vector< TH1D * > hSimHitLayEn1EE_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hitsBH_
void analyzeSimHits(int type, std::vector< PCaloHit > &hits, double zFront)
std::vector< float > hgcPassiveBHEnergy
std::vector< int > hgcPassiveFHID
int icol() const
get the column number
Definition: AHCalDetId.cc:39
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
int iEvent
Definition: GenABIO.cc:230
std::vector< TH1D * > hSimHitLayEn2BH_
unsigned int layers(bool reco) const
std::vector< int > idBeams_
void analyzeRecHits(int type, edm::Handle< HGCRecHitCollection > &hits)
const HGCalGeometry * hgeom_[2]
std::pair< double, double > getXY() const
get the local coordinate in the plane and along depth
Definition: AHCalDetId.cc:49
T z() const
Definition: PV3DBase.h:64
edm::EDGetTokenT< edm::SimTrackContainer > tok_simTk_
virtual void analyze(edm::Event const &, edm::EventSetup const &) override
std::vector< TH1D * > hSimHitLayEnBeam_
std::vector< float > hgcPassiveFHEnergy
const HGCalDDDConstants * hgcons_[2]
edm::EDGetToken tok_hitrFH_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hitsBeam_
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
std::vector< TH1D * > hSimHitLayEn1FH_
double waferZ(int layer, bool reco) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< uint32_t > simHitCellIdBeam
int k[5][pyjets_maxn]
Definition: DetId.h:18
edm::EDGetTokenT< edm::PassiveHitContainer > tok_hgcPHEE_
TProfile2D * hRecHitLat_[3]
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
edm::EDGetTokenT< edm::PassiveHitContainer > tok_hgcPHBH_
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:39
std::vector< uint32_t > simHitCellIdEE
TProfile * hSimHitLng_[3]
const T & get() const
Definition: EventSetup.h:56
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< uint32_t > simHitCellIdBH
std::vector< float > simHitLayEnBeam
void analyzePassiveHits(edm::Handle< edm::PassiveHitContainer > &hgcPh, std::string subdet)
std::vector< float > simHitLayEn1FH
std::vector< float > simHitCellEnBH
std::string detectorBeam_
void analyzeDigi(int type, const T1 &detId, uint16_t adc)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
int irowAbs() const
Definition: AHCalDetId.h:35
size_type size() const
std::vector< float > simHitLayEn2EE
std::vector< std::string > hgcPassiveFHName
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hitsEE_
edm::EDGetToken tok_digiBH_
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
edm::EDGetTokenT< edm::PassiveHitContainer > tok_hgcPHFH_
std::vector< int > hgcPassiveBHID
std::vector< TH1D * > hSimHitLayEn1BH_
int zside() const
get the z-side of the cell (1/-1)
Definition: AHCalDetId.h:32
T x() const
Definition: PV3DBase.h:62
T const * product() const
Definition: ESHandle.h:86
edm::EDGetToken tok_hitrEE_
edm::EDGetTokenT< edm::SimVertexContainer > tok_simVtx_
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
int layer() const
get the layer #
Definition: HGCalDetId.h:48
TProfile * hRecHitLng1_[3]
Definition: Run.h:42
std::vector< TH1D * > hSimHitLayEn2FH_
virtual void beginJob() override
edm::EDGetToken tok_digiEE_
std::vector< float > hgcPassiveEEEnergy
std::vector< std::string > hgcPassiveBHName
std::vector< float > simHitLayEn2FH