CMS 3D CMS Logo

CaloSD.cc
Go to the documentation of this file.
1 // File: CaloSD.cc
3 // Description: Sensitive Detector class for calorimeters
5 
14 
15 #include "G4EventManager.hh"
16 #include "G4LogicalVolumeStore.hh"
17 #include "G4LogicalVolume.hh"
18 #include "G4SDManager.hh"
19 #include "G4Step.hh"
20 #include "G4Track.hh"
21 #include "G4VProcess.hh"
22 #include "G4GFlashSpot.hh"
23 #include "G4ParticleTable.hh"
24 
25 #include "G4SystemOfUnits.hh"
26 #include "G4PhysicalConstants.hh"
27 
28 #include <fstream>
29 #include <memory>
30 
31 //#define EDM_ML_DEBUG
32 
34  const edm::EventSetup& es,
35  const SensitiveDetectorCatalog& clg,
36  edm::ParameterSet const& p,
37  const SimTrackManager* manager,
38  float timeSliceUnit,
39  bool ignoreTkID)
40  : SensitiveCaloDetector(name, es, clg, p),
41  G4VGFlashSensitiveDetector(),
42  eminHit(0.),
43  currentHit(nullptr),
44  m_trackManager(manager),
45  theHC(nullptr),
46  ignoreTrackID(ignoreTkID),
47  hcID(-1),
48  timeSlice(timeSliceUnit),
49  eminHitD(0.) {
50  //Parameters
51  edm::ParameterSet m_CaloSD = p.getParameter<edm::ParameterSet>("CaloSD");
52  energyCut = m_CaloSD.getParameter<double>("EminTrack") * CLHEP::GeV;
53  tmaxHit = m_CaloSD.getParameter<double>("TmaxHit") * CLHEP::ns;
54  std::vector<double> eminHits = m_CaloSD.getParameter<std::vector<double>>("EminHits");
55  std::vector<double> tmaxHits = m_CaloSD.getParameter<std::vector<double>>("TmaxHits");
56  std::vector<std::string> hcn = m_CaloSD.getParameter<std::vector<std::string>>("HCNames");
57  std::vector<int> useResMap = m_CaloSD.getParameter<std::vector<int>>("UseResponseTables");
58  std::vector<double> eminHitX = m_CaloSD.getParameter<std::vector<double>>("EminHitsDepth");
59  suppressHeavy = m_CaloSD.getParameter<bool>("SuppressHeavy");
60  kmaxIon = m_CaloSD.getParameter<double>("IonThreshold") * CLHEP::MeV;
61  kmaxProton = m_CaloSD.getParameter<double>("ProtonThreshold") * CLHEP::MeV;
62  kmaxNeutron = m_CaloSD.getParameter<double>("NeutronThreshold") * CLHEP::MeV;
63  nCheckedHits = m_CaloSD.getUntrackedParameter<int>("CheckHits", 25);
64  useMap = m_CaloSD.getUntrackedParameter<bool>("UseMap", true);
65  int verbn = m_CaloSD.getUntrackedParameter<int>("Verbosity", 0);
66  corrTOFBeam = m_CaloSD.getParameter<bool>("CorrectTOFBeam");
67  double beamZ = m_CaloSD.getParameter<double>("BeamPosition") * CLHEP::cm;
68  correctT = beamZ / CLHEP::c_light / CLHEP::nanosecond;
69  useFineCaloID_ = m_CaloSD.getParameter<bool>("UseFineCaloID");
70 
71  SetVerboseLevel(verbn);
72  meanResponse.reset(nullptr);
73  for (unsigned int k = 0; k < hcn.size(); ++k) {
74  if (name == hcn[k]) {
75  if (k < eminHits.size())
76  eminHit = eminHits[k] * CLHEP::MeV;
77  if (k < eminHitX.size())
78  eminHitD = eminHitX[k] * CLHEP::MeV;
79  if (k < tmaxHits.size())
80  tmaxHit = tmaxHits[k] * CLHEP::ns;
81  if (k < useResMap.size() && useResMap[k] > 0) {
82  meanResponse = std::make_unique<CaloMeanResponse>(p);
83  break;
84  }
85  }
86  }
87  slave = std::make_unique<CaloSlaveSD>(name);
88 
91  isParameterized = false;
92 
93  entrancePoint.set(0., 0., 0.);
94  entranceLocal.set(0., 0., 0.);
95  posGlobal.set(0., 0., 0.);
97 
99  forceSave = false;
100 
101  edm::LogVerbatim("CaloSim") << "CaloSD: Minimum energy of track for saving it " << energyCut / CLHEP::GeV
102  << " GeV\n Use of HitID Map " << useMap << "\n Check last " << nCheckedHits
103  << " before saving the hit\n Correct TOF globally by " << correctT
104  << " ns (Flag =" << corrTOFBeam << ")\n Save hits recorded before " << tmaxHit
105  << " ns and if energy is above " << eminHit / CLHEP::MeV << " MeV (for depth 0) or "
106  << eminHitD / CLHEP::MeV << " MeV (for nonzero depths);\n Time Slice Unit "
107  << timeSlice << "\nIgnore TrackID Flag " << ignoreTrackID << " UseFineCaloID flag "
108  << useFineCaloID_;
109 
110  // Get pointer to CaloSimulationParameters
112  es.get<HcalParametersRcd>().get(csps);
113  if (csps.isValid()) {
114  const CaloSimulationParameters* csp = csps.product();
115  edm::LogVerbatim("CaloSim") << "CaloSD: " << csp->fCaloNames_.size() << " entries for fineCalorimeters:";
116  for (unsigned int i = 0; i < csp->fCaloNames_.size(); i++)
117  edm::LogVerbatim("CaloSim") << " [" << i << "] " << csp->fCaloNames_[i] << ":" << csp->fLevels_[i];
118 
119  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
120  std::vector<G4LogicalVolume*>::const_iterator lvcite;
121  for (unsigned int i = 0; i < csp->fCaloNames_.size(); i++) {
122  G4LogicalVolume* lv = nullptr;
123  G4String name = static_cast<G4String>(csp->fCaloNames_[i]);
124  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
125  if ((*lvcite)->GetName() == name) {
126  lv = (*lvcite);
127  break;
128  }
129  }
130  if (lv != nullptr) {
132  detector.name = name;
133  detector.lv = lv;
134  detector.level = csp->fLevels_[i];
135  fineDetectors_.emplace_back(detector);
136  }
137  }
138 #ifdef EDM_ML_DEBUG
139  edm::LogVerbatim("CaloSim") << "CaloSD::Loads information for " << fineDetectors_.size() << " fine detectors";
140  unsigned int k(0);
141  for (const auto& detector : fineDetectors_) {
142  edm::LogVerbatim("CaloSim") << "Detector[" << k << "] " << detector.name << " at level " << detector.level
143  << " pointer to LV: " << detector.lv;
144  }
145 #endif
146  } else {
147  edm::LogError("CaloSim") << "CaloSD: Cannot find CaloSimulationParameters";
148  throw cms::Exception("Unknown", "CaloSD") << "Cannot find CaloSimulationParameters\n";
149  }
150 }
151 
153 
154 G4bool CaloSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
155  NaNTrap(aStep);
156  ignoreReject = false;
157 
158 #ifdef EDM_ML_DEBUG
159  edm::LogVerbatim("CaloSim") << "CaloSD::" << GetName() << " ID= " << aStep->GetTrack()->GetTrackID()
160  << " prID= " << aStep->GetTrack()->GetParentID()
161  << " Eprestep= " << aStep->GetPreStepPoint()->GetKineticEnergy()
162  << " step= " << aStep->GetStepLength() << " Edep= " << aStep->GetTotalEnergyDeposit();
163 #endif
164  // apply shower library or parameterisation
165  if (isParameterized) {
166  if (getFromLibrary(aStep)) {
167  // for parameterized showers the primary track should be killed
168  aStep->GetTrack()->SetTrackStatus(fStopAndKill);
169  auto tv = aStep->GetSecondary();
170  auto vol = aStep->GetPreStepPoint()->GetPhysicalVolume();
171  for (auto& tk : *tv) {
172  if (tk->GetVolume() == vol) {
173  tk->SetTrackStatus(fStopAndKill);
174  }
175  }
176  return true;
177  }
178  }
179 
180  // ignore steps without energy deposit
181  edepositEM = edepositHAD = 0.f;
182  unsigned int unitID = setDetUnitId(aStep);
183  auto const theTrack = aStep->GetTrack();
184  uint16_t depth = getDepth(aStep);
185 
186  double time = theTrack->GetGlobalTime() / nanosecond;
187  int primaryID = getTrackID(theTrack);
188  if (unitID > 0) {
189  currentID.setID(unitID, time, primaryID, depth);
190  } else {
191  if (aStep->GetTotalEnergyDeposit() > 0.0 && (!ignoreReject)) {
192  const G4TouchableHistory* touch = static_cast<const G4TouchableHistory*>(theTrack->GetTouchable());
193  edm::LogVerbatim("CaloSim") << "CaloSD::ProcessHits: unitID= " << unitID << " currUnit= " << currentID.unitID()
194  << " Detector: " << GetName() << " trackID= " << theTrack->GetTrackID() << " "
195  << theTrack->GetDefinition()->GetParticleName()
196  << "\n Edep= " << aStep->GetTotalEnergyDeposit()
197  << " PV: " << touch->GetVolume(0)->GetName()
198  << " PVid= " << touch->GetReplicaNumber(0) << " MVid= " << touch->GetReplicaNumber(1);
199  }
200  return false;
201  }
202 
203  if (aStep->GetTotalEnergyDeposit() == 0.0) {
204  return false;
205  }
206 
207  double energy = getEnergyDeposit(aStep);
208  if (energy > 0.0) {
210  edepositEM = energy;
211  } else {
213  }
214 #ifdef EDM_ML_DEBUG
215  G4TouchableHistory* touch = (G4TouchableHistory*)(theTrack->GetTouchable());
216  edm::LogVerbatim("CaloSim") << "CaloSD::" << GetName() << " PV:" << touch->GetVolume(0)->GetName()
217  << " PVid=" << touch->GetReplicaNumber(0) << " MVid=" << touch->GetReplicaNumber(1)
218  << " Unit:" << std::hex << unitID << std::dec << " Edep=" << edepositEM << " "
219  << edepositHAD << " ID=" << theTrack->GetTrackID() << " pID=" << theTrack->GetParentID()
220  << " E=" << theTrack->GetKineticEnergy() << " S=" << aStep->GetStepLength() << "\n "
221  << theTrack->GetDefinition()->GetParticleName() << " primaryID= " << primaryID
222  << " currentID= (" << currentID << ") previousID= (" << previousID << ")";
223 #endif
224  if (!hitExists(aStep)) {
225  currentHit = createNewHit(aStep, aStep->GetTrack());
226  }
227  return true;
228  }
229  return false;
230 }
231 
232 bool CaloSD::ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory*) {
233  edepositEM = edepositHAD = 0.f;
234  const G4Track* track = aSpot->GetOriginatorTrack()->GetPrimaryTrack();
235 
236  double edep = aSpot->GetEnergySpot()->GetEnergy();
237  if (edep <= 0.0) {
238  return false;
239  }
240 
241  G4Step fFakeStep;
242  G4StepPoint* fFakePreStepPoint = fFakeStep.GetPreStepPoint();
243  G4StepPoint* fFakePostStepPoint = fFakeStep.GetPostStepPoint();
244  fFakePreStepPoint->SetPosition(aSpot->GetPosition());
245  fFakePostStepPoint->SetPosition(aSpot->GetPosition());
246 
247  G4TouchableHandle fTouchableHandle = aSpot->GetTouchableHandle();
248  fFakePreStepPoint->SetTouchableHandle(fTouchableHandle);
249  fFakeStep.SetTotalEnergyDeposit(edep);
250  edep = EnergyCorrected(fFakeStep, track);
251  if (edep <= 0.0) {
252  return false;
253  }
254 
256  edepositEM = edep;
257  } else {
258  edepositHAD = edep;
259  }
260 
261  unsigned int unitID = setDetUnitId(&fFakeStep);
262 
263  if (unitID > 0) {
264  double time = 0;
265  int primaryID = getTrackID(track);
266  uint16_t depth = getDepth(&fFakeStep);
267  currentID.setID(unitID, time, primaryID, depth);
268 #ifdef EDM_ML_DEBUG
269  edm::LogVerbatim("CaloSim") << "CaloSD:: GetSpotInfo for Unit 0x" << std::hex << currentID.unitID() << std::dec
270  << " Edeposit = " << edepositEM << " " << edepositHAD;
271 #endif
272  // Update if in the same detector, time-slice and for same track
273  if (currentID == previousID) {
275  } else {
276  posGlobal = aSpot->GetEnergySpot()->GetPosition();
277  // Reset entry point for new primary
278  if (currentID.trackID() != previousID.trackID()) {
279  entrancePoint = aSpot->GetPosition();
280  entranceLocal = aSpot->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(entrancePoint);
281  incidentEnergy = track->GetKineticEnergy();
282 #ifdef EDM_ML_DEBUG
283  edm::LogVerbatim("CaloSim") << "CaloSD: Incident energy " << incidentEnergy / CLHEP::GeV << " GeV and"
284  << " entrance point " << entrancePoint << " (Global) " << entranceLocal
285  << " (Local)";
286 #endif
287  }
288  if (!checkHit()) {
289  currentHit = createNewHit(&fFakeStep, track);
290  }
291  }
292  return true;
293  }
294  return false;
295 }
296 
297 double CaloSD::getEnergyDeposit(const G4Step* aStep) { return aStep->GetTotalEnergyDeposit(); }
298 
299 double CaloSD::EnergyCorrected(const G4Step& aStep, const G4Track*) { return aStep.GetTotalEnergyDeposit(); }
300 
301 bool CaloSD::getFromLibrary(const G4Step*) { return false; }
302 
303 bool CaloSD::isItFineCalo(const G4VTouchable* touch) {
304  bool ok(false);
305  int level = ((touch->GetHistoryDepth()) + 1);
306  for (const auto& detector : fineDetectors_) {
307  if (level > 0 && level >= detector.level) {
308  int ii = level - detector.level;
309  G4LogicalVolume* lv = touch->GetVolume(ii)->GetLogicalVolume();
310  ok = (lv == detector.lv);
311 #ifdef EDM_ML_DEBUG
312  std::string name1 = (lv == 0) ? "Unknown" : lv->GetName();
313  edm::LogVerbatim("CaloSim") << "CaloSD: volume " << name1 << ":" << detector.name << " at Level "
314  << detector.level << " Flag " << ok;
315 #endif
316  if (ok)
317  break;
318  }
319  }
320  return ok;
321 }
322 
323 void CaloSD::Initialize(G4HCofThisEvent* HCE) {
324  totalHits = 0;
325 
326 #ifdef EDM_ML_DEBUG
327  edm::LogVerbatim("CaloSim") << "CaloSD : Initialize called for " << GetName();
328 #endif
329 
330  //This initialization is performed at the beginning of an event
331  //------------------------------------------------------------
332  theHC = new CaloG4HitCollection(GetName(), collectionName[0]);
333 
334  if (hcID < 0) {
335  hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
336  }
337  //theHC ownership is transfered here to HCE
338  HCE->AddHitsCollection(hcID, theHC);
339 }
340 
341 void CaloSD::EndOfEvent(G4HCofThisEvent*) {
342  // clean the hits for the last tracks
343 
345 
346 #ifdef EDM_ML_DEBUG
347  edm::LogVerbatim("CaloSim") << "CaloSD: EndofEvent entered with " << theHC->entries() << " entries";
348 #endif
349 }
350 
351 void CaloSD::clear() {}
352 
354 
356 #ifdef EDM_ML_DEBUG
357  edm::LogVerbatim("CaloSim") << "CaloSD: Collection " << theHC->GetName();
358 #endif
359  theHC->PrintAllHits();
360 }
361 
363 #ifdef EDM_ML_DEBUG
364  edm::LogVerbatim("CaloSim") << "CaloSD: Tries to transfer " << slave.get()->hits().size() << " hits for "
365  << slave.get()->name() << " " << hname;
366 #endif
367  if (slave.get()->name() == hname) {
368  cc = slave.get()->hits();
369  }
370  slave.get()->Clean();
371 }
372 
373 G4ThreeVector CaloSD::setToLocal(const G4ThreeVector& global, const G4VTouchable* touch) const {
374  return touch->GetHistory()->GetTopTransform().TransformPoint(global);
375 }
376 
377 G4ThreeVector CaloSD::setToGlobal(const G4ThreeVector& local, const G4VTouchable* touch) const {
378  return touch->GetHistory()->GetTopTransform().Inverse().TransformPoint(local);
379 }
380 
381 bool CaloSD::hitExists(const G4Step* aStep) {
382  // Update if in the same detector, time-slice and for same track
383  if (currentID == previousID) {
385  return true;
386  }
387 
388  // Reset entry point for new primary
389  posGlobal = aStep->GetPreStepPoint()->GetPosition();
390  if (currentID.trackID() != previousID.trackID()) {
391  resetForNewPrimary(aStep);
392  }
393  return checkHit();
394 }
395 
397  //look in the HitContainer whether a hit with the same ID already exists:
398  bool found = false;
399  if (useMap) {
400  std::map<CaloHitID, CaloG4Hit*>::const_iterator it = hitMap.find(currentID);
401  if (it != hitMap.end()) {
402  currentHit = it->second;
403  found = true;
404  }
405  } else if (nCheckedHits > 0) {
406  int nhits = theHC->entries();
407  int minhit = std::max(nhits - nCheckedHits, 0);
408  int maxhit = nhits - 1;
409 
410  for (int j = maxhit; j > minhit; --j) {
411  if ((*theHC)[j]->getID() == currentID) {
412  currentHit = (*theHC)[j];
413  found = true;
414  break;
415  }
416  }
417  }
418 
419  if (found) {
421  }
422  return found;
423 }
424 
425 int CaloSD::getNumberOfHits() { return theHC->entries(); }
426 
427 CaloG4Hit* CaloSD::createNewHit(const G4Step* aStep, const G4Track* theTrack) {
428 #ifdef EDM_ML_DEBUG
429  edm::LogVerbatim("CaloSim") << "CaloSD::CreateNewHit " << getNumberOfHits() << " for " << GetName()
430  << " Unit:" << currentID.unitID() << " " << currentID.depth() << " Edep= " << edepositEM
431  << " " << edepositHAD << " primaryID= " << currentID.trackID()
432  << " timeSlice= " << currentID.timeSliceID() << " ID= " << theTrack->GetTrackID() << " "
433  << theTrack->GetDefinition()->GetParticleName()
434  << " E(GeV)= " << theTrack->GetKineticEnergy() / CLHEP::GeV
435  << " parentID= " << theTrack->GetParentID() << "\n Ein= " << incidentEnergy
436  << " entranceGlobal: " << entrancePoint << " entranceLocal: " << entranceLocal
437  << " posGlobal: " << posGlobal;
438 #endif
439 
440  CaloG4Hit* aHit;
441  if (!reusehit.empty()) {
442  aHit = reusehit.back().release();
443  aHit->setEM(0.f);
444  aHit->setHadr(0.f);
445  reusehit.pop_back();
446  } else {
447  aHit = new CaloG4Hit;
448  }
449 
450  aHit->setID(currentID);
451  aHit->setEntry(entrancePoint.x(), entrancePoint.y(), entrancePoint.z());
453  aHit->setPosition(posGlobal.x(), posGlobal.y(), posGlobal.z());
455  updateHit(aHit);
456 
457  storeHit(aHit);
458  double etrack = 0;
459  if (currentID.trackID() == primIDSaved) { // The track is saved; nothing to be done
460  } else if (currentID.trackID() == theTrack->GetTrackID()) {
461  etrack = theTrack->GetKineticEnergy();
462 #ifdef EDM_ML_DEBUG
463  edm::LogVerbatim("CaloSim") << "CaloSD: set save the track " << currentID.trackID() << " etrack " << etrack
464  << " eCut " << energyCut << " force: " << forceSave
465  << " save: " << (etrack >= energyCut || forceSave);
466 #endif
467  if (etrack >= energyCut || forceSave) {
468  TrackInformation* trkInfo = cmsTrackInformation(theTrack);
469  trkInfo->storeTrack(true);
470  trkInfo->putInHistory();
471  }
472  } else {
474 #ifdef EDM_ML_DEBUG
475  edm::LogVerbatim("CaloSim") << "CaloSD : TrackwithHistory pointer for " << currentID.trackID() << " is " << trkh;
476 #endif
477  if (trkh != nullptr) {
478  etrack = sqrt(trkh->momentum().Mag2());
479  if (etrack >= energyCut) {
480  trkh->save();
481 #ifdef EDM_ML_DEBUG
482  edm::LogVerbatim("CaloSim") << "CaloSD: set save the track " << currentID.trackID() << " with Hit";
483 #endif
484  }
485  }
486  }
488  if (useMap)
489  ++totalHits;
490  return aHit;
491 }
492 
495 #ifdef EDM_ML_DEBUG
496  edm::LogVerbatim("CaloSim") << "CaloSD:" << GetName() << " Add energy deposit in " << currentID
497  << " Edep_em(MeV)= " << edepositEM << " Edep_had(MeV)= " << edepositHAD;
498 #endif
499 
500  // buffer for next steps:
502 }
503 
504 void CaloSD::resetForNewPrimary(const G4Step* aStep) {
505  auto const preStepPoint = aStep->GetPreStepPoint();
506  entrancePoint = preStepPoint->GetPosition();
507  entranceLocal = setToLocal(entrancePoint, preStepPoint->GetTouchable());
508  incidentEnergy = preStepPoint->GetKineticEnergy();
509 #ifdef EDM_ML_DEBUG
510  edm::LogVerbatim("CaloSim") << "CaloSD::resetForNewPrimary for " << GetName()
511  << " ID= " << aStep->GetTrack()->GetTrackID() << " Ein= " << incidentEnergy / CLHEP::GeV
512  << " GeV and"
513  << " entrance point global: " << entrancePoint << " local: " << entranceLocal;
514 #endif
515 }
516 
517 double CaloSD::getAttenuation(const G4Step* aStep, double birk1, double birk2, double birk3) const {
518  double weight = 1.;
519  double charge = aStep->GetPreStepPoint()->GetCharge();
520  double length = aStep->GetStepLength();
521 
522  if (charge != 0. && length > 0.) {
523  double density = aStep->GetPreStepPoint()->GetMaterial()->GetDensity();
524  double dedx = aStep->GetTotalEnergyDeposit() / length;
525  double rkb = birk1 / density;
526  double c = birk2 * rkb * rkb;
527  if (std::abs(charge) >= 2.)
528  rkb /= birk3; // based on alpha particle data
529  weight = 1. / (1. + rkb * dedx + c * dedx * dedx);
530 #ifdef EDM_ML_DEBUG
531  edm::LogVerbatim("CaloSim") << "CaloSD::getAttenuation in " << aStep->GetPreStepPoint()->GetMaterial()->GetName()
532  << " Charge " << charge << " dE/dx " << dedx << " Birk Const " << rkb << ", " << c
533  << " Weight = " << weight << " dE " << aStep->GetTotalEnergyDeposit();
534 #endif
535  }
536  return weight;
537 }
538 
539 void CaloSD::update(const BeginOfRun*) { initRun(); }
540 
541 void CaloSD::update(const BeginOfEvent* g4Event) {
542 #ifdef EDM_ML_DEBUG
543  edm::LogVerbatim("CaloSim") << "CaloSD: Dispatched BeginOfEvent for " << GetName() << " !";
544 #endif
545  clearHits();
546  initEvent(g4Event);
547 }
548 
549 void CaloSD::update(const EndOfTrack* trk) {
550  int id = (*trk)()->GetTrackID();
551  TrackInformation* trkI = cmsTrackInformation((*trk)());
552  int lastTrackID = -1;
553  if (trkI)
554  lastTrackID = trkI->getIDonCaloSurface();
555  if (id == lastTrackID) {
556  const TrackContainer* trksForThisEvent = m_trackManager->trackContainer();
557  if (trksForThisEvent != nullptr) {
558  int it = (int)(trksForThisEvent->size()) - 1;
559  if (it >= 0) {
560  TrackWithHistory* trkH = (*trksForThisEvent)[it];
561  if (trkH->trackID() == (unsigned int)(id))
562  tkMap[id] = trkH;
563 #ifdef EDM_ML_DEBUG
564  edm::LogVerbatim("CaloSim") << "CaloSD: get track " << it << " from Container of size "
565  << trksForThisEvent->size() << " with ID " << trkH->trackID();
566  } else {
567  edm::LogVerbatim("CaloSim") << "CaloSD: get track " << it << " from Container of size "
568  << trksForThisEvent->size() << " with no ID";
569 #endif
570  }
571  }
572  }
573 }
574 
575 void CaloSD::update(const ::EndOfEvent*) {
576  endEvent();
577  slave.get()->ReserveMemory(theHC->entries());
578 
579  int count(0);
580  int wrong(0);
581  double eEM(0.0);
582  double eHAD(0.0);
583  double eEM2(0.0);
584  double eHAD2(0.0);
585  double tt(0.0);
586  double zloc(0.0);
587  double zglob(0.0);
588  double ee(0.0);
589  int hc_entries = theHC->entries();
590  for (int i = 0; i < hc_entries; ++i) {
591  if (!saveHit((*theHC)[i])) {
592  ++wrong;
593  }
594  ++count;
595  double x = (*theHC)[i]->getEM();
596  eEM += x;
597  eEM2 += x * x;
598  x = (*theHC)[i]->getHadr();
599  eHAD += x;
600  eHAD2 += x * x;
601  tt += (*theHC)[i]->getTimeSlice();
602  ee += (*theHC)[i]->getIncidentEnergy();
603  zglob += std::abs((*theHC)[i]->getEntry().z());
604  zloc += std::abs((*theHC)[i]->getEntryLocal().z());
605  }
606 
607  double norm = (count > 0) ? 1.0 / count : 0.0;
608  eEM *= norm;
609  eEM2 *= norm;
610  eHAD *= norm;
611  eHAD2 *= norm;
612  eEM2 = std::sqrt(eEM2 - eEM * eEM);
613  eHAD2 = std::sqrt(eHAD2 - eHAD * eHAD);
614  tt *= norm;
615  ee *= norm;
616  zglob *= norm;
617  zloc *= norm;
618 
619 #ifdef EDM_ML_DEBUG
620  edm::LogVerbatim("CaloSim") << "CaloSD: " << GetName() << " store " << count << " hits; " << wrong
621  << " track IDs not given properly and " << totalHits - count
622  << " hits not passing cuts\n EmeanEM= " << eEM << " ErmsEM= " << eEM2
623  << "\n EmeanHAD= " << eHAD << " ErmsHAD= " << eHAD2 << " TimeMean= " << tt
624  << " E0mean= " << ee << " Zglob= " << zglob << " Zloc= " << zloc << " ";
625 #endif
626  tkMap.erase(tkMap.begin(), tkMap.end());
627  std::vector<std::unique_ptr<CaloG4Hit>>().swap(reusehit);
628  if (useMap)
629  hitMap.erase(hitMap.begin(), hitMap.end());
630 }
631 
633  cleanIndex = 0;
634  previousID.reset();
635  primIDSaved = -99;
636 #ifdef EDM_ML_DEBUG
637  edm::LogVerbatim("CaloSim") << "CaloSD: Clears hit vector for " << GetName()
638  << " and initialise slave: " << slave.get()->name();
639 #endif
640  slave.get()->Initialize();
641 }
642 
644  if (fpCaloG4HitAllocator) {
645  fpCaloG4HitAllocator->ResetStorage();
646  }
647 }
648 
650 
652 
654 
655 int CaloSD::getTrackID(const G4Track* aTrack) {
656  int primaryID = 0;
657  forceSave = false;
658  TrackInformation* trkInfo = cmsTrackInformation(aTrack);
659  if (trkInfo) {
660  primaryID = (useFineCaloID_) ? trkInfo->getIDfineCalo() : trkInfo->getIDonCaloSurface();
661 #ifdef EDM_ML_DEBUG
662  edm::LogVerbatim("CaloSim") << "Track ID: " << trkInfo->getIDfineCalo() << ":" << trkInfo->getIDonCaloSurface()
663  << ":" << aTrack->GetTrackID() << ":" << primaryID;
664 #endif
665  } else {
666  primaryID = aTrack->GetTrackID();
667 #ifdef EDM_ML_DEBUG
668  edm::LogWarning("CaloSim") << "CaloSD: Problem with primaryID **** set by force to TkID **** " << primaryID;
669 #endif
670  }
671  return primaryID;
672 }
673 
674 int CaloSD::setTrackID(const G4Step* aStep) {
675  auto const theTrack = aStep->GetTrack();
676  TrackInformation* trkInfo = cmsTrackInformation(theTrack);
677  int primaryID = (useFineCaloID_) ? trkInfo->getIDfineCalo() : trkInfo->getIDonCaloSurface();
678  if (primaryID <= 0) {
679  primaryID = theTrack->GetTrackID();
680  }
681 #ifdef EDM_ML_DEBUG
682  edm::LogVerbatim("CaloSim") << "Track ID: " << trkInfo->getIDfineCalo() << ":" << trkInfo->getIDonCaloSurface() << ":"
683  << theTrack->GetTrackID() << ":" << primaryID;
684 #endif
685 
686  if (primaryID != previousID.trackID()) {
687  resetForNewPrimary(aStep);
688  }
689 #ifdef EDM_ML_DEBUG
690  edm::LogVerbatim("CaloSim") << "CaloSD::setTrackID for " << GetName()
691  << " trackID= " << aStep->GetTrack()->GetTrackID() << " primaryID= " << primaryID;
692 #endif
693  return primaryID;
694 }
695 
696 uint16_t CaloSD::getDepth(const G4Step*) { return 0; }
697 
699  double emin(eminHit);
700  if (hit->getDepth() > 0)
701  emin = eminHitD;
702 #ifdef EDM_ML_DEBUG
703  edm::LogVerbatim("CaloSim") << "CaloSD::filterHit(..) Depth " << hit->getDepth() << " Emin = " << emin << " ("
704  << eminHit << ", " << eminHitD << ")";
705 #endif
706  return ((time <= tmaxHit) && (hit->getEnergyDeposit() > emin));
707 }
708 
709 double CaloSD::getResponseWt(const G4Track* aTrack) {
710  double wt = 1.0;
711  if (meanResponse.get()) {
712  TrackInformation* trkInfo = cmsTrackInformation(aTrack);
713  wt = meanResponse.get()->getWeight(trkInfo->genParticlePID(), trkInfo->genParticleP());
714  }
715  return wt;
716 }
717 
719  if (hit == nullptr || previousID.trackID() < 0) {
720  edm::LogWarning("CaloSim") << "CaloSD: hit to be stored is nullptr !!"
721  << " previousID.trackID()= " << previousID.trackID();
722  return;
723  }
724 
725  theHC->insert(hit);
726  if (useMap)
727  hitMap.insert(std::pair<CaloHitID, CaloG4Hit*>(previousID, hit));
728 }
729 
731  int tkID;
732  bool ok = true;
733  if (m_trackManager) {
734  tkID = m_trackManager->giveMotherNeeded(aHit->getTrackID());
735  if (tkID == 0) {
736  if (m_trackManager->trackExists(aHit->getTrackID()))
737  tkID = (aHit->getTrackID());
738  else {
739  ok = false;
740  }
741  }
742  } else {
743  tkID = aHit->getTrackID();
744  ok = false;
745  }
746 #ifdef EDM_ML_DEBUG
747  if (!ok)
748  edm::LogWarning("CaloSim") << "CaloSD:Cannot find track ID for " << aHit->getTrackID();
749  edm::LogVerbatim("CaloSim") << "CalosD: Track ID " << aHit->getTrackID() << " changed to " << tkID
750  << " by SimTrackManager Status " << ok;
751 #endif
752  double time = aHit->getTimeSlice();
753  if (corrTOFBeam)
754  time += correctT;
755  slave.get()->processHits(
756  aHit->getUnitID(), aHit->getEM() / CLHEP::GeV, aHit->getHadr() / CLHEP::GeV, time, tkID, aHit->getDepth());
757 #ifdef EDM_ML_DEBUG
758  edm::LogVerbatim("CaloSim") << "CaloSD: Store Hit at " << std::hex << aHit->getUnitID() << std::dec << " "
759  << aHit->getDepth() << " due to " << tkID << " in time " << time << " of energy "
760  << aHit->getEM() / CLHEP::GeV << " GeV (EM) and " << aHit->getHadr() / CLHEP::GeV
761  << " GeV (Hadr)";
762 #endif
763  return ok;
764 }
765 
766 void CaloSD::update(const BeginOfTrack* trk) {
767  int primary = -1;
768  TrackInformation* trkInfo = cmsTrackInformation((*trk)());
769  if (trkInfo->isPrimary())
770  primary = (*trk)()->GetTrackID();
771 
772 #ifdef EDM_ML_DEBUG
773  edm::LogVerbatim("CaloSim") << "New track: isPrimary " << trkInfo->isPrimary() << " primary ID = " << primary
774  << " primary ancestor ID " << primAncestor;
775 #endif
776 
777  // update the information if a different primary track ID
778 
779  if (primary > 0 && primary != primAncestor) {
780  primAncestor = primary;
781 
782  // clean the hits information
783 
784  if (theHC->entries() > 0)
786  }
787 }
788 
790  std::vector<CaloG4Hit*>* theCollection = theHC->GetVector();
791 
792 #ifdef EDM_ML_DEBUG
793  edm::LogVerbatim("CaloSim") << "CaloSD: collection before merging, size = " << theHC->entries();
794 #endif
795  if (reusehit.empty())
796  reusehit.reserve(theHC->entries() - cleanIndex);
797 
798  // if no map used, merge before hits to have the save situation as a map
799  if (!useMap) {
800  std::vector<CaloG4Hit*> hitvec;
801 
802  hitvec.swap(*theCollection);
803  sort((hitvec.begin() + cleanIndex), hitvec.end(), CaloG4HitLess());
804 #ifdef EDM_ML_DEBUG
805  edm::LogVerbatim("CaloSim") << "CaloSD::cleanHitCollection: sort hits in buffer starting from "
806  << "element = " << cleanIndex;
807  for (unsigned int i = 0; i < hitvec.size(); ++i)
808  edm::LogVerbatim("CaloSim") << i << " " << *hitvec[i];
809 #endif
811  for (unsigned int i = cleanIndex; i < hitvec.size(); ++i) {
812  int jump = 0;
813  for (unsigned int j = i + 1; j < hitvec.size() && equal(hitvec[i], hitvec[j]); ++j) {
814  ++jump;
815  // merge j to i
816  (*hitvec[i]).addEnergyDeposit(*hitvec[j]);
817  (*hitvec[j]).setEM(0.);
818  (*hitvec[j]).setHadr(0.);
819  reusehit.emplace_back(hitvec[j]);
820  hitvec[j] = nullptr;
821  }
822  i += jump;
823  }
824 #ifdef EDM_ML_DEBUG
825  edm::LogVerbatim("CaloSim") << "CaloSD: cleanHitCollection merge the hits in buffer ";
826  for (unsigned int i = 0; i < hitvec.size(); ++i)
827  edm::LogVerbatim("CaloSim") << i << " " << *hitvec[i];
828 #endif
829  //move all nullptr to end of list and then remove them
830  hitvec.erase(
831  std::stable_partition(hitvec.begin() + cleanIndex, hitvec.end(), [](CaloG4Hit* p) { return p != nullptr; }),
832  hitvec.end());
833 #ifdef EDM_ML_DEBUG
834  edm::LogVerbatim("CaloSim") << "CaloSD::cleanHitCollection: remove the merged hits in buffer,"
835  << " new size = " << hitvec.size();
836  for (unsigned int i = 0; i < hitvec.size(); ++i)
837  edm::LogVerbatim("CaloSim") << i << " " << *hitvec[i];
838 #endif
839  hitvec.swap(*theCollection);
840  totalHits = theHC->entries();
841  }
842 
843 #ifdef EDM_ML_DEBUG
844  edm::LogVerbatim("CaloSim") << "CaloSD: collection after merging, size= " << theHC->entries()
845  << " Size of reusehit= " << reusehit.size()
846  << "\n starting hit selection from index = " << cleanIndex;
847 #endif
848 
849  int addhit = 0;
850  for (unsigned int i = cleanIndex; i < theCollection->size(); ++i) {
851  CaloG4Hit* aHit((*theCollection)[i]);
852 
853  // selection
854 
855  double time = aHit->getTimeSlice();
856  if (corrTOFBeam)
857  time += correctT;
858  if (!filterHit(aHit, time)) {
859 #ifdef EDM_ML_DEBUG
860  edm::LogVerbatim("CaloSim") << "CaloSD: dropped CaloG4Hit "
861  << " " << *aHit;
862 #endif
863 
864  // create the list of hits to be reused
865 
866  reusehit.emplace_back((*theCollection)[i]);
867  (*theCollection)[i] = nullptr;
868  ++addhit;
869  }
870  }
871 
872 #ifdef EDM_ML_DEBUG
873  edm::LogVerbatim("CaloSim") << "CaloSD: Size of reusehit after selection = " << reusehit.size()
874  << " Number of added hit = " << addhit;
875 #endif
876  if (useMap) {
877  if (addhit > 0) {
878  int offset = reusehit.size() - addhit;
879  for (int ii = addhit - 1; ii >= 0; --ii) {
880  CaloHitID theID = reusehit[offset + ii]->getID();
881  hitMap.erase(theID);
882  }
883  }
884  }
885 
886  //move all nullptr to end of list and then remove them
887  theCollection->erase(
888  std::stable_partition(
889  theCollection->begin() + cleanIndex, theCollection->end(), [](CaloG4Hit* p) { return p != nullptr; }),
890  theCollection->end());
891 #ifdef EDM_ML_DEBUG
892  edm::LogVerbatim("CaloSim") << "CaloSD: hit collection after selection, size = " << theHC->entries();
893  theHC->PrintAllHits();
894 #endif
895 
896  cleanIndex = theHC->entries();
897 }
personalPlayback.level
level
Definition: personalPlayback.py:22
CaloSD::tkMap
std::map< int, TrackWithHistory * > tkMap
Definition: CaloSD.h:180
CaloSlaveSD.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CaloSD::filterHit
virtual bool filterHit(CaloG4Hit *, double)
Definition: CaloSD.cc:698
CaloG4Hit::setIncidentEnergy
void setIncidentEnergy(double e)
Definition: CaloG4Hit.h:62
CaloSD::edepositHAD
float edepositHAD
Definition: CaloSD.h:133
SimTrackManager
Definition: SimTrackManager.h:35
CaloSD::tmaxHit
double tmaxHit
Definition: CaloSD.h:137
CaloG4Hit::getTrackID
int getTrackID() const
Definition: CaloG4Hit.h:64
mps_fire.i
i
Definition: mps_fire.py:428
CaloSimulationParameters
Definition: CaloSimulationParameters.h:6
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
CaloSD::storeHit
void storeHit(CaloG4Hit *)
Definition: CaloSD.cc:718
TrackInformation::getIDonCaloSurface
int getIDonCaloSurface() const
Definition: TrackInformation.h:39
CaloSD::setToGlobal
G4ThreeVector setToGlobal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:377
CaloSD::currentHit
CaloG4Hit * currentHit
Definition: CaloSD.h:139
CaloSD::ProcessHits
G4bool ProcessHits(G4Step *step, G4TouchableHistory *) override
Definition: CaloSD.cc:154
CaloSD::kmaxProton
double kmaxProton
Definition: CaloSD.h:142
ESHandle.h
CaloSD::saveHit
bool saveHit(CaloG4Hit *)
Definition: CaloSD.cc:730
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
SensitiveDetector::NaNTrap
void NaNTrap(const G4Step *step) const
Definition: SensitiveDetector.cc:110
CaloHitID::depth
uint16_t depth() const
Definition: CaloHitID.h:24
CaloSD::useFineCaloID_
bool useFineCaloID_
Definition: CaloSD.h:177
CaloG4Hit::getUnitID
uint32_t getUnitID() const
Definition: CaloG4Hit.h:65
CaloSD::cleanIndex
int cleanIndex
Definition: CaloSD.h:169
SimTrackManager::trackExists
bool trackExists(unsigned int i) const
Definition: SimTrackManager.h:94
mps_merge.weight
weight
Definition: mps_merge.py:88
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
TrackWithHistory
Definition: TrackWithHistory.h:16
CaloSD::initRun
virtual void initRun()
Definition: CaloSD.cc:649
CaloSD::update
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
Definition: CaloSD.cc:539
CaloSD::nCheckedHits
int nCheckedHits
Definition: CaloSD.h:172
CaloHitID::trackID
int trackID() const
Definition: CaloHitID.h:23
CaloSD::getAttenuation
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:517
CaloSD::edepositEM
float edepositEM
Definition: CaloSD.h:133
CaloSD::hitExists
bool hitExists(const G4Step *)
Definition: CaloSD.cc:381
MeV
const double MeV
HcalParametersRcd
Definition: HcalParametersRcd.h:8
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
TrackInformation::putInHistory
void putInHistory()
Definition: TrackInformation.h:33
TrackInformation::genParticlePID
int genParticlePID() const
Definition: TrackInformation.h:59
CaloHitID::unitID
uint32_t unitID() const
Definition: CaloHitID.h:20
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
CaloG4Hit::getTimeSlice
double getTimeSlice() const
Definition: CaloG4Hit.h:66
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CaloSD::kmaxIon
double kmaxIon
Definition: CaloSD.h:142
EndOfTrack
Definition: EndOfTrack.h:6
SimTrackManager::giveMotherNeeded
int giveMotherNeeded(int i) const
Definition: SimTrackManager.h:84
G4TrackToParticleID::isGammaElectronPositron
static bool isGammaElectronPositron(int pdgCode)
Definition: G4TrackToParticleID.cc:17
CaloSD::setTrackID
virtual int setTrackID(const G4Step *)
Definition: CaloSD.cc:674
CaloG4HitEqual
Definition: CaloG4Hit.h:106
CaloSD::getResponseWt
double getResponseWt(const G4Track *)
Definition: CaloSD.cc:709
SensitiveCaloDetector
Definition: SensitiveCaloDetector.h:10
CaloSD::setDetUnitId
uint32_t setDetUnitId(const G4Step *step) override=0
HcalParametersRcd.h
CaloSimulationParameters.h
CaloSD::useMap
bool useMap
Definition: CaloSD.h:164
CaloHitID::setID
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:40
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
TrackInformation::isPrimary
bool isPrimary() const
Definition: TrackInformation.h:23
CaloSimulationParameters::fLevels_
std::vector< int > fLevels_
Definition: CaloSimulationParameters.h:18
CaloSD::setToLocal
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:373
CaloSD::isParameterized
bool isParameterized
Definition: CaloSD.h:162
fpCaloG4HitAllocator
G4ThreadLocal G4Allocator< CaloG4Hit > * fpCaloG4HitAllocator
Definition: CaloG4Hit.cc:11
CaloSD::~CaloSD
~CaloSD() override
Definition: CaloSD.cc:152
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
CaloSD::primIDSaved
int primIDSaved
Definition: CaloSD.h:171
edm::ESHandle
Definition: DTSurvey.h:22
CaloSD::PrintAll
void PrintAll() override
Definition: CaloSD.cc:355
BeginOfTrack
Definition: BeginOfTrack.h:6
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
CaloSD::entrancePoint
G4ThreeVector entrancePoint
Definition: CaloSD.h:129
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
TrackWithHistory::save
void save()
Definition: TrackWithHistory.h:27
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
CaloSD::posGlobal
G4ThreeVector posGlobal
Definition: CaloSD.h:131
dqmdumpme.k
k
Definition: dqmdumpme.py:60
CaloSD::clearHits
void clearHits() override
Definition: CaloSD.cc:632
CaloSD::meanResponse
std::unique_ptr< CaloMeanResponse > meanResponse
Definition: CaloSD.h:157
bysipixelclustmulteventfilter_cfi.collectionName
collectionName
Definition: bysipixelclustmulteventfilter_cfi.py:5
nhits
Definition: HIMultiTrackSelector.h:42
CaloSD::currentID
CaloHitID currentID
Definition: CaloSD.h:135
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
CaloSD::energyCut
double energyCut
Definition: CaloSD.h:137
CaloSD::reset
void reset() override
Definition: CaloSD.cc:643
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
CaloSD::eminHit
double eminHit
Definition: CaloSD.h:137
CaloSD::EndOfEvent
void EndOfEvent(G4HCofThisEvent *eventHC) override
Definition: CaloSD.cc:341
CaloG4Hit::getEM
double getEM() const
Definition: CaloG4Hit.h:55
edm::ParameterSet
Definition: ParameterSet.h:47
CaloSD::hitMap
std::map< CaloHitID, CaloG4Hit * > hitMap
Definition: CaloSD.h:179
CaloSD.h
CaloSD::theHC
CaloG4HitCollection * theHC
Definition: CaloSD.h:159
CaloSD::ignoreTrackID
bool ignoreTrackID
Definition: CaloSD.h:161
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
CaloSD::totalHits
int totalHits
Definition: CaloSD.h:170
CaloSD::incidentEnergy
float incidentEnergy
Definition: CaloSD.h:132
GeV
const double GeV
Definition: MathUtil.h:16
CaloSD::kmaxNeutron
double kmaxNeutron
Definition: CaloSD.h:142
CaloG4Hit::setEntryLocal
void setEntryLocal(double x, double y, double z)
Definition: CaloG4Hit.h:50
TrackInformation::getIDfineCalo
int getIDfineCalo() const
Definition: TrackInformation.h:55
CaloSD::timeSlice
float timeSlice
Definition: CaloSD.h:174
CaloSD::getEnergyDeposit
virtual double getEnergyDeposit(const G4Step *step)
Definition: CaloSD.cc:297
CaloSD::slave
std::unique_ptr< CaloSlaveSD > slave
Definition: CaloSD.h:156
TrackInformation
Definition: TrackInformation.h:8
createfilelist.int
int
Definition: createfilelist.py:10
CaloSD::CaloSD
CaloSD(const std::string &aSDname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:33
CaloG4Hit::setEntry
void setEntry(double x, double y, double z)
Definition: CaloG4Hit.h:47
CaloSD::resetForNewPrimary
void resetForNewPrimary(const G4Step *)
Definition: CaloSD.cc:504
BeginOfEvent
Definition: BeginOfEvent.h:6
TrackInformation::storeTrack
bool storeTrack() const
Definition: TrackInformation.h:14
BeginOfRun
Definition: BeginOfRun.h:6
CaloSD::getDepth
virtual uint16_t getDepth(const G4Step *)
Definition: CaloSD.cc:696
CaloSD::hcID
int hcID
Definition: CaloSD.h:167
CaloSD::eminHitD
double eminHitD
Definition: CaloSD.h:175
edm::EventSetup
Definition: EventSetup.h:57
CaloSD::DrawAll
void DrawAll() override
Definition: CaloSD.cc:353
CaloSD::reusehit
std::vector< std::unique_ptr< CaloG4Hit > > reusehit
Definition: CaloSD.h:181
TrackInformation.h
CaloG4Hit
Definition: CaloG4Hit.h:32
CaloG4Hit::setHadr
void setHadr(double e)
Definition: CaloG4Hit.h:59
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
TrackInformation::genParticleP
double genParticleP() const
Definition: TrackInformation.h:61
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
cc
CaloSD::corrTOFBeam
bool corrTOFBeam
Definition: CaloSD.h:165
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
CaloHitID::timeSliceID
int timeSliceID() const
Definition: CaloHitID.h:21
CaloG4HitLess
Definition: CaloG4Hit.h:91
CaloSD::m_trackManager
const SimTrackManager * m_trackManager
Definition: CaloSD.h:154
TrackWithHistory::trackID
unsigned int trackID() const
Definition: TrackWithHistory.h:28
TrackContainer
std::vector< TrackWithHistory * > TrackContainer
Definition: TrackContainer.h:8
CaloSD::getTrackID
virtual int getTrackID(const G4Track *)
Definition: CaloSD.cc:655
SensitiveDetector::cmsTrackInformation
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
Definition: SensitiveDetector.cc:96
G4TrackToParticleID.h
CaloSD::clear
void clear() override
Definition: CaloSD.cc:351
CaloSD::Detector
Definition: CaloSD.h:147
CaloSD::getNumberOfHits
int getNumberOfHits()
Definition: CaloSD.cc:425
CaloSD::cleanHitCollection
void cleanHitCollection()
Definition: CaloSD.cc:789
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
CaloSD::primAncestor
int primAncestor
Definition: CaloSD.h:168
CaloHitID::reset
void reset()
Definition: CaloHitID.cc:48
SimTrackManager.h
CaloHitID
Definition: CaloHitID.h:11
CaloSD::fineDetectors_
std::vector< Detector > fineDetectors_
Definition: CaloSD.h:182
Exception
Definition: hltDiff.cc:246
TrackWithHistory::momentum
const math::XYZVectorD & momentum() const
Definition: TrackWithHistory.h:32
CaloSD::entranceLocal
G4ThreeVector entranceLocal
Definition: CaloSD.h:130
CaloSimulationParameters::fCaloNames_
std::vector< std::string > fCaloNames_
Definition: CaloSimulationParameters.h:17
edm::PCaloHitContainer
std::vector< PCaloHit > PCaloHitContainer
Definition: PCaloHitContainer.h:8
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CaloG4HitCollection
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
Definition: CaloG4HitCollection.h:11
CaloSD::correctT
double correctT
Definition: CaloSD.h:176
CaloSD::getFromLibrary
virtual bool getFromLibrary(const G4Step *step)
Definition: CaloSD.cc:301
CaloSD::Initialize
void Initialize(G4HCofThisEvent *HCE) override
Definition: CaloSD.cc:323
CaloSD::checkHit
bool checkHit()
Definition: CaloSD.cc:396
CaloSD::forceSave
bool forceSave
Definition: CaloSD.h:144
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
cscdqm::timeSlice
CSCCFEBTimeSlice const *const timeSlice(T const &data, int nCFEB, int nSample)
Definition: CSCDQM_EventProcessor_processCSC.cc:29
CaloSD::fillHits
void fillHits(edm::PCaloHitContainer &, const std::string &) override
Definition: CaloSD.cc:362
CaloSD::ignoreReject
bool ignoreReject
Definition: CaloSD.h:163
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::roottree::getEntry
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:496
CaloG4Hit::setEM
void setEM(double e)
Definition: CaloG4Hit.h:56
CaloSD::initEvent
virtual void initEvent(const BeginOfEvent *)
Definition: CaloSD.cc:651
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CaloG4Hit::setID
void setID(uint32_t i, double d, int j, uint16_t k=0)
Definition: CaloG4Hit.h:71
ntuplemaker.time
time
Definition: ntuplemaker.py:310
CaloSD::updateHit
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:493
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
CaloSD::suppressHeavy
bool suppressHeavy
Definition: CaloSD.h:141
cond::serialization::equal
bool equal(const T &first, const T &second)
Definition: Equal.h:32
CaloSD::EnergyCorrected
virtual double EnergyCorrected(const G4Step &step, const G4Track *)
Definition: CaloSD.cc:299
edm::Log
Definition: MessageLogger.h:70
CaloG4Hit::getHadr
double getHadr() const
Definition: CaloG4Hit.h:58
CaloG4Hit::addEnergyDeposit
void addEnergyDeposit(double em, double hd)
Definition: CaloG4Hit.cc:45
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
cuy.ii
ii
Definition: cuy.py:590
CaloSD::isItFineCalo
bool isItFineCalo(const G4VTouchable *touch)
Definition: CaloSD.cc:303
weight
Definition: weight.py:1
SimTrackManager::trackContainer
const TrackContainer * trackContainer() const
Definition: SimTrackManager.h:52
hit
Definition: SiStripHitEffFromCalibTree.cc:88
CaloSD::endEvent
virtual void endEvent()
Definition: CaloSD.cc:653
CaloG4Hit::setPosition
void setPosition(double x, double y, double z)
Definition: CaloG4Hit.h:53
CaloG4Hit::getDepth
uint16_t getDepth() const
Definition: CaloG4Hit.h:68
fastSimProducer_cff.density
density
Definition: fastSimProducer_cff.py:61
CaloSD::createNewHit
CaloG4Hit * createNewHit(const G4Step *, const G4Track *)
Definition: CaloSD.cc:427
CaloSD::previousID
CaloHitID previousID
Definition: CaloSD.h:135