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 
29  : Phase2TrackerDigitizerAlgorithm(conf.getParameter<ParameterSet>("AlgorithmCommon"),
30  conf.getParameter<ParameterSet>("PSPDigitizerAlgorithm")) {
31  pixelFlag = false;
32  LogInfo("PSPDigitizerAlgorithm") << "Algorithm constructed "
33  << "Configuration parameters:"
34  << "Threshold/Gain = "
35  << "threshold in electron Endcap = " << theThresholdInE_Endcap
36  << "threshold in electron Barrel = " << theThresholdInE_Barrel << " "
37  << theElectronPerADC << " " << theAdcFullScale << " The delta cut-off is set to "
38  << tMax << " pix-inefficiency " << AddPixelInefficiency;
39 }
40 PSPDigitizerAlgorithm::~PSPDigitizerAlgorithm() { LogDebug("PSPDigitizerAlgorithm") << "Algorithm deleted"; }
41 void PSPDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
42  std::vector<PSimHit>::const_iterator inputEnd,
43  const size_t inputBeginGlobalIndex,
44  const unsigned int tofBin,
45  const Phase2TrackerGeomDetUnit* pixdet,
46  const GlobalVector& bfield) {
47  // produce SignalPoint's for all SimHit's in detector
48  // Loop over hits
49  uint32_t detId = pixdet->geographicalId().rawId();
50  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later
51  for (auto it = inputBegin; it != inputEnd; ++it, ++simHitGlobalIndex) {
52  // skip hits not in this detector.
53  if ((*it).detUnitId() != detId)
54  continue;
55 
56  LogDebug("PSPDigitizerAlgorithm") << (*it).particleType() << " " << (*it).pabs() << " " << (*it).energyLoss() << " "
57  << (*it).tof() << " " << (*it).trackId() << " " << (*it).processType() << " "
58  << (*it).detUnitId() << (*it).entryPoint() << " " << (*it).exitPoint();
59 
60  std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
61  std::vector<DigitizerUtility::SignalPoint> collection_points;
62 
63  // fill collection_points for this SimHit, indpendent of topology
64  // Check the TOF cut
65  if (((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag() / 30.) >= theTofLowerCut &&
66  ((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag() / 30.) <= theTofUpperCut) {
67  primary_ionization(*it, ionization_points); // fills _ionization_points
68  // transforms _ionization_points to collection_points
69  drift(*it, pixdet, bfield, ionization_points, collection_points);
70 
71  // compute induced signal on readout elements and add to _signal
72  // *ihit needed only for SimHit<-->Digi link
73  induce_signal(*it, simHitGlobalIndex, tofBin, pixdet, collection_points);
74  }
75  }
76 }
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:81
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:57
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
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:73
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