00001 #ifndef Calibration_EcalCalibAlgos_PhiSymmetryCalibration_h 00002 #define Calibration_EcalCalibAlgos_PhiSymmetryCalibration_h 00003 00004 // 00005 // Package: Calibration/EcalCalibAlgos 00006 // Class: PhiSymmetryCalibration 00007 // 00008 // 00009 // Description: performs phi-symmetry calibration 00010 // 00011 // 00012 // Original Author: David Futyan 00013 // 00014 // Responsible : Stefano Argiro, Valentina Sola 00015 // 00016 00017 #include <vector> 00018 00019 #include "Calibration/EcalCalibAlgos/interface/EcalGeomPhiSymHelper.h" 00020 00021 // Framework 00022 #include "FWCore/Framework/interface/EDAnalyzer.h" 00023 #include "FWCore/Framework/interface/EventSetup.h" 00024 #include "FWCore/Framework/interface/ProducerBase.h" 00025 #include "FWCore/Framework/interface/Frameworkfwd.h" 00026 #include "FWCore/Framework/interface/Event.h" 00027 #include "FWCore/Framework/interface/ESHandle.h" 00028 00029 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" 00030 #include "DataFormats/DetId/interface/DetId.h" 00031 00032 00033 class TH1F; 00034 00035 class PhiSymmetryCalibration : public edm::EDAnalyzer 00036 { 00037 00038 public: 00039 00041 PhiSymmetryCalibration( const edm::ParameterSet& iConfig ); 00042 00044 ~PhiSymmetryCalibration(); 00045 00047 virtual void beginJob(); 00048 virtual void endRun(edm::Run&, const edm::EventSetup&); 00049 void endLuminosityBlock(edm::LuminosityBlock const& ,edm::EventSetup const&); 00050 00051 00053 virtual void endJob(); 00054 00056 virtual void analyze( const edm::Event&, const edm::EventSetup& ); 00057 00059 void setUp(const edm::EventSetup& setup); 00060 00061 private: 00062 00063 // private member functions 00064 00065 void getKfactors(); 00066 00067 00068 // private data members 00069 00070 static const int kNMiscalBinsEB = 21; 00071 static const float kMiscalRangeEB; 00072 00073 static const int kNMiscalBinsEE = 41; 00074 static const float kMiscalRangeEE; 00075 00076 EcalGeomPhiSymHelper e_; 00077 00078 // Transverse energy sum arrays 00079 double etsum_barl_[kBarlRings] [kBarlWedges] [kSides]; 00080 double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]; 00081 double etsum_endc_uncorr[kEndcWedgesX][kEndcWedgesX][kSides]; 00082 double etsumMean_barl_[kBarlRings]; 00083 double etsumMean_endc_[kEndcEtaRings]; 00084 00085 unsigned int nhits_barl_[kBarlRings][kBarlWedges] [kSides]; 00086 unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]; 00087 00088 double etsum_barl_miscal_[kNMiscalBinsEB][kBarlRings]; 00089 double etsum_endc_miscal_[kNMiscalBinsEE][kEndcEtaRings]; 00090 00091 00092 double esumMean_barl_[kBarlRings]; 00093 double esumMean_endc_[kEndcEtaRings]; 00094 00095 00096 // factors to convert from ET sum deviation to miscalibration 00097 double k_barl_[kBarlRings]; 00098 double k_endc_[kEndcEtaRings]; 00099 double miscalEB_[kNMiscalBinsEB]; 00100 double miscalEE_[kNMiscalBinsEE]; 00101 00102 std::vector<DetId> barrelCells; 00103 std::vector<DetId> endcapCells; 00104 00105 // input calibration constants 00106 double oldCalibs_barl[kBarlRings ][kBarlWedges][kSides]; 00107 double oldCalibs_endc[kEndcWedgesX][kEndcWedgesY][kSides]; 00108 00109 // new calibration constants 00110 double newCalibs_barl[kBarlRings ][kBarlWedges][kSides]; 00111 double newCalibs_endc[kEndcWedgesX][kEndcWedgesX][kSides]; 00112 00113 // calibration constants not multiplied by old ones 00114 float epsilon_M_barl[kBarlRings][kBarlWedges][kSides]; 00115 float epsilon_M_endc[kEndcWedgesX][kEndcWedgesY][kSides]; 00116 00117 // calibration const not corrected for k 00118 float rawconst_barl[kBarlRings][kBarlWedges][kSides]; 00119 float rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]; 00120 00121 00122 // steering parameters 00123 00124 std::string ecalHitsProducer_; 00125 std::string barrelHits_; 00126 std::string endcapHits_; 00127 00128 // energy cut in the barrel 00129 double eCut_barl_; 00130 00131 00132 // parametrized energy cut EE : e_cut = ap + eta_ring*b 00133 double ap_; 00134 double b_; 00135 00136 int eventSet_; 00138 int statusThreshold_; 00139 00140 static const int kMaxEndciPhi = 360; 00141 00142 float phi_endc[kMaxEndciPhi][kEndcEtaRings]; 00143 00144 00145 bool reiteration_; 00146 std::string oldcalibfile_; //searched for in Calibration/EcalCalibAlgos/data 00147 00149 EcalIntercalibConstants oldCalibs_; 00150 00151 bool isfirstpass_; 00152 00153 00154 // Et and E spectra 00155 std::vector<TH1F*> et_spectrum_b_histos; //kBarlEtaRings 00156 std::vector<TH1F*> e_spectrum_b_histos; 00157 std::vector<TH1F*> et_spectrum_e_histos; //kEndcEtaRings 00158 std::vector<TH1F*> e_spectrum_e_histos; 00159 00160 bool spectra; 00161 int nevents_; 00162 int eventsinrun_; 00163 int eventsinlb_; 00164 }; 00165 00166 #endif