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 // system include files
21 #include <memory>
22 #include <vector>
23 #include <map>
24 #include <string>
25 
26 // user include files
34 
37 
40 
43 
47 
50 
51 #include "TTree.h"
52 #include "TFile.h"
53 #include "TGraph.h"
54 #include "TGraphErrors.h"
55 #include "TH1.h"
56 #include "TH2.h"
57 
64 
65 // class declaration
66 //
67 
69 public:
71  ZeeCalibration(const edm::ParameterSet& iConfig);
72 
74  ~ZeeCalibration() override;
75 
77  virtual void produce(edm::Event&, const edm::EventSetup&){};
78 
80  void beginOfJob() override;
81 
83  void endOfJob() override;
84 
86  void startingNewLoop(unsigned int iLoop) override;
87 
89  Status endOfLoop(const edm::EventSetup&, unsigned int iLoop) override;
90 
92  Status duringLoop(const edm::Event&, const edm::EventSetup&) override;
93 
95  virtual std::shared_ptr<EcalIntercalibConstants> produceEcalIntercalibConstants(
96  const EcalIntercalibConstantsRcd& iRecord);
97 
98 private:
99  /* ElectronEnergyCorrector myCorrector; */
100  /* ElectronClassification myClassificator; */
101 
102  double fEtaBarrelBad(double scEta) const;
103  double fEtaBarrelGood(double scEta) const;
104  double fEtaEndcapBad(double scEta) const;
105  double fEtaEndcapGood(double scEta) const;
106 
107  int ringNumberCorrector(int k);
108  double getEtaCorrection(const reco::GsfElectron*);
109 
110  void fillEleInfo(std::vector<HepMC::GenParticle*>& a, std::map<HepMC::GenParticle*, const reco::GsfElectron*>& b);
111  void fillMCInfo(HepMC::GenParticle* mcele);
112 
113  void fillMCmap(const std::vector<const reco::GsfElectron*>* electronCollection,
114  const std::vector<HepMC::GenParticle*>& mcEle,
115  std::map<HepMC::GenParticle*, const reco::GsfElectron*>& myMCmap);
116  // void fillMCmap(const reco::ElectronCollection* electronCollection, const std::vector<HepMC::GenParticle*>& mcEle,std::map<HepMC::GenParticle*,const reco::Electron*>& myMCmap);
117 
118  float EvalDPhi(float Phi, float Phi_ref);
119  float EvalDR(float Eta, float Eta_ref, float Phi, float Phi_ref);
120 
121  void bookHistograms();
122 
123  void resetVariables();
124 
125  void resetHistograms();
126 
127  void printStatistics();
128 
129  std::pair<DetId, double> getHottestDetId(const std::vector<std::pair<DetId, float> >& mySCRecHits,
130  const EBRecHitCollection* ebhits,
131  const EERecHitCollection* eehits);
132 
133  bool xtalIsOnModuleBorder(EBDetId myEBDetId);
134 
135  float computeCoefficientDistanceAtIteration(float v1[250], float v2[250], int size);
136 
137  // float Calculate_SigmaEtaEta(const reco::SuperCluster &passedCluster);
138 
139  // ----------member data ---------------------------
140 
141  TTree* myTree;
142 
144 
146 
154 
157 
160 
162 
170 
172 
173  unsigned int etaBins_;
174  unsigned int etBins_;
175 
176  double etaMin_;
177  double etMin_;
178  double etaMax_;
179  double etMax_;
180 
183 
186  double mass;
187 
188  float mass4tree;
190 
192 
194 
199 
200  std::shared_ptr<EcalIntercalibConstants> ical;
201 
203 
206 
207  // steering parameters
208 
210 
211  // TGraph* graph;
212 
215 
218 
225 
226  TH1F* h_eleEffEta[2];
227  TH1F* h_eleEffPhi[2];
228  TH1F* h_eleEffPt[2];
229 
232 
237 
244  TH1F* h1_RMin_;
245  TH1F* h1_RMinZ_;
247 
250 
251  TH1F* h_eleEffEta_[2];
252  TH1F* h_eleEffPhi_[2];
253  TH1F* h_eleEffPt_[2];
254  TH1F* h_ESCEtrue_[25];
255  TH2F* h_ESCEtrueVsEta_[25];
256 
257  TH1F* h_ESCcorrEtrue_[25];
259 
266 
268  // TH2F* h2_miscalRecalParz_[25];
269  TH1F* h1_mc_;
270  TH1F* h1_mcParz_[25];
271  /*
272  TH1F* h_DiffZMassDistr_[25];
273  TH1F* h_ZMassDistr_[25];
274  */
277  //TH2F* h2_miscalRecalEBParz_[25];
278  TH1F* h1_mcEB_;
279  TH1F* h1_mcEBParz_[25];
281  //TH2F* h2_miscalRecalEEParz_[25];
282  TH1F* h1_mcEE_;
283  TH1F* h1_mcEEParz_[25];
284 
285  TH2F* h2_chi2_[25];
286  TH2F* h2_iterations_[25];
287 
291 
295 
298 
307 
311 
313 
315  Int_t NEVT, MCZBB, MCZEB, MCZEE;
316 
317  TFile* outputFile_;
318 
319  unsigned int theMaxLoops; // Number of loops to loop
320 
322 
323  unsigned int electronSelection_;
324 
325  double loopArray[50];
326  double sigmaArray[50];
327  double sigmaErrorArray[50];
329 
332 
335 
338 
341 
344 
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 #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)
TH2F * h2_fEtaBarrelBad_
TH1F * h1_mcEEParz_[25]
const edm::EDGetTokenT< edm::HepMCProduct > hepMCToken_
std::string calibMode_
std::string outputFileName_
const std::string electronCollection_
const std::string electronProducer_
TH1F * h_eleEffPhi_[2]
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
int BARREL_ELECTRONS_AFTER_BORDER_CUT
void fillEleInfo(std::vector< HepMC::GenParticle *> &a, std::map< HepMC::GenParticle *, const reco::GsfElectron *> &b)
TH2F * h2_miscalRecal_
TH1F * h1_eventsBeforeEWKSelection_
unsigned int nErrors_
float computeCoefficientDistanceAtIteration(float v1[250], float v2[250], int size)
float calibCoeff[250]
const edm::EDGetTokenT< EERecHitCollection > eeRecHitToken_
unsigned int theMaxLoops
int GOLDEN_ELECTRONS_IN_ENDCAP
TH1F * h_ESCEtrue_[25]
TH1F * h1_occupancyVsEtaGold_
TH1F * h1_eventsAfterBorderSelection_
const std::string erechitProducer_
TH1F * h1_reco_ZMassGood_
TH1F * h1_occupancyEndcap_
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
Called at each event.
TH1F * h1_occupancyVsEtaShower_
TH1F * h_eleEffPhi[2]
TH1F * h1_eventsBeforeBorderSelection_
TH1F * h1_electronCosTheta_SC_
TH1F * h1_reco_ZMassCorr_
int GOLDEN_ELECTRONS_IN_BARREL
const edm::InputTag hlTriggerResults_
bool aTriggerResults[200]
TH2F * h2_coeffVsEtaGrouped_
unsigned int nWasRun_
TH1F * h1_occupancyVsEta_
std::string endcapfile_
TH1F * h1_occupancyBarrel_
~ZeeCalibration() override
Destructor.
TH2F * h2_miscalRecalEE_
const edm::EDGetTokenT< edm::TriggerResults > trigResultsToken_
float EvalDR(float Eta, float Eta_ref, float Phi, float Phi_ref)
unsigned int nAccept_
TH1F * h1_electronCosTheta_TK_
const std::string erechitCollection_
TH2F * h_ESCcorrEtrueVsEta_[25]
TH2F * h2_fEtaEndcapBad_
TH1F * h_eleEffPt[2]
const std::string scIslandCollection_
int ringNumberCorrector(int k)
int SILVER_ELECTRONS_IN_BARREL
void beginOfJob() override
Called at beginning of job.
double sigmaArray[50]
int TOTAL_ELECTRONS_IN_ENDCAP
int BARREL_ELECTRONS_BEFORE_BORDER_CUT
int SHOWER_ELECTRONS_IN_ENDCAP
TString aNames[200]
TH1F * h1_reco_ZMassBad_
const std::string scProducer_
TH1F * h1_mcEBParz_[25]
std::vector< std::string > hlNames_
ZIterativeAlgorithmWithFit * theAlgorithm_
const edm::EDGetTokenT< reco::SuperClusterCollection > islandSCToken_
ZeeRescaleFactorPlots * myZeeRescaleFactorPlots_
TH1F * h1_elePhiResol_
unsigned int electronSelection_
bool xtalIsOnModuleBorder(EBDetId myEBDetId)
TH1F * h1_eleEtaResol_
TH2F * h2_xtalRecalibCoeffBarrel_[25]
const std::string scCollection_
float EvalDPhi(float Phi, float Phi_ref)
TH1F * h1_eventsAfterEWKSelection_
TH1F * h1_preshowerOverSC_
const std::string rechitCollection_
TH1F * h1_electronCosTheta_SC_TK_
double coefficientDistanceAtIteration[50]
double fEtaBarrelBad(double scEta) const
void fillMCmap(const std::vector< const reco::GsfElectron *> *electronCollection, const std::vector< HepMC::GenParticle *> &mcEle, std::map< HepMC::GenParticle *, const reco::GsfElectron *> &myMCmap)
TH1F * h_eleEffPt_[2]
TH2F * h2_zMassDiffVsLoop_
void startingNewLoop(unsigned int iLoop) override
Called at beginning of loop.
TH1F * h1_mcParz_[25]
const edm::EDGetTokenT< reco::SuperClusterCollection > scToken_
void fillMCInfo(HepMC::GenParticle *mcele)
#define nMaxChannels
ZeePlots * myZeePlots_
double fEtaEndcapGood(double scEta) const
unsigned int nEvents_
unsigned int etaBins_
edm::ParameterSet theParameterSet
double fEtaBarrelGood(double scEta) const
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_
const std::string scIslandProducer_
const edm::EDGetTokenT< EBRecHitCollection > ebRecHitToken_
Status endOfLoop(const edm::EventSetup &, unsigned int iLoop) override
Called at end of loop.
const std::string mcProducer_
float initCalibCoeff[250]
int SILVER_ELECTRONS_IN_ENDCAP
TH1F * h1_reco_ZMassCorrBB_
const edm::EDGetTokenT< reco::GsfElectronCollection > gsfElectronToken_
virtual std::shared_ptr< EcalIntercalibConstants > produceEcalIntercalibConstants(const EcalIntercalibConstantsRcd &iRecord)
Produce Ecal interCalibrations.
TH1F * h1_reco_ZMassCorrEE_
double a
Definition: hdecay.h:121
TH2F * h2_xtalMiscalibCoeffBarrel_
TH2F * h2_chi2_[25]
TH2F * h2_coeffVsLoop_
std::string barrelfile_
TH1F * h1_weightSumMeanBarrel_
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
double fEtaEndcapBad(double scEta) const
TH2F * h2_fEtaEndcapGood_
TH2F * h2_xtalRecalibCoeffEndcapMinus_[25]
std::vector< unsigned int > hlWasRun_
double getEtaCorrection(const reco::GsfElectron *)
const std::string rechitProducer_
bool aHLTResults[200]
TH2F * h2_fEtaBarrelGood_
TH1F * h_eleEffEta_[2]
TH1F * h1_borderElectronClassification_
TH2F * h2_xtalMiscalibCoeffEndcapMinus_
TH2F * h2_zWidthVsLoop_
void endOfJob() override
Called at end of job.
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