62 namespace HcalMinbias {
149 for (
int subd=0; subd<4; ++subd) {
150 sprintf(name,
"Noise_%s",det[subd].c_str());
151 sprintf(title,
"Energy Distribution for Noise in %s",det[subd].c_str());
152 h_Noise[subd] =
new TH1D(name,title,100,-10.,10.);
153 sprintf(name,
"Signal_%s",det[subd].c_str());
154 sprintf(title,
"Energy Distribution for Signal in %s",det[subd].c_str());
155 h_Signal[subd] =
new TH1D(name,title,100,-10.,10.);
159 myTree =
new TTree(
"RecJet",
"RecJet Tree");
160 myTree->Branch(
"mydet", &
mydet,
"mydet/I");
161 myTree->Branch(
"mysubd", &
mysubd,
"mysubd/I");
162 myTree->Branch(
"cells", &
cells,
"cells");
163 myTree->Branch(
"depth", &
depth,
"depth/I");
164 myTree->Branch(
"ieta", &
ieta,
"ieta/I");
165 myTree->Branch(
"iphi", &
iphi,
"iphi/I");
166 myTree->Branch(
"eta", &
eta,
"eta/F");
167 myTree->Branch(
"phi", &
phi,
"phi/F");
168 myTree->Branch(
"mom0_MB", &
mom0_MB,
"mom0_MB/F");
169 myTree->Branch(
"mom1_MB", &
mom1_MB,
"mom1_MB/F");
170 myTree->Branch(
"mom2_MB", &
mom2_MB,
"mom2_MB/F");
171 myTree->Branch(
"mom3_MB", &
mom3_MB,
"mom3_MB/F");
172 myTree->Branch(
"mom4_MB", &
mom4_MB,
"mom4_MB/F");
173 myTree->Branch(
"mom0_Noise", &
mom0_Noise,
"mom0_Noise/F");
174 myTree->Branch(
"mom1_Noise", &
mom1_Noise,
"mom1_Noise/F");
175 myTree->Branch(
"mom2_Noise", &
mom2_Noise,
"mom2_Noise/F");
176 myTree->Branch(
"mom3_Noise", &
mom2_Noise,
"mom3_Noise/F");
177 myTree->Branch(
"mom4_Noise", &
mom4_Noise,
"mom4_Noise/F");
178 myTree->Branch(
"mom0_Diff", &
mom0_Diff,
"mom0_Diff/F");
179 myTree->Branch(
"mom1_Diff", &
mom1_Diff,
"mom1_Diff/F");
180 myTree->Branch(
"mom2_Diff", &
mom2_Diff,
"mom2_Diff/F");
181 myTree->Branch(
"occup", &
occup,
"occup/F");
182 myTree->Branch(
"trigbit", &
trigbit,
"trigbit/I");
183 myTree->Branch(
"rnnumber", &
rnnumber,
"rnnumber/D");
194 LogDebug(
"AnalyzerMB") <<
"Fired trigger bit number " << itr->first.first;
212 mysubd = itr->first.second.subdet();
213 depth = itr->first.second.depth();
214 ieta = itr->first.second.ieta();
215 iphi = itr->first.second.iphi();
218 <<
" " <<
ieta <<
" " <<
iphi <<
" mom0 "
222 <<
" mom1_Noise " <<
mom1_Noise <<
" mom2_Noise "
224 <<
" mom4_Noise " <<
mom4_Noise <<
" mom0_Diff "
236 for(
int i=0;
i<4;
i++){
257 myRecalib = recalibCorrs.
product();
265 edm::LogInfo(
"AnalyzerMB") <<
" The size of the normal collection "
266 << hbheNormal->size();
272 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hbheNoise product!";
276 edm::LogInfo(
"AnalyzerMB") <<
"HBHE NS size of collection " << HithbheNS.
size();
286 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
290 edm::LogInfo(
"AnalyzerMB") <<
"HBHE MB size of collection " << HithbheMB.
size();
300 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hfNoise product!";
314 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hf product!";
318 edm::LogInfo(
"AnalyzerMB") <<
"HF MB size of collection " << HithfMB.
size();
326 analyzeHcal(myRecalib,HithbheNS,HithbheMB,HithfNS,HithfMB,1,
true);
330 if (gtObjectMapRecord.
isValid()) {
331 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
333 bool ok(
false),
fill(
true);
334 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
335 itMap != objMapVec.end(); ++itMap, ++
ii) {
336 bool resultGt = (*itMap).algoGtlResult();
339 int algoBit = (*itMap).algoBitNumber();
340 analyzeHcal(myRecalib,HithbheNS,HithbheMB,HithfNS,HithfMB,algoBit,fill);
343 LogDebug(
"AnalyzerMB") <<
"Trigger[" << ii <<
"] " << algoNameStr
344 <<
" bit " << algoBit <<
" entered";
357 int algoBit,
bool fill) {
360 std::map<std::pair<int,HcalDetId>,
myInfo> tmpMap;
364 hbheItr!=HithbheNS.
end(); hbheItr++) {
371 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
372 double energyhit = aHit.
energy();
374 DetId id = (*hbheItr).detid();
376 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
377 if (itr1 ==
myMap_.end()) {
379 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
380 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
382 itr1->second.theNS0++;
383 itr1->second.theNS1 += energyhit;
384 itr1->second.theNS2 += (energyhit*energyhit);
385 itr1->second.theNS3 += (energyhit*energyhit*energyhit);
386 itr1->second.theNS4 += (energyhit*energyhit*energyhit*energyhit);
387 itr1->second.runcheck =
rnnum;
390 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int,HcalDetId>(algoBit,hid));
391 if (itr2 == tmpMap.end()) {
393 tmpMap[std::pair<int,HcalDetId>(algoBit,hid)] = info;
394 itr2 = tmpMap.find(std::pair<int,HcalDetId>(algoBit,hid));
397 itr2->second.theNS1 += energyhit;
398 itr2->second.theNS2 += (energyhit*energyhit);
399 itr2->second.theNS3 += (energyhit*energyhit*energyhit);
400 itr2->second.theNS4 += (energyhit*energyhit*energyhit*energyhit);
401 itr2->second.runcheck =
rnnum;
408 hbheItr!=HithbheMB.
end(); hbheItr++) {
414 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
415 double energyhit = aHit.
energy();
417 DetId id = (*hbheItr).detid();
420 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
421 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int,HcalDetId>(algoBit,hid));
423 if (itr1 ==
myMap_.end()) {
425 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
426 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
428 itr1->second.theMB0++;
429 itr1->second.theDif0 = 0;
430 itr1->second.theMB1 += energyhit;
431 itr1->second.theMB2 += (energyhit*energyhit);
432 itr1->second.theMB3 += (energyhit*energyhit*energyhit);
433 itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
434 itr1->second.runcheck =
rnnum;
436 if (itr2 !=tmpMap.end()) {
437 mydiff = energyhit - (itr2->second.theNS1);
438 itr1->second.theDif0++;
439 itr1->second.theDif1 += mydiff;
440 itr1->second.theDif2 += (mydiff*mydiff);
448 hbheItr!=HithfNS.
end(); hbheItr++) {
454 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
455 double energyhit = aHit.
energy();
457 if(fabs(energyhit) > 40. )
continue;
458 DetId id = (*hbheItr).detid();
461 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
463 if (itr1 ==
myMap_.end()) {
465 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
466 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
468 itr1->second.theNS0++;
469 itr1->second.theNS1 += energyhit;
470 itr1->second.theNS2 += (energyhit*energyhit);
471 itr1->second.theNS3 += (energyhit*energyhit*energyhit);
472 itr1->second.theNS4 += (energyhit*energyhit*energyhit*energyhit);
473 itr1->second.runcheck =
rnnum;
476 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int,HcalDetId>(algoBit,hid));
477 if (itr2 == tmpMap.end()) {
479 tmpMap[std::pair<int,HcalDetId>(algoBit,hid)] = info;
480 itr2 = tmpMap.find(std::pair<int,HcalDetId>(algoBit,hid));
483 itr2->second.theNS1 += energyhit;
484 itr2->second.theNS2 += (energyhit*energyhit);
485 itr2->second.theNS3 += (energyhit*energyhit*energyhit);
486 itr2->second.theNS4 += (energyhit*energyhit*energyhit*energyhit);
487 itr2->second.runcheck =
rnnum;
495 hbheItr!=HithfMB.
end(); hbheItr++) {
500 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
502 double energyhit = aHit.
energy();
504 if(fabs(energyhit) > 40. )
continue;
506 DetId id = (*hbheItr).detid();
509 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
510 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr2 = tmpMap.find(std::pair<int,HcalDetId>(algoBit,hid));
512 if (itr1 ==
myMap_.end()) {
514 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
515 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
517 itr1->second.theMB0++;
518 itr1->second.theDif0 = 0;
519 itr1->second.theMB1 += energyhit;
520 itr1->second.theMB2 += (energyhit*energyhit);
521 itr1->second.theMB3 += (energyhit*energyhit*energyhit);
522 itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
523 itr1->second.runcheck =
rnnum;
525 if (itr2 !=tmpMap.end()) {
526 mydiff = energyhit - (itr2->second.theNS1);
527 itr1->second.theDif0++;
528 itr1->second.theDif1 += mydiff;
529 itr1->second.theDif2 += (mydiff*mydiff);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheNormal_
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoNoise_
HcalSubdetector subdet() const
get the subdetector
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< HBHERecHit >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
AnalyzerMinbias(const edm::ParameterSet &)
edm::EDGetTokenT< HORecHitCollection > tok_horecoNoise_
std::string fOutputFileName
uint32_t rawId() const
get the raw id
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
edm::EDGetTokenT< HORecHitCollection > tok_horecoMB_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
std::ofstream * myout_hcal
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
const_iterator end() const
T const * product() const
T const * product() const
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_
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
const_iterator begin() const