29 #include <boost/foreach.hpp>
42 theRecNumber(nullptr),
47 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
true)),
50 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
false)),
54 theHBHEAmplifier(nullptr),
55 theHFAmplifier(nullptr),
56 theHOAmplifier(nullptr),
57 theZDCAmplifier(nullptr),
58 theHFQIE10Amplifier(nullptr),
59 theHBHEQIE11Amplifier(nullptr),
60 theIonFeedback(nullptr),
61 theCoderFactory(nullptr),
62 theHBHEElectronicsSim(nullptr),
63 theHFElectronicsSim(nullptr),
64 theHOElectronicsSim(nullptr),
65 theZDCElectronicsSim(nullptr),
66 theHFQIE10ElectronicsSim(nullptr),
67 theHBHEQIE11ElectronicsSim(nullptr),
69 theHBHEQIE11HitFilter(),
71 theHFQIE10HitFilter(),
75 theHBHEDigitizer(nullptr),
76 theHODigitizer(nullptr),
77 theHOSiPMDigitizer(nullptr),
78 theHFDigitizer(nullptr),
79 theZDCDigitizer(nullptr),
80 theHFQIE10Digitizer(nullptr),
81 theHBHEQIE11Digitizer(nullptr),
82 theRelabeller(nullptr),
89 doHFWindow_(ps.getParameter<
bool>(
"doHFWindow")),
90 killHE_(ps.getParameter<
bool>(
"killHE")),
91 debugCS_(ps.getParameter<
bool>(
"debugCaloSamples")),
92 ignoreTime_(ps.getParameter<
bool>(
"ignoreGeantTime")),
93 injectTestHits_(ps.getParameter<
bool>(
"injectTestHits")),
94 hitsProducer_(ps.getParameter<
std::
string>(
"hitsProducer")),
97 agingFlagHB(ps.getParameter<
bool>(
"HBDarkening")),
98 agingFlagHE(ps.getParameter<
bool>(
"HEDarkening")),
99 m_HBDarkening(nullptr),
100 m_HEDarkening(nullptr),
101 m_HFRecalibration(nullptr),
102 injectedHitsEnergy_(ps.getParameter<
std::
vector<double>>(
"injectTestHitsEnergy")),
103 injectedHitsTime_(ps.getParameter<
std::
vector<double>>(
"injectTestHitsTime")),
104 injectedHitsCells_(ps.getParameter<
std::
vector<
int>>(
"injectTestHitsCells")) {
120 bool PreMix1 = ps.
getParameter<
bool>(
"HcalPreMixStage1");
121 bool PreMix2 = ps.
getParameter<
bool>(
"HcalPreMixStage2");
124 bool agingFlagHF = ps.
getParameter<
bool>(
"HFDarkening");
127 if (PreMix1 && PreMix2) {
128 throw cms::Exception(
"Configuration") <<
"HcalDigitizer cannot operate in PreMixing digitization and "
130 "digi combination modes at the same time. Please set one mode to "
132 "in the configuration file.";
343 edm::Handle<std::vector<PCaloHit>>
const &zdcHandle,
345 CLHEP::HepRandomEngine *engine,
349 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
352 std::vector<PCaloHit> hcalHits;
353 hcalHits.reserve(hcalHitsOrig.size());
366 for (
unsigned int i = 0;
i < hcalHitsOrig.size();
i++) {
370 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid
381 std::cout <<
"HcalDigitizer format " << hid.
oldFormat() <<
" for " << hid << std::endl;
385 std::cout <<
"Hit " <<
i <<
" out of " << hcalHits.size() <<
" " << std::hex <<
id.rawId() <<
" --> "
388 hcalHitsOrig[
i].setID(newid.
rawId());
389 hcalHits.push_back(hcalHitsOrig[
i]);
414 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
422 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
430 e.getByLabel(zdcTag, zdcHandle);
435 e.getByLabel(hcalTag, hcalHandle);
445 CLHEP::HepRandomEngine *engine) {
449 e.getByLabel(zdcTag, zdcHandle);
454 e.getByLabel(hcalTag, hcalHandle);
500 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
501 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
502 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
503 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
504 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
505 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
509 std::cout <<
"HCAL HBHE digis : " << hbheResult->size() << std::endl;
510 std::cout <<
"HCAL HO digis : " << hoResult->size() << std::endl;
511 std::cout <<
"HCAL HF digis : " << hfResult->size() << std::endl;
512 std::cout <<
"HCAL ZDC digis : " << zdcResult->size() << std::endl;
513 std::cout <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size() << std::endl;
514 std::cout <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size() << std::endl;
522 e.put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
523 e.put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
532 csResult->insert(csResult->end(),
559 std::cout << std::endl <<
"========> HcalDigitizer e.put " << std::endl << std::endl;
602 if (check1
or check2) {
619 if (zdcCells.empty())
621 if (hbCells.empty() && heCells.empty())
652 std::vector<DetId> testCells;
674 throw cms::Exception(
"Configuration") <<
"Unknown subdet " << testSubdet <<
" for HCAL test hit injection";
680 for (
auto &aCell : testCells) {
695 if (qieTypes.
topo() ==
nullptr) {
699 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
701 if (qieType ==
QIE8) {
703 }
else if (qieType ==
QIE10) {
731 if (qieTypes.
topo() ==
nullptr) {
735 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
737 if (qieType ==
QIE8) {
739 }
else if (qieType ==
QIE11) {
773 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
777 if (mcParams.
topo() ==
nullptr) {
781 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
784 zecotekDetIds.emplace_back(*detItr);
787 hamamatsuDetIds.emplace_back(*detItr);
820 for (
unsigned int ii = 0;
ii < hcalHits.size(); ++
ii) {
821 uint32_t tmpId = hcalHits[
ii].id();
825 bool darkened =
false;
844 hcalHits[
ii].setEnergy(hcalHits[
ii].
energy() * dweight);