29 #include <boost/foreach.hpp>
42 theRecNumber(nullptr),
45 theHBHEResponse(std::make_unique<
CaloHitResponse>(&theParameterMap, &theShapes)),
47 &theParameterMap, &theShapes, ps.getParameter<bool>(
"HcalPreMixStage1"),
true)),
48 theHOResponse(std::make_unique<
CaloHitResponse>(&theParameterMap, &theShapes)),
50 &theParameterMap, &theShapes, ps.getParameter<bool>(
"HcalPreMixStage1"),
false)),
51 theHFResponse(std::make_unique<
CaloHitResponse>(&theParameterMap, &theShapes)),
53 &theParameterMap, &theShapes, ps.getParameter<bool>(
"HcalPreMixStage1"),
true)),
55 &theParameterMap, &theShapes, ps.getParameter<bool>(
"HcalPreMixStage1"),
false)),
56 theHBHEAmplifier(nullptr),
57 theHFAmplifier(nullptr),
58 theHOAmplifier(nullptr),
59 theZDCAmplifier(nullptr),
60 theHFQIE10Amplifier(nullptr),
61 theHBHEQIE11Amplifier(nullptr),
62 theIonFeedback(nullptr),
63 theCoderFactory(nullptr),
64 theHBHEElectronicsSim(nullptr),
65 theHFElectronicsSim(nullptr),
66 theHOElectronicsSim(nullptr),
67 theZDCElectronicsSim(nullptr),
68 theHFQIE10ElectronicsSim(nullptr),
69 theHBHEQIE11ElectronicsSim(nullptr),
71 theHBHEQIE11HitFilter(),
73 theHFQIE10HitFilter(),
77 theHBHEDigitizer(nullptr),
78 theHODigitizer(nullptr),
79 theHOSiPMDigitizer(nullptr),
80 theHFDigitizer(nullptr),
81 theZDCDigitizer(nullptr),
82 theHFQIE10Digitizer(nullptr),
83 theHBHEQIE11Digitizer(nullptr),
84 theRelabeller(nullptr),
91 doHFWindow_(ps.getParameter<bool>(
"doHFWindow")),
92 killHE_(ps.getParameter<bool>(
"killHE")),
93 debugCS_(ps.getParameter<bool>(
"debugCaloSamples")),
94 ignoreTime_(ps.getParameter<bool>(
"ignoreGeantTime")),
95 injectTestHits_(ps.getParameter<bool>(
"injectTestHits")),
96 hitsProducer_(ps.getParameter<std::
string>(
"hitsProducer")),
97 theHOSiPMCode(ps.getParameter<edm::
ParameterSet>(
"ho").getParameter<int>(
"siPMCode")),
99 agingFlagHB(ps.getParameter<bool>(
"HBDarkening")),
100 agingFlagHE(ps.getParameter<bool>(
"HEDarkening")),
101 m_HBDarkening(nullptr),
102 m_HEDarkening(nullptr),
103 m_HFRecalibration(nullptr),
104 injectedHitsEnergy_(ps.getParameter<std::
vector<double>>(
"injectTestHitsEnergy")),
105 injectedHitsTime_(ps.getParameter<std::
vector<double>>(
"injectTestHitsTime")),
106 injectedHitsCells_(ps.getParameter<std::
vector<int>>(
"injectTestHitsCells")) {
122 bool PreMix1 = ps.
getParameter<
bool>(
"HcalPreMixStage1");
123 bool PreMix2 = ps.
getParameter<
bool>(
"HcalPreMixStage2");
126 bool agingFlagHF = ps.
getParameter<
bool>(
"HFDarkening");
127 double minFCToDelay = ps.
getParameter<
double>(
"minFCToDelay");
129 if (PreMix1 && PreMix2) {
130 throw cms::Exception(
"Configuration") <<
"HcalDigitizer cannot operate in PreMixing digitization and "
132 "digi combination modes at the same time. Please set one mode to "
134 "in the configuration file.";
150 std::make_unique<HcalElectronicsSim>(&
theParameterMap, theHFAmplifier.get(), theCoderFactory.get(), PreMix1);
152 std::make_unique<HcalElectronicsSim>(&
theParameterMap, theHOAmplifier.get(), theCoderFactory.get(), PreMix1);
154 std::make_unique<HcalElectronicsSim>(&
theParameterMap, theZDCAmplifier.get(), theCoderFactory.get(), PreMix1);
157 theHFQIE10Amplifier.get(),
158 theCoderFactory.get(),
162 theHBHEQIE11Amplifier.get(),
163 theCoderFactory.get(),
219 if (ps.getParameter<
bool>(
"doThermalNoise")) {
226 if (theHBHEDigitizer)
227 theHBHEDigitizer->setDebugCaloSamples(
true);
235 theHFDigitizer->setDebugCaloSamples(
true);
238 theZDCDigitizer->setDebugCaloSamples(
true);
345 edm::Handle<std::vector<PCaloHit>>
const &zdcHandle,
347 CLHEP::HepRandomEngine *engine,
351 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
354 std::vector<PCaloHit> hcalHits;
355 hcalHits.reserve(hcalHitsOrig.size());
368 for (
unsigned int i = 0;
i < hcalHitsOrig.size();
i++) {
372 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid
383 std::cout <<
"HcalDigitizer format " << hid.
oldFormat() <<
" for " << hid << std::endl;
387 std::cout <<
"Hit " <<
i <<
" out of " << hcalHits.size() <<
" " << std::hex <<
id.rawId() <<
" --> "
390 hcalHitsOrig[
i].setID(newid.
rawId());
391 hcalHits.push_back(hcalHitsOrig[
i]);
416 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
424 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
447 CLHEP::HepRandomEngine *engine) {
502 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
503 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
504 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
505 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
506 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
507 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
511 std::cout <<
"HCAL HBHE digis : " << hbheResult->size() << std::endl;
512 std::cout <<
"HCAL HO digis : " << hoResult->size() << std::endl;
513 std::cout <<
"HCAL HF digis : " << hfResult->size() << std::endl;
514 std::cout <<
"HCAL ZDC digis : " << zdcResult->size() << std::endl;
515 std::cout <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size() << std::endl;
516 std::cout <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size() << std::endl;
524 e.
put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
525 e.
put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
534 csResult->insert(csResult->end(),
561 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) {
697 if (qieTypes.
topo() ==
nullptr) {
701 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
703 if (qieType ==
QIE8) {
705 }
else if (qieType ==
QIE10) {
733 if (qieTypes.
topo() ==
nullptr) {
737 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
739 if (qieType ==
QIE8) {
741 }
else if (qieType ==
QIE11) {
775 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
779 if (mcParams.
topo() ==
nullptr) {
783 for (std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
786 zecotekDetIds.emplace_back(*detItr);
789 hamamatsuDetIds.emplace_back(*detItr);
822 for (
unsigned int ii = 0;
ii < hcalHits.size(); ++
ii) {
823 uint32_t tmpId = hcalHits[
ii].id();
827 bool darkened =
false;
846 hcalHits[
ii].setEnergy(hcalHits[
ii].
energy() * dweight);
HFHitFilter theHFQIE10HitFilter
std::vector< DetId > theHFQIE10DetIds
int bunchCrossing() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< int > injectedHitsCells_
HBHEHitFilter theHBHEHitFilter
std::vector< PCaloHit > PCaloHitContainer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void setQIE10NoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
std::vector< CaloSamples > CaloSamplesCollection
const HcalDDDRecConstants * theRecNumber
void setParameterMap(HcalSimParameterMap *map)
std::unique_ptr< CaloHitResponse > theHFResponse
uint16_t *__restrict__ id
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > theRecNumberToken
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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)
constexpr bool oldFormat() const
HOHitFilter theHOHitFilter
constexpr uint32_t rawId() const
get the raw id
std::unique_ptr< ZDCDigitizer > theZDCDigitizer
void darkening(std::vector< PCaloHit > &hcalHits)
std::unique_ptr< HcalHitRelabeller > theRelabeller
HFHitFilter theHFHitFilter
void checkGeometry(const edm::EventSetup &eventSetup)
const Item * getValues(DetId fId, bool throwOnFail=true) const
bool validHcal(const HcalDetId &id) const
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
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
bool getData(T &iHolder) const
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *)
std::vector< double > injectedHitsEnergy_
constexpr HcalSubdetector subdet() const
get the subdetector
void setQIE11NoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
void setHOZecotekDetIds(const std::vector< HcalDetId > &ids)
std::unique_ptr< HcalElectronicsSim > theHFQIE10ElectronicsSim
const HBHEDarkening * m_HEDarkening
std::unique_ptr< HcalElectronicsSim > theHFElectronicsSim
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)
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::ESGetToken< HBHEDarkening, HBHEDarkeningRecord > m_HEDarkeningToken
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
HcalSimParameterMap theParameterMap
std::unique_ptr< HcalElectronicsSim > theHBHEElectronicsSim
const edm::ESGetToken< HcalQIETypes, HcalQIETypesRcd > qieTypesToken_
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
Log< level::Info, false > LogInfo
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_
static const int SubdetectorId
void setHOHamamatsuDetIds(const std::vector< HcalDetId > &ids)
void setDbService(const HcalDbService *service)
std::vector< DetId > theHFQIE8DetIds
std::unique_ptr< QIE11Digitizer > theHBHEQIE11Digitizer
T getParameter(std::string const &) const
std::unique_ptr< QIE10Digitizer > theHFQIE10Digitizer
void setDetIds(const std::vector< DetId > &detIds)
unsigned int signalShape() const
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
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
std::vector< DetId > hbheCells
const HBHEDarkening * m_HBDarkening
std::unique_ptr< HcalElectronicsSim > theHOElectronicsSim
HBHEHitFilter theHBHEQIE11HitFilter
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
void setZDCNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
std::vector< DetId > theHBHEQIE8DetIds
std::unique_ptr< CaloHitResponse > theHFQIE10Response
edm::SortedCollection< HFDataFrame > HFDigiCollection
void accumulateCaloHits(edm::Handle< std::vector< PCaloHit >> const &hcalHits, edm::Handle< std::vector< PCaloHit >> const &zdcHits, int bunchCrossing, CLHEP::HepRandomEngine *, const HcalTopology *h)
edm::ESGetToken< HcalMCParams, HcalMCParamsRcd > mcParamsToken_
const edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
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)
std::vector< DetId > theHBHEQIE11DetIds
void setTopo(const HcalTopology *topo)
void setDbService(const HcalDbService *service)
edm::SortedCollection< HBHEDataFrame > HBHEDigiCollection
float degradation(float intlumi, int ieta, int lay) const
std::vector< PCaloHit > injectedHits_
const HcalTopology * topo() const
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *)
constexpr uint32_t newForm() const
void setHONoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
HcalDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
const edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > hcalTimeSlew_delay_token_