34 #include <boost/foreach.hpp>
37 namespace HcalDigitizerImpl {
39 template<
typename SIPMDIGITIZER>
40 void fillSiPMCells(
const vector<int> & siPMCells, SIPMDIGITIZER * siPMDigitizer)
42 std::vector<DetId> siPMDetIds;
43 siPMDetIds.reserve(siPMCells.size());
44 for(std::vector<int>::const_iterator idItr = siPMCells.begin();
45 idItr != siPMCells.end(); ++idItr)
47 siPMDetIds.push_back(
DetId(*idItr));
49 siPMDigitizer->setDetIds(siPMDetIds);
54 template<
typename HPDDIGITIZER,
typename SIPMDIGITIZER>
56 HPDDIGITIZER * hpdDigitizer,
57 SIPMDIGITIZER * siPMDigitizer)
60 if(siPMDigitizer && hpdDigitizer)
62 std::vector<DetId> siPMDetIds = siPMDigitizer->detIds();
63 std::sort(siPMDetIds.begin(), siPMDetIds.end());
64 std::vector<DetId> sortedCells = allCells;
65 std::sort(sortedCells.begin(), sortedCells.end());
66 std::vector<DetId> hpdCells;
67 std::set_difference(sortedCells.begin(), sortedCells.end(),
68 siPMDetIds.begin(), siPMDetIds.end(),
69 std::back_inserter(hpdCells) );
70 hpdDigitizer->setDetIds(hpdCells);
74 if(siPMDigitizer) siPMDigitizer->setDetIds(allCells);
75 if(hpdDigitizer) hpdDigitizer->setDetIds(allCells);
86 theHBHESiPMResponse(0),
97 theHBHEElectronicsSim(0),
98 theHFElectronicsSim(0),
99 theHOElectronicsSim(0),
100 theZDCElectronicsSim(0),
102 theHFHitFilter(ps.getParameter<bool>(
"doHFWindow")),
107 theNoiseGenerator(0),
108 theNoiseHitGenerator(0),
110 theHBHESiPMDigitizer(0),
112 theHOSiPMDigitizer(0),
124 theHOSiPMCode(ps.getParameter<edm::
ParameterSet>(
"ho").getParameter<int>(
"siPMCode"))
132 double HBtp = ps.
getParameter<
double>(
"HBTuningParameter");
133 double HEtp = ps.
getParameter<
double>(
"HETuningParameter");
134 double HFtp = ps.
getParameter<
double>(
"HFTuningParameter");
135 double HOtp = ps.
getParameter<
double>(
"HOTuningParameter");
142 theHBHEAmplifier->setHBtuningParameter(HBtp);
143 theHBHEAmplifier->setHEtuningParameter(HEtp);
146 theHBHEAmplifier->setUseOldHB(useOldNoiseHB);
147 theHBHEAmplifier->setUseOldHE(useOldNoiseHE);
162 bool doHBHEHPD = hbSiPMCells.empty() || (hbSiPMCells[0] != 1);
164 bool doHBHESiPM = !hbSiPMCells.empty();
193 if(doHBHEHPD && doHBHESiPM)
252 <<
"HcalDigitizer requires the RandomNumberGeneratorService\n"
253 "which is not present in the configuration file. You must add the service\n"
254 "in the configuration file or remove the modules that require it.";
257 CLHEP::HepRandomEngine& engine = rng->
getEngine();
373 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
383 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
416 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
417 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
418 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
419 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
475 if(zdcCells.empty())
zdcgeo =
false;
476 if(hbCells.empty() && heCells.empty())
hbhegeo =
false;
477 if(hoCells.empty())
hogeo =
false;
478 if(hfCells.empty())
hfgeo =
false;
507 std::vector<HcalDetId> zecotekDetIds, hamamatsuDetIds;
511 for(std::vector<DetId>::const_iterator detItr = allCells.begin();
512 detItr != allCells.end(); ++detItr)
515 int shapeType = mcParams.getValues(*detItr)->signalShape();
517 zecotekDetIds.push_back(hcalId);
521 hamamatsuDetIds.push_back(hcalId);
void setNoiseHitGenerator(CaloVNoiseHitGenerator *generator)
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
HBHEHitFilter theHBHEHitFilter
void setParameterMap(HcalSimParameterMap *map)
void setDetIds(const std::vector< DetId > &detIds)
HcalElectronicsSim * theHFElectronicsSim
HBHEDigitizer * theHBHEDigitizer
HOHitFilter theHOHitFilter
void setRandomEngine(CLHEP::HepRandomEngine &engine)
void setUseOldHF(bool useOld)
HFDigitizer * theHFDigitizer
HFHitFilter theHFHitFilter
void checkGeometry(const edm::EventSetup &eventSetup)
HcalSimParameterMap * theParameterMap
void fillSiPMCells(const vector< int > &siPMCells, SIPMDIGITIZER *siPMDigitizer)
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)
HcalAmplifier * theHFAmplifier
HcalDigitizer(const edm::ParameterSet &ps)
HcalCoderFactory * theCoderFactory
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
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 run(MixCollection< PCaloHit > &input, DigiCollection &output)
turns hits into digis
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 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...
std::vector< DetId > theHOHPDDetIds
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
HcalHitCorrection * theHitCorrection
CaloHitResponse * theZDCResponse
void setNoiseSignalGenerator(const CaloVNoiseSignalGenerator *noiseSignalGenerator)
void fillCells(const vector< DetId > &allCells, HPDDIGITIZER *hpdDigitizer, SIPMDIGITIZER *siPMDigitizer)
HcalElectronicsSim * theZDCElectronicsSim
static const int SubdetectorId
void beginRun(const edm::EventSetup &es)
CaloTDigitizer< HODigitizerTraits > HODigitizer
void setHOHamamatsuDetIds(const std::vector< HcalDetId > &ids)
HcalAmplifier * theHOAmplifier
void setDbService(const HcalDbService *service)
HcalElectronicsSim * theHBHEElectronicsSim
T const * product() const
CaloHitResponse * theHBHEResponse
HODigitizer * theHODigitizer
T const * product() const
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
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 produce(edm::Event &e, const edm::EventSetup &c)
void setHBHENoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
CaloVNoiseHitGenerator * theNoiseHitGenerator
HcalAmplifier * theZDCAmplifier
void setDbService(const HcalDbService *service)
edm::SortedCollection< HBHEDataFrame > HBHEDigiCollection
void setHONoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
CaloTDigitizer< HBHEDigitizerTraits > HBHEDigitizer
CaloVNoiseSignalGenerator * theNoiseGenerator