52 tok_gtRec_ = consumes<L1GlobalTriggerReadoutRecord>(
edm::InputTag(
"gtDigisAlCaMB"));
53 tok_hbheNorm_ = consumes<HBHERecHitCollection>(
edm::InputTag(
"hbhereco"));
59 for(
int i=0;
i<73;
i++)
61 for(
int j=0;
j<43;
j++)
72 Analyzer_minbias::~Analyzer_minbias()
86 std::cout<<
" Runnumber "<<r.
run()<<
" Nevents "<<nevent_run<<std::endl;
92 hOutputFile =
new TFile( fOutputFileName.c_str(),
"RECREATE" ) ;
94 myTree =
new TTree(
"RecJet",
"RecJet Tree");
95 myTree->Branch(
"mydet", &mydet,
"mydet/I");
96 myTree->Branch(
"mysubd", &mysubd,
"mysubd/I");
97 myTree->Branch(
"depth", &depth,
"depth/I");
98 myTree->Branch(
"ieta", &ieta,
"ieta/I");
99 myTree->Branch(
"iphi", &iphi,
"iphi/I");
100 myTree->Branch(
"eta", &
eta,
"eta/F");
101 myTree->Branch(
"phi", &
phi,
"phi/F");
103 myTree->Branch(
"mom0_MB", &mom0_MB,
"mom0_MB/F");
104 myTree->Branch(
"mom1_MB", &mom1_MB,
"mom1_MB/F");
105 myTree->Branch(
"mom2_MB", &mom2_MB,
"mom2_MB/F");
106 myTree->Branch(
"mom4_MB", &mom4_MB,
"mom4_MB/F");
108 myTree->Branch(
"mom0_Noise", &mom0_Noise,
"mom0_Noise/F");
109 myTree->Branch(
"mom1_Noise", &mom1_Noise,
"mom1_Noise/F");
110 myTree->Branch(
"mom2_Noise", &mom2_Noise,
"mom2_Noise/F");
111 myTree->Branch(
"mom4_Noise", &mom4_Noise,
"mom4_Noise/F");
113 myTree->Branch(
"mom0_Diff", &mom0_Diff,
"mom0_Diff/F");
114 myTree->Branch(
"mom1_Diff", &mom1_Diff,
"mom1_Diff/F");
115 myTree->Branch(
"mom2_Diff", &mom2_Diff,
"mom2_Diff/F");
117 myTree->Branch(
"occup", &occup,
"occup/F");
119 std::cout<<
" Before ordering Histos "<<std::endl;
131 hHBHEsize_vs_run =
new TH2F(
"hHBHEsize_vs_run",
"hHBHEsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
132 hHFsize_vs_run =
new TH2F(
"hHFsize_vs_run",
"hHFsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
134 for(
int i=1;
i<73;
i++){
135 for(
int j=1;
j<43;
j++){
137 meannoise_pl[
i][
j] = 0.;
138 meannoise_min[
i][
j] = 0.;
142 sprintf(str0,
"mpl%d",k);
143 sprintf(str1,
"mmin%d",k);
145 sprintf(str10,
"vpl%d",k);
146 sprintf(str11,
"vmin%d",k);
151 hCalo1[
i][
j] =
new TH1F(str0,
"h0", 320, -10., 10.);
152 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
155 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 20.);
156 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 20.);
165 hCalo1[
i][
j] =
new TH1F(str0,
"h0", 320, -10., 10.);
166 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
169 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 40.);
170 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 40.);
174 hCalo1[
i][
j] =
new TH1F(str0,
"h0" , 320, -10., 10.);
175 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
178 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 120.);
179 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 120.);
188 hbheNoiseE =
new TH1F(
"hbheNoiseE",
"hbheNoiseE", 320, -10., 10.);
189 hfNoiseE =
new TH1F(
"hfNoiseE",
"hfNoiseE", 320, -10., 10.);
190 hbheSignalE =
new TH1F(
"hbheSignalE",
"hbheSignalE", 320, -10., 10.);
191 hfSignalE =
new TH1F(
"hfSignalE",
"hfSignalE", 320, -10., 10.);
194 std::cout<<
" After ordering Histos "<<std::endl;
198 myout_hcal =
new std::ofstream(ccc.c_str());
199 if(!myout_hcal)
cout <<
" Output file not open!!! "<<endl;
202 for (
int i=0;
i<5;
i++)
204 for (
int j=0;
j<5;
j++)
206 for (
int k=0; k<73;k++)
208 for (
int l=0;
l<43;
l++)
210 theMBFillDetMapPl0[
i][
j][
k][
l] = 0.;
211 theMBFillDetMapPl1[
i][
j][
k][
l] = 0.;
212 theMBFillDetMapPl2[
i][
j][
k][
l] = 0.;
213 theMBFillDetMapPl4[
i][
j][
k][
l] = 0.;
215 theMBFillDetMapMin0[
i][
j][
k][
l] = 0.;
216 theMBFillDetMapMin1[
i][
j][
k][
l] = 0.;
217 theMBFillDetMapMin2[
i][
j][
k][
l] = 0.;
218 theMBFillDetMapMin4[
i][
j][
k][
l] = 0.;
221 theNSFillDetMapPl0[
i][
j][
k][
l] = 0.;
222 theNSFillDetMapPl1[
i][
j][
k][
l] = 0.;
223 theNSFillDetMapPl2[
i][
j][
k][
l] = 0.;
224 theNSFillDetMapPl4[
i][
j][
k][
l] = 0.;
226 theNSFillDetMapMin0[
i][
j][
k][
l] = 0.;
227 theNSFillDetMapMin1[
i][
j][
k][
l] = 0.;
228 theNSFillDetMapMin2[
i][
j][
k][
l] = 0.;
229 theNSFillDetMapMin4[
i][
j][
k][
l] = 0.;
231 theDFFillDetMapPl0[
i][
j][
k][
l] = 0.;
232 theDFFillDetMapPl1[
i][
j][
k][
l] = 0.;
233 theDFFillDetMapPl2[
i][
j][
k][
l] = 0.;
234 theDFFillDetMapMin0[
i][
j][
k][
l] = 0.;
235 theDFFillDetMapMin1[
i][
j][
k][
l] = 0.;
236 theDFFillDetMapMin2[
i][
j][
k][
l] = 0.;
247 void Analyzer_minbias::endJob()
251 for (
int i=1;
i<5;
i++)
253 for (
int j=1;
j<5;
j++)
255 for (
int k=1;
k<73;
k++)
257 for (
int l=1;
l<43;
l++)
259 if(theMBFillDetMapPl0[
i][
j][
k][
l] > 0)
261 mom0_MB = theMBFillDetMapPl0[
i][
j][
k][
l];
262 mom1_MB = theMBFillDetMapPl1[
i][
j][
k][
l];
263 mom2_MB = theMBFillDetMapPl2[
i][
j][
k][
l];
264 mom4_MB = theMBFillDetMapPl4[
i][
j][
k][
l];
265 mom0_Noise = theNSFillDetMapPl0[
i][
j][
k][
l];
266 mom1_Noise = theNSFillDetMapPl1[
i][
j][
k][
l];
267 mom2_Noise = theNSFillDetMapPl2[
i][
j][
k][
l];
268 mom4_Noise = theNSFillDetMapPl4[
i][
j][
k][
l];
269 mom0_Diff = theDFFillDetMapPl0[
i][
j][
k][
l];
270 mom1_Diff = theDFFillDetMapPl1[
i][
j][
k][
l];
271 mom2_Diff = theDFFillDetMapPl2[
i][
j][
k][
l];
277 cout<<
" Result Plus= "<<mysubd<<
" "<<ieta<<
" "<<iphi<<
" mom0 "<<mom0_MB<<
" mom1 "<<mom1_MB<<
" mom2 "<<mom2_MB<<endl;
283 if(theMBFillDetMapMin0[
i][
j][
k][
l] > 0)
285 mom0_MB = theMBFillDetMapMin0[
i][
j][
k][
l];
286 mom1_MB = theMBFillDetMapMin1[
i][
j][
k][
l];
287 mom2_MB = theMBFillDetMapMin2[
i][
j][
k][
l];
288 mom4_MB = theMBFillDetMapMin4[
i][
j][
k][
l];
289 mom0_Noise = theNSFillDetMapMin0[
i][
j][
k][
l];
290 mom1_Noise = theNSFillDetMapMin1[
i][
j][
k][
l];
291 mom2_Noise = theNSFillDetMapMin2[
i][
j][
k][
l];
292 mom4_Noise = theNSFillDetMapMin4[
i][
j][
k][
l];
293 mom0_Diff = theDFFillDetMapMin0[
i][
j][
k][
l];
294 mom1_Diff = theDFFillDetMapMin1[
i][
j][
k][
l];
295 mom2_Diff = theDFFillDetMapMin2[
i][
j][
k][
l];
302 cout<<
" Result Minus= "<<mysubd<<
" "<<ieta<<
" "<<iphi<<
" mom0 "<<mom0_MB<<
" mom1 "<<mom1_MB<<
" mom2 "<<mom2_MB<<endl;
314 cout<<
" Number of cells "<<ii<<endl;
316 hOutputFile->Write();
322 hHBHEsize_vs_run->Write() ;
323 hHFsize_vs_run->Write() ;
325 for(
int i=1;
i<73;
i++){
326 for(
int j=1;
j<43;
j++){
327 hCalo1[
i][
j]->Write();
328 hCalo2[
i][
j]->Write();
329 hCalo1mom2[
i][
j]->Write();
330 hCalo2mom2[
i][
j]->Write();
334 hbheNoiseE->Write() ;
336 hbheSignalE->Write() ;
340 hOutputFile->Close() ;
342 cout<<
" File is closed "<<endl;
362 float rnnum = (float)iEvent.
run();
383 if (!gtRecord.isValid()) {
390 cout<<
" No L1 trigger record "<<endl;
395 for (
CItAlgo itAlgo = bitMap.begin(); itAlgo != bitMap.end(); itAlgo++)
397 bool decision=
menu->gtAlgorithmResult(itAlgo->first,dWord);
398 if(decision == 1)
std::cout<<
" Trigger "<<itAlgo->first<<
" "<<decision<<std::endl;
408 myRecalib = recalibCorrs.
product();
414 double tmpNSFillDetMapPl1[5][5][73][43];
415 double tmpNSFillDetMapMin1[5][5][73][43];
417 for (
int i=0;
i<5;
i++)
419 for (
int j=0;
j<5;
j++)
421 for (
int k=0;
k<73;
k++)
423 for (
int l=0;
l<43;
l++)
425 tmpNSFillDetMapPl1[
i][
j][
k][
l] = 0.;
426 tmpNSFillDetMapMin1[
i][
j][
k][
l] = 0.;
433 if(!hbheNormal.isValid()){
434 cout<<
" hbheNormal failed "<<endl;
436 cout<<
" The size of the normal collection "<<hbheNormal->size()<<endl;
444 if(!hbheNS.isValid()){
445 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
446 cout<<
" No HBHE MS "<<endl;
452 cout<<
" HBHE NS size of collection "<<HithbheNS.size()<<endl;
453 hHBHEsize_vs_run->Fill(rnnum,(
float)HithbheNS.size());
455 if(HithbheNS.size()!= 5184) {
456 cout<<
" HBHE problem "<<rnnum<<
" "<<HithbheNS.size()<<endl;
462 if(!hbheMB.isValid()){
463 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
464 cout<<
" No HBHE MB"<<endl;
469 cout<<
" HBHE MB size of collection "<<HithbheMB.size()<<endl;
470 if(HithbheMB.size()!= 5184) {
471 cout<<
" HBHE problem "<<rnnum<<
" "<<HithbheMB.size()<<endl;
479 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
480 cout<<
" No HF NS "<<endl;
485 cout<<
" HFE NS size of collection "<<HithfNS.size()<<endl;
486 hHFsize_vs_run->Fill(rnnum,(
float)HithfNS.size());
487 if(HithfNS.size()!= 1728) {
488 cout<<
" HF problem "<<rnnum<<
" "<<HithfNS.size()<<endl;
496 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
497 cout<<
" No HBHE MB"<<endl;
502 cout<<
" HF MB size of collection "<<HithfMB.size()<<endl;
503 if(HithfMB.size()!= 1728) {
504 cout<<
" HF problem "<<rnnum<<
" "<<HithfMB.size()<<endl;
515 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
517 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
519 double energyhit = aHit.
energy();
521 DetId id = (*hbheItr).detid();
526 int mysu = ((hid).rawId()>>25)&0x7;
527 if( hid.
ieta() > 0 ) {
528 theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
529 theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
530 theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
531 theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
533 tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
543 tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
547 if(hid.
depth() == 1) {
548 hbheNoiseE->Fill(energyhit);
550 if(energyhit<-2.)
std::cout<<
" Run "<<rnnum<<
" ieta,iphi "<<hid.
ieta()<<
" "<<hid.
iphi()<<energyhit<<std::endl;
574 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
576 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
578 double energyhit = aHit.
energy();
580 DetId id = (*hbheItr).detid();
583 int mysu = ((hid).rawId()>>25)&0x7;
584 if( hid.
ieta() > 0 ) {
585 theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
586 theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
587 theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
588 theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
589 float mydiff = energyhit - tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
592 theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+mydiff;
601 float mydiff = energyhit - tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
602 theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+mydiff;
603 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(mydiff,2);
607 if(hid.
depth() == 1) {
609 hbheSignalE->Fill(energyhit);
611 if( hid.
ieta() > 0 ) {
612 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit);
613 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
631 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
633 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
635 double energyhit = aHit.
energy();
639 if(fabs(energyhit) > 40. )
continue;
641 DetId id = (*hbheItr).detid();
644 int mysu = ((hid).rawId()>>25)&0x7;
645 if( hid.
ieta() > 0 ) {
646 theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
647 theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
648 theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
649 theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
651 tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
661 tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
665 if(hid.
depth() == 1) {
666 hfNoiseE->Fill(energyhit);
688 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
690 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
692 double energyhit = aHit.
energy();
696 if(fabs(energyhit) > 40. )
continue;
698 DetId id = (*hbheItr).detid();
701 int mysu = ((hid).rawId()>>25)&0x7;
702 if( hid.
ieta() > 0 ) {
703 theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
704 theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
705 theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
706 theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
709 theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit-tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
710 theDFFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
711 theDFFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow((energyhit-tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]),2);
718 theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit-tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
719 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
720 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow((energyhit-tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]),2);
724 if(hid.
depth() == 1) {
725 hfSignalE->Fill(energyhit);
729 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit);
730 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
741 std::cout<<
" Event is finished "<<std::endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< HBHERecHit >::const_iterator const_iterator
uint32_t rawId() const
get the raw id
int depth() const
get the tower depth
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< bool > DecisionWord
typedefs
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
int iphi() const
get the cell iphi
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)