51 for(
int i=0;
i<73;
i++)
53 for(
int j=0;
j<43;
j++)
64 Analyzer_minbias::~Analyzer_minbias()
78 std::cout<<
" Runnumber "<<r.
run()<<
" Nevents "<<nevent_run<<std::endl;
84 hOutputFile =
new TFile( fOutputFileName.c_str(),
"RECREATE" ) ;
86 myTree =
new TTree(
"RecJet",
"RecJet Tree");
87 myTree->Branch(
"mydet", &mydet,
"mydet/I");
88 myTree->Branch(
"mysubd", &mysubd,
"mysubd/I");
89 myTree->Branch(
"depth", &depth,
"depth/I");
90 myTree->Branch(
"ieta", &ieta,
"ieta/I");
91 myTree->Branch(
"iphi", &iphi,
"iphi/I");
92 myTree->Branch(
"eta", &
eta,
"eta/F");
93 myTree->Branch(
"phi", &
phi,
"phi/F");
95 myTree->Branch(
"mom0_MB", &mom0_MB,
"mom0_MB/F");
96 myTree->Branch(
"mom1_MB", &mom1_MB,
"mom1_MB/F");
97 myTree->Branch(
"mom2_MB", &mom2_MB,
"mom2_MB/F");
98 myTree->Branch(
"mom4_MB", &mom4_MB,
"mom4_MB/F");
100 myTree->Branch(
"mom0_Noise", &mom0_Noise,
"mom0_Noise/F");
101 myTree->Branch(
"mom1_Noise", &mom1_Noise,
"mom1_Noise/F");
102 myTree->Branch(
"mom2_Noise", &mom2_Noise,
"mom2_Noise/F");
103 myTree->Branch(
"mom4_Noise", &mom4_Noise,
"mom4_Noise/F");
105 myTree->Branch(
"mom0_Diff", &mom0_Diff,
"mom0_Diff/F");
106 myTree->Branch(
"mom1_Diff", &mom1_Diff,
"mom1_Diff/F");
107 myTree->Branch(
"mom2_Diff", &mom2_Diff,
"mom2_Diff/F");
109 myTree->Branch(
"occup", &occup,
"occup/F");
111 std::cout<<
" Before ordering Histos "<<std::endl;
123 hHBHEsize_vs_run =
new TH2F(
"hHBHEsize_vs_run",
"hHBHEsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
124 hHFsize_vs_run =
new TH2F(
"hHFsize_vs_run",
"hHFsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
126 for(
int i=1;
i<73;
i++){
127 for(
int j=1;
j<43;
j++){
129 meannoise_pl[
i][
j] = 0.;
130 meannoise_min[
i][
j] = 0.;
134 sprintf(str0,
"mpl%d",k);
135 sprintf(str1,
"mmin%d",k);
137 sprintf(str10,
"vpl%d",k);
138 sprintf(str11,
"vmin%d",k);
143 hCalo1[
i][
j] =
new TH1F(str0,
"h0", 320, -10., 10.);
144 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
147 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 20.);
148 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 20.);
157 hCalo1[
i][
j] =
new TH1F(str0,
"h0", 320, -10., 10.);
158 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
161 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 40.);
162 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 40.);
166 hCalo1[
i][
j] =
new TH1F(str0,
"h0" , 320, -10., 10.);
167 hCalo2[
i][
j] =
new TH1F(str1,
"h1", 320, -10., 10.);
170 hCalo1mom2[
i][
j] =
new TH1F(str10,
"h10", 320, 0., 120.);
171 hCalo2mom2[
i][
j] =
new TH1F(str11,
"h11", 320, 0., 120.);
180 std::cout<<
" After ordering Histos "<<std::endl;
182 std::string ccc =
"noise_0.dat";
184 myout_hcal =
new ofstream(ccc.c_str());
185 if(!myout_hcal)
cout <<
" Output file not open!!! "<<endl;
188 for (
int i=0;
i<5;
i++)
190 for (
int j=0;
j<5;
j++)
192 for (
int k=0; k<73;k++)
194 for (
int l=0;
l<43;
l++)
196 theMBFillDetMapPl0[
i][
j][
k][
l] = 0.;
197 theMBFillDetMapPl1[
i][
j][
k][
l] = 0.;
198 theMBFillDetMapPl2[
i][
j][
k][
l] = 0.;
199 theMBFillDetMapPl4[
i][
j][
k][
l] = 0.;
201 theMBFillDetMapMin0[
i][
j][
k][
l] = 0.;
202 theMBFillDetMapMin1[
i][
j][
k][
l] = 0.;
203 theMBFillDetMapMin2[
i][
j][
k][
l] = 0.;
204 theMBFillDetMapMin4[
i][
j][
k][
l] = 0.;
207 theNSFillDetMapPl0[
i][
j][
k][
l] = 0.;
208 theNSFillDetMapPl1[
i][
j][
k][
l] = 0.;
209 theNSFillDetMapPl2[
i][
j][
k][
l] = 0.;
210 theNSFillDetMapPl4[
i][
j][
k][
l] = 0.;
212 theNSFillDetMapMin0[
i][
j][
k][
l] = 0.;
213 theNSFillDetMapMin1[
i][
j][
k][
l] = 0.;
214 theNSFillDetMapMin2[
i][
j][
k][
l] = 0.;
215 theNSFillDetMapMin4[
i][
j][
k][
l] = 0.;
217 theDFFillDetMapPl0[
i][
j][
k][
l] = 0.;
218 theDFFillDetMapPl1[
i][
j][
k][
l] = 0.;
219 theDFFillDetMapPl2[
i][
j][
k][
l] = 0.;
220 theDFFillDetMapMin0[
i][
j][
k][
l] = 0.;
221 theDFFillDetMapMin1[
i][
j][
k][
l] = 0.;
222 theDFFillDetMapMin2[
i][
j][
k][
l] = 0.;
233 void Analyzer_minbias::endJob()
237 for (
int i=1;
i<5;
i++)
239 for (
int j=1;
j<5;
j++)
241 for (
int k=1;
k<73;
k++)
243 for (
int l=1;
l<43;
l++)
245 if(theMBFillDetMapPl0[
i][
j][
k][
l] > 0)
247 mom0_MB = theMBFillDetMapPl0[
i][
j][
k][
l];
248 mom1_MB = theMBFillDetMapPl1[
i][
j][
k][
l];
249 mom2_MB = theMBFillDetMapPl2[
i][
j][
k][
l];
250 mom4_MB = theMBFillDetMapPl4[
i][
j][
k][
l];
251 mom0_Noise = theNSFillDetMapPl0[
i][
j][
k][
l];
252 mom1_Noise = theNSFillDetMapPl1[
i][
j][
k][
l];
253 mom2_Noise = theNSFillDetMapPl2[
i][
j][
k][
l];
254 mom4_Noise = theNSFillDetMapPl4[
i][
j][
k][
l];
255 mom0_Diff = theDFFillDetMapPl0[
i][
j][
k][
l];
256 mom1_Diff = theDFFillDetMapPl1[
i][
j][
k][
l];
257 mom2_Diff = theDFFillDetMapPl2[
i][
j][
k][
l];
263 cout<<
" Result Plus= "<<mysubd<<
" "<<ieta<<
" "<<iphi<<
" mom0 "<<mom0_MB<<
" mom1 "<<mom1_MB<<
" mom2 "<<mom2_MB<<endl;
269 if(theMBFillDetMapMin0[
i][
j][
k][
l] > 0)
271 mom0_MB = theMBFillDetMapMin0[
i][
j][
k][
l];
272 mom1_MB = theMBFillDetMapMin1[
i][
j][
k][
l];
273 mom2_MB = theMBFillDetMapMin2[
i][
j][
k][
l];
274 mom4_MB = theMBFillDetMapMin4[
i][
j][
k][
l];
275 mom0_Noise = theNSFillDetMapMin0[
i][
j][
k][
l];
276 mom1_Noise = theNSFillDetMapMin1[
i][
j][
k][
l];
277 mom2_Noise = theNSFillDetMapMin2[
i][
j][
k][
l];
278 mom4_Noise = theNSFillDetMapMin4[
i][
j][
k][
l];
279 mom0_Diff = theDFFillDetMapMin0[
i][
j][
k][
l];
280 mom1_Diff = theDFFillDetMapMin1[
i][
j][
k][
l];
281 mom2_Diff = theDFFillDetMapMin2[
i][
j][
k][
l];
288 cout<<
" Result Minus= "<<mysubd<<
" "<<ieta<<
" "<<iphi<<
" mom0 "<<mom0_MB<<
" mom1 "<<mom1_MB<<
" mom2 "<<mom2_MB<<endl;
300 cout<<
" Number of cells "<<ii<<endl;
302 hOutputFile->Write() ;
304 hHBHEsize_vs_run->Write() ;
305 hHFsize_vs_run->Write() ;
306 for(
int i=1;
i<73;
i++){
307 for(
int j=1;
j<43;
j++){
308 hCalo1[
i][
j]->Write();
309 hCalo2[
i][
j]->Write();
310 hCalo1mom2[
i][
j]->Write();
311 hCalo2mom2[
i][
j]->Write();
317 hOutputFile->Close() ;
337 float rnnum = (float)iEvent.
run();
353 if (!gtRecord.isValid()) {
360 cout<<
" No L1 trigger record "<<endl;
370 myRecalib = recalibCorrs.
product();
376 double tmpNSFillDetMapPl1[5][5][73][43];
377 double tmpNSFillDetMapPl2[5][5][73][43];
378 double tmpNSFillDetMapMin1[5][5][73][43];
379 double tmpNSFillDetMapMin2[5][5][73][43];
381 for (
int i=0;
i<5;
i++)
383 for (
int j=0;
j<5;
j++)
385 for (
int k=0;
k<73;
k++)
387 for (
int l=0;
l<43;
l++)
389 tmpNSFillDetMapPl1[
i][
j][
k][
l] = 0.;
390 tmpNSFillDetMapPl2[
i][
j][
k][
l] = 0.;
391 tmpNSFillDetMapMin1[
i][
j][
k][
l] = 0.;
392 tmpNSFillDetMapMin2[
i][
j][
k][
l] = 0.;
399 if(!hbheNormal.isValid()){
400 cout<<
" hbheNormal failed "<<endl;
402 cout<<
" The size of the normal collection "<<hbheNormal->size()<<endl;
410 if(!hbheNS.isValid()){
411 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
412 cout<<
" No HBHE MS "<<endl;
418 cout<<
" HBHE NS size of collection "<<HithbheNS.size()<<endl;
419 hHBHEsize_vs_run->Fill(rnnum,(
float)HithbheNS.size());
421 if(HithbheNS.size()!= 5184) {
422 cout<<
" HBHE problem "<<rnnum<<
" "<<HithbheNS.size()<<endl;
428 if(!hbheMB.isValid()){
429 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
430 cout<<
" No HBHE MB"<<endl;
435 cout<<
" HBHE MB size of collection "<<HithbheMB.size()<<endl;
436 if(HithbheMB.size()!= 5184) {
437 cout<<
" HBHE problem "<<rnnum<<
" "<<HithbheMB.size()<<endl;
445 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
446 cout<<
" No HF NS "<<endl;
451 cout<<
" HFE NS size of collection "<<HithfNS.size()<<endl;
452 hHFsize_vs_run->Fill(rnnum,(
float)HithfNS.size());
453 if(HithfNS.size()!= 1728) {
454 cout<<
" HF problem "<<rnnum<<
" "<<HithfNS.size()<<endl;
462 LogDebug(
"") <<
"HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
463 cout<<
" No HBHE MB"<<endl;
468 cout<<
" HF MB size of collection "<<HithfMB.size()<<endl;
469 if(HithfMB.size()!= 1728) {
470 cout<<
" HF problem "<<rnnum<<
" "<<HithfMB.size()<<endl;
481 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
483 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
485 double energyhit = aHit.
energy();
487 DetId id = (*hbheItr).detid();
490 int mysu = ((hid).rawId()>>25)&0x7;
491 if( hid.
ieta() > 0 ) {
492 theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
493 theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
494 theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
495 theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
497 tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
498 tmpNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
pow(energyhit,2);
508 tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
509 tmpNSFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
pow(energyhit,2);
513 if(hid.
depth() == 1) {
514 if( hid.
ieta() > 0 ) {
515 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit-noise_pl[hid.
iphi()][hid.
ieta()]);
516 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
533 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
535 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
537 double energyhit = aHit.
energy();
539 DetId id = (*hbheItr).detid();
542 int mysu = ((hid).rawId()>>25)&0x7;
543 if( hid.
ieta() > 0 ) {
544 theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
545 theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
546 theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
547 theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
548 float mydiff = energyhit - tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
551 theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+mydiff;
560 float mydiff = energyhit - tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()];
561 theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+mydiff;
562 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(mydiff,2);
566 if(hid.
depth() == 1) {
567 if( hid.
ieta() > 0 ) {
568 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit);
569 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
584 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
586 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
588 double energyhit = aHit.
energy();
590 DetId id = (*hbheItr).detid();
593 int mysu = ((hid).rawId()>>25)&0x7;
594 if( hid.
ieta() > 0 ) {
595 theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
596 theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
597 theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
598 theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theNSFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
600 tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
601 tmpNSFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
pow(energyhit,2);
611 tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = energyhit;
612 tmpNSFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
pow(energyhit,2);
616 if(hid.
depth() == 1) {
617 if( hid.
ieta() > 0 ) {
618 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit-noise_pl[hid.
iphi()][hid.
ieta()]);
619 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
635 if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
637 HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
639 double energyhit = aHit.
energy();
641 DetId id = (*hbheItr).detid();
644 int mysu = ((hid).rawId()>>25)&0x7;
645 if( hid.
ieta() > 0 ) {
646 theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl0[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+ 1.;
647 theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+energyhit;
648 theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,2);
649 theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] = theMBFillDetMapPl4[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow(energyhit,4);
652 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()];
653 theDFFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
654 theDFFillDetMapPl2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow((energyhit-tmpNSFillDetMapPl1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]),2);
661 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()];
662 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()] =
663 theDFFillDetMapMin2[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]+
pow((energyhit-tmpNSFillDetMapMin1[mysu][hid.
depth()][hid.
iphi()][hid.
ieta()]),2);
667 if(hid.
depth() == 1) {
668 if( hid.
ieta() > 0 ) {
669 hCalo1[hid.
iphi()][hid.
ieta()]->Fill(energyhit);
670 hCalo1mom2[hid.
iphi()][hid.
ieta()]->Fill(
pow(energyhit,2));
678 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)
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)