56 for(
int i=0;
i<73;
i++)
58 for(
int j=0;
j<43;
j++)
69 Analyzer_minbias::~Analyzer_minbias()
83 std::cout<<
" Runnumber "<<r.
run()<<
" Nevents "<<nevent_run<<std::endl;
89 hOutputFile =
new TFile( fOutputFileName.c_str(),
"RECREATE" ) ;
91 myTree =
new TTree(
"RecJet",
"RecJet Tree");
92 myTree->Branch(
"mydet", &mydet,
"mydet/I");
93 myTree->Branch(
"mysubd", &mysubd,
"mysubd/I");
94 myTree->Branch(
"depth", &depth,
"depth/I");
95 myTree->Branch(
"ieta", &ieta,
"ieta/I");
96 myTree->Branch(
"iphi", &iphi,
"iphi/I");
97 myTree->Branch(
"eta", &
eta,
"eta/F");
98 myTree->Branch(
"phi", &
phi,
"phi/F");
100 myTree->Branch(
"mom0_MB", &mom0_MB,
"mom0_MB/F");
101 myTree->Branch(
"mom1_MB", &mom1_MB,
"mom1_MB/F");
102 myTree->Branch(
"mom2_MB", &mom2_MB,
"mom2_MB/F");
103 myTree->Branch(
"mom4_MB", &mom4_MB,
"mom4_MB/F");
105 myTree->Branch(
"mom0_Noise", &mom0_Noise,
"mom0_Noise/F");
106 myTree->Branch(
"mom1_Noise", &mom1_Noise,
"mom1_Noise/F");
107 myTree->Branch(
"mom2_Noise", &mom2_Noise,
"mom2_Noise/F");
108 myTree->Branch(
"mom4_Noise", &mom4_Noise,
"mom4_Noise/F");
110 myTree->Branch(
"mom0_Diff", &mom0_Diff,
"mom0_Diff/F");
111 myTree->Branch(
"mom1_Diff", &mom1_Diff,
"mom1_Diff/F");
112 myTree->Branch(
"mom2_Diff", &mom2_Diff,
"mom2_Diff/F");
114 myTree->Branch(
"occup", &occup,
"occup/F");
116 std::cout<<
" Before ordering Histos "<<std::endl;
128 hHBHEsize_vs_run =
new TH2F(
"hHBHEsize_vs_run",
"hHBHEsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
129 hHFsize_vs_run =
new TH2F(
"hHFsize_vs_run",
"hHFsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
131 for(
int i=1;
i<73;
i++){
132 for(
int j=1;
j<43;
j++){
134 meannoise_pl[
i][
j] = 0.;
135 meannoise_min[
i][
j] = 0.;
139 sprintf(str0,
"mpl%d",k);
140 sprintf(str1,
"mmin%d",k);
142 sprintf(str10,
"vpl%d",k);
143 sprintf(str11,
"vmin%d",k);
148 hCalo1[
i][
j] =
new TH1F(str0,
"h0", 320, -10., 10.);
149 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
152 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 20.);
153 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 20.);
162 hCalo1[
i][
j] =
new TH1F(str0,
"h0", 320, -10., 10.);
163 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
166 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 40.);
167 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 40.);
171 hCalo1[
i][
j] =
new TH1F(str0,
"h0" , 320, -10., 10.);
172 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
175 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 120.);
176 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 120.);
185 hbheNoiseE =
new TH1F(
"hbheNoiseE",
"hbheNoiseE", 320, -10., 10.);
186 hfNoiseE =
new TH1F(
"hfNoiseE",
"hfNoiseE", 320, -10., 10.);
187 hbheSignalE =
new TH1F(
"hbheSignalE",
"hbheSignalE", 320, -10., 10.);
188 hfSignalE =
new TH1F(
"hfSignalE",
"hfSignalE", 320, -10., 10.);
191 std::cout<<
" After ordering Histos "<<std::endl;
195 myout_hcal =
new ofstream(ccc.c_str());
196 if(!myout_hcal)
cout <<
" Output file not open!!! "<<endl;
199 for (
int i=0;
i<5;
i++)
201 for (
int j=0;
j<5;
j++)
203 for (
int k=0; k<73;k++)
205 for (
int l=0;
l<43;
l++)
207 theMBFillDetMapPl0[
i][
j][
k][
l] = 0.;
208 theMBFillDetMapPl1[
i][
j][
k][
l] = 0.;
209 theMBFillDetMapPl2[
i][
j][
k][
l] = 0.;
210 theMBFillDetMapPl4[
i][
j][
k][
l] = 0.;
212 theMBFillDetMapMin0[
i][
j][
k][
l] = 0.;
213 theMBFillDetMapMin1[
i][
j][
k][
l] = 0.;
214 theMBFillDetMapMin2[
i][
j][
k][
l] = 0.;
215 theMBFillDetMapMin4[
i][
j][
k][
l] = 0.;
218 theNSFillDetMapPl0[
i][
j][
k][
l] = 0.;
219 theNSFillDetMapPl1[
i][
j][
k][
l] = 0.;
220 theNSFillDetMapPl2[
i][
j][
k][
l] = 0.;
221 theNSFillDetMapPl4[
i][
j][
k][
l] = 0.;
223 theNSFillDetMapMin0[
i][
j][
k][
l] = 0.;
224 theNSFillDetMapMin1[
i][
j][
k][
l] = 0.;
225 theNSFillDetMapMin2[
i][
j][
k][
l] = 0.;
226 theNSFillDetMapMin4[
i][
j][
k][
l] = 0.;
228 theDFFillDetMapPl0[
i][
j][
k][
l] = 0.;
229 theDFFillDetMapPl1[
i][
j][
k][
l] = 0.;
230 theDFFillDetMapPl2[
i][
j][
k][
l] = 0.;
231 theDFFillDetMapMin0[
i][
j][
k][
l] = 0.;
232 theDFFillDetMapMin1[
i][
j][
k][
l] = 0.;
233 theDFFillDetMapMin2[
i][
j][
k][
l] = 0.;
244 void Analyzer_minbias::endJob()
248 for (
int i=1;
i<5;
i++)
250 for (
int j=1;
j<5;
j++)
252 for (
int k=1;
k<73;
k++)
254 for (
int l=1;
l<43;
l++)
256 if(theMBFillDetMapPl0[
i][
j][
k][
l] > 0)
258 mom0_MB = theMBFillDetMapPl0[
i][
j][
k][
l];
259 mom1_MB = theMBFillDetMapPl1[
i][
j][
k][
l];
260 mom2_MB = theMBFillDetMapPl2[
i][
j][
k][
l];
261 mom4_MB = theMBFillDetMapPl4[
i][
j][
k][
l];
262 mom0_Noise = theNSFillDetMapPl0[
i][
j][
k][
l];
263 mom1_Noise = theNSFillDetMapPl1[
i][
j][
k][
l];
264 mom2_Noise = theNSFillDetMapPl2[
i][
j][
k][
l];
265 mom4_Noise = theNSFillDetMapPl4[
i][
j][
k][
l];
266 mom0_Diff = theDFFillDetMapPl0[
i][
j][
k][
l];
267 mom1_Diff = theDFFillDetMapPl1[
i][
j][
k][
l];
268 mom2_Diff = theDFFillDetMapPl2[
i][
j][
k][
l];
274 cout<<
" Result Plus= "<<mysubd<<
" "<<ieta<<
" "<<iphi<<
" mom0 "<<mom0_MB<<
" mom1 "<<mom1_MB<<
" mom2 "<<mom2_MB<<endl;
280 if(theMBFillDetMapMin0[
i][
j][
k][
l] > 0)
282 mom0_MB = theMBFillDetMapMin0[
i][
j][
k][
l];
283 mom1_MB = theMBFillDetMapMin1[
i][
j][
k][
l];
284 mom2_MB = theMBFillDetMapMin2[
i][
j][
k][
l];
285 mom4_MB = theMBFillDetMapMin4[
i][
j][
k][
l];
286 mom0_Noise = theNSFillDetMapMin0[
i][
j][
k][
l];
287 mom1_Noise = theNSFillDetMapMin1[
i][
j][
k][
l];
288 mom2_Noise = theNSFillDetMapMin2[
i][
j][
k][
l];
289 mom4_Noise = theNSFillDetMapMin4[
i][
j][
k][
l];
290 mom0_Diff = theDFFillDetMapMin0[
i][
j][
k][
l];
291 mom1_Diff = theDFFillDetMapMin1[
i][
j][
k][
l];
292 mom2_Diff = theDFFillDetMapMin2[
i][
j][
k][
l];
299 cout<<
" Result Minus= "<<mysubd<<
" "<<ieta<<
" "<<iphi<<
" mom0 "<<mom0_MB<<
" mom1 "<<mom1_MB<<
" mom2 "<<mom2_MB<<endl;
311 cout<<
" Number of cells "<<ii<<endl;
313 hOutputFile->Write();
319 hHBHEsize_vs_run->Write() ;
320 hHFsize_vs_run->Write() ;
322 for(
int i=1;
i<73;
i++){
323 for(
int j=1;
j<43;
j++){
324 hCalo1[
i][
j]->Write();
325 hCalo2[
i][
j]->Write();
326 hCalo1mom2[
i][
j]->Write();
327 hCalo2mom2[
i][
j]->Write();
331 hbheNoiseE->Write() ;
333 hbheSignalE->Write() ;
337 hOutputFile->Close() ;
339 cout<<
" File is closed "<<endl;
359 float rnnum = (float)iEvent.
run();
380 if (!gtRecord.isValid()) {
387 cout<<
" No L1 trigger record "<<endl;
392 for (
CItAlgo itAlgo = bitMap.begin(); itAlgo != bitMap.end(); itAlgo++)
394 bool decision=
menu->gtAlgorithmResult(itAlgo->first,dWord);
395 if(decision == 1)
std::cout<<
" Trigger "<<itAlgo->first<<
" "<<decision<<std::endl;
405 myRecalib = recalibCorrs.
product();
411 double tmpNSFillDetMapPl1[5][5][73][43];
412 double tmpNSFillDetMapMin1[5][5][73][43];
414 for (
int i=0;
i<5;
i++)
416 for (
int j=0;
j<5;
j++)
418 for (
int k=0;
k<73;
k++)
420 for (
int l=0;
l<43;
l++)
422 tmpNSFillDetMapPl1[
i][
j][
k][
l] = 0.;
423 tmpNSFillDetMapMin1[
i][
j][
k][
l] = 0.;
430 if(!hbheNormal.isValid()){
431 cout<<
" hbheNormal failed "<<endl;
433 cout<<
" The size of the normal collection "<<hbheNormal->size()<<endl;
441 if(!hbheNS.isValid()){
442 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
443 cout<<
" No HBHE MS "<<endl;
449 cout<<
" HBHE NS size of collection "<<HithbheNS.size()<<endl;
450 hHBHEsize_vs_run->Fill(rnnum,(
float)HithbheNS.size());
452 if(HithbheNS.size()!= 5184) {
453 cout<<
" HBHE problem "<<rnnum<<
" "<<HithbheNS.size()<<endl;
459 if(!hbheMB.isValid()){
460 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
461 cout<<
" No HBHE MB"<<endl;
466 cout<<
" HBHE MB size of collection "<<HithbheMB.size()<<endl;
467 if(HithbheMB.size()!= 5184) {
468 cout<<
" HBHE problem "<<rnnum<<
" "<<HithbheMB.size()<<endl;
476 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
477 cout<<
" No HF NS "<<endl;
482 cout<<
" HFE NS size of collection "<<HithfNS.size()<<endl;
483 hHFsize_vs_run->Fill(rnnum,(
float)HithfNS.size());
484 if(HithfNS.size()!= 1728) {
485 cout<<
" HF problem "<<rnnum<<
" "<<HithfNS.size()<<endl;
493 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
494 cout<<
" No HBHE MB"<<endl;
499 cout<<
" HF MB size of collection "<<HithfMB.size()<<endl;
500 if(HithfMB.size()!= 1728) {
501 cout<<
" HF problem "<<rnnum<<
" "<<HithfMB.size()<<endl;
512 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
514 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
516 double energyhit = aHit.
energy();
518 DetId id = (*hbheItr).detid();
523 int mysu = ((hid).rawId()>>25)&0x7;
524 if( hid.
ieta() > 0 ) {
525 theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
526 theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
527 theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
528 theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
530 tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
540 tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
544 if(hid.
depth() == 1) {
545 hbheNoiseE->Fill(energyhit);
547 if(energyhit<-2.)
std::cout<<
" Run "<<rnnum<<
" ieta,iphi "<<hid.
ieta()<<
" "<<hid.
iphi()<<energyhit<<std::endl;
571 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
573 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
575 double energyhit = aHit.
energy();
577 DetId id = (*hbheItr).detid();
580 int mysu = ((hid).rawId()>>25)&0x7;
581 if( hid.
ieta() > 0 ) {
582 theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
583 theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
584 theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
585 theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
586 float mydiff = energyhit - tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
589 theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+mydiff;
598 float mydiff = energyhit - tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
599 theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+mydiff;
600 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(mydiff,2);
604 if(hid.
depth() == 1) {
606 hbheSignalE->Fill(energyhit);
608 if( hid.
ieta() > 0 ) {
609 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit);
610 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
628 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
630 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
632 double energyhit = aHit.
energy();
636 if(fabs(energyhit) > 40. )
continue;
638 DetId id = (*hbheItr).detid();
641 int mysu = ((hid).rawId()>>25)&0x7;
642 if( hid.
ieta() > 0 ) {
643 theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
644 theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
645 theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
646 theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
648 tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
658 tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
662 if(hid.
depth() == 1) {
663 hfNoiseE->Fill(energyhit);
685 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
687 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
689 double energyhit = aHit.
energy();
693 if(fabs(energyhit) > 40. )
continue;
695 DetId id = (*hbheItr).detid();
698 int mysu = ((hid).rawId()>>25)&0x7;
699 if( hid.
ieta() > 0 ) {
700 theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
701 theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
702 theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
703 theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
706 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()];
707 theDFFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
708 theDFFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow((energyhit-tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]),2);
715 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()];
716 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
717 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow((energyhit-tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]),2);
721 if(hid.
depth() == 1) {
722 hfSignalE->Fill(energyhit);
726 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit);
727 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
738 std::cout<<
" Event is finished "<<std::endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< T >::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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int iphi() const
get the cell iphi
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)