33 #include <boost/foreach.hpp>
38 : theGeometry(nullptr),
39 theRecNumber(nullptr),
44 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
true)),
47 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
false)),
51 theHBHEAmplifier(nullptr),
52 theHFAmplifier(nullptr),
53 theHOAmplifier(nullptr),
54 theZDCAmplifier(nullptr),
55 theHFQIE10Amplifier(nullptr),
56 theHBHEQIE11Amplifier(nullptr),
57 theIonFeedback(nullptr),
58 theCoderFactory(nullptr),
59 theHBHEElectronicsSim(nullptr),
60 theHFElectronicsSim(nullptr),
61 theHOElectronicsSim(nullptr),
62 theZDCElectronicsSim(nullptr),
63 theHFQIE10ElectronicsSim(nullptr),
64 theHBHEQIE11ElectronicsSim(nullptr),
66 theHBHEQIE11HitFilter(),
68 theHFQIE10HitFilter(),
72 theHBHEDigitizer(nullptr),
73 theHODigitizer(nullptr),
74 theHOSiPMDigitizer(nullptr),
75 theHFDigitizer(nullptr),
76 theZDCDigitizer(nullptr),
77 theHFQIE10Digitizer(nullptr),
78 theHBHEQIE11Digitizer(nullptr),
79 theRelabeller(nullptr),
86 doHFWindow_(ps.getParameter<
bool>(
"doHFWindow")),
87 killHE_(ps.getParameter<
bool>(
"killHE")),
88 debugCS_(ps.getParameter<
bool>(
"debugCaloSamples")),
89 ignoreTime_(ps.getParameter<
bool>(
"ignoreGeantTime")),
90 injectTestHits_(ps.getParameter<
bool>(
"injectTestHits")),
91 hitsProducer_(ps.getParameter<
std::
string>(
"hitsProducer")),
94 agingFlagHB(ps.getParameter<
bool>(
"HBDarkening")),
95 agingFlagHE(ps.getParameter<
bool>(
"HEDarkening")),
96 m_HBDarkening(nullptr),
97 m_HEDarkening(nullptr),
98 m_HFRecalibration(nullptr),
99 injectedHitsEnergy_(ps.getParameter<
std::vector<double>>(
"injectTestHitsEnergy")),
100 injectedHitsTime_(ps.getParameter<
std::vector<double>>(
"injectTestHitsTime")),
101 injectedHitsCells_(ps.getParameter<
std::vector<
int>>(
"injectTestHitsCells")) {
107 bool PreMix1 = ps.
getParameter<
bool>(
"HcalPreMixStage1");
108 bool PreMix2 = ps.
getParameter<
bool>(
"HcalPreMixStage2");
111 bool agingFlagHF = ps.
getParameter<
bool>(
"HFDarkening");
114 if (PreMix1 && PreMix2) {
115 throw cms::Exception(
"Configuration") <<
"HcalDigitizer cannot operate in PreMixing digitization and "
117 "digi combination modes at the same time. Please set one mode to "
119 "in the configuration file.";
331 edm::Handle<std::vector<PCaloHit>>
const &zdcHandle,
333 CLHEP::HepRandomEngine *engine,
337 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
340 std::vector<PCaloHit> hcalHits;
341 hcalHits.reserve(hcalHitsOrig.size());
354 for (
unsigned int i = 0;
i < hcalHitsOrig.size();
i++) {
358 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid
369 std::cout <<
"HcalDigitizer format " << hid.
oldFormat() <<
" for " << hid << std::endl;
373 std::cout <<
"Hit " <<
i <<
" out of " << hcalHits.size() <<
" " << std::hex <<
id.rawId() <<
" --> "
376 hcalHitsOrig[
i].setID(newid.
rawId());
377 hcalHits.push_back(hcalHitsOrig[
i]);
402 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
410 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
418 e.getByLabel(zdcTag, zdcHandle);
423 e.getByLabel(hcalTag, hcalHandle);
435 CLHEP::HepRandomEngine *engine) {
439 e.getByLabel(zdcTag, zdcHandle);
444 e.getByLabel(hcalTag, hcalHandle);
492 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
493 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
494 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
495 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
496 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
497 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
501 std::cout <<
"HCAL HBHE digis : " << hbheResult->size() << std::endl;
502 std::cout <<
"HCAL HO digis : " << hoResult->size() << std::endl;
503 std::cout <<
"HCAL HF digis : " << hfResult->size() << std::endl;
504 std::cout <<
"HCAL ZDC digis : " << zdcResult->size() << std::endl;
505 std::cout <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size() << std::endl;
506 std::cout <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size() << std::endl;
514 e.put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
515 e.put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
524 csResult->insert(csResult->end(),
551 std::cout << std::endl <<
"========> HcalDigitizer e.put " << std::endl << std::endl;
604 if (check1
or check2) {
621 if (zdcCells.empty())
623 if (hbCells.empty() && heCells.empty())
654 std::vector<DetId> testCells;
676 throw cms::Exception(
"Configuration") <<
"Unknown subdet " << testSubdet <<
" for HCAL test hit injection";
682 for (
auto &aCell : testCells) {
701 if (qieTypes.topo() ==
nullptr) {
705 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
707 if (qieType ==
QIE8) {
709 }
else if (qieType ==
QIE10) {
741 if (qieTypes.topo() ==
nullptr) {
745 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
747 if (qieType ==
QIE8) {
749 }
else if (qieType ==
QIE11) {
783 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
790 if (mcParams.topo() ==
nullptr) {
794 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
795 int shapeType = mcParams.getValues(*detItr)->signalShape();
797 zecotekDetIds.emplace_back(*detItr);
800 hamamatsuDetIds.emplace_back(*detItr);
833 for (
unsigned int ii = 0;
ii < hcalHits.size(); ++
ii) {
834 uint32_t tmpId = hcalHits[
ii].id();
838 bool darkened =
false;
857 hcalHits[
ii].setEnergy(hcalHits[
ii].
energy() * dweight);