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) {
202 unsigned int id = (
HcalDetId(subd, ieta[k], iphi[k], depth[k])).rawId();
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);
227 desc.
addUntracked<std::vector<int>>(
"triggerBits", iarray);
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");
318 for (
const auto& itr :
myMap_) {
319 edm::LogVerbatim(
"RecAnalyzerMinbias") <<
"Fired trigger bit number " << itr.first.first;
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)) {
365 sprintf(name,
"HBeta%dphi%ddep%d",
eta,
phi,
depth);
366 sprintf(title,
"HB #eta %d #phi %d depth %d",
eta,
phi,
depth);
376 x_min = (
Noise_) ? -3. : 0.;
382 if (hcaltopology->
valid(cell)) {
383 sprintf(name,
"HEeta%dphi%ddep%d",
eta,
phi,
depth);
384 sprintf(title,
"HE #eta %d #phi %d depth %d",
eta,
phi,
depth);
394 x_min = (
Noise_) ? -10. : 0.;
400 if (hcaltopology->
valid(cell)) {
401 sprintf(name,
"HFeta%dphi%ddep%d",
eta,
phi,
depth);
402 sprintf(title,
"Energy (HF #eta %d #phi %d depth %d)",
eta,
phi,
depth);
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;
550 eventWeight = genEventInfo->weight();
553 <<
":" << select <<
":" <<
ignoreL1_ <<
" Wt " << eventWeight;
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;
constexpr float energy() const
Log< level::Info, true > LogVerbatim
RecAnalyzerMinbias(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< HFDigiCollection > tok_hfdigi_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
uint16_t *__restrict__ id
TH1D * h_AmplitudeHFtest_
#define DEFINE_FWK_MODULE(type)
bool valid(const DetId &id) const override
const edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T * make(const Args &...args) const
make new ROOT object
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_
const edm::EDGetTokenT< QIE11DigiCollection > tok_qie11digi_
std::vector< TH1D * > histo_
bool getData(T &iHolder) const
constexpr HcalSubdetector subdet() const
get the subdetector
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
constexpr int iphi() const
get the cell iphi
const edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tok_gtRec_
Abs< T >::type abs(const T &t)
constexpr int ieta() const
get the cell ieta
void analyze(edm::Event const &, edm::EventSetup const &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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 fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
void endRun(edm::Run const &, edm::EventSetup const &) override
T const * product() const
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_
void beginRun(edm::Run const &, edm::EventSetup const &) override
const_iterator begin() const
std::map< DetId, double > corrFactor_
uint16_t *__restrict__ uint16_t const *__restrict__ adc