CMS 3D CMS Logo

SiPixelDigitizerAlgorithm.cc
Go to the documentation of this file.
1 //class SiPixelDigitizerAlgorithm SimTracker/SiPixelDigitizer/src/SiPixelDigitizerAlgoithm.cc
2 
3 // Original Author Danek Kotlinski
4 // Ported in CMSSW by Michele Pioppi-INFN perugia
5 // Added DB capabilities by F.Blekman, Cornell University
6 // Created: Mon Sep 26 11:08:32 CEST 2005
7 // Add tof, change AddNoise to tracked. 4/06
8 // Change drift direction. 6/06 d.k.
9 // Add the statuis (non-rate dependent) inefficiency.
10 // -1 - no ineffciency
11 // 0 - static inefficency only
12 // 1,2 - low-lumi rate dependent inefficency added
13 // 10 - high-lumi inefficiency added
14 // Adopt the correct drift sign convetion from Morris Swartz. d.k. 8/06
15 // Add more complex misscalinbration, change kev/e to 3.61, diff=3.7,d.k.9/06
16 // Add the readout channel electronic noise. d.k. 3/07
17 // Lower the pixel noise from 500 to 175elec.
18 // Change the input threshold from noise units to electrons.
19 // Lower the amount of static dead pixels from 0.01 to 0.001.
20 // Modify to the new random number services. d.k. 5/07
21 // Protect against sigma=0 (delta tracks on the surface). d.k.5/07
22 // Change the TOF cut to lower and upper limit. d.k. 7/07
23 //
24 // July 2008: Split Lorentz Angle configuration in BPix/FPix (V. Cuplov)
25 // tanLorentzAngleperTesla_FPix=0.0912 and tanLorentzAngleperTesla_BPix=0.106
26 // Sept. 2008: Disable Pixel modules which are declared dead in the configuration python file. (V. Cuplov)
27 // Oct. 2008: Accessing/Reading the Lorentz angle from the DataBase instead of the cfg file. (V. Cuplov)
28 // Accessing dead modules from the DB. Implementation done and tested on a test.db
29 // Do not use this option for now. The PixelQuality Objects are not in the official DB yet.
30 // Feb. 2009: Split Fpix and Bpix threshold and use official numbers (V. Cuplov)
31 // ThresholdInElectrons_FPix = 2870 and ThresholdInElectrons_BPix = 3700
32 // update the electron to VCAL conversion using: VCAL_electrons = VCAL * 65.5 - 414
33 // Feb. 2009: Threshold gaussian smearing (V. Cuplov)
34 // March, 2009: changed DB access to *SimRcd objects (to de-couple the DB objects from reco chain) (F. Blekman)
35 // May, 2009: Pixel charge VCAL smearing. (V. Cuplov)
36 // November, 2009: new parameterization of the pixel response. (V. Cuplov)
37 // December, 2009: Fix issue with different compilers.
38 // October, 2010: Improvement: Removing single dead ROC (V. Cuplov)
39 // November, 2010: Bug fix in removing TBMB/A half-modules (V. Cuplov)
40 // February, 2011: Time improvement in DriftDirection() (J. Bashir Butt)
41 // June, 2011: Bug Fix for pixels on ROC edges in module_killing_DB() (J. Bashir Butt)
42 // February, 2018: Implement cluster charge reweighting (P. Schuetze, with code from A. Hazi)
43 #include <iostream>
44 #include <iomanip>
45 
47 
54 
55 #include <gsl/gsl_sf_erf.h>
57 #include "CLHEP/Random/RandGaussQ.h"
58 #include "CLHEP/Random/RandFlat.h"
59 #include "CLHEP/Random/RandGeneral.h"
60 
61 //#include "PixelIndices.h"
65 
71 
72 // Accessing dead pixel modules from the DB:
74 
76 
84 
98 
105 
106 // Geometry
110 
112 
113 using namespace edm;
114 using namespace sipixelobjects;
115 
117  if (use_ineff_from_db_) { // load gain calibration service fromdb...
118  theSiPixelGainCalibrationService_->setESObjects(es);
119  }
120  if (use_deadmodule_DB_) {
121  es.get<SiPixelQualityRcd>().get(siPixelQualityLabel, SiPixelBadModule_);
122  }
123  if (use_LorentzAngle_DB_) {
124  // Get Lorentz angle from DB record
125  es.get<SiPixelLorentzAngleSimRcd>().get(SiPixelLorentzAngle_);
126  }
127  //gets the map and geometry from the DB (to kill ROCs)
128  es.get<SiPixelFedCablingMapRcd>().get(map_);
129  es.get<TrackerDigiGeometryRecord>().get(geom_);
130 
131  if (KillBadFEDChannels) {
132  es.get<SiPixelStatusScenarioProbabilityRcd>().get(scenarioProbabilityHandle);
133  es.get<SiPixelFEDChannelContainerESProducerRcd>().get(PixelFEDChannelCollectionMapHandle);
134  quality_map = PixelFEDChannelCollectionMapHandle.product();
135 
136  SiPixelQualityProbabilities::probabilityMap m_probabilities = scenarioProbabilityHandle->getProbability_Map();
137  std::vector<std::string> allScenarios;
138 
139  std::transform(quality_map->begin(),
140  quality_map->end(),
141  std::back_inserter(allScenarios),
142  [](const PixelFEDChannelCollectionMap::value_type& pair) { return pair.first; });
143 
144  std::vector<std::string> allScenariosInProb;
145 
146  for (auto it = m_probabilities.begin(); it != m_probabilities.end(); ++it) {
147  //int PUbin = it->first;
148  for (const auto& entry : it->second) {
149  auto scenario = entry.first;
150  auto probability = entry.second;
151  if (probability != 0) {
152  if (std::find(allScenariosInProb.begin(), allScenariosInProb.end(), scenario) == allScenariosInProb.end()) {
153  allScenariosInProb.push_back(scenario);
154  }
155  } // if prob!=0
156  } // loop on the scenarios for that PU bin
157  } // loop on PU bins
158 
159  std::vector<std::string> notFound;
160  std::copy_if(allScenariosInProb.begin(),
161  allScenariosInProb.end(),
162  std::back_inserter(notFound),
163  [&allScenarios](const std::string& arg) {
164  return (std::find(allScenarios.begin(), allScenarios.end(), arg) == allScenarios.end());
165  });
166 
167  if (!notFound.empty()) {
168  for (const auto& entry : notFound) {
169  edm::LogError("SiPixelFEDChannelContainer")
170  << "The requested scenario: " << entry << " is not found in the map!!" << std::endl;
171  }
172  throw cms::Exception("SiPixelDigitizerAlgorithm") << "Found: " << notFound.size()
173  << " missing scenario(s) in SiPixelStatusScenariosRcd while "
174  "present in SiPixelStatusScenarioProbabilityRcd \n";
175  }
176  }
177 
178  TheNewSiPixelChargeReweightingAlgorithmClass->init(es);
179 }
180 
181 //=========================================================================
182 
184  :
185 
187  conf.getParameter<std::string>("SiPixelQualityLabel")), //string to specify SiPixelQuality label
188  _signal(),
189  makeDigiSimLinks_(conf.getUntrackedParameter<bool>("makeDigiSimLinks", true)),
190  use_ineff_from_db_(conf.getParameter<bool>("useDB")),
191  use_module_killing_(conf.getParameter<bool>("killModules")), // boolean to kill or not modules
192  use_deadmodule_DB_(conf.getParameter<bool>("DeadModules_DB")), // boolean to access dead modules from DB
193  use_LorentzAngle_DB_(conf.getParameter<bool>("LorentzAngle_DB")), // boolean to access Lorentz angle from DB
194 
195  DeadModules(use_deadmodule_DB_ ? Parameters()
196  : conf.getParameter<Parameters>("DeadModules")), // get dead module from cfg file
197 
198  TheNewSiPixelChargeReweightingAlgorithmClass(),
199 
200  // Common pixel parameters
201  // These are parameters which are not likely to be changed
202  GeVperElectron(3.61E-09), // 1 electron(3.61eV, 1keV(277e, mod 9/06 d.k.
203  Sigma0(0.00037), // Charge diffusion constant 7->3.7
204  Dist300(0.0300), // normalized to 300micron Silicon
205  alpha2Order(conf.getParameter<bool>("Alpha2Order")), // switch on/off of E.B effect
206  ClusterWidth(3.), // Charge integration spread on the collection plane
207 
208  // get external parameters:
209  // To account for upgrade geometries do not assume the number
210  // of layers or disks.
211  NumberOfBarrelLayers(conf.exists("NumPixelBarrel") ? conf.getParameter<int>("NumPixelBarrel") : 3),
212  NumberOfEndcapDisks(conf.exists("NumPixelEndcap") ? conf.getParameter<int>("NumPixelEndcap") : 2),
213 
214  // ADC calibration 1adc count(135e.
215  // Corresponds to 2adc/kev, 270[e/kev]/135[e/adc](2[adc/kev]
216  // Be carefull, this parameter is also used in SiPixelDet.cc to
217  // calculate the noise in adc counts from noise in electrons.
218  // Both defaults should be the same.
219  theElectronPerADC(conf.getParameter<double>("ElectronPerAdc")),
220 
221  // ADC saturation value, 255(8bit adc.
222  //theAdcFullScale(conf.getUntrackedParameter<int>("AdcFullScale",255)),
223  theAdcFullScale(conf.getParameter<int>("AdcFullScale")),
224 
225  // Noise in electrons:
226  // Pixel cell noise, relevant for generating noisy pixels
227  theNoiseInElectrons(conf.getParameter<double>("NoiseInElectrons")),
228 
229  // Fill readout noise, including all readout chain, relevant for smearing
230  //theReadoutNoise(conf.getUntrackedParameter<double>("ReadoutNoiseInElec",500.)),
231  theReadoutNoise(conf.getParameter<double>("ReadoutNoiseInElec")),
232 
233  // Pixel threshold in units of noise:
234  // thePixelThreshold(conf.getParameter<double>("ThresholdInNoiseUnits")),
235  // Pixel threshold in electron units.
236  theThresholdInE_FPix(conf.getParameter<double>("ThresholdInElectrons_FPix")),
237  theThresholdInE_BPix(conf.getParameter<double>("ThresholdInElectrons_BPix")),
238  theThresholdInE_BPix_L1(conf.exists("ThresholdInElectrons_BPix_L1")
239  ? conf.getParameter<double>("ThresholdInElectrons_BPix_L1")
240  : theThresholdInE_BPix),
241  theThresholdInE_BPix_L2(conf.exists("ThresholdInElectrons_BPix_L2")
242  ? conf.getParameter<double>("ThresholdInElectrons_BPix_L2")
243  : theThresholdInE_BPix),
244 
245  // Add threshold gaussian smearing:
246  theThresholdSmearing_FPix(conf.getParameter<double>("ThresholdSmearing_FPix")),
247  theThresholdSmearing_BPix(conf.getParameter<double>("ThresholdSmearing_BPix")),
248  theThresholdSmearing_BPix_L1(conf.exists("ThresholdSmearing_BPix_L1")
249  ? conf.getParameter<double>("ThresholdSmearing_BPix_L1")
250  : theThresholdSmearing_BPix),
251  theThresholdSmearing_BPix_L2(conf.exists("ThresholdSmearing_BPix_L2")
252  ? conf.getParameter<double>("ThresholdSmearing_BPix_L2")
253  : theThresholdSmearing_BPix),
254 
255  // electrons to VCAL conversion needed in misscalibrate()
256  electronsPerVCAL(conf.getParameter<double>("ElectronsPerVcal")),
257  electronsPerVCAL_Offset(conf.getParameter<double>("ElectronsPerVcal_Offset")),
258  electronsPerVCAL_L1(conf.exists("ElectronsPerVcal_L1") ? conf.getParameter<double>("ElectronsPerVcal_L1")
259  : electronsPerVCAL),
260  electronsPerVCAL_L1_Offset(conf.exists("ElectronsPerVcal_L1_Offset")
261  ? conf.getParameter<double>("ElectronsPerVcal_L1_Offset")
262  : electronsPerVCAL_Offset),
263 
264  //theTofCut 12.5, cut in particle TOD +/- 12.5ns
265  //theTofCut(conf.getUntrackedParameter<double>("TofCut",12.5)),
266  theTofLowerCut(conf.getParameter<double>("TofLowerCut")),
267  theTofUpperCut(conf.getParameter<double>("TofUpperCut")),
268 
269  // Get the Lorentz angle from the cfg file:
270  tanLorentzAnglePerTesla_FPix(use_LorentzAngle_DB_ ? 0.0
271  : conf.getParameter<double>("TanLorentzAnglePerTesla_FPix")),
272  tanLorentzAnglePerTesla_BPix(use_LorentzAngle_DB_ ? 0.0
273  : conf.getParameter<double>("TanLorentzAnglePerTesla_BPix")),
274 
275  // signal response new parameterization: split Fpix and BPix
276  FPix_p0(conf.getParameter<double>("FPix_SignalResponse_p0")),
277  FPix_p1(conf.getParameter<double>("FPix_SignalResponse_p1")),
278  FPix_p2(conf.getParameter<double>("FPix_SignalResponse_p2")),
279  FPix_p3(conf.getParameter<double>("FPix_SignalResponse_p3")),
280 
281  BPix_p0(conf.getParameter<double>("BPix_SignalResponse_p0")),
282  BPix_p1(conf.getParameter<double>("BPix_SignalResponse_p1")),
283  BPix_p2(conf.getParameter<double>("BPix_SignalResponse_p2")),
284  BPix_p3(conf.getParameter<double>("BPix_SignalResponse_p3")),
285 
286  // Add noise
287  addNoise(conf.getParameter<bool>("AddNoise")),
288 
289  // Smear the pixel charge with a gaussian which RMS is a function of the
290  // pixel charge (Danek's study)
291  addChargeVCALSmearing(conf.getParameter<bool>("ChargeVCALSmearing")),
292 
293  // Add noisy pixels
294  addNoisyPixels(conf.getParameter<bool>("AddNoisyPixels")),
295 
296  // Fluctuate charge in track subsegments
297  fluctuateCharge(conf.getUntrackedParameter<bool>("FluctuateCharge", true)),
298 
299  // Control the pixel inefficiency
300  AddPixelInefficiency(conf.getParameter<bool>("AddPixelInefficiency")),
301  KillBadFEDChannels(conf.getParameter<bool>("KillBadFEDChannels")),
302 
303  // Add threshold gaussian smearing:
304  addThresholdSmearing(conf.getParameter<bool>("AddThresholdSmearing")),
305 
306  // Get the constants for the miss-calibration studies
307  doMissCalibrate(conf.getParameter<bool>("MissCalibrate")), // Enable miss-calibration
308  theGainSmearing(conf.getParameter<double>("GainSmearing")), // sigma of the gain smearing
309  theOffsetSmearing(conf.getParameter<double>("OffsetSmearing")), //sigma of the offset smearing
310 
311  // Add pixel radiation damage for upgrade studies
312  AddPixelAging(conf.getParameter<bool>("DoPixelAging")),
313  UseReweighting(conf.getParameter<bool>("UseReweighting")),
314 
315  // delta cutoff in MeV, has to be same as in OSCAR(0.030/cmsim=1.0 MeV
316  //tMax(0.030), // In MeV.
317  //tMax(conf.getUntrackedParameter<double>("deltaProductionCut",0.030)),
318  tMax(conf.getParameter<double>("deltaProductionCut")),
319 
320  fluctuate(fluctuateCharge ? new SiG4UniversalFluctuation() : nullptr),
321  theNoiser(addNoise ? new GaussianTailNoiseGenerator() : nullptr),
322  calmap(doMissCalibrate ? initCal() : std::map<int, CalParameters, std::less<int> >()),
323  theSiPixelGainCalibrationService_(use_ineff_from_db_ ? new SiPixelGainCalibrationOfflineSimService(conf)
324  : nullptr),
325  pixelEfficiencies_(conf, AddPixelInefficiency, NumberOfBarrelLayers, NumberOfEndcapDisks),
326  pixelAging_(conf, AddPixelAging, NumberOfBarrelLayers, NumberOfEndcapDisks) {
327  LogInfo("PixelDigitizer ") << "SiPixelDigitizerAlgorithm constructed"
328  << "Configuration parameters:"
329  << "Threshold/Gain = "
330  << "threshold in electron FPix = " << theThresholdInE_FPix
331  << "threshold in electron BPix = " << theThresholdInE_BPix
332  << "threshold in electron BPix Layer1 = " << theThresholdInE_BPix_L1
333  << "threshold in electron BPix Layer2 = " << theThresholdInE_BPix_L2 << " "
334  << theElectronPerADC << " " << theAdcFullScale << " The delta cut-off is set to " << tMax
335  << " pix-inefficiency " << AddPixelInefficiency;
336 
337  TheNewSiPixelChargeReweightingAlgorithmClass = std::make_unique<SiPixelChargeReweightingAlgorithm>(conf);
338 }
339 
340 std::map<int, SiPixelDigitizerAlgorithm::CalParameters, std::less<int> > SiPixelDigitizerAlgorithm::initCal() const {
341  using std::cerr;
342  using std::cout;
343  using std::endl;
344 
345  std::map<int, SiPixelDigitizerAlgorithm::CalParameters, std::less<int> > calmap;
346  // Prepare for the analog amplitude miss-calibration
347  LogDebug("PixelDigitizer ") << " miss-calibrate the pixel amplitude ";
348 
349  const bool ReadCalParameters = false;
350  if (ReadCalParameters) { // Read the calibration files from file
351  // read the calibration constants from a file (testing only)
352  std::ifstream in_file; // data file pointer
353  char filename[80] = "phCalibrationFit_C0.dat";
354 
355  in_file.open(filename, std::ios::in); // in C++
356  if (in_file.bad()) {
357  cout << " File not found " << endl;
358  return calmap; // signal error
359  }
360  cout << " file opened : " << filename << endl;
361 
362  char line[500];
363  for (int i = 0; i < 3; i++) {
364  in_file.getline(line, 500, '\n');
365  cout << line << endl;
366  }
367 
368  cout << " test map" << endl;
369 
370  float par0, par1, par2, par3;
371  int colid, rowid;
373  // Read MC tracks
374  for (int i = 0; i < (52 * 80); i++) { // loop over tracks
375  in_file >> par0 >> par1 >> par2 >> par3 >> name >> colid >> rowid;
376  if (in_file.bad()) { // check for errors
377  cerr << "Cannot read data file" << endl;
378  return calmap;
379  }
380  if (in_file.eof() != 0) {
381  cerr << in_file.eof() << " " << in_file.gcount() << " " << in_file.fail() << " " << in_file.good()
382  << " end of file " << endl;
383  return calmap;
384  }
385 
386  //cout << " line " << i << " " <<par0<<" "<<par1<<" "<<par2<<" "<<par3<<" "
387  // <<colid<<" "<<rowid<<endl;
388 
389  CalParameters onePix;
390  onePix.p0 = par0;
391  onePix.p1 = par1;
392  onePix.p2 = par2;
393  onePix.p3 = par3;
394 
395  // Convert ROC pixel index to channel
396  int chan = PixelIndices::pixelToChannelROC(rowid, colid);
397  calmap.insert(std::pair<int, CalParameters>(chan, onePix));
398 
399  // Testing the index conversion, can be skipped
400  std::pair<int, int> p = PixelIndices::channelToPixelROC(chan);
401  if (rowid != p.first)
402  cout << " wrong channel row " << rowid << " " << p.first << endl;
403  if (colid != p.second)
404  cout << " wrong channel col " << colid << " " << p.second << endl;
405 
406  } // pixel loop in a ROC
407 
408  cout << " map size " << calmap.size() << " max " << calmap.max_size() << " " << calmap.empty() << endl;
409 
410  // cout << " map size " << calmap.size() << endl;
411  // map<int,CalParameters,std::less<int> >::iterator ix,it;
412  // map<int,CalParameters,std::less<int> >::const_iterator ip;
413  // for (ix = calmap.begin(); ix != calmap.end(); ++ix) {
414  // int i = (*ix).first;
415  // std::pair<int,int> p = channelToPixelROC(i);
416  // it = calmap.find(i);
417  // CalParameters y = (*it).second;
418  // CalParameters z = (*ix).second;
419  // cout << i <<" "<<p.first<<" "<<p.second<<" "<<y.p0<<" "<<z.p0<<" "<<calmap[i].p0<<endl;
420 
421  // //int dummy=0;
422  // //cin>>dummy;
423  // }
424 
425  } // end if readparameters
426  return calmap;
427 } // end initCal()
428 
429 //=========================================================================
431  LogDebug("PixelDigitizer") << "SiPixelDigitizerAlgorithm deleted";
432 }
433 
434 // Read DynIneff Scale factors from Configuration
437  int NumberOfBarrelLayers,
438  int NumberOfEndcapDisks) {
439  // pixel inefficiency
440  // Don't use Hard coded values, read inefficiencies in from DB/python config or don't use any
441  int NumberOfTotLayers = NumberOfBarrelLayers + NumberOfEndcapDisks;
443  if (AddPixelInefficiency) {
444  FromConfig = conf.exists("thePixelColEfficiency_BPix1") && conf.exists("thePixelColEfficiency_BPix2") &&
445  conf.exists("thePixelColEfficiency_BPix3") && conf.exists("thePixelColEfficiency_FPix1") &&
446  conf.exists("thePixelColEfficiency_FPix2") && conf.exists("thePixelEfficiency_BPix1") &&
447  conf.exists("thePixelEfficiency_BPix2") && conf.exists("thePixelEfficiency_BPix3") &&
448  conf.exists("thePixelEfficiency_FPix1") && conf.exists("thePixelEfficiency_FPix2") &&
449  conf.exists("thePixelChipEfficiency_BPix1") && conf.exists("thePixelChipEfficiency_BPix2") &&
450  conf.exists("thePixelChipEfficiency_BPix3") && conf.exists("thePixelChipEfficiency_FPix1") &&
451  conf.exists("thePixelChipEfficiency_FPix2");
452  if (NumberOfBarrelLayers == 3)
453  FromConfig = FromConfig && conf.exists("theLadderEfficiency_BPix1") && conf.exists("theLadderEfficiency_BPix2") &&
454  conf.exists("theLadderEfficiency_BPix3") && conf.exists("theModuleEfficiency_BPix1") &&
455  conf.exists("theModuleEfficiency_BPix2") && conf.exists("theModuleEfficiency_BPix3") &&
456  conf.exists("thePUEfficiency_BPix1") && conf.exists("thePUEfficiency_BPix2") &&
457  conf.exists("thePUEfficiency_BPix3") && conf.exists("theInnerEfficiency_FPix1") &&
458  conf.exists("theInnerEfficiency_FPix2") && conf.exists("theOuterEfficiency_FPix1") &&
459  conf.exists("theOuterEfficiency_FPix2") && conf.exists("thePUEfficiency_FPix_Inner") &&
460  conf.exists("thePUEfficiency_FPix_Outer") && conf.exists("theInstLumiScaleFactor");
461  if (NumberOfBarrelLayers >= 4)
462  FromConfig = FromConfig && conf.exists("thePixelColEfficiency_BPix4") &&
463  conf.exists("thePixelEfficiency_BPix4") && conf.exists("thePixelChipEfficiency_BPix4");
464  if (NumberOfEndcapDisks >= 3)
465  FromConfig = FromConfig && conf.exists("thePixelColEfficiency_FPix3") &&
466  conf.exists("thePixelEfficiency_FPix3") && conf.exists("thePixelChipEfficiency_FPix3");
467  if (FromConfig) {
468  LogInfo("PixelDigitizer ") << "The PixelDigitizer inefficiency configuration is read from the config file.\n";
469  theInstLumiScaleFactor = conf.getParameter<double>("theInstLumiScaleFactor");
470  int i = 0;
471  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix1");
472  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix2");
473  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix3");
474  if (NumberOfBarrelLayers >= 4) {
475  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_BPix4");
476  }
477  //
478  i = 0;
479  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix1");
480  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix2");
481  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix3");
482  if (NumberOfBarrelLayers >= 4) {
483  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_BPix4");
484  }
485  //
486  i = 0;
487  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix1");
488  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix2");
489  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix3");
490  if (NumberOfBarrelLayers >= 4) {
491  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_BPix4");
492  }
493  //
494  if (NumberOfBarrelLayers == 3) {
495  i = 0;
496  theLadderEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theLadderEfficiency_BPix1");
497  theLadderEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theLadderEfficiency_BPix2");
498  theLadderEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theLadderEfficiency_BPix3");
499  if (((theLadderEfficiency_BPix[0].size() != 20) || (theLadderEfficiency_BPix[1].size() != 32) ||
500  (theLadderEfficiency_BPix[2].size() != 44)) &&
501  (NumberOfBarrelLayers == 3))
502  throw cms::Exception("Configuration") << "Wrong ladder number in efficiency config!";
503  //
504  i = 0;
505  theModuleEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theModuleEfficiency_BPix1");
506  theModuleEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theModuleEfficiency_BPix2");
507  theModuleEfficiency_BPix[i++] = conf.getParameter<std::vector<double> >("theModuleEfficiency_BPix3");
508  if (((theModuleEfficiency_BPix[0].size() != 4) || (theModuleEfficiency_BPix[1].size() != 4) ||
509  (theModuleEfficiency_BPix[2].size() != 4)) &&
510  (NumberOfBarrelLayers == 3))
511  throw cms::Exception("Configuration") << "Wrong module number in efficiency config!";
512  //
513  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_BPix1"));
514  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_BPix2"));
515  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_BPix3"));
516  if (((thePUEfficiency[0].empty()) || (thePUEfficiency[1].empty()) || (thePUEfficiency[2].empty())) &&
517  (NumberOfBarrelLayers == 3))
518  throw cms::Exception("Configuration")
519  << "At least one PU efficiency (BPix) number is needed in efficiency config!";
520  }
521  // The next is needed for Phase2 Tracker studies
522  if (NumberOfBarrelLayers >= 5) {
523  if (NumberOfTotLayers > 20) {
524  throw cms::Exception("Configuration") << "SiPixelDigitizer was given more layers than it can handle";
525  }
526  // For Phase2 tracker layers just set the outermost BPix inefficiency to 99.9% THESE VALUES ARE HARDCODED ALSO ELSEWHERE IN THIS FILE
527  for (int j = 5; j <= NumberOfBarrelLayers; j++) {
528  thePixelColEfficiency[j - 1] = 0.999;
529  thePixelEfficiency[j - 1] = 0.999;
530  thePixelChipEfficiency[j - 1] = 0.999;
531  }
532  }
533  //
534  i = FPixIndex;
535  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_FPix1");
536  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_FPix2");
537  if (NumberOfEndcapDisks >= 3) {
538  thePixelColEfficiency[i++] = conf.getParameter<double>("thePixelColEfficiency_FPix3");
539  }
540  i = FPixIndex;
541  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_FPix1");
542  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_FPix2");
543  if (NumberOfEndcapDisks >= 3) {
544  thePixelEfficiency[i++] = conf.getParameter<double>("thePixelEfficiency_FPix3");
545  }
546  i = FPixIndex;
547  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_FPix1");
548  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_FPix2");
549  if (NumberOfEndcapDisks >= 3) {
550  thePixelChipEfficiency[i++] = conf.getParameter<double>("thePixelChipEfficiency_FPix3");
551  }
552  // The next is needed for Phase2 Tracker studies
553  if (NumberOfEndcapDisks >= 4) {
554  if (NumberOfTotLayers > 20) {
555  throw cms::Exception("Configuration") << "SiPixelDigitizer was given more layers than it can handle";
556  }
557  // For Phase2 tracker layers just set the extra FPix disk inefficiency to 99.9% THESE VALUES ARE HARDCODED ALSO ELSEWHERE IN THIS FILE
558  for (int j = 4 + FPixIndex; j <= NumberOfEndcapDisks + NumberOfBarrelLayers; j++) {
559  thePixelColEfficiency[j - 1] = 0.999;
560  thePixelEfficiency[j - 1] = 0.999;
561  thePixelChipEfficiency[j - 1] = 0.999;
562  }
563  }
564  //FPix Dynamic Inefficiency
565  if (NumberOfBarrelLayers == 3) {
566  i = FPixIndex;
567  theInnerEfficiency_FPix[i++] = conf.getParameter<double>("theInnerEfficiency_FPix1");
568  theInnerEfficiency_FPix[i++] = conf.getParameter<double>("theInnerEfficiency_FPix2");
569  i = FPixIndex;
570  theOuterEfficiency_FPix[i++] = conf.getParameter<double>("theOuterEfficiency_FPix1");
571  theOuterEfficiency_FPix[i++] = conf.getParameter<double>("theOuterEfficiency_FPix2");
572  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_FPix_Inner"));
573  thePUEfficiency.push_back(conf.getParameter<std::vector<double> >("thePUEfficiency_FPix_Outer"));
574  if (((thePUEfficiency[3].empty()) || (thePUEfficiency[4].empty())) && (NumberOfEndcapDisks == 2))
575  throw cms::Exception("Configuration")
576  << "At least one (FPix) PU efficiency number is needed in efficiency config!";
577  pu_scale.resize(thePUEfficiency.size());
578  }
579  } else
580  LogInfo("PixelDigitizer ") << "The PixelDigitizer inefficiency configuration is read from the database.\n";
581  }
582  // the first "NumberOfBarrelLayers" settings [0],[1], ... , [NumberOfBarrelLayers-1] are for the barrel pixels
583  // the next "NumberOfEndcapDisks" settings [NumberOfBarrelLayers],[NumberOfBarrelLayers+1], ... [NumberOfEndcapDisks+NumberOfBarrelLayers-1]
584 }
585 
586 // Read DynIneff Scale factors from DB
589  if (bunchspace == 50)
591  else
594  }
595 }
596 
600  theInstLumiScaleFactor = SiPixelDynamicInefficiency->gettheInstLumiScaleFactor();
601  const std::map<uint32_t, double>& PixelGeomFactorsDBIn = SiPixelDynamicInefficiency->getPixelGeomFactors();
602  const std::map<uint32_t, double>& ColGeomFactorsDB = SiPixelDynamicInefficiency->getColGeomFactors();
603  const std::map<uint32_t, double>& ChipGeomFactorsDB = SiPixelDynamicInefficiency->getChipGeomFactors();
604  const std::map<uint32_t, std::vector<double> >& PUFactors = SiPixelDynamicInefficiency->getPUFactors();
605  std::vector<uint32_t> DetIdmasks = SiPixelDynamicInefficiency->getDetIdmasks();
606 
607  // Loop on all modules, initialize map for easy access
608  for (const auto& it_module : geom->detUnits()) {
609  if (dynamic_cast<PixelGeomDetUnit const*>(it_module) == nullptr)
610  continue;
611  const DetId detid = it_module->geographicalId();
612  uint32_t rawid = detid.rawId();
613  PixelGeomFactors[rawid] = 1;
614  ColGeomFactors[rawid] = 1;
615  ChipGeomFactors[rawid] = 1;
616  PixelGeomFactorsROCStdPixels[rawid] = std::vector<double>(16, 1);
617  PixelGeomFactorsROCBigPixels[rawid] = std::vector<double>(16, 1);
618  }
619 
620  // ROC level inefficiency for phase 1 (disentangle scale factors for big and std size pixels)
621  std::map<uint32_t, double> PixelGeomFactorsDB;
622 
623  if (geom->isThere(GeomDetEnumerators::P1PXB) || geom->isThere(GeomDetEnumerators::P1PXEC)) {
624  for (auto db_factor : PixelGeomFactorsDBIn) {
625  int shift = DetId(db_factor.first).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel) ? BPixRocIdShift
626  : FPixRocIdShift;
627  unsigned int rocMask = rocIdMaskBits << shift;
628  unsigned int rocId = (((db_factor.first) & rocMask) >> shift);
629  if (rocId != 0) {
630  rocId--;
631  unsigned int rawid = db_factor.first & (~rocMask);
632  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(geom->idToDet(rawid));
633  PixelTopology const* topology = &(theGeomDet->specificTopology());
634  const int nPixelsInROC = topology->rowsperroc() * topology->colsperroc();
635  const int nBigPixelsInROC = 2 * topology->rowsperroc() + topology->colsperroc() - 2;
636  double factor = db_factor.second;
637  double badFraction = 1 - factor;
638  double bigPixelFraction = static_cast<double>(nBigPixelsInROC) / nPixelsInROC;
639  double stdPixelFraction = 1. - bigPixelFraction;
640 
641  double badFractionBig = std::min(bigPixelFraction, badFraction);
642  double badFractionStd = std::max(0., badFraction - badFractionBig);
643  double badFractionBigReNormalized = badFractionBig / bigPixelFraction;
644  double badFractionStdReNormalized = badFractionStd / stdPixelFraction;
645  PixelGeomFactorsROCStdPixels[rawid][rocId] *= (1. - badFractionStdReNormalized);
646  PixelGeomFactorsROCBigPixels[rawid][rocId] *= (1. - badFractionBigReNormalized);
647  } else {
648  PixelGeomFactorsDB[db_factor.first] = db_factor.second;
649  }
650  }
651  } // is Phase 1 geometry
652  else {
653  PixelGeomFactorsDB = PixelGeomFactorsDBIn;
654  }
655 
656  // Loop on all modules, store module level geometrical scale factors
657  for (const auto& it_module : geom->detUnits()) {
658  if (dynamic_cast<PixelGeomDetUnit const*>(it_module) == nullptr)
659  continue;
660  const DetId detid = it_module->geographicalId();
661  uint32_t rawid = detid.rawId();
662  for (auto db_factor : PixelGeomFactorsDB)
663  if (matches(detid, DetId(db_factor.first), DetIdmasks))
664  PixelGeomFactors[rawid] *= db_factor.second;
665  for (auto db_factor : ColGeomFactorsDB)
666  if (matches(detid, DetId(db_factor.first), DetIdmasks))
667  ColGeomFactors[rawid] *= db_factor.second;
668  for (auto db_factor : ChipGeomFactorsDB)
669  if (matches(detid, DetId(db_factor.first), DetIdmasks))
670  ChipGeomFactors[rawid] *= db_factor.second;
671  }
672 
673  // piluep scale factors are calculated once per event
674  // therefore vector index is stored in a map for each module that matches to a db_id
675  size_t i = 0;
676  for (const auto& factor : PUFactors) {
677  const DetId db_id = DetId(factor.first);
678  for (const auto& it_module : geom->detUnits()) {
679  if (dynamic_cast<PixelGeomDetUnit const*>(it_module) == nullptr)
680  continue;
681  const DetId detid = it_module->geographicalId();
682  if (!matches(detid, db_id, DetIdmasks))
683  continue;
684  if (iPU.count(detid.rawId())) {
685  throw cms::Exception("Database")
686  << "Multiple db_ids match to same module in SiPixelDynamicInefficiency DB Object";
687  } else {
688  iPU[detid.rawId()] = i;
689  }
690  }
691  thePUEfficiency.push_back(factor.second);
692  ++i;
693  }
694  pu_scale.resize(thePUEfficiency.size());
695 }
696 
698  const DetId& db_id,
699  const std::vector<uint32_t>& DetIdmasks) {
700  if (detid.subdetId() != db_id.subdetId())
701  return false;
702  for (size_t i = 0; i < DetIdmasks.size(); ++i) {
703  DetId maskid = DetId(DetIdmasks.at(i));
704  if (maskid.subdetId() != db_id.subdetId())
705  continue;
706  if ((detid.rawId() & maskid.rawId()) != (db_id.rawId() & maskid.rawId()) &&
707  (db_id.rawId() & maskid.rawId()) != DetId(db_id.det(), db_id.subdetId()).rawId())
708  return false;
709  }
710  return true;
711 }
712 
714  bool AddAging,
716  int NumberOfEndcapDisks) {
717  // pixel aging
718  // Don't use Hard coded values, read aging in from python or don't use any
719  if (AddAging) {
720  int NumberOfTotLayers = NumberOfBarrelLayers + NumberOfEndcapDisks;
721  FPixIndex = NumberOfBarrelLayers;
722 
723  int i = 0;
724  thePixelPseudoRadDamage[i++] = conf.getParameter<double>("thePixelPseudoRadDamage_BPix1");
725  thePixelPseudoRadDamage[i++] = conf.getParameter<double>("thePixelPseudoRadDamage_BPix2");
726  thePixelPseudoRadDamage[i++] = conf.getParameter<double>("thePixelPseudoRadDamage_BPix3");
727  thePixelPseudoRadDamage[i++] = conf.getParameter<double>("thePixelPseudoRadDamage_BPix4");
728 
729  // to be removed when Gaelle will have the phase2 digitizer
730  if (NumberOfBarrelLayers >= 5) {
731  if (NumberOfTotLayers > 20) {
732  throw cms::Exception("Configuration") << "SiPixelDigitizer was given more layers than it can handle";
733  }
734  // For Phase2 tracker layers just set the outermost BPix aging 0.
735  for (int j = 5; j <= NumberOfBarrelLayers; j++) {
736  thePixelPseudoRadDamage[j - 1] = 0.;
737  }
738  }
739  //
740  i = FPixIndex;
741  thePixelPseudoRadDamage[i++] = conf.getParameter<double>("thePixelPseudoRadDamage_FPix1");
742  thePixelPseudoRadDamage[i++] = conf.getParameter<double>("thePixelPseudoRadDamage_FPix2");
743  thePixelPseudoRadDamage[i++] = conf.getParameter<double>("thePixelPseudoRadDamage_FPix3");
744 
745  //To be removed when Phase2 digitizer will be available
746  if (NumberOfEndcapDisks >= 4) {
747  if (NumberOfTotLayers > 20) {
748  throw cms::Exception("Configuration") << "SiPixelDigitizer was given more layers than it can handle";
749  }
750  // For Phase2 tracker layers just set the extra FPix disk aging to 0. BE CAREFUL THESE VALUES ARE HARDCODED ALSO ELSEWHERE IN THIS FILE
751  for (int j = 4 + FPixIndex; j <= NumberOfEndcapDisks + NumberOfBarrelLayers; j++) {
752  thePixelPseudoRadDamage[j - 1] = 0.;
753  }
754  }
755  }
756  // the first "NumberOfBarrelLayers" settings [0],[1], ... , [NumberOfBarrelLayers-1] are for the barrel pixels
757  // the next "NumberOfEndcapDisks" settings [NumberOfBarrelLayers],[NumberOfBarrelLayers+1], ... [NumberOfEndcapDisks+NumberOfBarrelLayers-1]
758 }
759 
760 //=========================================================================
761 void SiPixelDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
762  std::vector<PSimHit>::const_iterator inputEnd,
763  const size_t inputBeginGlobalIndex,
764  const unsigned int tofBin,
765  const PixelGeomDetUnit* pixdet,
766  const GlobalVector& bfield,
767  const TrackerTopology* tTopo,
768  CLHEP::HepRandomEngine* engine) {
769  // produce SignalPoint's for all SimHit's in detector
770  // Loop over hits
771 
772  uint32_t detId = pixdet->geographicalId().rawId();
773  size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to stored to create the digi-sim link later
774  for (std::vector<PSimHit>::const_iterator ssbegin = inputBegin; ssbegin != inputEnd; ++ssbegin, ++simHitGlobalIndex) {
775  // skip hits not in this detector.
776  if ((*ssbegin).detUnitId() != detId) {
777  continue;
778  }
779 
780 #ifdef TP_DEBUG
781  LogDebug("Pixel Digitizer") << (*ssbegin).particleType() << " " << (*ssbegin).pabs() << " "
782  << (*ssbegin).energyLoss() << " " << (*ssbegin).tof() << " " << (*ssbegin).trackId()
783  << " " << (*ssbegin).processType() << " " << (*ssbegin).detUnitId()
784  << (*ssbegin).entryPoint() << " " << (*ssbegin).exitPoint();
785 #endif
786 
787  std::vector<EnergyDepositUnit> ionization_points;
788  std::vector<SignalPoint> collection_points;
789 
790  // fill collection_points for this SimHit, indpendent of topology
791  // Check the TOF cut
792  if (((*ssbegin).tof() - pixdet->surface().toGlobal((*ssbegin).localPosition()).mag() / 30.) >= theTofLowerCut &&
793  ((*ssbegin).tof() - pixdet->surface().toGlobal((*ssbegin).localPosition()).mag() / 30.) <= theTofUpperCut) {
794  primary_ionization(*ssbegin, ionization_points, engine); // fills _ionization_points
795  drift(*ssbegin,
796  pixdet,
797  bfield,
798  tTopo,
799  ionization_points,
800  collection_points); // transforms _ionization_points to collection_points
801  // compute induced signal on readout elements and add to _signal
802  induce_signal(inputBegin,
803  inputEnd,
804  *ssbegin,
805  simHitGlobalIndex,
806  tofBin,
807  pixdet,
808  collection_points); // 1st 3 args needed only for SimHit<-->Digi link
809  } // end if
810  } // end for
811 }
812 
813 //============================================================================
815  //Instlumi scalefactor calculating for dynamic inefficiency
816 
817  if (puInfo) {
818  const std::vector<int>& bunchCrossing = puInfo->getMix_bunchCrossing();
819  const std::vector<float>& TrueInteractionList = puInfo->getMix_TrueInteractions();
820  //const int bunchSpacing = puInfo->getMix_bunchSpacing();
821 
822  int pui = 0, p = 0;
823  std::vector<int>::const_iterator pu;
824  std::vector<int>::const_iterator pu0 = bunchCrossing.end();
825 
826  for (pu = bunchCrossing.begin(); pu != bunchCrossing.end(); ++pu) {
827  if (*pu == 0) {
828  pu0 = pu;
829  p = pui;
830  }
831  pui++;
832  }
833  if (pu0 != bunchCrossing.end()) {
834  for (size_t i = 0, n = pixelEfficiencies_.thePUEfficiency.size(); i < n; i++) {
835  double instlumi = TrueInteractionList.at(p) * pixelEfficiencies_.theInstLumiScaleFactor;
836  double instlumi_pow = 1.;
838  for (size_t j = 0; j < pixelEfficiencies_.thePUEfficiency[i].size(); j++) {
840  instlumi_pow *= instlumi;
841  }
842  }
843  }
844  } else {
845  for (int i = 0, n = pixelEfficiencies_.thePUEfficiency.size(); i < n; i++) {
847  }
848  }
849 }
850 
851 //============================================================================
852 void SiPixelDigitizerAlgorithm::calculateInstlumiFactor(const std::vector<PileupSummaryInfo>& ps, int bunchSpacing) {
853  int p = -1;
854  for (unsigned int i = 0; i < ps.size(); i++)
855  if (ps[i].getBunchCrossing() == 0)
856  p = i;
857 
858  if (p >= 0) {
859  for (size_t i = 0, n = pixelEfficiencies_.thePUEfficiency.size(); i < n; i++) {
860  double instlumi = ps[p].getTrueNumInteractions() * pixelEfficiencies_.theInstLumiScaleFactor;
861  double instlumi_pow = 1.;
863  for (size_t j = 0; j < pixelEfficiencies_.thePUEfficiency[i].size(); j++) {
865  instlumi_pow *= instlumi;
866  }
867  }
868  } else {
869  for (int i = 0, n = pixelEfficiencies_.thePUEfficiency.size(); i < n; i++) {
871  }
872  }
873 }
874 
875 // ========== StuckTBMs
876 
878 
879 std::unique_ptr<PixelFEDChannelCollection> SiPixelDigitizerAlgorithm::chooseScenario(
880  const std::vector<PileupSummaryInfo>& ps, CLHEP::HepRandomEngine* engine) {
881  std::unique_ptr<PixelFEDChannelCollection> PixelFEDChannelCollection_ = nullptr;
883 
884  std::vector<int> bunchCrossing;
885  std::vector<float> TrueInteractionList;
886 
887  for (unsigned int i = 0; i < ps.size(); i++) {
888  bunchCrossing.push_back(ps[i].getBunchCrossing());
889  TrueInteractionList.push_back(ps[i].getTrueNumInteractions());
890  }
891 
892  int pui = 0, p = 0;
893  std::vector<int>::const_iterator pu;
894  std::vector<int>::const_iterator pu0 = bunchCrossing.end();
895 
896  for (pu = bunchCrossing.begin(); pu != bunchCrossing.end(); ++pu) {
897  if (*pu == 0) {
898  pu0 = pu;
899  p = pui;
900  }
901  pui++;
902  }
903 
904  if (pu0 != bunchCrossing.end()) {
905  unsigned int PUBin = TrueInteractionList.at(p); // case delta PU=1, fix me
906  const auto& theProbabilitiesPerScenario = scenarioProbabilityHandle->getProbabilities(PUBin);
907  std::vector<double> probabilities;
908  probabilities.reserve(theProbabilitiesPerScenario.size());
909  for (auto it = theProbabilitiesPerScenario.begin(); it != theProbabilitiesPerScenario.end(); it++) {
910  probabilities.push_back(it->second);
911  }
912 
913  CLHEP::RandGeneral randGeneral(*engine, &(probabilities.front()), probabilities.size());
914  double x = randGeneral.shoot();
915  unsigned int index = x * probabilities.size() - 1;
916  const std::string& scenario = theProbabilitiesPerScenario.at(index).first;
917 
918  PixelFEDChannelCollection_ = std::make_unique<PixelFEDChannelCollection>(quality_map->at(scenario));
920  std::make_unique<PixelFEDChannelCollection>(quality_map->at(scenario));
921  }
922 
923  return PixelFEDChannelCollection_;
924 }
925 
926 std::unique_ptr<PixelFEDChannelCollection> SiPixelDigitizerAlgorithm::chooseScenario(PileupMixingContent* puInfo,
927  CLHEP::HepRandomEngine* engine) {
928  //Determine scenario to use for the current event based on pileup information
929 
930  std::unique_ptr<PixelFEDChannelCollection> PixelFEDChannelCollection_ = nullptr;
932  if (puInfo) {
933  const std::vector<int>& bunchCrossing = puInfo->getMix_bunchCrossing();
934  const std::vector<float>& TrueInteractionList = puInfo->getMix_TrueInteractions();
935 
936  int pui = 0, p = 0;
937  std::vector<int>::const_iterator pu;
938  std::vector<int>::const_iterator pu0 = bunchCrossing.end();
939 
940  for (pu = bunchCrossing.begin(); pu != bunchCrossing.end(); ++pu) {
941  if (*pu == 0) {
942  pu0 = pu;
943  p = pui;
944  }
945  pui++;
946  }
947 
948  if (pu0 != bunchCrossing.end()) {
949  unsigned int PUBin = TrueInteractionList.at(p); // case delta PU=1, fix me
950  const auto& theProbabilitiesPerScenario = scenarioProbabilityHandle->getProbabilities(PUBin);
951  std::vector<double> probabilities;
952  probabilities.reserve(theProbabilitiesPerScenario.size());
953  for (auto it = theProbabilitiesPerScenario.begin(); it != theProbabilitiesPerScenario.end(); it++) {
954  probabilities.push_back(it->second);
955  }
956 
957  CLHEP::RandGeneral randGeneral(*engine, &(probabilities.front()), probabilities.size());
958  double x = randGeneral.shoot();
959  unsigned int index = x * probabilities.size() - 1;
960  const std::string& scenario = theProbabilitiesPerScenario.at(index).first;
961 
962  PixelFEDChannelCollection_ = std::make_unique<PixelFEDChannelCollection>(quality_map->at(scenario));
964  std::make_unique<PixelFEDChannelCollection>(quality_map->at(scenario));
965  }
966  }
967  return PixelFEDChannelCollection_;
968 }
969 
970 //============================================================================
971 void SiPixelDigitizerAlgorithm::setSimAccumulator(const std::map<uint32_t, std::map<int, int> >& signalMap) {
972  for (const auto& det : signalMap) {
973  auto& theSignal = _signal[det.first];
974  for (const auto& chan : det.second) {
975  theSignal[chan.first].set(chan.second *
976  theElectronPerADC); // will get divided again by theElectronPerAdc in digitize...
977  }
978  }
979 }
980 
981 //============================================================================
983  std::vector<PixelDigi>& digis,
984  std::vector<PixelDigiSimLink>& simlinks,
985  const TrackerTopology* tTopo,
986  CLHEP::HepRandomEngine* engine) {
987  // Pixel Efficiency moved from the constructor to this method because
988  // the information of the det are not available in the constructor
989  // Efficiency parameters. 0 - no inefficiency, 1-low lumi, 10-high lumi
990 
991  uint32_t detID = pixdet->geographicalId().rawId();
992  const signal_map_type& theSignal = _signal[detID];
993 
994  // Noise already defined in electrons
995  // thePixelThresholdInE = thePixelThreshold * theNoiseInElectrons ;
996  // Find the threshold in noise units, needed for the noiser.
997 
998  float thePixelThresholdInE = 0.;
999 
1000  if (theNoiseInElectrons > 0.) {
1001  if (pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()) { // Barrel modules
1002  int lay = tTopo->layer(detID);
1003  if (addThresholdSmearing) {
1006  if (lay == 1) {
1007  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(
1008  engine, theThresholdInE_BPix_L1, theThresholdSmearing_BPix_L1); // gaussian smearing
1009  } else if (lay == 2) {
1010  thePixelThresholdInE = CLHEP::RandGaussQ::shoot(
1011  engine, theThresholdInE_BPix_L2, theThresholdSmearing_BPix_L2); // gaussian smearing
1012  } else {
1013  thePixelThresholdInE =
1014  CLHEP::RandGaussQ::shoot(engine, theThresholdInE_BPix, theThresholdSmearing_BPix); // gaussian smearing
1015  }
1016  }
1017  } else {
1020  if (lay == 1) {
1021  thePixelThresholdInE = theThresholdInE_BPix_L1;
1022  } else if (lay == 2) {
1023  thePixelThresholdInE = theThresholdInE_BPix_L2;
1024  } else {
1025  thePixelThresholdInE = theThresholdInE_BPix; // no smearing
1026  }
1027  }
1028  }
1029  } else if (pixdet->type().isTrackerPixel()) { // Forward disks modules
1030  if (addThresholdSmearing) {
1031  thePixelThresholdInE =
1032  CLHEP::RandGaussQ::shoot(engine, theThresholdInE_FPix, theThresholdSmearing_FPix); // gaussian smearing
1033  } else {
1034  thePixelThresholdInE = theThresholdInE_FPix; // no smearing
1035  }
1036  } else {
1037  throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;
1038  }
1039  }
1040 
1041 #ifdef TP_DEBUG
1042  const PixelTopology* topol = &pixdet->specificTopology();
1043  int numColumns = topol->ncolumns(); // det module number of cols&rows
1044  int numRows = topol->nrows();
1045  // full detector thickness
1046  float moduleThickness = pixdet->specificSurface().bounds().thickness();
1047  LogDebug("PixelDigitizer") << " PixelDigitizer " << numColumns << " " << numRows << " " << moduleThickness;
1048 #endif
1049 
1050  if (addNoise)
1051  add_noise(pixdet, thePixelThresholdInE / theNoiseInElectrons, engine); // generate noise
1052 
1053  // Do only if needed
1054 
1055  if ((AddPixelInefficiency) && (!theSignal.empty()))
1056  pixel_inefficiency(pixelEfficiencies_, pixdet, tTopo, engine); // Kill some pixels
1057 
1058  if (use_ineff_from_db_ && (!theSignal.empty()))
1059  pixel_inefficiency_db(detID);
1060 
1061  if (use_module_killing_) {
1062  if (use_deadmodule_DB_) { // remove dead modules using DB
1063  module_killing_DB(detID);
1064  } else { // remove dead modules using the list in cfg file
1065  module_killing_conf(detID);
1066  }
1067  }
1068 
1069  make_digis(thePixelThresholdInE, detID, pixdet, digis, simlinks, tTopo);
1070 
1071 #ifdef TP_DEBUG
1072  LogDebug("PixelDigitizer") << "[SiPixelDigitizerAlgorithm] converted " << digis.size() << " PixelDigis in DetUnit"
1073  << detID;
1074 #endif
1075 }
1076 
1077 //***********************************************************************/
1078 // Generate primary ionization along the track segment.
1079 // Divide the track into small sub-segments
1081  std::vector<EnergyDepositUnit>& ionization_points,
1082  CLHEP::HepRandomEngine* engine) const {
1083  // Straight line approximation for trajectory inside active media
1084 
1085  const float SegmentLength = 0.0010; //10microns in cm
1086  float energy;
1087 
1088  // Get the 3D segment direction vector
1089  LocalVector direction = hit.exitPoint() - hit.entryPoint();
1090 
1091  float eLoss = hit.energyLoss(); // Eloss in GeV
1092  float length = direction.mag(); // Track length in Silicon
1093 
1094  int NumberOfSegments = int(length / SegmentLength); // Number of segments
1095  if (NumberOfSegments < 1)
1096  NumberOfSegments = 1;
1097 
1098 #ifdef TP_DEBUG
1099  LogDebug("Pixel Digitizer") << " enter primary_ionzation " << NumberOfSegments
1100  << " shift = " << (hit.exitPoint().x() - hit.entryPoint().x()) << " "
1101  << (hit.exitPoint().y() - hit.entryPoint().y()) << " "
1102  << (hit.exitPoint().z() - hit.entryPoint().z()) << " " << hit.particleType() << " "
1103  << hit.pabs();
1104 #endif
1105 
1106  float* elossVector = new float[NumberOfSegments]; // Eloss vector
1107 
1108  if (fluctuateCharge) {
1109  //MP DA RIMUOVERE ASSOLUTAMENTE
1110  int pid = hit.particleType();
1111  //int pid=211; // assume it is a pion
1112 
1113  float momentum = hit.pabs();
1114  // Generate fluctuated charge points
1115  fluctuateEloss(pid, momentum, eLoss, length, NumberOfSegments, elossVector, engine);
1116  }
1117 
1118  ionization_points.resize(NumberOfSegments); // set size
1119 
1120  // loop over segments
1121  for (int i = 0; i != NumberOfSegments; i++) {
1122  // Divide the segment into equal length subsegments
1123  Local3DPoint point = hit.entryPoint() + float((i + 0.5) / NumberOfSegments) * direction;
1124 
1125  if (fluctuateCharge)
1126  energy = elossVector[i] / GeVperElectron; // Convert charge to elec.
1127  else
1128  energy = hit.energyLoss() / GeVperElectron / float(NumberOfSegments);
1129 
1130  EnergyDepositUnit edu(energy, point); //define position,energy point
1131  ionization_points[i] = edu; // save
1132 
1133 #ifdef TP_DEBUG
1134  LogDebug("Pixel Digitizer") << i << " " << ionization_points[i].x() << " " << ionization_points[i].y() << " "
1135  << ionization_points[i].z() << " " << ionization_points[i].energy();
1136 #endif
1137 
1138  } // end for loop
1139 
1140  delete[] elossVector;
1141 }
1142 //******************************************************************************
1143 
1144 // Fluctuate the charge comming from a small (10um) track segment.
1145 // Use the G4 routine. For mip pions for the moment.
1147  float particleMomentum,
1148  float eloss,
1149  float length,
1150  int NumberOfSegs,
1151  float elossVector[],
1152  CLHEP::HepRandomEngine* engine) const {
1153  // Get dedx for this track
1154  //float dedx;
1155  //if( length > 0.) dedx = eloss/length;
1156  //else dedx = eloss;
1157 
1158  double particleMass = 139.6; // Mass in MeV, Assume pion
1159  pid = std::abs(pid);
1160  if (pid != 211) { // Mass in MeV
1161  if (pid == 11)
1162  particleMass = 0.511;
1163  else if (pid == 13)
1164  particleMass = 105.7;
1165  else if (pid == 321)
1166  particleMass = 493.7;
1167  else if (pid == 2212)
1168  particleMass = 938.3;
1169  }
1170  // What is the track segment length.
1171  float segmentLength = length / NumberOfSegs;
1172 
1173  // Generate charge fluctuations.
1174  float de = 0.;
1175  float sum = 0.;
1176  double segmentEloss = (1000. * eloss) / NumberOfSegs; //eloss in MeV
1177  for (int i = 0; i < NumberOfSegs; i++) {
1178  // material,*, momentum,energy,*, *, mass
1179  //myglandz_(14.,segmentLength,2.,2.,dedx,de,0.14);
1180  // The G4 routine needs momentum in MeV, mass in Mev, delta-cut in MeV,
1181  // track segment length in mm, segment eloss in MeV
1182  // Returns fluctuated eloss in MeV
1183  double deltaCutoff = tMax; // the cutoff is sometimes redefined inside, so fix it.
1184  de = fluctuate->SampleFluctuations(double(particleMomentum * 1000.),
1185  particleMass,
1186  deltaCutoff,
1187  double(segmentLength * 10.),
1188  segmentEloss,
1189  engine) /
1190  1000.; //convert to GeV
1191  elossVector[i] = de;
1192  sum += de;
1193  }
1194 
1195  if (sum > 0.) { // If fluctuations give eloss>0.
1196  // Rescale to the same total eloss
1197  float ratio = eloss / sum;
1198 
1199  for (int ii = 0; ii < NumberOfSegs; ii++)
1200  elossVector[ii] = ratio * elossVector[ii];
1201  } else { // If fluctuations gives 0 eloss
1202  float averageEloss = eloss / NumberOfSegs;
1203  for (int ii = 0; ii < NumberOfSegs; ii++)
1204  elossVector[ii] = averageEloss;
1205  }
1206  return;
1207 }
1208 
1209 //*******************************************************************************
1210 // Drift the charge segments to the sensor surface (collection plane)
1211 // Include the effect of E-field and B-field
1213  const PixelGeomDetUnit* pixdet,
1214  const GlobalVector& bfield,
1215  const TrackerTopology* tTopo,
1216  const std::vector<EnergyDepositUnit>& ionization_points,
1217  std::vector<SignalPoint>& collection_points) const {
1218 #ifdef TP_DEBUG
1219  LogDebug("Pixel Digitizer") << " enter drift ";
1220 #endif
1221 
1222  collection_points.resize(ionization_points.size()); // set size
1223 
1224  LocalVector driftDir = DriftDirection(pixdet, bfield, hit.detUnitId()); // get the charge drift direction
1225  if (driftDir.z() == 0.) {
1226  LogWarning("Magnetic field") << " pxlx: drift in z is zero ";
1227  return;
1228  }
1229 
1230  // tangent of Lorentz angle
1231  //float TanLorenzAngleX = driftDir.x()/driftDir.z();
1232  //float TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
1233 
1234  float TanLorenzAngleX, TanLorenzAngleY, dir_z, CosLorenzAngleX, CosLorenzAngleY;
1235  if (alpha2Order) {
1236  TanLorenzAngleX = driftDir.x(); // tangen of Lorentz angle
1237  TanLorenzAngleY = driftDir.y();
1238  dir_z = driftDir.z(); // The z drift direction
1239  CosLorenzAngleX = 1. / sqrt(1. + TanLorenzAngleX * TanLorenzAngleX); //cosine
1240  CosLorenzAngleY = 1. / sqrt(1. + TanLorenzAngleY * TanLorenzAngleY); //cosine;
1241 
1242  } else {
1243  TanLorenzAngleX = driftDir.x();
1244  TanLorenzAngleY = 0.; // force to 0, driftDir.y()/driftDir.z();
1245  dir_z = driftDir.z(); // The z drift direction
1246  CosLorenzAngleX = 1. / sqrt(1. + TanLorenzAngleX * TanLorenzAngleX); //cosine to estimate the path length
1247  CosLorenzAngleY = 1.;
1248  }
1249 
1250  float moduleThickness = pixdet->specificSurface().bounds().thickness();
1251 #ifdef TP_DEBUG
1252  LogDebug("Pixel Digitizer") << " Lorentz Tan " << TanLorenzAngleX << " " << TanLorenzAngleY << " " << CosLorenzAngleX
1253  << " " << CosLorenzAngleY << " " << moduleThickness * TanLorenzAngleX << " " << driftDir;
1254 #endif
1255 
1256  float Sigma_x = 1.; // Charge spread
1257  float Sigma_y = 1.;
1258  float DriftDistance; // Distance between charge generation and collection
1259  float DriftLength; // Actual Drift Lentgh
1260  float Sigma;
1261 
1262  for (unsigned int i = 0; i != ionization_points.size(); i++) {
1263  float SegX, SegY, SegZ; // position
1264  SegX = ionization_points[i].x();
1265  SegY = ionization_points[i].y();
1266  SegZ = ionization_points[i].z();
1267 
1268  // Distance from the collection plane
1269  //DriftDistance = (moduleThickness/2. + SegZ); // Drift to -z
1270  // Include explixitely the E drift direction (for CMS dir_z=-1)
1271  DriftDistance = moduleThickness / 2. - (dir_z * SegZ); // Drift to -z
1272 
1273  //if( DriftDistance <= 0.)
1274  //cout<<" <=0 "<<DriftDistance<<" "<<i<<" "<<SegZ<<" "<<dir_z<<" "
1275  // <<SegX<<" "<<SegY<<" "<<(moduleThickness/2)<<" "
1276  // <<ionization_points[i].energy()<<" "
1277  // <<hit.particleType()<<" "<<hit.pabs()<<" "<<hit.energyLoss()<<" "
1278  // <<hit.entryPoint()<<" "<<hit.exitPoint()
1279  // <<std::endl;
1280 
1281  if (DriftDistance < 0.) {
1282  DriftDistance = 0.;
1283  } else if (DriftDistance > moduleThickness)
1284  DriftDistance = moduleThickness;
1285 
1286  // Assume full depletion now, partial depletion will come later.
1287  float XDriftDueToMagField = DriftDistance * TanLorenzAngleX;
1288  float YDriftDueToMagField = DriftDistance * TanLorenzAngleY;
1289 
1290  // Shift cloud center
1291  float CloudCenterX = SegX + XDriftDueToMagField;
1292  float CloudCenterY = SegY + YDriftDueToMagField;
1293 
1294  // Calculate how long is the charge drift path
1295  DriftLength = sqrt(DriftDistance * DriftDistance + XDriftDueToMagField * XDriftDueToMagField +
1296  YDriftDueToMagField * YDriftDueToMagField);
1297 
1298  // What is the charge diffusion after this path
1299  Sigma = sqrt(DriftLength / Dist300) * Sigma0;
1300 
1301  // Project the diffusion sigma on the collection plane
1302  Sigma_x = Sigma / CosLorenzAngleX;
1303  Sigma_y = Sigma / CosLorenzAngleY;
1304 
1305  // Insert a charge loss due to Rad Damage here
1306  float energyOnCollector = ionization_points[i].energy(); // The energy that reaches the collector
1307 
1308  // add pixel aging
1309  if (AddPixelAging) {
1310  float kValue = pixel_aging(pixelAging_, pixdet, tTopo);
1311  energyOnCollector *= exp(-1 * kValue * DriftDistance / moduleThickness);
1312  }
1313 
1314 #ifdef TP_DEBUG
1315  LogDebug("Pixel Digitizer") << " Dift DistanceZ= " << DriftDistance << " module thickness= " << moduleThickness
1316  << " Start Energy= " << ionization_points[i].energy()
1317  << " Energy after loss= " << energyOnCollector;
1318 #endif
1319  SignalPoint sp(CloudCenterX, CloudCenterY, Sigma_x, Sigma_y, hit.tof(), energyOnCollector);
1320 
1321  // Load the Charge distribution parameters
1322  collection_points[i] = (sp);
1323 
1324  } // loop over ionization points, i.
1325 
1326 } // end drift
1327 
1328 //*************************************************************************
1329 // Induce the signal on the collection plane of the active sensor area.
1330 void SiPixelDigitizerAlgorithm::induce_signal(std::vector<PSimHit>::const_iterator inputBegin,
1331  std::vector<PSimHit>::const_iterator inputEnd,
1332  const PSimHit& hit,
1333  const size_t hitIndex,
1334  const unsigned int tofBin,
1335  const PixelGeomDetUnit* pixdet,
1336  const std::vector<SignalPoint>& collection_points) {
1337  // X - Rows, Left-Right, 160, (1.6cm) for barrel
1338  // Y - Columns, Down-Up, 416, (6.4cm)
1339 
1340  const PixelTopology* topol = &pixdet->specificTopology();
1341  uint32_t detID = pixdet->geographicalId().rawId();
1342  signal_map_type& theSignal = _signal[detID];
1343 
1344 #ifdef TP_DEBUG
1345  LogDebug("Pixel Digitizer") << " enter induce_signal, " << topol->pitch().first << " " << topol->pitch().second; //OK
1346 #endif
1347 
1348  // local map to store pixels hit by 1 Hit.
1349  typedef std::map<int, float, std::less<int> > hit_map_type;
1350  hit_map_type hit_signal;
1351 
1352  // map to store pixel integrals in the x and in the y directions
1353  std::map<int, float, std::less<int> > x, y;
1354 
1355  // Assign signals to readout channels and store sorted by channel number
1356 
1357  // Iterate over collection points on the collection plane
1358  for (std::vector<SignalPoint>::const_iterator i = collection_points.begin(); i != collection_points.end(); ++i) {
1359  float CloudCenterX = i->position().x(); // Charge position in x
1360  float CloudCenterY = i->position().y(); // in y
1361  float SigmaX = i->sigma_x(); // Charge spread in x
1362  float SigmaY = i->sigma_y(); // in y
1363  float Charge = i->amplitude(); // Charge amplitude
1364 
1365  //if(SigmaX==0 || SigmaY==0) {
1366  //cout<<SigmaX<<" "<<SigmaY
1367  // << " cloud " << i->position().x() << " " << i->position().y() << " "
1368  // << i->sigma_x() << " " << i->sigma_y() << " " << i->amplitude()<<std::endl;
1369  //}
1370 
1371 #ifdef TP_DEBUG
1372  LogDebug("Pixel Digitizer") << " cloud " << i->position().x() << " " << i->position().y() << " " << i->sigma_x()
1373  << " " << i->sigma_y() << " " << i->amplitude();
1374 #endif
1375 
1376  // Find the maximum cloud spread in 2D plane , assume 3*sigma
1377  float CloudRight = CloudCenterX + ClusterWidth * SigmaX;
1378  float CloudLeft = CloudCenterX - ClusterWidth * SigmaX;
1379  float CloudUp = CloudCenterY + ClusterWidth * SigmaY;
1380  float CloudDown = CloudCenterY - ClusterWidth * SigmaY;
1381 
1382  // Define 2D cloud limit points
1383  LocalPoint PointRightUp = LocalPoint(CloudRight, CloudUp);
1384  LocalPoint PointLeftDown = LocalPoint(CloudLeft, CloudDown);
1385 
1386  // This points can be located outside the sensor area.
1387  // The conversion to measurement point does not check for that
1388  // so the returned pixel index might be wrong (outside range).
1389  // We rely on the limits check below to fix this.
1390  // But remember whatever we do here THE CHARGE OUTSIDE THE ACTIVE
1391  // PIXEL AREA IS LOST, it should not be collected.
1392 
1393  // Convert the 2D points to pixel indices
1394  MeasurementPoint mp = topol->measurementPosition(PointRightUp); //OK
1395 
1396  int IPixRightUpX = int(floor(mp.x()));
1397  int IPixRightUpY = int(floor(mp.y()));
1398 
1399 #ifdef TP_DEBUG
1400  LogDebug("Pixel Digitizer") << " right-up " << PointRightUp << " " << mp.x() << " " << mp.y() << " " << IPixRightUpX
1401  << " " << IPixRightUpY;
1402 #endif
1403 
1404  mp = topol->measurementPosition(PointLeftDown); //OK
1405 
1406  int IPixLeftDownX = int(floor(mp.x()));
1407  int IPixLeftDownY = int(floor(mp.y()));
1408 
1409 #ifdef TP_DEBUG
1410  LogDebug("Pixel Digitizer") << " left-down " << PointLeftDown << " " << mp.x() << " " << mp.y() << " "
1411  << IPixLeftDownX << " " << IPixLeftDownY;
1412 #endif
1413 
1414  // Check detector limits to correct for pixels outside range.
1415  int numColumns = topol->ncolumns(); // det module number of cols&rows
1416  int numRows = topol->nrows();
1417 
1418  IPixRightUpX = numRows > IPixRightUpX ? IPixRightUpX : numRows - 1;
1419  IPixRightUpY = numColumns > IPixRightUpY ? IPixRightUpY : numColumns - 1;
1420  IPixLeftDownX = 0 < IPixLeftDownX ? IPixLeftDownX : 0;
1421  IPixLeftDownY = 0 < IPixLeftDownY ? IPixLeftDownY : 0;
1422 
1423  x.clear(); // clear temporary integration array
1424  y.clear();
1425 
1426  // First integrate charge strips in x
1427  int ix; // TT for compatibility
1428  for (ix = IPixLeftDownX; ix <= IPixRightUpX; ix++) { // loop over x index
1429  float xUB, xLB, UpperBound, LowerBound;
1430 
1431  // Why is set to 0 if ix=0, does it meen that we accept charge
1432  // outside the sensor? CHeck How it was done in ORCA?
1433  //if(ix == 0) LowerBound = 0.;
1434  if (ix == 0 || SigmaX == 0.) // skip for surface segemnts
1435  LowerBound = 0.;
1436  else {
1437  mp = MeasurementPoint(float(ix), 0.0);
1438  xLB = topol->localPosition(mp).x();
1439  LowerBound = 1 - calcQ((xLB - CloudCenterX) / SigmaX);
1440  }
1441 
1442  if (ix == numRows - 1 || SigmaX == 0.)
1443  UpperBound = 1.;
1444  else {
1445  mp = MeasurementPoint(float(ix + 1), 0.0);
1446  xUB = topol->localPosition(mp).x();
1447  UpperBound = 1. - calcQ((xUB - CloudCenterX) / SigmaX);
1448  }
1449 
1450  float TotalIntegrationRange = UpperBound - LowerBound; // get strip
1451  x[ix] = TotalIntegrationRange; // save strip integral
1452  //if(SigmaX==0 || SigmaY==0)
1453  //cout<<TotalIntegrationRange<<" "<<ix<<std::endl;
1454  }
1455 
1456  // Now integrate strips in y
1457  int iy; // TT for compatibility
1458  for (iy = IPixLeftDownY; iy <= IPixRightUpY; iy++) { //loope over y ind
1459  float yUB, yLB, UpperBound, LowerBound;
1460 
1461  if (iy == 0 || SigmaY == 0.)
1462  LowerBound = 0.;
1463  else {
1464  mp = MeasurementPoint(0.0, float(iy));
1465  yLB = topol->localPosition(mp).y();
1466  LowerBound = 1. - calcQ((yLB - CloudCenterY) / SigmaY);
1467  }
1468 
1469  if (iy == numColumns - 1 || SigmaY == 0.)
1470  UpperBound = 1.;
1471  else {
1472  mp = MeasurementPoint(0.0, float(iy + 1));
1473  yUB = topol->localPosition(mp).y();
1474  UpperBound = 1. - calcQ((yUB - CloudCenterY) / SigmaY);
1475  }
1476 
1477  float TotalIntegrationRange = UpperBound - LowerBound;
1478  y[iy] = TotalIntegrationRange; // save strip integral
1479  //if(SigmaX==0 || SigmaY==0)
1480  //cout<<TotalIntegrationRange<<" "<<iy<<std::endl;
1481  }
1482 
1483  // Get the 2D charge integrals by folding x and y strips
1484  int chan;
1485  for (ix = IPixLeftDownX; ix <= IPixRightUpX; ix++) { // loop over x index
1486  for (iy = IPixLeftDownY; iy <= IPixRightUpY; iy++) { //loope over y ind
1487 
1488  float ChargeFraction = Charge * x[ix] * y[iy];
1489 
1490  if (ChargeFraction > 0.) {
1491  chan = PixelDigi::pixelToChannel(ix, iy); // Get index
1492  // Load the amplitude
1493  hit_signal[chan] += ChargeFraction;
1494  } // endif
1495 
1496 #ifdef TP_DEBUG
1497  mp = MeasurementPoint(float(ix), float(iy));
1498  LocalPoint lp = topol->localPosition(mp);
1499  chan = topol->channel(lp);
1500  LogDebug("Pixel Digitizer") << " pixel " << ix << " " << iy << " - "
1501  << " " << chan << " " << ChargeFraction << " " << mp.x() << " " << mp.y() << " "
1502  << lp.x() << " " << lp.y() << " " // givex edge position
1503  << chan; // edge belongs to previous ?
1504 #endif
1505 
1506  } // endfor iy
1507  } //endfor ix
1508 
1509  } // loop over charge distributions
1510 
1511  // Fill the global map with all hit pixels from this event
1512 
1513  bool reweighted = false;
1514  if (UseReweighting) {
1515  if (hit.processType() == 0) {
1516  reweighted = TheNewSiPixelChargeReweightingAlgorithmClass->hitSignalReweight(
1517  hit, hit_signal, hitIndex, tofBin, topol, detID, theSignal, hit.processType(), makeDigiSimLinks_);
1518  } else {
1519  // If it's not the primary particle, use the first hit in the collection as SimHit, which should be the corresponding primary.
1520  reweighted = TheNewSiPixelChargeReweightingAlgorithmClass->hitSignalReweight(
1521  (*inputBegin), hit_signal, hitIndex, tofBin, topol, detID, theSignal, hit.processType(), makeDigiSimLinks_);
1522  }
1523  }
1524  if (!reweighted) {
1525  for (hit_map_type::const_iterator im = hit_signal.begin(); im != hit_signal.end(); ++im) {
1526  int chan = (*im).first;
1527  theSignal[chan] += (makeDigiSimLinks_ ? Amplitude((*im).second, &hit, hitIndex, tofBin, (*im).second)
1528  : Amplitude((*im).second, (*im).second));
1529 
1530 #ifdef TP_DEBUG
1531  std::pair<int, int> ip = PixelDigi::channelToPixel(chan);
1532  LogDebug("Pixel Digitizer") << " pixel " << ip.first << " " << ip.second << " " << theSignal[chan];
1533 #endif
1534  }
1535  }
1536 
1537 } // end induce_signal
1538 
1539 /***********************************************************************/
1540 
1541 // Build pixels, check threshold, add misscalibration, ...
1542 void SiPixelDigitizerAlgorithm::make_digis(float thePixelThresholdInE,
1543  uint32_t detID,
1544  const PixelGeomDetUnit* pixdet,
1545  std::vector<PixelDigi>& digis,
1546  std::vector<PixelDigiSimLink>& simlinks,
1547  const TrackerTopology* tTopo) const {
1548 #ifdef TP_DEBUG
1549  LogDebug("Pixel Digitizer") << " make digis "
1550  << " "
1551  << " pixel threshold FPix" << theThresholdInE_FPix << " "
1552  << " pixel threshold BPix" << theThresholdInE_BPix << " "
1553  << " pixel threshold BPix Layer1" << theThresholdInE_BPix_L1 << " "
1554  << " pixel threshold BPix Layer2" << theThresholdInE_BPix_L2 << " "
1555  << " List pixels passing threshold ";
1556 #endif
1557 
1558  // Loop over hit pixels
1559 
1560  signalMaps::const_iterator it = _signal.find(detID);
1561  if (it == _signal.end()) {
1562  return;
1563  }
1564 
1565  const signal_map_type& theSignal = (*it).second;
1566 
1567  // unsigned long is enough to store SimTrack id and EncodedEventId
1568  using TrackEventId = std::pair<decltype(SimTrack().trackId()), decltype(EncodedEventId().rawId())>;
1569  std::map<TrackEventId, float> simi; // re-used
1570 
1571  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
1572  float signalInElectrons = (*i).second; // signal in electrons
1573 
1574  // Do the miss calibration for calibration studies only.
1575  //if(doMissCalibrate) signalInElectrons = missCalibrate(signalInElectrons)
1576 
1577  // Do only for pixels above threshold
1578 
1579  if (signalInElectrons >= thePixelThresholdInE &&
1580  signalInElectrons > 0.) { // check threshold, always reject killed (0-charge) digis
1581 
1582  int chan = (*i).first; // channel number
1583  std::pair<int, int> ip = PixelDigi::channelToPixel(chan);
1584  int adc = 0; // ADC count as integer
1585 
1586  // Do the miss calibration for calibration studies only.
1587  if (doMissCalibrate) {
1588  int row = ip.first; // X in row
1589  int col = ip.second; // Y is in col
1590  adc = int(missCalibrate(detID, tTopo, pixdet, col, row, signalInElectrons)); //full misscalib.
1591  } else { // Just do a simple electron->adc conversion
1592  adc = int(signalInElectrons / theElectronPerADC); // calibrate gain
1593  }
1594  adc = std::min(adc, theAdcFullScale); // Check maximum value
1595 #ifdef TP_DEBUG
1596  LogDebug("Pixel Digitizer") << (*i).first << " " << (*i).second << " " << signalInElectrons << " " << adc
1597  << ip.first << " " << ip.second;
1598 #endif
1599 
1600  // Load digis
1601  digis.emplace_back(ip.first, ip.second, adc);
1602 
1603  if (makeDigiSimLinks_ && !(*i).second.hitInfos().empty()) {
1604  //digilink
1605  unsigned int il = 0;
1606  for (const auto& info : (*i).second.hitInfos()) {
1607  // note: according to C++ standard operator[] does
1608  // value-initializiation, which for float means initial value of 0
1609  simi[std::make_pair(info.trackId(), info.eventId().rawId())] += (*i).second.individualampl()[il];
1610  il++;
1611  }
1612 
1613  //sum the contribution of the same trackid
1614  for (const auto& info : (*i).second.hitInfos()) {
1615  // skip if track already processed
1616  auto found = simi.find(std::make_pair(info.trackId(), info.eventId().rawId()));
1617  if (found == simi.end())
1618  continue;
1619 
1620  float sum_samechannel = found->second;
1621  float fraction = sum_samechannel / (*i).second;
1622  if (fraction > 1.f)
1623  fraction = 1.f;
1624 
1625  // Approximation: pick hitIndex and tofBin only from the first SimHit
1626  simlinks.emplace_back((*i).first, info.trackId(), info.hitIndex(), info.tofBin(), info.eventId(), fraction);
1627  simi.erase(found);
1628  }
1629  simi.clear(); // although should be empty already
1630  }
1631  }
1632  }
1633 }
1634 
1635 /***********************************************************************/
1636 
1637 // Add electronic noise to pixel charge
1639  float thePixelThreshold,
1640  CLHEP::HepRandomEngine* engine) {
1641 #ifdef TP_DEBUG
1642  LogDebug("Pixel Digitizer") << " enter add_noise " << theNoiseInElectrons;
1643 #endif
1644 
1645  uint32_t detID = pixdet->geographicalId().rawId();
1646  signal_map_type& theSignal = _signal[detID];
1647 
1648  // First add noise to hit pixels
1649  float theSmearedChargeRMS = 0.0;
1650 
1651  for (signal_map_iterator i = theSignal.begin(); i != theSignal.end(); i++) {
1652  if (addChargeVCALSmearing) {
1653  if ((*i).second < 3000) {
1654  theSmearedChargeRMS = 543.6 - (*i).second * 0.093;
1655  } else if ((*i).second < 6000) {
1656  theSmearedChargeRMS = 307.6 - (*i).second * 0.01;
1657  } else {
1658  theSmearedChargeRMS = -432.4 + (*i).second * 0.123;
1659  }
1660 
1661  // Noise from Vcal smearing:
1662  float noise_ChargeVCALSmearing = theSmearedChargeRMS * CLHEP::RandGaussQ::shoot(engine, 0., 1.);
1663  // Noise from full readout:
1664  float noise = CLHEP::RandGaussQ::shoot(engine, 0., theReadoutNoise);
1665 
1666  if (((*i).second + Amplitude(noise + noise_ChargeVCALSmearing, -1.)) < 0.) {
1667  (*i).second.set(0);
1668  } else {
1669  (*i).second += Amplitude(noise + noise_ChargeVCALSmearing, -1.);
1670  }
1671 
1672  } // End if addChargeVCalSmearing
1673  else {
1674  // Noise: ONLY full READOUT Noise.
1675  // Use here the FULL readout noise, including TBM,ALT,AOH,OPT-REC.
1676  float noise = CLHEP::RandGaussQ::shoot(engine, 0., theReadoutNoise);
1677 
1678  if (((*i).second + Amplitude(noise, -1.)) < 0.) {
1679  (*i).second.set(0);
1680  } else {
1681  (*i).second += Amplitude(noise, -1.);
1682  }
1683  } // end if only Noise from full readout
1684  }
1685 
1686  if (!addNoisyPixels) // Option to skip noise in non-hit pixels
1687  return;
1688 
1689  const PixelTopology* topol = &pixdet->specificTopology();
1690  int numColumns = topol->ncolumns(); // det module number of cols&rows
1691  int numRows = topol->nrows();
1692 
1693  // Add noise on non-hit pixels
1694  // Use here the pixel noise
1695  int numberOfPixels = (numRows * numColumns);
1696  std::map<int, float, std::less<int> > otherPixels;
1697  std::map<int, float, std::less<int> >::iterator mapI;
1698 
1699  theNoiser->generate(numberOfPixels,
1700  thePixelThreshold, //thr. in un. of nois
1701  theNoiseInElectrons, // noise in elec.
1702  otherPixels,
1703  engine);
1704 
1705 #ifdef TP_DEBUG
1706  LogDebug("Pixel Digitizer") << " Add noisy pixels " << numRows << " " << numColumns << " " << theNoiseInElectrons
1707  << " " << theThresholdInE_FPix << theThresholdInE_BPix << " " << numberOfPixels << " "
1708  << otherPixels.size();
1709 #endif
1710 
1711  // Add noisy pixels
1712  for (mapI = otherPixels.begin(); mapI != otherPixels.end(); mapI++) {
1713  int iy = ((*mapI).first) / numRows;
1714  int ix = ((*mapI).first) - (iy * numRows);
1715 
1716  // Keep for a while for testing.
1717  if (iy < 0 || iy > (numColumns - 1))
1718  LogWarning("Pixel Geometry") << " error in iy " << iy;
1719  if (ix < 0 || ix > (numRows - 1))
1720  LogWarning("Pixel Geometry") << " error in ix " << ix;
1721 
1722  int chan = PixelDigi::pixelToChannel(ix, iy);
1723 
1724 #ifdef TP_DEBUG
1725  LogDebug("Pixel Digitizer") << " Storing noise = " << (*mapI).first << " " << (*mapI).second << " " << ix << " "
1726  << iy << " " << chan;
1727 #endif
1728 
1729  if (theSignal[chan] == 0) {
1730  // float noise = float( (*mapI).second );
1731  int noise = int((*mapI).second);
1732  theSignal[chan] = Amplitude(noise, -1.);
1733  }
1734  }
1735 }
1736 
1737 /***********************************************************************/
1738 
1739 // Simulate the readout inefficiencies.
1740 // Delete a selected number of single pixels, dcols and rocs.
1742  const PixelGeomDetUnit* pixdet,
1743  const TrackerTopology* tTopo,
1744  CLHEP::HepRandomEngine* engine) {
1745  uint32_t detID = pixdet->geographicalId().rawId();
1746  signal_map_type& theSignal = _signal[detID];
1747  const PixelTopology* topol = &pixdet->specificTopology();
1748  int numColumns = topol->ncolumns(); // det module number of cols&rows
1749  int numRows = topol->nrows();
1752  // Predefined efficiencies
1753  double pixelEfficiency = 1.0;
1754  double columnEfficiency = 1.0;
1755  double chipEfficiency = 1.0;
1756  std::vector<double> pixelEfficiencyROCStdPixels(16, 1);
1757  std::vector<double> pixelEfficiencyROCBigPixels(16, 1);
1758 
1759  auto pIndexConverter = PixelIndices(numColumns, numRows);
1760 
1761  std::vector<int> badRocsFromFEDChannels(16, 0);
1762  if (eff.PixelFEDChannelCollection_ != nullptr) {
1764 
1765  if (it != eff.PixelFEDChannelCollection_->end()) {
1766  const std::vector<CablingPathToDetUnit>& path = map_->pathToDetUnit(detID);
1767  for (const auto& ch : *it) {
1768  for (unsigned int i_roc = ch.roc_first; i_roc <= ch.roc_last; ++i_roc) {
1769  for (const auto p : path) {
1770  const PixelROC* myroc = map_.product()->findItem(p);
1771  if (myroc->idInDetUnit() == static_cast<unsigned int>(i_roc)) {
1772  LocalPixel::RocRowCol local = {39, 25}; //corresponding to center of ROC row,col
1773  GlobalPixel global = myroc->toGlobal(LocalPixel(local));
1774  int chipIndex(0), colROC(0), rowROC(0);
1775  pIndexConverter.transformToROC(global.col, global.row, chipIndex, colROC, rowROC);
1776  badRocsFromFEDChannels.at(chipIndex) = 1;
1777  }
1778  }
1779  }
1780  } // loop over channels
1781  } // detID in PixelFEDChannelCollection_
1782  } // has PixelFEDChannelCollection_
1783 
1784  if (eff.FromConfig) {
1785  // setup the chip indices conversion
1787  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P1PXB) { // barrel layers
1788  int layerIndex = tTopo->layer(detID);
1789  pixelEfficiency = eff.thePixelEfficiency[layerIndex - 1];
1790  columnEfficiency = eff.thePixelColEfficiency[layerIndex - 1];
1791  chipEfficiency = eff.thePixelChipEfficiency[layerIndex - 1];
1792  //std::cout <<"Using BPix columnEfficiency = "<<columnEfficiency<< " for layer = "<<layerIndex <<"\n";
1793  // This should never happen, but only check if it is not an upgrade geometry
1794  if (NumberOfBarrelLayers == 3) {
1795  if (numColumns > 416)
1796  LogWarning("Pixel Geometry") << " wrong columns in barrel " << numColumns;
1797  if (numRows > 160)
1798  LogWarning("Pixel Geometry") << " wrong rows in barrel " << numRows;
1799 
1800  int ladder = tTopo->pxbLadder(detID);
1801  int module = tTopo->pxbModule(detID);
1802  if (module <= 4)
1803  module = 5 - module;
1804  else
1805  module -= 4;
1806 
1807  columnEfficiency *= eff.theLadderEfficiency_BPix[layerIndex - 1][ladder - 1] *
1808  eff.theModuleEfficiency_BPix[layerIndex - 1][module - 1] * eff.pu_scale[layerIndex - 1];
1809  }
1812  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) { // forward disks
1813 
1814  unsigned int diskIndex =
1815  tTopo->layer(detID) + eff.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
1816  unsigned int panelIndex = tTopo->pxfPanel(detID);
1817  unsigned int moduleIndex = tTopo->pxfModule(detID);
1818  //if (eff.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = "
1819  // <<diskIndex-1<<" , MinIndex = "<<eff.FPixIndex<<" ... "<<tTopo->pxfDisk(detID);}
1820  pixelEfficiency = eff.thePixelEfficiency[diskIndex - 1];
1821  columnEfficiency = eff.thePixelColEfficiency[diskIndex - 1];
1822  chipEfficiency = eff.thePixelChipEfficiency[diskIndex - 1];
1823  //std::cout <<"Using FPix columnEfficiency = "<<columnEfficiency<<" for Disk = "<< tTopo->pxfDisk(detID)<<"\n";
1824  // Sometimes the forward pixels have wrong size,
1825  // this crashes the index conversion, so exit, but only check if it is not an upgrade geometry
1826  if (NumberOfBarrelLayers ==
1827  3) { // whether it is the present or the phase 1 detector can be checked using GeomDetEnumerators::SubDetector
1828  if (numColumns > 260 || numRows > 160) {
1829  if (numColumns > 260)
1830  LogWarning("Pixel Geometry") << " wrong columns in endcaps " << numColumns;
1831  if (numRows > 160)
1832  LogWarning("Pixel Geometry") << " wrong rows in endcaps " << numRows;
1833  return;
1834  }
1835  if ((panelIndex == 1 && (moduleIndex == 1 || moduleIndex == 2)) ||
1836  (panelIndex == 2 && moduleIndex == 1)) { //inner modules
1837  columnEfficiency *= eff.theInnerEfficiency_FPix[diskIndex - 1] * eff.pu_scale[3];
1838  } else { //outer modules
1839  columnEfficiency *= eff.theOuterEfficiency_FPix[diskIndex - 1] * eff.pu_scale[4];
1840  }
1841  } // current detector, forward
1842  } else if (pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2OTB ||
1844  // If phase 2 outer tracker, hardcoded values as they have been so far
1845  pixelEfficiency = 0.999;
1846  columnEfficiency = 0.999;
1847  chipEfficiency = 0.999;
1848  } // if barrel/forward
1849  } else { // Load precomputed factors from Database
1850  pixelEfficiency = eff.PixelGeomFactors.at(detID);
1851  columnEfficiency = eff.ColGeomFactors.at(detID) * eff.pu_scale[eff.iPU.at(detID)];
1852  chipEfficiency = eff.ChipGeomFactors.at(detID);
1853  if (isPhase1) {
1854  for (unsigned int i_roc = 0; i_roc < eff.PixelGeomFactorsROCStdPixels.at(detID).size(); ++i_roc) {
1855  pixelEfficiencyROCStdPixels[i_roc] = eff.PixelGeomFactorsROCStdPixels.at(detID).at(i_roc);
1856  pixelEfficiencyROCBigPixels[i_roc] = eff.PixelGeomFactorsROCBigPixels.at(detID).at(i_roc);
1857  }
1858  } // is Phase 1
1859  }
1860 
1861 #ifdef TP_DEBUG
1862  LogDebug("Pixel Digitizer") << " enter pixel_inefficiency " << pixelEfficiency << " " << columnEfficiency << " "
1863  << chipEfficiency;
1864 #endif
1865 
1866  // Initilize the index converter
1867  //PixelIndices indexConverter(numColumns,numRows);
1868 
1869  int chipIndex = 0;
1870  int rowROC = 0;
1871  int colROC = 0;
1872  std::map<int, int, std::less<int> > chips, columns, pixelStd, pixelBig;
1873  std::map<int, int, std::less<int> >::iterator iter;
1874 
1875  // Find out the number of columns and rocs hits
1876  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1877  for (signal_map_const_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
1878  int chan = i->first;
1879  std::pair<int, int> ip = PixelDigi::channelToPixel(chan);
1880  int row = ip.first; // X in row
1881  int col = ip.second; // Y is in col
1882  //transform to ROC index coordinates
1883  pIndexConverter.transformToROC(col, row, chipIndex, colROC, rowROC);
1884  int dColInChip = pIndexConverter.DColumn(colROC); // get ROC dcol from ROC col
1885  //dcol in mod
1886  int dColInDet = pIndexConverter.DColumnInModule(dColInChip, chipIndex);
1887 
1888  chips[chipIndex]++;
1889  columns[dColInDet]++;
1890  if (isPhase1) {
1891  if (topol->isItBigPixelInX(row) || topol->isItBigPixelInY(col))
1892  pixelBig[chipIndex]++;
1893  else
1894  pixelStd[chipIndex]++;
1895  }
1896  }
1897 
1898  // Delete some ROC hits.
1899  for (iter = chips.begin(); iter != chips.end(); iter++) {
1900  //float rand = RandFlat::shoot();
1901  float rand = CLHEP::RandFlat::shoot(engine);
1902  if (rand > chipEfficiency)
1903  chips[iter->first] = 0;
1904  }
1905 
1906  // Delete some Dcol hits.
1907  for (iter = columns.begin(); iter != columns.end(); iter++) {
1908  //float rand = RandFlat::shoot();
1909  float rand = CLHEP::RandFlat::shoot(engine);
1910  if (rand > columnEfficiency)
1911  columns[iter->first] = 0;
1912  }
1913 
1914  // Delete some pixel hits based on DCDC issue damage.
1915  if (isPhase1) {
1916  for (iter = pixelStd.begin(); iter != pixelStd.end(); iter++) {
1917  float rand = CLHEP::RandFlat::shoot(engine);
1918  if (rand > pixelEfficiencyROCStdPixels[iter->first])
1919  pixelStd[iter->first] = 0;
1920  }
1921 
1922  for (iter = pixelBig.begin(); iter != pixelBig.end(); iter++) {
1923  float rand = CLHEP::RandFlat::shoot(engine);
1924  if (rand > pixelEfficiencyROCBigPixels[iter->first])
1925  pixelBig[iter->first] = 0;
1926  }
1927  }
1928 
1929  // Now loop again over pixels to kill some of them.
1930  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
1931  for (signal_map_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
1932  // int chan = i->first;
1933  std::pair<int, int> ip = PixelDigi::channelToPixel(i->first); //get pixel pos
1934  int row = ip.first; // X in row
1935  int col = ip.second; // Y is in col
1936  //transform to ROC index coordinates
1937  pIndexConverter.transformToROC(col, row, chipIndex, colROC, rowROC);
1938  int dColInChip = pIndexConverter.DColumn(colROC); //get ROC dcol from ROC col
1939  //dcol in mod
1940  int dColInDet = pIndexConverter.DColumnInModule(dColInChip, chipIndex);
1941 
1942  //float rand = RandFlat::shoot();
1943  float rand = CLHEP::RandFlat::shoot(engine);
1944  if (chips[chipIndex] == 0 || columns[dColInDet] == 0 || rand > pixelEfficiency ||
1945  (pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) ||
1946  (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0)) {
1947  // make pixel amplitude =0, pixel will be lost at clusterization
1948  i->second.set(0.); // reset amplitude,
1949  } // end if
1950  if (isPhase1) {
1951  if ((pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) ||
1952  (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0) || (badRocsFromFEDChannels.at(chipIndex) == 1)) {
1953  //============================================================
1954  // make pixel amplitude =0, pixel will be lost at clusterization
1955  i->second.set(0.); // reset amplitude,
1956  } // end if
1957  } // is Phase 1
1958  if (KillBadFEDChannels && badRocsFromFEDChannels.at(chipIndex) == 1) {
1959  i->second.set(0.);
1960  }
1961  } // end pixel loop
1962 } // end pixel_indefficiency
1963 
1964 //***************************************************************************************
1965 // Simulate pixel aging with an exponential function
1966 //**************************************************************************************
1967 
1969  const PixelGeomDetUnit* pixdet,
1970  const TrackerTopology* tTopo) const {
1971  uint32_t detID = pixdet->geographicalId().rawId();
1972 
1973  // Predefined damage parameter (no aging)
1974  float pseudoRadDamage = 0.0f;
1975 
1976  // setup the chip indices conversion
1978  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P1PXB) { // barrel layers
1979  int layerIndex = tTopo->layer(detID);
1980 
1981  pseudoRadDamage = aging.thePixelPseudoRadDamage[layerIndex - 1];
1982 
1983  // std::cout << "pixel_aging: " << std::endl;
1984  // std::cout << "Subid " << Subid << " layerIndex " << layerIndex << " ladder " << tTopo->pxbLadder(detID) << " module " << tTopo->pxbModule(detID) << std::endl;
1985 
1988  pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) { // forward disks
1989  unsigned int diskIndex =
1990  tTopo->layer(detID) + aging.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix
1991 
1992  pseudoRadDamage = aging.thePixelPseudoRadDamage[diskIndex - 1];
1993 
1994  // std::cout << "pixel_aging: " << std::endl;
1995  // std::cout << "Subid " << Subid << " diskIndex " << diskIndex << std::endl;
1996  } else if (pixdet->subDetector() == GeomDetEnumerators::SubDetector::P2OTB ||
1998  // if phase 2 OT hardcoded value as it has always been
1999  pseudoRadDamage = 0.f;
2000  } // if barrel/forward
2001 
2002  // std::cout << " pseudoRadDamage " << pseudoRadDamage << std::endl;
2003  // std::cout << " end pixel_aging " << std::endl;
2004 
2005  return pseudoRadDamage;
2006 #ifdef TP_DEBUG
2007  LogDebug("Pixel Digitizer") << " enter pixel_aging " << pseudoRadDamage;
2008 #endif
2009 }
2010 
2011 //***********************************************************************
2012 
2013 // Fluctuate the gain and offset for the amplitude calibration
2014 // Use gaussian smearing.
2015 //float SiPixelDigitizerAlgorithm::missCalibrate(const float amp) const {
2016 //float gain = RandGaussQ::shoot(1.,theGainSmearing);
2017 //float offset = RandGaussQ::shoot(0.,theOffsetSmearing);
2018 //float newAmp = amp * gain + offset;
2019 // More complex misscalibration
2021  const TrackerTopology* tTopo,
2022  const PixelGeomDetUnit* pixdet,
2023  int col,
2024  int row,
2025  const float signalInElectrons) const {
2026  // Central values
2027  //const float p0=0.00352, p1=0.868, p2=112., p3=113.; // pix(0,0,0)
2028  // const float p0=0.00382, p1=0.886, p2=112.7, p3=113.0; // average roc=0
2029  //const float p0=0.00492, p1=1.998, p2=90.6, p3=134.1; // average roc=6
2030  // Smeared (rms)
2031  //const float s0=0.00020, s1=0.051, s2=5.4, s3=4.4; // average roc=0
2032  //const float s0=0.00015, s1=0.043, s2=3.2, s3=3.1; // col average roc=0
2033 
2034  // Make 2 sets of parameters for Fpix and BPIx:
2035 
2036  float p0 = 0.0f;
2037  float p1 = 0.0f;
2038  float p2 = 0.0f;
2039  float p3 = 0.0f;
2040 
2041  if (pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()) { // barrel layers
2042  p0 = BPix_p0;
2043  p1 = BPix_p1;
2044  p2 = BPix_p2;
2045  p3 = BPix_p3;
2046  } else if (pixdet->type().isTrackerPixel()) { // forward disks
2047  p0 = FPix_p0;
2048  p1 = FPix_p1;
2049  p2 = FPix_p2;
2050  p3 = FPix_p3;
2051  } else {
2052  throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;
2053  }
2054 
2055  float newAmp = 0.f; //Modified signal
2056 
2057  // Convert electrons to VCAL units
2058  float signal = (signalInElectrons - electronsPerVCAL_Offset) / electronsPerVCAL;
2059 
2060  // New gains/offsets are needed for phase1 L1
2061  int layer = 0;
2062  if (DetId(detID).subdetId() == 1)
2063  layer = tTopo->pxbLayer(detID);
2064  if (layer == 1)
2065  signal = (signalInElectrons - electronsPerVCAL_L1_Offset) / electronsPerVCAL_L1;
2066 
2067  // Simulate the analog response with fixed parametrization
2068  newAmp = p3 + p2 * tanh(p0 * signal - p1);
2069 
2070  // Use the pixel-by-pixel calibrations
2071  //transform to ROC index coordinates
2072  //int chipIndex=0, colROC=0, rowROC=0;
2073  //std::unique_ptr<PixelIndices> pIndexConverter(new PixelIndices(numColumns,numRows));
2074  //pIndexConverter->transformToROC(col,row,chipIndex,colROC,rowROC);
2075 
2076  // Use calibration from a file
2077  //int chanROC = PixelIndices::pixelToChannelROC(rowROC,colROC); // use ROC coordinates
2078  //float pp0=0, pp1=0,pp2=0,pp3=0;
2079  //map<int,CalParameters,std::less<int> >::const_iterator it=calmap.find(chanROC);
2080  //CalParameters y = (*it).second;
2081  //pp0 = y.p0;
2082  //pp1 = y.p1;
2083  //pp2 = y.p2;
2084  //pp3 = y.p3;
2085 
2086  //
2087  // Use random smearing
2088  // Randomize the pixel response
2089  //float pp0 = RandGaussQ::shoot(p0,s0);
2090  //float pp1 = RandGaussQ::shoot(p1,s1);
2091  //float pp2 = RandGaussQ::shoot(p2,s2);
2092  //float pp3 = RandGaussQ::shoot(p3,s3);
2093 
2094  //newAmp = pp3 + pp2 * tanh(pp0*signal - pp1); // Final signal
2095 
2096  //cout<<" misscalibrate "<<col<<" "<<row<<" "<<chipIndex<<" "<<colROC<<" "
2097  // <<rowROC<<" "<<signalInElectrons<<" "<<signal<<" "<<newAmp<<" "
2098  // <<(signalInElectrons/theElectronPerADC)<<std::endl;
2099 
2100  return newAmp;
2101 }
2102 //******************************************************************************
2103 
2104 // Set the drift direction accoring to the Bfield in local det-unit frame
2105 // Works for both barrel and forward pixels.
2106 // Replace the sign convention to fit M.Swartz's formulaes.
2107 // Configurations for barrel and foward pixels possess different tanLorentzAngleperTesla
2108 // parameter value
2109 
2111  const GlobalVector& bfield,
2112  const DetId& detId) const {
2113  Frame detFrame(pixdet->surface().position(), pixdet->surface().rotation());
2114  LocalVector Bfield = detFrame.toLocal(bfield);
2115 
2116  float alpha2_FPix;
2117  float alpha2_BPix;
2118  float alpha2;
2119 
2120  //float dir_x = -tanLorentzAnglePerTesla * Bfield.y();
2121  //float dir_y = +tanLorentzAnglePerTesla * Bfield.x();
2122  //float dir_z = -1.; // E field always in z direction, so electrons go to -z
2123  // The dir_z has to be +/- 1. !
2124  // LocalVector theDriftDirection = LocalVector(dir_x,dir_y,dir_z);
2125 
2126  float dir_x = 0.0f;
2127  float dir_y = 0.0f;
2128  float dir_z = 0.0f;
2129  float scale = 0.0f;
2130 
2131  uint32_t detID = pixdet->geographicalId().rawId();
2132 
2133  // Read Lorentz angle from cfg file:**************************************************************
2134 
2135  if (!use_LorentzAngle_DB_) {
2136  if (alpha2Order) {
2139  } else {
2140  alpha2_FPix = 0.0f;
2141  alpha2_BPix = 0.0f;
2142  }
2143 
2144  if (pixdet->type().isTrackerPixel() && pixdet->type().isBarrel()) { // barrel layers
2145  dir_x = -(tanLorentzAnglePerTesla_BPix * Bfield.y() + alpha2_BPix * Bfield.z() * Bfield.x());
2146  dir_y = +(tanLorentzAnglePerTesla_BPix * Bfield.x() - alpha2_BPix * Bfield.z() * Bfield.y());
2147  dir_z = -(1 + alpha2_BPix * Bfield.z() * Bfield.z());
2148  scale = -dir_z;
2149  } else if (pixdet->type().isTrackerPixel()) { // forward disks
2150  dir_x = -(tanLorentzAnglePerTesla_FPix * Bfield.y() + alpha2_FPix * Bfield.z() * Bfield.x());
2151  dir_y = +(tanLorentzAnglePerTesla_FPix * Bfield.x() - alpha2_FPix * Bfield.z() * Bfield.y());
2152  dir_z = -(1 + alpha2_FPix * Bfield.z() * Bfield.z());
2153  scale = -dir_z;
2154  } else {
2155  throw cms::Exception("NotAPixelGeomDetUnit") << "Not a pixel geomdet unit" << detID;
2156  }
2157  } // end: Read LA from cfg file.
2158 
2159  //Read Lorentz angle from DB:********************************************************************
2160  if (use_LorentzAngle_DB_) {
2161  float lorentzAngle = SiPixelLorentzAngle_->getLorentzAngle(detId);
2162  alpha2 = lorentzAngle * lorentzAngle;
2163  //std::cout << "detID is: "<< it->first <<"The LA per tesla is: "<< it->second << std::std::endl;
2164  dir_x = -(lorentzAngle * Bfield.y() + alpha2 * Bfield.z() * Bfield.x());
2165  dir_y = +(lorentzAngle * Bfield.x() - alpha2 * Bfield.z() * Bfield.y());
2166  dir_z = -(1 + alpha2 * Bfield.z() * Bfield.z());
2167  scale = -dir_z;
2168  } // end: Read LA from DataBase.
2169 
2170  LocalVector theDriftDirection = LocalVector(dir_x / scale, dir_y / scale, dir_z / scale);
2171 
2172 #ifdef TP_DEBUG
2173  LogDebug("Pixel Digitizer") << " The drift direction in local coordinate is " << theDriftDirection;
2174 #endif
2175 
2176  return theDriftDirection;
2177 }
2178 
2179 //****************************************************************************************************
2180 
2182  signal_map_type& theSignal = _signal[detID];
2183 
2184  // Loop over hit pixels, amplitude in electrons, channel = coded row,col
2185  for (signal_map_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
2186  // int chan = i->first;
2187  std::pair<int, int> ip = PixelDigi::channelToPixel(i->first); //get pixel pos
2188  int row = ip.first; // X in row
2189  int col = ip.second; // Y is in col
2190  //transform to ROC index coordinates
2191  if (theSiPixelGainCalibrationService_->isDead(detID, col, row)) {
2192  // std::cout << "now in isdead check, row " << detID << " " << col << "," << row << std::std::endl;
2193  // make pixel amplitude =0, pixel will be lost at clusterization
2194  i->second.set(0.); // reset amplitude,
2195  } // end if
2196  } // end pixel loop
2197 } // end pixel_indefficiency
2198 
2199 //****************************************************************************************************
2200 
2202  bool isbad = false;
2203 
2204  Parameters::const_iterator itDeadModules = DeadModules.begin();
2205 
2206  int detid = detID;
2207  for (; itDeadModules != DeadModules.end(); ++itDeadModules) {
2208  int Dead_detID = itDeadModules->getParameter<int>("Dead_detID");
2209  if (detid == Dead_detID) {
2210  isbad = true;
2211  break;
2212  }
2213  }
2214 
2215  if (!isbad)
2216  return;
2217 
2218  signal_map_type& theSignal = _signal[detID];
2219 
2220  std::string Module = itDeadModules->getParameter<std::string>("Module");
2221 
2222  if (Module == "whole") {
2223  for (signal_map_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
2224  i->second.set(0.); // reset amplitude
2225  }
2226  }
2227 
2228  for (signal_map_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
2229  std::pair<int, int> ip = PixelDigi::channelToPixel(i->first); //get pixel pos
2230 
2231  if (Module == "tbmA" && ip.first >= 80 && ip.first <= 159) {
2232  i->second.set(0.);
2233  }
2234 
2235  if (Module == "tbmB" && ip.first <= 79) {
2236  i->second.set(0.);
2237  }
2238  }
2239 }
2240 //****************************************************************************************************
2242  // Not SLHC safe for now
2243 
2244  bool isbad = false;
2245 
2246  std::vector<SiPixelQuality::disabledModuleType> disabledModules = SiPixelBadModule_->getBadComponentList();
2247 
2249 
2250  for (size_t id = 0; id < disabledModules.size(); id++) {
2251  if (detID == disabledModules[id].DetID) {
2252  isbad = true;
2253  badmodule = disabledModules[id];
2254  break;
2255  }
2256  }
2257 
2258  if (!isbad)
2259  return;
2260 
2261  signal_map_type& theSignal = _signal[detID];
2262 
2263  //std::cout<<"Hit in: "<< detID <<" errorType "<< badmodule.errorType<<" BadRocs="<<std::hex<<SiPixelBadModule_->getBadRocs(detID)<<dec<<" "<<std::endl;
2264  if (badmodule.errorType == 0) { // this is a whole dead module.
2265 
2266  for (signal_map_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
2267  i->second.set(0.); // reset amplitude
2268  }
2269  } else { // all other module types: half-modules and single ROCs.
2270  // Get Bad ROC position:
2271  //follow the example of getBadRocPositions in CondFormats/SiPixelObjects/src/SiPixelQuality.cc
2272  std::vector<GlobalPixel> badrocpositions(0);
2273  for (unsigned int j = 0; j < 16; j++) {
2274  if (SiPixelBadModule_->IsRocBad(detID, j) == true) {
2275  std::vector<CablingPathToDetUnit> path = map_.product()->pathToDetUnit(detID);
2276  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
2277  for (IT it = path.begin(); it != path.end(); ++it) {
2278  const PixelROC* myroc = map_.product()->findItem(*it);
2279  if (myroc->idInDetUnit() == j) {
2280  LocalPixel::RocRowCol local = {39, 25}; //corresponding to center of ROC row, col
2281  GlobalPixel global = myroc->toGlobal(LocalPixel(local));
2282  badrocpositions.push_back(global);
2283  break;
2284  }
2285  }
2286  }
2287  } // end of getBadRocPositions
2288 
2289  for (signal_map_iterator i = theSignal.begin(); i != theSignal.end(); ++i) {
2290  std::pair<int, int> ip = PixelDigi::channelToPixel(i->first); //get pixel pos
2291 
2292  for (std::vector<GlobalPixel>::const_iterator it = badrocpositions.begin(); it != badrocpositions.end(); ++it) {
2293  if (it->row >= 80 && ip.first >= 80) {
2294  if ((std::abs(ip.second - it->col) < 26)) {
2295  i->second.set(0.);
2296  } else if (it->row == 120 && ip.second - it->col == 26) {
2297  i->second.set(0.);
2298  } else if (it->row == 119 && it->col - ip.second == 26) {
2299  i->second.set(0.);
2300  }
2301  } else if (it->row < 80 && ip.first < 80) {
2302  if ((std::abs(ip.second - it->col) < 26)) {
2303  i->second.set(0.);
2304  } else if (it->row == 40 && ip.second - it->col == 26) {
2305  i->second.set(0.);
2306  } else if (it->row == 39 && it->col - ip.second == 26) {
2307  i->second.set(0.);
2308  }
2309  }
2310  }
2311  }
2312  }
2313 }
Vector3DBase
Definition: Vector3DBase.h:8
GloballyPositioned
Definition: GloballyPositioned.h:18
mcMuonSeeds_cfi.SimTrack
SimTrack
Definition: mcMuonSeeds_cfi.py:10
SiPixelDigitizerAlgorithm::electronsPerVCAL_L1
const float electronsPerVCAL_L1
Definition: SiPixelDigitizerAlgorithm.h:354
RPCChamberQuality_cfi.NumberOfEndcapDisks
NumberOfEndcapDisks
Definition: RPCChamberQuality_cfi.py:7
FEDNumbering.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Point2DBase
Definition: Point2DBase.h:9
SiPixelDigitizerAlgorithm::addChargeVCALSmearing
const bool addChargeVCALSmearing
Definition: SiPixelDigitizerAlgorithm.h:373
SiPixelDigitizerAlgorithm::Parameters
std::vector< edm::ParameterSet > Parameters
Definition: SiPixelDigitizerAlgorithm.h:301
DDAxes::y
PileupMixingContent::getMix_bunchCrossing
const std::vector< int > & getMix_bunchCrossing() const
Definition: PileupMixingContent.h:65
electrons_cff.bool
bool
Definition: electrons_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
PixelSubdetector.h
SiPixelDigitizerAlgorithm::Amplitude
Definition: SiPixelDigitizerAlgorithm.h:94
SiPixelDigitizerAlgorithm::missCalibrate
float missCalibrate(uint32_t detID, const TrackerTopology *tTopo, const PixelGeomDetUnit *pixdet, int col, int row, float amp) const
Definition: SiPixelDigitizerAlgorithm.cc:2020
SiPixel2DTemplateDBObject.h
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TrackerGeometry.h
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
SiPixelDigitizerAlgorithm::EnergyDepositUnit
Definition: SiPixelDigitizerAlgorithm.h:185
SiPixelQualityRcd
Definition: SiPixelQualityRcd.h:13
SiPixelDigitizerAlgorithm::AddPixelInefficiency
const bool AddPixelInefficiency
Definition: SiPixelDigitizerAlgorithm.h:378
SiPixelDigitizerAlgorithm::signal_map_iterator
signal_map_type::iterator signal_map_iterator
Definition: SiPixelDigitizerAlgorithm.h:297
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
SiPixelDigitizerAlgorithm::PixelEfficiencies::theOuterEfficiency_FPix
double theOuterEfficiency_FPix[20]
Definition: SiPixelDigitizerAlgorithm.h:263
SiPixelDigitizerAlgorithm::killBadFEDChannels
bool killBadFEDChannels() const
Definition: SiPixelDigitizerAlgorithm.cc:877
SiPixelDigitizerAlgorithm::pixelAging_
const PixelAging pixelAging_
Definition: SiPixelDigitizerAlgorithm.h:459
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
VtxSmearedParameters_cfi.SigmaX
SigmaX
Definition: VtxSmearedParameters_cfi.py:22
HLT_FULL_cff.scale
scale
Definition: HLT_FULL_cff.py:6637
min
T min(T a, T b)
Definition: MathUtil.h:58
SiPixelDigitizerAlgorithm::KillBadFEDChannels
const bool KillBadFEDChannels
Definition: SiPixelDigitizerAlgorithm.h:379
edm
HLT enums.
Definition: AlignableModifier.h:19
RandomNumberGenerator.h
mps_splice.entry
entry
Definition: mps_splice.py:68
SiPixelQualityProbabilities::getProbabilities
probabilityVec getProbabilities(const unsigned int puBin) const
Definition: SiPixelQualityProbabilities.cc:18
TrackerTopology
Definition: TrackerTopology.h:16
SiPixelDigitizerAlgorithm::theThresholdInE_BPix_L1
const float theThresholdInE_BPix_L1
Definition: SiPixelDigitizerAlgorithm.h:344
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiPixelDigitizerAlgorithm::theSiPixelGainCalibrationService_
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
Definition: SiPixelDigitizerAlgorithm.h:449
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
pixelClusterTagInfos_cfi.isPhase1
isPhase1
Definition: pixelClusterTagInfos_cfi.py:7
SiPixelDigitizerAlgorithm::use_module_killing_
const bool use_module_killing_
Definition: SiPixelDigitizerAlgorithm.h:310
TrackerTopology::pxbLadder
unsigned int pxbLadder(const DetId &id) const
Definition: TrackerTopology.h:155
cuy.col
col
Definition: cuy.py:1010
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiPixelFEDChannelContainerESProducerRcd
Definition: SiPixelFEDChannelContainerESProducerRcd.h:9
GaussianTailNoiseGenerator
Definition: GaussianTailNoiseGenerator.h:24
PSimHitContainer.h
phase2TrackerDigitizer_cfi.DeadModules
DeadModules
Definition: phase2TrackerDigitizer_cfi.py:36
SiPixelDigitizerAlgorithm::theNoiser
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser
Definition: SiPixelDigitizerAlgorithm.h:401
SiPixelQuality::disabledModuleType
Definition: SiPixelQuality.h:29
PixelTopology::pitch
virtual std::pair< float, float > pitch() const =0
SiPixelDigitizerAlgorithm::pixel_inefficiency
void pixel_inefficiency(const PixelEfficiencies &eff, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
Definition: SiPixelDigitizerAlgorithm.cc:1741
SiPixelFEDChannelContainer.h
GlobalPixel.h
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
GeomDetEnumerators::P2OTB
Definition: GeomDetEnumerators.h:23
SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelEfficiencies
PixelEfficiencies(const edm::ParameterSet &conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks)
Definition: SiPixelDigitizerAlgorithm.cc:435
SiPixelDigitizerAlgorithm::pixelEfficiencies_
PixelEfficiencies pixelEfficiencies_
Definition: SiPixelDigitizerAlgorithm.h:458
SiPixelFedCablingMap.h
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
SiPixelDigitizerAlgorithm::fluctuateEloss
void fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegments, float elossVector[], CLHEP::HepRandomEngine *) const
Definition: SiPixelDigitizerAlgorithm.cc:1146
sipixelobjects::GlobalPixel::row
int row
Definition: GlobalPixel.h:7
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
SiPixelQuality::disabledModuleType::errorType
int errorType
Definition: SiPixelQuality.h:31
Topology::localPosition
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
SiPixelDigitizerAlgorithm::SiPixelLorentzAngle_
edm::ESHandle< SiPixelLorentzAngle > SiPixelLorentzAngle_
Definition: SiPixelDigitizerAlgorithm.h:149
SiPixelDigitizerAlgorithm::theThresholdSmearing_FPix
const double theThresholdSmearing_FPix
Definition: SiPixelDigitizerAlgorithm.h:347
SiPixelLorentzAngleSimRcd.h
PixelDigi.h
DDAxes::x
SiPixelFedCablingTree.h
SiPixelDigitizerAlgorithm::TheNewSiPixelChargeReweightingAlgorithmClass
std::unique_ptr< SiPixelChargeReweightingAlgorithm > TheNewSiPixelChargeReweightingAlgorithmClass
Definition: SiPixelDigitizerAlgorithm.h:316
pfMETCorrectionType0_cfi.par1
par1
Definition: pfMETCorrectionType0_cfi.py:48
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
SiPixelGainCalibrationOfflineSimService.h
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
SiPixelDigitizerAlgorithm::pixel_inefficiency_db
void pixel_inefficiency_db(uint32_t detID)
Definition: SiPixelDigitizerAlgorithm.cc:2181
simKBmtfDigis_cfi.eLoss
eLoss
Definition: simKBmtfDigis_cfi.py:9
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
sipixelobjects::GlobalPixel::col
int col
Definition: GlobalPixel.h:8
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelFEDChannelCollection_
std::unique_ptr< PixelFEDChannelCollection > PixelFEDChannelCollection_
Definition: SiPixelDigitizerAlgorithm.h:279
SiPixelDigitizerAlgorithm::theTofLowerCut
const float theTofLowerCut
Definition: SiPixelDigitizerAlgorithm.h:357
GeomDetType::isTrackerPixel
bool isTrackerPixel() const
Definition: GeomDetType.cc:15
SiPixelDigitizerAlgorithm::initCal
std::map< int, CalParameters, std::less< int > > initCal() const
Definition: SiPixelDigitizerAlgorithm.cc:340
GaussianTailNoiseGenerator.h
SiPixelDigitizerAlgorithm::doMissCalibrate
const bool doMissCalibrate
Definition: SiPixelDigitizerAlgorithm.h:383
SiPixelDigitizerAlgorithm::FPix_p3
const float FPix_p3
Definition: SiPixelDigitizerAlgorithm.h:365
sipixelobjects::LocalPixel
identify pixel inside single ROC
Definition: LocalPixel.h:7
SiPixelDigitizerAlgorithm::addNoise
const bool addNoise
Definition: SiPixelDigitizerAlgorithm.h:372
SiPixelDigitizerAlgorithm::PixelEfficiencies::thePUEfficiency
std::vector< std::vector< double > > thePUEfficiency
Definition: SiPixelDigitizerAlgorithm.h:254
SiPixelDigitizerAlgorithm::PixelEfficiencies
Definition: SiPixelDigitizerAlgorithm.h:245
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
SiPixelDigitizerAlgorithm::PixelEfficiencies::iPU
std::map< uint32_t, size_t > iPU
Definition: SiPixelDigitizerAlgorithm.h:272
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
TrackerTopology::pxfPanel
unsigned int pxfPanel(const DetId &id) const
Definition: TrackerTopology.h:450
EncodedEventId
Definition: EncodedEventId.h:11
SiPixelLorentzAngle::getLorentzAngle
float getLorentzAngle(const uint32_t &) const
Definition: SiPixelLorentzAngle.cc:14
SiG4UniversalFluctuation.h
SiPixelDynamicInefficiency
Definition: SiPixelDynamicInefficiency.h:11
SiPixelDigitizerAlgorithm::use_ineff_from_db_
const bool use_ineff_from_db_
Definition: SiPixelDigitizerAlgorithm.h:309
PixelTopology::isItBigPixelInX
virtual bool isItBigPixelInX(int ixbin) const =0
DetId
Definition: DetId.h:17
GeomDetEnumerators::PixelBarrel
Definition: GeomDetEnumerators.h:11
SiPixelDigitizerAlgorithm::theThresholdInE_BPix_L2
const float theThresholdInE_BPix_L2
Definition: SiPixelDigitizerAlgorithm.h:345
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrackerTopology.h
SiPixelSimParameters_cfi.KillBadFEDChannels
KillBadFEDChannels
Definition: SiPixelSimParameters_cfi.py:50
SiPixelDigitizerAlgorithm::init
void init(const edm::EventSetup &es)
Definition: SiPixelDigitizerAlgorithm.cc:116
SiPixelDigitizerAlgorithm::accumulateSimHits
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 PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
Definition: SiPixelDigitizerAlgorithm.cc:761
SiPixelDigitizerAlgorithm::BPix_p0
const float BPix_p0
Definition: SiPixelDigitizerAlgorithm.h:366
SiPixelDigitizerAlgorithm::FPix_p0
const float FPix_p0
Definition: SiPixelDigitizerAlgorithm.h:362
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
sipixelobjects::GlobalPixel
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
SiPixelDigitizerAlgorithm::calmap
const std::map< int, CalParameters, std::less< int > > calmap
Definition: SiPixelDigitizerAlgorithm.h:404
pfMETCorrectionType0_cfi.par3
par3
Definition: pfMETCorrectionType0_cfi.py:50
HLTEgPhaseIITestSequence_cff.bunchSpacing
bunchSpacing
Definition: HLTEgPhaseIITestSequence_cff.py:1574
PixelIndices::channelToPixelROC
static std::pair< int, int > channelToPixelROC(const int chan)
Definition: PixelIndices.h:236
SiPixelQualityRcd.h
SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelGeomFactorsROCBigPixels
std::map< uint32_t, std::vector< double > > PixelGeomFactorsROCBigPixels
Definition: SiPixelDigitizerAlgorithm.h:269
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52861
ecaldqm::topology
const CaloTopology * topology(nullptr)
SiPixelDigitizerAlgorithm::NumberOfBarrelLayers
const int NumberOfBarrelLayers
Definition: SiPixelDigitizerAlgorithm.h:332
GeomDetEnumerators::P1PXEC
Definition: GeomDetEnumerators.h:26
Service.h
SiPixelDigitizerAlgorithm::PixelEfficiencies::FPixIndex
unsigned int FPixIndex
Definition: SiPixelDigitizerAlgorithm.h:264
sipixelobjects
Definition: CablingPathToDetUnit.h:4
SiPixelDigitizerAlgorithm::SiPixelBadModule_
edm::ESHandle< SiPixelQuality > SiPixelBadModule_
Definition: SiPixelDigitizerAlgorithm.h:153
SiPixelLorentzAngleSimRcd
Definition: SiPixelLorentzAngleSimRcd.h:24
SiPixelDigitizerAlgorithm::tMax
const double tMax
Definition: SiPixelDigitizerAlgorithm.h:396
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Topology::channel
virtual int channel(const LocalPoint &p) const =0
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelChipEfficiency
double thePixelChipEfficiency[20]
Definition: SiPixelDigitizerAlgorithm.h:259
SiPixelDigitizerAlgorithm::Sigma0
const float Sigma0
Definition: SiPixelDigitizerAlgorithm.h:325
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
edm::ESHandle< TrackerGeometry >
p2
double p2[4]
Definition: TauolaWrapper.h:90
SiPixelFedCablingMap::pathToDetUnit
std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const final
Definition: SiPixelFedCablingMap.cc:150
PixelTopology::ncolumns
virtual int ncolumns() const =0
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
SiPixelDigitizerAlgorithm::quality_map
const PixelFEDChannelCollectionMap * quality_map
Definition: SiPixelDigitizerAlgorithm.h:92
SiPixelDigitizerAlgorithm::module_killing_conf
void module_killing_conf(uint32_t detID)
Definition: SiPixelDigitizerAlgorithm.cc:2201
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
SiPixelDigitizerAlgorithm::Dist300
const float Dist300
Definition: SiPixelDigitizerAlgorithm.h:326
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
SiPixelGainCalibrationOfflineSimService
Definition: SiPixelGainCalibrationOfflineSimService.h:22
GeomDetEnumerators::P2OTEC
Definition: GeomDetEnumerators.h:24
HLT_FULL_cff.siPixelQualityLabel
siPixelQualityLabel
Definition: HLT_FULL_cff.py:8074
SiPixelDigitizerAlgorithm::chooseScenario
std::unique_ptr< PixelFEDChannelCollection > chooseScenario(PileupMixingContent *puInfo, CLHEP::HepRandomEngine *)
Definition: SiPixelDigitizerAlgorithm.cc:926
SiPixelDynamicInefficiencyRcd.h
PixelDigi::pixelToChannel
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:71
Point3DBase< float, LocalTag >
cmsdt::scenario
scenario
Definition: constants.h:166
PixelTopology
Definition: PixelTopology.h:10
SiPixelFedCabling.h
LaserClusterizer_cfi.ClusterWidth
ClusterWidth
Definition: LaserClusterizer_cfi.py:12
SiPixelDigitizerAlgorithm::theNoiseInElectrons
const float theNoiseInElectrons
Definition: SiPixelDigitizerAlgorithm.h:338
SiPixelDigitizerAlgorithm::PixelEfficiencies::theModuleEfficiency_BPix
std::vector< double > theModuleEfficiency_BPix[20]
Definition: SiPixelDigitizerAlgorithm.h:261
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
hit::z
double z
Definition: SiStripHitEffFromCalibTree.cc:91
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
SiPixelDigitizerAlgorithm::PixelEfficiencies::theInstLumiScaleFactor
double theInstLumiScaleFactor
Definition: SiPixelDigitizerAlgorithm.h:252
SiPixelDigitizerAlgorithm::geom_
edm::ESHandle< TrackerGeometry > geom_
Definition: SiPixelDigitizerAlgorithm.h:157
SiPixelDigitizerAlgorithm::addThresholdSmearing
const bool addThresholdSmearing
Definition: SiPixelDigitizerAlgorithm.h:380
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelDigitizerAlgorithm::signal_map_const_iterator
signal_map_type::const_iterator signal_map_const_iterator
Definition: SiPixelDigitizerAlgorithm.h:298
SiPixelDigitizerAlgorithm::module_killing_DB
void module_killing_DB(uint32_t detID)
Definition: SiPixelDigitizerAlgorithm.cc:2241
runGCPTkAlMap.in_file
in_file
Definition: runGCPTkAlMap.py:74
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
funct::true
true
Definition: Factorize.h:173
GeomDetEnumerators::P1PXB
Definition: GeomDetEnumerators.h:25
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
TrackerDigiGeometryRecord.h
Bounds::thickness
virtual float thickness() const =0
SiPixelDigitizerAlgorithm::PixelEfficiencies::pu_scale
std::vector< double > pu_scale
Definition: SiPixelDigitizerAlgorithm.h:253
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
HIPAlignmentAlgorithm_cfi.UseReweighting
UseReweighting
Definition: HIPAlignmentAlgorithm_cfi.py:61
PixelROC.h
SiPixelDigitizerAlgorithm::calculateInstlumiFactor
void calculateInstlumiFactor(PileupMixingContent *puInfo)
Definition: SiPixelDigitizerAlgorithm.cc:814
SiPixelDigitizerAlgorithm::PixelEfficiencies::theInnerEfficiency_FPix
double theInnerEfficiency_FPix[20]
Definition: SiPixelDigitizerAlgorithm.h:262
SiPixelDigitizerAlgorithm::BPix_p2
const float BPix_p2
Definition: SiPixelDigitizerAlgorithm.h:368
PixelIndices::pixelToChannelROC
static int pixelToChannelROC(const int rowROC, const int colROC)
Definition: PixelIndices.h:233
CablingPathToDetUnit.h
SiPixelDigitizerAlgorithm::PixelAging
Definition: SiPixelDigitizerAlgorithm.h:288
SiPixelDigitizerAlgorithm::map_
edm::ESHandle< SiPixelFedCablingMap > map_
Definition: SiPixelDigitizerAlgorithm.h:156
SiPixelFedCablingMapRcd.h
SiPixelDynamicInefficiency::gettheInstLumiScaleFactor
double gettheInstLumiScaleFactor() const
Definition: SiPixelDynamicInefficiency.cc:122
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SiPixelDigitizerAlgorithm::theThresholdSmearing_BPix_L1
const double theThresholdSmearing_BPix_L1
Definition: SiPixelDigitizerAlgorithm.h:349
SiPixelDigitizerAlgorithm::alpha2Order
const bool alpha2Order
Definition: SiPixelDigitizerAlgorithm.h:327
SiPixelQualityProbabilities::probabilityMap
std::map< unsigned int, probabilityVec > probabilityMap
Definition: SiPixelQualityProbabilities.h:13
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
SiPixelDigitizerAlgorithm::~SiPixelDigitizerAlgorithm
~SiPixelDigitizerAlgorithm()
Definition: SiPixelDigitizerAlgorithm.cc:430
SiPixelDynamicInefficiency::getChipGeomFactors
const std::map< unsigned int, double > & getChipGeomFactors() const
Definition: SiPixelDynamicInefficiency.h:27
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
PV2DBase::x
T x() const
Definition: PV2DBase.h:43
recoMuon::in
Definition: RecoMuonEnumerators.h:6
SiPixelDigitizerAlgorithm::makeDigiSimLinks_
const bool makeDigiSimLinks_
Definition: SiPixelDigitizerAlgorithm.h:307
hgcalDigitizer_cfi.noise
noise
Definition: hgcalDigitizer_cfi.py:155
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:671
pfMETCorrectionType0_cfi.par2
par2
Definition: pfMETCorrectionType0_cfi.py:49
SiPixelDigitizerAlgorithm::theThresholdSmearing_BPix_L2
const double theThresholdSmearing_BPix_L2
Definition: SiPixelDigitizerAlgorithm.h:350
PixelTopology::isItBigPixelInY
virtual bool isItBigPixelInY(int iybin) const =0
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
notFound
static const GlobalPoint notFound(0, 0, 0)
SiPixelDigitizerAlgorithm::theThresholdInE_BPix
const float theThresholdInE_BPix
Definition: SiPixelDigitizerAlgorithm.h:343
LocalVector
Local3DVector LocalVector
Definition: LocalVector.h:12
createfilelist.int
int
Definition: createfilelist.py:10
LocalPixel.h
SiPixelQualityProbabilities.h
SiPixelDigitizerAlgorithm::PixelAging::PixelAging
PixelAging(const edm::ParameterSet &conf, bool AddPixelAging, int NumberOfBarrelLayers, int NumberOfEndcapDisks)
Definition: SiPixelDigitizerAlgorithm.cc:713
SiPixelDigitizerAlgorithm::PixelEfficiencies::FromConfig
bool FromConfig
Definition: SiPixelDigitizerAlgorithm.h:250
TrackerTopology::pxfModule
unsigned int pxfModule(const DetId &id) const
Definition: TrackerTopology.h:163
PileupMixingContent
Definition: PileupMixingContent.h:24
SiPixelDigitizerAlgorithm::theTofUpperCut
const float theTofUpperCut
Definition: SiPixelDigitizerAlgorithm.h:358
SiPixelDigitizerAlgorithm::theElectronPerADC
const float theElectronPerADC
Definition: SiPixelDigitizerAlgorithm.h:336
SiPixelDigitizerAlgorithm::fluctuateCharge
const bool fluctuateCharge
Definition: SiPixelDigitizerAlgorithm.h:375
SiPixelDigitizerAlgorithm::theReadoutNoise
const float theReadoutNoise
Definition: SiPixelDigitizerAlgorithm.h:339
p1
double p1[4]
Definition: TauolaWrapper.h:89
SiPixelDigitizerAlgorithm::CalParameters::p3
float p3
Definition: SiPixelDigitizerAlgorithm.h:177
SiPixelDynamicInefficiencyRcd
Definition: SiPixelDynamicInefficiencyRcd.h:23
IdealGeometryRecord.h
SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db
void init_from_db(const edm::ESHandle< TrackerGeometry > &, const edm::ESHandle< SiPixelDynamicInefficiency > &)
Definition: SiPixelDigitizerAlgorithm.cc:597
SiPixelDigitizerAlgorithm::addNoisyPixels
const bool addNoisyPixels
Definition: SiPixelDigitizerAlgorithm.h:374
edm::EventSetup
Definition: EventSetup.h:57
Topology::measurementPosition
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
sipixelobjects::PixelROC::toGlobal
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:55
GeomDet::specificSurface
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
SiPixelDigitizerAlgorithm::SignalPoint
Definition: SiPixelDigitizerAlgorithm.h:207
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiPixelDigitizerAlgorithm::electronsPerVCAL_Offset
const float electronsPerVCAL_Offset
Definition: SiPixelDigitizerAlgorithm.h:353
get
#define get
SiPixelDigitizerAlgorithm::make_digis
void make_digis(float thePixelThresholdInE, uint32_t detID, const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, const TrackerTopology *tTopo) const
Definition: SiPixelDigitizerAlgorithm.cc:1542
SiPixelDigitizerAlgorithm::_signal
signalMaps _signal
Definition: SiPixelDigitizerAlgorithm.h:305
SiPixelDigitizerAlgorithm::drift
void drift(const PSimHit &hit, const PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const TrackerTopology *tTopo, const std::vector< EnergyDepositUnit > &ionization_points, std::vector< SignalPoint > &collection_points) const
Definition: SiPixelDigitizerAlgorithm.cc:1212
IT
std::vector< LinkConnSpec >::const_iterator IT
Definition: TriggerBoardSpec.cc:5
SiPixelDigitizerAlgorithm::electronsPerVCAL_L1_Offset
const float electronsPerVCAL_L1_Offset
Definition: SiPixelDigitizerAlgorithm.h:355
SiPixelDigitizerAlgorithm::fluctuate
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate
Definition: SiPixelDigitizerAlgorithm.h:400
PixelIndices.h
SiPixelDigitizerAlgorithm::DriftDirection
LocalVector DriftDirection(const PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
Definition: SiPixelDigitizerAlgorithm.cc:2110
SiPixelDigitizerAlgorithm::SiPixelDigitizerAlgorithm
SiPixelDigitizerAlgorithm(const edm::ParameterSet &conf)
Definition: SiPixelDigitizerAlgorithm.cc:183
SiPixelDigitizerAlgorithm::tanLorentzAnglePerTesla_FPix
const float tanLorentzAnglePerTesla_FPix
Definition: SiPixelDigitizerAlgorithm.h:359
SiPixelDigitizerAlgorithm::CalParameters::p2
float p2
Definition: SiPixelDigitizerAlgorithm.h:176
SiPixelQuality::getBadComponentList
const std::vector< disabledModuleType > getBadComponentList() const
Definition: SiPixelQuality.h:100
MixingModule_cfi.bunchspace
bunchspace
Definition: MixingModule_cfi.py:41
pixelDigitizer_cfi.AddPixelInefficiency
AddPixelInefficiency
Definition: pixelDigitizer_cfi.py:20
SiPixelDigitizerAlgorithm::BPix_p3
const float BPix_p3
Definition: SiPixelDigitizerAlgorithm.h:369
SiPixelDigitizerAlgorithm::signal_map_type
std::map< int, Amplitude, std::less< int > > signal_map_type
Definition: SiPixelDigitizerAlgorithm.h:296
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelGeomFactorsROCStdPixels
std::map< uint32_t, std::vector< double > > PixelGeomFactorsROCStdPixels
Definition: SiPixelDigitizerAlgorithm.h:268
SiPixelDigitizerAlgorithm::use_deadmodule_DB_
const bool use_deadmodule_DB_
Definition: SiPixelDigitizerAlgorithm.h:311
SiPixelChargeReweightingAlgorithm.h
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
PixelGeomDetUnit::type
const GeomDetType & type() const override
Definition: PixelGeomDetUnit.cc:11
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
sipixelobjects::PixelROC
Definition: PixelROC.h:23
LaserClient_cfi.Amplitude
Amplitude
Definition: LaserClient_cfi.py:39
SiPixelDynamicInefficiency.h
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
SiPixelDigitizerAlgorithm::PixelEfficiencies::theLadderEfficiency_BPix
std::vector< double > theLadderEfficiency_BPix[20]
Definition: SiPixelDigitizerAlgorithm.h:260
SiPixel2DTemplateDBObjectRcd.h
VtxSmearedParameters_cfi.SigmaY
SigmaY
Definition: VtxSmearedParameters_cfi.py:21
SiPixelDigitizerAlgorithm::GeVperElectron
const float GeVperElectron
Definition: SiPixelDigitizerAlgorithm.h:322
SiPixelDigitizerAlgorithm::electronsPerVCAL
const float electronsPerVCAL
Definition: SiPixelDigitizerAlgorithm.h:352
sipixelobjects::LocalPixel::RocRowCol
row and collumn in ROC representation
Definition: LocalPixel.h:13
SiPixelDigitizerAlgorithm::CalParameters::p0
float p0
Definition: SiPixelDigitizerAlgorithm.h:174
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
TrackerTopology::pxbModule
unsigned int pxbModule(const DetId &id) const
Definition: TrackerTopology.h:160
SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelColEfficiency
double thePixelColEfficiency[20]
Definition: SiPixelDigitizerAlgorithm.h:258
fitWZ.par0
par0
Definition: fitWZ.py:52
DetId.h
SiPixelStatusScenariosRcd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
SiPixelDigitizerAlgorithm::theAdcFullScale
const int theAdcFullScale
Definition: SiPixelDigitizerAlgorithm.h:337
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
SiPixelDigitizerAlgorithm::NumberOfEndcapDisks
const int NumberOfEndcapDisks
Definition: SiPixelDigitizerAlgorithm.h:333
mps_check.columns
columns
Definition: mps_check.py:244
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:246
SiPixelDigitizerAlgorithm::pixel_aging
float pixel_aging(const PixelAging &aging, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo) const
Definition: SiPixelDigitizerAlgorithm.cc:1968
SiPixelDynamicInefficiency::getDetIdmasks
const std::vector< uint32_t > getDetIdmasks() const
Definition: SiPixelDynamicInefficiency.h:36
SiPixelDigitizerAlgorithm::CalParameters
Definition: SiPixelDigitizerAlgorithm.h:172
SiPixelDigitizerAlgorithm::theThresholdInE_FPix
const float theThresholdInE_FPix
Definition: SiPixelDigitizerAlgorithm.h:342
SiPixelDigitizerAlgorithm::PixelEfficiencies::matches
bool matches(const DetId &, const DetId &, const std::vector< uint32_t > &)
Definition: SiPixelDigitizerAlgorithm.cc:697
SiPixelDigitizerAlgorithm::PixelEfficiencies::ColGeomFactors
std::map< uint32_t, double > ColGeomFactors
Definition: SiPixelDigitizerAlgorithm.h:270
PixelGeomDetUnit.h
PVValHelper::ladder
Definition: PVValidationHelpers.h:72
SiPixelDigitizerAlgorithm::induce_signal
void induce_signal(std::vector< PSimHit >::const_iterator inputBegin, std::vector< PSimHit >::const_iterator inputEnd, const PSimHit &hit, const size_t hitIndex, const unsigned int tofBin, const PixelGeomDetUnit *pixdet, const std::vector< SignalPoint > &collection_points)
Definition: SiPixelDigitizerAlgorithm.cc:1330
SiG4UniversalFluctuation
Definition: SiG4UniversalFluctuation.h:25
SiPixelDigitizerAlgorithm::BPix_p1
const float BPix_p1
Definition: SiPixelDigitizerAlgorithm.h:367
SiPixelDigitizerAlgorithm::theThresholdSmearing_BPix
const double theThresholdSmearing_BPix
Definition: SiPixelDigitizerAlgorithm.h:348
PixelTestBeamValidation_cfi.Charge
Charge
Definition: PixelTestBeamValidation_cfi.py:91
GeomDetType::isBarrel
bool isBarrel() const
Definition: GeomDetType.cc:9
SiPixelDigitizerAlgorithm::primary_ionization
void primary_ionization(const PSimHit &hit, std::vector< EnergyDepositUnit > &ionization_points, CLHEP::HepRandomEngine *) const
Definition: SiPixelDigitizerAlgorithm.cc:1080
SiPixelLorentzAngle.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
p3
double p3[4]
Definition: TauolaWrapper.h:91
SiPixelDigitizerAlgorithm::tanLorentzAnglePerTesla_BPix
const float tanLorentzAnglePerTesla_BPix
Definition: SiPixelDigitizerAlgorithm.h:360
Exception.h
SiPixelDigitizerAlgorithm::AddPixelAging
const bool AddPixelAging
Definition: SiPixelDigitizerAlgorithm.h:388
GeomDetEnumerators::PixelEndcap
Definition: GeomDetEnumerators.h:12
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
SiPixelDigitizerAlgorithm::FPix_p2
const float FPix_p2
Definition: SiPixelDigitizerAlgorithm.h:364
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiPixelQuality.h
SiPixelDigitizerAlgorithm::UseReweighting
const bool UseReweighting
Definition: SiPixelDigitizerAlgorithm.h:389
PileupMixingContent.h
muons2muons_cfi.pu
pu
Definition: muons2muons_cfi.py:31
funct::arg
A arg
Definition: Factorize.h:31
SiPixelDynamicInefficiency::getColGeomFactors
const std::map< unsigned int, double > & getColGeomFactors() const
Definition: SiPixelDynamicInefficiency.h:22
SiPixelDigitizerAlgorithm::CalParameters::p1
float p1
Definition: SiPixelDigitizerAlgorithm.h:175
SiPixelDynamicInefficiency::getPUFactors
const std::map< unsigned int, std::vector< double > > & getPUFactors() const
Definition: SiPixelDynamicInefficiency.h:30
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
genParticles_cff.map
map
Definition: genParticles_cff.py:11
SiPixelDigitizerAlgorithm::scenarioProbabilityHandle
edm::ESHandle< SiPixelQualityProbabilities > scenarioProbabilityHandle
Definition: SiPixelDigitizerAlgorithm.h:163
SimTrack.h
SiPixelDigitizerAlgorithm::setSimAccumulator
void setSimAccumulator(const std::map< uint32_t, std::map< int, int > > &signalMap)
Definition: SiPixelDigitizerAlgorithm.cc:971
ParameterSet.h
PSimHit
Definition: PSimHit.h:15
aging
Definition: aging.py:1
SiPixelQuality::IsRocBad
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
Definition: SiPixelQuality.cc:111
GloballyPositioned::rotation
const RotationType & rotation() const
Definition: GloballyPositioned.h:38
SiPixelFedCablingMapRcd
Definition: SiPixelFedCablingMapRcd.h:5
SiPixelDigitizerAlgorithm::FPix_p1
const float FPix_p1
Definition: SiPixelDigitizerAlgorithm.h:363
SiPixelDigitizerAlgorithm.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
SiPixelDigitizerAlgorithm::SiPixelDynamicInefficiency_
edm::ESHandle< SiPixelDynamicInefficiency > SiPixelDynamicInefficiency_
Definition: SiPixelDigitizerAlgorithm.h:160
SiPixelDigitizerAlgorithm::digitize
void digitize(const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
Definition: SiPixelDigitizerAlgorithm.cc:982
point
*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
SiPixelDigitizerAlgorithm::DeadModules
const Parameters DeadModules
Definition: SiPixelDigitizerAlgorithm.h:314
PixelTopology::nrows
virtual int nrows() const =0
mps_splice.line
line
Definition: mps_splice.py:76
SiPixelDynamicInefficiency::getPixelGeomFactors
const std::map< unsigned int, double > & getPixelGeomFactors() const
Definition: SiPixelDynamicInefficiency.h:19
SiPixelStatusScenarioProbabilityRcd.h
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
SiPixelDigitizerAlgorithm::PixelEfficiencies::thePixelEfficiency
double thePixelEfficiency[20]
Definition: SiPixelDigitizerAlgorithm.h:257
SiPixelDigitizerAlgorithm::init_DynIneffDB
void init_DynIneffDB(const edm::EventSetup &, const unsigned int &)
Definition: SiPixelDigitizerAlgorithm.cc:587
SiPixelFedCablingMap::findItem
const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &path) const final
Definition: SiPixelFedCablingMap.cc:124
PileupMixingContent::getMix_TrueInteractions
const std::vector< float > & getMix_TrueInteractions() const
Definition: PileupMixingContent.h:64
SiPixelDigitizerAlgorithm::calcQ
double calcQ(float x) const
Definition: SiPixelDigitizerAlgorithm.h:461
SiPixelDigitizerAlgorithm::PixelEfficiencies::PixelGeomFactors
std::map< uint32_t, double > PixelGeomFactors
Definition: SiPixelDigitizerAlgorithm.h:267
cuy.ii
ii
Definition: cuy.py:590
SiPixelDigitizerAlgorithm::ClusterWidth
const float ClusterWidth
Definition: SiPixelDigitizerAlgorithm.h:330
SiPixelStatusScenarioProbabilityRcd
Definition: SiPixelStatusScenarioProbabilityRcd.h:18
PixelFEDCabling.h
GeomDet::subDetector
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:38
hit
Definition: SiStripHitEffFromCalibTree.cc:88
SiPixelDigitizerAlgorithm::PixelEfficiencies::ChipGeomFactors
std::map< uint32_t, double > ChipGeomFactors
Definition: SiPixelDigitizerAlgorithm.h:271
sipixelobjects::PixelROC::idInDetUnit
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37
PixelDigi::channelToPixel
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:65
SiPixelDigitizerAlgorithm::add_noise
void add_noise(const PixelGeomDetUnit *pixdet, float thePixelThreshold, CLHEP::HepRandomEngine *)
Definition: SiPixelDigitizerAlgorithm.cc:1638
PixelIndices
Definition: PixelIndices.h:40
GeomDetEnumerators::P2PXEC
Definition: GeomDetEnumerators.h:28
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
SiPixelFrameReverter.h
SiPixelDigitizerAlgorithm::use_LorentzAngle_DB_
const bool use_LorentzAngle_DB_
Definition: SiPixelDigitizerAlgorithm.h:312