00001 #ifndef RecoEcal_EgammaClusterProducers_EnergyScaleAnalyzer_h 00002 #define RecoEcal_EgammaClusterProducers_EnergyScaleAnalyzer_h 00003 00010 // 00011 // $Id: EnergyScaleAnalyzer.h,v 1.1 2008/04/02 12:35:58 kkaadze Exp $ 00012 // 00013 00014 00015 // system include files 00016 #include <memory> 00017 00018 // user include files 00019 #include "FWCore/Framework/interface/Frameworkfwd.h" 00020 #include "FWCore/Framework/interface/EDAnalyzer.h" 00021 00022 #include "FWCore/Framework/interface/Event.h" 00023 #include "FWCore/Framework/interface/MakerMacros.h" 00024 #include "FWCore/Framework/interface/EventSetup.h" 00025 #include "FWCore/Framework/interface/ESHandle.h" 00026 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00027 00028 #include "DataFormats/EgammaReco/interface/BasicCluster.h" 00029 #include "DataFormats/EgammaReco/interface/SuperCluster.h" 00030 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" 00031 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" 00032 #include "DataFormats/EcalDetId/interface/EBDetId.h" 00033 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" 00034 #include "DataFormats/EgammaReco/interface/PreshowerCluster.h" 00035 #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h" 00036 00037 #include <string> 00038 #include "TH1.h" 00039 #include "TH2.h" 00040 #include "TTree.h" 00041 #include "TNtuple.h" 00042 class TFile; 00043 00044 // 00045 // class declaration 00046 // 00047 00048 class EnergyScaleAnalyzer : public edm::EDAnalyzer { 00049 public: 00050 explicit EnergyScaleAnalyzer( const edm::ParameterSet& ); 00051 ~EnergyScaleAnalyzer(); 00052 00053 00054 virtual void analyze( const edm::Event&, const edm::EventSetup& ); 00055 virtual void beginJob(edm::EventSetup const&); 00056 virtual void endJob(); 00057 00058 00059 private: 00060 00061 std::string outputFile_; // output file 00062 00063 std::string hepMCLabel_; 00064 00065 // root file to store histograms 00066 TFile* rootFile_; 00067 00068 //Tree 00069 TTree* mytree_; 00070 struct tree_structure_ { 00071 // MC information 00072 int mc_npar; 00073 int parID; 00074 float mc_sep; 00075 float mc_e; 00076 float mc_et; 00077 float mc_phi; 00078 float mc_eta; 00079 float mc_theta; 00080 00081 // MC-EM matching info 00082 float em_dR; 00083 00084 // EM SC info (uncorrected) 00085 int em_isInCrack; 00086 int em_scType; 00087 float em_e; 00088 float em_et; 00089 float em_phi; 00090 float em_eta; 00091 float em_theta; 00092 int em_nCell; 00093 int em_nBC; 00094 00095 // physics variables 00096 float em_pet; 00097 float em_pe; 00098 float em_peta; 00099 float em_ptheta; 00100 00101 // corrected collectin 00102 float emCorr_e; 00103 float emCorr_et; 00104 float emCorr_eta; 00105 float emCorr_phi; 00106 float emCorr_theta; 00107 float emCorr_pet; 00108 float emCorr_peta; 00109 float emCorr_ptheta; 00110 00111 // EM widths, pw -- phiWidth, ew -- etaWidth 00112 float em_pw; 00113 float em_ew; 00114 // ratios of widths pw/ew 00115 float em_br; 00116 }; 00117 tree_structure_ tree_; 00118 00119 // 00120 float xVtx_; 00121 float yVtx_; 00122 float zVtx_; 00123 // 00124 float xClust_zero_; 00125 float yClust_zero_; 00126 float zClust_zero_; 00127 // 00128 float xClust_vtx_; 00129 float yClust_vtx_; 00130 float zClust_vtx_; 00131 // 00132 float rClust_vtx_; 00133 // 00134 float energyMax_; 00135 float eTMax_; 00136 float eTMaxVtx_; 00137 float etaMax_; 00138 float etaMaxVtx_; 00139 float phiMax_; 00140 float phiMaxVtx_; 00141 float thetaMax_; 00142 float thetaMaxVtx_; 00143 // 00144 00145 int evtN; 00146 00147 //Function 00148 void fillTree ( const reco::SuperClusterCollection* scColl, const reco::SuperClusterCollection* corrSCColl, 00149 HepMC::GenParticle* mc, tree_structure_& tree_, float xV, float yV, float zV, int scType); 00150 }; 00151 #endif 00152