33 #include <boost/foreach.hpp>
39 : theGeometry(nullptr),
40 theRecNumber(nullptr),
45 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
true)),
48 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
false)),
52 theHBHEAmplifier(nullptr),
53 theHFAmplifier(nullptr),
54 theHOAmplifier(nullptr),
55 theZDCAmplifier(nullptr),
56 theHFQIE10Amplifier(nullptr),
57 theHBHEQIE11Amplifier(nullptr),
58 theIonFeedback(nullptr),
59 theCoderFactory(nullptr),
60 theHBHEElectronicsSim(nullptr),
61 theHFElectronicsSim(nullptr),
62 theHOElectronicsSim(nullptr),
63 theZDCElectronicsSim(nullptr),
64 theHFQIE10ElectronicsSim(nullptr),
65 theHBHEQIE11ElectronicsSim(nullptr),
67 theHBHEQIE11HitFilter(),
69 theHFQIE10HitFilter(),
73 theHBHEDigitizer(nullptr),
74 theHODigitizer(nullptr),
75 theHOSiPMDigitizer(nullptr),
76 theHFDigitizer(nullptr),
77 theZDCDigitizer(nullptr),
78 theHFQIE10Digitizer(nullptr),
79 theHBHEQIE11Digitizer(nullptr),
80 theRelabeller(nullptr),
87 doHFWindow_(ps.getParameter<
bool>(
"doHFWindow")),
88 killHE_(ps.getParameter<
bool>(
"killHE")),
89 debugCS_(ps.getParameter<
bool>(
"debugCaloSamples")),
90 ignoreTime_(ps.getParameter<
bool>(
"ignoreGeantTime")),
91 injectTestHits_(ps.getParameter<
bool>(
"injectTestHits")),
92 hitsProducer_(ps.getParameter<
std::
string>(
"hitsProducer")),
95 agingFlagHB(ps.getParameter<
bool>(
"HBDarkening")),
96 agingFlagHE(ps.getParameter<
bool>(
"HEDarkening")),
97 m_HBDarkening(nullptr),
98 m_HEDarkening(nullptr),
99 m_HFRecalibration(nullptr),
100 injectedHitsEnergy_(ps.getParameter<
std::
vector<double>>(
"injectTestHitsEnergy")),
101 injectedHitsTime_(ps.getParameter<
std::
vector<double>>(
"injectTestHitsTime")),
102 injectedHitsCells_(ps.getParameter<
std::
vector<
int>>(
"injectTestHitsCells")) {
108 bool PreMix1 = ps.
getParameter<
bool>(
"HcalPreMixStage1");
109 bool PreMix2 = ps.
getParameter<
bool>(
"HcalPreMixStage2");
112 bool agingFlagHF = ps.
getParameter<
bool>(
"HFDarkening");
115 if (PreMix1 && PreMix2) {
116 throw cms::Exception(
"Configuration") <<
"HcalDigitizer cannot operate in PreMixing digitization and "
118 "digi combination modes at the same time. Please set one mode to "
120 "in the configuration file.";
332 edm::Handle<std::vector<PCaloHit>>
const &zdcHandle,
334 CLHEP::HepRandomEngine *engine,
338 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
341 std::vector<PCaloHit> hcalHits;
342 hcalHits.reserve(hcalHitsOrig.size());
355 for (
unsigned int i = 0;
i < hcalHitsOrig.size();
i++) {
359 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid
370 std::cout <<
"HcalDigitizer format " << hid.
oldFormat() <<
" for " << hid << std::endl;
374 std::cout <<
"Hit " <<
i <<
" out of " << hcalHits.size() <<
" " << std::hex <<
id.rawId() <<
" --> "
377 hcalHitsOrig[
i].setID(newid.
rawId());
378 hcalHits.push_back(hcalHitsOrig[
i]);
403 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
411 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
419 e.getByLabel(zdcTag, zdcHandle);
424 e.getByLabel(hcalTag, hcalHandle);
436 CLHEP::HepRandomEngine *engine) {
440 e.getByLabel(zdcTag, zdcHandle);
445 e.getByLabel(hcalTag, hcalHandle);
493 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
494 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
495 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
496 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
497 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
498 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
502 std::cout <<
"HCAL HBHE digis : " << hbheResult->size() << std::endl;
503 std::cout <<
"HCAL HO digis : " << hoResult->size() << std::endl;
504 std::cout <<
"HCAL HF digis : " << hfResult->size() << std::endl;
505 std::cout <<
"HCAL ZDC digis : " << zdcResult->size() << std::endl;
506 std::cout <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size() << std::endl;
507 std::cout <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size() << std::endl;
515 e.put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
516 e.put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
525 csResult->insert(csResult->end(),
552 std::cout << std::endl <<
"========> HcalDigitizer e.put " << std::endl << std::endl;
605 if (check1
or check2) {
622 if (zdcCells.empty())
624 if (hbCells.empty() && heCells.empty())
655 std::vector<DetId> testCells;
677 throw cms::Exception(
"Configuration") <<
"Unknown subdet " << testSubdet <<
" for HCAL test hit injection";
683 for (
auto &aCell : testCells) {
702 if (qieTypes.topo() ==
nullptr) {
706 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
708 if (qieType ==
QIE8) {
710 }
else if (qieType ==
QIE10) {
742 if (qieTypes.topo() ==
nullptr) {
746 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
748 if (qieType ==
QIE8) {
750 }
else if (qieType ==
QIE11) {
784 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
791 if (mcParams.topo() ==
nullptr) {
795 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
796 int shapeType = mcParams.getValues(*detItr)->signalShape();
798 zecotekDetIds.emplace_back(*detItr);
801 hamamatsuDetIds.emplace_back(*detItr);
834 for (
unsigned int ii = 0;
ii < hcalHits.size(); ++
ii) {
835 uint32_t tmpId = hcalHits[
ii].id();
839 bool darkened =
false;
858 hcalHits[
ii].setEnergy(hcalHits[
ii].
energy() * dweight);