45 #include <gsl/gsl_sf_erf.h> 47 #include "CLHEP/Random/RandFlat.h" 48 #include "CLHEP/Random/RandGaussQ.h" 49 #include "CLHEP/Random/RandGeneral.h" 94 if (use_ineff_from_db_) {
95 theSiPixelGainCalibrationService_->setESObjects(es);
97 if (use_deadmodule_DB_) {
98 SiPixelBadModule_ = &es.
getData(SiPixelBadModuleToken_);
100 if (use_LorentzAngle_DB_) {
102 SiPixelLorentzAngle_ = &es.
getData(SiPixelLorentzAngleToken_);
106 geom_ = &es.
getData(geomToken_);
109 scenarioProbability_ = &es.
getData(scenarioProbabilityToken_);
110 quality_map = &es.
getData(PixelFEDChannelCollectionMapToken_);
113 std::vector<std::string> allScenarios;
117 std::back_inserter(allScenarios),
120 std::vector<std::string> allScenariosInProb;
122 for (
auto it = m_probabilities.begin();
it != m_probabilities.end(); ++
it) {
124 for (
const auto&
entry :
it->second) {
126 auto probability =
entry.second;
127 if (probability != 0) {
128 if (
std::find(allScenariosInProb.begin(), allScenariosInProb.end(),
scenario) == allScenariosInProb.end()) {
129 allScenariosInProb.push_back(
scenario);
136 std::copy_if(allScenariosInProb.begin(),
137 allScenariosInProb.end(),
140 return (
std::find(allScenarios.begin(), allScenarios.end(),
arg) == allScenarios.end());
145 LogError(
"SiPixelFEDChannelContainer")
146 <<
"The requested scenario: " <<
entry <<
" is not found in the map!! \n";
149 <<
" missing scenario(s) in SiPixelStatusScenariosRcd while " 150 "present in SiPixelStatusScenarioProbabilityRcd \n";
153 LogInfo(
"PixelDigitizer ") <<
" PixelDigitizerAlgorithm init \n";
154 LogInfo(
"PixelDigitizer ") <<
" PixelDigitizerAlgorithm --> UseReweighting " <<
UseReweighting <<
"\n";
155 LogInfo(
"PixelDigitizer ") <<
" PixelDigitizerAlgorithm --> store_SimHitEntryExitPoints_ " 156 << store_SimHitEntryExitPoints_ <<
"\n";
157 LogInfo(
"PixelDigitizer ") <<
" PixelDigitizerAlgorithm --> makeDigiSimLinks_ " << makeDigiSimLinks_ <<
"\n";
159 TheNewSiPixelChargeReweightingAlgorithmClass->init(es);
161 int collectionIndex = 0;
163 for (
int i1 = 1;
i1 < 3;
i1++) {
164 for (
int i2 = 0;
i2 < 2;
i2++) {
171 SimHitCollMap[theSubDetTofBin] = collectionIndex;
184 makeDigiSimLinks_(conf.getUntrackedParameter<
bool>(
"makeDigiSimLinks",
true)),
185 store_SimHitEntryExitPoints_(
186 conf.exists(
"store_SimHitEntryExitPoints") ? conf.getParameter<
bool>(
"store_SimHitEntryExitPoints") :
false),
187 use_ineff_from_db_(conf.getParameter<
bool>(
"useDB")),
188 use_module_killing_(conf.getParameter<
bool>(
"killModules")),
189 use_deadmodule_DB_(conf.getParameter<
bool>(
"DeadModules_DB")),
190 use_LorentzAngle_DB_(conf.getParameter<
bool>(
"LorentzAngle_DB")),
193 : conf.getParameter<
Parameters>(
"DeadModules")),
195 TheNewSiPixelChargeReweightingAlgorithmClass(),
199 GeVperElectron(3.61E-09),
202 alpha2Order(conf.getParameter<
bool>(
"Alpha2Order")),
208 NumberOfBarrelLayers(conf.exists(
"NumPixelBarrel") ? conf.getParameter<
int>(
"NumPixelBarrel") : 3),
216 theElectronPerADC(conf.getParameter<double>(
"ElectronPerAdc")),
220 theAdcFullScale(conf.getParameter<
int>(
"AdcFullScale")),
221 theAdcFullScLateCR(conf.getParameter<
int>(
"AdcFullScLateCR")),
225 theNoiseInElectrons(conf.getParameter<double>(
"NoiseInElectrons")),
229 theReadoutNoise(conf.getParameter<double>(
"ReadoutNoiseInElec")),
234 theThresholdInE_FPix(conf.getParameter<double>(
"ThresholdInElectrons_FPix")),
235 theThresholdInE_BPix(conf.getParameter<double>(
"ThresholdInElectrons_BPix")),
236 theThresholdInE_BPix_L1(conf.exists(
"ThresholdInElectrons_BPix_L1")
237 ? conf.getParameter<double>(
"ThresholdInElectrons_BPix_L1")
238 : theThresholdInE_BPix),
239 theThresholdInE_BPix_L2(conf.exists(
"ThresholdInElectrons_BPix_L2")
240 ? conf.getParameter<double>(
"ThresholdInElectrons_BPix_L2")
241 : theThresholdInE_BPix),
244 theThresholdSmearing_FPix(conf.getParameter<double>(
"ThresholdSmearing_FPix")),
245 theThresholdSmearing_BPix(conf.getParameter<double>(
"ThresholdSmearing_BPix")),
246 theThresholdSmearing_BPix_L1(conf.exists(
"ThresholdSmearing_BPix_L1")
247 ? conf.getParameter<double>(
"ThresholdSmearing_BPix_L1")
248 : theThresholdSmearing_BPix),
249 theThresholdSmearing_BPix_L2(conf.exists(
"ThresholdSmearing_BPix_L2")
250 ? conf.getParameter<double>(
"ThresholdSmearing_BPix_L2")
251 : theThresholdSmearing_BPix),
254 electronsPerVCAL(conf.getParameter<double>(
"ElectronsPerVcal")),
255 electronsPerVCAL_Offset(conf.getParameter<double>(
"ElectronsPerVcal_Offset")),
256 electronsPerVCAL_L1(conf.exists(
"ElectronsPerVcal_L1") ? conf.getParameter<double>(
"ElectronsPerVcal_L1")
258 electronsPerVCAL_L1_Offset(conf.exists(
"ElectronsPerVcal_L1_Offset")
259 ? conf.getParameter<double>(
"ElectronsPerVcal_L1_Offset")
260 : electronsPerVCAL_Offset),
264 theTofLowerCut(conf.getParameter<double>(
"TofLowerCut")),
265 theTofUpperCut(conf.getParameter<double>(
"TofUpperCut")),
268 tanLorentzAnglePerTesla_FPix(use_LorentzAngle_DB_ ? 0.0
269 : conf.getParameter<double>(
"TanLorentzAnglePerTesla_FPix")),
270 tanLorentzAnglePerTesla_BPix(use_LorentzAngle_DB_ ? 0.0
271 : conf.getParameter<double>(
"TanLorentzAnglePerTesla_BPix")),
274 FPix_p0(conf.getParameter<double>(
"FPix_SignalResponse_p0")),
275 FPix_p1(conf.getParameter<double>(
"FPix_SignalResponse_p1")),
276 FPix_p2(conf.getParameter<double>(
"FPix_SignalResponse_p2")),
277 FPix_p3(conf.getParameter<double>(
"FPix_SignalResponse_p3")),
279 BPix_p0(conf.getParameter<double>(
"BPix_SignalResponse_p0")),
280 BPix_p1(conf.getParameter<double>(
"BPix_SignalResponse_p1")),
281 BPix_p2(conf.getParameter<double>(
"BPix_SignalResponse_p2")),
282 BPix_p3(conf.getParameter<double>(
"BPix_SignalResponse_p3")),
285 addNoise(conf.getParameter<
bool>(
"AddNoise")),
289 addChargeVCALSmearing(conf.getParameter<
bool>(
"ChargeVCALSmearing")),
292 addNoisyPixels(conf.getParameter<
bool>(
"AddNoisyPixels")),
295 fluctuateCharge(conf.getUntrackedParameter<
bool>(
"FluctuateCharge",
true)),
302 addThresholdSmearing(conf.getParameter<
bool>(
"AddThresholdSmearing")),
305 doMissCalibrate(conf.getParameter<
bool>(
"MissCalibrate")),
306 doMissCalInLateCR(conf.getParameter<
bool>(
"MissCalInLateCR")),
307 theGainSmearing(conf.getParameter<double>(
"GainSmearing")),
308 theOffsetSmearing(conf.getParameter<double>(
"OffsetSmearing")),
311 AddPixelAging(conf.getParameter<
bool>(
"DoPixelAging")),
317 tMax(conf.getParameter<double>(
"deltaProductionCut")),
348 LogInfo(
"PixelDigitizer ") <<
"SiPixelDigitizerAlgorithm constructed" 349 <<
"Configuration parameters:" 350 <<
"Threshold/Gain = " 358 LogInfo(
"PixelDigitizer ") <<
" SiPixelDigitizerAlgorithm constructed with UseReweighting " <<
UseReweighting 365 std::map<int, SiPixelDigitizerAlgorithm::CalParameters, std::less<int> >
calmap;
367 LogDebug(
"PixelDigitizer ") <<
" miss-calibrate the pixel amplitude \n";
369 const bool ReadCalParameters =
false;
370 if (ReadCalParameters) {
373 char filename[80] =
"phCalibrationFit_C0.dat";
377 LogInfo(
"PixelDigitizer ") <<
" File not found \n ";
383 for (
int i = 0;
i < 3;
i++) {
388 LogInfo(
"PixelDigitizer ") <<
" test map" 395 for (
int i = 0;
i < (52 * 80);
i++) {
398 LogError(
"PixelDigitizer") <<
"Cannot read data file for calmap" 404 <<
" " <<
in_file.good() <<
" end of file " 410 << colid <<
" " << rowid <<
"\n";
420 calmap.insert(std::pair<int, CalParameters>(
chan, onePix));
424 if (rowid !=
p.first)
425 LogInfo(
"PixelDigitizer ") <<
" wrong channel row " << rowid <<
" " <<
p.first <<
"\n";
426 if (colid !=
p.second)
427 LogInfo(
"PixelDigitizer ") <<
" wrong channel col " << colid <<
" " <<
p.second <<
"\n";
431 LogInfo(
"PixelDigitizer ") <<
" map size " <<
calmap.size() <<
" max " <<
calmap.max_size() <<
" " 432 <<
calmap.empty() <<
"\n";
455 LogDebug(
"PixelDigitizer") <<
"SiPixelDigitizerAlgorithm deleted";
461 int NumberOfBarrelLayers,
469 conf.
exists(
"thePixelColEfficiency_BPix3") && conf.
exists(
"thePixelColEfficiency_FPix1") &&
470 conf.
exists(
"thePixelColEfficiency_FPix2") && conf.
exists(
"thePixelEfficiency_BPix1") &&
471 conf.
exists(
"thePixelEfficiency_BPix2") && conf.
exists(
"thePixelEfficiency_BPix3") &&
472 conf.
exists(
"thePixelEfficiency_FPix1") && conf.
exists(
"thePixelEfficiency_FPix2") &&
473 conf.
exists(
"thePixelChipEfficiency_BPix1") && conf.
exists(
"thePixelChipEfficiency_BPix2") &&
474 conf.
exists(
"thePixelChipEfficiency_BPix3") && conf.
exists(
"thePixelChipEfficiency_FPix1") &&
475 conf.
exists(
"thePixelChipEfficiency_FPix2");
478 conf.
exists(
"theLadderEfficiency_BPix3") && conf.
exists(
"theModuleEfficiency_BPix1") &&
479 conf.
exists(
"theModuleEfficiency_BPix2") && conf.
exists(
"theModuleEfficiency_BPix3") &&
480 conf.
exists(
"thePUEfficiency_BPix1") && conf.
exists(
"thePUEfficiency_BPix2") &&
481 conf.
exists(
"thePUEfficiency_BPix3") && conf.
exists(
"theInnerEfficiency_FPix1") &&
482 conf.
exists(
"theInnerEfficiency_FPix2") && conf.
exists(
"theOuterEfficiency_FPix1") &&
483 conf.
exists(
"theOuterEfficiency_FPix2") && conf.
exists(
"thePUEfficiency_FPix_Inner") &&
484 conf.
exists(
"thePUEfficiency_FPix_Outer") && conf.
exists(
"theInstLumiScaleFactor");
487 conf.
exists(
"thePixelEfficiency_BPix4") && conf.
exists(
"thePixelChipEfficiency_BPix4");
490 conf.
exists(
"thePixelEfficiency_FPix3") && conf.
exists(
"thePixelChipEfficiency_FPix3");
492 LogInfo(
"PixelDigitizer ") <<
"The PixelDigitizer inefficiency configuration is read from the config file.\n";
526 throw cms::Exception(
"Configuration") <<
"Wrong ladder number in efficiency config!";
535 throw cms::Exception(
"Configuration") <<
"Wrong module number in efficiency config!";
543 <<
"At least one PU efficiency (BPix) number is needed in efficiency config!";
547 if (NumberOfTotLayers > 20) {
548 throw cms::Exception(
"Configuration") <<
"SiPixelDigitizer was given more layers than it can handle";
578 if (NumberOfTotLayers > 20) {
579 throw cms::Exception(
"Configuration") <<
"SiPixelDigitizer was given more layers than it can handle";
600 <<
"At least one (FPix) PU efficiency number is needed in efficiency config!";
604 LogInfo(
"PixelDigitizer ") <<
"The PixelDigitizer inefficiency configuration is read from the database.\n";
630 for (
const auto& it_module :
geom->detUnits()) {
631 if (dynamic_cast<PixelGeomDetUnit const*>(it_module) ==
nullptr)
633 const DetId detid = it_module->geographicalId();
634 uint32_t rawid = detid.
rawId();
635 PixelGeomFactors[rawid] = 1;
636 ColGeomFactors[rawid] = 1;
637 ChipGeomFactors[rawid] = 1;
638 PixelGeomFactorsROCStdPixels[rawid] = std::vector<double>(16, 1);
639 PixelGeomFactorsROCBigPixels[rawid] = std::vector<double>(16, 1);
643 std::map<uint32_t, double> PixelGeomFactorsDB;
645 LogDebug(
"PixelDigitizer ") <<
" Check PixelEfficiencies -- PixelGeomFactorsDBIn " 648 for (
auto db_factor : PixelGeomFactorsDBIn) {
649 LogDebug(
"PixelDigitizer ") <<
" db_factor " << db_factor.first <<
" " << db_factor.second <<
"\n";
653 unsigned int rocMask = rocIdMaskBits <<
shift;
654 unsigned int rocId = (((db_factor.first) & rocMask) >>
shift);
657 unsigned int rawid = db_factor.first & (~rocMask);
661 const int nBigPixelsInROC = 2 *
topology->rowsperroc() +
topology->colsperroc() - 2;
662 double factor = db_factor.second;
663 double badFraction = 1 -
factor;
664 double bigPixelFraction =
static_cast<double>(nBigPixelsInROC) / nPixelsInROC;
665 double stdPixelFraction = 1. - bigPixelFraction;
667 double badFractionBig =
std::min(bigPixelFraction, badFraction);
668 double badFractionStd =
std::max(0., badFraction - badFractionBig);
669 double badFractionBigReNormalized = badFractionBig / bigPixelFraction;
670 double badFractionStdReNormalized = badFractionStd / stdPixelFraction;
671 PixelGeomFactorsROCStdPixels[rawid][rocId] *= (1. - badFractionStdReNormalized);
672 PixelGeomFactorsROCBigPixels[rawid][rocId] *= (1. - badFractionBigReNormalized);
674 PixelGeomFactorsDB[db_factor.first] = db_factor.second;
679 PixelGeomFactorsDB = PixelGeomFactorsDBIn;
683 <<
" Check PixelEfficiencies -- Loop on all modules and store module level geometrical scale factors " 686 for (
const auto& it_module :
geom->detUnits()) {
687 if (dynamic_cast<PixelGeomDetUnit const*>(it_module) ==
nullptr)
689 const DetId detid = it_module->geographicalId();
690 uint32_t rawid = detid.
rawId();
691 for (
auto db_factor : PixelGeomFactorsDB) {
692 LogDebug(
"PixelDigitizer ") <<
" db_factor PixelGeomFactorsDB " << db_factor.first <<
" " 693 << db_factor.second <<
"\n";
695 PixelGeomFactors[rawid] *= db_factor.second;
697 for (
auto db_factor : ColGeomFactorsDB) {
698 LogDebug(
"PixelDigitizer ") <<
" db_factor ColGeomFactorsDB " << db_factor.first <<
" " << db_factor.second
701 ColGeomFactors[rawid] *= db_factor.second;
703 for (
auto db_factor : ChipGeomFactorsDB) {
704 LogDebug(
"PixelDigitizer ") <<
" db_factor ChipGeomFactorsDB " << db_factor.first <<
" " 705 << db_factor.second <<
"\n";
707 ChipGeomFactors[rawid] *= db_factor.second;
714 LogDebug(
"PixelDigitizer ") <<
" Check PixelEfficiencies -- PUFactors " 716 for (
const auto&
factor : PUFactors) {
718 LogDebug(
"PixelDigitizer ") <<
" factor " <<
factor.first <<
" " <<
factor.second.size() <<
"\n";
719 for (
size_t i = 0,
n =
factor.second.size();
i <
n;
i++) {
720 LogDebug(
"PixelDigitizer ") <<
" print factor.second for " <<
i <<
" " <<
factor.second[
i] <<
"\n";
724 for (
const auto& it_module :
geom->detUnits()) {
725 if (dynamic_cast<PixelGeomDetUnit const*>(it_module) ==
nullptr)
727 const DetId detid = it_module->geographicalId();
728 if (!
matches(detid, db_id, DetIdmasks))
730 if (iPU.count(detid.
rawId())) {
732 <<
"Multiple db_ids match to same module in SiPixelDynamicInefficiency DB Object";
737 thePUEfficiency.push_back(
factor.second);
740 pu_scale.resize(thePUEfficiency.size());
745 const std::vector<uint32_t>& DetIdmasks) {
748 for (
size_t i = 0;
i < DetIdmasks.size(); ++
i) {
770 thePixelPseudoRadDamage[
i++] = conf.
getParameter<
double>(
"thePixelPseudoRadDamage_BPix1");
771 thePixelPseudoRadDamage[
i++] = conf.
getParameter<
double>(
"thePixelPseudoRadDamage_BPix2");
772 thePixelPseudoRadDamage[
i++] = conf.
getParameter<
double>(
"thePixelPseudoRadDamage_BPix3");
773 thePixelPseudoRadDamage[
i++] = conf.
getParameter<
double>(
"thePixelPseudoRadDamage_BPix4");
777 if (NumberOfTotLayers > 20) {
778 throw cms::Exception(
"Configuration") <<
"SiPixelDigitizer was given more layers than it can handle";
782 thePixelPseudoRadDamage[
j - 1] = 0.;
787 thePixelPseudoRadDamage[
i++] = conf.
getParameter<
double>(
"thePixelPseudoRadDamage_FPix1");
788 thePixelPseudoRadDamage[
i++] = conf.
getParameter<
double>(
"thePixelPseudoRadDamage_FPix2");
789 thePixelPseudoRadDamage[
i++] = conf.
getParameter<
double>(
"thePixelPseudoRadDamage_FPix3");
793 if (NumberOfTotLayers > 20) {
794 throw cms::Exception(
"Configuration") <<
"SiPixelDigitizer was given more layers than it can handle";
798 thePixelPseudoRadDamage[
j - 1] = 0.;
808 std::vector<PSimHit>::const_iterator inputEnd,
809 const size_t inputBeginGlobalIndex,
810 const unsigned int tofBin,
814 CLHEP::HepRandomEngine* engine) {
819 size_t simHitGlobalIndex = inputBeginGlobalIndex;
820 for (std::vector<PSimHit>::const_iterator ssbegin = inputBegin; ssbegin != inputEnd; ++ssbegin, ++simHitGlobalIndex) {
822 if ((*ssbegin).detUnitId() !=
detId) {
827 LogDebug(
"Pixel Digitizer") << (*ssbegin).particleType() <<
" " << (*ssbegin).pabs() <<
" " 828 << (*ssbegin).energyLoss() <<
" " << (*ssbegin).tof() <<
" " << (*ssbegin).trackId()
829 <<
" " << (*ssbegin).processType() <<
" " << (*ssbegin).detUnitId()
830 << (*ssbegin).entryPoint() <<
" " << (*ssbegin).exitPoint();
833 std::vector<EnergyDepositUnit> ionization_points;
834 std::vector<SignalPoint> collection_points;
852 inputBeginGlobalIndex,
870 std::vector<int>::const_iterator
pu;
871 std::vector<int>::const_iterator pu0 = bunchCrossing.end();
873 for (
pu = bunchCrossing.begin();
pu != bunchCrossing.end(); ++
pu) {
880 if (pu0 != bunchCrossing.end()) {
883 double instlumi_pow = 1.;
887 instlumi_pow *= instlumi;
901 for (
unsigned int i = 0;
i < ps.size();
i++)
902 if (ps[
i].getBunchCrossing() == 0)
908 double instlumi_pow = 1.;
912 instlumi_pow *= instlumi;
927 const std::vector<PileupSummaryInfo>& ps, CLHEP::HepRandomEngine* engine) {
928 std::unique_ptr<PixelFEDChannelCollection> PixelFEDChannelCollection_ =
nullptr;
931 std::vector<int> bunchCrossing;
932 std::vector<float> TrueInteractionList;
934 for (
unsigned int i = 0;
i < ps.size();
i++) {
935 bunchCrossing.push_back(ps[
i].getBunchCrossing());
936 TrueInteractionList.push_back(ps[
i].getTrueNumInteractions());
940 std::vector<int>::const_iterator
pu;
941 std::vector<int>::const_iterator pu0 = bunchCrossing.end();
943 for (
pu = bunchCrossing.begin();
pu != bunchCrossing.end(); ++
pu) {
951 if (pu0 != bunchCrossing.end()) {
952 unsigned int PUBin = TrueInteractionList.at(
p);
954 std::vector<double> probabilities;
955 probabilities.reserve(theProbabilitiesPerScenario.size());
956 for (
auto it = theProbabilitiesPerScenario.begin();
it != theProbabilitiesPerScenario.end();
it++) {
957 probabilities.push_back(
it->second);
960 CLHEP::RandGeneral randGeneral(*engine, &(probabilities.front()), probabilities.size());
961 double x = randGeneral.shoot();
962 unsigned int index =
x * probabilities.size() - 1;
965 PixelFEDChannelCollection_ = std::make_unique<PixelFEDChannelCollection>(
quality_map->at(
scenario));
970 return PixelFEDChannelCollection_;
974 CLHEP::HepRandomEngine* engine) {
977 std::unique_ptr<PixelFEDChannelCollection> PixelFEDChannelCollection_ =
nullptr;
984 std::vector<int>::const_iterator
pu;
985 std::vector<int>::const_iterator pu0 = bunchCrossing.end();
987 for (
pu = bunchCrossing.begin();
pu != bunchCrossing.end(); ++
pu) {
995 if (pu0 != bunchCrossing.end()) {
996 unsigned int PUBin = TrueInteractionList.at(
p);
998 std::vector<double> probabilities;
999 probabilities.reserve(theProbabilitiesPerScenario.size());
1000 for (
auto it = theProbabilitiesPerScenario.begin();
it != theProbabilitiesPerScenario.end();
it++) {
1001 probabilities.push_back(
it->second);
1004 CLHEP::RandGeneral randGeneral(*engine, &(probabilities.front()), probabilities.size());
1005 double x = randGeneral.shoot();
1006 unsigned int index =
x * probabilities.size() - 1;
1009 PixelFEDChannelCollection_ = std::make_unique<PixelFEDChannelCollection>(
quality_map->at(
scenario));
1014 return PixelFEDChannelCollection_;
1019 for (
const auto& det : signalMap) {
1020 auto& theSignal =
_signal[det.first];
1021 for (
const auto&
chan : det.second) {
1022 theSignal[
chan.first].set(
chan.second *
1030 std::vector<PixelDigi>& digis,
1031 std::vector<PixelDigiSimLink>& simlinks,
1032 std::vector<PixelDigiAddTempInfo>& newClass_Digi_extra,
1034 CLHEP::HepRandomEngine* engine) {
1046 float thePixelThresholdInE = 0.;
1050 int lay = tTopo->
layer(detID);
1055 thePixelThresholdInE = CLHEP::RandGaussQ::shoot(
1057 }
else if (lay == 2) {
1058 thePixelThresholdInE = CLHEP::RandGaussQ::shoot(
1061 thePixelThresholdInE =
1070 }
else if (lay == 2) {
1079 thePixelThresholdInE =
1085 throw cms::Exception(
"NotAPixelGeomDetUnit") <<
"Not a pixel geomdet unit" << detID;
1091 int numColumns = topol->
ncolumns();
1092 int numRows = topol->
nrows();
1095 LogDebug(
"PixelDigitizer") <<
" PixelDigitizer " << numColumns <<
" " << numRows <<
" " << moduleThickness;
1117 make_digis(thePixelThresholdInE, detID, pixdet, digis, simlinks, newClass_Digi_extra, tTopo);
1120 LogDebug(
"PixelDigitizer") <<
"[SiPixelDigitizerAlgorithm] converted " << digis.size() <<
" PixelDigis in DetUnit" 1129 std::vector<EnergyDepositUnit>& ionization_points,
1130 CLHEP::HepRandomEngine* engine)
const {
1133 const float SegmentLength = 0.0010;
1140 float length = direction.
mag();
1142 int NumberOfSegments =
int(length / SegmentLength);
1143 if (NumberOfSegments < 1)
1144 NumberOfSegments = 1;
1147 LogDebug(
"Pixel Digitizer") <<
" enter primary_ionzation " << NumberOfSegments
1148 <<
" shift = " << (
hit.exitPoint().
x() -
hit.entryPoint().
x()) <<
" " 1149 << (
hit.exitPoint().
y() -
hit.entryPoint().
y()) <<
" " 1150 << (
hit.exitPoint().
z() -
hit.entryPoint().
z()) <<
" " <<
hit.particleType() <<
" " 1154 float* elossVector =
new float[NumberOfSegments];
1158 int pid =
hit.particleType();
1161 float momentum =
hit.pabs();
1166 ionization_points.resize(NumberOfSegments);
1169 for (
int i = 0;
i != NumberOfSegments;
i++) {
1179 ionization_points[
i] = edu;
1182 LogDebug(
"Pixel Digitizer") <<
i <<
" " << ionization_points[
i].x() <<
" " << ionization_points[
i].y() <<
" " 1183 << ionization_points[
i].z() <<
" " << ionization_points[
i].energy();
1188 delete[] elossVector;
1195 float particleMomentum,
1199 float elossVector[],
1200 CLHEP::HepRandomEngine* engine)
const {
1206 double particleMass = 139.6;
1210 particleMass = 0.511;
1212 particleMass = 105.7;
1213 else if (pid == 321)
1214 particleMass = 493.7;
1215 else if (pid == 2212)
1216 particleMass = 938.3;
1219 float segmentLength = length / NumberOfSegs;
1224 double segmentEloss = (1000. * eloss) / NumberOfSegs;
1225 for (
int i = 0;
i < NumberOfSegs;
i++) {
1231 double deltaCutoff =
tMax;
1232 de =
fluctuate->SampleFluctuations(
double(particleMomentum * 1000.),
1235 double(segmentLength * 10.),
1239 elossVector[
i] = de;
1245 float ratio = eloss / sum;
1247 for (
int ii = 0;
ii < NumberOfSegs;
ii++)
1248 elossVector[
ii] = ratio * elossVector[
ii];
1250 float averageEloss = eloss / NumberOfSegs;
1251 for (
int ii = 0;
ii < NumberOfSegs;
ii++)
1252 elossVector[
ii] = averageEloss;
1264 const std::vector<EnergyDepositUnit>& ionization_points,
1265 std::vector<SignalPoint>& collection_points)
const {
1267 LogDebug(
"Pixel Digitizer") <<
" enter drift ";
1270 collection_points.resize(ionization_points.size());
1273 if (driftDir.
z() == 0.) {
1274 LogWarning(
"Magnetic field") <<
" pxlx: drift in z is zero ";
1282 float TanLorenzAngleX, TanLorenzAngleY, dir_z, CosLorenzAngleX, CosLorenzAngleY;
1284 TanLorenzAngleX = driftDir.
x();
1285 TanLorenzAngleY = driftDir.
y();
1286 dir_z = driftDir.
z();
1287 CosLorenzAngleX = 1. /
sqrt(1. + TanLorenzAngleX * TanLorenzAngleX);
1288 CosLorenzAngleY = 1. /
sqrt(1. + TanLorenzAngleY * TanLorenzAngleY);
1291 TanLorenzAngleX = driftDir.
x();
1292 TanLorenzAngleY = 0.;
1293 dir_z = driftDir.
z();
1294 CosLorenzAngleX = 1. /
sqrt(1. + TanLorenzAngleX * TanLorenzAngleX);
1295 CosLorenzAngleY = 1.;
1300 LogDebug(
"Pixel Digitizer") <<
" Lorentz Tan " << TanLorenzAngleX <<
" " << TanLorenzAngleY <<
" " << CosLorenzAngleX
1301 <<
" " << CosLorenzAngleY <<
" " << moduleThickness * TanLorenzAngleX <<
" " << driftDir;
1306 float DriftDistance;
1310 for (
unsigned int i = 0;
i != ionization_points.size();
i++) {
1311 float SegX, SegY, SegZ;
1312 SegX = ionization_points[
i].
x();
1313 SegY = ionization_points[
i].y();
1314 SegZ = ionization_points[
i].z();
1319 DriftDistance = moduleThickness / 2. - (dir_z * SegZ);
1321 if (DriftDistance <= 0.)
1322 LogDebug(
"PixelDigitizer ") <<
" <=0 " << DriftDistance <<
" " <<
i <<
" " << SegZ <<
" " << dir_z <<
" " << SegX
1323 <<
" " << SegY <<
" " << (moduleThickness / 2) <<
" " << ionization_points[
i].
energy()
1324 <<
" " <<
hit.particleType() <<
" " <<
hit.pabs() <<
" " <<
hit.energyLoss() <<
" " 1325 <<
hit.entryPoint() <<
" " <<
hit.exitPoint() <<
"\n";
1327 if (DriftDistance < 0.) {
1329 }
else if (DriftDistance > moduleThickness)
1330 DriftDistance = moduleThickness;
1333 float XDriftDueToMagField = DriftDistance * TanLorenzAngleX;
1334 float YDriftDueToMagField = DriftDistance * TanLorenzAngleY;
1337 float CloudCenterX = SegX + XDriftDueToMagField;
1338 float CloudCenterY = SegY + YDriftDueToMagField;
1341 DriftLength =
sqrt(DriftDistance * DriftDistance + XDriftDueToMagField * XDriftDueToMagField +
1342 YDriftDueToMagField * YDriftDueToMagField);
1348 Sigma_x = Sigma / CosLorenzAngleX;
1349 Sigma_y = Sigma / CosLorenzAngleY;
1352 float energyOnCollector = ionization_points[
i].energy();
1357 energyOnCollector *=
exp(-1 * kValue * DriftDistance / moduleThickness);
1361 LogDebug(
"Pixel Digitizer") <<
" Dift DistanceZ= " << DriftDistance <<
" module thickness= " << moduleThickness
1362 <<
" Start Energy= " << ionization_points[
i].energy()
1363 <<
" Energy after loss= " << energyOnCollector;
1365 SignalPoint sp(CloudCenterX, CloudCenterY, Sigma_x, Sigma_y,
hit.tof(), energyOnCollector);
1368 collection_points[
i] = (sp);
1377 std::vector<PSimHit>::const_iterator inputEnd,
1379 const size_t hitIndex,
1380 const size_t FirstHitIndex,
1381 const unsigned int tofBin,
1383 const std::vector<SignalPoint>& collection_points) {
1392 LogDebug(
"Pixel Digitizer") <<
" enter induce_signal, " << topol->
pitch().first <<
" " << topol->
pitch().second;
1396 typedef std::map<int, float, std::less<int> > hit_map_type;
1397 hit_map_type hit_signal;
1400 std::map<int, float, std::less<int> >
x,
y;
1405 for (std::vector<SignalPoint>::const_iterator
i = collection_points.begin();
i != collection_points.end(); ++
i) {
1406 float CloudCenterX =
i->position().x();
1407 float CloudCenterY =
i->position().y();
1410 float Charge =
i->amplitude();
1414 <<
i->position().y() <<
" " <<
i->sigma_x() <<
" " <<
i->sigma_y() <<
" " 1415 <<
i->amplitude() <<
"\n";
1419 LogDebug(
"Pixel Digitizer") <<
" cloud " <<
i->position().x() <<
" " <<
i->position().y() <<
" " <<
i->sigma_x()
1420 <<
" " <<
i->sigma_y() <<
" " <<
i->amplitude();
1443 int IPixRightUpX =
int(floor(mp.
x()));
1444 int IPixRightUpY =
int(floor(mp.
y()));
1447 LogDebug(
"Pixel Digitizer") <<
" right-up " << PointRightUp <<
" " << mp.
x() <<
" " << mp.
y() <<
" " << IPixRightUpX
1448 <<
" " << IPixRightUpY;
1453 int IPixLeftDownX =
int(floor(mp.
x()));
1454 int IPixLeftDownY =
int(floor(mp.
y()));
1457 LogDebug(
"Pixel Digitizer") <<
" left-down " << PointLeftDown <<
" " << mp.
x() <<
" " << mp.
y() <<
" " 1458 << IPixLeftDownX <<
" " << IPixLeftDownY;
1462 int numColumns = topol->
ncolumns();
1463 int numRows = topol->
nrows();
1465 IPixRightUpX = numRows > IPixRightUpX ? IPixRightUpX : numRows - 1;
1466 IPixRightUpY = numColumns > IPixRightUpY ? IPixRightUpY : numColumns - 1;
1467 IPixLeftDownX = 0 < IPixLeftDownX ? IPixLeftDownX : 0;
1468 IPixLeftDownY = 0 < IPixLeftDownY ? IPixLeftDownY : 0;
1475 for (
ix = IPixLeftDownX;
ix <= IPixRightUpX;
ix++) {
1476 float xUB, xLB, UpperBound, LowerBound;
1486 LowerBound = 1 -
calcQ((xLB - CloudCenterX) /
SigmaX);
1489 if (
ix == numRows - 1 ||
SigmaX == 0.)
1494 UpperBound = 1. -
calcQ((xUB - CloudCenterX) /
SigmaX);
1497 float TotalIntegrationRange = UpperBound - LowerBound;
1498 x[
ix] = TotalIntegrationRange;
1500 LogDebug(
"Pixel Digitizer") << TotalIntegrationRange <<
" " <<
ix <<
"\n";
1505 for (
iy = IPixLeftDownY;
iy <= IPixRightUpY;
iy++) {
1506 float yUB, yLB, UpperBound, LowerBound;
1513 LowerBound = 1. -
calcQ((yLB - CloudCenterY) /
SigmaY);
1516 if (
iy == numColumns - 1 ||
SigmaY == 0.)
1521 UpperBound = 1. -
calcQ((yUB - CloudCenterY) /
SigmaY);
1524 float TotalIntegrationRange = UpperBound - LowerBound;
1525 y[
iy] = TotalIntegrationRange;
1527 LogDebug(
"Pixel Digitizer") << TotalIntegrationRange <<
" " <<
iy <<
"\n";
1532 for (
ix = IPixLeftDownX;
ix <= IPixRightUpX;
ix++) {
1533 for (
iy = IPixLeftDownY;
iy <= IPixRightUpY;
iy++) {
1537 if (ChargeFraction > 0.) {
1540 hit_signal[
chan] += ChargeFraction;
1547 LogDebug(
"Pixel Digitizer") <<
" pixel " <<
ix <<
" " <<
iy <<
" - " 1548 <<
" " <<
chan <<
" " << ChargeFraction <<
" " << mp.
x() <<
" " << mp.
y() <<
" " 1549 << lp.
x() <<
" " << lp.
y() <<
" " 1560 bool reweighted =
false;
1563 size_t ReferenceIndex4CR = 0;
1565 if (
hit.processType() == 0) {
1566 ReferenceIndex4CR = hitIndex;
1568 hit, hit_signal, hitIndex, ReferenceIndex4CR, tofBin, topol, detID, theSignal,
hit.processType(), makeDSLinks);
1570 std::vector<PSimHit>::const_iterator crSimHit = inputBegin;
1571 ReferenceIndex4CR = FirstHitIndex;
1573 if ((*inputBegin).trackId() !=
hit.trackId()) {
1576 size_t localIndex = FirstHitIndex;
1577 for (std::vector<PSimHit>::const_iterator ssbegin = inputBegin; localIndex < hitIndex;
1578 ++ssbegin, ++localIndex) {
1579 if ((*ssbegin).detUnitId() !=
detId) {
1582 if ((*ssbegin).trackId() ==
hit.trackId() && (*ssbegin).processType() == 0) {
1584 ReferenceIndex4CR = localIndex;
1604 for (hit_map_type::const_iterator im = hit_signal.begin(); im != hit_signal.end(); ++im) {
1605 int chan = (*im).first;
1606 if (ReferenceIndex4CR == 0) {
1609 if (
hit.processType() == 0)
1610 ReferenceIndex4CR = hitIndex;
1612 ReferenceIndex4CR = FirstHitIndex;
1614 if ((*inputBegin).trackId() !=
hit.trackId()) {
1617 size_t localIndex = FirstHitIndex;
1618 for (std::vector<PSimHit>::const_iterator ssbegin = inputBegin; localIndex < hitIndex;
1619 ++ssbegin, ++localIndex) {
1620 if ((*ssbegin).detUnitId() !=
detId) {
1623 if ((*ssbegin).trackId() ==
hit.trackId() && (*ssbegin).processType() == 0) {
1624 ReferenceIndex4CR = localIndex;
1632 (*im).second, &
hit, hitIndex, ReferenceIndex4CR, tofBin, (*im).second)
1637 LogDebug(
"Pixel Digitizer") <<
" pixel " << ip.first <<
" " << ip.second <<
" " << theSignal[
chan];
1649 for (std::vector<PSimHit>::const_iterator
it =
simHits.begin(), itEnd =
simHits.end();
it != itEnd;
1651 unsigned int detID = (*it).detUnitId();
1666 std::vector<PixelDigi>& digis,
1667 std::vector<PixelDigiSimLink>& simlinks,
1668 std::vector<PixelDigiAddTempInfo>& newClass_Digi_extra,
1671 LogDebug(
"Pixel Digitizer") <<
" make digis " 1677 <<
" List pixels passing threshold ";
1682 signalMaps::const_iterator
it =
_signal.find(detID);
1691 std::map<TrackEventId, float> simi;
1694 float signalInElectrons = (*i).second;
1701 if (signalInElectrons >= thePixelThresholdInE &&
1702 signalInElectrons > 0.) {
1704 int chan = (*i).first;
1711 int col = ip.second;
1718 LogDebug(
"Pixel Digitizer") << (*i).first <<
" " << (*i).second <<
" " << signalInElectrons <<
" " <<
adc 1719 << ip.first <<
" " << ip.second;
1723 digis.emplace_back(ip.first, ip.second,
adc);
1727 unsigned int il = 0;
1728 for (
const auto&
info : (*i).second.hitInfos()) {
1731 simi[std::make_pair(
info.trackId(),
info.eventId().rawId())] += (*i).second.individualampl()[il];
1736 for (
const auto&
info : (*i).second.hitInfos()) {
1738 auto found = simi.find(std::make_pair(
info.trackId(),
info.eventId().rawId()));
1739 if (
found == simi.end())
1742 float sum_samechannel =
found->second;
1743 float fraction = sum_samechannel / (*i).second;
1756 for (
const auto&
info : (*i).second.hitInfos()) {
1757 unsigned int CFPostoBeUsed =
info.hitIndex4ChargeRew();
1760 std::vector<PixelDigiAddTempInfo>::iterator loopNewClass;
1761 bool already_present =
false;
1762 for (loopNewClass = newClass_Digi_extra.begin(); loopNewClass != newClass_Digi_extra.end(); ++loopNewClass) {
1763 if (
chan == (
int)loopNewClass->channel() && CFPostoBeUsed == loopNewClass->hitIndex()) {
1764 already_present =
true;
1765 loopNewClass->addCharge(
info.getAmpl());
1768 if (!already_present) {
1769 unsigned int tofBin =
info.tofBin();
1777 const PSimHit& theSimHit = (it2->second)[CFPostoBeUsed];
1778 newClass_Digi_extra.emplace_back(
chan,
1779 info.hitIndex4ChargeRew(),
1799 float thePixelThreshold,
1800 CLHEP::HepRandomEngine* engine) {
1809 float theSmearedChargeRMS = 0.0;
1813 if ((*i).second < 3000) {
1814 theSmearedChargeRMS = 543.6 - (*i).second * 0.093;
1815 }
else if ((*i).second < 6000) {
1816 theSmearedChargeRMS = 307.6 - (*i).second * 0.01;
1818 theSmearedChargeRMS = -432.4 + (*i).second * 0.123;
1822 float noise_ChargeVCALSmearing = theSmearedChargeRMS * CLHEP::RandGaussQ::shoot(engine, 0., 1.);
1850 int numColumns = topol->
ncolumns();
1851 int numRows = topol->
nrows();
1855 int numberOfPixels = (numRows * numColumns);
1856 std::map<int, float, std::less<int> > otherPixels;
1857 std::map<int, float, std::less<int> >::iterator mapI;
1868 << otherPixels.size();
1872 for (mapI = otherPixels.begin(); mapI != otherPixels.end(); mapI++) {
1873 int iy = ((*mapI).first) / numRows;
1874 int ix = ((*mapI).first) - (
iy * numRows);
1877 if (iy < 0 || iy > (numColumns - 1))
1879 if (ix < 0 || ix > (numRows - 1))
1885 LogDebug(
"Pixel Digitizer") <<
" Storing noise = " << (*mapI).first <<
" " << (*mapI).second <<
" " <<
ix <<
" " 1889 if (theSignal[
chan] == 0) {
1904 CLHEP::HepRandomEngine* engine) {
1908 int numColumns = topol->
ncolumns();
1909 int numRows = topol->
nrows();
1913 double pixelEfficiency = 1.0;
1914 double columnEfficiency = 1.0;
1915 double chipEfficiency = 1.0;
1916 std::vector<double> pixelEfficiencyROCStdPixels(16, 1);
1917 std::vector<double> pixelEfficiencyROCBigPixels(16, 1);
1919 auto pIndexConverter =
PixelIndices(numColumns, numRows);
1921 std::vector<int> badRocsFromFEDChannels(16, 0);
1927 for (
const auto& ch : *
it) {
1928 for (
unsigned int i_roc = ch.roc_first; i_roc <= ch.roc_last; ++i_roc) {
1929 for (
const auto p :
path) {
1931 if (myroc->
idInDetUnit() ==
static_cast<unsigned int>(i_roc)) {
1934 int chipIndex(0), colROC(0), rowROC(0);
1935 pIndexConverter.transformToROC(global.
col, global.
row, chipIndex, colROC, rowROC);
1936 badRocsFromFEDChannels.at(chipIndex) = 1;
1948 int layerIndex = tTopo->
layer(detID);
1952 LogDebug(
"Pixel Digitizer") <<
"Using BPix columnEfficiency = " << columnEfficiency
1953 <<
" for layer = " << layerIndex <<
"\n";
1956 if (numColumns > 416)
1957 LogWarning(
"Pixel Geometry") <<
" wrong columns in barrel " << numColumns;
1959 LogWarning(
"Pixel Geometry") <<
" wrong rows in barrel " << numRows;
1975 unsigned int diskIndex =
1977 unsigned int panelIndex = tTopo->
pxfPanel(detID);
1978 unsigned int moduleIndex = tTopo->
pxfModule(detID);
1984 LogDebug(
"Pixel Digitizer") <<
"Using FPix columnEfficiency = " << columnEfficiency
1985 <<
" for Disk = " << tTopo->
pxfDisk(detID) <<
"\n";
1990 if (numColumns > 260 || numRows > 160) {
1991 if (numColumns > 260)
1992 LogWarning(
"Pixel Geometry") <<
" wrong columns in endcaps " << numColumns;
1994 LogWarning(
"Pixel Geometry") <<
" wrong rows in endcaps " << numRows;
1997 if ((panelIndex == 1 && (moduleIndex == 1 || moduleIndex == 2)) ||
1998 (panelIndex == 2 && moduleIndex == 1)) {
2007 pixelEfficiency = 0.999;
2008 columnEfficiency = 0.999;
2009 chipEfficiency = 0.999;
2024 LogDebug(
"Pixel Digitizer") <<
" enter pixel_inefficiency " << pixelEfficiency <<
" " << columnEfficiency <<
" " 2034 std::map<int, int, std::less<int> > chips,
columns, pixelStd, pixelBig;
2035 std::map<int, int, std::less<int> >::iterator iter;
2040 int chan =
i->first;
2043 int col = ip.second;
2045 pIndexConverter.transformToROC(
col, row, chipIndex, colROC, rowROC);
2046 int dColInChip = pIndexConverter.DColumn(colROC);
2048 int dColInDet = pIndexConverter.DColumnInModule(dColInChip, chipIndex);
2054 pixelBig[chipIndex]++;
2056 pixelStd[chipIndex]++;
2061 for (iter = chips.begin(); iter != chips.end(); iter++) {
2063 float rand = CLHEP::RandFlat::shoot(engine);
2064 if (rand > chipEfficiency)
2065 chips[iter->first] = 0;
2071 float rand = CLHEP::RandFlat::shoot(engine);
2072 if (rand > columnEfficiency)
2078 for (iter = pixelStd.begin(); iter != pixelStd.end(); iter++) {
2079 float rand = CLHEP::RandFlat::shoot(engine);
2080 if (rand > pixelEfficiencyROCStdPixels[iter->first])
2081 pixelStd[iter->first] = 0;
2084 for (iter = pixelBig.begin(); iter != pixelBig.end(); iter++) {
2085 float rand = CLHEP::RandFlat::shoot(engine);
2086 if (rand > pixelEfficiencyROCBigPixels[iter->first])
2087 pixelBig[iter->first] = 0;
2097 int col = ip.second;
2099 pIndexConverter.transformToROC(
col, row, chipIndex, colROC, rowROC);
2100 int dColInChip = pIndexConverter.DColumn(colROC);
2102 int dColInDet = pIndexConverter.DColumnInModule(dColInChip, chipIndex);
2105 float rand = CLHEP::RandFlat::shoot(engine);
2106 if (chips[chipIndex] == 0 ||
columns[dColInDet] == 0 || rand > pixelEfficiency ||
2107 (pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) ||
2108 (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0)) {
2113 if ((pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) ||
2114 (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0) || (badRocsFromFEDChannels.at(chipIndex) == 1)) {
2136 float pseudoRadDamage = 0.0f;
2141 int layerIndex = tTopo->
layer(detID);
2143 pseudoRadDamage =
aging.thePixelPseudoRadDamage[layerIndex - 1];
2145 LogDebug(
"Pixel Digitizer") <<
"pixel_aging: " 2147 LogDebug(
"Pixel Digitizer") <<
"Subid " << pixdet->
subDetector() <<
" layerIndex " << layerIndex <<
" ladder " 2153 unsigned int diskIndex =
2156 pseudoRadDamage =
aging.thePixelPseudoRadDamage[diskIndex - 1];
2158 LogDebug(
"Pixel Digitizer") <<
"pixel_aging: " 2160 LogDebug(
"Pixel Digitizer") <<
"Subid " << pixdet->
subDetector() <<
" diskIndex " << diskIndex <<
"\n";
2164 pseudoRadDamage = 0.f;
2167 LogDebug(
"Pixel Digitizer") <<
" pseudoRadDamage " << pseudoRadDamage <<
"\n";
2168 LogDebug(
"Pixel Digitizer") <<
" end pixel_aging " 2171 return pseudoRadDamage;
2173 LogDebug(
"Pixel Digitizer") <<
" enter pixel_aging " << pseudoRadDamage;
2191 const float signalInElectrons)
const {
2218 throw cms::Exception(
"NotAPixelGeomDetUnit") <<
"Not a pixel geomdet unit" << detID;
2262 LogDebug(
"Pixel Digitizer") <<
" misscalibrate " <<
col <<
" " << row
2265 << signalInElectrons <<
" " << signal <<
" " << newAmp <<
" " 2323 throw cms::Exception(
"NotAPixelGeomDetUnit") <<
"Not a pixel geomdet unit" << detID;
2330 alpha2 = lorentzAngle * lorentzAngle;
2340 LogDebug(
"Pixel Digitizer") <<
" The drift direction in local coordinate is " << theDriftDirection;
2343 return theDriftDirection;
2356 int col = ip.second;
2359 LogDebug(
"Pixel Digitizer") <<
"now in isdead check, row " << detID <<
" " <<
col <<
"," << row <<
"\n";
2371 Parameters::const_iterator itDeadModules =
DeadModules.begin();
2374 for (; itDeadModules !=
DeadModules.end(); ++itDeadModules) {
2375 int Dead_detID = itDeadModules->getParameter<
int>(
"Dead_detID");
2376 if (detid == Dead_detID) {
2389 if (Module ==
"whole") {
2398 if (Module ==
"tbmA" && ip.first >= 80 && ip.first <= 159) {
2402 if (Module ==
"tbmB" && ip.first <= 79) {
2417 for (
size_t id = 0;
id < disabledModules.size();
id++) {
2418 if (detID == disabledModules[
id].DetID) {
2420 badmodule = disabledModules[
id];
2430 LogDebug(
"Pixel Digitizer") <<
"Hit in: " << detID <<
" errorType " << badmodule.
errorType <<
" BadRocs=" << std::hex
2441 std::vector<GlobalPixel> badrocpositions(0);
2442 for (
unsigned int j = 0;
j < 16;
j++) {
2445 typedef std::vector<CablingPathToDetUnit>::const_iterator
IT;
2451 badrocpositions.push_back(global);
2461 for (std::vector<GlobalPixel>::const_iterator
it = badrocpositions.begin();
it != badrocpositions.end(); ++
it) {
2462 if (
it->row >= 80 && ip.first >= 80) {
2465 }
else if (
it->row == 120 && ip.second -
it->col == 26) {
2467 }
else if (
it->row == 119 &&
it->col - ip.second == 26) {
2470 }
else if (
it->row < 80 && ip.first < 80) {
2473 }
else if (
it->row == 40 && ip.second -
it->col == 26) {
2475 }
else if (
it->row == 39 &&
it->col - ip.second == 26) {
2487 std::vector<PixelDigi>& digis,
2488 std::vector<PixelSimHitExtraInfo>& newClass_Sim_extra,
2490 CLHEP::HepRandomEngine* engine) {
2493 std::vector<PixelDigi> New_digis;
2497 LogError(
"PixelDigitizer ") <<
" ******************************** \n";
2498 LogError(
"PixelDigitizer ") <<
" ******************************** \n";
2499 LogError(
"PixelDigitizer ") <<
" ***** INCONSISTENCY !!! ***** \n";
2501 <<
" applyLateReweighting_ and UseReweighting can not be true at the same time for PU ! \n";
2502 LogError(
"PixelDigitizer ") <<
" ---> DO NOT APPLY CHARGE REWEIGHTING TWICE !!! \n";
2503 LogError(
"PixelDigitizer ") <<
" ******************************** \n";
2504 LogError(
"PixelDigitizer ") <<
" ******************************** \n";
2508 float thePixelThresholdInE = 0.;
2511 int lay = tTopo->
layer(detID);
2516 thePixelThresholdInE = CLHEP::RandGaussQ::shoot(
2518 }
else if (lay == 2) {
2519 thePixelThresholdInE = CLHEP::RandGaussQ::shoot(
2522 thePixelThresholdInE =
2531 }
else if (lay == 2) {
2542 thePixelThresholdInE =
2549 throw cms::Exception(
"NotAPixelGeomDetUnit") <<
"Not a pixel geomdet unit" << detID;
2555 bool reweighted =
false;
2556 std::vector<PixelSimHitExtraInfo>::iterator loopTempSH;
2557 for (loopTempSH = newClass_Sim_extra.begin(); loopTempSH != newClass_Sim_extra.end(); ++loopTempSH) {
2561 pixdet, digis, TheNewInfo, theDigiSignal, tTopo, engine);
2564 std::vector<PixelDigi>::const_iterator loopDigi;
2565 for (loopDigi = digis.begin(); loopDigi != digis.end(); ++loopDigi) {
2566 unsigned int chan = loopDigi->channel();
2568 if (loopTempSH->isInTheList(
chan)) {
2569 float corresponding_charge = loopDigi->adc();
2578 float signalInADC = (*i).second;
2579 if (signalInADC > 0.) {
2580 if (signalInADC >= Thresh_inADC) {
2581 int chan = (*i).first;
2583 int adc =
int(signalInADC);
2587 int col = ip.second;
2596 LogDebug(
"Pixel Digitizer") << (*i).first <<
" " << (*i).second <<
" " << signalInADC <<
" " <<
adc 2597 << ip.first <<
" " << ip.second;
2601 New_digis.emplace_back(ip.first, ip.second,
adc);
2605 theDigiSignal.clear();
void init(const edm::EventSetup &es)
static std::pair< int, int > channelToPixelROC(const int chan)
void fillSimHitMaps(std::vector< PSimHit > simHits, const unsigned int tofBin)
const float theThresholdInE_BPix_L2
double theOuterEfficiency_FPix[20]
std::map< int, digitizerUtility::Amplitude, std::less< int > > signal_map_type
T getParameter(std::string const &) const
void pixel_inefficiency_db(uint32_t detID)
unsigned int pxbLayer(const DetId &id) const
signal_map_type::const_iterator signal_map_const_iterator
Local3DVector LocalVector
const bool use_deadmodule_DB_
const float electronsPerVCAL
const double theThresholdSmearing_FPix
Point3DBase< Scalar, LocalTag > LocalPoint
std::map< unsigned int, probabilityVec > probabilityMap
void tanh(data_T data[CONFIG_T::n_in], res_T res[CONFIG_T::n_in])
const std::unique_ptr< SiPixelGainCalibrationOfflineSimService > theSiPixelGainCalibrationService_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
static std::pair< int, int > channelToPixel(int ch)
const std::map< unsigned int, double > & getPixelGeomFactors() const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual int ncolumns() const =0
const float tanLorentzAnglePerTesla_FPix
PixelEfficiencies pixelEfficiencies_
const std::unique_ptr< SiG4UniversalFluctuation > fluctuate
const int theAdcFullScale
PixelEfficiencies(const edm::ParameterSet &conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks)
unsigned int pxfModule(const DetId &id) const
const GeomDetType & type() const override
bool exists(std::string const ¶meterName) const
checks if a parameter exists
const double theThresholdSmearing_BPix_L1
const std::map< unsigned int, double > & getColGeomFactors() const
virtual int nrows() const =0
edm::ESGetToken< SiPixelQualityProbabilities, SiPixelStatusScenarioProbabilityRcd > scenarioProbabilityToken_
Local3DPoint exitPoint() const
Exit point in the local Det frame.
const float theThresholdInE_FPix
std::unique_ptr< PixelFEDChannelCollection > PixelFEDChannelCollection_
const double theThresholdSmearing_BPix
std::vector< std::vector< double > > thePUEfficiency
std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const final
const std::vector< int > & getMix_bunchCrossing() const
const float electronsPerVCAL_Offset
void make_digis(float thePixelThresholdInE, uint32_t detID, const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, std::vector< PixelDigiAddTempInfo > &newClass_Digi_extra, const TrackerTopology *tTopo) const
const bool addThresholdSmearing
float pixel_aging(const PixelAging &aging, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo) const
void module_killing_conf(uint32_t detID)
const bool fluctuateCharge
unsigned int pxbLadder(const DetId &id) const
Log< level::Error, false > LogError
std::map< uint32_t, size_t > iPU
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
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
~SiPixelDigitizerAlgorithm()
constexpr Detector det() const
get the detector field from this detid
const float GeVperElectron
const double theThresholdSmearing_BPix_L2
identify pixel inside single ROC
const bool doMissCalInLateCR
const SiPixelDynamicInefficiency * SiPixelDynamicInefficiency_
unsigned int layer(const DetId &id) const
std::unique_ptr< SiPixelChargeReweightingAlgorithm > TheNewSiPixelChargeReweightingAlgorithmClass
bool isTrackerPixel() const
const bool use_ineff_from_db_
static int pixelToChannel(int row, int col)
global coordinates (row and column in DetUnit, as in PixelDigi)
virtual float thickness() const =0
void induce_signal(std::vector< PSimHit >::const_iterator inputBegin, std::vector< PSimHit >::const_iterator inputEnd, const PSimHit &hit, const size_t hitIndex, const size_t FirstHitIndex, const unsigned int tofBin, const PixelGeomDetUnit *pixdet, const std::vector< SignalPoint > &collection_points)
const bool use_LorentzAngle_DB_
const std::map< unsigned int, std::vector< double > > & getPUFactors() const
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Container::value_type value_type
LocalVector DriftDirection(const PixelGeomDetUnit *pixdet, const GlobalVector &bfield, const DetId &detId) const
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > SiPixelBadModuleToken_
const std::vector< disabledModuleType > getBadComponentList() const
SiPixelDigitizerAlgorithm(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
const PixelFEDChannelCollectionMap * quality_map
const bool store_SimHitEntryExitPoints_
const std::vector< uint32_t > getDetIdmasks() const
std::pair< unsigned int, unsigned int > subDetTofBin
void digitize(const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, std::vector< PixelDigiAddTempInfo > &newClass_Digi_extra, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
double theInstLumiScaleFactor
const Parameters DeadModules
std::map< uint32_t, std::vector< double > > PixelGeomFactorsROCBigPixels
virtual bool isItBigPixelInX(int ixbin) const =0
double thePixelChipEfficiency[20]
const float theTofUpperCut
void primary_ionization(const PSimHit &hit, std::vector< EnergyDepositUnit > &ionization_points, CLHEP::HepRandomEngine *) const
const bool use_module_killing_
GlobalPixel toGlobal(const LocalPixel &loc) const
std::vector< double > pu_scale
void module_killing_DB(uint32_t detID)
probabilityVec getProbabilities(const unsigned int puBin) const
static int pixelToChannelROC(const int rowROC, const int colROC)
virtual bool isItBigPixelInY(int iybin) const =0
unsigned short processType() const
const std::map< unsigned int, double > & getChipGeomFactors() const
unsigned int pxfDisk(const DetId &id) const
const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &path) const final
Abs< T >::type abs(const T &t)
double calcQ(float x) const
const float theThresholdInE_BPix
double theInnerEfficiency_FPix[20]
const SiPixelLorentzAngle * SiPixelLorentzAngle_
Local3DPoint entryPoint() const
Entry point in the local Det frame.
virtual int channel(const LocalPoint &p) const =0
const int NumberOfEndcapDisks
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
std::vector< double > theModuleEfficiency_BPix[20]
float missCalibrate(uint32_t detID, const TrackerTopology *tTopo, const PixelGeomDetUnit *pixdet, int col, int row, float amp) const
unsigned int trackId() const
std::vector< LinkConnSpec >::const_iterator IT
void init_from_db(const TrackerGeometry *, const SiPixelDynamicInefficiency *)
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleSimRcd > SiPixelLorentzAngleToken_
signal_map_type::iterator signal_map_iterator
void init_DynIneffDB(const edm::EventSetup &)
DetId geographicalId() const
The label of this GeomDet.
std::unique_ptr< PixelFEDChannelCollection > chooseScenario(PileupMixingContent *puInfo, CLHEP::HepRandomEngine *)
const float theThresholdInE_BPix_L1
const float electronsPerVCAL_L1_Offset
void setSimAccumulator(const std::map< uint32_t, std::map< int, int > > &signalMap)
const bool UseReweighting
edm::ESGetToken< PixelFEDChannelCollectionMap, SiPixelFEDChannelContainerESProducerRcd > PixelFEDChannelCollectionMapToken_
const std::map< int, CalParameters, std::less< int > > calmap
const bool doMissCalibrate
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
const bool AddPixelInefficiency
unsigned int pxfPanel(const DetId &id) const
const bool addChargeVCALSmearing
const int theAdcFullScLateCR
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
const std::unique_ptr< GaussianTailNoiseGenerator > theNoiser
const float theNoiseInElectrons
const SiPixelQuality * SiPixelBadModule_
const SiPixelFedCablingMap * map_
const Plane & surface() const
The nominal surface of the GeomDet.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const float electronsPerVCAL_L1
const PositionType & position() const
std::map< uint32_t, std::vector< double > > PixelGeomFactorsROCStdPixels
double thePixelColEfficiency[20]
const std::vector< float > & getMix_TrueInteractions() const
constexpr uint32_t rawId() const
get the raw id
void calculateInstlumiFactor(PileupMixingContent *puInfo)
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 *)
row and collumn in ROC representation
virtual SubDetector subDetector() const
Which subdetector.
static const GlobalPoint notFound(0, 0, 0)
const float tanLorentzAnglePerTesla_BPix
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
const SiPixelQualityProbabilities * scenarioProbability_
void fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegments, float elossVector[], CLHEP::HepRandomEngine *) const
bool matches(const DetId &, const DetId &, const std::vector< uint32_t > &)
void lateSignalReweight(const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelSimHitExtraInfo > &newClass_Sim_extra, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *engine)
std::vector< edm::ParameterSet > Parameters
const bool KillBadFEDChannels
std::vector< double > theLadderEfficiency_BPix[20]
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const float theReadoutNoise
EcalLogicID subdetID(EcalSubdetector)
const TrackerGeometry * geom_
short getBadRocs(const uint32_t &detid) const
static unsigned int const shift
edm::ESGetToken< SiPixelDynamicInefficiency, SiPixelDynamicInefficiencyRcd > SiPixelDynamicInefficiencyToken_
std::map< uint32_t, double > ColGeomFactors
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
const RotationType & rotation() const
std::map< int, CalParameters, std::less< int > > initCal() const
double thePixelEfficiency[20]
virtual std::pair< float, float > pitch() const =0
simhit_collectionMap SimHitCollMap
PixelAging(const edm::ParameterSet &conf, bool AddPixelAging, int NumberOfBarrelLayers, int NumberOfEndcapDisks)
const float theTofLowerCut
unsigned int pxbModule(const DetId &id) const
Log< level::Warning, false > LogWarning
bool killBadFEDChannels() const
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
std::map< uint32_t, double > PixelGeomFactors
std::map< uint32_t, double > ChipGeomFactors
const bool addNoisyPixels
const PixelAging pixelAging_
float getLorentzAngle(const uint32_t &) const
const float theElectronPerADC
const bool makeDigiSimLinks_
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
*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
const int NumberOfBarrelLayers
double gettheInstLumiScaleFactor() const
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void add_noise(const PixelGeomDetUnit *pixdet, float thePixelThreshold, CLHEP::HepRandomEngine *)
void pixel_inefficiency(const PixelEfficiencies &eff, const PixelGeomDetUnit *pixdet, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
const Bounds & bounds() const