File indexing completed on 2024-04-06 12:32:01
0001 #ifndef RecoEcal_EgammaClusterProducers_EnergyScaleAnalyzer_h
0002 #define RecoEcal_EgammaClusterProducers_EnergyScaleAnalyzer_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <memory>
0016
0017
0018 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0019 #include "FWCore/Framework/interface/Frameworkfwd.h"
0020
0021 #include "FWCore/Framework/interface/ESHandle.h"
0022 #include "FWCore/Framework/interface/Event.h"
0023 #include "FWCore/Framework/interface/EventSetup.h"
0024 #include "FWCore/Framework/interface/MakerMacros.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026
0027 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0028 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0029 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0030 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0031 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
0032 #include "DataFormats/EgammaReco/interface/PreshowerCluster.h"
0033 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0034 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0035 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0036
0037 #include "TH1.h"
0038 #include "TH2.h"
0039 #include "TNtuple.h"
0040 #include "TTree.h"
0041 #include <string>
0042 class TFile;
0043
0044
0045
0046
0047
0048 class EnergyScaleAnalyzer : public edm::one::EDAnalyzer<> {
0049 public:
0050 explicit EnergyScaleAnalyzer(const edm::ParameterSet &);
0051 ~EnergyScaleAnalyzer() override;
0052
0053 void analyze(const edm::Event &, const edm::EventSetup &) override;
0054 void beginJob() override;
0055 void endJob() override;
0056
0057 private:
0058 std::string outputFile_;
0059
0060 edm::EDGetTokenT<edm::HepMCProduct> hepMCLabel_;
0061 edm::EDGetTokenT<reco::SuperClusterCollection> hybridSuperClusters_token;
0062 edm::EDGetTokenT<reco::SuperClusterCollection> dynamicHybridSuperClusters_token;
0063 edm::EDGetTokenT<reco::SuperClusterCollection> correctedHybridSuperClusters_token;
0064 edm::EDGetTokenT<reco::SuperClusterCollection> correctedDynamicHybridSuperClusters_token;
0065 edm::EDGetTokenT<reco::SuperClusterCollection> correctedFixedMatrixSuperClustersWithPreshower_token;
0066 edm::EDGetTokenT<reco::SuperClusterCollection> fixedMatrixSuperClustersWithPreshower_token;
0067
0068
0069 TFile *rootFile_;
0070
0071
0072 TTree *mytree_;
0073 struct tree_structure_ {
0074
0075 int mc_npar;
0076 int parID;
0077 float mc_sep;
0078 float mc_e;
0079 float mc_et;
0080 float mc_phi;
0081 float mc_eta;
0082 float mc_theta;
0083
0084
0085 float em_dR;
0086
0087
0088 int em_isInCrack;
0089 int em_scType;
0090 float em_e;
0091 float em_et;
0092 float em_phi;
0093 float em_eta;
0094 float em_theta;
0095 int em_nCell;
0096 int em_nBC;
0097
0098
0099 float em_pet;
0100 float em_pe;
0101 float em_peta;
0102 float em_ptheta;
0103
0104
0105 float emCorr_e;
0106 float emCorr_et;
0107 float emCorr_eta;
0108 float emCorr_phi;
0109 float emCorr_theta;
0110 float emCorr_pet;
0111 float emCorr_peta;
0112 float emCorr_ptheta;
0113
0114
0115 float em_pw;
0116 float em_ew;
0117
0118 float em_br;
0119 };
0120 tree_structure_ tree_;
0121
0122
0123 float xVtx_;
0124 float yVtx_;
0125 float zVtx_;
0126
0127 float xClust_zero_;
0128 float yClust_zero_;
0129 float zClust_zero_;
0130
0131 float xClust_vtx_;
0132 float yClust_vtx_;
0133 float zClust_vtx_;
0134
0135 float rClust_vtx_;
0136
0137 float energyMax_;
0138 float eTMax_;
0139 float eTMaxVtx_;
0140 float etaMax_;
0141 float etaMaxVtx_;
0142 float phiMax_;
0143 float phiMaxVtx_;
0144 float thetaMax_;
0145 float thetaMaxVtx_;
0146
0147
0148 int evtN;
0149
0150
0151 void fillTree(const reco::SuperClusterCollection *scColl,
0152 const reco::SuperClusterCollection *corrSCColl,
0153 HepMC::GenParticle *mc,
0154 tree_structure_ &tree_,
0155 float xV,
0156 float yV,
0157 float zV,
0158 int scType);
0159 };
0160 #endif