29 #include <boost/foreach.hpp> 63 theHFQIE10ElectronicsSim(
nullptr),
64 theHBHEQIE11ElectronicsSim(
nullptr),
66 theHBHEQIE11HitFilter(),
68 theHFQIE10HitFilter(),
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")),
99 injectedHitsEnergy_(ps.getParameter<
std::vector<double>>(
"injectTestHitsEnergy")),
100 injectedHitsTime_(ps.getParameter<
std::vector<double>>(
"injectTestHitsTime")),
101 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) {
117 <<
"HcalDigitizer cannot operate in PreMixing digitization and PreMixing\n" 118 "digi combination modes at the same time. Please set one mode to False\n" 119 "in the configuration file.";
334 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
336 std::vector<PCaloHit> hcalHits;
337 hcalHits.reserve(hcalHitsOrig.size());
350 for (
unsigned int i=0;
i< hcalHitsOrig.size();
i++) {
354 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid << std::endl;
367 std::cout <<
"HcalDigitizer format " << hid.
oldFormat() <<
" for " << hid << std::endl;
373 hcalHitsOrig[
i].setID(newid.
rawId());
374 hcalHits.push_back(hcalHitsOrig[
i]);
393 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
401 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
450 std::unique_ptr<QIE10DigiCollection> hfQIE10Result(
457 std::unique_ptr<QIE11DigiCollection> hbheQIE11Result(
483 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
484 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
485 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
486 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
487 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
488 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
492 std::cout <<
"HCAL HBHE digis : " << hbheResult->size() << std::endl;
493 std::cout <<
"HCAL HO digis : " << hoResult->size() << std::endl;
494 std::cout <<
"HCAL HF digis : " << hfResult->size() << std::endl;
495 std::cout <<
"HCAL ZDC digis : " << zdcResult->size() << std::endl;
496 std::cout <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size() << std::endl;
497 std::cout <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size() << std::endl;
505 e.
put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
506 e.
put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
528 std::cout << std::endl <<
"========> HcalDigitizer e.put " << std::endl << std::endl;
579 if (check1
or check2) {
594 if(zdcCells.empty())
zdcgeo =
false;
595 if(hbCells.empty() && heCells.empty())
hbhegeo =
false;
596 if(hoCells.empty())
hogeo =
false;
597 if(hfCells.empty())
hfgeo =
false;
623 std::vector<DetId> testCells;
634 if(testSubdet==
HcalBarrel) testCells = hbCells;
635 else if(testSubdet==
HcalEndcap) testCells = heCells;
636 else if(testSubdet==
HcalForward) testCells = hfCells;
637 else if(testSubdet==
HcalOuter) testCells = hoCells;
638 else throw cms::Exception(
"Configuration") <<
"Unknown subdet " << testSubdet <<
" for HCAL test hit injection";
644 for(
auto& aCell: testCells){
662 if (qieTypes.topo()==
nullptr) {
666 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
668 if(qieType ==
QIE8) {
670 }
else if(qieType ==
QIE10) {
701 if (qieTypes.topo()==
nullptr) {
705 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
707 if(qieType ==
QIE8) {
710 else if(qieType ==
QIE11) {
745 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
752 if (mcParams.topo()==
nullptr) {
756 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
757 int shapeType = mcParams.getValues(*detItr)->signalShape();
759 zecotekDetIds.emplace_back(*detItr);
762 hamamatsuDetIds.emplace_back(*detItr);
796 for (
unsigned int ii=0;
ii<hcalHits.size(); ++
ii) {
797 uint32_t tmpId = hcalHits[
ii].id();
801 bool darkened =
false;
821 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)
QIE10Digitizer * theHFQIE10Digitizer
T getParameter(std::string const &) const
std::vector< int > injectedHitsCells_
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
HBHEHitFilter theHBHEHitFilter
CaloHitResponse * theHFQIE10Response
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 add(const std::vector< PCaloHit > &hits, int bunchCrossing, CLHEP::HepRandomEngine *engine)
void setParameterMap(HcalSimParameterMap *map)
HcalSubdetector subdet() const
get the subdetector
HcalElectronicsSim * theHFElectronicsSim
void buildHFQIECells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
HBHEDigitizer * theHBHEDigitizer
HcalElectronicsSim * theHBHEQIE11ElectronicsSim
HOHitFilter theHOHitFilter
constexpr uint32_t rawId() const
get the raw id
void darkening(std::vector< PCaloHit > &hcalHits)
HFDigitizer * theHFDigitizer
HFHitFilter theHFHitFilter
CaloTDigitizer< HODigitizerTraits, CaloTDigitizerQIE8Run > HODigitizer
void checkGeometry(const edm::EventSetup &eventSetup)
HcalSimParameterMap * theParameterMap
bool validHcal(const HcalDetId &id) const
void setPECorrection(const CaloVPECorrection *peCorrection)
if you want to correct the photoelectrons
CaloTDigitizer< HBHEDigitizerTraits, CaloTDigitizerQIE8Run > HBHEDigitizer
HcalTimeSlewSim * theTimeSlewSim
void buildHBHEQIECells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
void setGeometry(const HcalDDDRecConstants *&)
HcalAmplifier * theHFAmplifier
HcalCoderFactory * theCoderFactory
HcalHitRelabeller * theRelabeller
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
std::unique_ptr< HFRecalibration > m_HFRecalibration
void setDbService(const HcalDbService *service)
void setIonFeedbackSim(HPDIonFeedbackSim *feedbackSim)
HcalAmplifier * theHBHEQIE11Amplifier
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)
const HBHEDarkening * m_HEDarkening
HcalAmplifier * theHBHEAmplifier
edm::ESWatcher< HcalRecNumberingRecord > theRecNumberWatcher_
edm::SortedCollection< HODataFrame > HODigiCollection
std::string hitsProducer_
HcalElectronicsSim * theHOElectronicsSim
void setElectronicsSim(HcalElectronicsSim *electronicsSim)
void setHitFilter(const CaloVHitFilter *filter)
if you want to reject hits, for example, from a certain subdetector, set this
Creates electronics signals from hits.
const HcalTimeSlew * hcalTimeSlew_delay_
void setHFNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
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
void setTimeSlew(const HcalTimeSlew *timeSlew)
HPDIonFeedbackSim * theIonFeedback
CaloTDigitizer< ZDCDigitizerTraits, CaloTDigitizerQIE8Run > ZDCDigitizer
CaloHitResponse * theHOResponse
CaloHitResponse * theHOSiPMResponse
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
std::vector< double > injectedHitsTime_
ZDCDigitizer * theZDCDigitizer
static const size_type MAXSAMPLES
void setNoiseSignalGenerator(CaloVNoiseSignalGenerator *generator)
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
CaloHitResponse * theZDCResponse
CaloTDigitizer< HFDigitizerTraits, CaloTDigitizerQIE8Run > HFDigitizer
void setNoiseSignalGenerator(const CaloVNoiseSignalGenerator *noiseSignalGenerator)
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
HcalElectronicsSim * theZDCElectronicsSim
edm::ESWatcher< CaloGeometryRecord > theGeometryWatcher_
static const int SubdetectorId
void process(std::vector< PCaloHit > &hcalHits)
void setTimeSlewSim(HcalTimeSlewSim *timeSlewSim)
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)
HcalAmplifier * theHOAmplifier
std::vector< DetId > theHFQIE8DetIds
void setDbService(const HcalDbService *service)
HcalElectronicsSim * theHBHEElectronicsSim
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
CaloHitResponse * theHBHEResponse
HODigitizer * theHODigitizer
void setDetIds(const std::vector< DetId > &detIds)
std::vector< DetId > theHOSiPMDetIds
HOHitFilter theHOSiPMHitFilter
bool check(const edm::EventSetup &iSetup)
const CaloGeometry * theGeometry
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
CaloHitResponse * theHFResponse
CaloTDigitizer< HcalQIE11DigitizerTraits, CaloTDigitizerQIE1011Run > QIE11Digitizer
HcalElectronicsSim * theHFQIE10ElectronicsSim
HODigitizer * theHOSiPMDigitizer
QIE11Digitizer * theHBHEQIE11Digitizer
HBHEHitFilter theHBHEQIE11HitFilter
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
void setZDCNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
std::vector< DetId > theHBHEQIE8DetIds
edm::SortedCollection< HFDataFrame > HFDigiCollection
void setDebugCaloSamples(bool debug)
CaloHitResponse * theHBHESiPMResponse
const CaloSimParameters & simParameters(const DetId &id) const override
CaloTDigitizer< HcalQIE10DigitizerTraits, CaloTDigitizerQIE1011Run > QIE10Digitizer
void updateGeometry(const edm::EventSetup &eventSetup)
void setHBHENoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
void setup(const edm::EventSetup &es)
T const * product() const
HcalAmplifier * theZDCAmplifier
std::vector< DetId > theHBHEQIE11DetIds
const CaloSamplesCollection & getCaloSamples() const
void setTopo(const HcalTopology *topo)
void setDbService(const HcalDbService *service)
void setDetIds(const std::vector< DetId > &detIds)
void setIgnoreGeantTime(bool gt)
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 *)
HcalAmplifier * theHFQIE10Amplifier
void setHONoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
HcalDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)