30 #include <boost/foreach.hpp>
44 theHBHESiPMResponse(new
HcalSiPMHitResponse(theParameterMap, theShapes, ps.getParameter<bool>(
"HcalPreMixStage1"))),
54 theHFQIE10Amplifier(0),
55 theHBHEQIE11Amplifier(0),
58 theHBHEElectronicsSim(0),
59 theHFElectronicsSim(0),
60 theHOElectronicsSim(0),
61 theZDCElectronicsSim(0),
62 theHFQIE10ElectronicsSim(0),
63 theHBHEQIE11ElectronicsSim(0),
65 theHBHEQIE11HitFilter(),
67 theHFQIE10HitFilter(),
73 theHOSiPMDigitizer(0),
76 theHFQIE10Digitizer(0),
77 theHBHEQIE11Digitizer(0),
85 doHFWindow_(ps.getParameter<bool>(
"doHFWindow")),
86 killHE_(ps.getParameter<bool>(
"killHE")),
87 debugCS_(ps.getParameter<bool>(
"debugCaloSamples")),
88 ignoreTime_(ps.getParameter<bool>(
"ignoreGeantTime")),
89 injectTestHits_(ps.getParameter<bool>(
"injectTestHits")),
90 hitsProducer_(ps.getParameter<std::
string>(
"hitsProducer")),
91 theHOSiPMCode(ps.getParameter<edm::
ParameterSet>(
"ho").getParameter<int>(
"siPMCode")),
95 injectedHitsEnergy_(ps.getParameter<std::vector<double>>(
"injectTestHitsEnergy")),
96 injectedHitsTime_(ps.getParameter<std::vector<double>>(
"injectTestHitsTime")),
97 injectedHitsCells_(ps.getParameter<std::vector<int>>(
"injectTestHitsCells"))
104 bool PreMix1 = ps.
getParameter<
bool>(
"HcalPreMixStage1");
105 bool PreMix2 = ps.
getParameter<
bool>(
"HcalPreMixStage2");
108 bool agingFlagHE = ps.
getParameter<
bool>(
"HEDarkening");
109 bool agingFlagHF = ps.
getParameter<
bool>(
"HFDarkening");
110 double minFCToDelay= ps.
getParameter<
double>(
"minFCToDelay");
112 if(PreMix1 && PreMix2) {
114 <<
"HcalDigitizer cannot operate in PreMixing digitization and PreMixing\n"
115 "digi combination modes at the same time. Please set one mode to False\n"
116 "in the configuration file.";
326 std::vector<PCaloHit> hcalHitsOrig = *hcalHandle.product();
328 std::vector<PCaloHit> hcalHits;
329 hcalHits.reserve(hcalHitsOrig.size());
342 for (
unsigned int i=0;
i< hcalHitsOrig.size();
i++) {
343 DetId id(hcalHitsOrig[
i].
id());
346 edm::LogError(
"HcalDigitizer") <<
"bad hcal id found in digitizer. Skipping " <<
id.rawId() <<
" " << hid << std::endl;
359 std::cout <<
"HcalDigitizer format " << hid.
oldFormat() <<
" for " << hid << std::endl;
365 hcalHitsOrig[
i].setID(newid.
rawId());
366 hcalHits.push_back(hcalHitsOrig[
i]);
385 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
393 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
442 std::unique_ptr<QIE10DigiCollection> hfQIE10Result(
449 std::unique_ptr<QIE11DigiCollection> hbheQIE11Result(
474 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
475 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
476 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
477 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
478 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size();
479 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size();
483 std::cout <<
"HCAL HBHE digis : " << hbheResult->size() << std::endl;
484 std::cout <<
"HCAL HO digis : " << hoResult->size() << std::endl;
485 std::cout <<
"HCAL HF digis : " << hfResult->size() << std::endl;
486 std::cout <<
"HCAL ZDC digis : " << zdcResult->size() << std::endl;
487 std::cout <<
"HCAL HF QIE10 digis : " << hfQIE10Result->size() << std::endl;
488 std::cout <<
"HCAL HBHE QIE11 digis : " << hbheQIE11Result->size() << std::endl;
496 e.
put(
std::move(hfQIE10Result),
"HFQIE10DigiCollection");
497 e.
put(
std::move(hbheQIE11Result),
"HBHEQIE11DigiCollection");
519 std::cout << std::endl <<
"========> HcalDigitizer e.put " << std::endl << std::endl;
570 if(zdcCells.empty())
zdcgeo =
false;
571 if(hbCells.empty() && heCells.empty())
hbhegeo =
false;
572 if(hoCells.empty())
hogeo =
false;
573 if(hfCells.empty())
hfgeo =
false;
599 std::vector<DetId> testCells;
610 if(testSubdet==
HcalBarrel) testCells = hbCells;
611 else if(testSubdet==
HcalEndcap) testCells = heCells;
612 else if(testSubdet==
HcalForward) testCells = hfCells;
613 else if(testSubdet==
HcalOuter) testCells = hoCells;
614 else throw cms::Exception(
"Configuration") <<
"Unknown subdet " << testSubdet <<
" for HCAL test hit injection";
620 for(
auto& aCell: testCells){
638 if (qieTypes.topo()==0) {
642 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
644 if(qieType ==
QIE8) {
646 }
else if(qieType ==
QIE10) {
677 if (qieTypes.topo()==0) {
681 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
683 if(qieType ==
QIE8) {
686 else if(qieType ==
QIE11) {
721 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
728 if (mcParams.topo()==0) {
732 for(std::vector<DetId>::const_iterator detItr = allCells.begin(); detItr != allCells.end(); ++detItr) {
733 int shapeType = mcParams.getValues(*detItr)->signalShape();
735 zecotekDetIds.emplace_back(*detItr);
738 hamamatsuDetIds.emplace_back(*detItr);
772 for (
unsigned int ii=0;
ii<hcalHits.size(); ++
ii) {
773 uint32_t tmpId = hcalHits[
ii].id();
777 bool darkened =
false;
794 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
void setGeometry(const CaloGeometry *&, const HcalDDDRecConstants *&)
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
virtual const CaloSimParameters & simParameters(const DetId &id) const
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
HcalElectronicsSim * theHFElectronicsSim
void buildHFQIECells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
HBHEDigitizer * theHBHEDigitizer
HcalElectronicsSim * theHBHEQIE11ElectronicsSim
HOHitFilter theHOHitFilter
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)
HcalAmplifier * theHFAmplifier
HcalCoderFactory * theCoderFactory
HcalHitRelabeller * theRelabeller
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
void setDbService(const HcalDbService *service)
void setIonFeedbackSim(HPDIonFeedbackSim *feedbackSim)
HcalAmplifier * theHBHEQIE11Amplifier
uint32_t rawId() const
get the raw id
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)
HcalAmplifier * theHBHEAmplifier
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
double getCorr(int ieta, int idepth, double lumi)
Creates electronics signals from hits.
void setHFNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
void buildHOSiPMCells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
ZDCHitFilter theZDCHitFilter
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
static const int SubdetectorId
void beginRun(const edm::EventSetup &es)
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)
HcalAmplifier * theHOAmplifier
std::vector< DetId > theHFQIE8DetIds
void setDbService(const HcalDbService *service)
HFRecalibration * m_HFRecalibration
HcalElectronicsSim * theHBHEElectronicsSim
T const * product() const
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
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
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
HEDarkening * m_HEDarkening
edm::SortedCollection< HFDataFrame > HFDigiCollection
void beginRun(edm::EventSetup const &es)
void setDebugCaloSamples(bool debug)
CaloHitResponse * theHBHESiPMResponse
CaloTDigitizer< HcalQIE10DigitizerTraits, CaloTDigitizerQIE1011Run > QIE10Digitizer
void updateGeometry(const edm::EventSetup &eventSetup)
float degradation(float intlumi, int ieta, int lay)
void setHBHENoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
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
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)