CMS 3D CMS Logo

Phase2TrackerDigitizerAlgorithm.cc
Go to the documentation of this file.
1 #include <typeinfo>
2 #include <iostream>
3 #include <cmath>
4 
6 
9 
10 #include "CLHEP/Random/RandGaussQ.h"
11 
16 
22 
28 
29 // Geometry
33 
34 using namespace edm;
35 
36 namespace ph2tkdigialgo {
37  // Mass in MeV
38  constexpr double m_pion = 139.571;
39  constexpr double m_kaon = 493.677;
40  constexpr double m_electron = 0.511;
41  constexpr double m_muon = 105.658;
42  constexpr double m_proton = 938.272;
43 } // namespace ph2tkdigialgo
45  const edm::ParameterSet& conf_specific,
47  : _signal(),
48  makeDigiSimLinks_(conf_common.getUntrackedParameter<bool>("makeDigiSimLinks", true)),
49  use_ineff_from_db_(conf_specific.getParameter<bool>("Inefficiency_DB")),
50  use_module_killing_(conf_specific.getParameter<bool>("KillModules")), // boolean to kill or not modules
51  use_deadmodule_DB_(conf_specific.getParameter<bool>("DeadModules_DB")), // boolean to access dead modules from DB
52  // boolean to access Lorentz angle from DB
53  use_LorentzAngle_DB_(conf_specific.getParameter<bool>("LorentzAngle_DB")),
54 
55  // get dead module from cfg file
56  deadModules_(use_deadmodule_DB_ ? Parameters() : conf_specific.getParameter<Parameters>("DeadModules")),
57 
58  // Common pixel parameters
59  // These are parameters which are not likely to be changed
60  GeVperElectron_(3.61E-09), // 1 electron(3.61eV, 1keV(277e, mod 9/06 d.k.
61  alpha2Order_(conf_specific.getParameter<bool>("Alpha2Order")), // switch on/off of E.B effect
62  addXtalk_(conf_specific.getParameter<bool>("AddXTalk")),
63  // Interstrip Coupling - Not used in PixelDigitizerAlgorithm
64  interstripCoupling_(conf_specific.getParameter<double>("InterstripCoupling")),
65 
66  Sigma0_(conf_specific.getParameter<double>("SigmaZero")), // Charge diffusion constant 7->3.7
67  SigmaCoeff_(conf_specific.getParameter<double>("SigmaCoeff")), // delta in the diffusion across the strip pitch
68  // (set between 0 to 0.9, 0-->flat Sigma0, 1-->Sigma_min=0 & Sigma_max=2*Sigma0
69  // D.B.: Dist300 replaced by moduleThickness, may not work with partially depleted sensors but works otherwise
70  // Dist300(0.0300), // normalized to 300micron Silicon
71 
72  // Charge integration spread on the collection plane
73  clusterWidth_(conf_specific.getParameter<double>("ClusterWidth")),
74 
75  // Allowed modes of readout which has following values :
76  // 0 ---> Digital or binary readout
77  // -1 ---> Analog readout, current digitizer (Inner Pixel) (TDR version) with no threshold subtraction
78  // Analog readout with dual slope with the "second" slope being 1/2^(n-1) and threshold subtraction (n = 1, 2, 3,4)
79  thePhase2ReadoutMode_(conf_specific.getParameter<int>("Phase2ReadoutMode")),
80 
81  // ADC calibration 1adc count(135e.
82  // Corresponds to 2adc/kev, 270[e/kev]/135[e/adc](2[adc/kev]
83  // Be careful, this parameter is also used in SiPixelDet.cc to
84  // calculate the noise in adc counts from noise in electrons.
85  // Both defaults should be the same.
86  theElectronPerADC_(conf_specific.getParameter<double>("ElectronPerAdc")),
87 
88  // ADC saturation value, 255(8bit adc.
89  theAdcFullScale_(conf_specific.getParameter<int>("AdcFullScale")),
90 
91  // Noise in electrons:
92  // Pixel cell noise, relevant for generating noisy pixels
93  theNoiseInElectrons_(conf_specific.getParameter<double>("NoiseInElectrons")),
94 
95  // Fill readout noise, including all readout chain, relevant for smearing
96  theReadoutNoise_(conf_specific.getParameter<double>("ReadoutNoiseInElec")),
97 
98  // Threshold in units of noise:
99  // thePixelThreshold(conf.getParameter<double>("ThresholdInNoiseUnits")),
100  // Pixel threshold in electron units.
101  theThresholdInE_Endcap_(conf_specific.getParameter<double>("ThresholdInElectrons_Endcap")),
102  theThresholdInE_Barrel_(conf_specific.getParameter<double>("ThresholdInElectrons_Barrel")),
103 
104  // Add threshold gaussian smearing:
105  theThresholdSmearing_Endcap_(conf_specific.getParameter<double>("ThresholdSmearing_Endcap")),
106  theThresholdSmearing_Barrel_(conf_specific.getParameter<double>("ThresholdSmearing_Barrel")),
107 
108  // Add HIP Threshold in electron units.
109  theHIPThresholdInE_Endcap_(conf_specific.getParameter<double>("HIPThresholdInElectrons_Endcap")),
110  theHIPThresholdInE_Barrel_(conf_specific.getParameter<double>("HIPThresholdInElectrons_Barrel")),
111 
112  // theTofCut 12.5, cut in particle TOD +/- 12.5ns
113  theTofLowerCut_(conf_specific.getParameter<double>("TofLowerCut")),
114  theTofUpperCut_(conf_specific.getParameter<double>("TofUpperCut")),
115 
116  // Get the Lorentz angle from the cfg file:
117  tanLorentzAnglePerTesla_Endcap_(
118  use_LorentzAngle_DB_ ? 0.0 : conf_specific.getParameter<double>("TanLorentzAnglePerTesla_Endcap")),
119  tanLorentzAnglePerTesla_Barrel_(
120  use_LorentzAngle_DB_ ? 0.0 : conf_specific.getParameter<double>("TanLorentzAnglePerTesla_Barrel")),
121 
122  // Add noise
123  addNoise_(conf_specific.getParameter<bool>("AddNoise")),
124 
125  // Add noisy pixels
126  addNoisyPixels_(conf_specific.getParameter<bool>("AddNoisyPixels")),
127 
128  // Fluctuate charge in track subsegments
129  fluctuateCharge_(conf_specific.getUntrackedParameter<bool>("FluctuateCharge", true)),
130 
131  // Control the pixel inefficiency
132  addPixelInefficiency_(conf_specific.getParameter<bool>("AddInefficiency")),
133 
134  // Add threshold gaussian smearing:
135  addThresholdSmearing_(conf_specific.getParameter<bool>("AddThresholdSmearing")),
136 
137  // Add some pseudo-red damage
138  pseudoRadDamage_(conf_specific.exists("PseudoRadDamage") ? conf_specific.getParameter<double>("PseudoRadDamage")
139  : double(0.0)),
140  pseudoRadDamageRadius_(conf_specific.exists("PseudoRadDamageRadius")
141  ? conf_specific.getParameter<double>("PseudoRadDamageRadius")
142  : double(0.0)),
143 
144  // delta cutoff in MeV, has to be same as in OSCAR(0.030/cmsim=1.0 MeV
145  // tMax(0.030), // In MeV.
146  // tMax(conf.getUntrackedParameter<double>("DeltaProductionCut",0.030)),
147  tMax_(conf_common.getParameter<double>("DeltaProductionCut")),
148 
149  badPixels_(conf_specific.getParameter<Parameters>("CellsToKill")),
150 
151  fluctuate_(fluctuateCharge_ ? std::make_unique<SiG4UniversalFluctuation>() : nullptr),
152  theNoiser_(addNoise_ ? std::make_unique<GaussianTailNoiseGenerator>() : nullptr),
153  theSiPixelGainCalibrationService_(
154  use_ineff_from_db_ ? std::make_unique<SiPixelGainCalibrationOfflineSimService>(conf_specific, iC) : nullptr),
155  subdetEfficiencies_(conf_specific) {
156  LogDebug("Phase2TrackerDigitizerAlgorithm")
157  << "Phase2TrackerDigitizerAlgorithm constructed\n"
158  << "Configuration parameters:\n"
159  << "Threshold/Gain = "
160  << "threshold in electron Endcap = " << theThresholdInE_Endcap_
161  << "\nthreshold in electron Barrel = " << theThresholdInE_Barrel_ << " ElectronPerADC " << theElectronPerADC_
162  << " ADC Scale (in bits) " << theAdcFullScale_ << " The delta cut-off is set to " << tMax_ << " pix-inefficiency "
164 }
165 
167  LogDebug("Phase2TrackerDigitizerAlgorithm") << "Phase2TrackerDigitizerAlgorithm deleted";
168 }
169 
171  barrel_efficiencies = conf.getParameter<std::vector<double> >("EfficiencyFactors_Barrel");
172  endcap_efficiencies = conf.getParameter<std::vector<double> >("EfficiencyFactors_Endcap");
173 }
174 void Phase2TrackerDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
175  std::vector<PSimHit>::const_iterator inputEnd,
176  const size_t inputBeginGlobalIndex,
177  const uint32_t tofBin,
178  const Phase2TrackerGeomDetUnit* pixdet,
179  const GlobalVector& bfield) {
180  // produce SignalPoint's for all SimHit's in detector
181  // Loop over hits
182  uint32_t detId = pixdet->geographicalId().rawId();
183  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later
184 
185  // find the relevant hits
186  std::vector<PSimHit> matchedSimHits;
187  std::copy_if(inputBegin, inputEnd, std::back_inserter(matchedSimHits), [detId](auto const& hit) -> bool {
188  return hit.detUnitId() == detId;
189  });
190  // loop over a much reduced set of SimHits
191  for (auto const& hit : matchedSimHits) {
192  LogDebug("Phase2DigitizerAlgorithm") << hit.particleType() << " " << hit.pabs() << " " << hit.energyLoss() << " "
193  << hit.tof() << " " << hit.trackId() << " " << hit.processType() << " "
194  << hit.detUnitId() << hit.entryPoint() << " " << hit.exitPoint();
195  double signalScale = 1.0;
196  // fill collection_points for this SimHit, indpendent of topology
197  if (select_hit(hit, (pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv), signalScale)) {
198  const auto& ionization_points = primary_ionization(hit); // fills ionization_points
199 
200  // transforms ionization_points -> collection_points
201  const auto& collection_points = drift(hit, pixdet, bfield, ionization_points);
202 
203  // compute induced signal on readout elements and add to _signal
204  // hit needed only for SimHit<-->Digi link
205  induce_signal(hit, simHitGlobalIndex, tofBin, pixdet, collection_points);
206  }
207  ++simHitGlobalIndex;
208  }
209 }
210 // =================================================================
211 //
212 // Generate primary ionization along the track segment.
213 // Divide the track into small sub-segments
214 //
215 // =================================================================
216 std::vector<DigitizerUtility::EnergyDepositUnit> Phase2TrackerDigitizerAlgorithm::primary_ionization(
217  const PSimHit& hit) const {
218  // Straight line approximation for trajectory inside active media
219  constexpr float SegmentLength = 0.0010; // in cm (10 microns)
220  // Get the 3D segment direction vector
221  LocalVector direction = hit.exitPoint() - hit.entryPoint();
222 
223  float eLoss = hit.energyLoss(); // Eloss in GeV
224  float length = direction.mag(); // Track length in Silicon
225 
226  int NumberOfSegments = static_cast<int>(length / SegmentLength); // Number of segments
227  if (NumberOfSegments < 1)
228  NumberOfSegments = 1;
229  LogDebug("Phase2TrackerDigitizerAlgorithm")
230  << "enter primary_ionzation " << NumberOfSegments << " shift = " << hit.exitPoint().x() - hit.entryPoint().x()
231  << " " << hit.exitPoint().y() - hit.entryPoint().y() << " " << hit.exitPoint().z() - hit.entryPoint().z() << " "
232  << hit.particleType() << " " << hit.pabs();
233 
234  std::vector<float> elossVector;
235  elossVector.reserve(NumberOfSegments);
236  if (fluctuateCharge_) {
237  // Generate fluctuated charge points
238  elossVector = fluctuateEloss(hit.particleType(), hit.pabs(), eLoss, length, NumberOfSegments);
239  } else {
240  float averageEloss = eLoss / NumberOfSegments;
241  elossVector.resize(NumberOfSegments, averageEloss);
242  }
243 
244  std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
245  ionization_points.reserve(NumberOfSegments); // set size
246  // loop over segments
247  for (size_t i = 0; i < elossVector.size(); ++i) {
248  // Divide the segment into equal length subsegments
249  Local3DPoint point = hit.entryPoint() + ((i + 0.5) / NumberOfSegments) * direction;
250  float energy = elossVector[i] / GeVperElectron_; // Convert charge to elec.
251 
252  DigitizerUtility::EnergyDepositUnit edu(energy, point); // define position,energy point
253  ionization_points.push_back(edu); // save
254  LogDebug("Phase2TrackerDigitizerAlgorithm")
255  << i << " " << edu.x() << " " << edu.y() << " " << edu.z() << " " << edu.energy();
256  }
257  return ionization_points;
258 }
259 //==============================================================================
260 //
261 // Fluctuate the charge comming from a small (10um) track segment.
262 // Use the G4 routine. For mip pions for the moment.
263 //
264 //==============================================================================
266  int pid, float particleMomentum, float eloss, float length, int NumberOfSegs) const {
267  double particleMass = ph2tkdigialgo::m_pion; // Mass in MeV, assume pion
268  pid = std::abs(pid);
269  if (pid != 211) { // Mass in MeV
270  if (pid == 11)
271  particleMass = ph2tkdigialgo::m_electron;
272  else if (pid == 13)
273  particleMass = ph2tkdigialgo::m_muon;
274  else if (pid == 321)
275  particleMass = ph2tkdigialgo::m_kaon;
276  else if (pid == 2212)
277  particleMass = ph2tkdigialgo::m_proton;
278  }
279  // What is the track segment length.
280  float segmentLength = length / NumberOfSegs;
281 
282  // Generate charge fluctuations.
283  float sum = 0.;
284  double segmentEloss = (1000. * eloss) / NumberOfSegs; //eloss in MeV
285  std::vector<float> elossVector;
286  elossVector.reserve(NumberOfSegs);
287  for (int i = 0; i < NumberOfSegs; ++i) {
288  // The G4 routine needs momentum in MeV, mass in Mev, delta-cut in MeV,
289  // track segment length in mm, segment eloss in MeV
290  // Returns fluctuated eloss in MeV
291  double deltaCutoff = tMax_; // the cutoff is sometimes redefined inside, so fix it.
292  float de = fluctuate_->SampleFluctuations(particleMomentum * 1000.,
293  particleMass,
294  deltaCutoff,
295  segmentLength * 10.,
296  segmentEloss,
297  rengine_) /
298  1000.; //convert to GeV
299  elossVector.push_back(de);
300  sum += de;
301  }
302  if (sum > 0.) { // if fluctuations give eloss>0.
303  // Rescale to the same total eloss
304  float ratio = eloss / sum;
306  std::begin(elossVector), std::end(elossVector), std::begin(elossVector), [&ratio](auto const& c) -> float {
307  return c * ratio;
308  }); // use a simple lambda expression
309  } else { // if fluctuations gives 0 eloss
310  float averageEloss = eloss / NumberOfSegs;
311  elossVector.resize(NumberOfSegs, averageEloss);
312  }
313  return elossVector;
314 }
315 
316 // ======================================================================
317 //
318 // Drift the charge segments to the sensor surface (collection plane)
319 // Include the effect of E-field and B-field
320 //
321 // =====================================================================
322 std::vector<DigitizerUtility::SignalPoint> Phase2TrackerDigitizerAlgorithm::drift(
323  const PSimHit& hit,
324  const Phase2TrackerGeomDetUnit* pixdet,
325  const GlobalVector& bfield,
326  const std::vector<DigitizerUtility::EnergyDepositUnit>& ionization_points) const {
327  LogDebug("Phase2TrackerDigitizerAlgorithm") << "enter drift ";
328 
329  std::vector<DigitizerUtility::SignalPoint> collection_points;
330  collection_points.reserve(ionization_points.size()); // set size
331  LocalVector driftDir = DriftDirection(pixdet, bfield, hit.detUnitId()); // get the charge drift direction
332  if (driftDir.z() == 0.) {
333  LogWarning("Phase2TrackerDigitizerAlgorithm") << " pxlx: drift in z is zero ";
334  return collection_points;
335  }
336 
337  float TanLorenzAngleX = driftDir.x(); // tangent of Lorentz angle
338  float TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
339  float dir_z = driftDir.z(); // The z drift direction
340  float CosLorenzAngleX = 1. / std::sqrt(1. + std::pow(TanLorenzAngleX, 2)); // cosine to estimate the path length
341  float CosLorenzAngleY = 1.;
342  if (alpha2Order_) {
343  TanLorenzAngleY = driftDir.y();
344  CosLorenzAngleY = 1. / std::sqrt(1. + std::pow(TanLorenzAngleY, 2)); // cosine
345  }
346 
347  float moduleThickness = pixdet->specificSurface().bounds().thickness();
348  float stripPitch = pixdet->specificTopology().pitch().first;
349 
350  LogDebug("Phase2TrackerDigitizerAlgorithm")
351  << " Lorentz Tan " << TanLorenzAngleX << " " << TanLorenzAngleY << " " << CosLorenzAngleX << " "
352  << CosLorenzAngleY << " " << moduleThickness * TanLorenzAngleX << " " << driftDir;
353 
354  for (auto const& val : ionization_points) {
355  // position
356  float SegX = val.x(), SegY = val.y(), SegZ = val.z();
357 
358  // Distance from the collection plane
359  // DriftDistance = (moduleThickness/2. + SegZ); // Drift to -z
360  // Include explixitely the E drift direction (for CMS dir_z=-1)
361 
362  // Distance between charge generation and collection
363  float driftDistance = moduleThickness / 2. - (dir_z * SegZ); // Drift to -z
364 
365  if (driftDistance < 0.)
366  driftDistance = 0.;
367  else if (driftDistance > moduleThickness)
368  driftDistance = moduleThickness;
369 
370  // Assume full depletion now, partial depletion will come later.
371  float XDriftDueToMagField = driftDistance * TanLorenzAngleX;
372  float YDriftDueToMagField = driftDistance * TanLorenzAngleY;
373 
374  // Shift cloud center
375  float CloudCenterX = SegX + XDriftDueToMagField;
376  float CloudCenterY = SegY + YDriftDueToMagField;
377 
378  // Calculate how long is the charge drift path
379  // Actual Drift Lentgh
380  float driftLength =
381  std::sqrt(std::pow(driftDistance, 2) + std::pow(XDriftDueToMagField, 2) + std::pow(YDriftDueToMagField, 2));
382 
383  // What is the charge diffusion after this path
384  // Sigma0=0.00037 is for 300um thickness (make sure moduleThickness is in [cm])
385  float Sigma = std::sqrt(driftLength / moduleThickness) * Sigma0_ * moduleThickness / 0.0300;
386  // D.B.: sigmaCoeff=0 means no modulation
387  if (SigmaCoeff_)
388  Sigma *= (SigmaCoeff_ * std::pow(cos(SegX * M_PI / stripPitch), 2) + 1);
389  // NB: divided by 4 to get a periodicity of stripPitch
390 
391  // Project the diffusion sigma on the collection plane
392  float Sigma_x = Sigma / CosLorenzAngleX;
393  float Sigma_y = Sigma / CosLorenzAngleY;
394 
395  // Insert a charge loss due to Rad Damage here
396  float energyOnCollector = val.energy(); // The energy that reaches the collector
397 
398  // pseudoRadDamage
399  if (pseudoRadDamage_) {
400  float moduleRadius = pixdet->surface().position().perp();
401  if (moduleRadius <= pseudoRadDamageRadius_) {
402  float kValue = pseudoRadDamage_ / std::pow(moduleRadius, 2);
403  energyOnCollector *= exp(-1 * kValue * driftDistance / moduleThickness);
404  }
405  }
406  LogDebug("Phase2TrackerDigitizerAlgorithm")
407  << "Dift DistanceZ = " << driftDistance << " module thickness = " << moduleThickness
408  << " Start Energy = " << val.energy() << " Energy after loss= " << energyOnCollector;
409  DigitizerUtility::SignalPoint sp(CloudCenterX, CloudCenterY, Sigma_x, Sigma_y, hit.tof(), energyOnCollector);
410 
411  // Load the Charge distribution parameters
412  collection_points.push_back(sp);
413  }
414  return collection_points;
415 }
416 
417 // ====================================================================
418 //
419 // Induce the signal on the collection plane of the active sensor area.
421  const PSimHit& hit,
422  const size_t hitIndex,
423  const uint32_t tofBin,
424  const Phase2TrackerGeomDetUnit* pixdet,
425  const std::vector<DigitizerUtility::SignalPoint>& collection_points) {
426  // X - Rows, Left-Right, 160, (1.6cm) for barrel
427  // Y - Columns, Down-Up, 416, (6.4cm)
428  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
429  uint32_t detID = pixdet->geographicalId().rawId();
430  signal_map_type& theSignal = _signal[detID];
431 
432  LogDebug("Phase2TrackerDigitizerAlgorithm")
433  << " enter induce_signal, " << topol->pitch().first << " " << topol->pitch().second;
434 
435  // local map to store pixels hit by 1 Hit.
436  using hit_map_type = std::map<int, float, std::less<int> >;
437  hit_map_type hit_signal;
438 
439  // Assign signals to readout channels and store sorted by channel number
440  // Iterate over collection points on the collection plane
441  for (auto const& v : collection_points) {
442  float CloudCenterX = v.position().x(); // Charge position in x
443  float CloudCenterY = v.position().y(); // in y
444  float SigmaX = v.sigma_x(); // Charge spread in x
445  float SigmaY = v.sigma_y(); // in y
446  float Charge = v.amplitude(); // Charge amplitude
447 
448  LogDebug("Phase2TrackerDigitizerAlgorithm") << " cloud " << v.position().x() << " " << v.position().y() << " "
449  << v.sigma_x() << " " << v.sigma_y() << " " << v.amplitude();
450 
451  // Find the maximum cloud spread in 2D plane , assume 3*sigma
452  float CloudRight = CloudCenterX + clusterWidth_ * SigmaX;
453  float CloudLeft = CloudCenterX - clusterWidth_ * SigmaX;
454  float CloudUp = CloudCenterY + clusterWidth_ * SigmaY;
455  float CloudDown = CloudCenterY - clusterWidth_ * SigmaY;
456 
457  // Define 2D cloud limit points
458  LocalPoint PointRightUp = LocalPoint(CloudRight, CloudUp);
459  LocalPoint PointLeftDown = LocalPoint(CloudLeft, CloudDown);
460 
461  // This points can be located outside the sensor area.
462  // The conversion to measurement point does not check for that
463  // so the returned pixel index might be wrong (outside range).
464  // We rely on the limits check below to fix this.
465  // But remember whatever we do here THE CHARGE OUTSIDE THE ACTIVE
466  // PIXEL ARE IS LOST, it should not be collected.
467 
468  // Convert the 2D points to pixel indices
469  MeasurementPoint mp = topol->measurementPosition(PointRightUp);
470  int IPixRightUpX = static_cast<int>(std::floor(mp.x())); // cast reqd.
471  int IPixRightUpY = static_cast<int>(std::floor(mp.y()));
472  LogDebug("Phase2TrackerDigitizerAlgorithm")
473  << " right-up " << PointRightUp << " " << mp.x() << " " << mp.y() << " " << IPixRightUpX << " " << IPixRightUpY;
474 
475  mp = topol->measurementPosition(PointLeftDown);
476  int IPixLeftDownX = static_cast<int>(std::floor(mp.x()));
477  int IPixLeftDownY = static_cast<int>(std::floor(mp.y()));
478  LogDebug("Phase2TrackerDigitizerAlgorithm") << " left-down " << PointLeftDown << " " << mp.x() << " " << mp.y()
479  << " " << IPixLeftDownX << " " << IPixLeftDownY;
480 
481  // Check detector limits to correct for pixels outside range.
482  int numColumns = topol->ncolumns(); // det module number of cols&rows
483  int numRows = topol->nrows();
484 
485  IPixRightUpX = numRows > IPixRightUpX ? IPixRightUpX : numRows - 1;
486  IPixRightUpY = numColumns > IPixRightUpY ? IPixRightUpY : numColumns - 1;
487  IPixLeftDownX = 0 < IPixLeftDownX ? IPixLeftDownX : 0;
488  IPixLeftDownY = 0 < IPixLeftDownY ? IPixLeftDownY : 0;
489 
490  // First integrate charge strips in x
491  hit_map_type x;
492  for (int ix = IPixLeftDownX; ix <= IPixRightUpX; ++ix) { // loop over x index
493  float xLB, LowerBound;
494  // Why is set to 0 if ix=0, does it meen that we accept charge
495  // outside the sensor?
496  if (ix == 0 || SigmaX == 0.) { // skip for surface segemnts
497  LowerBound = 0.;
498  } else {
499  mp = MeasurementPoint(ix, 0.0);
500  xLB = topol->localPosition(mp).x();
501  LowerBound = 1 - calcQ((xLB - CloudCenterX) / SigmaX);
502  }
503 
504  float xUB, UpperBound;
505  if (ix == numRows - 1 || SigmaX == 0.) {
506  UpperBound = 1.;
507  } else {
508  mp = MeasurementPoint(ix + 1, 0.0);
509  xUB = topol->localPosition(mp).x();
510  UpperBound = 1. - calcQ((xUB - CloudCenterX) / SigmaX);
511  }
512  float TotalIntegrationRange = UpperBound - LowerBound; // get strip
513  x.emplace(ix, TotalIntegrationRange); // save strip integral
514  }
515 
516  // Now integrate strips in y
517  hit_map_type y;
518  for (int iy = IPixLeftDownY; iy <= IPixRightUpY; ++iy) { // loop over y index
519  float yLB, LowerBound;
520  if (iy == 0 || SigmaY == 0.) {
521  LowerBound = 0.;
522  } else {
523  mp = MeasurementPoint(0.0, iy);
524  yLB = topol->localPosition(mp).y();
525  LowerBound = 1. - calcQ((yLB - CloudCenterY) / SigmaY);
526  }
527 
528  float yUB, UpperBound;
529  if (iy == numColumns - 1 || SigmaY == 0.) {
530  UpperBound = 1.;
531  } else {
532  mp = MeasurementPoint(0.0, iy + 1);
533  yUB = topol->localPosition(mp).y();
534  UpperBound = 1. - calcQ((yUB - CloudCenterY) / SigmaY);
535  }
536 
537  float TotalIntegrationRange = UpperBound - LowerBound;
538  y.emplace(iy, TotalIntegrationRange); // save strip integral
539  }
540 
541  // Get the 2D charge integrals by folding x and y strips
542  for (int ix = IPixLeftDownX; ix <= IPixRightUpX; ++ix) { // loop over x index
543  for (int iy = IPixLeftDownY; iy <= IPixRightUpY; ++iy) { // loop over y index
544  float ChargeFraction = Charge * x[ix] * y[iy];
545  int chanFired = -1;
546  if (ChargeFraction > 0.) {
547  chanFired =
549  // Load the amplitude
550  hit_signal[chanFired] += ChargeFraction;
551  }
552 
553  mp = MeasurementPoint(ix, iy);
554  LocalPoint lp = topol->localPosition(mp);
555  int chan = topol->channel(lp);
556 
557  LogDebug("Phase2TrackerDigitizerAlgorithm")
558  << " pixel " << ix << " " << iy << " - "
559  << " " << chanFired << " " << ChargeFraction << " " << mp.x() << " " << mp.y() << " " << lp.x() << " "
560  << lp.y() << " " // givex edge position
561  << chan; // edge belongs to previous ?
562  }
563  }
564  }
565  // Fill the global map with all hit pixels from this event
566  float corr_time = hit.tof() - pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv;
567  for (auto const& hit_s : hit_signal) {
568  int chan = hit_s.first;
569  theSignal[chan] +=
570  (makeDigiSimLinks_ ? DigitizerUtility::Amplitude(hit_s.second, &hit, hit_s.second, corr_time, hitIndex, tofBin)
571  : DigitizerUtility::Amplitude(hit_s.second, nullptr, hit_s.second));
572  }
573 }
574 // ======================================================================
575 //
576 // Add electronic noise to pixel charge
577 //
578 // ======================================================================
580  uint32_t detID = pixdet->geographicalId().rawId();
581  signal_map_type& theSignal = _signal[detID];
582  for (auto& s : theSignal) {
583  float noise = gaussDistribution_->fire();
584  if ((s.second.ampl() + noise) < 0.)
585  s.second.set(0);
586  else
587  s.second += noise;
588  }
589 }
590 // ======================================================================
591 //
592 // Add Cross-talk contribution
593 //
594 // ======================================================================
596  uint32_t detID = pixdet->geographicalId().rawId();
597  signal_map_type& theSignal = _signal[detID];
598  signal_map_type signalNew;
599  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
600  int numRows = topol->nrows();
601 
602  for (auto& s : theSignal) {
603  float signalInElectrons = s.second.ampl(); // signal in electrons
604 
605  std::pair<int, int> hitChan;
606  if (pixelFlag_)
607  hitChan = PixelDigi::channelToPixel(s.first);
608  else
609  hitChan = Phase2TrackerDigi::channelToPixel(s.first);
610 
611  float signalInElectrons_Xtalk = signalInElectrons * interstripCoupling_;
612  // subtract the charge which will be shared
613  s.second.set(signalInElectrons - signalInElectrons_Xtalk);
614 
615  if (hitChan.first != 0) {
616  auto XtalkPrev = std::make_pair(hitChan.first - 1, hitChan.second);
617  int chanXtalkPrev = pixelFlag_ ? PixelDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second)
618  : Phase2TrackerDigi::pixelToChannel(XtalkPrev.first, XtalkPrev.second);
619  signalNew.emplace(chanXtalkPrev, DigitizerUtility::Amplitude(signalInElectrons_Xtalk, nullptr, -1.0));
620  }
621  if (hitChan.first < numRows - 1) {
622  auto XtalkNext = std::make_pair(hitChan.first + 1, hitChan.second);
623  int chanXtalkNext = pixelFlag_ ? PixelDigi::pixelToChannel(XtalkNext.first, XtalkNext.second)
624  : Phase2TrackerDigi::pixelToChannel(XtalkNext.first, XtalkNext.second);
625  signalNew.emplace(chanXtalkNext, DigitizerUtility::Amplitude(signalInElectrons_Xtalk, nullptr, -1.0));
626  }
627  }
628  for (auto const& l : signalNew) {
629  int chan = l.first;
630  auto iter = theSignal.find(chan);
631  if (iter != theSignal.end()) {
632  theSignal[chan] += l.second.ampl();
633  } else {
634  theSignal.emplace(chan, DigitizerUtility::Amplitude(l.second.ampl(), nullptr, -1.0));
635  }
636  }
637 }
638 
639 // ======================================================================
640 //
641 // Add noise on non-hit cells
642 //
643 // ======================================================================
645  uint32_t detID = pixdet->geographicalId().rawId();
646  signal_map_type& theSignal = _signal[detID];
647  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
648 
649  int numColumns = topol->ncolumns(); // det module number of cols&rows
650  int numRows = topol->nrows();
651 
652  int numberOfPixels = numRows * numColumns;
653  std::map<int, float, std::less<int> > otherPixels;
654 
655  theNoiser_->generate(numberOfPixels,
656  thePixelThreshold, //thr. in un. of nois
657  theNoiseInElectrons_, // noise in elec.
658  otherPixels,
659  rengine_);
660 
661  LogDebug("Phase2TrackerDigitizerAlgorithm")
662  << " Add noisy pixels " << numRows << " " << numColumns << " " << theNoiseInElectrons_ << " "
663  << theThresholdInE_Endcap_ << " " << theThresholdInE_Barrel_ << " " << numberOfPixels << " "
664  << otherPixels.size();
665 
666  // Add noisy pixels
667  for (auto const& el : otherPixels) {
668  int iy = el.first / numRows;
669  if (iy < 0 || iy > numColumns - 1)
670  LogWarning("Phase2TrackerDigitizerAlgorithm") << " error in iy " << iy;
671 
672  int ix = el.first - iy * numRows;
673  if (ix < 0 || ix > numRows - 1)
674  LogWarning("Phase2TrackerDigitizerAlgorithm") << " error in ix " << ix;
675 
677 
678  LogDebug("Phase2TrackerDigitizerAlgorithm")
679  << " Storing noise = " << el.first << " " << el.second << " " << ix << " " << iy << " " << chan;
680 
681  if (theSignal[chan] == 0)
682  theSignal[chan] = DigitizerUtility::Amplitude(el.second, nullptr, -1.);
683  }
684 }
685 // ============================================================================
686 //
687 // Simulate the readout inefficiencies.
688 // Delete a selected number of single pixels, dcols and rocs.
690  const Phase2TrackerGeomDetUnit* pixdet,
691  const TrackerTopology* tTopo) {
692  uint32_t detID = pixdet->geographicalId().rawId();
693  signal_map_type& theSignal = _signal[detID]; // check validity
694 
695  // Predefined efficiencies
696  float subdetEfficiency = 1.0;
697 
698  // setup the chip indices conversion
699  uint32_t Subid = DetId(detID).subdetId();
700  if (Subid == PixelSubdetector::PixelBarrel || Subid == StripSubdetector::TOB) { // barrel layers
701  uint32_t layerIndex = tTopo->pxbLayer(detID);
702  if (layerIndex - 1 < eff.barrel_efficiencies.size())
703  subdetEfficiency = eff.barrel_efficiencies[layerIndex - 1];
704  } else { // forward disks
705  uint32_t diskIndex = 2 * tTopo->pxfDisk(detID) - tTopo->pxfSide(detID);
706  if (diskIndex - 1 < eff.endcap_efficiencies.size())
707  subdetEfficiency = eff.endcap_efficiencies[diskIndex - 1];
708  }
709 
710  LogDebug("Phase2TrackerDigitizerAlgorithm") << " enter pixel_inefficiency " << subdetEfficiency;
711 
712  // Now loop again over pixels to kill some of them.
713  // Loop over hits, amplitude in electrons, channel = coded row,col
714  for (auto& s : theSignal) {
715  float rand = rengine_->flat();
716  if (rand > subdetEfficiency) {
717  // make amplitude =0
718  s.second.set(0.); // reset amplitude
719  }
720  }
721 }
722 void Phase2TrackerDigitizerAlgorithm::initializeEvent(CLHEP::HepRandomEngine& eng) {
724  gaussDistribution_ = std::make_unique<CLHEP::RandGaussQ>(eng, 0., theReadoutNoise_);
725  }
726  // Threshold smearing with gaussian distribution:
727  if (addThresholdSmearing_) {
729  std::make_unique<CLHEP::RandGaussQ>(eng, theThresholdInE_Endcap_, theThresholdSmearing_Endcap_);
731  std::make_unique<CLHEP::RandGaussQ>(eng, theThresholdInE_Barrel_, theThresholdSmearing_Barrel_);
732  }
733  rengine_ = &eng;
734  _signal.clear();
735 }
736 
737 // =======================================================================================
738 //
739 // Set the drift direction accoring to the Bfield in local det-unit frame
740 // Works for both barrel and forward pixels.
741 // Replace the sign convention to fit M.Swartz's formulaes.
742 // Configurations for barrel and foward pixels possess different tanLorentzAngleperTesla
743 // parameter value
744 
746  const GlobalVector& bfield,
747  const DetId& detId) const {
748  Frame detFrame(pixdet->surface().position(), pixdet->surface().rotation());
749  LocalVector Bfield = detFrame.toLocal(bfield);
750 
751  float dir_x = 0.0;
752  float dir_y = 0.0;
753  float dir_z = 0.0;
754  float scale = 1.0;
755 
756  uint32_t detID = pixdet->geographicalId().rawId();
757  uint32_t Sub_detid = DetId(detID).subdetId();
758 
759  // Read Lorentz angle from DB:
760  if (use_LorentzAngle_DB_) {
761  bool isPixel = (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == PixelSubdetector::PixelEndcap);
762 
763  float lorentzAngle =
765  float alpha2 = std::pow(lorentzAngle, 2);
766 
767  dir_x = -(lorentzAngle * Bfield.y() + alpha2 * Bfield.z() * Bfield.x());
768  dir_y = +(lorentzAngle * Bfield.x() - alpha2 * Bfield.z() * Bfield.y());
769  dir_z = -(1 + alpha2 * std::pow(Bfield.z(), 2));
770  scale = (1 + alpha2 * std::pow(Bfield.z(), 2));
771  } else {
772  // Read Lorentz angle from cfg file:
773  float alpha2_Endcap = 0.0;
774  float alpha2_Barrel = 0.0;
775  if (alpha2Order_) {
776  alpha2_Endcap = std::pow(tanLorentzAnglePerTesla_Endcap_, 2);
777  alpha2_Barrel = std::pow(tanLorentzAnglePerTesla_Barrel_, 2);
778  }
779 
780  if (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == StripSubdetector::TOB) { // barrel layers
781  dir_x = -(tanLorentzAnglePerTesla_Barrel_ * Bfield.y() + alpha2_Barrel * Bfield.z() * Bfield.x());
782  dir_y = +(tanLorentzAnglePerTesla_Barrel_ * Bfield.x() - alpha2_Barrel * Bfield.z() * Bfield.y());
783  dir_z = -(1 + alpha2_Barrel * std::pow(Bfield.z(), 2));
784  scale = (1 + alpha2_Barrel * std::pow(Bfield.z(), 2));
785 
786  } else { // forward disks
787  dir_x = -(tanLorentzAnglePerTesla_Endcap_ * Bfield.y() + alpha2_Endcap * Bfield.z() * Bfield.x());
788  dir_y = +(tanLorentzAnglePerTesla_Endcap_ * Bfield.x() - alpha2_Endcap * Bfield.z() * Bfield.y());
789  dir_z = -(1 + alpha2_Endcap * std::pow(Bfield.z(), 2));
790  scale = (1 + alpha2_Endcap * std::pow(Bfield.z(), 2));
791  }
792  }
793 
794  LocalVector theDriftDirection = LocalVector(dir_x / scale, dir_y / scale, dir_z / scale);
795  LogDebug("Phase2TrackerDigitizerAlgorithm") << " The drift direction in local coordinate is " << theDriftDirection;
796  return theDriftDirection;
797 }
798 
799 // =============================================================================
800 
802  signal_map_type& theSignal = _signal[detID]; // check validity
803 
804  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
805  for (auto& s : theSignal) {
806  std::pair<int, int> ip;
807  if (pixelFlag_)
808  ip = PixelDigi::channelToPixel(s.first); //get pixel pos
809  else
810  ip = Phase2TrackerDigi::channelToPixel(s.first); //get pixel pos
811 
812  int row = ip.first; // X in row
813  int col = ip.second; // Y is in col
814  // transform to ROC index coordinates
815  if (theSiPixelGainCalibrationService_->isDead(detID, col, row))
816  s.second.set(0.); // reset amplitude
817  }
818 }
819 
820 // ==========================================================================
821 
823  bool isbad = false;
824  int detid = detID;
826  for (auto const& det_m : deadModules_) {
827  int Dead_detID = det_m.getParameter<int>("Dead_detID");
828  Module = det_m.getParameter<std::string>("Module");
829  if (detid == Dead_detID) {
830  isbad = true;
831  break;
832  }
833  }
834 
835  if (!isbad)
836  return;
837 
838  signal_map_type& theSignal = _signal[detID]; // check validity
839  for (auto& s : theSignal) {
840  std::pair<int, int> ip;
841  if (pixelFlag_)
842  ip = PixelDigi::channelToPixel(s.first);
843  else
844  ip = Phase2TrackerDigi::channelToPixel(s.first); //get pixel pos
845 
846  if (Module == "whole" || (Module == "tbmA" && ip.first >= 80 && ip.first <= 159) ||
847  (Module == "tbmB" && ip.first <= 79))
848  s.second.set(0.);
849  }
850 }
851 // For premixing
852 void Phase2TrackerDigitizerAlgorithm::loadAccumulator(uint32_t detId, const std::map<int, float>& accumulator) {
853  auto& theSignal = _signal[detId];
854  // the input channel is always with PixelDigi definition
855  // if needed, that has to be converted to Phase2TrackerDigi convention
856  for (const auto& elem : accumulator) {
857  auto inserted = theSignal.emplace(elem.first, DigitizerUtility::Amplitude(elem.second, nullptr));
858  if (!inserted.second) {
859  throw cms::Exception("LogicError") << "Signal was already set for DetId " << detId;
860  }
861  }
862 }
863 
865  std::map<int, DigitizerUtility::DigiSimInfo>& digi_map,
866  const TrackerTopology* tTopo) {
867  uint32_t detID = pixdet->geographicalId().rawId();
868  auto it = _signal.find(detID);
869  if (it == _signal.end())
870  return;
871 
872  const signal_map_type& theSignal = _signal[detID];
873 
874  uint32_t Sub_detid = DetId(detID).subdetId();
875 
876  float theThresholdInE = 0.;
877  float theHIPThresholdInE = 0.;
878  // Define Threshold
879  if (Sub_detid == PixelSubdetector::PixelBarrel || Sub_detid == StripSubdetector::TOB) { // Barrel modules
880  theThresholdInE = addThresholdSmearing_ ? smearedThreshold_Barrel_->fire() // gaussian smearing
881  : theThresholdInE_Barrel_; // no smearing
882  theHIPThresholdInE = theHIPThresholdInE_Barrel_;
883  } else { // Forward disks modules
884  theThresholdInE = addThresholdSmearing_ ? smearedThreshold_Endcap_->fire() // gaussian smearing
885  : theThresholdInE_Endcap_; // no smearing
886  theHIPThresholdInE = theHIPThresholdInE_Endcap_;
887  }
888 
889  // if (addNoise) add_noise(pixdet, theThresholdInE/theNoiseInElectrons_); // generate noise
890  if (addNoise_)
891  add_noise(pixdet); // generate noise
892  if (addXtalk_)
893  add_cross_talk(pixdet);
894  if (addNoisyPixels_)
895  add_noisy_cells(pixdet, theHIPThresholdInE / theElectronPerADC_);
896 
897  // Do only if needed
898  if (addPixelInefficiency_ && !theSignal.empty()) {
899  if (use_ineff_from_db_)
900  pixel_inefficiency_db(detID);
901  else
902  pixel_inefficiency(subdetEfficiencies_, pixdet, tTopo);
903  }
904  if (use_module_killing_) {
905  if (use_deadmodule_DB_) // remove dead modules using DB
906  module_killing_DB(pixdet);
907  else // remove dead modules using the list in cfg file
908  module_killing_conf(detID);
909  }
910 
911  // Digitize if the signal is greater than threshold
912  for (auto const& s : theSignal) {
913  const DigitizerUtility::Amplitude& sig_data = s.second;
914  float signalInElectrons = sig_data.ampl();
915 
916  const auto& info_list = sig_data.simInfoList();
917  const DigitizerUtility::SimHitInfo* hitInfo = nullptr;
918  if (!info_list.empty())
919  hitInfo = std::max_element(info_list.begin(), info_list.end())->second.get();
920 
921  if (isAboveThreshold(hitInfo, signalInElectrons, theThresholdInE)) { // check threshold
923  info.sig_tot = convertSignalToAdc(detID, signalInElectrons, theThresholdInE); // adc
924  info.ot_bit = signalInElectrons > theHIPThresholdInE ? true : false;
925  if (makeDigiSimLinks_) {
926  for (auto const& l : sig_data.simInfoList()) {
927  float charge_frac = l.first / signalInElectrons;
928  if (l.first > -5.0)
929  info.simInfoList.push_back({charge_frac, l.second.get()});
930  }
931  }
932  digi_map.insert({s.first, info});
933  }
934  }
935 }
936 //
937 // Scale the Signal using Dual Slope option
938 //
939 int Phase2TrackerDigitizerAlgorithm::convertSignalToAdc(uint32_t detID, float signal_in_elec, float threshold) {
940  int signal_in_adc;
941  int temp_signal;
942  const int max_limit = 10;
943  if (thePhase2ReadoutMode_ == 0) {
944  signal_in_adc = theAdcFullScale_;
945  } else {
946  if (thePhase2ReadoutMode_ == -1) {
947  temp_signal = std::min(static_cast<int>(signal_in_elec / theElectronPerADC_), theAdcFullScale_);
948  } else {
949  // calculate the kink point and the slope
950  int dualslope_param = std::min(std::abs(thePhase2ReadoutMode_), max_limit);
951  int kink_point = static_cast<int>(theAdcFullScale_ / 2) + 1;
952  // C-ROC: first valid ToT code above threshold is 0b0000
953  temp_signal = std::floor((signal_in_elec - threshold) / theElectronPerADC_);
954  if (temp_signal > kink_point)
955  temp_signal = std::floor((temp_signal - kink_point) / (pow(2, dualslope_param - 1))) + kink_point;
956  }
957  signal_in_adc = std::min(temp_signal, theAdcFullScale_);
958  LogTrace("Phase2TrackerDigitizerAlgorithm")
959  << " DetId " << detID << " signal_in_elec " << signal_in_elec << " threshold " << threshold
960  << " signal_above_thr " << signal_in_elec - threshold << " temp conversion "
961  << std::floor((signal_in_elec - threshold) / theElectronPerADC_) + 1 << " signal after slope correction "
962  << temp_signal << " signal_in_adc " << signal_in_adc;
963  }
964  return signal_in_adc;
965 }
967  constexpr float p1 = 12.5f;
968  constexpr float p2 = 0.2733f;
969  constexpr float p3 = 0.147f;
970 
971  auto xx = std::min(0.5f * x * x, p1);
972  return 0.5f * (1.f - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + p2 / (1.f + p3 * xx)))), x));
973 }
virtual bool select_hit(const PSimHit &hit, double tCorr, double &sigScale) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int pxbLayer(const DetId &id) const
static const TGPicture * info(bool iBackgroundIsBlack)
Local3DVector LocalVector
Definition: LocalVector.h:12
T perp() const
Definition: PV3DBase.h:69
LocalVector DriftDirection(const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
void loadAccumulator(uint32_t detId, const std::map< int, float > &accumulator)
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:69
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual int ncolumns() const =0
T z() const
Definition: PV3DBase.h:61
const std::vector< std::pair< float, std::unique_ptr< SimHitInfo > > > & simInfoList() const
virtual void initializeEvent(CLHEP::HepRandomEngine &eng)
virtual int nrows() const =0
virtual bool isAboveThreshold(const DigitizerUtility::SimHitInfo *hitInfo, float charge, float thr) const
virtual void add_cross_talk(const Phase2TrackerGeomDetUnit *pixdet)
const SiPixelLorentzAngle * siPixelLorentzAngle_
T x() const
Definition: PV2DBase.h:43
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate_
virtual void add_noise(const Phase2TrackerGeomDetUnit *pixdet)
virtual void module_killing_conf(uint32_t detID)
#define LogTrace(id)
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:75
T y() const
Definition: PV2DBase.h:44
virtual float thickness() const =0
U second(std::pair< T, U > const &p)
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
virtual void add_noisy_cells(const Phase2TrackerGeomDetUnit *pixdet, float thePixelThreshold)
std::unique_ptr< CLHEP::RandGaussQ > gaussDistribution_
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
virtual void accumulateSimHits(const std::vector< PSimHit >::const_iterator inputBegin, const std::vector< PSimHit >::const_iterator inputEnd, const size_t inputBeginGlobalIndex, const uint32_t tofBin, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual std::vector< DigitizerUtility::EnergyDepositUnit > primary_ionization(const PSimHit &hit) const
T sqrt(T t)
Definition: SSEVec.h:19
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet &conf_common, const edm::ParameterSet &conf_specific, edm::ConsumesCollector iC)
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:88
T mag() const
Definition: PV3DBase.h:64
unsigned int pxfDisk(const DetId &id) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual std::vector< DigitizerUtility::SignalPoint > drift(const PSimHit &hit, const Phase2TrackerGeomDetUnit *pixdet, const GlobalVector &bfield, const std::vector< DigitizerUtility::EnergyDepositUnit > &ionization_points) const
virtual int channel(const LocalPoint &p) const =0
double f[11][100]
virtual void induce_signal(const PSimHit &hit, const size_t hitIndex, const uint32_t tofBin, const Phase2TrackerGeomDetUnit *pixdet, const std::vector< DigitizerUtility::SignalPoint > &collection_points)
virtual std::vector< float > fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegments) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
virtual void pixel_inefficiency_db(uint32_t detID)
static constexpr auto TOB
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Endcap_
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
virtual void digitize(const Phase2TrackerGeomDetUnit *pixdet, std::map< int, DigitizerUtility::DigiSimInfo > &digi_map, const TrackerTopology *tTopo)
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
#define M_PI
std::vector< edm::ParameterSet > Parameters
constexpr double c_inv
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const PositionType & position() const
const SiPhase2OuterTrackerLorentzAngle * siPhase2OTLorentzAngle_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::unique_ptr< CLHEP::RandGaussQ > smearedThreshold_Barrel_
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
HLT enums.
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
col
Definition: cuy.py:1009
bool isPixel(HitType hitType)
const RotationType & rotation() const
virtual void pixel_inefficiency(const SubdetEfficiencies &eff, const Phase2TrackerGeomDetUnit *pixdet, const TrackerTopology *tTopo)
virtual std::pair< float, float > pitch() const =0
Log< level::Warning, false > LogWarning
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
float getLorentzAngle(const uint32_t &) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
virtual void module_killing_DB(const Phase2TrackerGeomDetUnit *pixdet)=0
int convertSignalToAdc(uint32_t detID, float signal_in_elec, float threshold)
#define LogDebug(id)
const Bounds & bounds() const
Definition: Surface.h:87
unsigned transform(const HcalDetId &id, unsigned transformCode)