59 namespace HcalMinbias {}
138 tok_respCorr_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd>();
146 for (
int subd = 0; subd < 4; ++subd) {
147 sprintf(name,
"Noise_%s", det[subd].c_str());
148 sprintf(title,
"Energy Distribution for Noise in %s", det[subd].c_str());
149 h_Noise[subd] =
new TH1D(name, title, 100, -10., 10.);
150 sprintf(name,
"Signal_%s", det[subd].c_str());
151 sprintf(title,
"Energy Distribution for Signal in %s", det[subd].c_str());
152 h_Signal[subd] =
new TH1D(name, title, 100, -10., 10.);
157 myTree = fs->
make<TTree>(
"RecJet",
"RecJet Tree");
158 myTree->Branch(
"mydet", &
mydet,
"mydet/I");
159 myTree->Branch(
"mysubd", &
mysubd,
"mysubd/I");
160 myTree->Branch(
"cells", &
cells,
"cells");
161 myTree->Branch(
"depth", &
depth,
"depth/I");
162 myTree->Branch(
"ieta", &
ieta,
"ieta/I");
163 myTree->Branch(
"iphi", &
iphi,
"iphi/I");
164 myTree->Branch(
"eta", &
eta,
"eta/F");
165 myTree->Branch(
"phi", &
phi,
"phi/F");
166 myTree->Branch(
"mom0_MB", &
mom0_MB,
"mom0_MB/F");
167 myTree->Branch(
"mom1_MB", &
mom1_MB,
"mom1_MB/F");
168 myTree->Branch(
"mom2_MB", &
mom2_MB,
"mom2_MB/F");
169 myTree->Branch(
"mom3_MB", &
mom3_MB,
"mom3_MB/F");
170 myTree->Branch(
"mom4_MB", &
mom4_MB,
"mom4_MB/F");
171 myTree->Branch(
"mom0_Noise", &
mom0_Noise,
"mom0_Noise/F");
172 myTree->Branch(
"mom1_Noise", &
mom1_Noise,
"mom1_Noise/F");
173 myTree->Branch(
"mom2_Noise", &
mom2_Noise,
"mom2_Noise/F");
174 myTree->Branch(
"mom3_Noise", &
mom3_Noise,
"mom3_Noise/F");
175 myTree->Branch(
"mom4_Noise", &
mom4_Noise,
"mom4_Noise/F");
176 myTree->Branch(
"mom0_Diff", &
mom0_Diff,
"mom0_Diff/F");
177 myTree->Branch(
"mom1_Diff", &
mom1_Diff,
"mom1_Diff/F");
178 myTree->Branch(
"mom2_Diff", &
mom2_Diff,
"mom2_Diff/F");
179 myTree->Branch(
"occup", &
occup,
"occup/F");
180 myTree->Branch(
"trigbit", &
trigbit,
"trigbit/I");
181 myTree->Branch(
"rnnumber", &
rnnumber,
"rnnumber/D");
190 for (std::map<std::pair<int, HcalDetId>,
myInfo>::const_iterator itr =
myMap_.begin(); itr !=
myMap_.end(); ++itr) {
192 edm::LogVerbatim(
"AnalyzerMB") <<
"Fired trigger bit number " << itr->first.first;
211 mysubd = itr->first.second.subdet();
212 depth = itr->first.second.depth();
213 ieta = itr->first.second.ieta();
214 iphi = itr->first.second.iphi();
234 for (
int i = 0;
i < 4;
i++) {
259 edm::LogVerbatim(
"AnalyzerMB") <<
" The size of the normal collection " << hbheNormal->size();
265 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hbheNoise product!";
278 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
291 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hfNoise product!";
304 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hf product!";
315 analyzeHcal(myRecalib, HithbheNS, HithbheMB, HithfNS, HithfMB, 1,
true);
319 if (gtObjectMapRecord.
isValid()) {
320 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
322 bool ok(
false),
fill(
true);
323 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
325 bool resultGt = (*itMap).algoGtlResult();
328 int algoBit = (*itMap).algoBitNumber();
329 analyzeHcal(myRecalib, HithbheNS, HithbheMB, HithfNS, HithfMB, algoBit, fill);
333 edm::LogVerbatim(
"AnalyzerMB") <<
"Trigger[" << ii <<
"] " << algoNameStr <<
" bit " << algoBit <<
" entered";
351 std::map<std::pair<int, HcalDetId>,
myInfo> tmpMap;
356 float icalconst = 1.;
361 HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
362 double energyhit = aHit.
energy();
364 DetId id = (*hbheItr).detid();
366 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
367 if (itr1 ==
myMap_.end()) {
369 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
370 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
372 itr1->second.theNS0++;
373 itr1->second.theNS1 += energyhit;
374 itr1->second.theNS2 += (energyhit * energyhit);
375 itr1->second.theNS3 += (energyhit * energyhit * energyhit);
376 itr1->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
377 itr1->second.runcheck =
rnnum;
381 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
382 if (itr2 == tmpMap.end()) {
384 tmpMap[std::pair<int, HcalDetId>(algoBit, hid)] = info;
385 itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
388 itr2->second.theNS1 += energyhit;
389 itr2->second.theNS2 += (energyhit * energyhit);
390 itr2->second.theNS3 += (energyhit * energyhit * energyhit);
391 itr2->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
392 itr2->second.runcheck =
rnnum;
400 float icalconst = 1.;
405 HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
406 double energyhit = aHit.
energy();
408 DetId id = (*hbheItr).detid();
411 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
412 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
414 if (itr1 ==
myMap_.end()) {
416 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
417 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
419 itr1->second.theMB0++;
420 itr1->second.theDif0 = 0;
421 itr1->second.theMB1 += energyhit;
422 itr1->second.theMB2 += (energyhit * energyhit);
423 itr1->second.theMB3 += (energyhit * energyhit * energyhit);
424 itr1->second.theMB4 += (energyhit * energyhit * energyhit * energyhit);
425 itr1->second.runcheck =
rnnum;
427 if (itr2 != tmpMap.end()) {
428 mydiff = energyhit - (itr2->second.theNS1);
429 itr1->second.theDif0++;
430 itr1->second.theDif1 += mydiff;
431 itr1->second.theDif2 += (mydiff * mydiff);
441 float icalconst = 1.;
446 HFRecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
447 double energyhit = aHit.
energy();
449 if (fabs(energyhit) > 40.)
451 DetId id = (*hbheItr).detid();
454 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
456 if (itr1 ==
myMap_.end()) {
458 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
459 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
461 itr1->second.theNS0++;
462 itr1->second.theNS1 += energyhit;
463 itr1->second.theNS2 += (energyhit * energyhit);
464 itr1->second.theNS3 += (energyhit * energyhit * energyhit);
465 itr1->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
466 itr1->second.runcheck =
rnnum;
470 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
471 if (itr2 == tmpMap.end()) {
473 tmpMap[std::pair<int, HcalDetId>(algoBit, hid)] = info;
474 itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
477 itr2->second.theNS1 += energyhit;
478 itr2->second.theNS2 += (energyhit * energyhit);
479 itr2->second.theNS3 += (energyhit * energyhit * energyhit);
480 itr2->second.theNS4 += (energyhit * energyhit * energyhit * energyhit);
481 itr2->second.runcheck =
rnnum;
489 float icalconst = 1.;
493 HFRecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
495 double energyhit = aHit.
energy();
497 if (fabs(energyhit) > 40.)
500 DetId id = (*hbheItr).detid();
503 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
504 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int, HcalDetId>(algoBit, hid));
506 if (itr1 ==
myMap_.end()) {
508 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
509 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
511 itr1->second.theMB0++;
512 itr1->second.theDif0 = 0;
513 itr1->second.theMB1 += energyhit;
514 itr1->second.theMB2 += (energyhit * energyhit);
515 itr1->second.theMB3 += (energyhit * energyhit * energyhit);
516 itr1->second.theMB4 += (energyhit * energyhit * energyhit * energyhit);
517 itr1->second.runcheck =
rnnum;
519 if (itr2 != tmpMap.end()) {
520 mydiff = energyhit - (itr2->second.theNS1);
521 itr1->second.theDif0++;
522 itr1->second.theDif1 += mydiff;
523 itr1->second.theDif2 += (mydiff * mydiff);
constexpr float energy() const
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheNormal_
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoNoise_
~AnalyzerMinbias() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respCorr_
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
T * make(const Args &...args) const
make new ROOT object
const Item * getValues(DetId fId, bool throwOnFail=true) const
AnalyzerMinbias(const edm::ParameterSet &)
edm::EDGetTokenT< HORecHitCollection > tok_horecoNoise_
std::string fOutputFileName
bool getData(T &iHolder) const
edm::EDGetTokenT< HORecHitCollection > tok_horecoMB_
constexpr HcalSubdetector subdet() const
get the subdetector
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
std::ofstream * myout_hcal
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
const_iterator end() const
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
T const * product() const
T getParameter(std::string const &) const
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
Log< level::Warning, false > LogWarning
void analyzeHcal(const HcalRespCorrs *myRecalib, const HBHERecHitCollection &HithbheNS, const HBHERecHitCollection &HithbheMB, const HFRecHitCollection &HithfNS, const HFRecHitCollection &HithfMB, int algoBit, bool fill)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoNoise_
void analyze(const edm::Event &, const edm::EventSetup &) override
const_iterator begin() const