147 sprintf(
histo,
"EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC");
150 sprintf(
histo,
"EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC");
153 sprintf(
histo,
"EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun");
156 sprintf(
histo,
"EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun");
159 sprintf(
histo,
"EcalDigiTask Barrel bunch crossing");
162 sprintf(
histo,
"EcalDigiTask Endcap bunch crossing");
165 sprintf(
histo,
"EcalDigiTask Preshower bunch crossing");
169 sprintf(
histo,
"EcalDigiTask Barrel shape bunch crossing %02d",
i - 10);
172 sprintf(
histo,
"EcalDigiTask Endcap shape bunch crossing %02d",
i - 10);
175 sprintf(
histo,
"EcalDigiTask Preshower shape bunch crossing %02d",
i - 10);
179 sprintf(
histo,
"EcalDigiTask Barrel shape digi");
182 sprintf(
histo,
"EcalDigiTask Endcap shape digi");
185 sprintf(
histo,
"EcalDigiTask Preshower shape digi");
188 sprintf(
histo,
"EcalDigiTask Barrel shape digi ratio");
191 sprintf(
histo,
"EcalDigiTask Endcap shape digi ratio");
194 sprintf(
histo,
"EcalDigiTask Preshower shape digi ratio");
201 std::vector<MonitorElement*> theBunches;
202 theBunches.reserve(
nBunch);
227 std::vector<double> bunchSum;
228 bunchSum.reserve(nSample);
229 std::vector<double> bunchSumErro;
230 bunchSumErro.reserve(nSample);
231 std::vector<double>
total;
232 total.reserve(nSample);
233 std::vector<double> totalErro;
234 totalErro.reserve(nSample);
235 std::vector<double>
ratio;
236 ratio.reserve(nSample);
237 std::vector<double> ratioErro;
238 ratioErro.reserve(nSample);
240 for (
int iEl = 0; iEl < nSample; iEl++) {
242 bunchSumErro[iEl] = 0.;
249 for (
int iSample = 0; iSample < nSample; iSample++) {
251 totalErro[iSample] += theTotal->
getBinError(iSample + 1);
256 bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample + 1);
257 bunchSumErro[iSample] +=
pow(theBunches[iHisto]->getBinError(iSample + 1), 2);
259 bunchSumErro[iSample] =
sqrt(bunchSumErro[iSample]);
261 if (bunchSum[iSample] > 0.) {
262 ratio[iSample] =
total[iSample] / bunchSum[iSample];
264 sqrt(
pow(totalErro[iSample] / bunchSum[iSample], 2) +
265 pow((
total[iSample] * bunchSumErro[iSample]) / (bunchSum[iSample] * bunchSum[iSample]), 2));
268 std::cout <<
" Sample = " << iSample <<
" Total = " <<
total[iSample] <<
" +- " << totalErro[iSample] <<
"\n" 269 <<
" Sum = " << bunchSum[iSample] <<
" +- " << bunchSumErro[iSample] <<
"\n" 270 <<
" Ratio = " <<
ratio[iSample] <<
" +- " << ratioErro[iSample] << std::endl;
273 theRatio->
setBinError(iSample + 1, (
float)ratioErro[iSample]);
282 std::vector<SimTrack> theSimTracks;
283 std::vector<SimVertex> theSimVertexes;
304 EBdigis = EcalDigiEB.
product();
305 LogDebug(
"DigiInfo") <<
"total # EBdigis: " << EBdigis->
size();
306 if (EBdigis->
empty())
315 EEdigis = EcalDigiEE.
product();
316 LogDebug(
"DigiInfo") <<
"total # EEdigis: " << EEdigis->
size();
317 if (EEdigis->
empty())
323 bool isPreshower =
true;
326 ESdigis = EcalDigiES.
product();
327 LogDebug(
"DigiInfo") <<
"total # ESdigis: " << ESdigis->
size();
328 if (ESdigis->
empty())
334 double theGunEnergy = 0.;
336 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
339 theGunEnergy = (*p)->momentum().e();
344 edm::LogWarning(
"DigiInfo") <<
"No HepMC available, using 30 GeV as giun energy";
358 double ebSimThreshold = 0.5 * theGunEnergy;
363 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n" 364 <<
" DetID = " << iHit.id() <<
" EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi() <<
"\n" 365 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 366 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 367 <<
" Energy = " << iHit.energy();
369 uint32_t crystid = ebid.
rawId();
371 if (iHit.eventId().rawId() == 0)
372 ebSignalSimMap[crystid] += iHit.energy();
382 std::vector<double> ebAnalogSignal;
383 std::vector<double> ebADCCounts;
384 std::vector<double> ebADCGains;
389 for (
unsigned int digis = 0; digis < EcalDigiEB->
size(); ++digis) {
391 int nrSamples = ebdf.
size();
399 ebAnalogSignal[
sample] = 0.;
410 if (Emax < ebAnalogSignal[
sample]) {
411 Emax = ebAnalogSignal[
sample];
415 <<
" Gain Id = " << ebADCGains[
sample] <<
" Analog eq = " << ebAnalogSignal[
sample];
417 double pedestalPreSampleAnalog = 0.;
420 double Erec = Emax - pedestalPreSampleAnalog;
422 if (ebSignalSimMap[ebid.
rawId()] != 0.) {
423 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << ebSignalSimMap[ebid.
rawId()] <<
" gainConv " 430 for (
int i = 0;
i < 10;
i++) {
431 pedestalPreSampleAnalog = 0.;
432 findPedestal(ebid, (
int)ebADCGains[
i], pedestalPreSampleAnalog);
453 double eeSimThreshold = 0.4 * theGunEnergy;
458 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n" 459 <<
" DetID = " << iHit.id() <<
" EEDetId side = " << eeid.
zside() <<
" = " << eeid.
ix() <<
" " 461 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 462 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 463 <<
" Energy = " << iHit.energy();
465 uint32_t crystid = eeid.
rawId();
467 if (iHit.eventId().rawId() == 0)
468 eeSignalSimMap[crystid] += iHit.energy();
478 std::vector<double> eeAnalogSignal;
479 std::vector<double> eeADCCounts;
480 std::vector<double> eeADCGains;
485 for (
unsigned int digis = 0; digis < EcalDigiEE->
size(); ++digis) {
487 int nrSamples = eedf.
size();
495 eeAnalogSignal[
sample] = 0.;
506 if (Emax < eeAnalogSignal[
sample]) {
507 Emax = eeAnalogSignal[
sample];
511 <<
" Gain Id = " << eeADCGains[
sample] <<
" Analog eq = " << eeAnalogSignal[
sample];
513 double pedestalPreSampleAnalog = 0.;
516 double Erec = Emax - pedestalPreSampleAnalog;
518 if (eeSignalSimMap[eeid.
rawId()] != 0.) {
519 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << eeSignalSimMap[eeid.
rawId()] <<
" gainConv " 526 for (
int i = 0;
i < 10;
i++) {
527 pedestalPreSampleAnalog = 0.;
528 findPedestal(eeid, (
int)eeADCGains[
i], pedestalPreSampleAnalog);
549 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n" 550 <<
" DetID = " << iHit.id() <<
"ESDetId: z side " << esid.
zside() <<
" plane " 551 << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip() <<
"\n" 552 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 553 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 554 <<
" Energy = " << iHit.energy();
556 uint32_t stripid = esid.
rawId();
558 if (iHit.eventId().rawId() == 0)
559 esSignalSimMap[stripid] += iHit.energy();
568 std::vector<double> esADCCounts;
569 std::vector<double> esADCAnalogSignal;
573 for (
unsigned int digis = 0; digis < EcalDigiES->
size(); ++digis) {
575 int nrSamples = esdf.
size();
581 esADCAnalogSignal[
sample] = 0.;
593 LogDebug(
"DigiInfo") <<
"Preshower Digi for ESDetId: z side " << esid.
zside() <<
" plane " << esid.
plane()
594 << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip();
595 for (
int i = 0;
i < 3;
i++) {
596 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << esADCCounts[
i]
597 <<
" Analog eq = " << esADCAnalogSignal[
i];
601 for (
int i = 0;
i < 3;
i++) {
624 LogDebug(
"EcalDigi") <<
" Gains conversions: " 660 edm::LogError(
"EcalMMValid") <<
"Could not find pedestal for " <<
detId.rawId() <<
" among the " 682 LogDebug(
"EcalMMValid") <<
"Pedestals for " <<
detId.rawId() <<
" gain range " <<
gainId <<
" : \n" 691 const double& theSimThreshold,
692 CLHEP::HepRandomEngine* engine) {
718 std::vector<DetId> theOverThresholdId;
719 for (
unsigned int i = 0;
i < theSDId.size();
i++) {
720 int sdId = theSDId[
i].rawId();
721 if (SignalSimMap[sdId] > theSimThreshold)
722 theOverThresholdId.push_back(theSDId[
i]);
747 for (std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin(); idItr != theOverThresholdId.end();
const ESDetId & id() const
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > dbPed
void checkPedestals(const edm::EventSetup &c)
T getParameter(std::string const &) const
float getESValueHigh() const
MonitorElement * meEBDigiMixRatioOriggt50pc_
MonitorElement * meESbunchCrossing_
const ESIntercalibConstants * m_ESmips
static const int MAXSAMPLES
std::unique_ptr< EEShape > theEEShape
virtual void setCurrentFolder(std::string const &fullpath)
std::map< uint32_t, float, std::less< uint32_t > > MapType
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
MonitorElement * meEEShapeRatio_
int iphi() const
get the crystal iphi
T const * product() const
simHitToPhotoelectronsEndcap
void checkCalibrations(edm::EventSetup const &c)
MonitorElement * meEEBunchShape_[nBunch]
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
std::unique_ptr< const EcalSimParameterMap > theParameterMap
std::vector< CLHEP::HepRandomEngine * > randomEngines_
MonitorElement * meEBBunchShape_[nBunch]
simHitToPhotoelectronsBarrel
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
Log< level::Error, false > LogError
edm::ESGetToken< ESMIPToGeVConstant, ESMIPToGeVConstantRcd > esMIPToGeV_
void bunchSumTest(std::vector< MonitorElement *> &theBunches, MonitorElement *&theTotal, MonitorElement *&theRatio, int nSample)
std::unique_ptr< CaloHitResponse > theEBResponse
const_iterator find(uint32_t rawId) const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
MonitorElement * meESShape_
edm::ESGetToken< ESGain, ESGainRcd > esgain_
int ieta() const
get the crystal ieta
MonitorElement * meESShapeRatio_
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< CaloHitResponse > theESResponse
MonitorElement * meEBbunchCrossing_
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
MonitorElement * meESBunchShape_[nBunch]
~EcalMixingModuleValidation() override
Destructor.
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
DetId id() const
get the (generic) id
std::unique_ptr< CaloHitResponse > theEEResponse
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static const int MAXSAMPLES
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
MonitorElement * meEBShape_
float getESValueLow() const
bool isEndcap(GeomDetEnumerators::SubDetector m)
std::unique_ptr< ESShape > theESShape
void computeSDBunchDigi(const edm::EventSetup &eventSetup, const MixCollection< PCaloHit > &theHits, MapType &ebSignalSimMap, const EcalSubdetector &thisDet, const double &theSimThreshold, CLHEP::HepRandomEngine *)
const HepMC::GenEvent * GetEvent() const
const_iterator find(uint32_t rawId) const
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
std::map< int, double, std::less< int > > gainConv_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
void reserve(size_t isize)
float gain12Over6() const
const EcalPedestals * thePedestals
std::unique_ptr< EBShape > theEBShape
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEBShapeRatio_
const CaloGeometry * theGeometry
MonitorElement * meEEbunchCrossing_
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
void findPedestal(const DetId &detId, int gainId, double &ped) const
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
edm::ESGetToken< ESPedestals, ESPedestalsRcd > esPedestals_
void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override
constexpr uint32_t rawId() const
get the raw id
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
void analyze(edm::Event const &e, edm::EventSetup const &c) override
Analyze.
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > pAgc
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
photoelectronsToAnalogBarrel
const ESPedestals * m_ESpeds
MonitorElement * meEEShape_
edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcd > esMIPs_
const self & getMap() const
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
const_iterator end() const
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
static constexpr int MAXSAMPLES
unsigned int value() const
const self & getMap() const
Log< level::Warning, false > LogWarning
EcalMixingModuleValidation(const edm::ParameterSet &ps)
Constructor.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
photoelectronsToAnalogEndcap
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > hGeometry
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
MonitorElement * meEBDigiMixRatiogt100ADC_
virtual double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * meEEDigiMixRatiogt100ADC_
MonitorElement * meEEDigiMixRatioOriggt40pc_