CMS 3D CMS Logo

CalorimetryManager.cc
Go to the documentation of this file.
1 //updated by Reza Goldouzian
2 //Framework headers
5 
6 // Fast Simulation headers
19 //#include "FastSimulation/Utilities/interface/Histos.h"
29 // New headers for Muon Mip Simulation
32 // Muon Brem
34 
35 //Gflash Hadronic Model
43 
44 //FastHFShowerLibrary
46 
47 // STL headers
48 #include <memory>
49 
50 #include <iostream>
51 #include <vector>
52 
53 //CMSSW headers
56 //#include "DataFormats/EcalDetId/interface/EcalDetId.h"
58 
61 
62 //ROOT headers
63 #include "TROOT.h"
64 #include "TH1.h"
65 
66 using namespace edm;
67 
70 
71 std::vector<std::pair<int, float> > CalorimetryManager::myZero_ =
72  std::vector<std::pair<int, float> >(1, std::pair<int, float>(0, 0.));
73 
74 CalorimetryManager::CalorimetryManager() : myCalorimeter_(nullptr), initialized_(false) { ; }
75 
77  const edm::ParameterSet& fastCalo,
78  const edm::ParameterSet& fastMuECAL,
79  const edm::ParameterSet& fastMuHCAL,
80  const edm::ParameterSet& parGflash)
81  : mySimEvent(aSimEvent),
82  initialized_(false),
83  theMuonEcalEffects(nullptr),
84  theMuonHcalEffects(nullptr),
85  bFixedLength_(false) {
88 
89  //Gflash
90  theProfile = new GflashHadronShowerProfile(parGflash);
91  thePiKProfile = new GflashPiKShowerProfile(parGflash);
94 
95  // FastHFShowerLibrary
97 
98  readParameters(fastCalo);
99 
100  myCalorimeter_ = new CaloGeometryHelper(fastCalo);
101  myHDResponse_ = new HCALResponse(fastCalo.getParameter<edm::ParameterSet>("HCALResponse"));
102  myHSParameters_ = new HSParameters(fastCalo.getParameter<edm::ParameterSet>("HSParameters"));
103 
104  // Material Effects for Muons in ECAL (only EnergyLoss implemented so far)
105  if (fastMuECAL.getParameter<bool>("PairProduction") || fastMuECAL.getParameter<bool>("Bremsstrahlung") ||
106  fastMuECAL.getParameter<bool>("MuonBremsstrahlung") || fastMuECAL.getParameter<bool>("EnergyLoss") ||
107  fastMuECAL.getParameter<bool>("MultipleScattering"))
108  theMuonEcalEffects = new MaterialEffects(fastMuECAL);
109 
110  // Material Effects for Muons in HCAL (only EnergyLoss implemented so far)
111  if (fastMuHCAL.getParameter<bool>("PairProduction") || fastMuHCAL.getParameter<bool>("Bremsstrahlung") ||
112  fastMuHCAL.getParameter<bool>("MuonBremsstrahlung") || fastMuHCAL.getParameter<bool>("EnergyLoss") ||
113  fastMuHCAL.getParameter<bool>("MultipleScattering"))
114  theMuonHcalEffects = new MaterialEffects(fastMuHCAL);
115 
116  if (fastCalo.exists("ECALResponseScaling")) {
118  std::make_unique<KKCorrectionFactors>(fastCalo.getParameter<edm::ParameterSet>("ECALResponseScaling"));
119  }
120 }
121 
123  EBMapping_.clear();
124  EEMapping_.clear();
125  HMapping_.clear();
126  ESMapping_.clear();
127  muonSimTracks.clear();
128  savedMuonSimTracks.clear();
129 }
130 
132  if (myCalorimeter_)
133  delete myCalorimeter_;
134  if (myHDResponse_)
135  delete myHDResponse_;
136 
137  if (theMuonEcalEffects)
138  delete theMuonEcalEffects;
139  if (theMuonHcalEffects)
140  delete theMuonHcalEffects;
141 
142  if (theProfile)
143  delete theProfile;
144 
145  if (theHFShowerLibrary)
146  delete theHFShowerLibrary;
147 }
148 
150  if (!evtsToDebug_.empty()) {
151  std::vector<unsigned int>::const_iterator itcheck =
152  find(evtsToDebug_.begin(), evtsToDebug_.end(), mySimEvent->id().event());
153  debug_ = (itcheck != evtsToDebug_.end());
154  if (debug_)
155  mySimEvent->print();
156  }
157 
158  initialize(random);
159 
160  LogInfo("FastCalorimetry") << "Reconstructing " << (int)mySimEvent->nTracks() << " tracks." << std::endl;
161  for (int fsimi = 0; fsimi < (int)mySimEvent->nTracks(); ++fsimi) {
162  FSimTrack& myTrack = mySimEvent->track(fsimi);
163 
164  reconstructTrack(myTrack, random);
165  } // particle loop
166 
167 } // reconstruct
168 
170  // Clear the content of the calorimeters
171  if (!initialized_) {
172  theHFShowerLibrary->SetRandom(random);
173 
174  // Check if the preshower is really available
176  edm::LogWarning("CalorimetryManager")
177  << " WARNING: The preshower simulation has been turned on; but no preshower geometry is available "
178  << std::endl;
179  edm::LogWarning("CalorimetryManager") << " Disabling the preshower simulation " << std::endl;
180  simulatePreshower_ = false;
181  }
182 
183  initialized_ = true;
184  }
185  clean();
186 }
187 
189  int pid = abs(myTrack.type());
190 
191  if (debug_) {
192  LogInfo("FastCalorimetry") << " ===> pid = " << pid << std::endl;
193  }
194 
195  // Check that the particle hasn't decayed
196  if (myTrack.noEndVertex()) {
197  // Simulate energy smearing for photon and electrons
198  float charge_ = (float)(myTrack.charge());
199  if (pid == 11 || pid == 22) {
200  if (myTrack.onEcal())
201  EMShowerSimulation(myTrack, random);
202  else if (myTrack.onVFcal()) {
203  if (useShowerLibrary) {
205  myHDResponse_->correctHF(myTrack.hcalEntrance().e(), abs(myTrack.type()));
207  } else
208  reconstructHCAL(myTrack, random);
209  }
210  } // electron or photon
211  else if (pid == 13 || pid == 1000024 || (pid > 1000100 && pid < 1999999 && fabs(charge_) > 0.001)) {
212  MuonMipSimulation(myTrack, random);
213  }
214  // Simulate energy smearing for hadrons (i.e., everything
215  // but muons... and SUSY particles that deserve a special
216  // treatment.
217  else if (pid < 1000000) {
218  if (myTrack.onHcal() || myTrack.onVFcal()) {
219  if (optionHDSim_ == 0)
220  reconstructHCAL(myTrack, random);
221  else
222  HDShowerSimulation(myTrack, random);
223  }
224  } // pid < 1000000
225  } // myTrack.noEndVertex()
226 }
227 
228 // Simulation of electromagnetic showers in PS, ECAL, HCAL
230  std::vector<const RawParticle*> thePart;
231  double X0depth;
232 
233  if (debug_) {
234  LogInfo("FastCalorimetry") << " EMShowerSimulation " << myTrack << std::endl;
235  }
236 
237  // The Particle at ECAL entrance
238  myPart = myTrack.ecalEntrance();
239 
240  // protection against infinite loop.
241  if (myTrack.type() == 22 && myPart.e() < 0.055)
242  return;
243 
244  // Barrel or Endcap ?
245  int onEcal = myTrack.onEcal();
246  int onHcal = myTrack.onHcal();
247  int onLayer1 = myTrack.onLayer1();
248  int onLayer2 = myTrack.onLayer2();
249 
250  // The entrance in ECAL
251  XYZPoint ecalentrance = myPart.vertex().Vect();
252 
253  // The preshower
254  PreshowerHitMaker* myPreshower = nullptr;
255  if (simulatePreshower_ && (onLayer1 || onLayer2)) {
256  XYZPoint layer1entrance, layer2entrance;
258  if (onLayer1) {
259  layer1entrance = XYZPoint(myTrack.layer1Entrance().vertex().Vect());
260  dir1 = XYZVector(myTrack.layer1Entrance().Vect().Unit());
261  }
262  if (onLayer2) {
263  layer2entrance = XYZPoint(myTrack.layer2Entrance().vertex().Vect());
264  dir2 = XYZVector(myTrack.layer2Entrance().Vect().Unit());
265  }
266  myPreshower =
267  new PreshowerHitMaker(myCalorimeter_, layer1entrance, dir1, layer2entrance, dir2, aLandauGenerator, random);
268  myPreshower->setMipEnergy(mipValues_[0], mipValues_[1]);
269  }
270 
271  // The ECAL Properties
274  myCalorimeter_->layer1Properties(onLayer1),
275  myCalorimeter_->layer2Properties(onLayer2),
278  RCFactor_,
279  RTFactor_);
280 
281  // Photons : create an e+e- pair
282  if (myTrack.type() == 22) {
283  // Depth for the first e+e- pair creation (in X0)
284  X0depth = -log(random->flatShoot()) * (9. / 7.);
285 
286  // Initialization
287  double eMass = 0.000510998902;
288  double xe = 0;
289  double xm = eMass / myPart.e();
290  double weight = 0.;
291 
292  // Generate electron energy between emass and eGamma-emass
293  do {
294  xe = random->flatShoot() * (1. - 2. * xm) + xm;
295  weight = 1. - 4. / 3. * xe * (1. - xe);
296  } while (weight < random->flatShoot());
297 
298  // Protection agains infinite loop in Famos Shower
299  if (myPart.e() * xe < 0.055 || myPart.e() * (1. - xe) < 0.055) {
300  if (myPart.e() > 0.055)
301  thePart.push_back(&myPart);
302 
303  } else {
304  myElec = (myPart.momentum()) * xe;
305  myPosi = (myPart.momentum()) * (1. - xe);
308  thePart.push_back(&myElec);
309  thePart.push_back(&myPosi);
310  }
311  // Electrons
312  } else {
313  X0depth = 0.;
314  if (myPart.e() > 0.055)
315  thePart.push_back(&myPart);
316  }
317 
318  // After the different protections, this shouldn't happen.
319  if (thePart.empty()) {
320  if (myPreshower == nullptr)
321  return;
322  delete myPreshower;
323  return;
324  }
325 
326  // find the most energetic particle
327  double maxEnergy = -1.;
328  for (unsigned ip = 0; ip < thePart.size(); ++ip)
329  if (thePart[ip]->e() > maxEnergy)
330  maxEnergy = thePart[ip]->e();
331 
332  // Initialize the Grid in ECAL
333  int size = gridSize_;
334  if (maxEnergy > 100)
335  size = 11;
336 
337  EMShower theShower(random, aGammaGenerator, &showerparam, &thePart, nullptr, nullptr, bFixedLength_);
338 
339  double maxShower = theShower.getMaximumOfShower();
340  if (maxShower > 20.)
341  maxShower = 2.; // simple pivot-searching protection
342 
343  double depth((X0depth + maxShower) * myCalorimeter_->ecalProperties(onEcal)->radLenIncm());
344  XYZPoint meanShower = ecalentrance + myPart.Vect().Unit() * depth;
345 
346  // The closest crystal
347  DetId pivot(myCalorimeter_->getClosestCell(meanShower, true, onEcal == 1));
348 
349  if (pivot.subdetId() == 0) { // further protection against avbsence of pivot
350  edm::LogWarning("CalorimetryManager")
351  << "Pivot for egamma e = " << myTrack.hcalEntrance().e() << " is not found at depth " << depth
352  << " and meanShower coordinates = " << meanShower << std::endl;
353  if (myPreshower)
354  delete myPreshower;
355  return;
356  }
357 
358  EcalHitMaker myGrid(myCalorimeter_, ecalentrance, pivot, onEcal, size, 0, random);
359  // ^^^^
360  // for EM showers
363 
364  //maximumdepth dependence of the radiusfactorbehindpreshower
365  //First tuning: Shilpi Jain (Mar-Apr 2010); changed after tuning - Feb-July - Shilpi Jain
366  /* **************
367  myGrid.setRadiusFactor(radiusFactor_);
368  if(onLayer1 || onLayer2)
369  {
370  float b = radiusPreshowerCorrections_[0];
371  float a = radiusFactor_*( 1.+radiusPreshowerCorrections_[1]*radiusPreshowerCorrections_[0] );
372  float maxdepth = X0depth+theShower.getMaximumOfShower();
373  float newRadiusFactor = radiusFactor_;
374  if(myPart.e()<=250.)
375  {
376  newRadiusFactor = a/(1.+b*maxdepth);
377  }
378  myGrid.setRadiusFactor(newRadiusFactor);
379  }
380  else // otherwise use the normal radius factor
381  {
382  myGrid.setRadiusFactor(radiusFactor_);
383  }
384  ************** */
385  if (myTrack.onEcal() == 2) // if on EE
386  {
387  if ((onLayer1 || onLayer2) && myPart.e() <= 250.) {
388  double maxdepth = X0depth + theShower.getMaximumOfShower();
389  double newRadiusFactor = radiusFactorEE_ * aTerm / (1. + bTerm * maxdepth);
390  myGrid.setRadiusFactor(newRadiusFactor);
391  } else // otherwise use the normal radius factor
392  {
394  }
395  } //if(myTrack.onEcal() == 2)
396  else // else if on EB
397  {
399  }
400  //(end of) changed after tuning - Feb-July - Shilpi Jain
401 
403 
404  // The shower simulation
405  myGrid.setTrackParameters(myPart.Vect().Unit(), X0depth, myTrack);
406 
407  if (myPreshower)
408  theShower.setPreshower(myPreshower);
409 
410  HcalHitMaker myHcalHitMaker(myGrid, (unsigned)0);
411 
412  theShower.setGrid(&myGrid);
413  theShower.setHcal(&myHcalHitMaker);
414  theShower.compute();
415 
416  // calculate the total simulated energy for this particle
417  float simE = 0;
418  for (const auto& mapIterator : myGrid.getHits()) {
419  simE += mapIterator.second;
420  }
421 
422  auto scale = ecalCorrection
423  ? ecalCorrection->getScale(myTrack.ecalEntrance().e(), std::abs(myTrack.ecalEntrance().eta()), simE)
424  : 1.;
425 
426  // Save the hits !
427  updateECAL(myGrid.getHits(), onEcal, myTrack.id(), scale);
428 
429  // Now fill the HCAL hits
430  updateHCAL(myHcalHitMaker.getHits(), myTrack.id());
431 
432  // delete the preshower
433  if (myPreshower != nullptr) {
434  updatePreshower(myPreshower->getHits(), myTrack.id());
435  delete myPreshower;
436  }
437 }
438 
440  int hit;
441  int pid = abs(myTrack.type());
442  if (debug_) {
443  LogInfo("FastCalorimetry") << " reconstructHCAL " << myTrack << std::endl;
444  }
445 
446  XYZTLorentzVector trackPosition;
447  if (myTrack.onHcal()) {
448  trackPosition = myTrack.hcalEntrance().vertex();
449  hit = myTrack.onHcal() - 1;
450  } else {
451  trackPosition = myTrack.vfcalEntrance().vertex();
452  hit = 2;
453  }
454 
455  double pathEta = trackPosition.eta();
456  double pathPhi = trackPosition.phi();
457 
458  double EGen = myTrack.hcalEntrance().e();
459  double emeas = 0.;
460 
461  float charge_ = (float)myTrack.charge();
462  if (pid == 13 || pid == 1000024 || (pid > 1000100 && pid < 1999999 && fabs(charge_) > 0.001)) {
463  emeas = myHDResponse_->responseHCAL(0, EGen, pathEta, 2, random); // 2=muon
464  if (debug_)
465  LogInfo("FastCalorimetry") << "CalorimetryManager::reconstructHCAL - MUON !!!" << std::endl;
466  } else if (pid == 22 || pid == 11) {
467  emeas = myHDResponse_->responseHCAL(0, EGen, pathEta, 0, random); // last par. = 0 = e/gamma
468  if (debug_)
469  LogInfo("FastCalorimetry") << "CalorimetryManager::reconstructHCAL - e/gamma !!!" << std::endl;
470  } else {
471  emeas = myHDResponse_->getHCALEnergyResponse(EGen, hit, random);
472  }
473 
474  if (debug_)
475  LogInfo("FastCalorimetry") << "CalorimetryManager::reconstructHCAL - on-calo "
476  << " eta = " << pathEta << " phi = " << pathPhi << " Egen = " << EGen
477  << " Emeas = " << emeas << std::endl;
478 
479  if (emeas > 0.) {
480  DetId cell = myCalorimeter_->getClosestCell(trackPosition.Vect(), false, false);
481  double tof =
482  (((HcalGeometry*)(myCalorimeter_->getHcalGeometry()))->getPosition(cell).mag()) / 29.98; //speed of light
483  CaloHitID current_id(cell.rawId(), tof, myTrack.id());
484  std::map<CaloHitID, float> hitMap;
485  hitMap[current_id] = emeas;
486  updateHCAL(hitMap, myTrack.id());
487  }
488 }
489 
491  // const edm::ParameterSet& fastCalo){
492 
493  theHFShowerLibrary->SetRandom(random);
494 
495  // TimeMe t(" FASTEnergyReconstructor::HDShower");
496  const XYZTLorentzVector& moment = myTrack.momentum();
497 
498  if (debug_)
499  LogInfo("FastCalorimetry") << "CalorimetryManager::HDShowerSimulation - track param." << std::endl
500  << " eta = " << moment.eta() << std::endl
501  << " phi = " << moment.phi() << std::endl
502  << " et = " << moment.Et() << std::endl
503  << " e = " << myTrack.hcalEntrance().e() << std::endl;
504 
505  if (debug_) {
506  LogInfo("FastCalorimetry") << " HDShowerSimulation " << myTrack << std::endl;
507  }
508 
509  int hit;
510 
511  XYZTLorentzVector trackPosition;
512  if (myTrack.onEcal()) {
513  trackPosition = myTrack.ecalEntrance().vertex();
514  hit = myTrack.onEcal() - 1; //
515  myPart = myTrack.ecalEntrance();
516  } else if (myTrack.onVFcal()) {
517  trackPosition = myTrack.vfcalEntrance().vertex();
518  hit = 2;
519  myPart = myTrack.vfcalEntrance();
520  } else {
521  LogInfo("FastCalorimetry") << " The particle is not in the acceptance " << std::endl;
522  return;
523  }
524 
525  // int onHCAL = hit + 1; - specially for myCalorimeter->hcalProperties(onHCAL)
526  // (below) to get VFcal properties ...
527  int onHCAL = hit + 1;
528  int onECAL = myTrack.onEcal();
529 
530  double pathEta = trackPosition.eta();
531  double pathPhi = trackPosition.phi();
532 
533  double eint = moment.e();
534  double eGen = myTrack.hcalEntrance().e();
535 
536  double emeas = 0.;
537  double pmip = myHDResponse_->getMIPfraction(eGen, pathEta);
538 
539  //===========================================================================
540  if (eGen > 0.) {
541  // ECAL and HCAL properties to get
542  HDShowerParametrization theHDShowerparam(
544 
545  //Making ECAL Grid (and segments calculation)
546  XYZPoint caloentrance;
547  XYZVector direction;
548  if (myTrack.onEcal()) {
549  caloentrance = myTrack.ecalEntrance().vertex().Vect();
550  direction = myTrack.ecalEntrance().Vect().Unit();
551  } else if (myTrack.onHcal()) {
552  caloentrance = myTrack.hcalEntrance().vertex().Vect();
553  direction = myTrack.hcalEntrance().Vect().Unit();
554  } else {
555  caloentrance = myTrack.vfcalEntrance().vertex().Vect();
556  direction = myTrack.vfcalEntrance().Vect().Unit();
557  }
558 
559  if (debug_)
560  LogInfo("FastCalorimetry") << "CalorimetryManager::HDShowerSimulation - on-calo 1 " << std::endl
561  << " onEcal = " << myTrack.onEcal() << std::endl
562  << " onHcal = " << myTrack.onHcal() << std::endl
563  << " onVFcal = " << myTrack.onVFcal() << std::endl
564  << " position = " << caloentrance << std::endl;
565 
566  DetId pivot;
567  if (myTrack.onEcal()) {
568  pivot = myCalorimeter_->getClosestCell(caloentrance, true, myTrack.onEcal() == 1);
569  } else if (myTrack.onHcal()) {
570  pivot = myCalorimeter_->getClosestCell(caloentrance, false, false);
571  }
572 
573  EcalHitMaker myGrid(
574  myCalorimeter_, caloentrance, pivot, pivot.null() ? 0 : myTrack.onEcal(), hdGridSize_, 1, random);
575  // 1=HAD shower
576 
577  myGrid.setTrackParameters(direction, 0, myTrack);
578  // Build the FAMOS HCAL
579  HcalHitMaker myHcalHitMaker(myGrid, (unsigned)1);
580 
581  // Shower simulation
582  bool status = false;
583  int mip = 2;
584  // Use HFShower for HF
585  if (!myTrack.onEcal() && !myTrack.onHcal()) {
586  // Warning : We give here the particle energy with the response
587  // but without the resolution/gaussian smearing
588  // For HF, the resolution is due to the PE statistic
589 
590  if (useShowerLibrary) {
592  status = true;
593  } else {
594  HFShower theShower(random, &theHDShowerparam, &myGrid, &myHcalHitMaker, onECAL, eGen);
595  // eGen);
596  // e); // PV Warning : temporarly set the energy to the generated E
597 
598  status = theShower.compute();
599  }
600  } else {
601  if (hdSimMethod_ == 0) {
602  HDShower theShower(random, &theHDShowerparam, &myGrid, &myHcalHitMaker, onECAL, eGen, pmip);
603  status = theShower.compute();
604  mip = theShower.getmip();
605  } else if (hdSimMethod_ == 1) {
606  HDRShower theShower(random, &theHDShowerparam, &myGrid, &myHcalHitMaker, onECAL, eGen);
607  status = theShower.computeShower();
608  mip = 2;
609  } else if (hdSimMethod_ == 2) {
610  //dynamically loading a corresponding profile by the particle type
611  int particleType = myTrack.type();
613  if (particleType == -2212)
615  else if (particleType == 2212)
617 
618  //input variables for GflashHadronShowerProfile
619  int showerType = 99 + myTrack.onEcal();
620  double globalTime = 150.0; // a temporary reference hit time in nanosecond
621  float charge = (float)(myTrack.charge());
622  Gflash3Vector gfpos(trackPosition.X(), trackPosition.Y(), trackPosition.Z());
623  Gflash3Vector gfmom(moment.X(), moment.Y(), moment.Z());
624 
625  theProfile->initialize(showerType, eGen, globalTime, charge, gfpos, gfmom);
628 
629  //make hits
630  std::vector<GflashHit>& gflashHitList = theProfile->getGflashHitList();
631  std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
632  std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
633 
635 
636  for (; spotIter != spotIterEnd; spotIter++) {
637  double pathLength = theProfile->getGflashShowino()->getPathLengthAtShower() +
638  (30 * 100 / eGen) * (spotIter->getTime() - globalTime);
639 
640  double currentDepth = std::max(0.0, pathLength - theProfile->getGflashShowino()->getPathLengthOnEcal());
641 
642  //find the the showino position at the currentDepth
643  GflashTrajectoryPoint trajectoryPoint;
644  theProfile->getGflashShowino()->getHelix()->getGflashTrajectoryPoint(trajectoryPoint, pathLength);
645  Gflash3Vector positionAtCurrentDepth = trajectoryPoint.getPosition();
646  //find radial distrance
647  Gflash3Vector lateralDisplacement = positionAtCurrentDepth - spotIter->getPosition() / CLHEP::cm;
648  double rShower = lateralDisplacement.r();
649  double azimuthalAngle = lateralDisplacement.phi();
650 
651  whichCalor = Gflash::getCalorimeterNumber(positionAtCurrentDepth);
652 
653  if (whichCalor == Gflash::kESPM || whichCalor == Gflash::kENCA) {
654  bool statusPad = myGrid.getPads(currentDepth, true);
655  if (!statusPad)
656  continue;
657  myGrid.setSpotEnergy(1.2 * spotIter->getEnergy() / CLHEP::GeV);
658  myGrid.addHit(rShower / Gflash::intLength[Gflash::kESPM], azimuthalAngle, 0);
659  } else if (whichCalor == Gflash::kHB || whichCalor == Gflash::kHE) {
660  bool setHDdepth = myHcalHitMaker.setDepth(currentDepth, true);
661  if (!setHDdepth)
662  continue;
663  myHcalHitMaker.setSpotEnergy(1.4 * spotIter->getEnergy() / CLHEP::GeV);
664  myHcalHitMaker.addHit(rShower / Gflash::intLength[Gflash::kHB], azimuthalAngle, 0);
665  }
666  }
667  status = true;
668  } else {
669  edm::LogInfo("FastSimulationCalorimetry") << " SimMethod " << hdSimMethod_ << " is NOT available ";
670  }
671  }
672 
673  if (status) {
674  // Here to switch between simple formulae and parameterized response
675  if (optionHDSim_ == 1) {
676  emeas = myHDResponse_->getHCALEnergyResponse(eGen, hit, random);
677  } else { // optionHDsim == 2
678  emeas = myHDResponse_->responseHCAL(mip, eGen, pathEta, 1, random); // 1=hadron
679  }
680 
681  double correction = emeas / eGen;
682 
683  // RespCorrP factors (ECAL and HCAL separately) calculation
684  respCorr(eint);
685 
686  if (debug_)
687  LogInfo("FastCalorimetry") << "CalorimetryManager::HDShowerSimulation - on-calo 2" << std::endl
688  << " eta = " << pathEta << std::endl
689  << " phi = " << pathPhi << std::endl
690  << " Egen = " << eGen << std::endl
691  << " Emeas = " << emeas << std::endl
692  << " corr = " << correction << std::endl
693  << " mip = " << mip << std::endl;
694 
695  if (myTrack.onEcal() > 0) {
696  // Save ECAL hits
697  updateECAL(myGrid.getHits(), onECAL, myTrack.id(), correction * ecorr);
698  }
699 
700  // Save HCAL hits
701  if (myTrack.onVFcal() && useShowerLibrary) {
702  myHDResponse_->correctHF(eGen, abs(myTrack.type()));
704  } else
705  updateHCAL(myHcalHitMaker.getHits(), myTrack.id(), correction * hcorr);
706 
707  } else { // shower simulation failed
708  if (myTrack.onHcal() || myTrack.onVFcal()) {
709  DetId cell = myCalorimeter_->getClosestCell(trackPosition.Vect(), false, false);
710  double tof =
711  (((HcalGeometry*)(myCalorimeter_->getHcalGeometry()))->getPosition(cell).mag()) / 29.98; //speed of light
712  CaloHitID current_id(cell.rawId(), tof, myTrack.id());
713  std::map<CaloHitID, float> hitMap;
714  hitMap[current_id] = emeas;
715  updateHCAL(hitMap, myTrack.id());
716  if (debug_)
717  LogInfo("FastCalorimetry") << " HCAL simple cell " << cell.rawId() << " added E = " << emeas << std::endl;
718  }
719  }
720 
721  } // e > 0. ...
722 
723  if (debug_)
724  LogInfo("FastCalorimetry") << std::endl << " FASTEnergyReconstructor::HDShowerSimulation finished " << std::endl;
725 }
726 
728  // TimeMe t(" FASTEnergyReconstructor::HDShower");
729  XYZTLorentzVector moment = myTrack.momentum();
730 
731  // Backward compatibility behaviour
732  if (!theMuonHcalEffects) {
733  savedMuonSimTracks.push_back(myTrack);
734 
735  if (myTrack.onHcal() || myTrack.onVFcal())
736  reconstructHCAL(myTrack, random);
737 
738  return;
739  }
740 
741  if (debug_)
742  LogInfo("FastCalorimetry") << "CalorimetryManager::MuonMipSimulation - track param." << std::endl
743  << " eta = " << moment.eta() << std::endl
744  << " phi = " << moment.phi() << std::endl
745  << " et = " << moment.Et() << std::endl;
746 
747  XYZTLorentzVector trackPosition;
748  if (myTrack.onEcal()) {
749  trackPosition = myTrack.ecalEntrance().vertex();
750  myPart = myTrack.ecalEntrance();
751  } else if (myTrack.onVFcal()) {
752  trackPosition = myTrack.vfcalEntrance().vertex();
753  myPart = myTrack.vfcalEntrance();
754  } else {
755  LogInfo("FastCalorimetry") << " The particle is not in the acceptance " << std::endl;
756  return;
757  }
758 
759  // int onHCAL = hit + 1; - specially for myCalorimeter->hcalProperties(onHCAL)
760  // (below) to get VFcal properties ...
761  // not needed ?
762  // int onHCAL = hit + 1;
763  int onECAL = myTrack.onEcal();
764 
765  //===========================================================================
766 
767  // ECAL and HCAL properties to get
768 
769  //Making ECAL Grid (and segments calculation)
770  XYZPoint caloentrance;
771  XYZVector direction;
772  if (myTrack.onEcal()) {
773  caloentrance = myTrack.ecalEntrance().vertex().Vect();
774  direction = myTrack.ecalEntrance().Vect().Unit();
775  } else if (myTrack.onHcal()) {
776  caloentrance = myTrack.hcalEntrance().vertex().Vect();
777  direction = myTrack.hcalEntrance().Vect().Unit();
778  } else {
779  caloentrance = myTrack.vfcalEntrance().vertex().Vect();
780  direction = myTrack.vfcalEntrance().Vect().Unit();
781  }
782 
783  DetId pivot;
784  if (myTrack.onEcal()) {
785  pivot = myCalorimeter_->getClosestCell(caloentrance, true, myTrack.onEcal() == 1);
786  } else if (myTrack.onHcal()) {
787  pivot = myCalorimeter_->getClosestCell(caloentrance, false, false);
788  }
789 
790  EcalHitMaker myGrid(myCalorimeter_, caloentrance, pivot, pivot.null() ? 0 : myTrack.onEcal(), hdGridSize_, 0, random);
791  // 0 =EM shower -> Unit = X0
792 
793  myGrid.setTrackParameters(direction, 0, myTrack);
794 
795  // Now get the path in the Preshower, ECAL and HCAL along a straight line extrapolation
796  // but only those in the ECAL are used
797 
798  const std::vector<CaloSegment>& segments = myGrid.getSegments();
799  unsigned nsegments = segments.size();
800 
801  int ifirstHcal = -1;
802  int ilastEcal = -1;
803 
805  // // Muon brem in ECAL
806  // MuonBremsstrahlungSimulator* muonBremECAL = 0;
807  // if (theMuonEcalEffects) muonBremECAL = theMuonEcalEffects->muonBremsstrahlungSimulator();
808 
809  for (unsigned iseg = 0; iseg < nsegments && ifirstHcal < 0; ++iseg) {
810  // in the ECAL, there are two types of segments: PbWO4 and GAP
811  float segmentSizeinX0 = segments[iseg].X0length();
812 
813  // Martijn - insert your computations here
814  float energy = 0.0;
815  if (segmentSizeinX0 > 0.001 && segments[iseg].material() == CaloSegment::PbWO4) {
816  // The energy loss simulator
817  float charge = (float)(myTrack.charge());
818  RawParticle p = rawparticle::makeMuon(charge < 0, moment, trackPosition);
819  ParticlePropagator theMuon(p, nullptr, nullptr, mySimEvent->theTable());
820  if (energyLossECAL) {
821  energyLossECAL->updateState(theMuon, segmentSizeinX0, random);
822  energy = energyLossECAL->deltaMom().E();
823  moment -= energyLossECAL->deltaMom();
824  }
825  }
826  // that's all for ECAL, Florian
827  // Save the hit only if it is a crystal
828  if (segments[iseg].material() == CaloSegment::PbWO4) {
829  myGrid.getPads(segments[iseg].sX0Entrance() + segmentSizeinX0 * 0.5);
830  myGrid.setSpotEnergy(energy);
831  myGrid.addHit(0., 0.);
832  ilastEcal = iseg;
833  }
834  // Check for end of loop:
835  if (segments[iseg].material() == CaloSegment::HCAL) {
836  ifirstHcal = iseg;
837  }
838  }
839 
840  // Build the FAMOS HCAL
841  HcalHitMaker myHcalHitMaker(myGrid, (unsigned)2);
842  // float mipenergy=0.1;
843  // Create the helix with the stepping helix propagator
844  // to add a hit, just do
845  // myHcalHitMaker.setSpotEnergy(mipenergy);
846  // math::XYZVector hcalEntrance;
847  // if(ifirstHcal>=0) hcalEntrance=segments[ifirstHcal].entrance();
848  // myHcalHitMaker.addHit(hcalEntrance);
852  int ilastHcal = -1;
853  float mipenergy = 0.0;
854 
856  // // Muon Brem effect
857  // MuonBremsstrahlungSimulator* muonBremHCAL = 0;
858  // if (theMuonHcalEffects) muonBremHCAL = theMuonHcalEffects->muonBremsstrahlungSimulator();
859 
860  if (ifirstHcal > 0 && energyLossHCAL) {
861  for (unsigned iseg = ifirstHcal; iseg < nsegments; ++iseg) {
862  float segmentSizeinX0 = segments[iseg].X0length();
863  if (segments[iseg].material() == CaloSegment::HCAL) {
864  ilastHcal = iseg;
865  if (segmentSizeinX0 > 0.001) {
866  // The energy loss simulator
867  float charge = (float)(myTrack.charge());
868  RawParticle p = rawparticle::makeMuon(charge < 0, moment, trackPosition);
869  ParticlePropagator theMuon(p, nullptr, nullptr, mySimEvent->theTable());
870  energyLossHCAL->updateState(theMuon, segmentSizeinX0, random);
871  mipenergy = energyLossHCAL->deltaMom().E();
872  moment -= energyLossHCAL->deltaMom();
873  myHcalHitMaker.setSpotEnergy(mipenergy);
874  myHcalHitMaker.addHit(segments[iseg].entrance());
875  }
876  }
877  }
878  }
879 
880  // Copy the muon SimTrack (Only for Energy loss)
881  FSimTrack muonTrack(myTrack);
882  if (energyLossHCAL && ilastHcal >= 0) {
883  math::XYZVector hcalExit = segments[ilastHcal].exit();
884  muonTrack.setTkPosition(hcalExit);
885  muonTrack.setTkMomentum(moment);
886  } else if (energyLossECAL && ilastEcal >= 0) {
887  math::XYZVector ecalExit = segments[ilastEcal].exit();
888  muonTrack.setTkPosition(ecalExit);
889  muonTrack.setTkMomentum(moment);
890  } // else just leave tracker surface position and momentum...
891 
892  muonSimTracks.push_back(muonTrack);
893 
894  // no need to change below this line
895  std::map<CaloHitID, float>::const_iterator mapitr;
896  std::map<CaloHitID, float>::const_iterator endmapitr;
897  if (myTrack.onEcal() > 0) {
898  // Save ECAL hits
899  updateECAL(myGrid.getHits(), onECAL, myTrack.id());
900  }
901 
902  // Save HCAL hits
903  updateHCAL(myHcalHitMaker.getHits(), myTrack.id());
904 
905  if (debug_)
906  LogInfo("FastCalorimetry") << std::endl << " FASTEnergyReconstructor::MipShowerSimulation finished " << std::endl;
907 }
908 
910  edm::ParameterSet ECALparameters = fastCalo.getParameter<edm::ParameterSet>("ECAL");
911 
912  evtsToDebug_ = fastCalo.getUntrackedParameter<std::vector<unsigned int> >("EvtsToDebug", std::vector<unsigned>());
913  debug_ = fastCalo.getUntrackedParameter<bool>("Debug");
914 
915  bFixedLength_ = ECALparameters.getParameter<bool>("bFixedLength");
916 
917  gridSize_ = ECALparameters.getParameter<int>("GridSize");
918  spotFraction_ = ECALparameters.getParameter<double>("SpotFraction");
919  pulledPadSurvivalProbability_ = ECALparameters.getParameter<double>("FrontLeakageProbability");
920  crackPadSurvivalProbability_ = ECALparameters.getParameter<double>("GapLossProbability");
921  theCoreIntervals_ = ECALparameters.getParameter<std::vector<double> >("CoreIntervals");
922  theTailIntervals_ = ECALparameters.getParameter<std::vector<double> >("TailIntervals");
923 
924  RCFactor_ = ECALparameters.getParameter<double>("RCFactor");
925  RTFactor_ = ECALparameters.getParameter<double>("RTFactor");
926  //changed after tuning - Feb-July - Shilpi Jain
927  // radiusFactor_ = ECALparameters.getParameter<double>("RadiusFactor");
928  radiusFactorEE_ = ECALparameters.getParameter<double>("RadiusFactorEE");
929  radiusFactorEB_ = ECALparameters.getParameter<double>("RadiusFactorEB");
930  //(end of) changed after tuning - Feb-July - Shilpi Jain
931  radiusPreshowerCorrections_ = ECALparameters.getParameter<std::vector<double> >("RadiusPreshowerCorrections");
934  mipValues_ = ECALparameters.getParameter<std::vector<double> >("MipsinGeV");
935  simulatePreshower_ = ECALparameters.getParameter<bool>("SimulatePreshower");
936 
937  if (gridSize_ < 1)
938  gridSize_ = 7;
939  if (pulledPadSurvivalProbability_ < 0. || pulledPadSurvivalProbability_ > 1)
941  if (crackPadSurvivalProbability_ < 0. || crackPadSurvivalProbability_ > 1)
943 
944  LogInfo("FastCalorimetry") << " Fast ECAL simulation parameters " << std::endl;
945  LogInfo("FastCalorimetry") << " =============================== " << std::endl;
946  if (simulatePreshower_)
947  LogInfo("FastCalorimetry") << " The preshower is present " << std::endl;
948  else
949  LogInfo("FastCalorimetry") << " The preshower is NOT present " << std::endl;
950  LogInfo("FastCalorimetry") << " Grid Size : " << gridSize_ << std::endl;
951  if (spotFraction_ > 0.)
952  LogInfo("FastCalorimetry") << " Spot Fraction : " << spotFraction_ << std::endl;
953  else {
954  LogInfo("FastCalorimetry") << " Core of the shower " << std::endl;
955  for (unsigned ir = 0; ir < theCoreIntervals_.size() / 2; ++ir) {
956  LogInfo("FastCalorimetry") << " r < " << theCoreIntervals_[ir * 2] << " R_M : " << theCoreIntervals_[ir * 2 + 1]
957  << " ";
958  }
959  LogInfo("FastCalorimetry") << std::endl;
960 
961  LogInfo("FastCalorimetry") << " Tail of the shower " << std::endl;
962  for (unsigned ir = 0; ir < theTailIntervals_.size() / 2; ++ir) {
963  LogInfo("FastCalorimetry") << " r < " << theTailIntervals_[ir * 2] << " R_M : " << theTailIntervals_[ir * 2 + 1]
964  << " ";
965  }
966  //changed after tuning - Feb-July - Shilpi Jain
967  LogInfo("FastCalorimetry") << "Radius correction factors: EB & EE " << radiusFactorEB_ << " : " << radiusFactorEE_
968  << std::endl;
969  //(end of) changed after tuning - Feb-July - Shilpi Jain
970  LogInfo("FastCalorimetry") << std::endl;
971  if (mipValues_.size() > 2) {
972  LogInfo("FastCalorimetry") << "Improper number of parameters for the preshower ; using 95keV" << std::endl;
973  mipValues_.clear();
974  mipValues_.resize(2, 0.000095);
975  }
976  }
977 
978  LogInfo("FastCalorimetry") << " FrontLeakageProbability : " << pulledPadSurvivalProbability_ << std::endl;
979  LogInfo("FastCalorimetry") << " GapLossProbability : " << crackPadSurvivalProbability_ << std::endl;
980 
981  // RespCorrP: p (momentum), ECAL and HCAL corrections = f(p)
982  edm::ParameterSet CalorimeterParam = fastCalo.getParameter<edm::ParameterSet>("CalorimeterProperties");
983 
984  rsp = CalorimeterParam.getParameter<std::vector<double> >("RespCorrP");
985  LogInfo("FastCalorimetry") << " RespCorrP (rsp) size " << rsp.size() << std::endl;
986 
987  if (rsp.size() % 3 != 0) {
988  LogInfo("FastCalorimetry") << " RespCorrP size is wrong -> no corrections applied !!!" << std::endl;
989 
990  p_knots.push_back(14000.);
991  k_e.push_back(1.);
992  k_h.push_back(1.);
993  } else {
994  for (unsigned i = 0; i < rsp.size(); i += 3) {
995  LogInfo("FastCalorimetry") << "i = " << i / 3 << " p = " << rsp[i] << " k_e(p) = " << rsp[i + 1]
996  << " k_e(p) = " << rsp[i + 2] << std::endl;
997 
998  p_knots.push_back(rsp[i]);
999  k_e.push_back(rsp[i + 1]);
1000  k_h.push_back(rsp[i + 2]);
1001  }
1002  }
1003 
1004  //FR
1005  edm::ParameterSet HCALparameters = fastCalo.getParameter<edm::ParameterSet>("HCAL");
1006  optionHDSim_ = HCALparameters.getParameter<int>("SimOption");
1007  hdGridSize_ = HCALparameters.getParameter<int>("GridSize");
1008  hdSimMethod_ = HCALparameters.getParameter<int>("SimMethod");
1009  //RF
1010 
1011  EcalDigitizer_ = ECALparameters.getUntrackedParameter<bool>("Digitizer", false);
1012  HcalDigitizer_ = HCALparameters.getUntrackedParameter<bool>("Digitizer", false);
1013  samplingHBHE_ = HCALparameters.getParameter<std::vector<double> >("samplingHBHE");
1014  samplingHF_ = HCALparameters.getParameter<std::vector<double> >("samplingHF");
1015  samplingHO_ = HCALparameters.getParameter<std::vector<double> >("samplingHO");
1016  ietaShiftHB_ = HCALparameters.getParameter<int>("ietaShiftHB");
1017  ietaShiftHE_ = HCALparameters.getParameter<int>("ietaShiftHE");
1018  ietaShiftHF_ = HCALparameters.getParameter<int>("ietaShiftHF");
1019  ietaShiftHO_ = HCALparameters.getParameter<int>("ietaShiftHO");
1020  timeShiftHB_ = HCALparameters.getParameter<std::vector<double> >("timeShiftHB");
1021  timeShiftHE_ = HCALparameters.getParameter<std::vector<double> >("timeShiftHE");
1022  timeShiftHF_ = HCALparameters.getParameter<std::vector<double> >("timeShiftHF");
1023  timeShiftHO_ = HCALparameters.getParameter<std::vector<double> >("timeShiftHO");
1024 
1025  // FastHFShowerLibrary
1026  edm::ParameterSet m_HS = fastCalo.getParameter<edm::ParameterSet>("HFShowerLibrary");
1027  useShowerLibrary = m_HS.getUntrackedParameter<bool>("useShowerLibrary", false);
1028  useCorrectionSL = m_HS.getUntrackedParameter<bool>("useCorrectionSL", false);
1029 }
1030 
1032  int sizeP = p_knots.size();
1033 
1034  if (sizeP <= 1) {
1035  ecorr = 1.;
1036  hcorr = 1.;
1037  } else {
1038  int ip = -1;
1039  for (int i = 0; i < sizeP; i++) {
1040  if (p < p_knots[i]) {
1041  ip = i;
1042  break;
1043  }
1044  }
1045  if (ip == 0) {
1046  ecorr = k_e[0];
1047  hcorr = k_h[0];
1048  } else {
1049  if (ip == -1) {
1050  ecorr = k_e[sizeP - 1];
1051  hcorr = k_h[sizeP - 1];
1052  } else {
1053  double x1 = p_knots[ip - 1];
1054  double x2 = p_knots[ip];
1055  double y1 = k_e[ip - 1];
1056  double y2 = k_e[ip];
1057 
1058  ecorr = (y1 + (y2 - y1) * (p - x1) / (x2 - x1));
1059 
1060  y1 = k_h[ip - 1];
1061  y2 = k_h[ip];
1062  hcorr = (y1 + (y2 - y1) * (p - x1) / (x2 - x1));
1063  }
1064  }
1065  }
1066 
1067  if (debug_)
1068  LogInfo("FastCalorimetry") << " p, ecorr, hcorr = " << p << " " << ecorr << " " << hcorr << std::endl;
1069 }
1070 
1071 void CalorimetryManager::updateECAL(const std::map<CaloHitID, float>& hitMap, int onEcal, int trackID, float corr) {
1072  std::map<CaloHitID, float>::const_iterator mapitr;
1073  std::map<CaloHitID, float>::const_iterator endmapitr = hitMap.end();
1074  if (onEcal == 1) {
1075  EBMapping_.reserve(EBMapping_.size() + hitMap.size());
1076  endmapitr = hitMap.end();
1077  for (mapitr = hitMap.begin(); mapitr != endmapitr; ++mapitr) {
1078  //correct energy
1079  float energy = mapitr->second;
1080  energy *= corr;
1081 
1082  //make finalized CaloHitID
1083  CaloHitID current_id(mapitr->first.unitID(), mapitr->first.timeSlice(), trackID);
1084 
1085  EBMapping_.push_back(std::pair<CaloHitID, float>(current_id, energy));
1086  }
1087  } else if (onEcal == 2) {
1088  EEMapping_.reserve(EEMapping_.size() + hitMap.size());
1089  endmapitr = hitMap.end();
1090  for (mapitr = hitMap.begin(); mapitr != endmapitr; ++mapitr) {
1091  //correct energy
1092  float energy = mapitr->second;
1093  energy *= corr;
1094 
1095  //make finalized CaloHitID
1096  CaloHitID current_id(mapitr->first.unitID(), mapitr->first.timeSlice(), trackID);
1097 
1098  EEMapping_.push_back(std::pair<CaloHitID, float>(current_id, energy));
1099  }
1100  }
1101 }
1102 
1103 void CalorimetryManager::updateHCAL(const std::map<CaloHitID, float>& hitMap, int trackID, float corr) {
1104  std::vector<double> hfcorrEm = myHDResponse_->getCorrHFem();
1105  std::vector<double> hfcorrHad = myHDResponse_->getCorrHFhad();
1106  std::map<CaloHitID, float>::const_iterator mapitr;
1107  std::map<CaloHitID, float>::const_iterator endmapitr = hitMap.end();
1108  HMapping_.reserve(HMapping_.size() + hitMap.size());
1109  for (mapitr = hitMap.begin(); mapitr != endmapitr; ++mapitr) {
1110  //correct energy
1111  float energy = mapitr->second;
1112  energy *= corr;
1113 
1114  float time = mapitr->first.timeSlice();
1115  //put energy into uncalibrated state for digitizer && correct timing
1116  if (HcalDigitizer_) {
1117  HcalDetId hdetid = HcalDetId(mapitr->first.unitID());
1118  if (hdetid.subdetId() == HcalBarrel) {
1119  energy /= samplingHBHE_[hdetid.ietaAbs() - 1]; //re-convert to GeV
1120  time = timeShiftHB_[hdetid.ietaAbs() - ietaShiftHB_];
1121  } else if (hdetid.subdetId() == HcalEndcap) {
1122  energy /= samplingHBHE_[hdetid.ietaAbs() - 1]; //re-convert to GeV
1123  time = timeShiftHE_[hdetid.ietaAbs() - ietaShiftHE_];
1124  } else if (hdetid.subdetId() == HcalForward) {
1125  if (useShowerLibrary) {
1126  if (useCorrectionSL) {
1127  if (hdetid.depth() == 1 or hdetid.depth() == 3)
1128  energy *= hfcorrEm[hdetid.ietaAbs() - ietaShiftHF_];
1129  if (hdetid.depth() == 2 or hdetid.depth() == 4)
1130  energy *= hfcorrHad[hdetid.ietaAbs() - ietaShiftHF_];
1131  }
1132  } else {
1133  if (hdetid.depth() == 1 or hdetid.depth() == 3)
1134  energy *= samplingHF_[0];
1135  if (hdetid.depth() == 2 or hdetid.depth() == 4)
1136  energy *= samplingHF_[1];
1137  time = timeShiftHF_[hdetid.ietaAbs() - ietaShiftHF_];
1138  }
1139  } else if (hdetid.subdetId() == HcalOuter) {
1140  energy /= samplingHO_[hdetid.ietaAbs() - 1];
1141  time = timeShiftHO_[hdetid.ietaAbs() - ietaShiftHO_];
1142  }
1143  }
1144 
1145  //make finalized CaloHitID
1146  CaloHitID current_id(mapitr->first.unitID(), time, trackID);
1147  HMapping_.push_back(std::pair<CaloHitID, float>(current_id, energy));
1148  }
1149 }
1150 
1151 void CalorimetryManager::updatePreshower(const std::map<CaloHitID, float>& hitMap, int trackID, float corr) {
1152  std::map<CaloHitID, float>::const_iterator mapitr;
1153  std::map<CaloHitID, float>::const_iterator endmapitr = hitMap.end();
1154  ESMapping_.reserve(ESMapping_.size() + hitMap.size());
1155  for (mapitr = hitMap.begin(); mapitr != endmapitr; ++mapitr) {
1156  //correct energy
1157  float energy = mapitr->second;
1158  energy *= corr;
1159 
1160  //make finalized CaloHitID
1161  CaloHitID current_id(mapitr->first.unitID(), mapitr->first.timeSlice(), trackID);
1162 
1163  ESMapping_.push_back(std::pair<CaloHitID, float>(current_id, energy));
1164  }
1165 }
1166 
1168  c.reserve(c.size() + EBMapping_.size());
1169  for (unsigned i = 0; i < EBMapping_.size(); i++) {
1170  c.push_back(PCaloHit(EBDetId::unhashIndex(EBMapping_[i].first.unitID()),
1171  EBMapping_[i].second,
1172  EBMapping_[i].first.timeSlice(),
1173  EBMapping_[i].first.trackID()));
1174  }
1175 }
1176 
1178  c.reserve(c.size() + EEMapping_.size());
1179  for (unsigned i = 0; i < EEMapping_.size(); i++) {
1180  c.push_back(PCaloHit(EEDetId::unhashIndex(EEMapping_[i].first.unitID()),
1181  EEMapping_[i].second,
1182  EEMapping_[i].first.timeSlice(),
1183  EEMapping_[i].first.trackID()));
1184  }
1185 }
1186 
1188  c.reserve(c.size() + HMapping_.size());
1189  for (unsigned i = 0; i < HMapping_.size(); i++) {
1190  c.push_back(PCaloHit(DetId(HMapping_[i].first.unitID()),
1191  HMapping_[i].second,
1192  HMapping_[i].first.timeSlice(),
1193  HMapping_[i].first.trackID()));
1194  }
1195 }
1196 
1198  c.reserve(c.size() + ESMapping_.size());
1199  for (unsigned i = 0; i < ESMapping_.size(); i++) {
1200  c.push_back(PCaloHit(ESMapping_[i].first.unitID(),
1201  ESMapping_[i].second,
1202  ESMapping_[i].first.timeSlice(),
1203  ESMapping_[i].first.trackID()));
1204  }
1205 }
1206 
1207 // The main danger in this method is to screw up to relationships between particles
1208 // So, the muon FSimTracks created by FSimEvent.cc are simply to be updated
1210  unsigned size = muons.size();
1211  for (unsigned i = 0; i < size; ++i) {
1212  int id = muons[i].trackId();
1213  if (!(abs(muons[i].type()) == 13 || abs(muons[i].type()) == 1000024 ||
1214  (abs(muons[i].type()) > 1000100 && abs(muons[i].type()) < 1999999)))
1215  continue;
1216  // identify the corresponding muon in the local collection
1217 
1218  std::vector<FSimTrack>::const_iterator itcheck =
1219  find_if(muonSimTracks.begin(), muonSimTracks.end(), FSimTrackEqual(id));
1220  if (itcheck != muonSimTracks.end()) {
1221  muons[i].setTkPosition(itcheck->trackerSurfacePosition());
1222  muons[i].setTkMomentum(itcheck->trackerSurfaceMomentum());
1223  }
1224  }
1225 }
1226 
1228  c.reserve(int(0.2 * muonSimTracks.size() + 0.2 * savedMuonSimTracks.size() + 0.5));
1229  for (const auto& track : muonSimTracks) {
1230  if (track.momentum().perp2() > 1.0 && fabs(track.momentum().eta()) < 3.0 && track.isGlobal())
1231  c.push_back(track);
1232  }
1233  for (const auto& track : savedMuonSimTracks) {
1234  if (track.momentum().perp2() > 1.0 && fabs(track.momentum().eta()) < 3.0 && track.isGlobal())
1235  c.push_back(track);
1236  }
1237  c.shrink_to_fit();
1238 }
CalorimetryManager::hdGridSize_
int hdGridSize_
Definition: CalorimetryManager.h:149
CalorimetryManager::hdSimMethod_
int hdSimMethod_
Definition: CalorimetryManager.h:149
EcalHitMaker::setRadiusFactor
void setRadiusFactor(double r)
Definition: EcalHitMaker.h:125
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
CalorimetryManager::myPosi
RawParticle myPosi
Definition: CalorimetryManager.h:133
GflashHit.h
FastHFShowerLibrary.h
rawparticle::makeMuon
RawParticle makeMuon(bool isParticle, const math::XYZTLorentzVector &p, const math::XYZTLorentzVector &xStart)
Definition: makeMuon.cc:20
FSimTrack::charge
float charge() const
charge
Definition: FSimTrack.h:56
L1TDiffHarvesting_cfi.dir2
dir2
Definition: L1TDiffHarvesting_cfi.py:12
HCALResponse::getCorrHFem
vec1 & getCorrHFem()
Definition: HCALResponse.h:47
CalorimetryManager::myElec
RawParticle myElec
A few pointers to save time.
Definition: CalorimetryManager.h:132
RawParticle
Definition: RawParticle.h:37
CalorimetryManager::aGammaGenerator
GammaFunctionGenerator * aGammaGenerator
Definition: CalorimetryManager.h:154
mps_fire.i
i
Definition: mps_fire.py:428
FSimEvent
Definition: FSimEvent.h:29
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
HCALResponse::getHCALEnergyResponse
double getHCALEnergyResponse(double e, int hit, RandomEngineAndDistribution const *)
Definition: HCALResponse.cc:563
Calorimeter::hcalProperties
const HCALProperties * hcalProperties(int onHcal) const
HCAL properties.
Definition: Calorimeter.cc:88
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
CaloGeometryHelper::preshowerPresent
bool preshowerPresent() const
Definition: CaloGeometryHelper.h:51
funct::false
false
Definition: Factorize.h:29
CalorimetryManager::useShowerLibrary
bool useShowerLibrary
Definition: CalorimetryManager.h:188
CalorimetryManager::myHSParameters_
HSParameters * myHSParameters_
Definition: CalorimetryManager.h:107
HSParameters.h
EnergyLossSimulator.h
FSimTrack::onLayer2
int onLayer2() const
Definition: FSimTrack.h:106
CalorimetryManager::~CalorimetryManager
~CalorimetryManager()
Definition: CalorimetryManager.cc:131
FBaseSimEvent::print
void print() const
print the FBaseSimEvent in an intelligible way
Definition: FBaseSimEvent.cc:632
CalorimetryManager::theMuonEcalEffects
MaterialEffects * theMuonEcalEffects
Definition: CalorimetryManager.h:172
GflashTrajectoryPoint.h
FSimTrack::onLayer1
int onLayer1() const
Definition: FSimTrack.h:101
RawParticle::momentum
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:321
Calorimeter::ecalProperties
const ECALProperties * ecalProperties(int onEcal) const
ECAL properties.
Definition: Calorimeter.cc:78
EcalHitMaker::setTrackParameters
void setTrackParameters(const XYZNormal &normal, double X0depthoffset, const FSimTrack &theTrack)
Definition: EcalHitMaker.cc:304
CalorimetryManager::harvestMuonSimTracks
void harvestMuonSimTracks(edm::SimTrackContainer &m) const
Definition: CalorimetryManager.cc:1227
mps_update.status
status
Definition: mps_update.py:69
HLT_FULL_cff.scale
scale
Definition: HLT_FULL_cff.py:6637
Calorimeter::layer2Properties
const PreshowerLayer2Properties * layer2Properties(int onLayer2) const
Preshower Layer2 properties.
Definition: Calorimeter.cc:110
RawParticle::vertex
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:320
edm
HLT enums.
Definition: AlignableModifier.h:19
FastHFShowerLibrary::recoHFShowerLibrary
void recoHFShowerLibrary(const FSimTrack &myTrack)
Definition: FastHFShowerLibrary.cc:83
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
CalorimetryManager::loadFromEcalEndcap
void loadFromEcalEndcap(edm::PCaloHitContainer &c) const
Definition: CalorimetryManager.cc:1177
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CalorimetryManager::EcalDigitizer_
bool EcalDigitizer_
Definition: CalorimetryManager.h:120
Gflash3Vector.h
FSimTrack::layer1Entrance
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
Definition: FSimTrack.h:137
CalorimetryManager::thePiKProfile
GflashPiKShowerProfile * thePiKProfile
Definition: CalorimetryManager.h:183
CalorimetryManager::theMuonHcalEffects
MaterialEffects * theMuonHcalEffects
Definition: CalorimetryManager.h:173
EBDetId.h
SimTrack::setTkPosition
void setTkPosition(const math::XYZVectorD &pos)
Definition: SimTrack.h:41
EEDetId.h
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
CalorimetryManager::aTerm
double aTerm
Definition: CalorimetryManager.h:143
CalorimetryManager::myPart
RawParticle myPart
Definition: CalorimetryManager.h:134
CalorimetryManager::HcalDigitizer_
bool HcalDigitizer_
Definition: CalorimetryManager.h:121
FSimTrack.h
HcalHitMaker::getHits
const std::map< CaloHitID, float > & getHits() override
Definition: HcalHitMaker.h:35
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
CalorimetryManager::muonSimTracks
std::vector< FSimTrack > muonSimTracks
Definition: CalorimetryManager.h:170
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
HDRShower.h
FSimTrackEqual.h
CalorimetryManager::simulatePreshower_
bool simulatePreshower_
Definition: CalorimetryManager.h:150
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
DetId::null
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
CalorimetryManager::samplingHF_
std::vector< double > samplingHF_
Definition: CalorimetryManager.h:123
HDRShower
Definition: HDRShower.h:22
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
FSimTrack::layer2Entrance
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
Definition: FSimTrack.h:140
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
CalorimetryManager::loadFromHcal
void loadFromHcal(edm::PCaloHitContainer &c) const
Definition: CalorimetryManager.cc:1187
CalorimetryManager::theHFShowerLibrary
FastHFShowerLibrary * theHFShowerLibrary
Definition: CalorimetryManager.h:190
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
PreshowerHitMaker::getHits
const std::map< CaloHitID, float > & getHits() override
Definition: PreshowerHitMaker.h:30
HcalBarrel
Definition: HcalAssistant.h:33
Calorimeter::layer1Properties
const PreshowerLayer1Properties * layer1Properties(int onLayer1) const
Preshower Layer1 properties.
Definition: Calorimeter.cc:103
GammaFunctionGenerator
Definition: GammaFunctionGenerator.h:21
Gflash::intLength
const double intLength[kNumberCalorimeter]
Definition: GflashNameSpace.h:58
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
CalorimetryManager::samplingHBHE_
std::vector< double > samplingHBHE_
Definition: CalorimetryManager.h:122
FSimEvent::nTracks
unsigned int nTracks() const
Number of tracks.
Definition: FSimEvent.cc:24
MaterialEffects_cfi.MaterialEffects
MaterialEffects
Definition: MaterialEffects_cfi.py:5
HDShower::compute
bool compute()
Compute the shower longitudinal and lateral development.
Definition: HDShower.cc:453
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
RandomEngineAndDistribution.h
EMShower::setHcal
void setHcal(HcalHitMaker *const myHcal)
set the HCAL address
Definition: EMShower.cc:661
HDRShower::computeShower
bool computeShower()
Definition: HDRShower.cc:41
HcalGeometry.h
CalorimetryManager::optionHDSim_
int optionHDSim_
Definition: CalorimetryManager.h:149
GammaFunctionGenerator.h
HcalResponse_cfi.HCALResponse
HCALResponse
Definition: HcalResponse_cfi.py:15
MaterialEffectsSimulator::updateState
void updateState(ParticlePropagator &myTrack, double radlen, RandomEngineAndDistribution const *)
Compute the material effect (calls the sub class)
Definition: MaterialEffectsSimulator.cc:19
HFShower::compute
bool compute()
Compute the shower longitudinal and lateral development.
Definition: HFShower.cc:461
EDMException.h
DetId
Definition: DetId.h:17
FSimEvent.h
CalorimetryManager::gridSize_
int gridSize_
Definition: CalorimetryManager.h:145
CalorimetryManager::RCFactor_
double RCFactor_
Definition: CalorimetryManager.h:147
CalorimetryManager::CalorimetryManager
CalorimetryManager()
Definition: CalorimetryManager.cc:74
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
CalorimetryManager::k_h
std::vector< double > k_h
Definition: CalorimetryManager.h:163
Gflash::kHB
Definition: GflashNameSpace.h:13
CalorimetryManager::timeShiftHF_
std::vector< double > timeShiftHF_
Definition: CalorimetryManager.h:128
CalorimetryManager::timeShiftHE_
std::vector< double > timeShiftHE_
Definition: CalorimetryManager.h:127
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
CaloGeometryHelper::getClosestCell
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
Definition: CaloGeometryHelper.cc:58
EcalHitMaker::setPulledPadSurvivalProbability
void setPulledPadSurvivalProbability(double val)
Definition: EcalHitMaker.h:127
CalorimetryManager::theTailIntervals_
std::vector< double > theTailIntervals_
Definition: CalorimetryManager.h:146
EMShower
Definition: EMShower.h:26
Gflash::kHE
Definition: GflashNameSpace.h:15
Gflash::kENCA
Definition: GflashNameSpace.h:14
FBaseSimEvent::track
FSimTrack & track(int id) const
Return track with given Id.
Gflash::kNULL
Definition: GflashNameSpace.h:11
GflashProtonShowerProfile
Definition: GflashProtonShowerProfile.h:6
FSimTrack::vfcalEntrance
const RawParticle & vfcalEntrance() const
The particle at VFCAL entrance.
Definition: FSimTrack.h:149
FSimTrack::onHcal
int onHcal() const
Definition: FSimTrack.h:116
CalorimetryManager::ecorr
double ecorr
Definition: CalorimetryManager.h:164
CalorimetryManager::pulledPadSurvivalProbability_
double pulledPadSurvivalProbability_
Definition: CalorimetryManager.h:137
CalorimetryManager::reconstructTrack
void reconstructTrack(FSimTrack &myTrack, RandomEngineAndDistribution const *)
Definition: CalorimetryManager.cc:188
CalorimetryManager::loadFromPreshower
void loadFromPreshower(edm::PCaloHitContainer &c) const
Definition: CalorimetryManager.cc:1197
CalorimetryManager::timeShiftHO_
std::vector< double > timeShiftHO_
Definition: CalorimetryManager.h:129
MaterialEffects::energyLossSimulator
EnergyLossSimulator * energyLossSimulator() const
Return the Energy Loss engine.
Definition: MaterialEffects.h:80
CaloSegment::PbWO4
Definition: CaloSegment.h:20
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
CalorimetryManager::radiusPreshowerCorrections_
std::vector< double > radiusPreshowerCorrections_
Definition: CalorimetryManager.h:142
CalorimetryManager::myHDResponse_
HCALResponse * myHDResponse_
Definition: CalorimetryManager.h:106
EcalHitMaker::setPreshowerPresent
void setPreshowerPresent(bool ps)
Definition: EcalHitMaker.h:132
RawParticle::eta
double eta() const
Definition: RawParticle.h:279
FSimTrack::hcalEntrance
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
Definition: FSimTrack.h:146
SimTrack::setTkMomentum
void setTkMomentum(const math::XYZTLorentzVectorD &mom)
Definition: SimTrack.h:43
CalorimetryManager::reconstructHCAL
void reconstructHCAL(const FSimTrack &myTrack, RandomEngineAndDistribution const *)
Definition: CalorimetryManager.cc:439
CalorimetryManager::theAntiProtonProfile
GflashAntiProtonShowerProfile * theAntiProtonProfile
Definition: CalorimetryManager.h:185
CalorimetryManager::EEMapping_
std::vector< std::pair< CaloHitID, float > > EEMapping_
Definition: CalorimetryManager.h:110
CaloSegment::HCAL
Definition: CaloSegment.h:20
HcalOuter
Definition: HcalAssistant.h:35
GflashShowino::getPathLengthOnEcal
double getPathLengthOnEcal()
Definition: GflashShowino.h:28
GflashHadronShowerProfile::initialize
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)
Definition: GflashHadronShowerProfile.cc:30
CalorimetryManager::mipValues_
std::vector< double > mipValues_
Definition: CalorimetryManager.h:144
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
L1TDiffHarvesting_cfi.dir1
dir1
Definition: L1TDiffHarvesting_cfi.py:10
CalorimetryManager::ietaShiftHF_
int ietaShiftHF_
Definition: CalorimetryManager.h:125
XYZVector
math::XYZVector XYZVector
Definition: CalorimetryManager.cc:68
FSimTrack::ecalEntrance
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
Definition: FSimTrack.h:143
CalorimetryManager::readParameters
void readParameters(const edm::ParameterSet &fastCalo)
Definition: CalorimetryManager.cc:909
FSimTrack::onVFcal
int onVFcal() const
Definition: FSimTrack.h:121
ParticlePropagator.h
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
FastHFShowerLibrary
Definition: FastHFShowerLibrary.h:38
FSimEvent::id
edm::EventID id() const
Method to return the EventId.
Definition: FSimEvent.cc:20
RawParticle::Vect
XYZVector Vect() const
the momentum threevector
Definition: RawParticle.h:323
FBaseSimEvent::theTable
const HepPDT::ParticleDataTable * theTable() const
Get the pointer to the particle data table.
Definition: FBaseSimEvent.h:54
HFShower
Definition: HFShower.h:22
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EMShower::compute
void compute()
Compute the shower longitudinal and lateral development.
Definition: EMShower.cc:263
EMShower::setGrid
void setGrid(EcalHitMaker *const myGrid)
set the grid address
Definition: EMShower.h:58
CalorimetryManager::updateECAL
void updateECAL(const std::map< CaloHitID, float > &hitMap, int onEcal, int trackID=0, float corr=1.0)
Definition: CalorimetryManager.cc:1071
GflashHadronShowerProfile::getGflashHitList
std::vector< GflashHit > & getGflashHitList()
Definition: GflashHadronShowerProfile.h:33
GflashHadronShowerProfile::loadParameters
virtual void loadParameters()
Definition: GflashHadronShowerProfile.cc:247
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
FSimTrack::id
int id() const
the index in FBaseSimEvent and other vectors
Definition: FSimTrack.h:96
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
FSimTrackEqual
Definition: FSimTrackEqual.h:6
MuonBremsstrahlungSimulator.h
CaloSubdetectorGeometry.h
CalorimetryManager::theProtonProfile
GflashProtonShowerProfile * theProtonProfile
Definition: CalorimetryManager.h:184
Gflash::getCalorimeterNumber
CalorimeterNumber getCalorimeterNumber(const Gflash3Vector &position)
Definition: GflashNameSpace.cc:7
fastsim::Constants::eMass
static constexpr double eMass
Electron mass[GeV].
Definition: Constants.h:13
CalorimetryManager::ESMapping_
std::vector< std::pair< CaloHitID, float > > ESMapping_
Definition: CalorimetryManager.h:112
edm::ParameterSet
Definition: ParameterSet.h:47
MaterialEffects.h
HCALResponse::responseHCAL
double responseHCAL(int _mip, double energy, double eta, int partype, RandomEngineAndDistribution const *)
Definition: HCALResponse.cc:280
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
Calorimeter::getHcalGeometry
const CaloSubdetectorGeometry * getHcalGeometry() const
Definition: Calorimeter.h:56
CaloGeometryHelper.h
pfMETCorrectionType0_cfi.correction
correction
Definition: pfMETCorrectionType0_cfi.py:39
CalorimetryManager::HDShowerSimulation
void HDShowerSimulation(const FSimTrack &myTrack, RandomEngineAndDistribution const *)
Hadronic Shower Simulation.
Definition: CalorimetryManager.cc:490
CalorimetryManager::aLandauGenerator
const LandauFluctuationGenerator * aLandauGenerator
Definition: CalorimetryManager.h:153
HDShowerParametrization
Definition: HDShowerParametrization.h:15
EMECALShowerParametrization.h
GeV
const double GeV
Definition: MathUtil.h:16
PreshowerHitMaker
Definition: PreshowerHitMaker.h:11
HcalDetId.h
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
CalorimetryManager::ietaShiftHO_
int ietaShiftHO_
Definition: CalorimetryManager.h:125
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
ParticlePropagator
Definition: ParticlePropagator.h:28
CalorimetryManager::p_knots
std::vector< double > p_knots
Definition: CalorimetryManager.h:161
FastHFShowerLibrary::getHitsMap
const std::map< CaloHitID, float > & getHitsMap()
Definition: FastHFShowerLibrary.h:48
Gflash::CalorimeterNumber
CalorimeterNumber
Definition: GflashNameSpace.h:10
CalorimetryManager::RTFactor_
double RTFactor_
Definition: CalorimetryManager.h:147
CalorimetryManager::theCoreIntervals_
std::vector< double > theCoreIntervals_
Definition: CalorimetryManager.h:146
CalorimetryManager::bTerm
double bTerm
Definition: CalorimetryManager.h:143
CalorimetryManager::EMShowerSimulation
void EMShowerSimulation(const FSimTrack &myTrack, RandomEngineAndDistribution const *)
Definition: CalorimetryManager.cc:229
CalorimetryManager::initialized_
bool initialized_
Definition: CalorimetryManager.h:168
CalorimetryManager.h
HCALResponse::getMIPfraction
double getMIPfraction(double energy, double eta)
Definition: HCALResponse.cc:247
GflashProtonShowerProfile.h
EMShower::setPreshower
void setPreshower(PreshowerHitMaker *const myPresh)
set the preshower address
Definition: EMShower.cc:654
Gflash3Vector
CLHEP::Hep3Vector Gflash3Vector
Definition: Gflash3Vector.h:6
HcalHitMaker
Definition: HcalHitMaker.h:16
CoreSimTrack::type
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
CalorimetryManager::useCorrectionSL
bool useCorrectionSL
Definition: CalorimetryManager.h:189
HcalSubdetector.h
particleFlowClusterECALTimeSelected_cfi.maxEnergy
maxEnergy
Definition: particleFlowClusterECALTimeSelected_cfi.py:10
PCaloHit
Definition: PCaloHit.h:8
CalorimetryManager::myCalorimeter_
CaloGeometryHelper * myCalorimeter_
Definition: CalorimetryManager.h:102
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HSParameters_cfi.HSParameters
HSParameters
Definition: HSParameters_cfi.py:4
CalorimetryManager::loadFromEcalBarrel
void loadFromEcalBarrel(edm::PCaloHitContainer &c) const
Definition: CalorimetryManager.cc:1167
CalorimetryManager::rsp
std::vector< double > rsp
Definition: CalorimetryManager.h:160
CalorimetryManager::reconstruct
void reconstruct(RandomEngineAndDistribution const *)
Definition: CalorimetryManager.cc:149
FSimTrack::momentum
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
Definition: FSimTrack.h:209
RandomEngineAndDistribution::flatShoot
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition: RandomEngineAndDistribution.h:27
XYZPoint
math::XYZVector XYZPoint
Definition: CalorimetryManager.cc:69
EMShower.h
CalorimetryManager::ecalCorrection
std::unique_ptr< KKCorrectionFactors > ecalCorrection
Definition: CalorimetryManager.h:192
HcalHitMaker::setDepth
bool setDepth(double, bool inCm=false)
set the depth in X0 or Lambda0 units depending on showerType
Definition: HcalHitMaker.cc:114
PreshowerHitMaker::setMipEnergy
void setMipEnergy(double e1, double e2)
Definition: PreshowerHitMaker.h:32
EMECALShowerParametrization
Definition: EMECALShowerParametrization.h:19
EcalHitMaker::setCrackPadSurvivalProbability
void setCrackPadSurvivalProbability(double val)
Definition: EcalHitMaker.h:129
GflashAntiProtonShowerProfile
Definition: GflashAntiProtonShowerProfile.h:6
HFShower.h
HcalForward
Definition: HcalAssistant.h:36
CalorimetryManager::initialize
void initialize(RandomEngineAndDistribution const *random)
Definition: CalorimetryManager.cc:169
CalorimetryManager::radiusFactorEB_
double radiusFactorEB_
Definition: CalorimetryManager.h:141
FSimTrack::noEndVertex
bool noEndVertex() const
no end vertex
HCALResponse::correctHF
void correctHF(double e, int type)
Definition: HCALResponse.cc:634
CalorimetryManager::debug_
bool debug_
Definition: CalorimetryManager.h:114
CalorimetryManager::radiusFactorEE_
double radiusFactorEE_
Definition: CalorimetryManager.h:141
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CalorimetryManager::loadMuonSimTracks
void loadMuonSimTracks(edm::SimTrackContainer &m) const
Definition: CalorimetryManager.cc:1209
ECALProperties::radLenIncm
double radLenIncm() const override
Radiation length in cm.
Definition: ECALProperties.h:32
EMShower::getMaximumOfShower
double getMaximumOfShower() const
get the depth of the centre of gravity of the shower(s)
Definition: EMShower.h:55
RawParticle::e
double e() const
energy of the momentum
Definition: RawParticle.h:305
CalorimetryManager::respCorr
void respCorr(double)
Definition: CalorimetryManager.cc:1031
CalorimetryManager::bFixedLength_
bool bFixedLength_
Definition: CalorimetryManager.h:179
edm::SimTrackContainer
std::vector< SimTrack > SimTrackContainer
Definition: SimTrackContainer.h:12
CalorimetryManager::timeShiftHB_
std::vector< double > timeShiftHB_
Definition: CalorimetryManager.h:126
HcalEndcap
Definition: HcalAssistant.h:34
DetId.h
CalorimetryManager::clean
void clean()
Definition: CalorimetryManager.cc:122
CalorimetryManager::ietaShiftHE_
int ietaShiftHE_
Definition: CalorimetryManager.h:125
RawParticle::setVertex
void setVertex(const XYZTLorentzVector &vtx)
set the vertex
Definition: RawParticle.h:325
CaloHitID
Definition: CaloHitID.h:11
GflashPiKShowerProfile.h
GflashShowino::getHelix
GflashTrajectory * getHelix()
Definition: GflashShowino.h:33
EnergyLossSimulator::deltaMom
const XYZTLorentzVector & deltaMom() const
Returns the actual energy lost.
Definition: EnergyLossSimulator.h:37
EcalHitMaker
Definition: EcalHitMaker.h:24
LandauFluctuationGenerator.h
CalorimetryManager::myZero_
static std::vector< std::pair< int, float > > myZero_
Definition: CalorimetryManager.h:156
edm::PCaloHitContainer
std::vector< PCaloHit > PCaloHitContainer
Definition: PCaloHitContainer.h:8
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
CalorimetryManager::mySimEvent
FSimEvent * mySimEvent
Definition: CalorimetryManager.h:101
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HDShowerParametrization.h
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
GflashHadronShowerProfile.h
CalorimetryManager::samplingHO_
std::vector< double > samplingHO_
Definition: CalorimetryManager.h:124
EnergyLossSimulator
Definition: EnergyLossSimulator.h:25
CalorimetryManager::evtsToDebug_
std::vector< unsigned int > evtsToDebug_
Definition: CalorimetryManager.h:115
CalorimetryManager::savedMuonSimTracks
std::vector< FSimTrack > savedMuonSimTracks
Definition: CalorimetryManager.h:171
FSimTrack
Definition: FSimTrack.h:30
HcalHitMaker::addHit
bool addHit(double r, double phi, unsigned layer=0) override
add the hit in the HCAL in local coordinates
Definition: HcalHitMaker.cc:30
FastHFShowerLibrary::SetRandom
void SetRandom(const RandomEngineAndDistribution *)
Definition: FastHFShowerLibrary.cc:76
CalorimetryManager::theProfile
GflashHadronShowerProfile * theProfile
Definition: CalorimetryManager.h:182
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalDetId::ietaAbs
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
ParameterSet.h
CalorimetryManager::spotFraction_
double spotFraction_
Definition: CalorimetryManager.h:139
CalorimetryManager::ietaShiftHB_
int ietaShiftHB_
Definition: CalorimetryManager.h:125
GflashHadronShowerProfile
Definition: GflashHadronShowerProfile.h:15
CalorimetryManager::MuonMipSimulation
void MuonMipSimulation(const FSimTrack &myTrack, RandomEngineAndDistribution const *)
Definition: CalorimetryManager.cc:727
PbPb_ZMuSkimMuonDPG_cff.particleType
particleType
Definition: PbPb_ZMuSkimMuonDPG_cff.py:27
CalorimetryManager::EBMapping_
std::vector< std::pair< CaloHitID, float > > EBMapping_
Definition: CalorimetryManager.h:109
GflashHadronShowerProfile::getGflashShowino
GflashShowino * getGflashShowino()
Definition: GflashHadronShowerProfile.h:32
ntuplemaker.time
time
Definition: ntuplemaker.py:310
HDShower::getmip
int getmip()
Definition: HDShower.h:39
FSimTrack::onEcal
int onEcal() const
Definition: FSimTrack.h:111
CaloGeometryHelper
Definition: CaloGeometryHelper.h:18
HDShower
Definition: HDShower.h:22
HcalHitMaker::setSpotEnergy
void setSpotEnergy(double e) override
Set the spot energy.
Definition: HcalHitMaker.h:26
CalorimetryManager::updateHCAL
void updateHCAL(const std::map< CaloHitID, float > &hitMap, int trackID=0, float corr=1.0)
Definition: CalorimetryManager.cc:1103
HcalGeometry
Definition: HcalGeometry.h:17
GflashShowino::getPathLengthAtShower
double getPathLengthAtShower()
Definition: GflashShowino.h:29
GflashTrajectoryPoint
Definition: GflashTrajectoryPoint.h:8
GflashAntiProtonShowerProfile.h
LandauFluctuationGenerator
Definition: LandauFluctuationGenerator.h:20
HCALResponse::getCorrHFhad
vec1 & getCorrHFhad()
Definition: HCALResponse.h:48
CalorimetryManager::crackPadSurvivalProbability_
double crackPadSurvivalProbability_
Definition: CalorimetryManager.h:138
CalorimetryManager::hcorr
double hcorr
Definition: CalorimetryManager.h:165
weight
Definition: weight.py:1
hit
Definition: SiStripHitEffFromCalibTree.cc:88
Gflash::kESPM
Definition: GflashNameSpace.h:12
CalorimetryManager::updatePreshower
void updatePreshower(const std::map< CaloHitID, float > &hitMap, int trackID=0, float corr=1.0)
Definition: CalorimetryManager.cc:1151
HDShower.h
GflashHadronShowerProfile::hadronicParameterization
void hadronicParameterization()
Definition: GflashHadronShowerProfile.cc:36
GflashTrajectory::getGflashTrajectoryPoint
void getGflashTrajectoryPoint(GflashTrajectoryPoint &point, double s) const
Definition: GflashTrajectory.cc:155
GflashPiKShowerProfile
Definition: GflashPiKShowerProfile.h:6
CalorimetryManager::HMapping_
std::vector< std::pair< CaloHitID, float > > HMapping_
Definition: CalorimetryManager.h:111
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
CalorimetryManager::k_e
std::vector< double > k_e
Definition: CalorimetryManager.h:162
EcalHitMaker::getHits
const std::map< CaloHitID, float > & getHits() override
Definition: EcalHitMaker.cc:1097
RandomEngineAndDistribution
Definition: RandomEngineAndDistribution.h:18