130 : runNZS_(iConfig.getParameter<
bool>(
"runNZS")),
131 Noise_(iConfig.getParameter<
bool>(
"noise")),
132 ignoreL1_(iConfig.getUntrackedParameter<
bool>(
"ignoreL1",
false)),
133 fillHist_(iConfig.getUntrackedParameter<
bool>(
"fillHisto",
false)),
134 extraHist_(iConfig.getUntrackedParameter<
bool>(
"extraHisto",
false)),
135 eLowHB_(iConfig.getParameter<double>(
"eLowHB")),
136 eHighHB_(iConfig.getParameter<double>(
"eHighHB")),
137 eLowHE_(iConfig.getParameter<double>(
"eLowHE")),
138 eHighHE_(iConfig.getParameter<double>(
"eHighHE")),
139 eLowHF_(iConfig.getParameter<double>(
"eLowHF")),
140 eHighHF_(iConfig.getParameter<double>(
"eHighHF")),
141 eMin_(iConfig.getUntrackedParameter<double>(
"eMin", 2.0)),
142 runMin_(iConfig.getUntrackedParameter<
int>(
"RunMin", 308327)),
143 runMax_(iConfig.getUntrackedParameter<
int>(
"RunMax", 315250)),
144 trigbit_(iConfig.getUntrackedParameter<
std::
vector<
int>>(
"triggerBits")),
145 cfile_(iConfig.getUntrackedParameter<
std::
string>(
"corrFile")),
158 usesResource(
"TFileService");
171 unsigned int ndets(0), nrec(0);
180 std::map<DetId, double>::iterator itr =
corrFactor_.find(detId);
187 edm::LogVerbatim(
"RecAnalyzerMinbias") <<
"Reads " << nrec <<
" correction factors for " << ndets <<
" detIds";
192 <<
" (NZS) " <<
runNZS_ <<
" and with " <<
ieta.size()
193 <<
" detId for full histogram";
196 for (
unsigned int k = 0;
k <
ieta.size(); ++
k) {
212 std::vector<int> iarray;
214 desc.add<
bool>(
"runNZS",
true);
215 desc.add<
bool>(
"noise",
false);
216 desc.add<
double>(
"eLowHB", 4);
217 desc.add<
double>(
"eHighHB", 100);
218 desc.add<
double>(
"eLowHE", 4);
219 desc.add<
double>(
"eHighHE", 150);
220 desc.add<
double>(
"eLowHF", 10);
221 desc.add<
double>(
"eHighHF", 150);
223 desc.addUntracked<
double>(
"eMin", 2.0);
225 desc.addUntracked<
int>(
"runMin", 308327);
226 desc.addUntracked<
int>(
"runMax", 308347);
227 desc.addUntracked<std::vector<int>>(
"triggerBits", iarray);
228 desc.addUntracked<
bool>(
"ignoreL1",
false);
230 desc.addUntracked<
bool>(
"fillHisto",
false);
231 desc.addUntracked<
bool>(
"extraHisto",
false);
232 desc.addUntracked<std::vector<int>>(
"hcalIeta", iarray);
233 desc.addUntracked<std::vector<int>>(
"hcalIphi", iarray);
234 desc.addUntracked<std::vector<int>>(
"hcalDepth", iarray);
239 descriptions.
add(
"recAnalyzerMinbias",
desc);
244 std::string hc[5] = {
"Empty",
"HB",
"HE",
"HO",
"HF"};
246 hbhe_ =
fs->make<TH2D>(
"hbhe",
"Noise in HB/HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
247 hb_ =
fs->make<TH2D>(
"hb",
"Noise in HB", 61, -16.5, 16.5, 72, 0.5, 72.5);
248 he_ =
fs->make<TH2D>(
"he",
"Noise in HE", 61, -30.5, 30.5, 72, 0.5, 72.5);
249 hf_ =
fs->make<TH2D>(
"hf",
"Noise in HF", 82, -41.5, 41.5, 72, 0.5, 72.5);
251 sprintf(
title,
"Fraction of channels in HB/HE with E > %4.1f GeV vs Run number",
eMin_);
253 sprintf(
title,
"Fraction of channels in HB with E > %4.1f GeV vs Run number",
eMin_);
255 sprintf(
title,
"Fraction of channels in HE with E > %4.1f GeV vs Run number",
eMin_);
257 sprintf(
title,
"Fraction of channels in HF with E > %4.1f GeV vs Run number",
eMin_);
259 for (
int idet = 1; idet <= 4; idet++) {
260 sprintf(
name,
"%s", hc[idet].c_str());
261 sprintf(
title,
"Noise distribution for %s", hc[idet].c_str());
265 for (
const auto& hcalid :
hcalID_) {
267 int subdet =
id.subdetId();
268 sprintf(
name,
"%s%d_%d_%d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
270 "Energy Distribution for %s ieta %d iphi %d depth %d",
275 double xmin = (subdet == 4) ? -10 : -1;
276 double xmax = (subdet == 4) ? 90 : 9;
291 myTree_ =
fs->make<TTree>(
"RecJet",
"RecJet Tree");
305 myTree1_ =
fs->make<TTree>(
"RecJet1",
"RecJet1 Tree");
318 for (
const auto& itr :
myMap_) {
319 edm::LogVerbatim(
"RecAnalyzerMinbias") <<
"Fired trigger bit number " << itr.first.first;
321 if (
info.theMB0 > 0) {
329 mysubd = itr.first.second.subdet();
330 depth = itr.first.second.depth();
331 iphi = itr.first.second.iphi();
332 ieta = itr.first.second.ieta();
343 edm::LogVerbatim(
"RecAnalyzerMinbias") <<
"Exiting from RecAnalyzerMinbias::endjob";
358 double x_min = (
Noise_) ? -3. : 0.;
364 if (hcaltopology->
valid(cell)) {
367 TH1D*
h =
fs->make<TH1D>(
name,
title, nbinHB, x_min, x_max);
376 x_min = (
Noise_) ? -3. : 0.;
382 if (hcaltopology->
valid(cell)) {
385 TH1D*
h =
fs->make<TH1D>(
name,
title, nbinHE, x_min, x_max);
394 x_min = (
Noise_) ? -10. : 0.;
400 if (hcaltopology->
valid(cell)) {
403 TH1D*
h =
fs->make<TH1D>(
name,
title, nbinHF, x_min, x_max);
422 double amplitudefullHB(0), amplitudefullHE(0), amplitudefullHF(0);
425 for (
auto const& digi : *(hbhedigi.
product())) {
426 int nTS = digi.size();
427 double amplitudefullTSs = 0.;
430 for (
int i = 0;
i < nTS;
i++)
431 amplitudefullTSs += digi.sample(
i).adc();
433 amplitudefullHB += amplitudefullTSs;
438 for (
int i = 0;
i < nTS;
i++)
439 amplitudefullTSs += digi.sample(
i).adc();
441 amplitudefullHE += amplitudefullTSs;
450 double amplitudefullTSs = 0.;
452 for (
int i = 0;
i < digi.samples();
i++)
453 amplitudefullTSs += digi[
i].
adc();
455 amplitudefullHB += amplitudefullTSs;
458 for (
int i = 0;
i < digi.samples();
i++)
459 amplitudefullTSs += digi[
i].
adc();
461 amplitudefullHE += amplitudefullTSs;
468 for (
auto const& digi : *(hfdigi.
product())) {
469 int nTS = digi.size();
470 double amplitudefullTSs = 0.;
473 for (
int i = 0;
i < nTS;
i++)
474 amplitudefullTSs += digi.sample(
i).adc();
476 amplitudefullHF += amplitudefullTSs;
485 double amplitudefullTSs = 0.;
487 for (
int i = 0;
i < digi.samples();
i++)
488 amplitudefullTSs += digi[
i].
adc();
490 amplitudefullHF += amplitudefullTSs;
502 edm::LogWarning(
"RecAnalyzerMinbias") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
514 edm::LogWarning(
"RecAnalyzerMinbias") <<
"HcalCalibAlgos: Error! can't get hf product!";
527 if (gtObjectMapRecord.
isValid()) {
528 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
529 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
531 bool resultGt = (*itMap).algoGtlResult();
533 int algoBit = (*itMap).algoBitNumber();
547 double eventWeight = 1.0;
556 analyzeHcal(HithbheMB, HithfMB, 1,
true, eventWeight);
559 if (gtObjectMapRecord.
isValid()) {
560 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
562 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
564 bool resultGt = (*itMap).algoGtlResult();
566 int algoBit = (*itMap).algoBitNumber();
567 analyzeHcal(HithbheMB, HithfMB, algoBit, (!
ok), eventWeight);
581 int count(0), countHB(0), countHE(0), count2(0), count2HB(0), count2HE(0);
585 double icalconst(1.);
587 std::map<DetId, double>::iterator itr =
corrFactor_.find(mydetid);
589 icalconst = itr->second;
591 HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
592 double energyhit = aHit.
energy();
593 DetId id = (*hbheItr).detid();
603 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
610 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
612 itr1->second->Fill(energyhit);
614 h_[hid.
subdet() - 1]->Fill(energyhit);
615 if (energyhit >
eMin_) {
628 if (
Noise_ ||
runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
629 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
630 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
631 if (itr1 ==
myMap_.end()) {
633 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
634 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
636 itr1->second.theMB0 +=
weight;
637 itr1->second.theMB1 += (
weight * energyhit);
638 itr1->second.theMB2 += (
weight * energyhit * energyhit);
639 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
640 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
641 itr1->second.runcheck =
rnnum_;
655 <<
"\t HB " << count2HB <<
":" << countHB <<
":" 656 << (double)(count2HB) / countHB <<
"\t HE " << count2HE <<
":" << countHE
657 <<
":" << (double)(count2HE) / countHE;
659 int countHF(0), count2HF(0);
664 double icalconst(1.);
666 std::map<DetId, double>::iterator itr =
corrFactor_.find(mydetid);
668 icalconst = itr->second;
670 HFRecHit aHit(hfItr->id(), hfItr->energy() * icalconst, hfItr->time());
672 double energyhit = aHit.
energy();
673 DetId id = (*hfItr).detid();
677 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
684 std::map<HcalDetId, TH1D*>::iterator itr1 =
histHC_.find(hid);
686 itr1->second->Fill(energyhit);
688 h_[hid.
subdet() - 1]->Fill(energyhit);
689 if (energyhit >
eMin_) {
700 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
701 myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
702 if (itr1 ==
myMap_.end()) {
704 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] =
info;
705 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
707 itr1->second.theMB0 +=
weight;
708 itr1->second.theMB1 += (
weight * energyhit);
709 itr1->second.theMB2 += (
weight * energyhit * energyhit);
710 itr1->second.theMB3 += (
weight * energyhit * energyhit * energyhit);
711 itr1->second.theMB4 += (
weight * energyhit * energyhit * energyhit * energyhit);
712 itr1->second.runcheck =
rnnum_;
716 if (
fill && countHF > 0)
721 <<
"HF " << count2HF <<
":" << countHF <<
":" << (double)(count2HF) / countHF;
Log< level::Info, true > LogVerbatim
RecAnalyzerMinbias(const edm::ParameterSet &)
const edm::EDGetTokenT< HFDigiCollection > tok_hfdigi_
TH1D * h_AmplitudeHFtest_
#define DEFINE_FWK_MODULE(type)
bool valid(const DetId &id) const override
const edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
T const * product() const
std::vector< T >::const_iterator const_iterator
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::map< HcalDetId, TH1D * > histHC_
constexpr float energy() const
const edm::EDGetTokenT< QIE11DigiCollection > tok_qie11digi_
const std::vector< L1GlobalTriggerObjectMap > & gtObjectMap() const
get / set the vector of object maps
std::vector< TH1D * > histo_
T getUntrackedParameter(std::string const &, T const &) const
constexpr HcalSubdetector subdet() const
get the subdetector
constexpr int ieta() const
get the cell ieta
const edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tok_gtRec_
Abs< T >::type abs(const T &t)
void analyze(edm::Event const &, edm::EventSetup const &) override
bool getData(T &iHolder) const
const_iterator begin() const
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
~RecAnalyzerMinbias() override=default
const_iterator end() const
void analyzeHcal(const HBHERecHitCollection &, const HFRecHitCollection &, int, bool, double)
TH1D * h_AmplitudeHBtest_
void endRun(edm::Run const &, edm::EventSetup const &) override
constexpr uint32_t rawId() const
get the raw id
std::vector< unsigned int > hcalID_
const edm::EDGetTokenT< QIE10DigiCollection > tok_qie10digi_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
const edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
const std::vector< int > trigbit_
const edm::EDGetTokenT< HODigiCollection > tok_hodigi_
const edm::EDGetTokenT< HBHEDigiCollection > tok_hbhedigi_
Log< level::Warning, false > LogWarning
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
TH1D * h_AmplitudeHEtest_
constexpr int iphi() const
get the cell iphi
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::map< DetId, double > corrFactor_
uint16_t *__restrict__ uint16_t const *__restrict__ adc