21 EBdigiCollectionToken_( consumes<
EBDigiCollection>( ps.getParameter<
edm::InputTag>(
"EBdigiCollection" ) ) ),
22 EEdigiCollectionToken_( consumes<
EEDigiCollection>( ps.getParameter<
edm::InputTag>(
"EEdigiCollection" ) ) ),
23 ESdigiCollectionToken_( consumes<
ESDigiCollection>( ps.getParameter<
edm::InputTag>(
"ESdigiCollection" ) ) ),
54 doPhotostatistics =
false;
57 photoelectronsToAnalogBarrel, photoelectronsToAnalogEndcap,
58 samplingFactor, timePhase, readoutFrameSize, binOfMaximum,
59 doPhotostatistics, syncPhase);
149 sprintf (histo,
"EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC" ) ;
152 sprintf (histo,
"EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC" ) ;
155 sprintf (histo,
"EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun" ) ;
158 sprintf (histo,
"EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun" ) ;
161 sprintf (histo,
"EcalDigiTask Barrel bunch crossing" ) ;
164 sprintf (histo,
"EcalDigiTask Endcap bunch crossing" ) ;
167 sprintf (histo,
"EcalDigiTask Preshower bunch crossing" ) ;
172 sprintf (histo,
"EcalDigiTask Barrel shape bunch crossing %02d",
i-10 );
175 sprintf (histo,
"EcalDigiTask Endcap shape bunch crossing %02d",
i-10 );
178 sprintf (histo,
"EcalDigiTask Preshower shape bunch crossing %02d",
i-10 );
183 sprintf (histo,
"EcalDigiTask Barrel shape digi");
186 sprintf (histo,
"EcalDigiTask Endcap shape digi");
189 sprintf (histo,
"EcalDigiTask Preshower shape digi");
192 sprintf (histo,
"EcalDigiTask Barrel shape digi ratio");
195 sprintf (histo,
"EcalDigiTask Endcap shape digi ratio");
198 sprintf (histo,
"EcalDigiTask Preshower shape digi ratio");
207 std::vector<MonitorElement *> theBunches;
232 std::vector<double> bunchSum;
233 bunchSum.reserve(nSample);
234 std::vector<double> bunchSumErro;
235 bunchSumErro.reserve(nSample);
236 std::vector<double>
total;
237 total.reserve(nSample);
238 std::vector<double> totalErro;
239 totalErro.reserve(nSample);
240 std::vector<double>
ratio;
241 ratio.reserve(nSample);
242 std::vector<double> ratioErro;
243 ratioErro.reserve(nSample);
246 for (
int iEl = 0 ; iEl < nSample ; iEl++ ) {
248 bunchSumErro[iEl] = 0.;
255 for (
int iSample = 0 ; iSample < nSample ; iSample++ ) {
258 totalErro[iSample] += theTotal->
getBinError(iSample+1);
264 bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample+1);
265 bunchSumErro[iSample] +=
pow(theBunches[iHisto]->getBinError(iSample+1),2);
268 bunchSumErro[iSample] =
sqrt(bunchSumErro[iSample]);
270 if ( bunchSum[iSample] > 0. ) {
271 ratio[iSample] = total[iSample]/bunchSum[iSample];
272 ratioErro[iSample] =
sqrt(
pow(totalErro[iSample]/bunchSum[iSample],2)+
273 pow((total[iSample]*bunchSumErro[iSample])/(bunchSum[iSample]*bunchSum[iSample]),2));
276 std::cout <<
" Sample = " << iSample <<
" Total = " << total[iSample] <<
" +- " << totalErro[iSample] <<
"\n" 277 <<
" Sum = " << bunchSum[iSample] <<
" +- " << bunchSumErro[iSample] <<
"\n" 278 <<
" Ratio = " << ratio[iSample] <<
" +- " << ratioErro[iSample] << std::endl;
281 theRatio->
setBinError(iSample+1, (
float)ratioErro[iSample]);
293 std::vector<SimTrack> theSimTracks;
294 std::vector<SimVertex> theSimVertexes;
305 if (!MCEvt.
isValid()) { skipMC =
true; }
314 EBdigis = EcalDigiEB.
product();
315 LogDebug(
"DigiInfo") <<
"total # EBdigis: " << EBdigis->
size() ;
316 if ( EBdigis->
empty() ) isBarrel =
false;
324 EEdigis = EcalDigiEE.
product();
325 LogDebug(
"DigiInfo") <<
"total # EEdigis: " << EEdigis->
size() ;
326 if ( EEdigis->
empty() ) isEndcap =
false;
331 bool isPreshower =
true;
334 ESdigis = EcalDigiES.
product();
335 LogDebug(
"DigiInfo") <<
"total # ESdigis: " << ESdigis->
size() ;
336 if ( ESdigis->
empty() ) isPreshower =
false;
341 double theGunEnergy = 0.;
343 for ( HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
344 p != MCEvt->
GetEvent()->particles_end(); ++
p ) {
346 theGunEnergy = (*p)->momentum().e();
351 edm::LogWarning(
"DigiInfo") <<
"No HepMC available, using 30 GeV as giun energy";
366 double ebSimThreshold = 0.5*theGunEnergy;
373 <<
" CaloHit " << iHit.getName() <<
"\n" 374 <<
" DetID = "<<iHit.id()<<
" EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi() <<
"\n" 375 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 376 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 377 <<
" Energy = " << iHit.energy();
379 uint32_t crystid = ebid.
rawId();
381 if ( iHit.eventId().rawId() == 0 ) ebSignalSimMap[crystid] += iHit.energy();
391 std::vector<double> ebAnalogSignal ;
392 std::vector<double> ebADCCounts ;
393 std::vector<double> ebADCGains ;
398 for (
unsigned int digis=0; digis<EcalDigiEB->
size(); ++digis) {
401 int nrSamples=ebdf.
size();
409 ebAnalogSignal[
sample] = 0.;
421 if (Emax < ebAnalogSignal[
sample] ) {
422 Emax = ebAnalogSignal[
sample] ;
425 LogDebug(
"DigiInfo") <<
"EB sample " << sample <<
" ADC counts = " << ebADCCounts[
sample] <<
" Gain Id = " << ebADCGains[
sample] <<
" Analog eq = " << ebAnalogSignal[
sample];
427 double pedestalPreSampleAnalog = 0.;
428 findPedestal( ebid, (
int)ebADCGains[Pmax] , pedestalPreSampleAnalog);
430 double Erec = Emax - pedestalPreSampleAnalog;
432 if ( ebSignalSimMap[ebid.
rawId()] != 0. ) {
433 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << ebSignalSimMap[ebid.
rawId()] <<
" gainConv " <<
gainConv_[(
int)ebADCGains[Pmax]];
437 for (
int i = 0;
i < 10 ;
i++ ) {
438 pedestalPreSampleAnalog = 0.;
439 findPedestal( ebid, (
int)ebADCGains[
i] , pedestalPreSampleAnalog);
463 double eeSimThreshold = 0.4*theGunEnergy;
470 <<
" CaloHit " << iHit.getName() <<
"\n" 471 <<
" DetID = "<<iHit.id()<<
" EEDetId side = " << eeid.
zside() <<
" = " << eeid.
ix() <<
" " << eeid.
iy() <<
"\n" 472 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 473 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 474 <<
" Energy = " << iHit.energy();
476 uint32_t crystid = eeid.
rawId();
478 if ( iHit.eventId().rawId() == 0 ) eeSignalSimMap[crystid] += iHit.energy();
488 std::vector<double> eeAnalogSignal ;
489 std::vector<double> eeADCCounts ;
490 std::vector<double> eeADCGains ;
495 for (
unsigned int digis=0; digis<EcalDigiEE->
size(); ++digis) {
498 int nrSamples=eedf.
size();
506 eeAnalogSignal[
sample] = 0.;
518 if (Emax < eeAnalogSignal[
sample] ) {
519 Emax = eeAnalogSignal[
sample] ;
522 LogDebug(
"DigiInfo") <<
"EE sample " << sample <<
" ADC counts = " << eeADCCounts[
sample] <<
" Gain Id = " << eeADCGains[
sample] <<
" Analog eq = " << eeAnalogSignal[
sample];
524 double pedestalPreSampleAnalog = 0.;
525 findPedestal( eeid, (
int)eeADCGains[Pmax] , pedestalPreSampleAnalog);
527 double Erec = Emax - pedestalPreSampleAnalog;
529 if ( eeSignalSimMap[eeid.
rawId()] != 0. ) {
530 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << eeSignalSimMap[eeid.
rawId()] <<
" gainConv " <<
gainConv_[(
int)eeADCGains[Pmax]];
534 for (
int i = 0;
i < 10 ;
i++ ) {
535 pedestalPreSampleAnalog = 0.;
536 findPedestal( eeid, (
int)eeADCGains[
i] , pedestalPreSampleAnalog);
560 <<
" CaloHit " << iHit.getName() <<
"\n" 561 <<
" DetID = "<<iHit.id()<<
"ESDetId: z side " << esid.
zside() <<
" plane " << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip() <<
"\n" 562 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 563 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 564 <<
" Energy = " << iHit.energy();
566 uint32_t stripid = esid.
rawId();
568 if ( iHit.eventId().rawId() == 0 ) esSignalSimMap[stripid] += iHit.energy();
576 std::vector<double> esADCCounts ;
577 std::vector<double> esADCAnalogSignal ;
581 for (
unsigned int digis=0; digis<EcalDigiES->
size(); ++digis) {
584 int nrSamples=esdf.
size();
590 esADCAnalogSignal[
sample] = 0.;
603 LogDebug(
"DigiInfo") <<
"Preshower Digi for ESDetId: z side " << esid.
zside() <<
" plane " << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip();
604 for (
int i = 0;
i < 3 ;
i++ ) {
605 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << esADCCounts[
i] <<
" Analog eq = " << esADCAnalogSignal[
i];
609 for (
int i = 0;
i < 3 ;
i++ ) {
639 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" g1 = " << gainConv_[1] <<
"\n" <<
" g2 = " << gainConv_[2] <<
"\n" <<
" g3 = " << gainConv_[3];
641 delete defaultRatios;
673 ( 2 ==
m_ESgain ? 0.8815 : 1.0 ) ) ) ;
714 LogDebug(
"EcalMMValid") <<
"Pedestals for " << detId.
rawId() <<
" gain range " << gainId <<
" : \n" <<
"Mean = " << ped;
749 std::vector<DetId> theOverThresholdId;
750 for (
unsigned int i = 0 ;
i < theSDId.size() ;
i++ ) {
752 int sdId = theSDId[
i].rawId();
753 if ( SignalSimMap[sdId] > theSimThreshold ) theOverThresholdId.push_back( theSDId[
i] );
781 for ( std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin() ; idItr != theOverThresholdId.end() ; ++idItr ) {
795 if ( analogSignal ) {
799 for (
int i = 0 ;
i <
limit ;
i++ ) {
T getParameter(std::string const &) const
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
T getUntrackedParameter(std::string const &, T const &) const
void checkPedestals(const edm::EventSetup &c)
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * meEBDigiMixRatioOriggt50pc_
MonitorElement * meESbunchCrossing_
const ESIntercalibConstants * m_ESmips
void endRun(const edm::Run &r, const edm::EventSetup &c) override
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
void findPedestal(const DetId &detId, int gainId, double &ped) const
static const int MAXSAMPLES
int gainId(sample_type sample)
get the gainId (2 bits)
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setGain(const int gain)
const self & getMap() const
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
const ESDetId & id() const
MonitorElement * meEEShapeRatio_
const self & getMap() const
float getESValueLow() const
simHitToPhotoelectronsEndcap
constexpr uint32_t rawId() const
get the raw id
void checkCalibrations(edm::EventSetup const &c)
MonitorElement * meEEBunchShape_[nBunch]
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
std::vector< CLHEP::HepRandomEngine * > randomEngines_
MonitorElement * meEBBunchShape_[nBunch]
simHitToPhotoelectronsBarrel
int gainId() const
get the gainId (2 bits)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
MonitorElement * meESShape_
virtual void run(const MixCollection< PCaloHit > &hits, CLHEP::HepRandomEngine *)
Complete cell digitization.
CaloHitResponse * theESResponse
MonitorElement * meESShapeRatio_
int iphi() const
get the crystal iphi
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
MonitorElement * meEBbunchCrossing_
void setCurrentFolder(std::string const &fullpath)
CaloHitResponse * theEBResponse
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
void bunchSumTest(std::vector< MonitorElement * > &theBunches, MonitorElement *&theTotal, MonitorElement *&theRatio, int nSample)
MonitorElement * meESBunchShape_[nBunch]
Creates electronics signals from hits.
~EcalMixingModuleValidation() override
Destructor.
static const int MAXSAMPLES
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
MonitorElement * meEBShape_
const_iterator find(uint32_t rawId) const
MonitorElement * book1D(Args &&...args)
const CaloSimParameters & simParameters(const DetId &id) const override
return the sim parameters relative to the right subdet
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
int ieta() const
get the crystal ieta
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
bool isEndcap(GeomDetEnumerators::SubDetector m)
void computeSDBunchDigi(const edm::EventSetup &eventSetup, const MixCollection< PCaloHit > &theHits, MapType &ebSignalSimMap, const EcalSubdetector &thisDet, const double &theSimThreshold, CLHEP::HepRandomEngine *)
std::map< int, double, std::less< int > > gainConv_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
void reserve(size_t isize)
const EcalSimParameterMap * theParameterMap
const EcalPedestals * thePedestals
std::map< uint32_t, float, std::less< uint32_t > > MapType
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEBShapeRatio_
unsigned int value() const
const CaloGeometry * theGeometry
MonitorElement * meEEbunchCrossing_
const HepMC::GenEvent * GetEvent() const
T const * product() const
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
void analyze(edm::Event const &e, edm::EventSetup const &c) override
Analyze.
float gain12Over6() const
CaloHitResponse * theEEResponse
void setBunchRange(int minBunch, int maxBunch)
tells it which pileup bunches to do
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
CaloSamples * findSignal(const DetId &detId)
users can look for the signal for a given cell
double getBinContent(int binx) const
get content of bin (1-D)
void clear()
frees up memory
photoelectronsToAnalogBarrel
const ESPedestals * m_ESpeds
StreamID streamID() const
MonitorElement * meEEShape_
void setEventSetup(const edm::EventSetup &evtSetup)
const_iterator find(uint32_t rawId) const
const_iterator end() const
int adc() const
get the ADC sample (singed 16 bits)
static constexpr int MAXSAMPLES
DetId id() const
get the (generic) id
EcalMixingModuleValidation(const edm::ParameterSet &ps)
Constructor.
float getESValueHigh() const
T const * product() const
photoelectronsToAnalogEndcap
Power< A, B >::type pow(const A &a, const B &b)
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
int adc() const
get the ADC sample (12 bits)
MonitorElement * meEBDigiMixRatiogt100ADC_
MonitorElement * meEEDigiMixRatiogt100ADC_
MonitorElement * meEEDigiMixRatioOriggt40pc_