17 #include "boost/filesystem/operations.hpp"
30 have_initial_miscalib_=
34 "InitialMiscalib.xml");
37 "EcalIntercalibConstants.xml");
62 e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_);
65 if (have_initial_miscalib_){
68 namespace fs = boost::filesystem;
71 << initialmiscalibfile_ <<endl;
75 if (ret)
edm::LogError(
"PhiSym")<<
"Error reading XML files"<<endl;;
78 for (vector<DetId>::iterator it=barrelCells.begin(); it!=barrelCells.end(); ++it){
82 for (vector<DetId>::iterator it=endcapCells.begin(); it!=endcapCells.end(); ++it){
94 namespace fs = boost::filesystem;
97 << oldcalibfile_ <<endl;
103 if (ret)
edm::LogError(
"PhiSym")<<
"Error reading XML files"<<endl;;
107 for (vector<DetId>::iterator it=barrelCells.begin();
108 it!=barrelCells.end(); ++it)
112 for (vector<DetId>::iterator it=endcapCells.begin();
113 it!=endcapCells.end(); ++it)
127 for (
int sign=0; sign<
kSides; sign++) {
128 etsum_barl_[ieta][iphi][sign]=0.;
129 nhits_barl_[ieta][iphi][sign]=0;
130 esum_barl_[ieta][iphi][sign]=0.;
138 for (
int sign=0; sign<
kSides; sign++) {
139 etsum_endc_[ix][iy][sign]=0.;
140 nhits_endc_[ix][iy][sign]=0;
141 esum_endc_[ix][iy][sign]=0.;
154 edm::LogError(
"PhiSym")<<
"Must process at least one event-Exiting" <<endl;
168 int ring = e_.endcapRing_[ix][iy];
171 for (
int sign=0; sign<
kSides; sign++) {
172 etsum_endc_uncorr[ix][iy][sign] = etsum_endc_[ix][iy][sign];
173 etsum_endc_[ix][iy][sign]*=e_.meanCellArea_[
ring]/e_.cellArea_[ix][iy];
185 std::ofstream etsumMean_barl_out(
"etsumMean_barl.dat",
ios::out);
187 etsumMean_barl_out << ieta <<
" " << etsumMean_barl_[ieta] << endl;
189 etsumMean_barl_out.close();
191 std::ofstream etsumMean_endc_out(
"etsumMean_endc.dat",
ios::out);
193 etsumMean_endc_out << e_.cellPos_[
ring][50].eta() <<
" " << etsumMean_endc_[
ring] << endl;
195 etsumMean_endc_out.close();
201 for (
int sign=0; sign<
kSides; sign++) {
202 if(e_.goodCell_barl[ieta][iphi][sign]){
203 float etsum = etsum_barl_[ieta][iphi][sign];
204 float epsilon_T = (etsum/etsumMean_barl_[ieta]) - 1.;
205 rawconst_barl[ieta][iphi][sign] = epsilon_T + 1.;
206 epsilon_M_barl[ieta][iphi][sign] = epsilon_T/k_barl_[ieta];
208 rawconst_barl[ieta][iphi][sign] = 1.;
209 epsilon_M_barl[ieta][iphi][sign] = 0.;
218 for (
int sign=0; sign<
kSides; sign++) {
219 int ring = e_.endcapRing_[ix][iy];
220 if (ring!=-1 && e_.goodCell_endc[ix][iy][sign]) {
221 float etsum = etsum_endc_[ix][iy][sign];
222 float epsilon_T = (etsum/etsumMean_endc_[
ring]) - 1.;
223 rawconst_endc[ix][iy][sign] = epsilon_T + 1.;
224 epsilon_M_endc[ix][iy][sign] = epsilon_T/k_endc_[
ring];
226 epsilon_M_endc[ix][iy][0] = 0.;
227 epsilon_M_endc[ix][iy][1] = 0.;
228 rawconst_endc[ix][iy][0] = 1.;
229 rawconst_endc[ix][iy][1] = 1.;
237 std::string newcalibfile(
"EcalIntercalibConstants_new.xml");
241 TFile ehistof(
"ehistos.root",
"recreate");
243 TH1D ebhisto(
"eb",
"eb",100, 0.,2.);
245 std::vector<DetId>::const_iterator barrelIt=barrelCells.begin();
246 for (; barrelIt!=barrelCells.end(); barrelIt++) {
249 int iphi = eb.
iphi()-1;
250 int sign = eb.
zside()>0 ? 1 : 0;
254 newCalibs_[eb] = oldCalibs_[eb]/(1+epsilon_M_barl[ieta][iphi][sign]);
256 if(e_.goodCell_barl[ieta][iphi][sign]){
258 ebhisto.Fill(newCalibs_[eb]);
261 miscal_resid_barl_histos[ieta]->Fill(miscalib_[eb]*newCalibs_[eb]);
262 correl_barl_histos[ieta]->Fill(miscalib_[eb],newCalibs_[eb]);
268 TH1D eehisto(
"ee",
"ee",100, 0.,2.);
269 std::vector<DetId>::const_iterator endcapIt=endcapCells.begin();
271 for (; endcapIt!=endcapCells.end(); endcapIt++) {
275 int sign = ee.
zside()>0 ? 1 : 0;
277 newCalibs_[ee] = oldCalibs_[ee]/(1+epsilon_M_endc[ix][iy][sign]);
280 if(e_.goodCell_endc[ix][iy][sign]){
282 eehisto.Fill(newCalibs_[ee]);
283 miscal_resid_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee]*
286 correl_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee],
297 header.
tag_=
"unknown";
298 header.
date_=
"Mar 24 1973";
307 fillConstantsHistos();
312 std::fstream ebf(
"etsummary_barl.dat",
ios::out);
313 std::fstream eef(
"etsummary_endc.dat",
ios::out);
317 for (
int sign=0; sign<
kSides; sign++) {
319 ebf<< ieta<<
" " << iphi <<
" " <<sign <<
" "
320 << etsum_barl_[ieta][iphi][sign]<<endl;
328 for (
int sign=0; sign<
kSides; sign++) {
329 eef<<ix<<
" " <<iy<<
" " <<sign<<
" "
330 << etsum_endc_[ix][iy][sign]<<endl;
344 TFile
f(
"CalibHistos.root",
"recreate");
346 TH2F barreletamap(
"barreletamap",
"barreletamap",171, -85,86,100,0.,2.);
347 TH2F barreletamapraw(
"barreletamapraw",
"barreletamapraw",171, -85,86,100,0.,2.);
349 TH2F barrelmapold(
"barrelmapold",
"barrelmapold",360,1.,361.,171,-85.,86.);
350 TH2F barrelmapnew(
"barrelmapnew",
"barrelmapnew",360,1.,361.,171,-85.,86.);
351 TH2F barrelmapratio(
"barrelmapratio",
"barrelmapratio",360,1.,361.,171,-85.,86.);
353 TH1F rawconst_endc_h(
"rawconst_endc",
"rawconst_endc",100,0.,2.);
354 TH1F const_endc_h(
"const_endc",
"const_endc",100,0.,2.);
356 TH1F oldconst_endc_h(
"oldconst_endc",
"oldconst_endc;oldCalib;",200,0,2);
357 TH2F newvsraw_endc_h(
"newvsraw_endc",
"newvsraw_endc;rawConst;newCalib",200,0,2,200,0,2);
359 TH2F endcapmapold_plus(
"endcapmapold_plus",
"endcapmapold_plus",100,1.,101.,100,1.,101.);
360 TH2F endcapmapnew_plus(
"endcapmapnew_plus",
"endcapmapnew_plus",100,1.,101.,100,1.,101.);
361 TH2F endcapmapratio_plus(
"endcapmapratio_plus",
"endcapmapratio_plus",100,1.,101.,100,1.,101.);
363 TH2F endcapmapold_minus(
"endcapmapold_minus",
"endcapmapold_minus",100,1.,101.,100,1.,101.);
364 TH2F endcapmapnew_minus(
"endcapmapnew_minus",
"endcapmapnew_minus",100,1.,101.,100,1.,101.);
365 TH2F endcapmapratio_minus(
"endcapmapratio_minus",
"endcapmapratio_minus",100,1.,101.,100,1.,101.);
368 for (
int sign=0; sign<
kSides; sign++) {
370 int thesign = sign==1 ? 1:-1;
374 if(e_.goodCell_barl[ieta][iphi][sign]){
376 EBDetId eb(thesign*( ieta+1 ), iphi+1);
379 barreletamap.Fill(ieta*thesign + thesign,newCalibs_[eb]);
380 barreletamapraw.Fill(ieta*thesign + thesign,rawconst_barl[ieta][iphi][sign]);
382 barrelmapold.Fill(iphi+1,ieta*thesign + thesign, oldCalibs_[eb]);
383 barrelmapnew.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]);
384 barrelmapratio.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]/oldCalibs_[eb]);
391 if (e_.goodCell_endc[ix][iy][sign]){
393 EEDetId ee(ix+1, iy+1,thesign);
395 rawconst_endc_h.Fill(rawconst_endc[ix][iy][sign]);
396 const_endc_h.Fill(newCalibs_[ee]);
397 oldconst_endc_h.Fill(oldCalibs_[ee]);
398 newvsraw_endc_h.Fill(rawconst_endc[ix][iy][sign],newCalibs_[ee]);
401 endcapmapold_plus.Fill(ix+1,iy+1,oldCalibs_[ee]);
402 endcapmapnew_plus.Fill(ix+1,iy+1,newCalibs_[ee]);
403 endcapmapratio_plus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
406 endcapmapold_minus.Fill(ix+1,iy+1,oldCalibs_[ee]);
407 endcapmapnew_minus.Fill(ix+1,iy+1,newCalibs_[ee]);
408 endcapmapratio_minus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
417 barreletamap.Write();
418 barreletamapraw.Write();
419 rawconst_endc_h.Write();
420 const_endc_h.Write();
421 oldconst_endc_h.Write();
422 newvsraw_endc_h.Write();
423 barrelmapold.Write();
424 barrelmapnew.Write();
425 barrelmapratio.Write();
426 endcapmapold_plus.Write();
427 endcapmapnew_plus.Write();
428 endcapmapratio_plus.Write();
429 endcapmapold_minus.Write();
430 endcapmapnew_minus.Write();
431 endcapmapratio_minus.Write();
448 TFile
f(
"PhiSymmetryCalibration.root",
"recreate");
450 std::vector<TH1F*> etsum_barl_histos(
kBarlRings);
451 std::vector<TH1F*> esum_barl_histos(
kBarlRings);
461 for (
int sign=0; sign<
kSides; sign++) {
462 float etsum = etsum_barl_[ieta][iphi][sign];
463 if (etsum<low && etsum!=0.) low=etsum;
464 if (etsum>high) high=etsum;
466 float esum = esum_barl_[ieta][iphi][sign];
467 if (esum<low_e && esum!=0.) low_e=esum;
468 if (esum>high_e) high_e=esum;
473 t <<
"etsum_barl_" << ieta+1;
474 etsum_barl_histos[ieta]=
new TH1F(t.str().c_str(),
"",50,low-.2*low,high+.1*high);
477 t <<
"esum_barl_" << ieta+1;
478 esum_barl_histos[ieta]=
new TH1F(t.str().c_str(),
"",50,low_e-.2*low_e,high_e+.1*high_e);
482 etsumMean_barl_[ieta]=0.;
483 esumMean_barl_[ieta]=0.;
485 for (
int sign=0; sign<
kSides; sign++) {
486 if(e_.goodCell_barl[ieta][iphi][sign]){
487 float etsum = etsum_barl_[ieta][iphi][sign];
488 float esum = esum_barl_[ieta][iphi][sign];
489 etsum_barl_histos[ieta]->Fill(etsum);
490 esum_barl_histos[ieta]->Fill(esum);
491 etsumMean_barl_[ieta]+=etsum;
492 esumMean_barl_[ieta]+=esum;
497 etsum_barl_histos[ieta]->Write();
498 esum_barl_histos[ieta]->Write();
499 etsumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
500 esumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
501 delete etsum_barl_histos[ieta];
502 delete esum_barl_histos[ieta];
517 float low_uncorr=FLT_MAX;
526 if (e_.endcapRing_[ix][iy]==
ring) {
527 for (
int sign=0; sign<
kSides; sign++) {
528 float etsum = etsum_endc_[ix][iy][sign];
529 if (etsum<low && etsum!=0.) low=etsum;
530 if (etsum>high) high=etsum;
532 float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
533 if (etsum_uncorr<low_uncorr && etsum_uncorr!=0.) low_uncorr=etsum_uncorr;
534 if (etsum_uncorr>high_uncorr) high_uncorr=etsum_uncorr;
536 float esum = esum_endc_[ix][iy][sign];
537 if (esum<low_e && esum!=0.) low_e=esum;
538 if (esum>high_e) high_e=esum;
540 float area = e_.cellArea_[ix][iy];
541 if (area<low_a) low_a=area;
542 if (area>high_a) high_a=area;
549 t<<
"etsum_endc_" <<
ring+1;
550 etsum_endc_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,low-.2*low,high+.1*high);
553 t<<
"etsum_endc_uncorr_" << ring+1;
554 etsum_endc_uncorr_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,low_uncorr-.2*low_uncorr,high_uncorr+.1*high_uncorr);
557 t<<
"esum_endc_" << ring+1;
558 esum_endc_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,low_e-.2*low_e,high_e+.1*high_e);
561 t<<
"etsumvsarea_endc_" << ring+1;
562 etsumvsarea_endc_histos[
ring]=
new TH2F(t.str().c_str(),
";A_{#eta#phi};#Sigma E_{T}",50,low_a,high_a,50,low,high);
565 t<<
"esumvsarea_endc_" << ring+1;
566 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);
570 etsumMean_endc_[
ring]=0.;
571 esumMean_endc_[
ring]=0.;
574 if (e_.endcapRing_[ix][iy]==ring) {
575 for (
int sign=0; sign<
kSides; sign++) {
576 if(e_.goodCell_endc[ix][iy][sign]){
577 float etsum = etsum_endc_[ix][iy][sign];
578 float esum = esum_endc_[ix][iy][sign];
579 float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
580 etsum_endc_histos[
ring]->Fill(etsum);
581 etsum_endc_uncorr_histos[
ring]->Fill(etsum_uncorr);
582 esum_endc_histos[
ring]->Fill(esum);
584 float area = e_.cellArea_[ix][iy];
585 etsumvsarea_endc_histos[
ring]->Fill(area,etsum);
586 esumvsarea_endc_histos[
ring]->Fill(area,esum);
588 etsumMean_endc_[
ring]+=etsum;
589 esumMean_endc_[
ring]+=esum;
596 etsum_endc_histos[
ring]->Write();
597 etsum_endc_uncorr_histos[
ring]->Write();
598 esum_endc_histos[
ring]->Write();
599 etsumMean_endc_[
ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
600 esumMean_endc_[
ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
601 etsumvsarea_endc_histos[
ring]->Write();
602 esumvsarea_endc_histos[
ring]->Write();
604 delete etsum_endc_histos[
ring];
605 delete etsum_endc_uncorr_histos[
ring];
606 delete esum_endc_histos[
ring];
607 delete etsumvsarea_endc_histos[
ring];
608 delete esumvsarea_endc_histos[
ring];
613 TH2F barreletamap(
"barreletamap",
"barreletamap",171, -85,86,100,0,2);
614 TH2F barrelmap(
"barrelmap",
"barrelmap - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{0}}",360,1,360, 171, -85,86);
615 TH2F barrelmap_e(
"barrelmape",
"barrelmape - #frac{#Sigma E}{<#Sigma E>_{0}}",360,1,360, 171, -85,86);
616 TH2F barrelmap_divided(
"barrelmapdiv",
"barrelmapdivided - #frac{#Sigma E_{T}}{hits}",360,1,360,171,-85,86);
617 TH2F barrelmap_e_divided(
"barrelmapediv",
"barrelmapedivided - #frac{#Sigma E}{hits}",360,1,360,171,-85,86);
618 TH2F endcmap_plus_corr(
"endcapmapplus_corrected",
"endcapmapplus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
619 TH2F endcmap_minus_corr(
"endcapmapminus_corrected",
"endcapmapminus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
620 TH2F endcmap_plus_uncorr(
"endcapmapplus_uncorrected",
"endcapmapplus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
621 TH2F endcmap_minus_uncorr(
"endcapmapminus_uncorrected",
"endcapmapminus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
622 TH2F endcmap_e_plus(
"endcapmapeplus",
"endcapmapeplus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
623 TH2F endcmap_e_minus(
"endcapmapeminus",
"endcapmapeminus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
625 for (
int sign=0; sign<
kSides; sign++) {
627 int thesign = sign==1 ? 1:-1;
631 if(e_.goodCell_barl[ieta][iphi][sign]){
632 barrelmap.Fill(iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
633 barrelmap_e.Fill(iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/esumMean_barl_[0]);
634 if (!nhits_barl_[ieta][iphi][sign]) nhits_barl_[ieta][iphi][sign] =1;
635 barrelmap_divided.Fill( iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]);
636 barrelmap_e_divided.Fill( iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]);
639 barreletamap.Fill(ieta*thesign + thesign,etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
647 endcmap_plus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
648 endcmap_plus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
649 endcmap_e_plus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
652 endcmap_minus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
653 endcmap_minus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
654 endcmap_e_minus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
663 barreletamap.Write();
664 barrelmap_divided.Write();
666 barrelmap_e_divided.Write();
668 endcmap_plus_corr.Write();
669 endcmap_minus_corr.Write();
670 endcmap_plus_uncorr.Write();
671 endcmap_minus_uncorr.Write();
672 endcmap_e_plus.Write();
673 endcmap_e_minus.Write();
676 vector<TH1F*> etavsphi_endc(kEndcEtaRings);
677 vector<TH1F*> areavsphi_endc(kEndcEtaRings);
678 vector<TH1F*> etsumvsphi_endcp_corr(kEndcEtaRings);
679 vector<TH1F*> etsumvsphi_endcm_corr(kEndcEtaRings);
680 vector<TH1F*> etsumvsphi_endcp_uncorr(kEndcEtaRings);
681 vector<TH1F*> etsumvsphi_endcm_uncorr(kEndcEtaRings);
682 vector<TH1F*> esumvsphi_endcp(kEndcEtaRings);
683 vector<TH1F*> esumvsphi_endcm(kEndcEtaRings);
685 std::vector<TH1F*> deltaeta_histos(kEndcEtaRings);
686 std::vector<TH1F*> deltaphi_histos(kEndcEtaRings);
691 t<<
"etavsphi_endc_"<<
ring;
692 etavsphi_endc[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
695 t<<
"areavsphi_endc_"<<
ring;
696 areavsphi_endc[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
699 t<<
"etsumvsphi_endcp_corr_"<<
ring;
700 etsumvsphi_endcp_corr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
703 t <<
"etsumvsphi_endcm_corr_"<<
ring;
704 etsumvsphi_endcm_corr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
707 t <<
"etsumvsphi_endcp_uncorr_"<<
ring;
708 etsumvsphi_endcp_uncorr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
711 t <<
"etsumvsphi_endcm_uncorr_"<<
ring;
712 etsumvsphi_endcm_uncorr[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
715 t <<
"esumvsphi_endcp_"<<
ring;
716 esumvsphi_endcp[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
719 t <<
"esumvsphi_endcm_"<<
ring;
720 esumvsphi_endcm[
ring] =
new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[
ring],0,e_.nRing_[
ring]);
723 t <<
"deltaeta_" <<
ring;
724 deltaeta_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,-.1,.1);
726 t <<
"deltaphi_" <<
ring;
727 deltaphi_histos[
ring]=
new TH1F(t.str().c_str(),
"",50,-.1,.1);
734 int ring = e_.endcapRing_[ix][iy];
737 for (
int ip=0; ip<e_.nRing_[
ring]; ip++) {
738 if (e_.cellPhi_[ix][iy]==e_.phi_endc_[ip][ring]) iphi_endc=ip;
742 for (
int sign=0; sign<
kSides; sign++) {
743 if(e_.goodCell_endc[ix][iy][sign]){
745 etsumvsphi_endcp_corr[
ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
746 etsumvsphi_endcp_uncorr[
ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
747 esumvsphi_endcp[
ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
749 etsumvsphi_endcm_corr[
ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
750 etsumvsphi_endcm_uncorr[
ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
751 esumvsphi_endcm[
ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
755 etavsphi_endc[
ring]->Fill(iphi_endc,e_.cellPos_[ix][iy].eta());
756 areavsphi_endc[
ring]->Fill(iphi_endc,e_.cellArea_[ix][iy]);
767 etavsphi_endc[
ring]->Write();
768 areavsphi_endc[
ring]->Write();
769 etsumvsphi_endcp_corr[
ring]->Write();
770 etsumvsphi_endcm_corr[
ring]->Write();
771 etsumvsphi_endcp_uncorr[
ring]->Write();
772 etsumvsphi_endcm_uncorr[
ring]->Write();
773 esumvsphi_endcp[
ring]->Write();
774 esumvsphi_endcm[
ring]->Write();
775 deltaeta_histos[
ring]->Write();
776 deltaphi_histos[
ring]->Write();
779 delete etsumvsphi_endcp_corr[
ring];
780 delete etsumvsphi_endcm_corr[
ring];
781 delete etsumvsphi_endcp_uncorr[
ring];
782 delete etsumvsphi_endcm_uncorr[
ring];
783 delete etavsphi_endc[
ring];
784 delete areavsphi_endc[
ring];
785 delete esumvsphi_endcp[
ring];
786 delete esumvsphi_endcm[
ring];
787 delete deltaeta_histos[
ring];
788 delete deltaphi_histos[
ring];
801 int ieta,iphi,sign,ix,iy,dummy;
804 std::ifstream etsum_barl_in(
"etsum_barl.dat",
ios::in);
805 while ( etsum_barl_in >> dummy >> ieta >> iphi >> sign >> etsum >> nhits ) {
806 etsum_barl_[ieta][iphi][sign]+=etsum;
807 nhits_barl_[ieta][iphi][sign]+=nhits;
811 std::ifstream etsum_endc_in(
"etsum_endc.dat",
ios::in);
812 while ( etsum_endc_in >> dummy >> ix >> iy >> sign >> etsum >> nhits>>dummy ) {
813 etsum_endc_[ix][iy][sign]+=etsum;
814 nhits_endc_[ix][iy][sign]+=nhits;
817 std::ifstream k_barl_in(
"k_barl.dat",
ios::in);
819 k_barl_in >> dummy >> k_barl_[ieta];
822 std::ifstream k_endc_in(
"k_endc.dat",
ios::in);
824 k_endc_in >> dummy >> k_endc_[
ring];
840 t1<<
"mr_barl_"<<ieta+1;
841 miscal_resid_barl_histos[ieta] =
new TH1F(t1.str().c_str(),
"",100,0.,2.);
843 t2<<
"co_barl_"<<ieta+1;
844 correl_barl_histos[ieta] =
new TH2F(t2.str().c_str(),
"",50,.5,1.5,50,.5,1.5);
853 t1<<
"mr_endc_"<<
ring+1;
854 miscal_resid_endc_histos[
ring] =
new TH1F(t1.str().c_str(),
"",100,0.,2.);
856 t2<<
"co_endc_"<<ring+1;
857 correl_endc_histos[
ring] =
new TH2F(t2.str().c_str(),
"",50,.5,1.5,50,.5,1.5);
870 TFile
f(
"PhiSymmetryCalibration_miscal_resid.root",
"recreate");
871 for (
int ieta=0; ieta<85; ieta++) {
872 miscal_resid_barl_histos[ieta]->Write();
873 correl_barl_histos[ieta]->Write();
875 delete miscal_resid_barl_histos[ieta];
876 delete correl_barl_histos[ieta];
880 miscal_resid_endc_histos[
ring]->Write();
881 correl_endc_histos[
ring]->Write();
883 delete miscal_resid_endc_histos[
ring];
884 delete correl_endc_histos[
ring];
void fillConstantsHistos()
T getUntrackedParameter(std::string const &, T const &) const
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
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
PhiSymmetryCalibration_step2(const edm::ParameterSet &iConfig)
static const int kEndcWedgesX
auto const T2 &decltype(t1.eta()) t2
static const int kEndcEtaRings
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
void setUp(const edm::EventSetup &setup)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
void analyze(const edm::Event &, const edm::EventSetup &)
~PhiSymmetryCalibration_step2()
int zside() const
get the z-side of the crystal (1/-1)
static const int kEndcWedgesY