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: "
630 delete defaultRatios;
662 edm::LogError(
"EcalMMValid") <<
"Could not find pedestal for " << detId.
rawId() <<
" among the "
684 LogDebug(
"EcalMMValid") <<
"Pedestals for " << detId.
rawId() <<
" gain range " <<
gainId <<
" : \n"
693 const double& theSimThreshold,
694 CLHEP::HepRandomEngine* engine) {
720 std::vector<DetId> theOverThresholdId;
721 for (
unsigned int i = 0;
i < theSDId.size();
i++) {
722 int sdId = theSDId[
i].rawId();
723 if (SignalSimMap[sdId] > theSimThreshold)
724 theOverThresholdId.push_back(theSDId[
i]);
749 for (std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin(); idItr != theOverThresholdId.end();