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) {
216 std::vector<int> iarray;
218 desc.add<
bool>(
"runNZS",
true);
219 desc.add<
bool>(
"noise",
false);
220 desc.add<
double>(
"eLowHB", 4);
221 desc.add<
double>(
"eHighHB", 100);
222 desc.add<
double>(
"eLowHE", 4);
223 desc.add<
double>(
"eHighHE", 150);
224 desc.add<
double>(
"eLowHF", 10);
225 desc.add<
double>(
"eHighHF", 150);
227 desc.addUntracked<
double>(
"eMin", 2.0);
229 desc.addUntracked<
int>(
"runMin", 308327);
230 desc.addUntracked<
int>(
"runMax", 308347);
231 desc.addUntracked<std::vector<int>>(
"triggerBits", iarray);
232 desc.addUntracked<
bool>(
"ignoreL1",
false);
234 desc.addUntracked<
bool>(
"fillHisto",
false);
235 desc.addUntracked<
bool>(
"extraHisto",
false);
236 desc.addUntracked<std::vector<int>>(
"hcalIeta", iarray);
237 desc.addUntracked<std::vector<int>>(
"hcalIphi", iarray);
238 desc.addUntracked<std::vector<int>>(
"hcalDepth", iarray);
243 descriptions.
add(
"recAnalyzerMinbias",
desc);
247 std::string hc[5] = {
"Empty",
"HB",
"HE",
"HO",
"HF"};
249 hbhe_ =
fs_->
make<TH2D>(
"hbhe",
"Noise in HB/HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
250 hb_ =
fs_->
make<TH2D>(
"hb",
"Noise in HB", 61, -16.5, 16.5, 72, 0.5, 72.5);
251 he_ =
fs_->
make<TH2D>(
"he",
"Noise in HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
252 hf_ =
fs_->
make<TH2D>(
"hf",
"Noise in HF", 82, -41.5, 41.5, 72, 0.5, 72.5);
254 sprintf(
title,
"Fraction of channels in HB/HE with E > %4.1f GeV vs Run number",
eMin_);
256 sprintf(
title,
"Fraction of channels in HB with E > %4.1f GeV vs Run number",
eMin_);
258 sprintf(
title,
"Fraction of channels in HE with E > %4.1f GeV vs Run number",
eMin_);
260 sprintf(
title,
"Fraction of channels in HF with E > %4.1f GeV vs Run number",
eMin_);
262 for (
int idet = 1; idet <= 4; idet++) {
263 sprintf(
name,
"%s", hc[idet].c_str());
264 sprintf(
title,
"Noise distribution for %s", hc[idet].c_str());
268 for (
const auto& hcalid :
hcalID_) {
270 int subdet =
id.subdetId();
271 sprintf(
name,
"%s%d_%d_%d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
273 "Energy Distribution for %s ieta %d iphi %d depth %d",
278 double xmin = (subdet == 4) ? -10 : -1;
279 double xmax = (subdet == 4) ? 90 : 9;
321 for (
const auto& itr :
myMap_) {
322 edm::LogVerbatim(
"RecAnalyzer") <<
"Fired trigger bit number " << itr.first.first;
324 if (
info.theMB0 > 0) {
332 mysubd = itr.first.second.subdet();
333 depth = itr.first.second.depth();
334 iphi = itr.first.second.iphi();
335 ieta = itr.first.second.ieta();
347 edm::LogVerbatim(
"RecAnalyzer") <<
"Exiting from RecAnalyzerMinbias::endjob";
361 double x_min = (
Noise_) ? -3. : 0.;
367 if (hcaltopology->
valid(cell)) {
379 x_min = (
Noise_) ? -3. : 0.;
385 if (hcaltopology->
valid(cell)) {
397 x_min = (
Noise_) ? -10. : 0.;
403 if (hcaltopology->
valid(cell)) {
425 double amplitudefullHB(0), amplitudefullHE(0), amplitudefullHF(0);
429 for (
auto const& digi : *(hbhedigi.
product())) {
430 int nTS = digi.size();
431 double amplitudefullTSs = 0.;
434 for (
int i = 0;
i < nTS;
i++)
435 amplitudefullTSs += digi.sample(
i).adc();
437 amplitudefullHB += amplitudefullTSs;
442 for (
int i = 0;
i < nTS;
i++)
443 amplitudefullTSs += digi.sample(
i).adc();
445 amplitudefullHE += amplitudefullTSs;
455 double amplitudefullTSs = 0.;
457 for (
int i = 0;
i < digi.samples();
i++)
458 amplitudefullTSs += digi[
i].
adc();
460 amplitudefullHB += amplitudefullTSs;
463 for (
int i = 0;
i < digi.samples();
i++)
464 amplitudefullTSs += digi[
i].
adc();
466 amplitudefullHE += amplitudefullTSs;
474 for (
auto const& digi : *(hfdigi.
product())) {
475 int nTS = digi.size();
476 double amplitudefullTSs = 0.;
479 for (
int i = 0;
i < nTS;
i++)
480 amplitudefullTSs += digi.sample(
i).adc();
482 amplitudefullHF += amplitudefullTSs;
492 double amplitudefullTSs = 0.;
494 for (
int i = 0;
i < digi.samples();
i++)
495 amplitudefullTSs += digi[
i].
adc();
497 amplitudefullHF += amplitudefullTSs;
510 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
523 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hf product!";
537 if (gtObjectMapRecord.
isValid()) {
538 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
539 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
541 bool resultGt = (*itMap).algoGtlResult();
543 int algoBit = (*itMap).algoBitNumber();
557 double eventWeight = 1.0;
567 analyzeHcal(HithbheMB, HithfMB, 1,
true, eventWeight);
571 if (gtObjectMapRecord.
isValid()) {
572 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
574 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
576 bool resultGt = (*itMap).algoGtlResult();
578 int algoBit = (*itMap).algoBitNumber();
579 analyzeHcal(HithbheMB, HithfMB, algoBit, (!
ok), eventWeight);
593 int count(0), countHB(0), countHE(0), count2(0), count2HB(0), count2HE(0);
597 double icalconst(1.);
599 std::map<DetId, double>::iterator itr =
corrFactor_.find(mydetid);
601 icalconst = itr->second;
603 HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
604 double energyhit = aHit.
energy();
605 DetId id = (*hbheItr).detid();
615 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
622 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
624 itr1->second->Fill(energyhit);
626 h_[hid.
subdet() - 1]->Fill(energyhit);
627 if (energyhit >
eMin_) {
640 if (
Noise_ ||
runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
641 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
642 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
643 if (itr1 ==
myMap_.end()) {
645 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
646 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
648 itr1->second.theMB0 +=
weight;
649 itr1->second.theMB1 += (
weight * energyhit);
650 itr1->second.theMB2 += (
weight * energyhit * energyhit);
651 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
652 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
653 itr1->second.runcheck =
rnnum_;
667 << count2HB <<
":" << countHB <<
":" << (double)(count2HB) / countHB <<
"\t HE "
668 << count2HE <<
":" << countHE <<
":" << (double)(count2HE) / countHE;
670 int countHF(0), count2HF(0);
675 double icalconst(1.);
677 std::map<DetId, double>::iterator itr =
corrFactor_.find(mydetid);
679 icalconst = itr->second;
681 HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
683 double energyhit = aHit.
energy();
684 DetId id = (*hfItr).detid();
688 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
695 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
697 itr1->second->Fill(energyhit);
699 h_[hid.
subdet() - 1]->Fill(energyhit);
700 if (energyhit >
eMin_) {
711 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
712 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
713 if (itr1 ==
myMap_.end()) {
715 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
716 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
718 itr1->second.theMB0 +=
weight;
719 itr1->second.theMB1 += (
weight * energyhit);
720 itr1->second.theMB2 += (
weight * energyhit * energyhit);
721 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
722 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
723 itr1->second.runcheck =
rnnum_;
727 if (
fill && countHF > 0)
731 edm::LogVerbatim(
"RecAnalyzer") <<
"HF " << count2HF <<
":" << countHF <<
":" << (double)(count2HF) / countHF;