CMS 3D CMS Logo

HcalTB04Analysis.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTestBeam
4 // Class : HcalTB04Analysis
5 //
6 // Implementation:
7 // Main analysis class for Hcal Test Beam 2004 Analysis
8 //
9 // Usage: A Simwatcher class and can be activated from Oscarproducer module
10 //
11 // Original Author:
12 // Created: Tue May 16 10:14:34 CEST 2006
13 //
14 
15 // system include files
16 #include <cmath>
17 #include <iomanip>
18 #include <iostream>
19 #include <memory>
20 #include <vector>
21 #include <string>
22 
23 // user include files
30 
31 // to retreive hits
42 
48 
49 #include "HcalTBNumberingScheme.h"
50 #include "HcalTB04Histo.h"
52 
53 #include "G4SDManager.hh"
54 #include "G4Step.hh"
55 #include "G4Track.hh"
56 #include "G4ThreeVector.hh"
57 #include "G4VProcess.hh"
58 #include "G4HCofThisEvent.hh"
59 #include "CLHEP/Random/RandGaussQ.h"
60 #include "CLHEP/Units/GlobalSystemOfUnits.h"
61 #include "CLHEP/Units/GlobalPhysicalConstants.h"
62 #include "Randomize.hh"
63 #include <cstdint>
64 
65 //#define EDM_ML_DEBUG
66 
67 namespace CLHEP {
68  class HepRandomEngine;
69 }
70 
72  public Observer<const BeginOfRun*>,
73  public Observer<const BeginOfEvent*>,
74  public Observer<const EndOfEvent*>,
75  public Observer<const G4Step*> {
76 public:
78  ~HcalTB04Analysis() override;
79 
80  void produce(edm::Event&, const edm::EventSetup&) override;
81 
82 private:
83  HcalTB04Analysis(const HcalTB04Analysis&) = delete; // stop default
84  const HcalTB04Analysis& operator=(const HcalTB04Analysis&) = delete;
85 
86  void init();
87 
88  // observer methods
89  void update(const BeginOfRun* run) override;
90  void update(const BeginOfEvent* evt) override;
91  void update(const G4Step* step) override;
92  void update(const EndOfEvent* evt) override;
93 
94  //User methods
95  void fillBuffer(const EndOfEvent* evt);
96  void qieAnalysis(CLHEP::HepRandomEngine*);
97  void xtalAnalysis(CLHEP::HepRandomEngine*);
98  void finalAnalysis();
99  void fillEvent(PHcalTB04Info&);
100 
101  void clear();
102  int unitID(uint32_t id);
103  double scale(int det, int layer);
104  double timeOfFlight(int det, int layer, double eta);
105 
106 private:
109 
110  // to read from parameter set
111  bool hcalOnly;
112  int mode, type;
114  int iceta, icphi;
116  std::vector<std::string> names;
117  G4RotationMatrix* beamline_RM;
118 
119  // Constants for the run
120  int count;
122  std::vector<int> idHcal, idXtal;
123  std::vector<uint32_t> idTower, idEcal;
124 
125  // Constants for the event
128  std::vector<CaloHit> ecalHitCache;
129  std::vector<CaloHit> hcalHitCache, hcalHitLayer;
130  std::vector<double> esimh, eqie, esime, enois;
131  std::vector<double> eseta, eqeta, esphi, eqphi, eslay, eqlay;
133 
134  bool pvFound;
135  int evNum, pvType;
136  G4ThreeVector pvPosition, pvMomentum, pvUVW;
137  std::vector<int> secTrackID, secPartID;
138  std::vector<G4ThreeVector> secMomentum;
139  std::vector<double> secEkin;
140  std::vector<int> shortLivedSecondaries;
141 };
142 
143 //
144 // constructors and destructor
145 //
146 
147 HcalTB04Analysis::HcalTB04Analysis(const edm::ParameterSet& p) : myQie(nullptr), histo(nullptr) {
148  edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("HcalTB04Analysis");
149  hcalOnly = m_Anal.getParameter<bool>("HcalOnly");
150  mode = m_Anal.getParameter<int>("Mode");
151  type = m_Anal.getParameter<int>("Type");
152  ecalNoise = m_Anal.getParameter<double>("EcalNoise");
153  scaleHB0 = m_Anal.getParameter<double>("ScaleHB0");
154  scaleHB16 = m_Anal.getParameter<double>("ScaleHB16");
155  scaleHO = m_Anal.getParameter<double>("ScaleHO");
156  scaleHE0 = m_Anal.getParameter<double>("ScaleHE0");
157  names = m_Anal.getParameter<std::vector<std::string> >("Names");
158  beamOffset = -m_Anal.getParameter<double>("BeamPosition") * cm;
159  double fMinEta = m_Anal.getParameter<double>("MinEta");
160  double fMaxEta = m_Anal.getParameter<double>("MaxEta");
161  double fMinPhi = m_Anal.getParameter<double>("MinPhi");
162  double fMaxPhi = m_Anal.getParameter<double>("MaxPhi");
163  double beamEta = (fMaxEta + fMinEta) / 2.;
164  double beamPhi = (fMaxPhi + fMinPhi) / 2.;
165  double beamThet = 2 * atan(exp(-beamEta));
166  if (beamPhi < 0)
167  beamPhi += twopi;
168  iceta = (int)(beamEta / 0.087) + 1;
169  icphi = (int)(fabs(beamPhi) / 0.087) + 5;
170  if (icphi > 72)
171  icphi -= 73;
172 
173  produces<PHcalTB04Info>();
174 
175  beamline_RM = new G4RotationMatrix;
176  beamline_RM->rotateZ(-beamPhi);
177  beamline_RM->rotateY(-beamThet);
178 
179  edm::LogVerbatim("HcalTBSim")
180  << "HcalTB04:: Initialised as observer of BeginOf Job/BeginOfRun/BeginOfEvent/G4Step/EndOfEvent with Parameter "
181  "values:\n \thcalOnly = "
182  << hcalOnly << "\tecalNoise = " << ecalNoise << "\n\tMode = " << mode << " (0: HB2 Standard; 1:HB2 Segmented)"
183  << "\tType = " << type << " (0: HB; 1 HE; 2 HB+HE)\n\tbeamOffset = " << beamOffset << "\ticeta = " << iceta
184  << "\ticphi = " << icphi << "\n\tbeamline_RM = " << *beamline_RM;
185 
186  init();
187 
188  myQie = new HcalQie(p);
189  histo = new HcalTB04Histo(m_Anal);
190 }
191 
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("HcalTBSim") << "\n --------> Total number of selected entries : " << count << "\nPointers:: QIE "
195  << myQie << " Histo " << histo;
196 #endif
197  if (myQie) {
198  delete myQie;
199  myQie = nullptr;
200  }
201  if (histo) {
202  delete histo;
203  histo = nullptr;
204  }
205 }
206 
207 //
208 // member functions
209 //
210 
212  std::unique_ptr<PHcalTB04Info> product(new PHcalTB04Info);
213  fillEvent(*product);
214  e.put(std::move(product));
215 }
216 
219  nTower = idTower.size();
220 #ifdef EDM_ML_DEBUG
221  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Save information from " << nTower << " HCal towers";
222 #endif
223  idHcal.reserve(nTower);
224  for (int i = 0; i < nTower; i++) {
225  int id = unitID(idTower[i]);
226  idHcal.push_back(id);
227 #ifdef EDM_ML_DEBUG
228  edm::LogVerbatim("HcalTBSim") << "\tTower[" << i << "] Original " << std::hex << idTower[i] << " Stored "
229  << idHcal[i] << std::dec;
230 #endif
231  }
232 
233  if (!hcalOnly) {
234  int det = 10;
235  uint32_t id1;
236  nCrystal = 0;
237  for (int lay = 1; lay < 8; lay++) {
238  for (int icr = 1; icr < 8; icr++) {
239  id1 = HcalTestNumbering::packHcalIndex(det, 0, 1, icr, lay, 1);
240  int id = unitID(id1);
241  idEcal.push_back(id1);
242  idXtal.push_back(id);
243  nCrystal++;
244  }
245  }
246  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Save information from " << nCrystal << " ECal Crystals";
247 #ifdef EDM_ML_DEBUG
248  for (int i = 0; i < nCrystal; i++) {
249  edm::LogVerbatim("HcalTBSim") << "\tCrystal[" << i << "] Original " << std::hex << idEcal[i] << " Stored "
250  << idXtal[i] << std::dec;
251  }
252 #endif
253  }
254  // Profile vectors
255  eseta.reserve(5);
256  eqeta.reserve(5);
257  esphi.reserve(3);
258  eqphi.reserve(3);
259  eslay.reserve(20);
260  eqlay.reserve(20);
261  for (int i = 0; i < 5; i++) {
262  eseta.push_back(0.);
263  eqeta.push_back(0.);
264  }
265  for (int i = 0; i < 3; i++) {
266  esphi.push_back(0.);
267  eqphi.push_back(0.);
268  }
269  for (int i = 0; i < 20; i++) {
270  eslay.push_back(0.);
271  eqlay.push_back(0.);
272  }
273 
274  // counter
275  count = 0;
276  evNum = 0;
277  clear();
278 }
279 
281  int irun = (*run)()->GetRunID();
282  edm::LogVerbatim("HcalTBSim") << " =====> Begin of Run = " << irun;
283 
284  G4SDManager* sd = G4SDManager::GetSDMpointerIfExist();
285  if (sd != nullptr) {
286  std::string sdname = names[0];
287  G4VSensitiveDetector* aSD = sd->FindSensitiveDetector(sdname);
288  if (aSD == nullptr) {
289  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis::beginOfRun: No SD"
290  << " with name " << sdname << " in this "
291  << "Setup";
292  } else {
293  HCalSD* theCaloSD = dynamic_cast<HCalSD*>(aSD);
294  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::beginOfRun: Finds SD with name " << theCaloSD->GetName()
295  << " in this Setup";
297  theCaloSD->setNumberingScheme(org);
298  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::beginOfRun: set a new numbering scheme";
299  }
300  if (!hcalOnly) {
301  sdname = names[1];
302  aSD = sd->FindSensitiveDetector(sdname);
303  if (aSD == nullptr) {
304  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis::beginOfRun: No SD"
305  << " with name " << sdname << " in this "
306  << "Setup";
307  } else {
308  ECalSD* theCaloSD = dynamic_cast<ECalSD*>(aSD);
309  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::beginOfRun: Finds SD with name " << theCaloSD->GetName()
310  << " in this Setup";
312  theCaloSD->setNumberingScheme(org);
313  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::beginOfRun: set a new numbering scheme";
314  }
315  }
316  } else {
317  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis::beginOfRun: Could "
318  << "not get SD Manager!";
319  }
320 }
321 
323  clear();
324 #ifdef EDM_ML_DEBUG
325  evNum = (*evt)()->GetEventID();
326  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis: =====> Begin of event = " << evNum;
327 #endif
328 }
329 
330 void HcalTB04Analysis::update(const G4Step* aStep) {
331  if (aStep != nullptr) {
332  //Get Step properties
333  G4ThreeVector thePreStepPoint = aStep->GetPreStepPoint()->GetPosition();
334  G4ThreeVector thePostStepPoint;
335 
336  // Get Tracks properties
337  G4Track* aTrack = aStep->GetTrack();
338  int trackID = aTrack->GetTrackID();
339  int parentID = aTrack->GetParentID();
340  const G4ThreeVector& position = aTrack->GetPosition();
341  G4ThreeVector momentum = aTrack->GetMomentum();
342  G4String partType = aTrack->GetDefinition()->GetParticleType();
343  G4String partSubType = aTrack->GetDefinition()->GetParticleSubType();
344  int partPDGEncoding = aTrack->GetDefinition()->GetPDGEncoding();
345 #ifdef EDM_ML_DEBUG
346  bool isPDGStable = aTrack->GetDefinition()->GetPDGStable();
347 #endif
348  double pDGlifetime = aTrack->GetDefinition()->GetPDGLifeTime();
349  double gammaFactor = aStep->GetPreStepPoint()->GetGamma();
350 
351  if (!pvFound) { //search for v1
352  double stepDeltaEnergy = aStep->GetDeltaEnergy();
353  double kinEnergy = aTrack->GetKineticEnergy();
354 
355  // look for DeltaE > 10% kinEnergy of particle, or particle death - Ek=0
356  if (trackID == 1 && parentID == 0 && ((kinEnergy == 0.) || (fabs(stepDeltaEnergy / kinEnergy) > 0.1))) {
357  pvType = -1;
358  if (kinEnergy == 0.) {
359  pvType = 0;
360  } else {
361  if (fabs(stepDeltaEnergy / kinEnergy) > 0.1)
362  pvType = 1;
363  }
364  pvFound = true;
366  pvMomentum = momentum;
367  // Rotated coord.system:
368  pvUVW = (*beamline_RM) * (pvPosition);
369 
370  //Volume name requires some checks:
371  G4String thePostPVname = "NoName";
372  G4StepPoint* thePostPoint = aStep->GetPostStepPoint();
373  if (thePostPoint) {
374  thePostStepPoint = thePostPoint->GetPosition();
375  G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
376  if (thePostPV)
377  thePostPVname = thePostPV->GetName();
378  }
379 #ifdef EDM_ML_DEBUG
380  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: V1 found at: " << thePostStepPoint
381  << " G4VPhysicalVolume: " << thePostPVname;
382  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::fill_v1Pos: Primary Track momentum: " << pvMomentum
383  << " psoition " << pvPosition << " u/v/w " << pvUVW;
384 #endif
385  }
386  } else {
387  // watch for secondaries originating @v1, including the surviving primary
388  if ((trackID != 1 && parentID == 1 && (aTrack->GetCurrentStepNumber() == 1) && (thePreStepPoint == pvPosition)) ||
389  (trackID == 1 && thePreStepPoint == pvPosition)) {
390 #ifdef EDM_ML_DEBUG
391  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::A secondary... PDG:" << partPDGEncoding
392  << " TrackID:" << trackID << " ParentID:" << parentID
393  << " stable: " << isPDGStable << " Tau: " << pDGlifetime
394  << " cTauGamma=" << c_light * pDGlifetime * gammaFactor * 1000.
395  << "um GammaFactor: " << gammaFactor;
396 #endif
397  secTrackID.push_back(trackID);
398  secPartID.push_back(partPDGEncoding);
399  secMomentum.push_back(momentum);
400  secEkin.push_back(aTrack->GetKineticEnergy());
401 
402  // Check for short-lived secondaries: cTauGamma<100um
403  double ctaugamma_um = CLHEP::c_light * pDGlifetime * gammaFactor * 1000.;
404  if ((ctaugamma_um > 0.) && (ctaugamma_um < 100.)) { //short-lived secondary
405  shortLivedSecondaries.push_back(trackID);
406  } else { //normal secondary - enter into the V1-calorimetric tree
407  // histos->fill_v1cSec (aTrack);
408  }
409  }
410  // Also watch for tertiary particles coming from
411  // short-lived secondaries from V1
412  if (aTrack->GetCurrentStepNumber() == 1) {
413  if (!shortLivedSecondaries.empty()) {
414  int pid = parentID;
415  std::vector<int>::iterator pos1 = shortLivedSecondaries.begin();
416  std::vector<int>::iterator pos2 = shortLivedSecondaries.end();
417  std::vector<int>::iterator pos;
418  for (pos = pos1; pos != pos2; pos++) {
419  if (*pos == pid) { //ParentID is on the list of short-lived
420  // secondary
421 #ifdef EDM_ML_DEBUG
422  edm::LogVerbatim("HcalTBSim")
423  << "HcalTB04Analysis:: A tertiary... PDG:" << partPDGEncoding << " TrackID:" << trackID
424  << " ParentID:" << parentID << " stable: " << isPDGStable << " Tau: " << pDGlifetime
425  << " cTauGamma=" << c_light * pDGlifetime * gammaFactor * 1000. << "um GammaFactor: " << gammaFactor;
426 #endif
427  }
428  }
429  }
430  }
431  }
432  }
433 }
434 
436  count++;
437 
438  //fill the buffer
439 #ifdef EDM_ML_DEBUG
440  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::Fill event " << (*evt)()->GetEventID();
441 #endif
442  fillBuffer(evt);
443 
444  //QIE analysis
445 #ifdef EDM_ML_DEBUG
446  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::Do QIE analysis with " << hcalHitCache.size() << " hits";
447 #endif
448  CLHEP::HepRandomEngine* engine = G4Random::getTheEngine();
449  qieAnalysis(engine);
450 
451  //Energy in Crystal Matrix
452  if (!hcalOnly) {
453 #ifdef EDM_ML_DEBUG
454  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::Do Xtal analysis with " << ecalHitCache.size() << " hits";
455 #endif
456  xtalAnalysis(engine);
457  }
458 
459  //Final Analysis
460 #ifdef EDM_ML_DEBUG
461  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::Final analysis";
462 #endif
463  finalAnalysis();
464 
465  int iEvt = (*evt)()->GetEventID();
466  if (iEvt < 10)
467  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Event " << iEvt;
468  else if ((iEvt < 100) && (iEvt % 10 == 0))
469  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Event " << iEvt;
470  else if ((iEvt < 1000) && (iEvt % 100 == 0))
471  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Event " << iEvt;
472  else if ((iEvt < 10000) && (iEvt % 1000 == 0))
473  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Event " << iEvt;
474 }
475 
477  std::vector<CaloHit> hhits, hhitl;
478  int idHC, j;
479  CaloG4HitCollection* theHC;
480  std::map<int, float, std::less<int> > primaries;
481  double etot1 = 0, etot2 = 0;
482 
483  // Look for the Hit Collection of HCal
484  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
485  std::string sdName = names[0];
486  idHC = G4SDManager::GetSDMpointer()->GetCollectionID(sdName);
487  theHC = (CaloG4HitCollection*)allHC->GetHC(idHC);
488 #ifdef EDM_ML_DEBUG
489  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hit Collection for " << sdName << " of ID " << idHC
490  << " is obtained at " << theHC << " with " << theHC->entries() << " entries";
491 #endif
492  int thehc_entries = theHC->entries();
493  if (idHC >= 0 && theHC != nullptr) {
494  hhits.reserve(theHC->entries());
495  hhitl.reserve(theHC->entries());
496  for (j = 0; j < thehc_entries; j++) {
497  CaloG4Hit* aHit = (*theHC)[j];
498  double e = aHit->getEnergyDeposit() / CLHEP::GeV;
499  double time = aHit->getTimeSlice();
500  math::XYZPoint pos = aHit->getEntry();
501  unsigned int id = aHit->getUnitID();
502  double theta = pos.theta();
503  double eta = -log(tan(theta * 0.5));
504  double phi = pos.phi();
505  int det, z, group, ieta, iphi, layer;
507  double jitter = time - timeOfFlight(det, layer, eta);
508  if (jitter < 0)
509  jitter = 0;
510  if (e < 0 || e > 1.)
511  e = 0;
512  double escl = e * scale(det, layer);
513  unsigned int idx = HcalTBNumberingScheme::getUnitID(id, mode);
514  CaloHit hit(det, layer, escl, eta, phi, jitter, idx);
515  hhits.push_back(hit);
516  CaloHit hitl(det, layer, escl, eta, phi, jitter, id);
517  hhitl.push_back(hitl);
518  primaries[aHit->getTrackID()] += e;
519  etot1 += escl;
520 #ifdef EDM_ML_DEBUG
521  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hcal Hit i/p " << j << " ID 0x" << std::hex << id << " 0x"
522  << idx << std::dec << " time " << std::setw(6) << time << " " << std::setw(6)
523  << jitter << " theta " << std::setw(8) << theta << " eta " << std::setw(8) << eta
524  << " phi " << std::setw(8) << phi << " e " << std::setw(8) << e << " "
525  << std::setw(8) << escl;
526 #endif
527  }
528  }
529 
530  // Add hits in the same channel within same time slice
531  std::vector<CaloHit>::iterator itr;
532  int nHit = hhits.size();
533  std::vector<CaloHit*> hits(nHit);
534  for (j = 0, itr = hhits.begin(); itr != hhits.end(); j++, itr++) {
535  hits[j] = &hhits[j];
536  }
537  sort(hits.begin(), hits.end(), CaloHitIdMore());
538  std::vector<CaloHit*>::iterator k1, k2;
539  int nhit = 0;
540  for (k1 = hits.begin(); k1 != hits.end(); k1++) {
541  int det = (**k1).det();
542  int layer = (**k1).layer();
543  double ehit = (**k1).e();
544  double eta = (**k1).eta();
545  double phi = (**k1).phi();
546  double jitter = (**k1).t();
547  uint32_t unitID = (**k1).id();
548  int jump = 0;
549  for (k2 = k1 + 1; k2 != hits.end() && fabs(jitter - (**k2).t()) < 1 && unitID == (**k2).id(); k2++) {
550  ehit += (**k2).e();
551  jump++;
552  }
553  nhit++;
554  CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
555  hcalHitCache.push_back(hit);
556  etot2 += ehit;
557  k1 += jump;
558 #ifdef EDM_ML_DEBUG
559  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hcal Hit store " << nhit << " ID 0x" << std::hex << unitID
560  << std::dec << " time " << std::setw(6) << jitter << " eta " << std::setw(8) << eta
561  << " phi " << std::setw(8) << phi << " e " << std::setw(8) << ehit;
562 #endif
563  }
564 #ifdef EDM_ML_DEBUG
565  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Stores " << nhit << " HCal hits from " << nHit
566  << " input hits E(Hcal) " << etot1 << " " << etot2;
567 #endif
568  //Repeat for Hit in each layer (hhits and hhitl sizes are the same)
569  for (j = 0, itr = hhitl.begin(); itr != hhitl.end(); j++, itr++) {
570  hits[j] = &hhitl[j];
571  }
572  sort(hits.begin(), hits.end(), CaloHitIdMore());
573  int nhitl = 0;
574  double etotl = 0;
575  for (k1 = hits.begin(); k1 != hits.end(); k1++) {
576  int det = (**k1).det();
577  int layer = (**k1).layer();
578  double ehit = (**k1).e();
579  double eta = (**k1).eta();
580  double phi = (**k1).phi();
581  double jitter = (**k1).t();
582  uint32_t unitID = (**k1).id();
583  int jump = 0;
584  for (k2 = k1 + 1; k2 != hits.end() && fabs(jitter - (**k2).t()) < 1 && unitID == (**k2).id(); k2++) {
585  ehit += (**k2).e();
586  jump++;
587  }
588  nhitl++;
589  CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
590  hcalHitLayer.push_back(hit);
591  etotl += ehit;
592  k1 += jump;
593 #ifdef EDM_ML_DEBUG
594  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hcal Hit store " << nhitl << " ID 0x" << std::hex << unitID
595  << std::dec << " time " << std::setw(6) << jitter << " eta " << std::setw(8) << eta
596  << " phi " << std::setw(8) << phi << " e " << std::setw(8) << ehit;
597 #endif
598  }
599 #ifdef EDM_ML_DEBUG
600  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Stores " << nhitl << " HCal hits from " << nHit
601  << " input hits E(Hcal) " << etot1 << " " << etotl;
602 #endif
603  // Look for the Hit Collection of ECal
604  std::vector<CaloHit> ehits;
605  sdName = names[1];
606  idHC = G4SDManager::GetSDMpointer()->GetCollectionID(sdName);
607  theHC = (CaloG4HitCollection*)allHC->GetHC(idHC);
608  etot1 = etot2 = 0;
609 #ifdef EDM_ML_DEBUG
610  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Hit Collection for " << sdName << " of ID " << idHC
611  << " is obtained at " << theHC << " with " << theHC->entries() << " entries";
612 #endif
613  if (idHC >= 0 && theHC != nullptr) {
614  thehc_entries = theHC->entries();
615  ehits.reserve(theHC->entries());
616  for (j = 0; j < thehc_entries; j++) {
617  CaloG4Hit* aHit = (*theHC)[j];
618  double e = aHit->getEnergyDeposit() / CLHEP::GeV;
619  double time = aHit->getTimeSlice();
620  if (e < 0 || e > 100000.)
621  e = 0;
622  if (e > 0) {
623  math::XYZPoint pos = aHit->getEntry();
624  unsigned int id = aHit->getUnitID();
625  double theta = pos.theta();
626  double eta = -log(tan(theta * 0.5));
627  double phi = pos.phi();
628  int det, z, group, ieta, iphi, layer;
630  CaloHit hit(det, 0, e, eta, phi, time, id);
631  ehits.push_back(hit);
632  primaries[aHit->getTrackID()] += e;
633  etot1 += e;
634 #ifdef EDM_ML_DEBUG
635  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Ecal Hit i/p " << j << " ID 0x" << std::hex << id
636  << std::dec << " time " << std::setw(6) << time << " theta " << std::setw(8)
637  << theta << " eta " << std::setw(8) << eta << " phi " << std::setw(8) << phi
638  << " e " << std::setw(8) << e;
639 #endif
640  }
641  }
642  }
643 
644  // Add hits in the same channel within same time slice
645  nHit = ehits.size();
646  std::vector<CaloHit*> hite(nHit);
647  for (j = 0, itr = ehits.begin(); itr != ehits.end(); j++, itr++) {
648  hite[j] = &ehits[j];
649  }
650  sort(hite.begin(), hite.end(), CaloHitIdMore());
651  nhit = 0;
652  for (k1 = hite.begin(); k1 != hite.end(); k1++) {
653  int det = (**k1).det();
654  int layer = (**k1).layer();
655  double ehit = (**k1).e();
656  double eta = (**k1).eta();
657  double phi = (**k1).phi();
658  double jitter = (**k1).t();
659  uint32_t unitID = (**k1).id();
660  int jump = 0;
661  for (k2 = k1 + 1; k2 != hite.end() && fabs(jitter - (**k2).t()) < 1 && unitID == (**k2).id(); k2++) {
662  ehit += (**k2).e();
663  jump++;
664  }
665  nhit++;
666  CaloHit hit(det, layer, ehit, eta, phi, jitter, unitID);
667  ecalHitCache.push_back(hit);
668  etot2 += ehit;
669  k1 += jump;
670 #ifdef EDM_ML_DEBUG
671  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Ecal Hit store " << nhit << " ID 0x" << std::hex << unitID
672  << std::dec << " time " << std::setw(6) << jitter << " eta " << std::setw(8) << eta
673  << " phi " << std::setw(8) << phi << " e " << std::setw(8) << ehit;
674 #endif
675  }
676 #ifdef EDM_ML_DEBUG
677  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Stores " << nhit << " ECal hits from " << nHit
678  << " input hits E(Ecal) " << etot1 << " " << etot2;
679 #endif
680  // Find Primary info:
681  nPrimary = (int)(primaries.size());
682  int trackID = 0;
683  G4PrimaryParticle* thePrim = nullptr;
684  int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
685 #ifdef EDM_ML_DEBUG
686  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Event has " << nvertex << " verteices";
687 #endif
688  if (nvertex <= 0)
689  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis::EndOfEvent ERROR: no vertex found for event " << evNum;
690  for (int i = 0; i < nvertex; i++) {
691  G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i);
692  if (avertex == nullptr) {
693  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis::EndOfEvent ERR: pointer to vertex = 0 for event " << evNum;
694  } else {
695  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::Vertex number :" << i << " " << avertex->GetPosition();
696  int npart = avertex->GetNumberOfParticle();
697  if (npart == 0)
698  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis::End Of Event ERR: no primary!";
699  if (thePrim == nullptr)
700  thePrim = avertex->GetPrimary(trackID);
701  }
702  }
703 
704  if (thePrim != nullptr) {
705  double px = thePrim->GetPx();
706  double py = thePrim->GetPy();
707  double pz = thePrim->GetPz();
708  double p = std::sqrt(pow(px, 2.) + pow(py, 2.) + pow(pz, 2.));
709  pInit = p / CLHEP::GeV;
710  if (p == 0)
711  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis:: EndOfEvent ERR: primary has p=0 ";
712  else {
713  double costheta = pz / p;
714  double theta = acos(std::min(std::max(costheta, -1.), 1.));
715  etaInit = -log(tan(theta / 2));
716  if (px != 0 || py != 0)
717  phiInit = atan2(py, px);
718  }
719  particleType = thePrim->GetPDGcode();
720  } else
721  edm::LogWarning("HcalTBSim") << "HcalTB04Analysis::EndOfEvent ERR: could not find primary";
722 }
723 
724 void HcalTB04Analysis::qieAnalysis(CLHEP::HepRandomEngine* engine) {
725  int hittot = hcalHitCache.size();
726  if (hittot <= 0)
727  hittot = 1;
728  std::vector<CaloHit> hits(hittot);
729  std::vector<int> todo(nTower, 0);
730 
731 #ifdef EDM_ML_DEBUG
732  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::qieAnalysis: Size " << hits.size() << " " << todo.size() << " "
733  << idTower.size() << " " << esimh.size() << " " << eqie.size();
734 #endif
735  // Loop over all HCal hits
736  for (unsigned int k1 = 0; k1 < hcalHitCache.size(); k1++) {
737  CaloHit hit = hcalHitCache[k1];
738  uint32_t id = hit.id();
739  int nhit = 0;
740  double esim = hit.e();
741  hits[nhit] = hit;
742  for (unsigned int k2 = k1 + 1; k2 < hcalHitCache.size(); k2++) {
743  hit = hcalHitCache[k2];
744  if (hit.id() == id) {
745  nhit++;
746  hits[nhit] = hit;
747  esim += hit.e();
748  }
749  }
750  k1 += nhit;
751  nhit++;
752  std::vector<int> cd = myQie->getCode(nhit, hits, engine);
753  double eq = myQie->getEnergy(cd);
754 #ifdef EDM_ML_DEBUG
755  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: ID 0x" << std::hex << id << std::dec << " registers " << esim
756  << " energy from " << nhit << " hits starting with hit # " << k1
757  << " energy with noise " << eq;
758 #endif
759  for (int k2 = 0; k2 < nTower; k2++) {
760  if (id == idTower[k2]) {
761  todo[k2] = 1;
762  esimh[k2] = esim;
763  eqie[k2] = eq;
764  }
765  }
766  }
767 
768  // Towers with no hit
769  for (int k2 = 0; k2 < nTower; k2++) {
770  if (todo[k2] == 0) {
771  std::vector<int> cd = myQie->getCode(0, hits, engine);
772  double eq = myQie->getEnergy(cd);
773  esimh[k2] = 0;
774  eqie[k2] = eq;
775 #ifdef EDM_ML_DEBUG
776  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: ID 0x" << std::hex << idTower[k2] << std::dec
777  << " registers " << esimh[k2] << " energy from hits and energy after QIE analysis "
778  << eqie[k2];
779 #endif
780  }
781  }
782 }
783 
784 void HcalTB04Analysis::xtalAnalysis(CLHEP::HepRandomEngine* engine) {
785  CLHEP::RandGaussQ randGauss(*engine);
786 
787  // Crystal Data
788  std::vector<int> iok(nCrystal, 0);
789 #ifdef EDM_ML_DEBUG
790  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::xtalAnalysis: Size " << iok.size() << " " << idEcal.size() << " "
791  << esime.size() << " " << enois.size();
792 #endif
793  for (unsigned int k1 = 0; k1 < ecalHitCache.size(); k1++) {
794  uint32_t id = ecalHitCache[k1].id();
795  int nhit = 0;
796  double esim = ecalHitCache[k1].e();
797  for (unsigned int k2 = k1 + 1; k2 < ecalHitCache.size(); k2++) {
798  if (ecalHitCache[k2].id() == id) {
799  nhit++;
800  esim += ecalHitCache[k2].e();
801  }
802  }
803  k1 += nhit;
804  nhit++;
805  double eq = esim + randGauss.fire(0., ecalNoise);
806 #ifdef EDM_ML_DEBUG
807  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: ID 0x" << std::hex << id << std::dec << " registers " << esim
808  << " energy from " << nhit << " hits starting with hit # " << k1
809  << " energy with noise " << eq;
810 #endif
811  for (int k2 = 0; k2 < nCrystal; k2++) {
812  if (id == idEcal[k2]) {
813  iok[k2] = 1;
814  esime[k2] = esim;
815  enois[k2] = eq;
816  }
817  }
818  }
819 
820  // Crystals with no hit
821  for (int k2 = 0; k2 < nCrystal; k2++) {
822  if (iok[k2] == 0) {
823  esime[k2] = 0;
824  enois[k2] = randGauss.fire(0., ecalNoise);
825 #ifdef EDM_ML_DEBUG
826  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: ID 0x" << std::hex << idEcal[k2] << std::dec
827  << " registers " << esime[k2] << " energy from hits and energy from noise "
828  << enois[k2];
829 #endif
830  }
831  }
832 }
833 
835  //Beam Information
837 
838  // Total Energy
839  eecals = ehcals = eecalq = ehcalq = 0.;
840  for (int i = 0; i < nTower; i++) {
841  ehcals += esimh[i];
842  ehcalq += eqie[i];
843  }
844  for (int i = 0; i < nCrystal; i++) {
845  eecals += esime[i];
846  eecalq += enois[i];
847  }
848  etots = eecals + ehcals;
849  etotq = eecalq + ehcalq;
850 #ifdef EDM_ML_DEBUG
851  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Energy deposit at Sim Level (Total) " << etots << " (ECal) "
852  << eecals << " (HCal) " << ehcals
853  << "\nHcalTB04Analysis:: Energy deposit at Qie Level (Total) " << etotq << " (ECal) "
854  << eecalq << " (HCal) " << ehcalq;
855 #endif
857 
858  // Lateral Profile
859  for (int i = 0; i < 5; i++) {
860  eseta[i] = 0.;
861  eqeta[i] = 0.;
862  }
863  for (int i = 0; i < 3; i++) {
864  esphi[i] = 0.;
865  eqphi[i] = 0.;
866  }
867  double e1 = 0, e2 = 0;
868  unsigned int id;
869  for (int i = 0; i < nTower; i++) {
870  int det, z, group, ieta, iphi, layer;
871  id = idTower[i];
873  iphi -= (icphi - 1);
874  if (icphi > 4) {
875  if (ieta == 0)
876  ieta = 2;
877  else
878  ieta = -1;
879  } else {
880  ieta = ieta - iceta + 2;
881  }
882  if (iphi >= 0 && iphi < 3 && ieta >= 0 && ieta < 5) {
883  eseta[ieta] += esimh[i];
884  esphi[iphi] += esimh[i];
885  e1 += esimh[i];
886  eqeta[ieta] += eqie[i];
887  eqphi[iphi] += eqie[i];
888  e2 += eqie[i];
889  }
890  }
891  for (int i = 0; i < 3; i++) {
892  if (e1 > 0)
893  esphi[i] /= e1;
894  if (e2 > 0)
895  eqphi[i] /= e2;
896  }
897  for (int i = 0; i < 5; i++) {
898  if (e1 > 0)
899  eseta[i] /= e1;
900  if (e2 > 0)
901  eqeta[i] /= e2;
902  }
903 #ifdef EDM_ML_DEBUG
904  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Energy fraction along Eta and Phi (Sim/Qie)";
905  for (int i = 0; i < 5; i++)
906  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: [" << i << "] Eta Sim = " << eseta[i] << " Qie = " << eqeta[i]
907  << " Phi Sim = " << esphi[i] << " Qie = " << eqphi[i];
908 #endif
910 
911  // Longitudianl profile
912  for (int i = 0; i < 20; i++) {
913  eslay[i] = 0.;
914  eqlay[i] = 0.;
915  }
916  e1 = 0;
917  e2 = 0;
918  for (int i = 0; i < nTower; i++) {
919  int det, z, group, ieta, iphi, layer;
920  id = idTower[i];
922  iphi -= (icphi - 1);
923  layer -= 1;
924  if (iphi >= 0 && iphi < 3 && layer >= 0 && layer < 20) {
925  eslay[layer] += esimh[i];
926  e1 += esimh[i];
927  eqlay[layer] += eqie[i];
928  e2 += eqie[i];
929  }
930  }
931  for (int i = 0; i < 20; i++) {
932  if (e1 > 0)
933  eslay[i] /= e1;
934  if (e2 > 0)
935  eqlay[i] /= e2;
936  }
937 #ifdef EDM_ML_DEBUG
938  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Energy fraction along Layer";
939  for (int i = 0; i < 20; i++)
940  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: [" << i << "] Sim = " << eslay[i] << " Qie = " << eqlay[i];
941 #endif
943 }
944 
946  //Setup the ID's
947  product.setIDs(idHcal, idXtal);
948 
949  //Beam Information
951 
952  //Energy deposits in the crystals and towers
953  product.setEdepHcal(esimh, eqie);
954  product.setEdepHcal(esime, enois);
955 
956  // Total Energy
957  product.setEdep(etots, eecals, ehcals, etotq, eecalq, ehcalq);
958 
959  // Lateral Profile
960  product.setTrnsProf(eseta, eqeta, esphi, eqphi);
961 
962  // Longitudianl profile
963  product.setLongProf(eslay, eqlay);
964 
965  //Save Hits
966  int i, nhit = 0;
967  std::vector<CaloHit>::iterator itr;
968  for (i = 0, itr = ecalHitCache.begin(); itr != ecalHitCache.end(); i++, itr++) {
969  uint32_t id = itr->id();
970  int det, z, group, ieta, iphi, lay;
972  product.saveHit(det, lay, ieta, iphi, itr->e(), itr->t());
973  nhit++;
974 #ifdef EDM_ML_DEBUG
975  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Save Hit " << std::setw(3) << i + 1 << " ID 0x" << std::hex
976  << group << std::dec << " " << std::setw(2) << det << " " << std::setw(2) << lay
977  << " " << std::setw(1) << z << " " << std::setw(3) << ieta << " " << std::setw(3)
978  << iphi << " T " << std::setw(6) << itr->t() << " E " << std::setw(6) << itr->e();
979 #endif
980  }
981  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Saves " << nhit << " hits from Crystals";
982  int hit = nhit;
983  nhit = 0;
984 
985  for (i = hit, itr = hcalHitCache.begin(); itr != hcalHitCache.end(); i++, itr++) {
986  uint32_t id = itr->id();
987  int det, z, group, ieta, iphi, lay;
989  product.saveHit(det, lay, ieta, iphi, itr->e(), itr->t());
990  nhit++;
991 #ifdef EDM_ML_DEBUG
992  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Save Hit " << std::setw(3) << i + 1 << " ID 0x" << std::hex
993  << group << std::dec << " " << std::setw(2) << det << " " << std::setw(2) << lay
994  << " " << std::setw(1) << z << " " << std::setw(3) << ieta << " " << std::setw(3)
995  << iphi << " T " << std::setw(6) << itr->t() << " E " << std::setw(6) << itr->e();
996 #endif
997  }
998  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis:: Saves " << nhit << " hits from HCal";
999 
1000  //Vertex associated quantities
1001  product.setVtxPrim(evNum,
1002  pvType,
1003  pvPosition.x(),
1004  pvPosition.y(),
1005  pvPosition.z(),
1006  pvUVW.x(),
1007  pvUVW.y(),
1008  pvUVW.z(),
1009  pvMomentum.x(),
1010  pvMomentum.y(),
1011  pvMomentum.z());
1012  for (unsigned int i = 0; i < secTrackID.size(); i++) {
1013  product.setVtxSec(
1015  }
1016 }
1017 
1019  pvFound = false;
1020  pvType = -2;
1021  pvPosition = G4ThreeVector();
1022  pvMomentum = G4ThreeVector();
1023  pvUVW = G4ThreeVector();
1024  secTrackID.clear();
1025  secPartID.clear();
1026  secMomentum.clear();
1027  secEkin.clear();
1028  shortLivedSecondaries.clear();
1029 
1030  ecalHitCache.erase(ecalHitCache.begin(), ecalHitCache.end());
1031  hcalHitCache.erase(hcalHitCache.begin(), hcalHitCache.end());
1032  hcalHitLayer.erase(hcalHitLayer.begin(), hcalHitLayer.end());
1033  nPrimary = particleType = 0;
1034  pInit = etaInit = phiInit = 0;
1035 
1036  esimh.clear();
1037  eqie.clear();
1038  esimh.reserve(nTower);
1039  eqie.reserve(nTower);
1040  for (int i = 0; i < nTower; i++) {
1041  esimh.push_back(0.);
1042  eqie.push_back(0.);
1043  }
1044  esime.clear();
1045  enois.clear();
1046  esime.reserve(nCrystal);
1047  enois.reserve(nCrystal);
1048  for (int i = 0; i < nCrystal; i++) {
1049  esime.push_back(0.);
1050  enois.push_back(0.);
1051  }
1052 }
1053 
1054 int HcalTB04Analysis::unitID(uint32_t id) {
1055  int det, z, group, ieta, iphi, lay;
1057  group = (det & 15) << 20;
1058  group += ((lay - 1) & 31) << 15;
1059  group += (z & 1) << 14;
1060  group += (ieta & 127) << 7;
1061  group += (iphi & 127);
1062  return group;
1063 }
1064 
1065 double HcalTB04Analysis::scale(int det, int layer) {
1066  double tmp = 1.;
1067  if (det == static_cast<int>(HcalBarrel)) {
1068  if (layer == 1)
1069  tmp = scaleHB0;
1070  else if (layer == 17)
1071  tmp = scaleHB16;
1072  else if (layer > 17)
1073  tmp = scaleHO;
1074  } else {
1075  if (layer <= 2)
1076  tmp = scaleHE0;
1077  }
1078  return tmp;
1079 }
1080 
1081 double HcalTB04Analysis::timeOfFlight(int det, int layer, double eta) {
1082  double theta = 2.0 * atan(exp(-eta));
1083  double dist = beamOffset;
1084  if (det == static_cast<int>(HcalBarrel)) {
1085  const double rLay[19] = {1836.0,
1086  1902.0,
1087  1962.0,
1088  2022.0,
1089  2082.0,
1090  2142.0,
1091  2202.0,
1092  2262.0,
1093  2322.0,
1094  2382.0,
1095  2448.0,
1096  2514.0,
1097  2580.0,
1098  2646.0,
1099  2712.0,
1100  2776.0,
1101  2862.5,
1102  3847.0,
1103  4052.0};
1104  if (layer > 0 && layer <= 19)
1105  dist += rLay[layer - 1] * mm / sin(theta);
1106  } else {
1107  const double zLay[19] = {4034.0,
1108  4032.0,
1109  4123.0,
1110  4210.0,
1111  4297.0,
1112  4384.0,
1113  4471.0,
1114  4558.0,
1115  4645.0,
1116  4732.0,
1117  4819.0,
1118  4906.0,
1119  4993.0,
1120  5080.0,
1121  5167.0,
1122  5254.0,
1123  5341.0,
1124  5428.0,
1125  5515.0};
1126  if (layer > 0 && layer <= 19)
1127  dist += zLay[layer - 1] * mm / cos(theta);
1128  }
1129 
1130  double tmp = dist / c_light / ns;
1131 #ifdef EDM_ML_DEBUG
1132  edm::LogVerbatim("HcalTBSim") << "HcalTB04Analysis::timeOfFlight " << tmp << " for det/lay " << det << " " << layer
1133  << " eta/theta " << eta << " " << theta / deg << " dist " << dist;
1134 #endif
1135  return tmp;
1136 }
1137 
HcalTB04Analysis::esime
std::vector< double > esime
Definition: HcalTB04Analysis.cc:130
HcalTB04Analysis::particleType
int particleType
Definition: HcalTB04Analysis.cc:126
DDAxes::y
HcalTB04Analysis::xtalAnalysis
void xtalAnalysis(CLHEP::HepRandomEngine *)
Definition: HcalTB04Analysis.cc:784
CaloG4Hit::getTrackID
int getTrackID() const
Definition: CaloG4Hit.h:64
mps_fire.i
i
Definition: mps_fire.py:428
HcalTB04Analysis::idXtal
std::vector< int > idXtal
Definition: HcalTB04Analysis.cc:122
Observer
Definition: Observer.h:23
HcalTB04Analysis::iceta
int iceta
Definition: HcalTB04Analysis.cc:114
HcalTB04Analysis::timeOfFlight
double timeOfFlight(int det, int layer, double eta)
Definition: HcalTB04Analysis.cc:1081
MessageLogger.h
DQMOfflineHeavyIons_cff.todo
todo
Definition: DQMOfflineHeavyIons_cff.py:112
HcalTB04Analysis::beamline_RM
G4RotationMatrix * beamline_RM
Definition: HcalTB04Analysis.cc:117
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
step
step
Definition: StallMonitor.cc:94
HcalTB04Analysis::pvUVW
G4ThreeVector pvUVW
Definition: HcalTB04Analysis.cc:136
HcalTB04Analysis::hcalHitCache
std::vector< CaloHit > hcalHitCache
Definition: HcalTB04Analysis.cc:129
min
T min(T a, T b)
Definition: MathUtil.h:58
CaloG4HitCollection.h
HCalSD
Definition: HCalSD.h:38
CaloG4Hit::getUnitID
uint32_t getUnitID() const
Definition: CaloG4Hit.h:66
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
SimProducer.h
HcalTB04Analysis::ecalHitCache
std::vector< CaloHit > ecalHitCache
Definition: HcalTB04Analysis.cc:128
HcalTB04Histo::fillTrnsProf
void fillTrnsProf(const std::vector< double > &es1, const std::vector< double > &eq1, const std::vector< double > &es2, const std::vector< double > &eq2)
Definition: HcalTB04Histo.cc:98
HcalTB04Analysis::histo
HcalTB04Histo * histo
Definition: HcalTB04Analysis.cc:108
HcalTB04Analysis::beamOffset
double beamOffset
Definition: HcalTB04Analysis.cc:113
HcalQie.h
globals_cff.id1
id1
Definition: globals_cff.py:33
pos
Definition: PixelAliasList.h:18
HcalTB04Analysis::ehcals
double ehcals
Definition: HcalTB04Analysis.cc:132
HcalTB04Analysis::eecalq
double eecalq
Definition: HcalTB04Analysis.cc:132
PHcalTB04Info::setIDs
void setIDs(const std::vector< int > &, const std::vector< int > &)
Definition: PHcalTB04Info.cc:69
HcalTB04Analysis::ehcalq
double ehcalq
Definition: HcalTB04Analysis.cc:132
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:278
protons_cff.time
time
Definition: protons_cff.py:35
HcalTB04Analysis::idTower
std::vector< uint32_t > idTower
Definition: HcalTB04Analysis.cc:123
PHcalTB04Info::setPrimary
void setPrimary(int primary, int id, double energy, double eta, double phi)
Definition: PHcalTB04Info.cc:95
HcalTB04Analysis::pvType
int pvType
Definition: HcalTB04Analysis.cc:135
HcalTB04Analysis::eqlay
std::vector< double > eqlay
Definition: HcalTB04Analysis.cc:131
HcalTB04Analysis::scale
double scale(int det, int layer)
Definition: HcalTB04Analysis.cc:1065
EndOfEvent.h
HcalTB04Analysis::unitID
int unitID(uint32_t id)
Definition: HcalTB04Analysis.cc:1054
DDAxes::x
PHcalTB04Info::saveHit
void saveHit(int det, int lay, int eta, int phi, double e, double t)
Definition: PHcalTB04Info.cc:185
HcalTB04Analysis::HcalTB04Analysis
HcalTB04Analysis(const edm::ParameterSet &p)
Definition: HcalTB04Analysis.cc:147
HcalTB04Histo
Definition: HcalTB04Histo.h:31
HcalBarrel
Definition: HcalAssistant.h:33
HcalTB04Analysis::esphi
std::vector< double > esphi
Definition: HcalTB04Analysis.cc:131
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
CaloG4Hit::getTimeSlice
double getTimeSlice() const
Definition: CaloG4Hit.h:67
PHcalTB04Info::setEdep
void setEdep(double simtot, double sime, double simh, double digtot, double dige, double digh)
Definition: PHcalTB04Info.cc:105
PHcalTB04Info::setTrnsProf
void setTrnsProf(const std::vector< double > &es1, const std::vector< double > &eq1, const std::vector< double > &es2, const std::vector< double > &eq2)
Definition: PHcalTB04Info.cc:149
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
HcalTB04Analysis::pvMomentum
G4ThreeVector pvMomentum
Definition: HcalTB04Analysis.cc:136
npart
double npart
Definition: HydjetWrapper.h:46
Observer.h
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HcalTB04Analysis::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: HcalTB04Analysis.cc:211
DEFINE_SIMWATCHER
#define DEFINE_SIMWATCHER(type)
Definition: SimWatcherFactory.h:13
HcalTB04Analysis::operator=
const HcalTB04Analysis & operator=(const HcalTB04Analysis &)=delete
HcalTB04Analysis::nTower
int nTower
Definition: HcalTB04Analysis.cc:121
HcalTB04Histo.h
HcalTB04Analysis
Definition: HcalTB04Analysis.cc:71
EcalNumberingScheme
Definition: EcalNumberingScheme.h:14
MakerMacros.h
HcalTB04Analysis::~HcalTB04Analysis
~HcalTB04Analysis() override
Definition: HcalTB04Analysis.cc:192
BeginOfRun.h
HcalTB04Analysis::eecals
double eecals
Definition: HcalTB04Analysis.cc:132
HcalTB04Analysis::init
void init()
Definition: HcalTB04Analysis.cc:217
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HcalTestNumbering::unpackHcalIndex
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
Definition: HcalTestNumbering.cc:18
HcalTB04Histo::fillPrimary
void fillPrimary(double energy, double eta, double phi)
Definition: HcalTB04Histo.cc:78
HcalTB04Analysis::ecalNoise
double ecalNoise
Definition: HcalTB04Analysis.cc:113
HcalTB04Analysis::enois
std::vector< double > enois
Definition: HcalTB04Analysis.cc:130
HcalTB04Analysis::secMomentum
std::vector< G4ThreeVector > secMomentum
Definition: HcalTB04Analysis.cc:138
PVValHelper::eta
Definition: PVValidationHelpers.h:70
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalTBNumberingScheme.h
ECalSD::setNumberingScheme
void setNumberingScheme(EcalNumberingScheme *)
Definition: ECalSD.cc:327
CaloG4Hit::getEnergyDeposit
double getEnergyDeposit() const
Definition: CaloG4Hit.h:78
DDAxes::z
HcalTB04Analysis::pvPosition
G4ThreeVector pvPosition
Definition: HcalTB04Analysis.cc:136
HcalTB04Analysis::myQie
HcalQie * myQie
Definition: HcalTB04Analysis.cc:107
PHcalTB04Info::setLongProf
void setLongProf(const std::vector< double > &es, const std::vector< double > &eq)
Definition: PHcalTB04Info.cc:171
HcalTB04Analysis::phiInit
double phiInit
Definition: HcalTB04Analysis.cc:127
HcalTB04Analysis::icphi
int icphi
Definition: HcalTB04Analysis.cc:114
HcalTB04Analysis::esimh
std::vector< double > esimh
Definition: HcalTB04Analysis.cc:130
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
HcalTB04Analysis::etots
double etots
Definition: HcalTB04Analysis.cc:132
HcalTB04Analysis::type
int type
Definition: HcalTB04Analysis.cc:112
EndOfEvent
Definition: EndOfEvent.h:6
CaloHitIdMore
Definition: CaloHit.h:41
ECalSD
Definition: ECalSD.h:31
PHcalTB04Info.h
HcalTB04Analysis::qieAnalysis
void qieAnalysis(CLHEP::HepRandomEngine *)
Definition: HcalTB04Analysis.cc:724
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CLHEP
Definition: CocoaGlobals.h:27
HcalTB04Analysis::hcalHitLayer
std::vector< CaloHit > hcalHitLayer
Definition: HcalTB04Analysis.cc:129
HcalTB04Analysis::eslay
std::vector< double > eslay
Definition: HcalTB04Analysis.cc:131
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
HcalTestNumbering::packHcalIndex
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
Definition: HcalTestNumbering.cc:7
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HcalTB04Analysis::secEkin
std::vector< double > secEkin
Definition: HcalTB04Analysis.cc:139
HcalTB04Analysis::names
std::vector< std::string > names
Definition: HcalTB04Analysis.cc:116
HcalTB04Analysis::finalAnalysis
void finalAnalysis()
Definition: HcalTB04Analysis.cc:834
Event.h
HcalTestNumberingScheme
Definition: HcalTestNumberingScheme.h:11
HcalTB04Analysis::secTrackID
std::vector< int > secTrackID
Definition: HcalTB04Analysis.cc:137
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SimProducer
Definition: SimProducer.h:64
PHcalTB04Info::setVtxSec
void setVtxSec(int id, int pdg, double px, double py, double pz, double ek)
Definition: PHcalTB04Info.cc:218
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
SimWatcherFactory.h
GeV
const double GeV
Definition: MathUtil.h:16
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
BeginOfEvent.h
HcalTB04Analysis::fillEvent
void fillEvent(PHcalTB04Info &)
Definition: HcalTB04Analysis.cc:945
PHcalTB04Info::setVtxPrim
void setVtxPrim(int evNum, int type, double x, double y, double z, double u, double v, double w, double px, double py, double pz)
Definition: PHcalTB04Info.cc:198
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
ModuleDef.h
createfilelist.int
int
Definition: createfilelist.py:10
HcalTB04Analysis::eqphi
std::vector< double > eqphi
Definition: HcalTB04Analysis.cc:131
HcalTB04XtalNumberingScheme.h
HcalTB04Analysis::fillBuffer
void fillBuffer(const EndOfEvent *evt)
Definition: HcalTB04Analysis.cc:476
BeginOfEvent
Definition: BeginOfEvent.h:6
BeginOfRun
Definition: BeginOfRun.h:6
HcalTB04Analysis::update
void update(const BeginOfRun *run) override
This routine will be called when the appropriate signal arrives.
Definition: HcalTB04Analysis.cc:280
HcalQie::getCode
std::vector< int > getCode(int, const std::vector< CaloHit > &, CLHEP::HepRandomEngine *)
Definition: HcalQie.cc:268
CaloHit
Definition: CaloHit.h:12
edm::EventSetup
Definition: EventSetup.h:58
HcalTB04Histo::fillEdep
void fillEdep(double etots, double eecals, double ehcals, double etotq, double eecalq, double ehcalq)
Definition: HcalTB04Histo.cc:85
HcalSubdetector.h
CaloG4Hit
Definition: CaloG4Hit.h:32
HcalTB04Analysis::nPrimary
int nPrimary
Definition: HcalTB04Analysis.cc:126
HcalTB04Analysis::shortLivedSecondaries
std::vector< int > shortLivedSecondaries
Definition: HcalTB04Analysis.cc:140
ECalSD.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalNumberingScheme
Definition: HcalNumberingScheme.h:13
HCalSD.h
HcalTBNumberingScheme::getUnitIDs
static std::vector< uint32_t > getUnitIDs(const int type, const int mode)
Definition: HcalTBNumberingScheme.cc:69
HcalTB04Analysis::etotq
double etotq
Definition: HcalTB04Analysis.cc:132
HcalTB04Analysis::count
int count
Definition: HcalTB04Analysis.cc:120
PHcalTB04Info::setEdepHcal
void setEdepHcal(const std::vector< double > &esim, const std::vector< double > &edig)
Definition: PHcalTB04Info.cc:133
HcalTB04Analysis::secPartID
std::vector< int > secPartID
Definition: HcalTB04Analysis.cc:137
DDAxes::phi
HCalSD::setNumberingScheme
void setNumberingScheme(HcalNumberingScheme *)
Definition: HCalSD.cc:545
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
HcalTB04Analysis::eqie
std::vector< double > eqie
Definition: HcalTB04Analysis.cc:130
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
HcalTB04Analysis::scaleHB0
double scaleHB0
Definition: HcalTB04Analysis.cc:115
HcalTB04Analysis::idHcal
std::vector< int > idHcal
Definition: HcalTB04Analysis.cc:122
HcalTB04Analysis::evNum
int evNum
Definition: HcalTB04Analysis.cc:135
HcalTB04Analysis::eqeta
std::vector< double > eqeta
Definition: HcalTB04Analysis.cc:131
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Point3D.h
EventSetup.h
HcalTB04Analysis::hcalOnly
bool hcalOnly
Definition: HcalTB04Analysis.cc:111
HcalTB04Analysis::idEcal
std::vector< uint32_t > idEcal
Definition: HcalTB04Analysis.cc:123
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CaloG4HitCollection
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
Definition: CaloG4HitCollection.h:11
HcalTB04Analysis::clear
void clear()
Definition: HcalTB04Analysis.cc:1018
HcalTB04Analysis::mode
int mode
Definition: HcalTB04Analysis.cc:112
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
HcalTB04Analysis::scaleHB16
double scaleHB16
Definition: HcalTB04Analysis.cc:115
HcalQie::getEnergy
double getEnergy(const std::vector< int > &)
Definition: HcalQie.cc:354
sd
double sd
Definition: CascadeWrapper.h:113
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40
HcalTB04Analysis::nCrystal
int nCrystal
Definition: HcalTB04Analysis.cc:121
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
HcalTB04Analysis::scaleHE0
double scaleHE0
Definition: HcalTB04Analysis.cc:115
PHcalTB04Info
Definition: PHcalTB04Info.h:33
HcalTB04Analysis::pvFound
bool pvFound
Definition: HcalTB04Analysis.cc:134
HcalTBNumberingScheme::getUnitID
static uint32_t getUnitID(const uint32_t id, const int mode)
Definition: HcalTBNumberingScheme.cc:26
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
HcalQie
Definition: HcalQie.h:18
edm::Event
Definition: Event.h:73
HcalTestNumberingScheme.h
edm::Log
Definition: MessageLogger.h:70
CaloG4Hit.h
HcalTB04Analysis::eseta
std::vector< double > eseta
Definition: HcalTB04Analysis.cc:131
HcalTB04Analysis::pInit
double pInit
Definition: HcalTB04Analysis.cc:127
CaloHit.h
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
HcalTB04Histo::fillLongProf
void fillLongProf(const std::vector< double > &es, const std::vector< double > &eq)
Definition: HcalTB04Histo.cc:126
HcalTB04XtalNumberingScheme
Definition: HcalTB04XtalNumberingScheme.h:24
hit
Definition: SiStripHitEffFromCalibTree.cc:88
CaloG4Hit::getEntry
math::XYZPoint getEntry() const
Definition: CaloG4Hit.h:46
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
watchdog.group
group
Definition: watchdog.py:82
HcalTB04Analysis::scaleHO
double scaleHO
Definition: HcalTB04Analysis.cc:115
HcalTB04Analysis::etaInit
double etaInit
Definition: HcalTB04Analysis.cc:127