130 usesResource(
"TFileService");
166 tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
169 std::ifstream
infile(cfile.c_str());
172 edm::LogWarning(
"RecAnalyzer") <<
"Cannot open '" << cfile <<
"' for the correction file";
174 unsigned int ndets(0), nrec(0);
190 edm::LogVerbatim(
"RecAnalyzer") <<
"Reads " << nrec <<
" correction factors for " << ndets <<
" detIds";
195 <<
runNZS_ <<
" and with " <<
ieta.size() <<
" detId for full histogram";
198 for (
unsigned int k = 0;
k <
ieta.size(); ++
k) {
217 std::vector<int> iarray;
219 desc.add<
bool>(
"runNZS",
true);
220 desc.add<
bool>(
"noise",
false);
221 desc.add<
double>(
"eLowHB", 4);
222 desc.add<
double>(
"eHighHB", 100);
223 desc.add<
double>(
"eLowHE", 4);
224 desc.add<
double>(
"eHighHE", 150);
225 desc.add<
double>(
"eLowHF", 10);
226 desc.add<
double>(
"eHighHF", 150);
228 desc.addUntracked<
double>(
"eMin", 2.0);
230 desc.addUntracked<
int>(
"runMin", 308327);
231 desc.addUntracked<
int>(
"runMax", 308347);
232 desc.addUntracked<std::vector<int>>(
"triggerBits", iarray);
233 desc.addUntracked<
bool>(
"ignoreL1",
false);
235 desc.addUntracked<
bool>(
"fillHisto",
false);
236 desc.addUntracked<
bool>(
"extraHisto",
false);
237 desc.addUntracked<std::vector<int>>(
"hcalIeta", iarray);
238 desc.addUntracked<std::vector<int>>(
"hcalIphi", iarray);
239 desc.addUntracked<std::vector<int>>(
"hcalDepth", iarray);
244 descriptions.
add(
"recAnalyzerMinbias",
desc);
248 std::string hc[5] = {
"Empty",
"HB",
"HE",
"HO",
"HF"};
250 hbhe_ =
fs_->
make<TH2D>(
"hbhe",
"Noise in HB/HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
251 hb_ =
fs_->
make<TH2D>(
"hb",
"Noise in HB", 61, -16.5, 16.5, 72, 0.5, 72.5);
252 he_ =
fs_->
make<TH2D>(
"he",
"Noise in HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
253 hf_ =
fs_->
make<TH2D>(
"hf",
"Noise in HF", 82, -41.5, 41.5, 72, 0.5, 72.5);
255 sprintf(
title,
"Fraction of channels in HB/HE with E > %4.1f GeV vs Run number",
eMin_);
257 sprintf(
title,
"Fraction of channels in HB with E > %4.1f GeV vs Run number",
eMin_);
259 sprintf(
title,
"Fraction of channels in HE with E > %4.1f GeV vs Run number",
eMin_);
261 sprintf(
title,
"Fraction of channels in HF with E > %4.1f GeV vs Run number",
eMin_);
263 for (
int idet = 1; idet <= 4; idet++) {
264 sprintf(
name,
"%s", hc[idet].c_str());
265 sprintf(
title,
"Noise distribution for %s", hc[idet].c_str());
269 for (
const auto& hcalid :
hcalID_) {
271 int subdet =
id.subdetId();
272 sprintf(
name,
"%s%d_%d_%d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
274 "Energy Distribution for %s ieta %d iphi %d depth %d",
279 double xmin = (subdet == 4) ? -10 : -1;
280 double xmax = (subdet == 4) ? 90 : 9;
325 if (
info.theMB0 > 0) {
335 iphi =
itr.first.second.iphi();
336 ieta =
itr.first.second.ieta();
348 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)) {
426 double amplitudefullHB(0), amplitudefullHE(0), amplitudefullHF(0);
430 for (
auto const& digi : *(hbhedigi.
product())) {
431 int nTS = digi.size();
432 double amplitudefullTSs = 0.;
435 for (
int i = 0;
i < nTS;
i++)
436 amplitudefullTSs += digi.sample(
i).adc();
438 amplitudefullHB += amplitudefullTSs;
443 for (
int i = 0;
i < nTS;
i++)
444 amplitudefullTSs += digi.sample(
i).adc();
446 amplitudefullHE += amplitudefullTSs;
456 double amplitudefullTSs = 0.;
458 for (
int i = 0;
i < digi.samples();
i++)
459 amplitudefullTSs += digi[
i].
adc();
461 amplitudefullHB += amplitudefullTSs;
464 for (
int i = 0;
i < digi.samples();
i++)
465 amplitudefullTSs += digi[
i].
adc();
467 amplitudefullHE += amplitudefullTSs;
475 for (
auto const& digi : *(hfdigi.
product())) {
476 int nTS = digi.size();
477 double amplitudefullTSs = 0.;
480 for (
int i = 0;
i < nTS;
i++)
481 amplitudefullTSs += digi.sample(
i).adc();
483 amplitudefullHF += amplitudefullTSs;
493 double amplitudefullTSs = 0.;
495 for (
int i = 0;
i < digi.samples();
i++)
496 amplitudefullTSs += digi[
i].
adc();
498 amplitudefullHF += amplitudefullTSs;
511 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
524 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hf product!";
538 if (gtObjectMapRecord.
isValid()) {
539 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
540 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
542 bool resultGt = (*itMap).algoGtlResult();
544 int algoBit = (*itMap).algoBitNumber();
558 double eventWeight = 1.0;
568 analyzeHcal(HithbheMB, HithfMB, 1,
true, eventWeight);
572 if (gtObjectMapRecord.
isValid()) {
573 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
575 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
577 bool resultGt = (*itMap).algoGtlResult();
579 int algoBit = (*itMap).algoBitNumber();
580 analyzeHcal(HithbheMB, HithfMB, algoBit, (!
ok), eventWeight);
594 int count(0), countHB(0), countHE(0), count2(0), count2HB(0), count2HE(0);
598 double icalconst(1.);
600 std::map<DetId, double>::iterator
itr =
corrFactor_.find(mydetid);
602 icalconst =
itr->second;
604 HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
605 double energyhit = aHit.
energy();
606 DetId id = (*hbheItr).detid();
616 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
623 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
625 itr1->second->Fill(energyhit);
627 h_[hid.
subdet() - 1]->Fill(energyhit);
628 if (energyhit >
eMin_) {
641 if (
Noise_ ||
runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
642 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
643 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
644 if (itr1 ==
myMap_.end()) {
646 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
647 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
649 itr1->second.theMB0 +=
weight;
650 itr1->second.theMB1 += (
weight * energyhit);
651 itr1->second.theMB2 += (
weight * energyhit * energyhit);
652 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
653 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
654 itr1->second.runcheck =
rnnum_;
668 << count2HB <<
":" << countHB <<
":" << (double)(count2HB) / countHB <<
"\t HE "
669 << count2HE <<
":" << countHE <<
":" << (double)(count2HE) / countHE;
671 int countHF(0), count2HF(0);
676 double icalconst(1.);
678 std::map<DetId, double>::iterator
itr =
corrFactor_.find(mydetid);
680 icalconst =
itr->second;
682 HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
684 double energyhit = aHit.
energy();
685 DetId id = (*hfItr).detid();
689 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
696 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
698 itr1->second->Fill(energyhit);
700 h_[hid.
subdet() - 1]->Fill(energyhit);
701 if (energyhit >
eMin_) {
712 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
713 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
714 if (itr1 ==
myMap_.end()) {
716 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
717 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
719 itr1->second.theMB0 +=
weight;
720 itr1->second.theMB1 += (
weight * energyhit);
721 itr1->second.theMB2 += (
weight * energyhit * energyhit);
722 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
723 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
724 itr1->second.runcheck =
rnnum_;
728 if (
fill && countHF > 0)
732 edm::LogVerbatim(
"RecAnalyzer") <<
"HF " << count2HF <<
":" << countHF <<
":" << (double)(count2HF) / countHF;