129 usesResource(
"TFileService");
166 std::ifstream
infile(cfile.c_str());
169 edm::LogWarning(
"RecAnalyzer") <<
"Cannot open '" << cfile <<
"' for the correction file";
171 unsigned int ndets(0), nrec(0);
187 edm::LogInfo(
"RecAnalyzer") <<
"Reads " << nrec <<
" correction factors for " << ndets <<
" detIds";
192 <<
runNZS_ <<
" and with " <<
ieta.size() <<
" detId for full histogram";
195 for (
unsigned int k = 0;
k <
ieta.size(); ++
k) {
214 std::vector<int> iarray;
216 desc.
add<
bool>(
"runNZS",
true);
217 desc.
add<
bool>(
"noise",
false);
218 desc.
add<
double>(
"eLowHB", 4);
219 desc.
add<
double>(
"eHighHB", 100);
220 desc.
add<
double>(
"eLowHE", 4);
221 desc.
add<
double>(
"eHighHE", 150);
222 desc.
add<
double>(
"eLowHF", 10);
223 desc.
add<
double>(
"eHighHF", 150);
229 desc.
addUntracked<std::vector<int>>(
"triggerBits", iarray);
234 desc.
addUntracked<std::vector<int>>(
"hcalIeta", iarray);
235 desc.
addUntracked<std::vector<int>>(
"hcalIphi", iarray);
236 desc.
addUntracked<std::vector<int>>(
"hcalDepth", iarray);
241 descriptions.
add(
"recAnalyzerMinbias", desc);
245 std::string hc[5] = {
"Empty",
"HB",
"HE",
"HO",
"HF"};
247 hbhe_ =
fs_->
make<TH2D>(
"hbhe",
"Noise in HB/HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
248 hb_ =
fs_->
make<TH2D>(
"hb",
"Noise in HB", 61, -16.5, 16.5, 72, 0.5, 72.5);
249 he_ =
fs_->
make<TH2D>(
"he",
"Noise in HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
250 hf_ =
fs_->
make<TH2D>(
"hf",
"Noise in HF", 82, -41.5, 41.5, 72, 0.5, 72.5);
252 sprintf(
title,
"Fraction of channels in HB/HE with E > %4.1f GeV vs Run number",
eMin_);
254 sprintf(
title,
"Fraction of channels in HB with E > %4.1f GeV vs Run number",
eMin_);
256 sprintf(
title,
"Fraction of channels in HE with E > %4.1f GeV vs Run number",
eMin_);
258 sprintf(
title,
"Fraction of channels in HF with E > %4.1f GeV vs Run number",
eMin_);
260 for (
int idet = 1; idet <= 4; idet++) {
261 sprintf(
name,
"%s", hc[idet].c_str());
262 sprintf(
title,
"Noise distribution for %s", hc[idet].c_str());
266 for (
const auto& hcalid :
hcalID_) {
268 int subdet =
id.subdetId();
269 sprintf(
name,
"%s%d_%d_%d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
271 "Energy Distribution for %s ieta %d iphi %d depth %d",
276 double xmin = (subdet == 4) ? -10 : -1;
277 double xmax = (subdet == 4) ? 90 : 9;
322 if (
info.theMB0 > 0) {
332 iphi =
itr.first.second.iphi();
333 ieta =
itr.first.second.ieta();
345 edm::LogVerbatim(
"RecAnalyzer") <<
"Exiting from RecAnalyzerMinbias::endjob";
362 double x_min = (
Noise_) ? -3. : 0.;
368 if (hcaltopology->
valid(cell)) {
380 x_min = (
Noise_) ? -3. : 0.;
386 if (hcaltopology->
valid(cell)) {
398 x_min = (
Noise_) ? -10. : 0.;
404 if (hcaltopology->
valid(cell)) {
427 double amplitudefullHB(0), amplitudefullHE(0), amplitudefullHF(0);
431 for (
auto const& digi : *(hbhedigi.
product())) {
432 int nTS = digi.size();
433 double amplitudefullTSs = 0.;
436 for (
int i = 0;
i < nTS;
i++)
437 amplitudefullTSs += digi.sample(
i).adc();
439 amplitudefullHB += amplitudefullTSs;
444 for (
int i = 0;
i < nTS;
i++)
445 amplitudefullTSs += digi.sample(
i).adc();
447 amplitudefullHE += amplitudefullTSs;
457 double amplitudefullTSs = 0.;
459 for (
int i = 0;
i < digi.samples();
i++)
460 amplitudefullTSs += digi[
i].
adc();
462 amplitudefullHB += amplitudefullTSs;
465 for (
int i = 0;
i < digi.samples();
i++)
466 amplitudefullTSs += digi[
i].
adc();
468 amplitudefullHE += amplitudefullTSs;
476 for (
auto const& digi : *(hfdigi.
product())) {
477 int nTS = digi.size();
478 double amplitudefullTSs = 0.;
481 for (
int i = 0;
i < nTS;
i++)
482 amplitudefullTSs += digi.sample(
i).adc();
484 amplitudefullHF += amplitudefullTSs;
494 double amplitudefullTSs = 0.;
496 for (
int i = 0;
i < digi.samples();
i++)
497 amplitudefullTSs += digi[
i].
adc();
499 amplitudefullHF += amplitudefullTSs;
512 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
525 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hf product!";
539 if (gtObjectMapRecord.
isValid()) {
540 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
541 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
543 bool resultGt = (*itMap).algoGtlResult();
545 int algoBit = (*itMap).algoBitNumber();
559 double eventWeight = 1.0;
569 analyzeHcal(HithbheMB, HithfMB, 1,
true, eventWeight);
573 if (gtObjectMapRecord.
isValid()) {
574 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
576 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
578 bool resultGt = (*itMap).algoGtlResult();
580 int algoBit = (*itMap).algoBitNumber();
581 analyzeHcal(HithbheMB, HithfMB, algoBit, (!
ok), eventWeight);
586 edm::LogInfo(
"RecAnalyzer") <<
"No passed L1 Trigger found";
595 int count(0), countHB(0), countHE(0), count2(0), count2HB(0), count2HE(0);
599 double icalconst(1.);
601 std::map<DetId, double>::iterator
itr =
corrFactor_.find(mydetid);
603 icalconst =
itr->second;
605 HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
606 double energyhit = aHit.
energy();
607 DetId id = (*hbheItr).detid();
617 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
624 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
626 itr1->second->Fill(energyhit);
628 h_[hid.
subdet() - 1]->Fill(energyhit);
629 if (energyhit >
eMin_) {
642 if (
Noise_ ||
runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
643 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
644 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
645 if (itr1 ==
myMap_.end()) {
647 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
648 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
650 itr1->second.theMB0 +=
weight;
651 itr1->second.theMB1 += (
weight * energyhit);
652 itr1->second.theMB2 += (
weight * energyhit * energyhit);
653 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
654 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
655 itr1->second.runcheck =
rnnum_;
669 << count2HB <<
":" << countHB <<
":" << (double)(count2HB) / countHB <<
"\t HE "
670 << count2HE <<
":" << countHE <<
":" << (double)(count2HE) / countHE;
672 int countHF(0), count2HF(0);
677 double icalconst(1.);
679 std::map<DetId, double>::iterator
itr =
corrFactor_.find(mydetid);
681 icalconst =
itr->second;
683 HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
685 double energyhit = aHit.
energy();
686 DetId id = (*hfItr).detid();
690 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
697 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
699 itr1->second->Fill(energyhit);
701 h_[hid.
subdet() - 1]->Fill(energyhit);
702 if (energyhit >
eMin_) {
713 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
714 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
715 if (itr1 ==
myMap_.end()) {
717 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
718 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
720 itr1->second.theMB0 +=
weight;
721 itr1->second.theMB1 += (
weight * energyhit);
722 itr1->second.theMB2 += (
weight * energyhit * energyhit);
723 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
724 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
725 itr1->second.runcheck =
rnnum_;
729 if (
fill && countHF > 0)
733 edm::LogVerbatim(
"RecAnalyzer") <<
"HF " << count2HF <<
":" << countHF <<
":" << (double)(count2HF) / countHF;