CMS 3D CMS Logo

PixelDigitizerAlgorithm.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cmath>
3 
7 
10 
12 #include "CLHEP/Random/RandGaussQ.h"
13 #include "CLHEP/Random/RandFlat.h"
14 
20 
38 
39 // Geometry
45 
46 using namespace edm;
47 using namespace sipixelobjects;
48 
50  if (use_ineff_from_db_) // load gain calibration service fromdb...
51  theSiPixelGainCalibrationService_->setESObjects(es);
52 
53  if (use_deadmodule_DB_)
54  es.get<SiPixelQualityRcd>().get(SiPixelBadModule_);
55 
56  if (use_LorentzAngle_DB_) // Get Lorentz angle from DB record
57  es.get<SiPixelLorentzAngleSimRcd>().get(SiPixelLorentzAngle_);
58 
59  // gets the map and geometry from the DB (to kill ROCs)
60  es.get<SiPixelFedCablingMapRcd>().get(map_);
61  es.get<TrackerDigiGeometryRecord>().get(geom_);
62 }
63 
64 PixelDigitizerAlgorithm::PixelDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng) :
65  Phase2TrackerDigitizerAlgorithm(conf.getParameter<ParameterSet>("AlgorithmCommon"),
66  conf.getParameter<ParameterSet>("PixelDigitizerAlgorithm"),
67  eng)
68 {
69  pixelFlag = true;
70  LogInfo("PixelDigitizerAlgorithm") << "Algorithm constructed "
71  << "Configuration parameters:"
72  << "Threshold/Gain = "
73  << "threshold in electron Endcap = "
75  << "threshold in electron Barrel = "
77  << " " << theElectronPerADC << " " << theAdcFullScale
78  << " The delta cut-off is set to " << tMax
79  << " pix-inefficiency " << AddPixelInefficiency;
80 }
82  LogDebug("PixelDigitizerAlgorithm") << "Algorithm deleted";
83 }
84 void PixelDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
85  std::vector<PSimHit>::const_iterator inputEnd,
86  const size_t inputBeginGlobalIndex,
87  const unsigned int tofBin,
88  const Phase2TrackerGeomDetUnit* pixdet,
89  const GlobalVector& bfield) {
90  // produce SignalPoint's for all SimHit's in detector
91  // Loop over hits
92  uint32_t detId = pixdet->geographicalId().rawId();
93  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later
94  for (auto it = inputBegin; it != inputEnd; ++it, ++simHitGlobalIndex) {
95  // skip hits not in this detector.
96  if ((*it).detUnitId() != detId)
97  continue;
98 
99  LogDebug ("PixelDigitizerAlgorithm")
100  << (*it).particleType() << " " << (*it).pabs() << " "
101  << (*it).energyLoss() << " " << (*it).tof() << " "
102  << (*it).trackId() << " " << (*it).processType() << " "
103  << (*it).detUnitId()
104  << (*it).entryPoint() << " " << (*it).exitPoint();
105 
106  std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
107  std::vector<DigitizerUtility::SignalPoint> collection_points;
108 
109  // fill collection_points for this SimHit, indpendent of topology
110  // Check the TOF cut
111  if (((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) >= theTofLowerCut &&
112  ((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) <= theTofUpperCut) {
113  primary_ionization(*it, ionization_points); // fills _ionization_points
114  drift (*it, pixdet, bfield, ionization_points, collection_points); // transforms _ionization_points to collection_points
115 
116  // compute induced signal on readout elements and add to _signal
117  induce_signal(*it, simHitGlobalIndex, tofBin, pixdet, collection_points); // *ihit needed only for SimHit<-->Digi link
118  }
119  }
120 }
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
Map map_
void init(const edm::EventSetup &es) override
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 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
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
PixelDigitizerAlgorithm(const edm::ParameterSet &conf, CLHEP::HepRandomEngine &)
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)
const T & get() const
Definition: EventSetup.h:58
HLT enums.