36 #include <boost/foreach.hpp>
39 namespace HcalDigitizerImpl {
41 template<
typename SIPMDIGITIZER>
42 void fillSiPMCells(std::vector<int> & siPMCells, SIPMDIGITIZER * siPMDigitizer)
44 std::vector<DetId> siPMDetIds;
45 siPMDetIds.reserve(siPMCells.size());
46 for(std::vector<int>::const_iterator idItr = siPMCells.begin();
47 idItr != siPMCells.end(); ++idItr)
49 siPMDetIds.emplace_back(*idItr);
51 siPMDigitizer->setDetIds(siPMDetIds);
56 template<
typename HPDDIGITIZER,
typename SIPMDIGITIZER>
58 HPDDIGITIZER * hpdDigitizer,
59 SIPMDIGITIZER * siPMDigitizer)
62 if(siPMDigitizer && hpdDigitizer)
64 std::vector<DetId> siPMDetIds = siPMDigitizer->detIds();
65 std::sort(siPMDetIds.begin(), siPMDetIds.end());
66 std::vector<DetId> sortedCells = allCells;
67 std::sort(sortedCells.begin(), sortedCells.end());
68 std::vector<DetId> hpdCells;
69 std::set_difference(sortedCells.begin(), sortedCells.end(),
70 siPMDetIds.begin(), siPMDetIds.end(),
71 std::back_inserter(hpdCells) );
72 hpdDigitizer->setDetIds(hpdCells);
76 if(siPMDigitizer) siPMDigitizer->setDetIds(allCells);
77 if(hpdDigitizer) hpdDigitizer->setDetIds(allCells);
88 theHBHESiPMResponse(0),
99 theUpgradeCoderFactory(0),
100 theHBHEElectronicsSim(0),
101 theHFElectronicsSim(0),
102 theHOElectronicsSim(0),
103 theZDCElectronicsSim(0),
104 theUpgradeHBHEElectronicsSim(0),
105 theUpgradeHFElectronicsSim(0),
107 theHFHitFilter(ps.getParameter<bool>(
"doHFWindow")),
112 theNoiseGenerator(0),
113 theNoiseHitGenerator(0),
115 theHBHESiPMDigitizer(0),
117 theHOSiPMDigitizer(0),
120 theHBHEUpgradeDigitizer(0),
121 theHFUpgradeDigitizer(0),
129 theHOSiPMCode(ps.getParameter<edm::
ParameterSet>(
"ho").getParameter<int>(
"siPMCode"))
137 double HBtp = ps.
getParameter<
double>(
"HBTuningParameter");
138 double HEtp = ps.
getParameter<
double>(
"HETuningParameter");
139 double HFtp = ps.
getParameter<
double>(
"HFTuningParameter");
140 double HOtp = ps.
getParameter<
double>(
"HOTuningParameter");
141 bool doHBHEUpgrade = ps.
getParameter<
bool>(
"HBHEUpgradeQIE");
142 bool doHFUpgrade = ps.
getParameter<
bool>(
"HFUpgradeQIE");
149 theHBHEAmplifier->setHBtuningParameter(HBtp);
150 theHBHEAmplifier->setHEtuningParameter(HEtp);
153 theHBHEAmplifier->setUseOldHB(useOldNoiseHB);
154 theHBHEAmplifier->setUseOldHE(useOldNoiseHE);
179 bool doHBHEHPD = hbSiPMCells.empty() || (hbSiPMCells[0] != 1);
181 bool doHBHESiPM = !hbSiPMCells.empty();
185 edm::LogInfo(
"HcalDigitizer") <<
"Set scale for HB towers";
190 bool changeResponse = ps.
getParameter<
bool>(
"ChangeResponse");
192 if (changeResponse) {
194 edm::LogInfo(
"HcalDigitizer") <<
"Set scale for HB towers from " << corrFileName;
223 if(doHBHEHPD && doHBHESiPM) {
299 <<
"HcalDigitizer requires the RandomNumberGeneratorService\n"
300 "which is not present in the configuration file. You must add the service\n"
301 "in the configuration file or remove the modules that require it.";
304 CLHEP::HepRandomEngine& engine = rng->
getEngine();
435 std::vector<PCaloHit> hcalHits = *hcalHandle.product();
463 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
471 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
537 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
538 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
539 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
540 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
541 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE upgrade digis : " << hbheupgradeResult->size();
542 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF upgrade digis : " << hfupgradeResult->size();
561 e.
put(hbheupgradeResult,
"HBHEUpgradeDigiCollection");
562 e.
put(hfupgradeResult,
"HFUpgradeDigiCollection");
614 if(zdcCells.empty())
zdcgeo =
false;
615 if(hbCells.empty() && heCells.empty())
hbhegeo =
false;
616 if(hoCells.empty())
hogeo =
false;
617 if(hfCells.empty())
hfgeo =
false;
646 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
653 if (mcParams.topo()==0) {
657 for(std::vector<DetId>::const_iterator detItr = allCells.begin();
658 detItr != allCells.end(); ++detItr) {
659 int shapeType = mcParams.getValues(*detItr)->signalShape();
661 zecotekDetIds.emplace_back(*detItr);
664 hamamatsuDetIds.emplace_back(*detItr);
void setNoiseHitGenerator(CaloVNoiseHitGenerator *generator)
int bunchCrossing() const
void setHOtuningParameter(double tp)
T getParameter(std::string const &) const
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
T getUntrackedParameter(std::string const &, T const &) const
HBHEHitFilter theHBHEHitFilter
void setParameterMap(HcalSimParameterMap *map)
void setDetIds(const std::vector< DetId > &detIds)
HcalElectronicsSim * theHFElectronicsSim
HBHEDigitizer * theHBHEDigitizer
HOHitFilter theHOHitFilter
CaloTDigitizer< HcalUpgradeDigitizerTraits > UpgradeDigitizer
void setRandomEngine(CLHEP::HepRandomEngine &engine)
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
void setUseOldHF(bool useOld)
void setTopo(const HcalTopology *topo) const
HFDigitizer * theHFDigitizer
HFHitFilter theHFHitFilter
void checkGeometry(const edm::EventSetup &eventSetup)
HcalSimParameterMap * theParameterMap
void setHFtuningParameter(double tp)
void setTimeSlewSim(const HcalTimeSlewSim *timeSlewSim)
void setPECorrection(const CaloVPECorrection *peCorrection)
if you want to correct the photoelectrons
HcalTimeSlewSim * theTimeSlewSim
void setADCPeds(const HcalPedestals *ADCPeds)
void setGeometry(const CaloGeometry *&theGeometry)
HcalAmplifier * theHFAmplifier
HcalDigitizer(const edm::ParameterSet &ps)
HcalElectronicsSim * theUpgradeHFElectronicsSim
void fillSiPMCells(std::vector< int > &siPMCells, SIPMDIGITIZER *siPMDigitizer)
HcalCoderFactory * theCoderFactory
HcalHitRelabeller * theRelabeller
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
HcalCoderFactory * theUpgradeCoderFactory
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
void setDbService(const HcalDbService *service)
UpgradeDigitizer * theHFUpgradeDigitizer
CaloTDigitizer< HFDigitizerTraits > HFDigitizer
void setHOZecotekDetIds(const std::vector< HcalDetId > &ids)
HcalAmplifier * theHBHEAmplifier
void setUseOldHO(bool useOld)
edm::SortedCollection< HODataFrame > HODigiCollection
CaloTDigitizer< ZDCDigitizerTraits > ZDCDigitizer
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.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void setRandomEngine(CLHEP::HepRandomEngine &engine)
need a shaper in order to set thermal noise
void setHFNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
void setRandomEngine(CLHEP::HepRandomEngine &engine)
std::vector< DetId > theHBHEDetIds
void buildHOSiPMCells(const std::vector< DetId > &allCells, const edm::EventSetup &eventSetup)
ZDCHitFilter theZDCHitFilter
HPDIonFeedbackSim * theIonFeedback
void fillChargeSums(MixCollection< PCaloHit > &hits)
CaloHitResponse * theHOResponse
HcalHitFilter theHOSiPMHitFilter
CaloHitResponse * theHOSiPMResponse
void setHBHEScale(std::string &)
void setNoiseSignalGenerator(CaloVNoiseSignalGenerator *generator)
ZDCDigitizer * theZDCDigitizer
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
edm::SortedCollection< HcalUpgradeDataFrame > HFUpgradeDigiCollection
std::vector< DetId > theHOHPDDetIds
edm::SortedCollection< HcalUpgradeDataFrame > HBHEUpgradeDigiCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
HcalHitCorrection * theHitCorrection
CaloHitResponse * theZDCResponse
void setNoiseSignalGenerator(const CaloVNoiseSignalGenerator *noiseSignalGenerator)
void accumulateCaloHits(edm::Handle< std::vector< PCaloHit > > const &hcalHits, edm::Handle< std::vector< PCaloHit > > const &zdcHits, int bunchCrossing)
HcalElectronicsSim * theZDCElectronicsSim
HcalElectronicsSim * theUpgradeHBHEElectronicsSim
void run(MixCollection< PCaloHit > &, DigiCollection &)
turns hits into digis
static const int SubdetectorId
void beginRun(const edm::EventSetup &es)
void process(std::vector< PCaloHit > &hcalHits)
CaloTDigitizer< HODigitizerTraits > HODigitizer
void accumulate(edm::Event const &e, edm::EventSetup const &c)
void setHOHamamatsuDetIds(const std::vector< HcalDetId > &ids)
HcalAmplifier * theHOAmplifier
void setDbService(const HcalDbService *service)
HcalElectronicsSim * theHBHEElectronicsSim
T const * product() const
void fillCells(std::vector< DetId > &allCells, HPDDIGITIZER *hpdDigitizer, SIPMDIGITIZER *siPMDigitizer)
CaloHitResponse * theHBHEResponse
HODigitizer * theHODigitizer
std::vector< DetId > theHOSiPMDetIds
const CaloGeometry * theGeometry
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
void setCholesky(const HcalCholeskyMatrices *Cholesky)
ESHandle< TrackerGeometry > geometry
CaloHitResponse * theHFResponse
HODigitizer * theHOSiPMDigitizer
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
void setZDCNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
HBHEDigitizer * theHBHESiPMDigitizer
edm::SortedCollection< HFDataFrame > HFDigiCollection
void setDetIds(const std::vector< DetId > &detIds)
void beginRun(edm::EventSetup const &es)
CaloHitResponse * theHBHESiPMResponse
void setRandomEngine(CLHEP::HepRandomEngine &engine)
void updateGeometry(const edm::EventSetup &eventSetup)
void setHBHENoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
CaloVNoiseHitGenerator * theNoiseHitGenerator
HcalAmplifier * theZDCAmplifier
void setDbService(const HcalDbService *service)
edm::SortedCollection< HBHEDataFrame > HBHEDigiCollection
void finalizeEvent(edm::Event &e, edm::EventSetup const &c)
UpgradeDigitizer * theHBHEUpgradeDigitizer
void setHONoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
CaloTDigitizer< HBHEDigitizerTraits > HBHEDigitizer
CaloVNoiseSignalGenerator * theNoiseGenerator