35 #include <boost/foreach.hpp>
38 namespace HcalDigitizerImpl {
40 template<
typename SIPMDIGITIZER>
41 void fillSiPMCells(
const vector<int> & siPMCells, SIPMDIGITIZER * siPMDigitizer)
43 std::vector<DetId> siPMDetIds;
44 siPMDetIds.reserve(siPMCells.size());
45 for(std::vector<int>::const_iterator idItr = siPMCells.begin();
46 idItr != siPMCells.end(); ++idItr)
48 siPMDetIds.push_back(
DetId(*idItr));
50 siPMDigitizer->setDetIds(siPMDetIds);
55 template<
typename HPDDIGITIZER,
typename SIPMDIGITIZER>
57 HPDDIGITIZER * hpdDigitizer,
58 SIPMDIGITIZER * siPMDigitizer)
61 if(siPMDigitizer && hpdDigitizer)
63 std::vector<DetId> siPMDetIds = siPMDigitizer->detIds();
64 std::sort(siPMDetIds.begin(), siPMDetIds.end());
65 std::vector<DetId> sortedCells = allCells;
66 std::sort(sortedCells.begin(), sortedCells.end());
67 std::vector<DetId> hpdCells;
68 std::set_difference(sortedCells.begin(), sortedCells.end(),
69 siPMDetIds.begin(), siPMDetIds.end(),
70 std::back_inserter(hpdCells) );
71 hpdDigitizer->setDetIds(hpdCells);
75 if(siPMDigitizer) siPMDigitizer->setDetIds(allCells);
76 if(hpdDigitizer) hpdDigitizer->setDetIds(allCells);
89 theHcalIntegratedShape(0),
90 theSiPMIntegratedShape(0),
94 theHBHESiPMResponse(0),
97 theHFResponse(new
CaloHitResponse(theParameterMap, theHFIntegratedShape)),
98 theZDCResponse(new
CaloHitResponse(theParameterMap, theZDCIntegratedShape)),
105 theHBHEElectronicsSim(0),
106 theHFElectronicsSim(0),
107 theHOElectronicsSim(0),
108 theZDCElectronicsSim(0),
110 theHFHitFilter(ps.getParameter<bool>(
"doHFWindow")),
115 theNoiseGenerator(0),
116 theNoiseHitGenerator(0),
118 theHBHESiPMDigitizer(0),
120 theHOSiPMDigitizer(0),
132 theHOSiPMCode(ps.getParameter<edm::
ParameterSet>(
"ho").getParameter<int>(
"siPMCode"))
140 double HBtp = ps.
getParameter<
double>(
"HBTuningParameter");
141 double HEtp = ps.
getParameter<
double>(
"HETuningParameter");
142 double HFtp = ps.
getParameter<
double>(
"HFTuningParameter");
143 double HOtp = ps.
getParameter<
double>(
"HOTuningParameter");
150 theHBHEAmplifier->setHBtuningParameter(HBtp);
151 theHBHEAmplifier->setHEtuningParameter(HEtp);
154 theHBHEAmplifier->setUseOldHB(useOldNoiseHB);
155 theHBHEAmplifier->setUseOldHE(useOldNoiseHE);
170 bool doHBHEHPD = hbSiPMCells.empty() || (hbSiPMCells[0] != 1);
172 bool doHBHESiPM = !hbSiPMCells.empty();
175 if(doHBHEHPD || doHOHPD )
180 if(doHBHESiPM || doHOSiPM )
213 if(doHBHEHPD && doHBHESiPM)
268 <<
"HcalDigitizer requires the RandomNumberGeneratorService\n"
269 "which is not present in the configuration file. You must add the service\n"
270 "in the configuration file or remove the modules that require it.";
273 CLHEP::HepRandomEngine& engine = rng->
getEngine();
400 edm::LogInfo(
"HcalDigitizer") <<
"We don't have ZDC hit collection available ";
410 edm::LogInfo(
"HcalDigitizer") <<
"We don't have HCAL hit collection available ";
443 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HBHE digis : " << hbheResult->size();
444 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HO digis : " << hoResult->size();
445 edm::LogInfo(
"HcalDigitizer") <<
"HCAL HF digis : " << hfResult->size();
446 edm::LogInfo(
"HcalDigitizer") <<
"HCAL ZDC digis : " << zdcResult->size();
486 if(zdcCells.empty())
zdcgeo =
false;
487 if(hbCells.empty() && heCells.empty())
hbhegeo =
false;
488 if(hoCells.empty())
hogeo =
false;
489 if(hfCells.empty())
hfgeo =
false;
518 std::vector<HcalDetId> zecotekDetIds;
519 std::vector<HcalDetId> hamamatsuDetIds;
520 for(std::vector<DetId>::const_iterator detItr = allCells.begin();
521 detItr != allCells.end(); ++detItr)
524 int ieta = hcalId.
ieta();
525 int iphi = hcalId.
iphi();
526 if ((ieta>=5 && ieta <= 10 ) && (iphi >=47 && iphi <=52))
528 zecotekDetIds.push_back(hcalId);
531 else if(((ieta>=5 && ieta <= 10 ) && (iphi >=53 && iphi <=58))
532 || ((ieta>=11 && ieta <= 15 ) && (iphi >=59 && iphi <=70))){
533 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
void setShape(const CaloVShape *shape)
need a shaper in order to set thermal noise
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)
CaloVShape * theZDCIntegratedShape
void setPECorrection(const CaloVPECorrection *peCorrection)
if you want to correct the photoelectrons
void setADCPeds(const HcalPedestals *ADCPeds)
CaloVShape * theHcalIntegratedShape
HcalAmplifier * theHFAmplifier
HcalDigitizer(const edm::ParameterSet &ps)
HcalCoderFactory * theCoderFactory
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
CaloTDigitizer< HFDigitizerTraits > HFDigitizer
void setHOZecotekDetIds(const std::vector< HcalDetId > &ids)
CaloVShape * theSiPMIntegratedShape
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)
void setHFNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
std::vector< DetId > theHBHEDetIds
void run(MixCollection< PCaloHit > &input, DigiCollection &output)
turns hits into digis
CaloVShape * theSiPMShape
ZDCHitFilter theZDCHitFilter
HPDIonFeedbackSim * theIonFeedback
void fillChargeSums(MixCollection< PCaloHit > &hits)
int ieta() const
get the cell ieta
CaloHitResponse * theHOResponse
HcalHitFilter theHOSiPMHitFilter
CaloHitResponse * theHOSiPMResponse
void setNoiseSignalGenerator(CaloVNoiseSignalGenerator *generator)
shaper for Hcal (not for HF)
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)
int iphi() const
get the cell iphi
HcalElectronicsSim * theZDCElectronicsSim
static const int SubdetectorId
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
void setHitCorrection(const CaloVHitCorrection *hitCorrection)
If you want to correct hits, for attenuation or delay, set this.
HODigitizer * theHOSiPMDigitizer
void setZDCNoiseSignalGenerator(HcalBaseSignalGenerator *noiseGenerator)
HBHEDigitizer * theHBHESiPMDigitizer
edm::SortedCollection< HFDataFrame > HFDigiCollection
CaloVShape * theHFIntegratedShape
void setDetIds(const std::vector< DetId > &detIds)
void buildHOSiPMCells(const std::vector< DetId > &allCells)
CaloHitResponse * theHBHESiPMResponse
void setRandomEngine(CLHEP::HepRandomEngine &engine)
CaloVShape * theHcalShape
virtual 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