CMS 3D CMS Logo

ZeeCalibration.h
Go to the documentation of this file.
1 #ifndef CALIBRATION_ECALCALIBALGOS_ZEECALIBRATION
2 #define CALIBRATION_ECALCALIBALGOS_ZEECALIBRATION
3 
4 // -*- C++ -*-
5 //
6 // Package: ZeeCalibration
7 // Class: ZeeCalibration
8 //
16 //
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include <vector>
24 #include <map>
25 
26 // user include files
36 
39 
42 
45 
48 
49 #include "TTree.h"
50 #include "TFile.h"
51 #include "TGraph.h"
52 #include "TGraphErrors.h"
53 #include "TH1.h"
54 #include "TH2.h"
55 
61 
65 
66 #include<vector>
67 #include<string>
68 
69 // class declaration
70 //
71 
73 
74  public:
75 
77  ZeeCalibration( const edm::ParameterSet& iConfig );
78 
81 
83  virtual void produce(edm::Event&, const edm::EventSetup&) {};
84 
86  virtual void beginOfJob();
87 
89  virtual void endOfJob();
90 
92  virtual void startingNewLoop( unsigned int iLoop );
93 
95  virtual Status endOfLoop( const edm::EventSetup&, unsigned int iLoop );
96 
98  virtual Status duringLoop( const edm::Event&, const edm::EventSetup& );
99 
101  virtual std::shared_ptr<EcalIntercalibConstants> produceEcalIntercalibConstants( const EcalIntercalibConstantsRcd& iRecord );
102 
103  private:
104 
105 /* ElectronEnergyCorrector myCorrector; */
106 /* ElectronClassification myClassificator; */
107 
108  double fEtaBarrelBad(double scEta) const;
109  double fEtaBarrelGood(double scEta) const;
110  double fEtaEndcapBad(double scEta) const;
111  double fEtaEndcapGood(double scEta) const;
112 
113  int ringNumberCorrector(int k);
114  double getEtaCorrection(const reco::GsfElectron*);
115 
116  \
117  void fillEleInfo(std::vector<HepMC::GenParticle*>& a, std::map<HepMC::GenParticle*,const reco::GsfElectron*>& b);
118  void fillMCInfo(HepMC::GenParticle* mcele);
119 
120  void fillMCmap(const std::vector<const reco::GsfElectron*>* electronCollection, const std::vector<HepMC::GenParticle*>& mcEle,std::map<HepMC::GenParticle*,const reco::GsfElectron*>& myMCmap);
121  // void fillMCmap(const reco::ElectronCollection* electronCollection, const std::vector<HepMC::GenParticle*>& mcEle,std::map<HepMC::GenParticle*,const reco::Electron*>& myMCmap);
122 
123  float EvalDPhi(float Phi,float Phi_ref);
124  float EvalDR(float Eta,float Eta_ref,float Phi,float Phi_ref);
125 
126 
127  void bookHistograms();
128 
129  void resetVariables();
130 
131  void resetHistograms();
132 
133  void printStatistics();
134 
135  std::pair<DetId, double> getHottestDetId(const std::vector<std::pair<DetId, float> >& mySCRecHits, const EBRecHitCollection* ebhits , const EERecHitCollection* eehits);
136 
137  bool xtalIsOnModuleBorder( EBDetId myEBDetId );
138 
139  float computeCoefficientDistanceAtIteration( float v1[250], float v2[250], int size);
140 
141  // float Calculate_SigmaEtaEta(const reco::SuperCluster &passedCluster);
142 
143  // ----------member data ---------------------------
144 
145 
146  TTree* myTree;
147 
149 
156 
159 
162 
165 
167 
168  unsigned int etaBins_;
169  unsigned int etBins_;
170 
171  double etaMin_;
172  double etMin_;
173  double etaMax_;
174  double etMax_;
175 
178 
181  double mass;
182 
183  float mass4tree;
185 
187 
189 
194 
195  std::shared_ptr<EcalIntercalibConstants> ical;
196 
198 
201 
202  // steering parameters
203 
205 
206  // TGraph* graph;
207 
210 
213 
214 
221 
222  TH1F* h_eleEffEta[2];
223  TH1F* h_eleEffPhi[2];
224  TH1F* h_eleEffPt[2];
225 
228 
233 
240  TH1F* h1_RMin_;
241  TH1F* h1_RMinZ_;
243 
246 
247  TH1F* h_eleEffEta_[2];
248  TH1F* h_eleEffPhi_[2];
249  TH1F* h_eleEffPt_[2];
250  TH1F* h_ESCEtrue_[25];
251  TH2F* h_ESCEtrueVsEta_[25];
252 
253  TH1F* h_ESCcorrEtrue_[25];
255 
262 
264  // TH2F* h2_miscalRecalParz_[25];
265  TH1F* h1_mc_;
266  TH1F* h1_mcParz_[25];
267  /*
268  TH1F* h_DiffZMassDistr_[25];
269  TH1F* h_ZMassDistr_[25];
270  */
273  //TH2F* h2_miscalRecalEBParz_[25];
274  TH1F* h1_mcEB_;
275  TH1F* h1_mcEBParz_[25];
277  //TH2F* h2_miscalRecalEEParz_[25];
278  TH1F* h1_mcEE_;
279  TH1F* h1_mcEEParz_[25];
280 
281  TH2F* h2_chi2_[25];
282  TH2F* h2_iterations_[25];
283 
287 
291 
294 
303 
307 
309 
310 
312  Int_t NEVT, MCZBB, MCZEB, MCZEE;
313 
314  TFile* outputFile_;
315 
316  unsigned int theMaxLoops; // Number of loops to loop
317 
319 
320  unsigned int electronSelection_;
321 
322  double loopArray[50];
323  double sigmaArray[50];
324  double sigmaErrorArray[50];
326 
329 
332 
335 
338 
341 
344 
345 
347 
348  unsigned int nEvents_; // number of events processed
349 
350  unsigned int nWasRun_; // # where at least one HLT was run
351  unsigned int nAccept_; // # of accepted events
352  unsigned int nErrors_; // # where at least one HLT had error
353 
354  std::vector<unsigned int> hlWasRun_; // # where HLT[i] was run
355  std::vector<unsigned int> hlAccept_; // # of events accepted by HLT[i]
356  std::vector<unsigned int> hlErrors_; // # of events with error in HLT[i]
357 
358  std::vector<std::string> hlNames_; // name of each HLT algorithm
359  bool init_; // vectors initialised or not
360 
362  char aTriggerNames[200][30];
363  bool aTriggerResults[200];
364 
365  Int_t hltCount;
366  char aHLTNames[6000];
367  Int_t hltNamesLen;
368  TString aNames[200];
369  bool aHLTResults[200];
370 
372 
373 };
374 #endif
char aHLTNames[6000]
unsigned int etBins_
size
Write out results.
TH1F * h1_eleERecoOverEtrue_
virtual void produce(edm::Event &, const edm::EventSetup &)
Dummy implementation (job done in duringLoop)
virtual void endOfJob()
Called at end of job.
TH2F * h2_fEtaBarrelBad_
TH1F * h1_mcEEParz_[25]
std::string calibMode_
std::string outputFileName_
double fEtaEndcapGood(double scEta) const
std::string scIslandCollection_
std::string RecalibBarrelHits_
TH1F * h_eleEffPhi_[2]
std::string electronCollection_
int BARREL_ELECTRONS_AFTER_BORDER_CUT
TH2F * h2_miscalRecal_
TH1F * h1_eventsBeforeEWKSelection_
unsigned int nErrors_
double fEtaBarrelBad(double scEta) const
float computeCoefficientDistanceAtIteration(float v1[250], float v2[250], int size)
virtual Status endOfLoop(const edm::EventSetup &, unsigned int iLoop)
Called at end of loop.
virtual void beginOfJob()
Called at beginning of job.
float calibCoeff[250]
unsigned int theMaxLoops
int GOLDEN_ELECTRONS_IN_ENDCAP
TH1F * h_ESCEtrue_[25]
TH1F * h1_occupancyVsEtaGold_
TH1F * h1_eventsAfterBorderSelection_
edm::InputTag hlTriggerResults_
void fillMCmap(const std::vector< const reco::GsfElectron * > *electronCollection, const std::vector< HepMC::GenParticle * > &mcEle, std::map< HepMC::GenParticle *, const reco::GsfElectron * > &myMCmap)
TH1F * h1_reco_ZMassGood_
TH1F * h1_occupancyEndcap_
virtual Status duringLoop(const edm::Event &, const edm::EventSetup &)
Called at each event.
TH1F * h1_occupancyVsEtaShower_
TH1F * h_eleEffPhi[2]
TH1F * h1_eventsBeforeBorderSelection_
TH1F * h1_electronCosTheta_SC_
double fEtaEndcapBad(double scEta) const
TH1F * h1_reco_ZMassCorr_
int GOLDEN_ELECTRONS_IN_BARREL
bool aTriggerResults[200]
TH2F * h2_coeffVsEtaGrouped_
unsigned int nWasRun_
TH1F * h1_occupancyVsEta_
std::string endcapfile_
std::string rechitCollection_
TH1F * h1_occupancyBarrel_
TH2F * h2_miscalRecalEE_
float EvalDR(float Eta, float Eta_ref, float Phi, float Phi_ref)
unsigned int nAccept_
TH1F * h1_electronCosTheta_TK_
~ZeeCalibration()
Destructor.
TH2F * h_ESCcorrEtrueVsEta_[25]
TH2F * h2_fEtaEndcapBad_
TH1F * h_eleEffPt[2]
std::string rechitProducer_
int ringNumberCorrector(int k)
std::string scIslandProducer_
int SILVER_ELECTRONS_IN_BARREL
double sigmaArray[50]
int TOTAL_ELECTRONS_IN_ENDCAP
int BARREL_ELECTRONS_BEFORE_BORDER_CUT
int SHOWER_ELECTRONS_IN_ENDCAP
TString aNames[200]
std::string scProducer_
TH1F * h1_reco_ZMassBad_
std::string erechitProducer_
TH1F * h1_mcEBParz_[25]
std::vector< std::string > hlNames_
ZIterativeAlgorithmWithFit * theAlgorithm_
ZeeRescaleFactorPlots * myZeeRescaleFactorPlots_
TH1F * h1_elePhiResol_
unsigned int electronSelection_
bool xtalIsOnModuleBorder(EBDetId myEBDetId)
TH1F * h1_eleEtaResol_
TH2F * h2_xtalRecalibCoeffBarrel_[25]
float EvalDPhi(float Phi, float Phi_ref)
TH1F * h1_eventsAfterEWKSelection_
TH1F * h1_preshowerOverSC_
TH1F * h1_electronCosTheta_SC_TK_
double coefficientDistanceAtIteration[50]
TH1F * h_eleEffPt_[2]
int k[5][pyjets_maxn]
TH2F * h2_zMassDiffVsLoop_
std::string scCollection_
TH1F * h1_mcParz_[25]
void fillMCInfo(HepMC::GenParticle *mcele)
#define nMaxChannels
ZeePlots * myZeePlots_
unsigned int nEvents_
unsigned int etaBins_
edm::ParameterSet theParameterSet
TH2F * h2_miscalRecalEB_
std::vector< unsigned int > hlErrors_
TH1F * h_ESCcorrEtrue_[25]
std::pair< DetId, double > getHottestDetId(const std::vector< std::pair< DetId, float > > &mySCRecHits, const EBRecHitCollection *ebhits, const EERecHitCollection *eehits)
double loopArray[50]
TH2F * h2_xtalMiscalibCoeffEndcapPlus_
double b
Definition: hdecay.h:120
TH1F * h1_occupancyVsEtaCrack_
std::vector< unsigned int > hlAccept_
float initCalibCoeff[250]
int SILVER_ELECTRONS_IN_ENDCAP
std::string mcProducer_
TH1F * h1_reco_ZMassCorrBB_
virtual std::shared_ptr< EcalIntercalibConstants > produceEcalIntercalibConstants(const EcalIntercalibConstantsRcd &iRecord)
Produce Ecal interCalibrations.
virtual void startingNewLoop(unsigned int iLoop)
Called at beginning of loop.
TH1F * h1_reco_ZMassCorrEE_
double a
Definition: hdecay.h:121
TH2F * h2_xtalMiscalibCoeffBarrel_
TH2F * h2_chi2_[25]
TH2F * h2_coeffVsLoop_
void fillEleInfo(std::vector< HepMC::GenParticle * > &a, std::map< HepMC::GenParticle *, const reco::GsfElectron * > &b)
std::string barrelfile_
TH1F * h1_weightSumMeanBarrel_
double fEtaBarrelGood(double scEta) const
TH2F * h_ESCEtrueVsEta_[25]
TH2F * h2_zMassVsLoop_
TH2F * h2_iterations_[25]
ZeeCalibration(const edm::ParameterSet &iConfig)
Constructor.
char aTriggerNames[200][30]
float NewCalibCoeff[250]
float calibCoeffError[250]
TH2F * h2_xtalRecalibCoeffEndcapPlus_[25]
int CRACK_ELECTRONS_IN_ENDCAP
int CRACK_ELECTRONS_IN_BARREL
TH2F * h2_fEtaEndcapGood_
TH2F * h2_xtalRecalibCoeffEndcapMinus_[25]
std::vector< unsigned int > hlWasRun_
std::string electronProducer_
double getEtaCorrection(const reco::GsfElectron *)
bool aHLTResults[200]
TH2F * h2_fEtaBarrelGood_
std::string erechitCollection_
TH1F * h_eleEffEta_[2]
TH1F * h1_borderElectronClassification_
TH2F * h2_xtalMiscalibCoeffEndcapMinus_
TH2F * h2_zWidthVsLoop_
TH1F * h1_occupancyVsEtaSilver_
double sigmaErrorArray[50]
TH2F * h2_residualSigma_
int SHOWER_ELECTRONS_IN_BARREL
TH1F * h_eleEffEta[2]
int TOTAL_ELECTRONS_IN_BARREL
TH1F * h1_weightSumMeanEndcap_
std::shared_ptr< EcalIntercalibConstants > ical