129 usesResource(
"TFileService");
165 tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
168 std::ifstream
infile(cfile.c_str());
171 edm::LogWarning(
"RecAnalyzer") <<
"Cannot open '" << cfile <<
"' for the correction file";
173 unsigned int ndets(0), nrec(0);
182 std::map<DetId, double>::iterator itr =
corrFactor_.find(detId);
189 edm::LogVerbatim(
"RecAnalyzer") <<
"Reads " << nrec <<
" correction factors for " << ndets <<
" detIds";
194 <<
runNZS_ <<
" and with " <<
ieta.size() <<
" detId for full histogram";
197 for (
unsigned int k = 0;
k <
ieta.size(); ++
k) {
215 std::vector<int> iarray;
217 desc.add<
bool>(
"runNZS",
true);
218 desc.add<
bool>(
"noise",
false);
219 desc.add<
double>(
"eLowHB", 4);
220 desc.add<
double>(
"eHighHB", 100);
221 desc.add<
double>(
"eLowHE", 4);
222 desc.add<
double>(
"eHighHE", 150);
223 desc.add<
double>(
"eLowHF", 10);
224 desc.add<
double>(
"eHighHF", 150);
226 desc.addUntracked<
double>(
"eMin", 2.0);
228 desc.addUntracked<
int>(
"runMin", 308327);
229 desc.addUntracked<
int>(
"runMax", 308347);
230 desc.addUntracked<std::vector<int>>(
"triggerBits", iarray);
231 desc.addUntracked<
bool>(
"ignoreL1",
false);
233 desc.addUntracked<
bool>(
"fillHisto",
false);
234 desc.addUntracked<
bool>(
"extraHisto",
false);
235 desc.addUntracked<std::vector<int>>(
"hcalIeta", iarray);
236 desc.addUntracked<std::vector<int>>(
"hcalIphi", iarray);
237 desc.addUntracked<std::vector<int>>(
"hcalDepth", iarray);
242 descriptions.
add(
"recAnalyzerMinbias",
desc);
246 std::string hc[5] = {
"Empty",
"HB",
"HE",
"HO",
"HF"};
248 hbhe_ =
fs_->
make<TH2D>(
"hbhe",
"Noise in HB/HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
249 hb_ =
fs_->
make<TH2D>(
"hb",
"Noise in HB", 61, -16.5, 16.5, 72, 0.5, 72.5);
250 he_ =
fs_->
make<TH2D>(
"he",
"Noise in HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
251 hf_ =
fs_->
make<TH2D>(
"hf",
"Noise in HF", 82, -41.5, 41.5, 72, 0.5, 72.5);
253 sprintf(
title,
"Fraction of channels in HB/HE with E > %4.1f GeV vs Run number",
eMin_);
255 sprintf(
title,
"Fraction of channels in HB with E > %4.1f GeV vs Run number",
eMin_);
257 sprintf(
title,
"Fraction of channels in HE with E > %4.1f GeV vs Run number",
eMin_);
259 sprintf(
title,
"Fraction of channels in HF with E > %4.1f GeV vs Run number",
eMin_);
261 for (
int idet = 1; idet <= 4; idet++) {
262 sprintf(
name,
"%s", hc[idet].c_str());
263 sprintf(
title,
"Noise distribution for %s", hc[idet].c_str());
267 for (
const auto& hcalid :
hcalID_) {
269 int subdet =
id.subdetId();
270 sprintf(
name,
"%s%d_%d_%d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
272 "Energy Distribution for %s ieta %d iphi %d depth %d",
277 double xmin = (subdet == 4) ? -10 : -1;
278 double xmax = (subdet == 4) ? 90 : 9;
320 for (
const auto& itr :
myMap_) {
321 edm::LogVerbatim(
"RecAnalyzer") <<
"Fired trigger bit number " << itr.first.first;
323 if (
info.theMB0 > 0) {
331 mysubd = itr.first.second.subdet();
332 depth = itr.first.second.depth();
333 iphi = itr.first.second.iphi();
334 ieta = itr.first.second.ieta();
346 edm::LogVerbatim(
"RecAnalyzer") <<
"Exiting from RecAnalyzerMinbias::endjob";
360 double x_min = (
Noise_) ? -3. : 0.;
366 if (hcaltopology->
valid(cell)) {
378 x_min = (
Noise_) ? -3. : 0.;
384 if (hcaltopology->
valid(cell)) {
396 x_min = (
Noise_) ? -10. : 0.;
402 if (hcaltopology->
valid(cell)) {
424 double amplitudefullHB(0), amplitudefullHE(0), amplitudefullHF(0);
428 for (
auto const& digi : *(hbhedigi.
product())) {
429 int nTS = digi.size();
430 double amplitudefullTSs = 0.;
433 for (
int i = 0;
i < nTS;
i++)
434 amplitudefullTSs += digi.sample(
i).adc();
436 amplitudefullHB += amplitudefullTSs;
441 for (
int i = 0;
i < nTS;
i++)
442 amplitudefullTSs += digi.sample(
i).adc();
444 amplitudefullHE += amplitudefullTSs;
454 double amplitudefullTSs = 0.;
456 for (
int i = 0;
i < digi.samples();
i++)
457 amplitudefullTSs += digi[
i].
adc();
459 amplitudefullHB += amplitudefullTSs;
462 for (
int i = 0;
i < digi.samples();
i++)
463 amplitudefullTSs += digi[
i].
adc();
465 amplitudefullHE += amplitudefullTSs;
473 for (
auto const& digi : *(hfdigi.
product())) {
474 int nTS = digi.size();
475 double amplitudefullTSs = 0.;
478 for (
int i = 0;
i < nTS;
i++)
479 amplitudefullTSs += digi.sample(
i).adc();
481 amplitudefullHF += amplitudefullTSs;
491 double amplitudefullTSs = 0.;
493 for (
int i = 0;
i < digi.samples();
i++)
494 amplitudefullTSs += digi[
i].
adc();
496 amplitudefullHF += amplitudefullTSs;
509 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
522 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hf product!";
536 if (gtObjectMapRecord.
isValid()) {
537 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
538 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
540 bool resultGt = (*itMap).algoGtlResult();
542 int algoBit = (*itMap).algoBitNumber();
556 double eventWeight = 1.0;
566 analyzeHcal(HithbheMB, HithfMB, 1,
true, eventWeight);
570 if (gtObjectMapRecord.
isValid()) {
571 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
573 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
575 bool resultGt = (*itMap).algoGtlResult();
577 int algoBit = (*itMap).algoBitNumber();
578 analyzeHcal(HithbheMB, HithfMB, algoBit, (!
ok), eventWeight);
592 int count(0), countHB(0), countHE(0), count2(0), count2HB(0), count2HE(0);
596 double icalconst(1.);
598 std::map<DetId, double>::iterator itr =
corrFactor_.find(mydetid);
600 icalconst = itr->second;
602 HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
603 double energyhit = aHit.
energy();
604 DetId id = (*hbheItr).detid();
614 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
621 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
623 itr1->second->Fill(energyhit);
625 h_[hid.
subdet() - 1]->Fill(energyhit);
626 if (energyhit >
eMin_) {
639 if (
Noise_ ||
runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
640 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
641 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
642 if (itr1 ==
myMap_.end()) {
644 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
645 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
647 itr1->second.theMB0 +=
weight;
648 itr1->second.theMB1 += (
weight * energyhit);
649 itr1->second.theMB2 += (
weight * energyhit * energyhit);
650 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
651 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
652 itr1->second.runcheck =
rnnum_;
666 << count2HB <<
":" << countHB <<
":" << (double)(count2HB) / countHB <<
"\t HE "
667 << count2HE <<
":" << countHE <<
":" << (double)(count2HE) / countHE;
669 int countHF(0), count2HF(0);
674 double icalconst(1.);
676 std::map<DetId, double>::iterator itr =
corrFactor_.find(mydetid);
678 icalconst = itr->second;
680 HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
682 double energyhit = aHit.
energy();
683 DetId id = (*hfItr).detid();
687 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
694 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
696 itr1->second->Fill(energyhit);
698 h_[hid.
subdet() - 1]->Fill(energyhit);
699 if (energyhit >
eMin_) {
710 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
711 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
712 if (itr1 ==
myMap_.end()) {
714 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
715 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
717 itr1->second.theMB0 +=
weight;
718 itr1->second.theMB1 += (
weight * energyhit);
719 itr1->second.theMB2 += (
weight * energyhit * energyhit);
720 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
721 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
722 itr1->second.runcheck =
rnnum_;
726 if (
fill && countHF > 0)
730 edm::LogVerbatim(
"RecAnalyzer") <<
"HF " << count2HF <<
":" << countHF <<
":" << (double)(count2HF) / countHF;