17 #include "boost/filesystem/operations.hpp"
30 have_initial_miscalib_=
34 "InitialMiscalib.xml");
37 "EcalIntercalibConstants.xml");
62 e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_);
66 for (
int sign=0; sign<
kSides; sign++) {
69 int iphi_r=int(iphi/nscx);
70 if( !e_.goodCell_barl[ieta][iphi][sign] ){
71 nBads_barl_SM_[ieta][iphi_r][sign]++;
81 if (have_initial_miscalib_){
84 namespace fs = boost::filesystem;
87 << initialmiscalibfile_ <<endl;
91 if (ret)
edm::LogError(
"PhiSym")<<
"Error reading XML files"<<endl;
94 for (vector<DetId>::iterator it=barrelCells.begin(); it!=barrelCells.end(); ++it){
98 for (vector<DetId>::iterator it=endcapCells.begin(); it!=endcapCells.end(); ++it){
110 namespace fs = boost::filesystem;
113 << oldcalibfile_ <<endl;
119 if (ret)
edm::LogError(
"PhiSym")<<
"Error reading XML files"<<endl;;
123 for (vector<DetId>::iterator it=barrelCells.begin();
124 it!=barrelCells.end(); ++it)
128 for (vector<DetId>::iterator it=endcapCells.begin();
129 it!=endcapCells.end(); ++it)
143 for (
int sign=0; sign<
kSides; sign++) {
144 int iphi_r=int(iphi/nscx);
146 etsum_barl_[ieta][iphi][sign]=0.;
147 nhits_barl_[ieta][iphi][sign]=0;
148 esum_barl_[ieta][iphi][sign]=0.;
149 etsum_barl_SM_[ieta][iphi_r][sign]=0;
150 nBads_barl_SM_[ieta][iphi_r][sign]=0;
151 epsilon_M_barl_SM_[ieta][iphi_r][sign]=0;
154 etsumMean_barl_SM_[ieta]=0.;
159 for (
int sign=0; sign<
kSides; sign++) {
160 etsum_endc_[ix][iy][sign]=0.;
161 nhits_endc_[ix][iy][sign]=0;
162 esum_endc_[ix][iy][sign]=0.;
175 edm::LogError(
"PhiSym")<<
"Must process at least one event-Exiting" <<endl;
206 std::ofstream etsumMean_barl_out(
"etsumMean_barl.dat",
ios::out);
208 etsumMean_barl_out << ieta <<
" " << etsumMean_barl_[ieta] << endl;
210 etsumMean_barl_out.close();
212 std::ofstream etsumMean_endc_out(
"etsumMean_endc.dat",
ios::out);
214 etsumMean_endc_out << e_.cellPos_[
ring][50].eta() <<
" " << etsumMean_endc_[
ring] << endl;
216 etsumMean_endc_out.close();
222 for (
int sign=0; sign<
kSides; sign++) {
226 int iphi_r = int(iphi/nscx);
233 etsum_barl_SM_[ieta][iphi_r][sign] /etsumMean_barl_SM_[ieta] -1.;
235 epsilon_M_barl_SM_[ieta][iphi_r][sign] = epsilon_T_SM/k_barl_[ieta];
237 if(e_.goodCell_barl[ieta][iphi][sign]){
238 float etsum = etsum_barl_[ieta][iphi][sign];
239 float epsilon_T = (etsum/etsumMean_barl_[ieta]) - 1.;
240 rawconst_barl[ieta][iphi][sign] = epsilon_T + 1.;
241 epsilon_M_barl[ieta][iphi][sign] = epsilon_T/k_barl_[ieta];
245 rawconst_barl[ieta][iphi][sign] = 1.;
246 epsilon_M_barl[ieta][iphi][sign] = 0.;
255 for (
int sign=0; sign<
kSides; sign++) {
256 int ring = e_.endcapRing_[ix][iy];
257 if (ring!=-1 && e_.goodCell_endc[ix][iy][sign]) {
258 float etsum = etsum_endc_[ix][iy][sign];
259 float epsilon_T = (etsum/etsumMean_endc_[
ring]) - 1.;
260 rawconst_endc[ix][iy][sign] = epsilon_T + 1.;
261 epsilon_M_endc[ix][iy][sign] = epsilon_T/k_endc_[
ring];
263 epsilon_M_endc[ix][iy][0] = 0.;
264 epsilon_M_endc[ix][iy][1] = 0.;
265 rawconst_endc[ix][iy][0] = 1.;
266 rawconst_endc[ix][iy][1] = 1.;
277 for (
int iphi_r =0; iphi_r< int(
kBarlWedges/nscx);++iphi_r){
278 for (
int sign=0; sign<
kSides; sign++) {
279 scfile<< ieta <<
" " << iphi_r <<
" " <<sign <<
" "
280 << 1/(1+epsilon_M_barl_SM_[ieta][iphi_r][sign] )<< std::endl;
285 std::string newcalibfile(
"EcalIntercalibConstants_new.xml");
289 TFile ehistof(
"ehistos.root",
"recreate");
291 TH1D ebhisto(
"eb",
"eb",100, 0.,2.);
293 std::vector<DetId>::const_iterator barrelIt=barrelCells.begin();
294 for (; barrelIt!=barrelCells.end(); barrelIt++) {
297 int iphi = eb.
iphi()-1;
298 int sign = eb.
zside()>0 ? 1 : 0;
302 newCalibs_[eb] = oldCalibs_[eb]/(1+epsilon_M_barl[ieta][iphi][sign]);
304 if(e_.goodCell_barl[ieta][iphi][sign]){
306 ebhisto.Fill(newCalibs_[eb]);
309 miscal_resid_barl_histos[ieta]->Fill(miscalib_[eb]*newCalibs_[eb]);
310 correl_barl_histos[ieta]->Fill(miscalib_[eb],newCalibs_[eb]);
316 TH1D eehisto(
"ee",
"ee",100, 0.,2.);
317 std::vector<DetId>::const_iterator endcapIt=endcapCells.begin();
319 for (; endcapIt!=endcapCells.end(); endcapIt++) {
323 int sign = ee.
zside()>0 ? 1 : 0;
325 newCalibs_[ee] = oldCalibs_[ee]/(1+epsilon_M_endc[ix][iy][sign]);
328 if(e_.goodCell_endc[ix][iy][sign]){
330 eehisto.Fill(newCalibs_[ee]);
331 miscal_resid_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee]*
334 correl_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee],
345 header.
tag_=
"unknown";
346 header.
date_=
"Mar 24 1973";
355 fillConstantsHistos();
366 TFile
f(
"CalibHistos.root",
"recreate");
368 TH2F barreletamap(
"barreletamap",
"barreletamap",171, -85,86,100,0.,2.);
369 TH2F barreletamapraw(
"barreletamapraw",
"barreletamapraw",171, -85,86,100,0.,2.);
371 TH2F barrelmapold(
"barrelmapold",
"barrelmapold",360,1.,361.,171,-85.,86.);
372 TH2F barrelmapnew(
"barrelmapnew",
"barrelmapnew",360,1.,361.,171,-85.,86.);
373 TH2F barrelmapratio(
"barrelmapratio",
"barrelmapratio",360,1.,361.,171,-85.,86.);
375 TH1F rawconst_endc_h(
"rawconst_endc",
"rawconst_endc",100,0.,2.);
376 TH1F const_endc_h(
"const_endc",
"const_endc",100,0.,2.);
378 TH1F oldconst_endc_h(
"oldconst_endc",
"oldconst_endc;oldCalib;",200,0,2);
379 TH2F newvsraw_endc_h(
"newvsraw_endc",
"newvsraw_endc;rawConst;newCalib",200,0,2,200,0,2);
381 TH2F endcapmapold_plus(
"endcapmapold_plus",
"endcapmapold_plus",100,1.,101.,100,1.,101.);
382 TH2F endcapmapnew_plus(
"endcapmapnew_plus",
"endcapmapnew_plus",100,1.,101.,100,1.,101.);
383 TH2F endcapmapratio_plus(
"endcapmapratio_plus",
"endcapmapratio_plus",100,1.,101.,100,1.,101.);
385 TH2F endcapmapold_minus(
"endcapmapold_minus",
"endcapmapold_minus",100,1.,101.,100,1.,101.);
386 TH2F endcapmapnew_minus(
"endcapmapnew_minus",
"endcapmapnew_minus",100,1.,101.,100,1.,101.);
387 TH2F endcapmapratio_minus(
"endcapmapratio_minus",
"endcapmapratio_minus",100,1.,101.,100,1.,101.);
390 for (
int sign=0; sign<
kSides; sign++) {
392 int thesign = sign==1 ? 1:-1;
396 if(e_.goodCell_barl[ieta][iphi][sign]){
398 EBDetId eb(thesign*( ieta+1 ), iphi+1);
401 barreletamap.Fill(ieta*thesign + thesign,newCalibs_[eb]);
402 barreletamapraw.Fill(ieta*thesign + thesign,rawconst_barl[ieta][iphi][sign]);
404 barrelmapold.Fill(iphi+1,ieta*thesign + thesign, oldCalibs_[eb]);
405 barrelmapnew.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]);
406 barrelmapratio.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]/oldCalibs_[eb]);
413 if (e_.goodCell_endc[ix][iy][sign]){
415 EEDetId ee(ix+1, iy+1,thesign);
417 rawconst_endc_h.Fill(rawconst_endc[ix][iy][sign]);
418 const_endc_h.Fill(newCalibs_[ee]);
419 oldconst_endc_h.Fill(oldCalibs_[ee]);
420 newvsraw_endc_h.Fill(rawconst_endc[ix][iy][sign],newCalibs_[ee]);
423 endcapmapold_plus.Fill(ix+1,iy+1,oldCalibs_[ee]);
424 endcapmapnew_plus.Fill(ix+1,iy+1,newCalibs_[ee]);
425 endcapmapratio_plus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
428 endcapmapold_minus.Fill(ix+1,iy+1,oldCalibs_[ee]);
429 endcapmapnew_minus.Fill(ix+1,iy+1,newCalibs_[ee]);
430 endcapmapratio_minus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
439 barreletamap.Write();
440 barreletamapraw.Write();
441 rawconst_endc_h.Write();
442 const_endc_h.Write();
443 oldconst_endc_h.Write();
444 newvsraw_endc_h.Write();
445 barrelmapold.Write();
446 barrelmapnew.Write();
447 barrelmapratio.Write();
448 endcapmapold_plus.Write();
449 endcapmapnew_plus.Write();
450 endcapmapratio_plus.Write();
451 endcapmapold_minus.Write();
452 endcapmapnew_minus.Write();
453 endcapmapratio_minus.Write();
470 TFile
f(
"PhiSymmetryCalibration.root",
"recreate");
472 std::vector<TH1F*> etsum_barl_histos(
kBarlRings);
473 std::vector<TH1F*> esum_barl_histos(
kBarlRings);
483 for (
int sign=0; sign<
kSides; sign++) {
484 float etsum = etsum_barl_[ieta][iphi][sign];
485 if (etsum<low && etsum!=0.) low=etsum;
486 if (etsum>high) high=etsum;
488 float esum = esum_barl_[ieta][iphi][sign];
489 if (esum<low_e && esum!=0.) low_e=esum;
490 if (esum>high_e) high_e=esum;
495 t <<
"etsum_barl_" << ieta+1;
496 etsum_barl_histos[ieta]=
new TH1F(t.str().c_str(),
"",50,low-.2*low,high+.1*high);
499 t <<
"esum_barl_" << ieta+1;
500 esum_barl_histos[ieta]=
new TH1F(t.str().c_str(),
"",50,low_e-.2*low_e,high_e+.1*high_e);
504 etsumMean_barl_[ieta]=0.;
505 esumMean_barl_[ieta]=0.;
508 for (
int sign=0; sign<
kSides; sign++) {
511 int iphi_r = int(iphi/nscx);
515 etsum_barl_SM_[ieta][iphi_r][sign] = etsum_barl_SM_[ieta][iphi_r][sign]*nscx/(nscx- nBads_barl_SM_[ieta][iphi_r][sign]);
518 etsumMean_barl_SM_[ieta] +=
519 etsum_barl_SM_[ieta][iphi_r][sign]/(2*int(kBarlWedges/nscx));
521 if(e_.goodCell_barl[ieta][iphi][sign]){
522 float etsum = etsum_barl_[ieta][iphi][sign];
523 float esum = esum_barl_[ieta][iphi][sign];
524 etsum_barl_histos[ieta]->Fill(etsum);
525 esum_barl_histos[ieta]->Fill(esum);
526 etsumMean_barl_[ieta]+=etsum;
529 esumMean_barl_[ieta]+=esum;
534 etsum_barl_histos[ieta]->Write();
535 esum_barl_histos[ieta]->Write();
536 etsumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
537 esumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
539 delete etsum_barl_histos[ieta];
540 delete esum_barl_histos[ieta];
554 float low_uncorr=FLT_MAX;
563 if (e_.endcapRing_[ix][iy]==
ring) {
564 for (
int sign=0; sign<
kSides; sign++) {
565 float etsum = etsum_endc_[ix][iy][sign];
566 if (etsum<low && etsum!=0.) low=etsum;
567 if (etsum>high) high=etsum;
569 float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
570 if (etsum_uncorr<low_uncorr && etsum_uncorr!=0.) low_uncorr=etsum_uncorr;
571 if (etsum_uncorr>high_uncorr) high_uncorr=etsum_uncorr;
573 float esum = esum_endc_[ix][iy][sign];
574 if (esum<low_e && esum!=0.) low_e=esum;
575 if (esum>high_e) high_e=esum;
577 float area = e_.cellArea_[ix][iy];
578 if (area<low_a) low_a=area;
579 if (area>high_a) high_a=area;
586 t<<
"etsum_endc_" <<
ring+1;
587 etsum_endc_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,low-.2*low,high+.1*high);
590 t<<
"etsum_endc_uncorr_" << ring+1;
591 etsum_endc_uncorr_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,low_uncorr-.2*low_uncorr,high_uncorr+.1*high_uncorr);
594 t<<
"esum_endc_" << ring+1;
595 esum_endc_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,low_e-.2*low_e,high_e+.1*high_e);
598 t<<
"etsumvsarea_endc_" << ring+1;
599 etsumvsarea_endc_histos[
ring]=
new TH2F(t.str().c_str(),
";A_{#eta#phi};#Sigma E_{T}",50,low_a,high_a,50,low,high);
602 t<<
"esumvsarea_endc_" << ring+1;
603 esumvsarea_endc_histos[
ring]=
new TH2F(t.str().c_str(),
";A_{#eta#phi};#Sigma E",50,low_a,high_a,50,low_e,high_e);
607 etsumMean_endc_[
ring]=0.;
608 esumMean_endc_[
ring]=0.;
611 if (e_.endcapRing_[ix][iy]==ring) {
612 for (
int sign=0; sign<
kSides; sign++) {
613 if(e_.goodCell_endc[ix][iy][sign]){
614 float etsum = etsum_endc_[ix][iy][sign];
615 float esum = esum_endc_[ix][iy][sign];
616 float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
617 etsum_endc_histos[
ring]->Fill(etsum);
618 etsum_endc_uncorr_histos[
ring]->Fill(etsum_uncorr);
619 esum_endc_histos[
ring]->Fill(esum);
621 float area = e_.cellArea_[ix][iy];
622 etsumvsarea_endc_histos[
ring]->Fill(area,etsum);
623 esumvsarea_endc_histos[
ring]->Fill(area,esum);
625 etsumMean_endc_[
ring]+=etsum;
626 esumMean_endc_[
ring]+=esum;
633 etsum_endc_histos[
ring]->Write();
634 etsum_endc_uncorr_histos[
ring]->Write();
635 esum_endc_histos[
ring]->Write();
636 etsumMean_endc_[
ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
637 esumMean_endc_[
ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
638 etsumvsarea_endc_histos[
ring]->Write();
639 esumvsarea_endc_histos[
ring]->Write();
641 delete etsum_endc_histos[
ring];
642 delete etsum_endc_uncorr_histos[
ring];
643 delete esum_endc_histos[
ring];
644 delete etsumvsarea_endc_histos[
ring];
645 delete esumvsarea_endc_histos[
ring];
650 TH2F barreletamap(
"barreletamap",
"barreletamap",171, -85,86,100,0,2);
651 TH2F barrelmap(
"barrelmap",
"barrelmap - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{0}}",360,1,360, 171, -85,86);
652 TH2F barrelmap_e(
"barrelmape",
"barrelmape - #frac{#Sigma E}{<#Sigma E>_{0}}",360,1,360, 171, -85,86);
653 TH2F barrelmap_divided(
"barrelmapdiv",
"barrelmapdivided - #frac{#Sigma E_{T}}{hits}",360,1,360,171,-85,86);
654 TH2F barrelmap_e_divided(
"barrelmapediv",
"barrelmapedivided - #frac{#Sigma E}{hits}",360,1,360,171,-85,86);
655 TH2F endcmap_plus_corr(
"endcapmapplus_corrected",
"endcapmapplus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
656 TH2F endcmap_minus_corr(
"endcapmapminus_corrected",
"endcapmapminus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
657 TH2F endcmap_plus_uncorr(
"endcapmapplus_uncorrected",
"endcapmapplus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
658 TH2F endcmap_minus_uncorr(
"endcapmapminus_uncorrected",
"endcapmapminus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
659 TH2F endcmap_e_plus(
"endcapmapeplus",
"endcapmapeplus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
660 TH2F endcmap_e_minus(
"endcapmapeminus",
"endcapmapeminus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
662 for (
int sign=0; sign<
kSides; sign++) {
664 int thesign = sign==1 ? 1:-1;
668 if(e_.goodCell_barl[ieta][iphi][sign]){
669 barrelmap.Fill(iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
670 barrelmap_e.Fill(iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/esumMean_barl_[0]);
671 if (!nhits_barl_[ieta][iphi][sign]) nhits_barl_[ieta][iphi][sign] =1;
672 barrelmap_divided.Fill( iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]);
673 barrelmap_e_divided.Fill( iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]);
676 barreletamap.Fill(ieta*thesign + thesign,etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
684 endcmap_plus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
685 endcmap_plus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
686 endcmap_e_plus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
689 endcmap_minus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
690 endcmap_minus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
691 endcmap_e_minus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
700 barreletamap.Write();
701 barrelmap_divided.Write();
703 barrelmap_e_divided.Write();
705 endcmap_plus_corr.Write();
706 endcmap_minus_corr.Write();
707 endcmap_plus_uncorr.Write();
708 endcmap_minus_uncorr.Write();
709 endcmap_e_plus.Write();
710 endcmap_e_minus.Write();
713 vector<TH1F*> etavsphi_endc(kEndcEtaRings);
714 vector<TH1F*> areavsphi_endc(kEndcEtaRings);
715 vector<TH1F*> etsumvsphi_endcp_corr(kEndcEtaRings);
716 vector<TH1F*> etsumvsphi_endcm_corr(kEndcEtaRings);
717 vector<TH1F*> etsumvsphi_endcp_uncorr(kEndcEtaRings);
718 vector<TH1F*> etsumvsphi_endcm_uncorr(kEndcEtaRings);
719 vector<TH1F*> esumvsphi_endcp(kEndcEtaRings);
720 vector<TH1F*> esumvsphi_endcm(kEndcEtaRings);
722 std::vector<TH1F*> deltaeta_histos(kEndcEtaRings);
723 std::vector<TH1F*> deltaphi_histos(kEndcEtaRings);
728 t<<
"etavsphi_endc_"<<
ring;
729 etavsphi_endc[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
732 t<<
"areavsphi_endc_"<<
ring;
733 areavsphi_endc[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
736 t<<
"etsumvsphi_endcp_corr_"<<
ring;
737 etsumvsphi_endcp_corr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
740 t <<
"etsumvsphi_endcm_corr_"<<
ring;
741 etsumvsphi_endcm_corr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
744 t <<
"etsumvsphi_endcp_uncorr_"<<
ring;
745 etsumvsphi_endcp_uncorr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
748 t <<
"etsumvsphi_endcm_uncorr_"<<
ring;
749 etsumvsphi_endcm_uncorr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
752 t <<
"esumvsphi_endcp_"<<
ring;
753 esumvsphi_endcp[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
756 t <<
"esumvsphi_endcm_"<<
ring;
757 esumvsphi_endcm[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
760 t <<
"deltaeta_" <<
ring;
761 deltaeta_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,-.1,.1);
763 t <<
"deltaphi_" <<
ring;
764 deltaphi_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,-.1,.1);
771 int ring = e_.endcapRing_[ix][iy];
774 for (
int ip=0; ip<e_.nRing_[
ring]; ip++) {
775 if (e_.cellPhi_[ix][iy]==e_.phi_endc_[ip][ring]) iphi_endc=ip;
779 for (
int sign=0; sign<
kSides; sign++) {
780 if(e_.goodCell_endc[ix][iy][sign]){
782 etsumvsphi_endcp_corr[
ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
783 etsumvsphi_endcp_uncorr[
ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
784 esumvsphi_endcp[
ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
786 etsumvsphi_endcm_corr[
ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
787 etsumvsphi_endcm_uncorr[
ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
788 esumvsphi_endcm[
ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
792 etavsphi_endc[
ring]->Fill(iphi_endc,e_.cellPos_[ix][iy].eta());
793 areavsphi_endc[
ring]->Fill(iphi_endc,e_.cellArea_[ix][iy]);
804 etavsphi_endc[
ring]->Write();
805 areavsphi_endc[
ring]->Write();
806 etsumvsphi_endcp_corr[
ring]->Write();
807 etsumvsphi_endcm_corr[
ring]->Write();
808 etsumvsphi_endcp_uncorr[
ring]->Write();
809 etsumvsphi_endcm_uncorr[
ring]->Write();
810 esumvsphi_endcp[
ring]->Write();
811 esumvsphi_endcm[
ring]->Write();
812 deltaeta_histos[
ring]->Write();
813 deltaphi_histos[
ring]->Write();
816 delete etsumvsphi_endcp_corr[
ring];
817 delete etsumvsphi_endcm_corr[
ring];
818 delete etsumvsphi_endcp_uncorr[
ring];
819 delete etsumvsphi_endcm_uncorr[
ring];
820 delete etavsphi_endc[
ring];
821 delete areavsphi_endc[
ring];
822 delete esumvsphi_endcp[
ring];
823 delete esumvsphi_endcm[
ring];
824 delete deltaeta_histos[
ring];
825 delete deltaphi_histos[
ring];
838 int ieta,iphi,sign,ix,iy,dummy;
841 std::ifstream etsum_barl_in(
"etsum_barl.dat",
ios::in);
842 while ( etsum_barl_in >> dummy >> ieta >> iphi >> sign >> etsum >> nhits ) {
843 etsum_barl_[ieta][iphi][sign]+=etsum;
844 nhits_barl_[ieta][iphi][sign]+=nhits;
847 int iphi_r = int(iphi/nscx);
848 etsum_barl_SM_[ieta][iphi_r][sign]+= etsum;
855 std::ifstream etsum_endc_in(
"etsum_endc.dat",
ios::in);
856 while ( etsum_endc_in >> dummy >> ix >> iy >> sign >> etsum >> nhits>>dummy ) {
857 etsum_endc_[ix][iy][sign]+=etsum;
858 nhits_endc_[ix][iy][sign]+=nhits;
862 std::ifstream k_barl_in(
"k_barl.dat",
ios::in);
864 k_barl_in >> dummy >> k_barl_[ieta];
867 std::ifstream k_endc_in(
"k_endc.dat",
ios::in);
869 k_endc_in >> dummy >> k_endc_[
ring];
885 t1<<
"mr_barl_"<<ieta+1;
886 miscal_resid_barl_histos[ieta] =
new TH1F(t1.str().c_str(),
"",100,0.,2.);
888 t2<<
"co_barl_"<<ieta+1;
889 correl_barl_histos[ieta] =
new TH2F(t2.str().c_str(),
"",50,.5,1.5,50,.5,1.5);
898 t1<<
"mr_endc_"<<
ring+1;
899 miscal_resid_endc_histos[
ring] =
new TH1F(t1.str().c_str(),
"",100,0.,2.);
901 t2<<
"co_endc_"<<ring+1;
902 correl_endc_histos[
ring] =
new TH2F(t2.str().c_str(),
"",50,.5,1.5,50,.5,1.5);
915 TFile
f(
"PhiSymmetryCalibration_miscal_resid.root",
"recreate");
916 for (
int ieta=0; ieta<85; ieta++) {
917 miscal_resid_barl_histos[ieta]->Write();
918 correl_barl_histos[ieta]->Write();
920 delete miscal_resid_barl_histos[ieta];
921 delete correl_barl_histos[ieta];
925 miscal_resid_endc_histos[
ring]->Write();
926 correl_endc_histos[
ring]->Write();
928 delete miscal_resid_endc_histos[
ring];
929 delete correl_endc_histos[
ring];
T getUntrackedParameter(std::string const &, T const &) const
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
PhiSymmetryCalibration_step2_SM(const edm::ParameterSet &iConfig)
static const int kBarlRings
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
int iphi() const
get the crystal iphi
static const int kBarlWedges
static const int kEndcWedgesX
tuple path
else: Piece not in the list, fine.
auto const T2 &decltype(t1.eta()) t2
void analyze(const edm::Event &, const edm::EventSetup &)
static const int kEndcEtaRings
Abs< T >::type abs(const T &t)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void fillConstantsHistos()
int ieta() const
get the crystal ieta
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
void setUp(const edm::EventSetup &setup)
~PhiSymmetryCalibration_step2_SM()
int zside() const
get the z-side of the crystal (1/-1)
static const int kEndcWedgesY