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 
65  Phase2TrackerDigitizerAlgorithm(conf.getParameter<ParameterSet>("AlgorithmCommon"),
66  conf.getParameter<ParameterSet>("PixelDigitizerAlgorithm")),
67  odd_row_interchannelCoupling_next_row(conf.getParameter<ParameterSet>("PixelDigitizerAlgorithm").getParameter<double>("Odd_row_interchannelCoupling_next_row")),
68  even_row_interchannelCoupling_next_row(conf.getParameter<ParameterSet>("PixelDigitizerAlgorithm").getParameter<double>("Even_row_interchannelCoupling_next_row")),
69  odd_column_interchannelCoupling_next_column(conf.getParameter<ParameterSet>("PixelDigitizerAlgorithm").getParameter<double>("Odd_column_interchannelCoupling_next_column")),
70  even_column_interchannelCoupling_next_column(conf.getParameter<ParameterSet>("PixelDigitizerAlgorithm").getParameter<double>("Even_column_interchannelCoupling_next_column"))
71 {
72  pixelFlag = true;
73  LogInfo("PixelDigitizerAlgorithm") << "Algorithm constructed "
74  << "Configuration parameters:"
75  << "Threshold/Gain = "
76  << "threshold in electron Endcap = "
78  << "threshold in electron Barrel = "
80  << " " << theElectronPerADC << " " << theAdcFullScale
81  << " The delta cut-off is set to " << tMax
82  << " pix-inefficiency " << AddPixelInefficiency;
83 }
85  LogDebug("PixelDigitizerAlgorithm") << "Algorithm deleted";
86 }
87 void PixelDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
88  std::vector<PSimHit>::const_iterator inputEnd,
89  const size_t inputBeginGlobalIndex,
90  const unsigned int tofBin,
91  const Phase2TrackerGeomDetUnit* pixdet,
92  const GlobalVector& bfield) {
93  // produce SignalPoint's for all SimHit's in detector
94  // Loop over hits
95  uint32_t detId = pixdet->geographicalId().rawId();
96  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later
97  for (auto it = inputBegin; it != inputEnd; ++it, ++simHitGlobalIndex) {
98  // skip hits not in this detector.
99  if ((*it).detUnitId() != detId)
100  continue;
101 
102  LogDebug ("PixelDigitizerAlgorithm")
103  << (*it).particleType() << " " << (*it).pabs() << " "
104  << (*it).energyLoss() << " " << (*it).tof() << " "
105  << (*it).trackId() << " " << (*it).processType() << " "
106  << (*it).detUnitId()
107  << (*it).entryPoint() << " " << (*it).exitPoint();
108 
109  std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
110  std::vector<DigitizerUtility::SignalPoint> collection_points;
111 
112  // fill collection_points for this SimHit, indpendent of topology
113  // Check the TOF cut
114  if (((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) >= theTofLowerCut &&
115  ((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) <= theTofUpperCut) {
116  primary_ionization(*it, ionization_points); // fills _ionization_points
117  drift (*it, pixdet, bfield, ionization_points, collection_points); // transforms _ionization_points to collection_points
118 
119  // compute induced signal on readout elements and add to _signal
120  induce_signal(*it, simHitGlobalIndex, tofBin, pixdet, collection_points); // *ihit needed only for SimHit<-->Digi link
121  }
122  }
123 }
124 // ======================================================================
125 //
126 // Add Cross-talk contribution
127 //
128 // ======================================================================
130  if (!pixelFlag) return;
131 
132  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
133 
134  // cross-talk calculation valid for the case of 25x100 pixels
135  const float pitch_first = 0.0025;
136  const float pitch_second = 0.0100;
137 
138  if ( topol->pitch().first != pitch_first || topol->pitch().second != pitch_second ) return; // please check that units are really cm!
139 
140  uint32_t detID = pixdet->geographicalId().rawId();
141  signal_map_type& theSignal = _signal[detID];
142  signal_map_type signalNew;
143  int numRows = topol->nrows();
144  int numColumns = topol->ncolumns();
145 
146  for (auto & s : theSignal) {
147  float signalInElectrons = s.second.ampl(); // signal in electrons
148 
149  auto hitChan = PixelDigi::channelToPixel(s.first);
150 
151  float signalInElectrons_odd_row_Xtalk_next_row = signalInElectrons * odd_row_interchannelCoupling_next_row;
152  float signalInElectrons_even_row_Xtalk_next_row = signalInElectrons * even_row_interchannelCoupling_next_row;
153  float signalInElectrons_odd_column_Xtalk_next_column = signalInElectrons * odd_column_interchannelCoupling_next_column;
154  float signalInElectrons_even_column_Xtalk_next_column = signalInElectrons * even_column_interchannelCoupling_next_column;
155 
156  //subtract the charge which will be shared
157  s.second.set(signalInElectrons-signalInElectrons_odd_row_Xtalk_next_row-signalInElectrons_even_row_Xtalk_next_row-signalInElectrons_odd_column_Xtalk_next_column-signalInElectrons_even_column_Xtalk_next_column);
158 
159  if (hitChan.first != 0) {
160  auto XtalkPrev = std::make_pair(hitChan.first-1, hitChan.second);
161  int chanXtalkPrev = (pixelFlag) ? PixelDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second)
162  : Phase2TrackerDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second);
163  if (hitChan.first % 2 == 1) signalNew.emplace(chanXtalkPrev, DigitizerUtility::Amplitude(signalInElectrons_even_row_Xtalk_next_row, nullptr, -1.0));
164  else signalNew.emplace(chanXtalkPrev, DigitizerUtility::Amplitude(signalInElectrons_odd_row_Xtalk_next_row, nullptr, -1.0));
165  }
166  if (hitChan.first < (numRows-1)) {
167  auto XtalkNext = std::make_pair(hitChan.first+1, hitChan.second);
168  int chanXtalkNext = (pixelFlag) ? PixelDigi::pixelToChannel(XtalkNext.first, XtalkNext.second)
169  : Phase2TrackerDigi::pixelToChannel(XtalkNext.first, XtalkNext.second);
170  if (hitChan.first % 2 == 1) signalNew.emplace(chanXtalkNext, DigitizerUtility::Amplitude(signalInElectrons_odd_row_Xtalk_next_row, nullptr, -1.0));
171  else signalNew.emplace(chanXtalkNext, DigitizerUtility::Amplitude(signalInElectrons_even_row_Xtalk_next_row, nullptr, -1.0));
172  }
173 
174  if (hitChan.second != 0) {
175  auto XtalkPrev = std::make_pair(hitChan.first, hitChan.second-1);
176  int chanXtalkPrev = (pixelFlag) ? PixelDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second)
177  : Phase2TrackerDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second);
178  if (hitChan.second % 2 == 1) signalNew.emplace(chanXtalkPrev, DigitizerUtility::Amplitude(signalInElectrons_even_column_Xtalk_next_column, nullptr, -1.0));
179  else signalNew.emplace(chanXtalkPrev, DigitizerUtility::Amplitude(signalInElectrons_odd_column_Xtalk_next_column, nullptr, -1.0));
180  }
181  if (hitChan.second < (numColumns-1)) {
182  auto XtalkNext = std::make_pair(hitChan.first, hitChan.second+1);
183  int chanXtalkNext = (pixelFlag) ? PixelDigi::pixelToChannel(XtalkNext.first, XtalkNext.second)
184  : Phase2TrackerDigi::pixelToChannel(XtalkNext.first, XtalkNext.second);
185  if (hitChan.second % 2 == 1) signalNew.emplace(chanXtalkNext, DigitizerUtility::Amplitude(signalInElectrons_odd_column_Xtalk_next_column, nullptr, -1.0));
186  else signalNew.emplace(chanXtalkNext, DigitizerUtility::Amplitude(signalInElectrons_even_column_Xtalk_next_column, nullptr, -1.0));
187  }
188  }
189  for (auto const & l : signalNew) {
190  int chan = l.first;
191  auto iter = theSignal.find(chan);
192  if (iter != theSignal.end()) {
193  theSignal[chan] += l.second.ampl();
194  } else {
195  theSignal.emplace(chan, DigitizerUtility::Amplitude(l.second.ampl(), nullptr, -1.0));
196  }
197  }
198 }
199 
200 
void primary_ionization(const PSimHit &hit, std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points) const
#define LogDebug(id)
const double even_row_interchannelCoupling_next_row
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
virtual int nrows() const =0
PixelDigitizerAlgorithm(const edm::ParameterSet &conf)
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
const double odd_column_interchannelCoupling_next_column
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
virtual std::pair< float, float > pitch() const =0
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 double even_column_interchannelCoupling_next_column
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:68
void add_cross_talk(const Phase2TrackerGeomDetUnit *pixdet) override
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
const double odd_row_interchannelCoupling_next_row
void induce_signal(const PSimHit &hit, const size_t hitIndex, const unsigned int tofBin, const Phase2TrackerGeomDetUnit *pixdet, const std::vector< DigitizerUtility::SignalPoint > &collection_points)
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
HLT enums.
virtual int ncolumns() const =0
T get() const
Definition: EventSetup.h:71