CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.h

Go to the documentation of this file.
00001 #ifndef GsfElectronDataAnalyzer_h
00002 #define GsfElectronDataAnalyzer_h
00003 
00004 //
00005 // Package:         RecoEgamma/Examples
00006 // Class:           GsfElectronDataAnalyzer
00007 //
00008 
00009 //
00010 // Original Author:  Ursula Berthon, Claude Charlot
00011 //         Created:  Mon Mar 27 13:22:06 CEST 2006
00012 // $Id: GsfElectronDataAnalyzer.h,v 1.21 2011/05/20 17:17:28 wmtan Exp $
00013 //
00014 //
00015 
00016 
00017 #include "FWCore/Framework/interface/EDAnalyzer.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 #include "DataFormats/Common/interface/Handle.h"
00020 #include "FWCore/Framework/interface/ESHandle.h"
00021 #include "FWCore/Framework/interface/EventSetup.h"
00022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00023 
00024 
00025 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00026 
00027 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00028 
00029 class MagneticField;
00030 class TFile;
00031 class TH1F;
00032 class TH2F;
00033 class TH1I;
00034 class TProfile;
00035 class TTree;
00036 
00037 class GsfElectronDataAnalyzer : public edm::EDAnalyzer
00038 {
00039  public:
00040 
00041   explicit GsfElectronDataAnalyzer(const edm::ParameterSet& conf);
00042 
00043   virtual ~GsfElectronDataAnalyzer();
00044 
00045   virtual void beginJob();
00046   virtual void endJob();
00047   virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
00048 
00049  private:
00050 
00051   bool trigger(const edm::Event & e);
00052   
00053   unsigned int nEvents_;
00054   unsigned int nAfterTrigger_;
00055 
00056   edm::InputTag triggerResults_;
00057 
00058   std::vector<std::string > HLTPathsByName_;
00059   std::vector<unsigned int> HLTPathsByIndex_;
00060 
00061   std::string outputFile_;
00062   edm::InputTag electronCollection_;
00063   edm::InputTag matchingObjectCollection_;
00064   std::string matchingCondition_;
00065   std::string type_;
00066   bool readAOD_;
00067   // matching 
00068   double maxPtMatchingObject_;
00069   double maxAbsEtaMatchingObject_;
00070   double deltaR_;
00071 
00072   TrajectoryStateTransform transformer_;
00073   edm::ESHandle<TrackerGeometry> pDD;
00074   edm::ESHandle<MagneticField> theMagField;
00075 
00076   TFile *histfile_;
00077   TTree *tree_;
00078   float mcEnergy[10], mcEta[10], mcPhi[10], mcPt[10], mcQ[10];
00079   float superclusterEnergy[10], superclusterEta[10], superclusterPhi[10], superclusterEt[10];
00080   float seedMomentum[10], seedEta[10], seedPhi[10], seedPt[10], seedQ[10];
00081 
00082   TH1F *h_matchingObjectNum;
00083 
00084   TH1F *h_matchingObjectEta;
00085   TH1F *h_matchingObjectAbsEta;
00086   TH1F *h_matchingObjectP;
00087   TH1F *h_matchingObjectPt;
00088   TH1F *h_matchingObjectPhi;
00089   TH1F *h_matchingObjectZ;
00090 
00091   TH1F *h_ele_matchingObjectEta_matched;
00092   TH1F *h_ele_matchingObjectAbsEta_matched;
00093   TH1F *h_ele_matchingObjectPt_matched;
00094   TH1F *h_ele_matchingObjectPhi_matched;
00095   TH1F *h_ele_matchingObjectZ_matched;
00096 
00097   TH1F *h_ele_mee_all;
00098   TH1F *h_ele_mee_os;
00099   TH1F *h_ele_mee_os_ebeb;
00100   TH1F *h_ele_mee_os_ebee;
00101   TH1F *h_ele_mee_os_eeee;
00102   TH1F *h_ele_mee_os_gg;
00103   TH1F *h_ele_mee_os_gb;
00104   TH1F *h_ele_mee_os_bb;
00105 
00106   TH2F *h_ele_E2mnE1vsMee_all;
00107   TH2F *h_ele_E2mnE1vsMee_egeg_all;
00108   
00109   TH1F *h_ele_charge;
00110   TH2F *h_ele_chargeVsEta;
00111   TH2F *h_ele_chargeVsPhi;
00112   TH2F *h_ele_chargeVsPt;
00113   TH1F *h_ele_vertexP;
00114   TH1F *h_ele_vertexPt;
00115   TH1F *h_ele_Et;
00116   TH2F *h_ele_vertexPtVsEta;
00117   TH2F *h_ele_vertexPtVsPhi;
00118   TH1F *h_ele_vertexPt_5100;
00119   TH1F *h_ele_vertexEta;
00120   TH2F *h_ele_vertexEtaVsPhi;
00121   TH1F *h_ele_vertexAbsEta;
00122   TH1F *h_ele_vertexPhi;
00123   TH1F *h_ele_vertexX;
00124   TH1F *h_ele_vertexY;
00125   TH1F *h_ele_vertexZ;
00126   TH1F *h_ele_vertexTIP;
00127   TH2F *h_ele_vertexTIPVsEta;
00128   TH2F *h_ele_vertexTIPVsPhi;
00129   TH2F *h_ele_vertexTIPVsPt;
00130 
00131   TH1F *histNum_;
00132 
00133   TH1F *histSclEn_ ;
00134   TH1F *histSclEoEmatchingObject_barrel_matched;
00135   TH1F *histSclEoEmatchingObject_endcaps_matched;
00136   TH1F *histSclEoEmatchingObject_barrel_new_matched;
00137   TH1F *histSclEoEmatchingObject_endcaps_new_matched;
00138   TH1F *histSclEt_ ;
00139   TH2F *histSclEtVsEta_ ;
00140   TH2F *histSclEtVsPhi_ ;
00141   TH2F *histSclEtaVsPhi_ ;
00142   TH1F *histSclEta_ ;
00143   TH1F *histSclPhi_ ;
00144   TH1F *histSclSigEtaEta_ ;
00145   TH1F *histSclSigEtaEta_barrel_ ;
00146   TH1F *histSclSigEtaEta_endcaps_ ;
00147   TH1F *histSclSigIEtaIEta_ ;
00148   TH1F *histSclSigIEtaIEta_barrel_ ;
00149   TH1F *histSclSigIEtaIEta_endcaps_ ;
00150   TH1F *histSclE1x5_ ;
00151   TH1F *histSclE1x5_barrel_ ;
00152   TH1F *histSclE1x5_endcaps_ ;
00153   TH1F *histSclE2x5max_ ;
00154   TH1F *histSclE2x5max_barrel_ ;
00155   TH1F *histSclE2x5max_endcaps_ ;
00156   TH1F *histSclE5x5_ ;
00157   TH1F *histSclE5x5_barrel_ ;
00158   TH1F *histSclE5x5_endcaps_ ;
00159 
00160   TH1F *h_ele_ambiguousTracks;
00161   TH2F *h_ele_ambiguousTracksVsEta;
00162   TH2F *h_ele_ambiguousTracksVsPhi;
00163   TH2F *h_ele_ambiguousTracksVsPt;
00164   TH1F *h_ele_foundHits;
00165   TH1F *h_ele_foundHits_barrel;
00166   TH1F *h_ele_foundHits_endcaps;
00167   TH2F *h_ele_foundHitsVsEta;
00168   TH2F *h_ele_foundHitsVsPhi;
00169   TH2F *h_ele_foundHitsVsPt;
00170   TH1F *h_ele_lostHits;
00171   TH1F *h_ele_lostHits_barrel;
00172   TH1F *h_ele_lostHits_endcaps;
00173   TH2F *h_ele_lostHitsVsEta;
00174   TH2F *h_ele_lostHitsVsPhi;
00175   TH2F *h_ele_lostHitsVsPt;
00176   TH1F *h_ele_chi2;
00177   TH1F *h_ele_chi2_barrel_;
00178   TH1F *h_ele_chi2_endcaps_;
00179   TH2F *h_ele_chi2VsEta;
00180   TH2F *h_ele_chi2VsPhi;
00181   TH2F *h_ele_chi2VsPt;
00182 
00183   TH1F *h_ele_PtoPtmatchingObject_matched;
00184   TH1F *h_ele_PoPmatchingObject_matched;
00185   TH2F *h_ele_PoPmatchingObjectVsEta_matched;
00186   TH2F *h_ele_PoPmatchingObjectVsPhi_matched;
00187   TH2F *h_ele_PoPmatchingObjectVsPt_matched;
00188   TH1F *h_ele_PoPmatchingObject_barrel_matched;
00189   TH1F *h_ele_PoPmatchingObject_endcaps_matched;
00190   TH1F *h_ele_PtoPtmatchingObject_barrel_matched;
00191   TH1F *h_ele_PtoPtmatchingObject_endcaps_matched;
00192   TH1F *h_ele_EtaMnEtamatchingObject_matched;
00193   TH2F *h_ele_EtaMnEtamatchingObjectVsEta_matched;
00194   TH2F *h_ele_EtaMnEtamatchingObjectVsPhi_matched;
00195   TH2F *h_ele_EtaMnEtamatchingObjectVsPt_matched;
00196   TH1F *h_ele_PhiMnPhimatchingObject_matched;
00197   TH1F *h_ele_PhiMnPhimatchingObject2_matched;
00198   TH2F *h_ele_PhiMnPhimatchingObjectVsEta_matched;
00199   TH2F *h_ele_PhiMnPhimatchingObjectVsPhi_matched;
00200   TH2F *h_ele_PhiMnPhimatchingObjectVsPt_matched;
00201   TH1F *h_ele_PinMnPout;
00202   TH1F *h_ele_PinMnPout_mode;
00203   TH2F *h_ele_PinMnPoutVsEta_mode;
00204   TH2F *h_ele_PinMnPoutVsPhi_mode;
00205   TH2F *h_ele_PinMnPoutVsPt_mode;
00206   TH2F *h_ele_PinMnPoutVsE_mode;
00207   TH2F *h_ele_PinMnPoutVsChi2_mode;
00208 
00209   TH1F *h_ele_outerP;
00210   TH1F *h_ele_outerP_mode;
00211   TH2F *h_ele_outerPVsEta_mode;
00212   TH1F *h_ele_outerPt;
00213   TH1F *h_ele_outerPt_mode;
00214   TH2F *h_ele_outerPtVsEta_mode;
00215   TH2F *h_ele_outerPtVsPhi_mode;
00216   TH2F *h_ele_outerPtVsPt_mode;
00217   TH1F *h_ele_EoP;
00218   TH1F *h_ele_EoP_barrel;
00219   TH1F *h_ele_EoP_endcaps;
00220   TH2F *h_ele_EoPVsEta;
00221   TH2F *h_ele_EoPVsPhi;
00222   TH2F *h_ele_EoPVsE;
00223   TH1F *h_ele_EseedOP;
00224   TH1F *h_ele_EseedOP_barrel;
00225   TH1F *h_ele_EseedOP_endcaps;
00226   TH2F *h_ele_EseedOPVsEta;
00227   TH2F *h_ele_EseedOPVsPhi;
00228   TH2F *h_ele_EseedOPVsE;
00229   TH1F *h_ele_EoPout;
00230   TH1F *h_ele_EoPout_barrel;
00231   TH1F *h_ele_EoPout_endcaps;
00232   TH2F *h_ele_EoPoutVsEta;
00233   TH2F *h_ele_EoPoutVsPhi;
00234   TH2F *h_ele_EoPoutVsE;
00235   TH1F *h_ele_EeleOPout;
00236   TH1F *h_ele_EeleOPout_barrel;
00237   TH1F *h_ele_EeleOPout_endcaps;
00238   TH2F *h_ele_EeleOPoutVsEta;
00239   TH2F *h_ele_EeleOPoutVsPhi;
00240   TH2F *h_ele_EeleOPoutVsE;
00241 
00242   TH1F *h_ele_dEtaSc_propVtx;
00243   TH1F *h_ele_dEtaSc_propVtx_barrel;
00244   TH1F *h_ele_dEtaSc_propVtx_endcaps;
00245   TH2F *h_ele_dEtaScVsEta_propVtx;
00246   TH2F *h_ele_dEtaScVsPhi_propVtx;
00247   TH2F *h_ele_dEtaScVsPt_propVtx;
00248   TH1F *h_ele_dPhiSc_propVtx;
00249   TH1F *h_ele_dPhiSc_propVtx_barrel;
00250   TH1F *h_ele_dPhiSc_propVtx_endcaps;
00251   TH2F *h_ele_dPhiScVsEta_propVtx;
00252   TH2F *h_ele_dPhiScVsPhi_propVtx;
00253   TH2F *h_ele_dPhiScVsPt_propVtx;
00254   TH1F *h_ele_dEtaCl_propOut;
00255   TH1F *h_ele_dEtaCl_propOut_barrel;
00256   TH1F *h_ele_dEtaCl_propOut_endcaps;
00257   TH2F *h_ele_dEtaClVsEta_propOut;
00258   TH2F *h_ele_dEtaClVsPhi_propOut;
00259   TH2F *h_ele_dEtaClVsPt_propOut;
00260   TH1F *h_ele_dPhiCl_propOut;
00261   TH1F *h_ele_dPhiCl_propOut_barrel;
00262   TH1F *h_ele_dPhiCl_propOut_endcaps;
00263   TH2F *h_ele_dPhiClVsEta_propOut;
00264   TH2F *h_ele_dPhiClVsPhi_propOut;
00265   TH2F *h_ele_dPhiClVsPt_propOut;
00266   TH1F *h_ele_dEtaEleCl_propOut;
00267   TH1F *h_ele_dEtaEleCl_propOut_barrel;
00268   TH1F *h_ele_dEtaEleCl_propOut_endcaps;
00269   TH2F *h_ele_dEtaEleClVsEta_propOut;
00270   TH2F *h_ele_dEtaEleClVsPhi_propOut;
00271   TH2F *h_ele_dEtaEleClVsPt_propOut;
00272   TH1F *h_ele_dPhiEleCl_propOut;
00273   TH1F *h_ele_dPhiEleCl_propOut_barrel;
00274   TH1F *h_ele_dPhiEleCl_propOut_endcaps;
00275   TH2F *h_ele_dPhiEleClVsEta_propOut;
00276   TH2F *h_ele_dPhiEleClVsPhi_propOut;
00277   TH2F *h_ele_dPhiEleClVsPt_propOut;
00278 
00279   TH1F *h_ele_seed_dphi2_;
00280   TH2F *h_ele_seed_dphi2VsEta_;
00281   TH2F *h_ele_seed_dphi2VsPt_ ;
00282   TH1F *h_ele_seed_drz2_;
00283   TH2F *h_ele_seed_drz2VsEta_;
00284   TH2F *h_ele_seed_drz2VsPt_;
00285   TH1F *h_ele_seed_subdet2_;
00286 
00287   TH1F *h_ele_classes;
00288   TH1F *h_ele_eta;
00289   TH1F *h_ele_eta_golden;
00290   TH1F *h_ele_eta_bbrem;
00291   TH1F *h_ele_eta_narrow;
00292   TH1F *h_ele_eta_shower;
00293 
00294   TH1F *h_ele_HoE;
00295   TH1F *h_ele_HoE_barrel;
00296   TH1F *h_ele_HoE_endcaps;
00297   TH1F *h_ele_HoE_fiducial;
00298   TH2F *h_ele_HoEVsEta;
00299   TH2F *h_ele_HoEVsPhi;
00300   TH2F *h_ele_HoEVsE;
00301 
00302   TH1F *h_ele_fbrem;
00303   TProfile *h_ele_fbremVsEta_mode;
00304   TProfile *h_ele_fbremVsEta_mean;
00305 
00306   TH2F *h_ele_PinVsPoutGolden_mode;
00307   TH2F *h_ele_PinVsPoutShowering_mode;
00308   TH2F *h_ele_PinVsPoutGolden_mean;
00309   TH2F *h_ele_PinVsPoutShowering_mean;
00310   TH2F *h_ele_PtinVsPtoutGolden_mode;
00311   TH2F *h_ele_PtinVsPtoutShowering_mode;
00312   TH2F *h_ele_PtinVsPtoutGolden_mean;
00313   TH2F *h_ele_PtinVsPtoutShowering_mean;
00314   TH1F *histSclEoEmatchingObjectGolden_barrel;
00315   TH1F *histSclEoEmatchingObjectGolden_endcaps;
00316   TH1F *histSclEoEmatchingObjectShowering_barrel;
00317   TH1F *histSclEoEmatchingObjectShowering_endcaps;
00318   
00319   TH1F *h_ele_mva; 
00320   TH1F *h_ele_provenance; 
00321 
00322   TH1F *h_ele_tkSumPt_dr03; 
00323   TH1F *h_ele_ecalRecHitSumEt_dr03;
00324   TH1F *h_ele_hcalDepth1TowerSumEt_dr03;
00325   TH1F *h_ele_hcalDepth2TowerSumEt_dr03;
00326   TH1F *h_ele_tkSumPt_dr04; 
00327   TH1F *h_ele_ecalRecHitSumEt_dr04;
00328   TH1F *h_ele_hcalDepth1TowerSumEt_dr04;
00329   TH1F *h_ele_hcalDepth2TowerSumEt_dr04;
00330 
00331   // electron selection
00332   double minEt_;
00333   double minPt_;
00334   double maxAbsEta_;
00335   bool isEB_;
00336   bool isEE_;
00337   bool isNotEBEEGap_;
00338   bool isEcalDriven_;
00339   bool isTrackerDriven_;
00340   double eOverPMinBarrel_;
00341   double eOverPMaxBarrel_;
00342   double eOverPMinEndcaps_;
00343   double eOverPMaxEndcaps_;
00344   double dEtaMinBarrel_;
00345   double dEtaMaxBarrel_;
00346   double dEtaMinEndcaps_;
00347   double dEtaMaxEndcaps_;
00348   double dPhiMinBarrel_;
00349   double dPhiMaxBarrel_;
00350   double dPhiMinEndcaps_;
00351   double dPhiMaxEndcaps_;
00352   double sigIetaIetaMinBarrel_;
00353   double sigIetaIetaMaxBarrel_;
00354   double sigIetaIetaMinEndcaps_;
00355   double sigIetaIetaMaxEndcaps_;
00356   double hadronicOverEmMaxBarrel_;
00357   double hadronicOverEmMaxEndcaps_;
00358   double mvaMin_;
00359   double tipMaxBarrel_;
00360   double tipMaxEndcaps_;
00361   double tkIso03Max_;
00362   double hcalIso03Depth1MaxBarrel_;
00363   double hcalIso03Depth1MaxEndcaps_;
00364   double hcalIso03Depth2MaxEndcaps_;
00365   double ecalIso03MaxBarrel_;
00366   double ecalIso03MaxEndcaps_;
00367   
00368    // histos limits and binning
00369   double etamin;
00370   double etamax;
00371   double phimin;
00372   double phimax;
00373   double ptmax;
00374   double pmax;
00375   double eopmax;
00376   double eopmaxsht;
00377   double detamin;
00378   double detamax;
00379   double dphimin;
00380   double dphimax;
00381   double detamatchmin;
00382   double detamatchmax;
00383   double dphimatchmin;
00384   double dphimatchmax;
00385   double fhitsmax;
00386   double lhitsmax;
00387   double poptruemin;
00388   double poptruemax;
00389   double meemin;
00390   double meemax;
00391   double hoemin;
00392   double hoemax;
00393   int nbineta;
00394   int nbinp;
00395   int nbinpt;
00396   int nbinpteff;
00397   int nbinphi;
00398   int nbinp2D;
00399   int nbinpt2D;
00400   int nbineta2D;
00401   int nbinphi2D;
00402   int nbineop;
00403   int nbineop2D;
00404   int nbinfhits;
00405   int nbinlhits;
00406   int nbinxyz;
00407   int nbindeta;
00408   int nbindphi;
00409   int nbindetamatch;
00410   int nbindphimatch;
00411   int nbindetamatch2D;
00412   int nbindphimatch2D;
00413   int nbinpoptrue;
00414   int nbinmee;
00415   int nbinhoe;
00416 
00417  };
00418 
00419 #endif
00420 
00421 
00422