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;
219 std::vector<double> bunchSum;
220 bunchSum.reserve(nSample);
221 std::vector<double> bunchSumErro;
222 bunchSumErro.reserve(nSample);
223 std::vector<double>
total;
224 total.reserve(nSample);
225 std::vector<double> totalErro;
226 totalErro.reserve(nSample);
227 std::vector<double>
ratio;
228 ratio.reserve(nSample);
229 std::vector<double> ratioErro;
230 ratioErro.reserve(nSample);
232 for (
int iEl = 0; iEl < nSample; iEl++) {
234 bunchSumErro[iEl] = 0.;
241 for (
int iSample = 0; iSample < nSample; iSample++) {
243 totalErro[iSample] += theTotal->
getBinError(iSample + 1);
248 bunchSum[iSample] += theBunches[iHisto]->getBinContent(iSample + 1);
249 bunchSumErro[iSample] +=
pow(theBunches[iHisto]->getBinError(iSample + 1), 2);
251 bunchSumErro[iSample] =
sqrt(bunchSumErro[iSample]);
253 if (bunchSum[iSample] > 0.) {
254 ratio[iSample] =
total[iSample] / bunchSum[iSample];
256 sqrt(
pow(totalErro[iSample] / bunchSum[iSample], 2) +
257 pow((
total[iSample] * bunchSumErro[iSample]) / (bunchSum[iSample] * bunchSum[iSample]), 2));
260 std::cout <<
" Sample = " << iSample <<
" Total = " <<
total[iSample] <<
" +- " << totalErro[iSample] <<
"\n"
261 <<
" Sum = " << bunchSum[iSample] <<
" +- " << bunchSumErro[iSample] <<
"\n"
262 <<
" Ratio = " <<
ratio[iSample] <<
" +- " << ratioErro[iSample] << std::endl;
265 theRatio->
setBinError(iSample + 1, (
float)ratioErro[iSample]);
274 std::vector<SimTrack> theSimTracks;
275 std::vector<SimVertex> theSimVertexes;
296 EBdigis = EcalDigiEB.
product();
297 LogDebug(
"DigiInfo") <<
"total # EBdigis: " << EBdigis->
size();
298 if (EBdigis->
empty())
307 EEdigis = EcalDigiEE.
product();
308 LogDebug(
"DigiInfo") <<
"total # EEdigis: " << EEdigis->
size();
309 if (EEdigis->
empty())
315 bool isPreshower =
true;
318 ESdigis = EcalDigiES.
product();
319 LogDebug(
"DigiInfo") <<
"total # ESdigis: " << ESdigis->
size();
320 if (ESdigis->
empty())
326 double theGunEnergy = 0.;
328 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
331 theGunEnergy = (*p)->momentum().e();
336 edm::LogWarning(
"DigiInfo") <<
"No HepMC available, using 30 GeV as giun energy";
350 double ebSimThreshold = 0.5 * theGunEnergy;
355 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
356 <<
" DetID = " << iHit.id() <<
" EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi() <<
"\n"
357 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
358 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
359 <<
" Energy = " << iHit.energy();
361 uint32_t crystid = ebid.
rawId();
363 if (iHit.eventId().rawId() == 0)
364 ebSignalSimMap[crystid] += iHit.energy();
374 std::vector<double> ebAnalogSignal;
375 std::vector<double> ebADCCounts;
376 std::vector<double> ebADCGains;
381 for (
unsigned int digis = 0; digis < EcalDigiEB->
size(); ++digis) {
383 int nrSamples = ebdf.
size();
391 ebAnalogSignal[
sample] = 0.;
402 if (Emax < ebAnalogSignal[
sample]) {
403 Emax = ebAnalogSignal[
sample];
407 <<
" Gain Id = " << ebADCGains[
sample] <<
" Analog eq = " << ebAnalogSignal[
sample];
409 double pedestalPreSampleAnalog = 0.;
412 double Erec = Emax - pedestalPreSampleAnalog;
414 if (ebSignalSimMap[ebid.
rawId()] != 0.) {
415 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << ebSignalSimMap[ebid.
rawId()] <<
" gainConv "
422 for (
int i = 0;
i < 10;
i++) {
423 pedestalPreSampleAnalog = 0.;
424 findPedestal(ebid, (
int)ebADCGains[
i], pedestalPreSampleAnalog);
445 double eeSimThreshold = 0.4 * theGunEnergy;
450 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
451 <<
" DetID = " << iHit.id() <<
" EEDetId side = " << eeid.
zside() <<
" = " << eeid.
ix() <<
" "
453 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
454 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
455 <<
" Energy = " << iHit.energy();
457 uint32_t crystid = eeid.
rawId();
459 if (iHit.eventId().rawId() == 0)
460 eeSignalSimMap[crystid] += iHit.energy();
470 std::vector<double> eeAnalogSignal;
471 std::vector<double> eeADCCounts;
472 std::vector<double> eeADCGains;
477 for (
unsigned int digis = 0; digis < EcalDigiEE->
size(); ++digis) {
479 int nrSamples = eedf.
size();
487 eeAnalogSignal[
sample] = 0.;
498 if (Emax < eeAnalogSignal[
sample]) {
499 Emax = eeAnalogSignal[
sample];
503 <<
" Gain Id = " << eeADCGains[
sample] <<
" Analog eq = " << eeAnalogSignal[
sample];
505 double pedestalPreSampleAnalog = 0.;
508 double Erec = Emax - pedestalPreSampleAnalog;
510 if (eeSignalSimMap[eeid.
rawId()] != 0.) {
511 LogDebug(
"DigiInfo") <<
" Digi / Signal Hit = " << Erec <<
" / " << eeSignalSimMap[eeid.
rawId()] <<
" gainConv "
518 for (
int i = 0;
i < 10;
i++) {
519 pedestalPreSampleAnalog = 0.;
520 findPedestal(eeid, (
int)eeADCGains[
i], pedestalPreSampleAnalog);
541 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
542 <<
" DetID = " << iHit.id() <<
"ESDetId: z side " << esid.
zside() <<
" plane "
543 << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip() <<
"\n"
544 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
545 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
546 <<
" Energy = " << iHit.energy();
548 uint32_t stripid = esid.
rawId();
550 if (iHit.eventId().rawId() == 0)
551 esSignalSimMap[stripid] += iHit.energy();
560 std::vector<double> esADCCounts;
561 std::vector<double> esADCAnalogSignal;
565 for (
unsigned int digis = 0; digis < EcalDigiES->
size(); ++digis) {
567 int nrSamples = esdf.
size();
573 esADCAnalogSignal[
sample] = 0.;
585 LogDebug(
"DigiInfo") <<
"Preshower Digi for ESDetId: z side " << esid.
zside() <<
" plane " << esid.
plane()
586 << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip();
587 for (
int i = 0;
i < 3;
i++) {
588 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << esADCCounts[
i]
589 <<
" Analog eq = " << esADCAnalogSignal[
i];
593 for (
int i = 0;
i < 3;
i++) {
618 LogDebug(
"EcalDigi") <<
" Gains conversions: "
624 delete defaultRatios;
668 edm::LogError(
"EcalMMValid") <<
"Could not find pedestal for " << detId.
rawId() <<
" among the "
690 LogDebug(
"EcalMMValid") <<
"Pedestals for " << detId.
rawId() <<
" gain range " <<
gainId <<
" : \n"
699 const double& theSimThreshold,
700 CLHEP::HepRandomEngine* engine) {
728 std::vector<DetId> theOverThresholdId;
729 for (
unsigned int i = 0;
i < theSDId.size();
i++) {
730 int sdId = theSDId[
i].rawId();
731 if (SignalSimMap[sdId] > theSimThreshold)
732 theOverThresholdId.push_back(theSDId[
i]);
757 for (std::vector<DetId>::const_iterator idItr = theOverThresholdId.begin(); idItr != theOverThresholdId.end();