CMS 3D CMS Logo

PSPDigitizerAlgorithm.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cmath>
3 
7 
9 
11 #include "CLHEP/Random/RandGaussQ.h"
12 #include "CLHEP/Random/RandFlat.h"
13 
18 
19 // Geometry
24 
25 using namespace edm;
26 
28  es.get<TrackerDigiGeometryRecord>().get(geom_);
29 }
31  Phase2TrackerDigitizerAlgorithm(conf.getParameter<ParameterSet>("AlgorithmCommon"),
32  conf.getParameter<ParameterSet>("PSPDigitizerAlgorithm"))
33 {
34  pixelFlag = false;
35  LogInfo("PSPDigitizerAlgorithm") << "Algorithm constructed "
36  << "Configuration parameters:"
37  << "Threshold/Gain = "
38  << "threshold in electron Endcap = "
40  << "threshold in electron Barrel = "
42  << " " << theElectronPerADC << " " << theAdcFullScale
43  << " The delta cut-off is set to " << tMax
44  << " pix-inefficiency " << AddPixelInefficiency;
45 }
47  LogDebug("PSPDigitizerAlgorithm") << "Algorithm deleted";
48 }
49 void PSPDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
50  std::vector<PSimHit>::const_iterator inputEnd,
51  const size_t inputBeginGlobalIndex,
52  const unsigned int tofBin,
53  const Phase2TrackerGeomDetUnit* pixdet,
54  const GlobalVector& bfield) {
55  // produce SignalPoint's for all SimHit's in detector
56  // Loop over hits
57  uint32_t detId = pixdet->geographicalId().rawId();
58  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later
59  for (auto it = inputBegin; it != inputEnd; ++it, ++simHitGlobalIndex) {
60  // skip hits not in this detector.
61  if ((*it).detUnitId() != detId)
62  continue;
63 
64  LogDebug("PSPDigitizerAlgorithm")
65  << (*it).particleType() << " " << (*it).pabs() << " "
66  << (*it).energyLoss() << " " << (*it).tof() << " "
67  << (*it).trackId() << " " << (*it).processType() << " "
68  << (*it).detUnitId()
69  << (*it).entryPoint() << " " << (*it).exitPoint();
70 
71  std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
72  std::vector<DigitizerUtility::SignalPoint> collection_points;
73 
74  // fill collection_points for this SimHit, indpendent of topology
75  // Check the TOF cut
76  if (((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) >= theTofLowerCut &&
77  ((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) <= theTofUpperCut) {
78  primary_ionization(*it, ionization_points); // fills _ionization_points
79  drift(*it, pixdet, bfield, ionization_points, collection_points); // transforms _ionization_points to collection_points
80 
81  // compute induced signal on readout elements and add to _signal
82  induce_signal(*it, simHitGlobalIndex, tofBin, pixdet, collection_points); // *ihit needed only for SimHit<-->Digi link
83  }
84  }
85 }
void primary_ionization(const PSimHit &hit, std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points) const
#define LogDebug(id)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
PSPDigitizerAlgorithm(const edm::ParameterSet &conf)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void drift(const PSimHit &hit, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points, std::vector< DigitizerUtility::SignalPoint > &collection_points) const
void init(const edm::EventSetup &es) override
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
void induce_signal(const PSimHit &hit, const size_t hitIndex, const unsigned int tofBin, const Phase2TrackerGeomDetUnit *pixdet, const std::vector< DigitizerUtility::SignalPoint > &collection_points)
HLT enums.
T get() const
Definition: EventSetup.h:63
void accumulateSimHits(const std::vector< PSimHit >::const_iterator inputBegin, const std::vector< PSimHit >::const_iterator inputEnd, const size_t inputBeginGlobalIndex, const unsigned int tofBin, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield) override