CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoEgamma/Examples/plugins/DQMAnalyzer.h

Go to the documentation of this file.
00001 #ifndef DQMAnalyzer_h
00002 #define DQMAnalyzer_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: DQMAnalyzer.h,v 1.5 2011/05/20 17:17:28 wmtan Exp $
00013 //
00014 //
00015 
00016 
00017 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00018 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00019 
00020 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00021 #include "DataFormats/Common/interface/Handle.h"
00022 
00023 #include "FWCore/Framework/interface/EDAnalyzer.h"
00024 #include "FWCore/Framework/interface/Event.h"
00025 #include "FWCore/Framework/interface/ESHandle.h"
00026 #include "FWCore/Framework/interface/EventSetup.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSet.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 DQMAnalyzer : public edm::EDAnalyzer
00038 {
00039  public:
00040 
00041   explicit DQMAnalyzer( const edm::ParameterSet & conf ) ;
00042 
00043   virtual ~DQMAnalyzer() ;
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    //=========================================
00052    // parameters
00053    //=========================================
00054 
00055   std::string outputFile_;
00056   edm::InputTag electronCollection_;
00057   edm::InputTag matchingObjectCollection_;
00058   std::string matchingCondition_;
00059   //std::string type_;
00060   bool readAOD_;
00061 
00062   // matching
00063   double maxPtMatchingObject_;
00064   double maxAbsEtaMatchingObject_;
00065   double deltaR_;
00066 
00067   // tag and probe
00068   int Selection_;
00069   double massLow_;
00070   double massHigh_;
00071   bool TPchecksign_;
00072   bool TAGcheckclass_;
00073   bool PROBEetcut_;
00074   bool PROBEcheckclass_;
00075 
00076   // electron selection
00077   double minEt_;
00078   double minPt_;
00079   double maxAbsEta_;
00080   bool isEB_;
00081   bool isEE_;
00082   bool isNotEBEEGap_;
00083   bool isEcalDriven_;
00084   bool isTrackerDriven_;
00085   double eOverPMinBarrel_;
00086   double eOverPMaxBarrel_;
00087   double eOverPMinEndcaps_;
00088   double eOverPMaxEndcaps_;
00089   double dEtaMinBarrel_;
00090   double dEtaMaxBarrel_;
00091   double dEtaMinEndcaps_;
00092   double dEtaMaxEndcaps_;
00093   double dPhiMinBarrel_;
00094   double dPhiMaxBarrel_;
00095   double dPhiMinEndcaps_;
00096   double dPhiMaxEndcaps_;
00097   double sigIetaIetaMinBarrel_;
00098   double sigIetaIetaMaxBarrel_;
00099   double sigIetaIetaMinEndcaps_;
00100   double sigIetaIetaMaxEndcaps_;
00101   double hadronicOverEmMaxBarrel_;
00102   double hadronicOverEmMaxEndcaps_;
00103   double mvaMin_;
00104   double tipMaxBarrel_;
00105   double tipMaxEndcaps_;
00106   double tkIso03Max_;
00107   double hcalIso03Depth1MaxBarrel_;
00108   double hcalIso03Depth1MaxEndcaps_;
00109   double hcalIso03Depth2MaxEndcaps_;
00110   double ecalIso03MaxBarrel_;
00111   double ecalIso03MaxEndcaps_;
00112 
00113   // for trigger
00114   edm::InputTag triggerResults_;
00115   std::vector<std::string > HLTPathsByName_;
00116 
00117   // histos limits and binning
00118   int nbineta; int nbineta2D; double etamin; double etamax;
00119   int nbinphi; int nbinphi2D; double phimin; double phimax;
00120   int nbinpt; int nbinpteff; int nbinpt2D; double ptmax;
00121   int nbinp; int nbinp2D; double pmax;
00122   int nbineop; int nbineop2D; double eopmax; double eopmaxsht;
00123   int nbindeta; double detamin; double detamax;
00124   int nbindphi; double dphimin; double dphimax;
00125   int nbindetamatch; int nbindetamatch2D; double detamatchmin; double detamatchmax;
00126   int nbindphimatch; int nbindphimatch2D; double dphimatchmin; double dphimatchmax;
00127   int nbinfhits; double fhitsmax;
00128   int nbinlhits; double lhitsmax;
00129   int nbinxyz;
00130   int nbinpoptrue; double poptruemin; double poptruemax;
00131   int nbinmee; double meemin; double meemax;
00132   int nbinhoe; double hoemin; double hoemax;
00133 
00134 
00135   //=========================================
00136   // usual attributes and methods
00137   //=========================================
00138 
00139 
00140   unsigned int nEvents_ ;
00141 
00142   bool selected( const reco::GsfElectronCollection::const_iterator & gsfIter , double vertexTIP ) ;
00143   bool generalCut( const reco::GsfElectronCollection::const_iterator & gsfIter) ;
00144   bool etCut( const reco::GsfElectronCollection::const_iterator & gsfIter ) ;
00145   bool isolationCut( const reco::GsfElectronCollection::const_iterator & gsfIter, double vertexTIP ) ;
00146   bool idCut( const reco::GsfElectronCollection::const_iterator & gsfIter ) ;
00147 
00148   bool trigger( const edm::Event & e ) ;
00149   unsigned int nAfterTrigger_;
00150   std::vector<unsigned int> HLTPathsByIndex_;
00151 
00152   TrajectoryStateTransform transformer_;
00153   edm::ESHandle<TrackerGeometry> pDD;
00154   edm::ESHandle<MagneticField> theMagField;
00155 
00156   TFile * histfile_ ;
00157   TTree * tree_ ;
00158 
00159   float mcEnergy[10], mcEta[10], mcPhi[10], mcPt[10], mcQ[10] ;
00160   float superclusterEnergy[10], superclusterEta[10], superclusterPhi[10], superclusterEt[10] ;
00161   float seedMomentum[10], seedEta[10], seedPhi[10], seedPt[10], seedQ[10] ;
00162 
00163 
00164   //=========================================
00165   // histograms
00166   //=========================================
00167 
00168   TH1F *h_matchingObjectNum;
00169 
00170   TH1F *h_matchingObjectEta;
00171   TH1F *h_matchingObjectAbsEta;
00172   TH1F *h_matchingObjectP;
00173   TH1F *h_matchingObjectPt;
00174   TH1F *h_matchingObjectPhi;
00175   TH1F *h_matchingObjectZ;
00176 
00177   TH1F *h_ele_matchingObjectEta_matched;
00178   TH1F *h_ele_matchingObjectAbsEta_matched;
00179   TH1F *h_ele_matchingObjectPt_matched;
00180   TH1F *h_ele_matchingObjectPhi_matched;
00181   TH1F *h_ele_matchingObjectZ_matched;
00182 
00183   //TH1F *h_ele_vertexP;
00184   TH1F *h_ele_vertexPt;
00185   TH1F *h_ele_Et;
00186   TH1F *h_ele_vertexEta;
00187   //TH1F *h_ele_vertexAbsEta;
00188   TH1F *h_ele_vertexPhi;
00189   TH1F *h_ele_vertexX;
00190   TH1F *h_ele_vertexY;
00191   TH1F *h_ele_vertexZ;
00192   TH1F *h_ele_vertexTIP;
00193   TH1F *h_ele_charge;
00194 
00195   TH1F *histNum_;
00196 
00197   TH1F *histSclEn_ ;
00198   TH1F *histSclEt_ ;
00199   TH1F *histSclEta_ ;
00200   TH1F *histSclPhi_ ;
00201   TH1F *histSclSigEtaEta_ ;
00202 
00203   TH1F *h_ele_ambiguousTracks;
00204   TH2F *h_ele_ambiguousTracksVsEta;
00205   TH2F *h_ele_ambiguousTracksVsPhi;
00206   TH2F *h_ele_ambiguousTracksVsPt;
00207   TH1F *h_ele_foundHits;
00208 //  TH1F *h_ele_foundHits_barrel;
00209 //  TH1F *h_ele_foundHits_endcaps;
00210   TH2F *h_ele_foundHitsVsEta;
00211   TH2F *h_ele_foundHitsVsPhi;
00212   TH2F *h_ele_foundHitsVsPt;
00213   TH1F *h_ele_lostHits;
00214 //  TH1F *h_ele_lostHits_barrel;
00215 //  TH1F *h_ele_lostHits_endcaps;
00216   TH2F *h_ele_lostHitsVsEta;
00217   TH2F *h_ele_lostHitsVsPhi;
00218   TH2F *h_ele_lostHitsVsPt;
00219   TH1F *h_ele_chi2;
00220 //  TH1F *h_ele_chi2_barrel_;
00221 //  TH1F *h_ele_chi2_endcaps_;
00222   TH2F *h_ele_chi2VsEta;
00223   TH2F *h_ele_chi2VsPhi;
00224   TH2F *h_ele_chi2VsPt;
00225 
00226   TH1F *h_ele_EoP;
00227 //  TH1F *h_ele_EoPout;
00228   TH1F *h_ele_EeleOPout;
00229   TH1F *h_ele_dEtaSc_propVtx;
00230   TH1F *h_ele_dPhiSc_propVtx;
00231   TH1F *h_ele_dEtaCl_propOut;
00232   TH1F *h_ele_dPhiCl_propOut;
00233   TH1F *h_ele_dEtaEleCl_propOut;
00234   TH1F *h_ele_dPhiEleCl_propOut;
00235 //  TH1F *h_ele_dPhiEleCl_propOut_barrel;
00236 //  TH1F *h_ele_dPhiEleCl_propOut_endcaps;
00237   TH1F *h_ele_HoE;
00238   TH1F *h_ele_outerP;
00239   TH1F *h_ele_outerP_mode;
00240   TH1F *h_ele_outerPt;
00241   TH1F *h_ele_outerPt_mode;
00242 
00243   TH1F *h_ele_PinMnPout;
00244   TH1F *h_ele_PinMnPout_mode;
00245 
00246   TH1F *h_ele_mva;
00247   TH1F *h_ele_provenance;
00248 
00249   TH1F *h_ele_tkSumPt_dr03;
00250   TH1F *h_ele_ecalRecHitSumEt_dr03;
00251   TH1F *h_ele_hcalDepth1TowerSumEt_dr03;
00252   TH1F *h_ele_hcalDepth2TowerSumEt_dr03;
00253   TH1F *h_ele_tkSumPt_dr04;
00254   TH1F *h_ele_ecalRecHitSumEt_dr04;
00255   TH1F *h_ele_hcalDepth1TowerSumEt_dr04;
00256   TH1F *h_ele_hcalDepth2TowerSumEt_dr04;
00257 
00258   TH1F *h_ele_mee_os;
00259 
00260   // OBSOLETE
00261   //  TH1F *h_ele_PtoPtmatchingObject_matched; //OBSOLETE ?
00262   //  TH1F *h_ele_PtoPtmatchingObject_barrel_matched; //OBSOLETE ?
00263   //  TH1F *h_ele_PtoPtmatchingObject_endcaps_matched; //OBSOLETE ?
00264   //  TH1F *h_ele_PoPmatchingObject_matched; //OBSOLETE ?
00265   //  TH1F *h_ele_PoPmatchingObject_barrel_matched; //OBSOLETE ?
00266   //  TH1F *h_ele_PoPmatchingObject_endcaps_matched; //OBSOLETE ?
00267   //  TH1F *h_ele_EtaMnEtamatchingObject_matched; //OBSOLETE ?
00268   //  TH1F *h_ele_PhiMnPhimatchingObject_matched; //OBSOLETE ?
00269   //  TH1F *h_ele_PhiMnPhimatchingObject2_matched; //OBSOLETE ?
00270 
00271  };
00272 
00273 #endif