27 #include <boost/foreach.hpp> 61 theHFQIE10ElectronicsSim(
nullptr),
62 theHBHEQIE11ElectronicsSim(
nullptr),
64 theHBHEQIE11HitFilter(),
66 theHFQIE10HitFilter(),
84 doHFWindow_(ps.getParameter<
bool>(
"doHFWindow")),
85 killHE_(ps.getParameter<
bool>(
"killHE")),
86 debugCS_(ps.getParameter<
bool>(
"debugCaloSamples")),
87 ignoreTime_(ps.getParameter<
bool>(
"ignoreGeantTime")),
88 injectTestHits_(ps.getParameter<
bool>(
"injectTestHits")),
89 hitsProducer_(ps.getParameter<
std::
string>(
"hitsProducer")),
92 agingFlagHB(ps.getParameter<
bool>(
"HBDarkening")),
93 agingFlagHE(ps.getParameter<
bool>(
"HEDarkening")),
97 injectedHitsEnergy_(ps.getParameter<
std::vector<double>>(
"injectTestHitsEnergy")),
98 injectedHitsTime_(ps.getParameter<
std::vector<double>>(
"injectTestHitsTime")),
99 injectedHitsCells_(ps.getParameter<
std::vector<
int>>(
"injectTestHitsCells"))
106 bool PreMix1 = ps.
getParameter<
bool>(
"HcalPreMixStage1");
107 bool PreMix2 = ps.
getParameter<
bool>(
"HcalPreMixStage2");
110 bool agingFlagHF = ps.
getParameter<
bool>(
"HFDarkening");
113 if(PreMix1 && PreMix2) {
115 <<
"HcalDigitizer cannot operate in PreMixing digitization and PreMixing\n" 116 "digi combination modes at the same time. Please set one mode to False\n" 117 "in the configuration file.";
131 theHFElectronicsSim = std::make_unique<HcalElectronicsSim>(theHFAmplifier.get(), theCoderFactory.get(), PreMix1);
132 theHOElectronicsSim = std::make_unique<HcalElectronicsSim>(theHOAmplifier.get(), theCoderFactory.get(), PreMix1);
133 theZDCElectronicsSim = std::make_unique<HcalElectronicsSim>(theZDCAmplifier.get(), theCoderFactory.get(), PreMix1);
134 theHFQIE10ElectronicsSim = std::make_unique<HcalElectronicsSim>(theHFQIE10Amplifier.get(), theCoderFactory.get(), PreMix1);
135 theHBHEQIE11ElectronicsSim = std::make_unique<HcalElectronicsSim>(theHBHEQIE11Amplifier.get(), theCoderFactory.get(), PreMix1);
186 if(ps.getParameter<
bool>(
"doThermalNoise")) {
193 if(theHBHEDigitizer) theHBHEDigitizer->setDebugCaloSamples(
true);
197 if(theHFDigitizer) theHFDigitizer->setDebugCaloSamples(
true);
199 theZDCDigitizer->setDebugCaloSamples(
true);
301 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
303 std::vector<PCaloHit> hcalHits;
304 hcalHits.reserve(hcalHitsOrig.size());
317 for (
unsigned int i=0;
i< hcalHitsOrig.size();
i++) {
321 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid << std::endl;
334 std::cout <<
"HcalDigitizer format " << hid.
oldFormat() <<
" for " << hid << std::endl;
340 hcalHitsOrig[
i].setID(newid.
rawId());
341 hcalHits.push_back(hcalHitsOrig[
i]);
360 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
368 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
417 std::unique_ptr<QIE10DigiCollection> hfQIE10Result(
424 std::unique_ptr<QIE11DigiCollection> hbheQIE11Result(
450 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
451 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
452 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
453 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
454 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
455 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
459 std::cout <<
"HCAL HBHE digis : " << hbheResult->size() << std::endl;
460 std::cout <<
"HCAL HO digis : " << hoResult->size() << std::endl;
461 std::cout <<
"HCAL HF digis : " << hfResult->size() << std::endl;
462 std::cout <<
"HCAL ZDC digis : " << zdcResult->size() << std::endl;
463 std::cout <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size() << std::endl;
464 std::cout <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size() << std::endl;
472 e.
put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
473 e.
put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
495 std::cout << std::endl <<
"========> HcalDigitizer e.put " << std::endl << std::endl;
546 if (check1
or check2) {
561 if(zdcCells.empty())
zdcgeo =
false;
562 if(hbCells.empty() && heCells.empty())
hbhegeo =
false;
563 if(hoCells.empty())
hogeo =
false;
564 if(hfCells.empty())
hfgeo =
false;
590 std::vector<DetId> testCells;
601 if(testSubdet==
HcalBarrel) testCells = hbCells;
602 else if(testSubdet==
HcalEndcap) testCells = heCells;
603 else if(testSubdet==
HcalForward) testCells = hfCells;
604 else if(testSubdet==
HcalOuter) testCells = hoCells;
605 else throw cms::Exception(
"Configuration") <<
"Unknown subdet " << testSubdet <<
" for HCAL test hit injection";
611 for(
auto& aCell: testCells){
629 if (qieTypes.topo()==
nullptr) {
633 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
635 if(qieType ==
QIE8) {
637 }
else if(qieType ==
QIE10) {
666 if (qieTypes.topo()==
nullptr) {
670 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
672 if(qieType ==
QIE8) {
675 else if(qieType ==
QIE11) {
708 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
715 if (mcParams.topo()==
nullptr) {
719 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
720 int shapeType = mcParams.getValues(*detItr)->signalShape();
722 zecotekDetIds.emplace_back(*detItr);
725 hamamatsuDetIds.emplace_back(*detItr);
757 for (
unsigned int ii=0;
ii<hcalHits.size(); ++
ii) {
758 uint32_t tmpId = hcalHits[
ii].id();
762 bool darkened =
false;
782 if(darkened) hcalHits[
ii].setEnergy(hcalHits[
ii].energy()*dweight);
HFHitFilter theHFQIE10HitFilter
std::vector< DetId > theHFQIE10DetIds
int bunchCrossing() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
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)
HcalSubdetector subdet() const
get the subdetector
std::unique_ptr< CaloHitResponse > theHFResponse
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)
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)
bool validHcal(const HcalDetId &id) const
void buildHBHEQIECells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
std::unique_ptr< HFDigitizer > theHFDigitizer
std::unique_ptr< HODigitizer > theHODigitizer
std::unique_ptr< HcalAmplifier > theHFAmplifier
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
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
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *)
std::vector< double > injectedHitsEnergy_
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)
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
int readoutFrameSize() const
for now, the LinearFrames and trhe digis will be one-to-one.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
HcalSimParameterMap theParameterMap
std::unique_ptr< HcalElectronicsSim > theHBHEElectronicsSim
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
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 accumulateCaloHits(edm::Handle< std::vector< PCaloHit > > const &hcalHits, edm::Handle< std::vector< PCaloHit > > const &zdcHits, int bunchCrossing, CLHEP::HepRandomEngine *, const HcalTopology *h)
void setDbService(const HcalDbService *service)
std::vector< DetId > theHFQIE8DetIds
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
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
std::vector< DetId > hbheCells
std::vector< std::vector< double > > tmp
ESHandle< TrackerGeometry > geometry
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
std::unique_ptr< HcalAmplifier > theHFQIE10Amplifier
const CaloSimParameters & simParameters(const DetId &id) const override
std::unique_ptr< HcalElectronicsSim > theHBHEQIE11ElectronicsSim
void updateGeometry(const edm::EventSetup &eventSetup)
void setHBHENoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
void setup(const edm::EventSetup &es)
T const * product() const
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_
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *)
void setHONoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
HcalDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)