30 #include <boost/foreach.hpp> 44 theRecNumber(nullptr),
49 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
true)),
52 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
false)),
55 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
true)),
57 &theParameterMap, &theShapes, ps.getParameter<
bool>(
"HcalPreMixStage1"),
false)),
58 theHBHEAmplifier(nullptr),
59 theHFAmplifier(nullptr),
60 theHOAmplifier(nullptr),
61 theZDCAmplifier(nullptr),
62 theHFQIE10Amplifier(nullptr),
63 theHBHEQIE11Amplifier(nullptr),
64 theIonFeedback(nullptr),
65 theCoderFactory(nullptr),
66 theHBHEElectronicsSim(nullptr),
67 theHFElectronicsSim(nullptr),
68 theHOElectronicsSim(nullptr),
69 theZDCElectronicsSim(nullptr),
70 theHFQIE10ElectronicsSim(nullptr),
71 theHBHEQIE11ElectronicsSim(nullptr),
73 theHBHEQIE11HitFilter(),
75 theHFQIE10HitFilter(),
79 theHBHEDigitizer(nullptr),
80 theHODigitizer(nullptr),
81 theHOSiPMDigitizer(nullptr),
82 theHFDigitizer(nullptr),
83 theZDCDigitizer(nullptr),
84 theHFQIE10Digitizer(nullptr),
85 theHBHEQIE11Digitizer(nullptr),
86 theRelabeller(nullptr),
87 isZDC(ps.getParameter<
bool>(
"doZDCDigi")),
93 doHFWindow_(ps.getParameter<
bool>(
"doHFWindow")),
94 killHE_(ps.getParameter<
bool>(
"killHE")),
95 debugCS_(ps.getParameter<
bool>(
"debugCaloSamples")),
96 ignoreTime_(ps.getParameter<
bool>(
"ignoreGeantTime")),
97 injectTestHits_(ps.getParameter<
bool>(
"injectTestHits")),
98 hitsProducer_(ps.getParameter<
std::
string>(
"hitsProducer")),
101 agingFlagHB(ps.getParameter<
bool>(
"HBDarkening")),
102 agingFlagHE(ps.getParameter<
bool>(
"HEDarkening")),
103 zdcToken_(iC.consumes(
edm::
InputTag(hitsProducer_,
"ZDCHITS"))),
104 hcalToken_(iC.consumes(
edm::
InputTag(hitsProducer_,
"HcalHits"))),
105 m_HBDarkening(nullptr),
106 m_HEDarkening(nullptr),
107 m_HFRecalibration(nullptr),
108 injectedHitsEnergy_(ps.getParameter<
std::
vector<double>>(
"injectTestHitsEnergy")),
109 injectedHitsTime_(ps.getParameter<
std::
vector<double>>(
"injectTestHitsTime")),
110 injectedHitsCells_(ps.getParameter<
std::
vector<
int>>(
"injectTestHitsCells")) {
123 bool PreMix1 = ps.
getParameter<
bool>(
"HcalPreMixStage1");
124 bool PreMix2 = ps.
getParameter<
bool>(
"HcalPreMixStage2");
127 bool agingFlagHF = ps.
getParameter<
bool>(
"HFDarkening");
130 if (PreMix1 && PreMix2) {
131 throw cms::Exception(
"Configuration") <<
"HcalDigitizer cannot operate in PreMixing digitization and " 133 "digi combination modes at the same time. Please set one mode to " 135 "in the configuration file.";
228 if (ps.getParameter<
bool>(
"doThermalNoise")) {
358 edm::Handle<std::vector<PCaloHit>>
const &zdcHandle,
360 CLHEP::HepRandomEngine *engine,
365 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
368 std::vector<PCaloHit> hcalHits;
369 hcalHits.reserve(hcalHitsOrig.size());
382 for (
unsigned int i = 0;
i < hcalHitsOrig.size();
i++) {
386 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid;
400 edm::LogVerbatim(
"HcalSim") <<
"Hit " <<
i <<
" out of " << hcalHits.size() <<
" " << std::hex <<
id.rawId()
403 hcalHitsOrig[
i].setID(newid.
rawId());
404 hcalHits.push_back(hcalHitsOrig[
i]);
429 edm::LogVerbatim(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
434 std::vector<PCaloHit> zdcHitsOrig = *zdcHandle.product();
435 std::vector<PCaloHit> zdcHits;
436 zdcHits.reserve(zdcHitsOrig.size());
438 for (
unsigned int i = 0;
i < zdcHitsOrig.size();
i++) {
441 if (!ztopoP->
valid(hid)) {
442 edm::LogError(
"HcalDigitizer") <<
"bad zdc id found in digitizer. Skipping " << std::hex <<
id.rawId()
446 zdcHits.push_back(zdcHitsOrig[
i]);
448 edm::LogVerbatim(
"HcalSim") <<
"Hit " <<
i <<
" out of " << zdcHitsOrig.size() <<
" " << std::hex <<
id.rawId()
455 edm::LogVerbatim(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
475 CLHEP::HepRandomEngine *engine) {
479 e.getByLabel(zdcTag, zdcHandle);
484 e.getByLabel(hcalTag, hcalHandle);
531 edm::LogVerbatim(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
532 edm::LogVerbatim(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
533 edm::LogVerbatim(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
534 edm::LogVerbatim(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
535 edm::LogVerbatim(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
536 edm::LogVerbatim(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
539 edm::LogVerbatim(
"HcalSim") <<
"\nHCAL HBHE digis : " << hbheResult->size();
543 edm::LogVerbatim(
"HcalSim") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
544 edm::LogVerbatim(
"HcalSim") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
552 e.put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
553 e.put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
562 csResult->insert(csResult->end(),
633 if (check1
or check2) {
649 edm::LogVerbatim(
"HcalSim") <<
"HcalDigitizer::CheckGeometry number of cells: " << zdcCells.size();
651 if (zdcCells.empty())
653 if (hbCells.empty() && heCells.empty())
685 std::vector<DetId> testCells;
707 throw cms::Exception(
"Configuration") <<
"Unknown subdet " << testSubdet <<
" for HCAL test hit injection";
713 for (
auto &aCell : testCells) {
728 if (qieTypes.
topo() ==
nullptr) {
732 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
764 if (qieTypes.
topo() ==
nullptr) {
768 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
806 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
810 if (mcParams.
topo() ==
nullptr) {
814 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
817 zecotekDetIds.emplace_back(*detItr);
820 hamamatsuDetIds.emplace_back(*detItr);
853 for (
unsigned int ii = 0;
ii < hcalHits.size(); ++
ii) {
854 uint32_t tmpId = hcalHits[
ii].id();
858 bool darkened =
false;
877 hcalHits[
ii].setEnergy(hcalHits[
ii].
energy() * dweight);
HFHitFilter theHFQIE10HitFilter
std::vector< DetId > theHFQIE10DetIds
Log< level::Info, true > LogVerbatim
std::vector< int > injectedHitsCells_
HBHEHitFilter theHBHEHitFilter
T getParameter(std::string const &) const
constexpr bool oldFormat() const
std::vector< PCaloHit > PCaloHitContainer
void setQIE10NoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
std::vector< CaloSamples > CaloSamplesCollection
const HcalDDDRecConstants * theRecNumber
void setParameterMap(HcalSimParameterMap *map)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::unique_ptr< CaloHitResponse > theHFResponse
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > theRecNumberToken
std::unique_ptr< HcalTimeSlewSim > theTimeSlewSim
std::unique_ptr< HcalAmplifier > theHBHEAmplifier
std::unique_ptr< HBHEDigitizer > theHBHEDigitizer
void buildHFQIECells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
float degradation(float intlumi, int ieta, int lay) const
HOHitFilter theHOHitFilter
std::unique_ptr< ZDCDigitizer > theZDCDigitizer
void darkening(std::vector< PCaloHit > &hcalHits)
std::unique_ptr< HcalHitRelabeller > theRelabeller
HFHitFilter theHFHitFilter
void checkGeometry(const edm::EventSetup &eventSetup)
Log< level::Error, false > LogError
void buildHBHEQIECells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
std::unique_ptr< HFDigitizer > theHFDigitizer
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > theGeometryToken
std::unique_ptr< HODigitizer > theHODigitizer
std::unique_ptr< HcalAmplifier > theHFAmplifier
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
edm::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > m_HBDarkeningToken
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::unique_ptr< HcalCoderFactory > theCoderFactory
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
std::unique_ptr< HcalElectronicsSim > theZDCElectronicsSim
std::unique_ptr< HFRecalibration > m_HFRecalibration
edm::EDGetTokenT< std::vector< PCaloHit > > zdcToken_
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *)
constexpr uint32_t newForm() const
std::vector< double > injectedHitsEnergy_
void setQIE11NoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
constexpr HcalSubdetector subdet() const
get the subdetector
void setHOZecotekDetIds(const std::vector< HcalDetId > &ids)
std::unique_ptr< HcalElectronicsSim > theHFQIE10ElectronicsSim
const HBHEDarkening * m_HEDarkening
std::unique_ptr< HcalElectronicsSim > theHFElectronicsSim
const HcalTopology * topo() const
edm::ESWatcher< HcalRecNumberingRecord > theRecNumberWatcher_
edm::SortedCollection< HODataFrame > HODigiCollection
std::string hitsProducer_
void setElectronicsSim(HcalElectronicsSim *electronicsSim)
std::unique_ptr< HODigitizer > theHOSiPMDigitizer
Creates electronics signals from hits.
const HcalTimeSlew * hcalTimeSlew_delay_
void setHFNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
std::unique_ptr< HcalAmplifier > theHBHEQIE11Amplifier
void buildHOSiPMCells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
ZDCHitFilter theZDCHitFilter
std::unique_ptr< HcalSiPMHitResponse > theHBHESiPMResponse
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
std::vector< double > injectedHitsTime_
static const size_type MAXSAMPLES
std::unique_ptr< CaloHitResponse > theHBHEResponse
std::vector< DetId > theHOHPDDetIds
edm::EDGetTokenT< std::vector< PCaloHit > > hcalToken_
unsigned int signalShape() const
edm::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > m_HEDarkeningToken
HcalSimParameterMap theParameterMap
std::unique_ptr< HcalElectronicsSim > theHBHEElectronicsSim
virtual bool valid(const HcalZDCDetId &id) const
const edm::ESGetToken< HcalQIETypes, HcalQIETypesRcd > qieTypesToken_
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken_
std::unique_ptr< CaloHitResponse > theHOResponse
std::unique_ptr< HPDIonFeedbackSim > theIonFeedback
std::unique_ptr< HcalAmplifier > theZDCAmplifier
edm::ESWatcher< CaloGeometryRecord > theGeometryWatcher_
void setHOHamamatsuDetIds(const std::vector< HcalDetId > &ids)
void setDbService(const HcalDbService *service)
std::vector< DetId > theHFQIE8DetIds
constexpr uint32_t rawId() const
get the raw id
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
std::unique_ptr< QIE11Digitizer > theHBHEQIE11Digitizer
std::unique_ptr< QIE10Digitizer > theHFQIE10Digitizer
void setDetIds(const std::vector< DetId > &detIds)
std::vector< DetId > theHOSiPMDetIds
HOHitFilter theHOSiPMHitFilter
std::unique_ptr< CaloHitResponse > theZDCResponse
bool check(const edm::EventSetup &iSetup)
const CaloGeometry * theGeometry
std::unique_ptr< HcalAmplifier > theHOAmplifier
std::unique_ptr< HcalSiPMHitResponse > theHOSiPMResponse
bool validHcal(const HcalDetId &id) const
std::vector< DetId > hbheCells
const HBHEDarkening * m_HBDarkening
void accumulateCaloHits(edm::Handle< std::vector< PCaloHit >> const &hcalHits, edm::Handle< std::vector< PCaloHit >> const &zdcHits, int bunchCrossing, CLHEP::HepRandomEngine *, const HcalTopology *h, const ZdcTopology *z)
std::unique_ptr< HcalElectronicsSim > theHOElectronicsSim
HBHEHitFilter theHBHEQIE11HitFilter
void setZDCNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
std::vector< DetId > theHBHEQIE8DetIds
std::unique_ptr< CaloHitResponse > theHFQIE10Response
edm::SortedCollection< HFDataFrame > HFDigiCollection
edm::ESGetToken< HcalMCParams, HcalMCParamsRcd > mcParamsToken_
const edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
static constexpr int32_t SubdetectorId
std::unique_ptr< HcalAmplifier > theHFQIE10Amplifier
std::unique_ptr< HcalElectronicsSim > theHBHEQIE11ElectronicsSim
void updateGeometry(const edm::EventSetup &eventSetup)
void setHBHENoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
void setup(const edm::EventSetup &es)
const edm::ESGetToken< ZdcTopology, HcalRecNumberingRecord > topoZToken_
std::vector< DetId > theHBHEQIE11DetIds
void setTopo(const HcalTopology *topo)
void setDbService(const HcalDbService *service)
edm::SortedCollection< HBHEDataFrame > HBHEDigiCollection
std::vector< PCaloHit > injectedHits_
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *)
void setHONoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
HcalDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
const edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > hcalTimeSlew_delay_token_