140 sprintf(
histo,
"EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC");
143 sprintf(
histo,
"EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC");
146 sprintf(
histo,
"EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun");
149 sprintf(
histo,
"EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun");
152 sprintf(
histo,
"EcalDigiTask Barrel bunch crossing");
155 sprintf(
histo,
"EcalDigiTask Endcap bunch crossing");
158 sprintf(
histo,
"EcalDigiTask Preshower bunch crossing");
162 sprintf(
histo,
"EcalDigiTask Barrel shape bunch crossing %02d",
i - 10);
165 sprintf(
histo,
"EcalDigiTask Endcap shape bunch crossing %02d",
i - 10);
168 sprintf(
histo,
"EcalDigiTask Preshower shape bunch crossing %02d",
i - 10);
172 sprintf(
histo,
"EcalDigiTask Barrel shape digi");
175 sprintf(
histo,
"EcalDigiTask Endcap shape digi");
178 sprintf(
histo,
"EcalDigiTask Preshower shape digi");
181 sprintf(
histo,
"EcalDigiTask Barrel shape digi ratio");
184 sprintf(
histo,
"EcalDigiTask Endcap shape digi ratio");
187 sprintf(
histo,
"EcalDigiTask Preshower shape digi ratio");
194 std::vector<MonitorElement*> theBunches;
195 theBunches.reserve(
nBunch);
220 std::vector<double> bunchSum;
221 bunchSum.reserve(nSample);
222 std::vector<double> bunchSumErro;
223 bunchSumErro.reserve(nSample);
224 std::vector<double>
total;
225 total.reserve(nSample);
226 std::vector<double> totalErro;
227 totalErro.reserve(nSample);
228 std::vector<double>
ratio;
229 ratio.reserve(nSample);
230 std::vector<double> ratioErro;
231 ratioErro.reserve(nSample);
233 for (
int iEl = 0; iEl < nSample; iEl++) {
235 bunchSumErro[iEl] = 0.;
242 for (
int iSample = 0; iSample < nSample; iSample++) {
244 totalErro[iSample] += theTotal->
getBinError(iSample + 1);
249 bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample + 1);
250 bunchSumErro[iSample] +=
pow(theBunches[iHisto]->getBinError(iSample + 1), 2);
252 bunchSumErro[iSample] =
sqrt(bunchSumErro[iSample]);
254 if (bunchSum[iSample] > 0.) {
255 ratio[iSample] =
total[iSample] / bunchSum[iSample];
257 sqrt(
pow(totalErro[iSample] / bunchSum[iSample], 2) +
258 pow((
total[iSample] * bunchSumErro[iSample]) / (bunchSum[iSample] * bunchSum[iSample]), 2));
261 std::cout <<
" Sample = " << iSample <<
" Total = " <<
total[iSample] <<
" +- " << totalErro[iSample] <<
"\n"
262 <<
" Sum = " << bunchSum[iSample] <<
" +- " << bunchSumErro[iSample] <<
"\n"
263 <<
" Ratio = " <<
ratio[iSample] <<
" +- " << ratioErro[iSample] << std::endl;
266 theRatio->
setBinError(iSample + 1, (
float)ratioErro[iSample]);
275 std::vector<SimTrack> theSimTracks;
276 std::vector<SimVertex> theSimVertexes;
297 EBdigis = EcalDigiEB.
product();
298 LogDebug(
"DigiInfo") <<
"total # EBdigis: " << EBdigis->
size();
299 if (EBdigis->
empty())
308 EEdigis = EcalDigiEE.
product();
309 LogDebug(
"DigiInfo") <<
"total # EEdigis: " << EEdigis->
size();
310 if (EEdigis->
empty())
316 bool isPreshower =
true;
319 ESdigis = EcalDigiES.
product();
320 LogDebug(
"DigiInfo") <<
"total # ESdigis: " << ESdigis->
size();
321 if (ESdigis->
empty())
327 double theGunEnergy = 0.;
329 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
332 theGunEnergy = (*p)->momentum().e();
337 edm::LogWarning(
"DigiInfo") <<
"No HepMC available, using 30 GeV as giun energy";
351 double ebSimThreshold = 0.5 * theGunEnergy;
356 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
357 <<
" DetID = " << iHit.id() <<
" EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi() <<
"\n"
358 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
359 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
360 <<
" Energy = " << iHit.energy();
362 uint32_t crystid = ebid.
rawId();
364 if (iHit.eventId().rawId() == 0)
365 ebSignalSimMap[crystid] += iHit.energy();
375 std::vector<double> ebAnalogSignal;
376 std::vector<double> ebADCCounts;
377 std::vector<double> ebADCGains;
382 for (
unsigned int digis = 0; digis < EcalDigiEB->
size(); ++digis) {
384 int nrSamples = ebdf.
size();
392 ebAnalogSignal[
sample] = 0.;
403 if (Emax < ebAnalogSignal[
sample]) {
404 Emax = ebAnalogSignal[
sample];
408 <<
" Gain Id = " << ebADCGains[
sample] <<
" Analog eq = " << ebAnalogSignal[
sample];
410 double pedestalPreSampleAnalog = 0.;
413 double Erec = Emax - pedestalPreSampleAnalog;
415 if (ebSignalSimMap[ebid.
rawId()] != 0.) {
416 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << ebSignalSimMap[ebid.
rawId()] <<
" gainConv "
423 for (
int i = 0;
i < 10;
i++) {
424 pedestalPreSampleAnalog = 0.;
425 findPedestal(ebid, (
int)ebADCGains[
i], pedestalPreSampleAnalog);
446 double eeSimThreshold = 0.4 * theGunEnergy;
451 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
452 <<
" DetID = " << iHit.id() <<
" EEDetId side = " << eeid.
zside() <<
" = " << eeid.
ix() <<
" "
454 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
455 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
456 <<
" Energy = " << iHit.energy();
458 uint32_t crystid = eeid.
rawId();
460 if (iHit.eventId().rawId() == 0)
461 eeSignalSimMap[crystid] += iHit.energy();
471 std::vector<double> eeAnalogSignal;
472 std::vector<double> eeADCCounts;
473 std::vector<double> eeADCGains;
478 for (
unsigned int digis = 0; digis < EcalDigiEE->
size(); ++digis) {
480 int nrSamples = eedf.
size();
488 eeAnalogSignal[
sample] = 0.;
499 if (Emax < eeAnalogSignal[
sample]) {
500 Emax = eeAnalogSignal[
sample];
504 <<
" Gain Id = " << eeADCGains[
sample] <<
" Analog eq = " << eeAnalogSignal[
sample];
506 double pedestalPreSampleAnalog = 0.;
509 double Erec = Emax - pedestalPreSampleAnalog;
511 if (eeSignalSimMap[eeid.
rawId()] != 0.) {
512 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << eeSignalSimMap[eeid.
rawId()] <<
" gainConv "
519 for (
int i = 0;
i < 10;
i++) {
520 pedestalPreSampleAnalog = 0.;
521 findPedestal(eeid, (
int)eeADCGains[
i], pedestalPreSampleAnalog);
542 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
543 <<
" DetID = " << iHit.id() <<
"ESDetId: z side " << esid.
zside() <<
" plane "
544 << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip() <<
"\n"
545 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
546 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
547 <<
" Energy = " << iHit.energy();
549 uint32_t stripid = esid.
rawId();
551 if (iHit.eventId().rawId() == 0)
552 esSignalSimMap[stripid] += iHit.energy();
561 std::vector<double> esADCCounts;
562 std::vector<double> esADCAnalogSignal;
566 for (
unsigned int digis = 0; digis < EcalDigiES->
size(); ++digis) {
568 int nrSamples = esdf.
size();
574 esADCAnalogSignal[
sample] = 0.;
586 LogDebug(
"DigiInfo") <<
"Preshower Digi for ESDetId: z side " << esid.
zside() <<
" plane " << esid.
plane()
587 << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip();
588 for (
int i = 0;
i < 3;
i++) {
589 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << esADCCounts[
i]
590 <<
" Analog eq = " << esADCAnalogSignal[
i];
594 for (
int i = 0;
i < 3;
i++) {
619 LogDebug(
"EcalDigi") <<
" Gains conversions: "
625 delete defaultRatios;
669 edm::LogError(
"EcalMMValid") <<
"Could not find pedestal for " << detId.
rawId() <<
" among the "
691 LogDebug(
"EcalMMValid") <<
"Pedestals for " << detId.
rawId() <<
" gain range " <<
gainId <<
" : \n"
700 const double& theSimThreshold,
701 CLHEP::HepRandomEngine* engine) {
729 std::vector<DetId> theOverThresholdId;
730 for (
unsigned int i = 0;
i < theSDId.size();
i++) {
731 int sdId = theSDId[
i].rawId();
732 if (SignalSimMap[sdId] > theSimThreshold)
733 theOverThresholdId.push_back(theSDId[
i]);
758 for (std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin(); idItr != theOverThresholdId.end();