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