File indexing completed on 2024-04-06 11:58:39
0001 #ifndef CALIBRATION_ECALCALIBALGOS_ELECTRONCALIBRATIONUNIV
0002 #define CALIBRATION_ECALCALIBALGOS_ELECTRONCALIBRATIONUNIV
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include <memory>
0024
0025
0026 #include "FWCore/Framework/interface/Frameworkfwd.h"
0027 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0028
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030
0031
0032 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0033 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0034 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0035 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0036
0037 #include "FWCore/Framework/interface/Event.h"
0038 #include "FWCore/Framework/interface/MakerMacros.h"
0039 #include "FWCore/Framework/interface/EventSetup.h"
0040 #include "FWCore/Framework/interface/ESHandle.h"
0041 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0042 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0043 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0044 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0045 #include "Calibration/Tools/interface/HouseholderDecomposition.h"
0046 #include "Calibration/Tools/interface/MinL3Algorithm.h"
0047 #include "Calibration/Tools/interface/CalibrationCluster.h"
0048 #include "DataFormats/DetId/interface/DetId.h"
0049 #include "TFile.h"
0050 #include "TH1.h"
0051 #include "TH2.h"
0052
0053 #include "Calibration/Tools/interface/MinL3AlgoUniv.h"
0054
0055
0056
0057
0058 class ElectronCalibrationUniv : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0059 public:
0060 explicit ElectronCalibrationUniv(const edm::ParameterSet &);
0061 ~ElectronCalibrationUniv() override;
0062
0063 void analyze(const edm::Event &, const edm::EventSetup &) override;
0064 void beginJob() override;
0065 void beginRun(edm::Run const &, edm::EventSetup const &) override;
0066 void endRun(edm::Run const &, edm::EventSetup const &) override;
0067 void endJob() override;
0068
0069 private:
0070 DetId findMaxHit(const std::vector<DetId> &v1, const EBRecHitCollection *EBhits, const EERecHitCollection *EEhits);
0071 bool TestEEvalidDetId(int crystal_ix, int crystal_iy, int iz);
0072
0073
0074
0075 const edm::InputTag ebRecHitLabel_;
0076 const edm::InputTag eeRecHitLabel_;
0077 const edm::InputTag electronLabel_;
0078 const std::string rootfile_;
0079 const std::string calibAlgo_;
0080 const std::string miscalibfile_;
0081 const std::string miscalibfileEndCap_;
0082 const int keventweight_;
0083 const double elePt_;
0084 const int maxeta_;
0085 const int mineta_;
0086 const int maxphi_;
0087 const int minphi_;
0088 const double cut1_;
0089 const double cut2_;
0090 const double cut3_;
0091 const int numevent_;
0092 const double cutEPCalo1_;
0093 const double cutEPCalo2_;
0094 const double cutEPin1_;
0095 const double cutEPin2_;
0096 const double cutCalo1_;
0097 const double cutCalo2_;
0098 const double cutESeed_;
0099 const int clusterSize_;
0100 const int elecclass_;
0101
0102 int read_events;
0103
0104 int calibClusterSize, keventweight;
0105 int etaMin, etaMax, phiMin, phiMax;
0106 std::vector<float> EnergyVector;
0107 std::vector<float> WeightVector;
0108 std::vector<std::vector<float> > EventMatrix;
0109 std::vector<int> MaxCCeta;
0110 std::vector<int> MaxCCphi;
0111 std::vector<float> EnergyVectorNoCuts;
0112 std::vector<float> WeightVectorNoCuts;
0113 std::vector<std::vector<float> > EventMatrixNoCuts;
0114 std::vector<int> MaxCCetaNoCuts;
0115 std::vector<int> MaxCCphiNoCuts;
0116 MinL3Algorithm *MyL3Algo1;
0117 MinL3AlgoUniv<DetId> *UnivL3;
0118
0119 const edm::EDGetTokenT<EBRecHitCollection> ebRecHitToken_;
0120 const edm::EDGetTokenT<EERecHitCollection> eeRecHitToken_;
0121 const edm::EDGetTokenT<reco::GsfElectronCollection> gsfElectronToken_;
0122 const edm::ESGetToken<CaloTopology, CaloTopologyRecord> topologyToken_;
0123 const CaloTopology *theCaloTopology_;
0124
0125 std::vector<float> solution;
0126 std::vector<float> solutionNoCuts;
0127
0128
0129 std::vector<std::vector<DetId> > UnivEventIds;
0130 std::map<DetId, float> Univsolution;
0131
0132
0133
0134 TFile *f;
0135
0136 TH1F *EventsAfterCuts;
0137
0138 TH1F *e25;
0139 TH1F *e9;
0140 TH1F *scE;
0141 TH1F *trP;
0142 TH1F *EoP;
0143 TH1F *EoP_all;
0144 TH1F *calibs;
0145 TH1F *calibsEndCapMinus;
0146 TH1F *calibsEndCapPlus;
0147 TH1F *e9Overe25;
0148 TH1F *e25OverScE;
0149 TH2F *Map;
0150 TH1F *E25oP;
0151
0152 TH1F *PinOverPout;
0153 TH1F *eSeedOverPout;
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166 TH1F *e25NoCuts;
0167 TH1F *e9NoCuts;
0168 TH1F *scENoCuts;
0169 TH1F *trPNoCuts;
0170 TH1F *EoPNoCuts;
0171 TH1F *calibsNoCuts;
0172 TH1F *e9Overe25NoCuts;
0173 TH1F *e25OverScENoCuts;
0174 TH2F *MapEndCapMinus;
0175 TH2F *MapEndCapPlus;
0176 TH1F *E25oPNoCuts;
0177 TH2F *Map3Dcalib;
0178 TH2F *Map3DcalibEndCapMinus;
0179 TH2F *Map3DcalibEndCapPlus;
0180 TH2F *Map3DcalibNoCuts;
0181 TH1F *calibinter;
0182 TH1F *calibinterEndCapMinus;
0183 TH1F *calibinterEndCapPlus;
0184 TH1F *calibinterNoCuts;
0185 HouseholderDecomposition *MyHH;
0186 TH1F *PinOverPoutNoCuts;
0187 TH1F *eSeedOverPoutNoCuts;
0188
0189 TH2F *GeneralMap;
0190 TH2F *GeneralMapEndCapMinus;
0191 TH2F *GeneralMapEndCapPlus;
0192 TH2F *GeneralMapBeforePt;
0193 TH2F *GeneralMapEndCapMinusBeforePt;
0194 TH2F *GeneralMapEndCapPlusBeforePt;
0195
0196 TH2F *MapCor1;
0197 TH2F *MapCor2;
0198 TH2F *MapCor3;
0199 TH2F *MapCor4;
0200 TH2F *MapCor5;
0201 TH2F *MapCor6;
0202 TH2F *MapCor7;
0203 TH2F *MapCor8;
0204 TH2F *MapCor9;
0205 TH2F *MapCor10;
0206 TH2F *MapCor11;
0207
0208
0209 TH2F *MapCor1NoCuts;
0210 TH2F *MapCor2NoCuts;
0211 TH2F *MapCor3NoCuts;
0212 TH2F *MapCor4NoCuts;
0213 TH2F *MapCor5NoCuts;
0214 TH2F *MapCor6NoCuts;
0215 TH2F *MapCor7NoCuts;
0216 TH2F *MapCor8NoCuts;
0217 TH2F *MapCor9NoCuts;
0218 TH2F *MapCor10NoCuts;
0219 TH2F *MapCor11NoCuts;
0220
0221
0222
0223 TH2F *MapCor1ESeed;
0224 TH2F *MapCor2ESeed;
0225 TH2F *MapCor3ESeed;
0226 TH2F *MapCor4ESeed;
0227 TH2F *MapCor5ESeed;
0228 TH2F *MapCor6ESeed;
0229 TH2F *MapCor7ESeed;
0230 TH2F *MapCor8ESeed;
0231 TH2F *MapCor9ESeed;
0232 TH2F *MapCor10ESeed;
0233 TH2F *MapCor11ESeed;
0234
0235 TH2F *E25oPvsEta;
0236 TH2F *E25oPvsEtaEndCapMinus;
0237 TH2F *E25oPvsEtaEndCapPlus;
0238
0239 TH1F *PinMinPout;
0240 TH1F *PinMinPoutNoCuts;
0241
0242 TH1F *Error1;
0243 TH1F *Error2;
0244 TH1F *Error3;
0245 TH1F *Error1NoCuts;
0246 TH1F *Error2NoCuts;
0247 TH1F *Error3NoCuts;
0248
0249 TH1F *eSeedOverPout2;
0250 TH1F *eSeedOverPout2NoCuts;
0251 TH1F *eSeedOverPout2ESeed;
0252
0253 TH1F *hadOverEm;
0254 TH1F *hadOverEmNoCuts;
0255 TH1F *hadOverEmESeed;
0256 };
0257 #endif