Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:39

0001 #ifndef CALIBRATION_ECALCALIBALGOS_ELECTRONCALIBRATION
0002 #define CALIBRATION_ECALCALIBALGOS_ELECTRONCALIBRATION
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:    ElectronCalibration
0007 // Class:      ElectronCalibration
0008 //
0009 /**\class ElectronCalibration ElectronCalibration.cc Calibration/EcalCalibAlgos/src/ElectronCalibration.cc
0010 
0011  Description: Perform single electron calibration (tested on TB data only).
0012 
0013  Implementation:
0014      <Notes on implementation>
0015 */
0016 //
0017 // Original Author:  Lorenzo AGOSTINO, Radek Ofierzynski
0018 //         Created:  Tue Jul 18 12:17:01 CEST 2006
0019 //
0020 //
0021 
0022 // system include files
0023 #include <memory>
0024 
0025 // user include files
0026 #include "FWCore/Framework/interface/Frameworkfwd.h"
0027 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0028 
0029 #include "FWCore/Framework/interface/Event.h"
0030 #include "FWCore/Framework/interface/MakerMacros.h"
0031 #include "FWCore/Framework/interface/EventSetup.h"
0032 #include "FWCore/Framework/interface/ESHandle.h"
0033 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0034 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0035 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0036 #include "Calibration/Tools/interface/HouseholderDecomposition.h"
0037 #include "Calibration/Tools/interface/MinL3Algorithm.h"
0038 #include "Calibration/Tools/interface/CalibrationCluster.h"
0039 #include "DataFormats/DetId/interface/DetId.h"
0040 #include "TFile.h"
0041 #include "TH1.h"
0042 #include "TH2.h"
0043 
0044 // class declaration
0045 
0046 class ElectronCalibration : public edm::one::EDAnalyzer<> {
0047 public:
0048   explicit ElectronCalibration(const edm::ParameterSet&);
0049   ~ElectronCalibration() override;
0050 
0051   void analyze(const edm::Event&, const edm::EventSetup&) override;
0052   void beginJob() override;
0053   void endJob() override;
0054 
0055 private:
0056   EBDetId findMaxHit(edm::Handle<EBRecHitCollection>&);
0057   EBDetId findMaxHit2(const std::vector<DetId>&, const EBRecHitCollection*);
0058 
0059   // ----------member data ---------------------------
0060   std::string rootfile_;
0061   edm::EDGetTokenT<EBRecHitCollection> recHitToken_;
0062   edm::EDGetTokenT<reco::GsfElectronCollection> electronToken_;
0063   edm::InputTag trackLabel_;
0064   std::string calibAlgo_;
0065   std::string miscalibfile_;
0066   int keventweight_;
0067   double ElePt_;
0068   int maxeta_;
0069   int mineta_;
0070   int maxphi_;
0071   int minphi_;
0072   double cut1_;
0073   double cut2_;
0074   double cut3_;
0075   int elecclass_;
0076   double cutEPCalo1_;
0077   double cutEPCalo2_;
0078   double cutEPin1_;
0079   double cutEPin2_;
0080   double cutCalo1_;
0081   double cutCalo2_;
0082   double cutESeed_;
0083   int ClusterSize_;
0084 
0085   CalibrationCluster calibCluster;
0086   CalibrationCluster::CalibMap ReducedMap;
0087 
0088   int read_events;
0089 
0090   int calibClusterSize, keventweight;
0091   int etaMin, etaMax, phiMin, phiMax;
0092   std::vector<float> EnergyVector;
0093   std::vector<float> WeightVector;
0094   std::vector<std::vector<float> > EventMatrix;
0095   std::vector<int> MaxCCeta;
0096   std::vector<int> MaxCCphi;
0097   std::vector<float> EnergyVectorNoCuts;
0098   std::vector<float> WeightVectorNoCuts;
0099   std::vector<std::vector<float> > EventMatrixNoCuts;
0100   std::vector<int> MaxCCetaNoCuts;
0101   std::vector<int> MaxCCphiNoCuts;
0102   MinL3Algorithm* MyL3Algo1;
0103   std::vector<float> solution;
0104   std::vector<float> solutionNoCuts;
0105   std::vector<float> newCalibs;
0106   std::vector<float> oldCalibs;
0107 
0108   int eventcrystal[171][360];
0109   int numevent_;
0110 
0111   TFile* f;
0112 
0113   TH1F* e25;
0114   TH1F* e9;
0115   TH1F* scE;
0116   TH1F* trP;
0117   TH1F* EoP;
0118   TH1F* EoP_all;
0119   TH1F* calibs;
0120   TH1F* e9Overe25;
0121   TH1F* e25OverScE;
0122   TH2F* Map;
0123   TH1F* E25oP;
0124 
0125   TH1F* PinOverPout;
0126   TH1F* eSeedOverPout;
0127   TH1F* MisCalibs;
0128   TH1F* RatioCalibs;
0129   TH1F* DiffCalibs;
0130   TH1F* RatioCalibsNoCuts;
0131   TH1F* DiffCalibsNoCuts;
0132 
0133   TH1F* e25NoCuts;
0134   TH1F* e9NoCuts;
0135   TH1F* scENoCuts;
0136   TH1F* trPNoCuts;
0137   TH1F* EoPNoCuts;
0138   TH1F* calibsNoCuts;
0139   TH1F* e9Overe25NoCuts;
0140   TH1F* e25OverScENoCuts;
0141   TH2F* MapNoCuts;
0142   TH1F* E25oPNoCuts;
0143   TH2F* Map3Dcalib;
0144   TH2F* Map3DcalibNoCuts;
0145   TH1F* calibinter;
0146   TH1F* calibinterNoCuts;
0147   HouseholderDecomposition* MyHH;
0148   TH1F* PinOverPoutNoCuts;
0149   TH1F* eSeedOverPoutNoCuts;
0150 
0151   TH2F* GeneralMap;
0152 
0153   TH2F* MapCor1;
0154   TH2F* MapCor2;
0155   TH2F* MapCor3;
0156   TH2F* MapCor4;
0157   TH2F* MapCor5;
0158   TH2F* MapCor6;
0159   TH2F* MapCor7;
0160   TH2F* MapCor8;
0161   TH2F* MapCor9;
0162   TH2F* MapCor10;
0163   TH2F* MapCor11;
0164   TH2F* MapCorCalib;
0165 
0166   TH2F* MapCor1NoCuts;
0167   TH2F* MapCor2NoCuts;
0168   TH2F* MapCor3NoCuts;
0169   TH2F* MapCor4NoCuts;
0170   TH2F* MapCor5NoCuts;
0171   TH2F* MapCor6NoCuts;
0172   TH2F* MapCor7NoCuts;
0173   TH2F* MapCor8NoCuts;
0174   TH2F* MapCor9NoCuts;
0175   TH2F* MapCor10NoCuts;
0176   TH2F* MapCor11NoCuts;
0177   TH2F* MapCorCalibNoCuts;
0178 
0179   TH2F* MapCor1ESeed;
0180   TH2F* MapCor2ESeed;
0181   TH2F* MapCor3ESeed;
0182   TH2F* MapCor4ESeed;
0183   TH2F* MapCor5ESeed;
0184   TH2F* MapCor6ESeed;
0185   TH2F* MapCor7ESeed;
0186   TH2F* MapCor8ESeed;
0187   TH2F* MapCor9ESeed;
0188   TH2F* MapCor10ESeed;
0189   TH2F* MapCor11ESeed;
0190 
0191   TH1F* PinMinPout;
0192   TH1F* PinMinPoutNoCuts;
0193 
0194   TH1F* Error1;
0195   TH1F* Error2;
0196   TH1F* Error3;
0197   TH1F* Error1NoCuts;
0198   TH1F* Error2NoCuts;
0199   TH1F* Error3NoCuts;
0200 
0201   TH1F* eSeedOverPout2;
0202   TH1F* eSeedOverPout2NoCuts;
0203   TH1F* eSeedOverPout2ESeed;
0204 
0205   TH1F* hadOverEm;
0206   TH1F* hadOverEmNoCuts;
0207   TH1F* hadOverEmESeed;
0208 };
0209 #endif