Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-15 08:47:35

0001 
0002 #ifndef DQMOffline_EGamma_ElectronAnalyzer_h
0003 #define DQMOffline_EGamma_ElectronAnalyzer_h
0004 
0005 #include "DQMOffline/EGamma/interface/ElectronDqmAnalyzerBase.h"
0006 
0007 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0008 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
0009 
0010 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0011 #include "DataFormats/VertexReco/interface/Vertex.h"
0012 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0013 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0014 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0015 #include "DataFormats/EgammaCandidates/interface/GsfElectronCore.h"
0016 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0017 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
0018 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
0019 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
0020 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0021 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0022 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
0023 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0024 #include "DataFormats/JetReco/interface/GenJetCollection.h"
0025 
0026 #include "DataFormats/Common/interface/Handle.h"
0027 #include "DataFormats/Common/interface/ValueMap.h"
0028 
0029 class MagneticField;
0030 
0031 #include "FWCore/Framework/interface/Event.h"
0032 #include "FWCore/Framework/interface/ESHandle.h"
0033 #include "FWCore/Framework/interface/EventSetup.h"
0034 
0035 class ElectronAnalyzer : public ElectronDqmAnalyzerBase {
0036 public:
0037   explicit ElectronAnalyzer(const edm::ParameterSet &conf);
0038   ~ElectronAnalyzer() override;
0039 
0040   //    virtual void book() ;
0041   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0042   void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0043 
0044 private:
0045   //=========================================
0046   // parameters
0047   //=========================================
0048 
0049   // general, collections
0050   int Selection_;
0051   edm::EDGetTokenT<reco::GsfElectronCollection> electronCollection_;
0052   edm::EDGetTokenT<reco::SuperClusterCollection> matchingObjectCollection_;
0053   edm::EDGetTokenT<reco::GsfTrackCollection> gsftrackCollection_;
0054   edm::EDGetTokenT<reco::TrackCollection> trackCollection_;
0055   edm::EDGetTokenT<reco::VertexCollection> vertexCollection_;
0056   edm::EDGetTokenT<reco::BeamSpot> beamSpotTag_;
0057   bool readAOD_;  //NEW
0058 
0059   std::string inputFile_;
0060   std::string outputFile_;
0061   std::string inputInternalPath_;
0062   std::string outputInternalPath_;
0063 
0064   // matching
0065   std::string matchingCondition_;   //NEW
0066   double maxPtMatchingObject_;      // SURE ?
0067   double maxAbsEtaMatchingObject_;  // SURE ?
0068   double deltaR_;
0069 
0070   // electron selection NEW
0071   double minEt_;
0072   double minPt_;
0073   double maxAbsEta_;
0074   bool isEB_;
0075   bool isEE_;
0076   bool isNotEBEEGap_;
0077   bool isEcalDriven_;
0078   bool isTrackerDriven_;
0079   double eOverPMinBarrel_;
0080   double eOverPMaxBarrel_;
0081   double eOverPMinEndcaps_;
0082   double eOverPMaxEndcaps_;
0083   double dEtaMinBarrel_;
0084   double dEtaMaxBarrel_;
0085   double dEtaMinEndcaps_;
0086   double dEtaMaxEndcaps_;
0087   double dPhiMinBarrel_;
0088   double dPhiMaxBarrel_;
0089   double dPhiMinEndcaps_;
0090   double dPhiMaxEndcaps_;
0091   double sigIetaIetaMinBarrel_;
0092   double sigIetaIetaMaxBarrel_;
0093   double sigIetaIetaMinEndcaps_;
0094   double sigIetaIetaMaxEndcaps_;
0095   double hadronicOverEmMaxBarrel_;
0096   double hadronicOverEmMaxEndcaps_;
0097   double mvaMin_;
0098   double tipMaxBarrel_;
0099   double tipMaxEndcaps_;
0100   double tkIso03Max_;
0101   double hcalIso03Depth1MaxBarrel_;
0102   double hcalIso03Depth1MaxEndcaps_;
0103   double hcalIso03Depth2MaxEndcaps_;
0104   double ecalIso03MaxBarrel_;
0105   double ecalIso03MaxEndcaps_;
0106 
0107   // for trigger NEW
0108   edm::InputTag triggerResults_;
0109   //    std::vector<std::string > HLTPathsByName_;
0110 
0111   // histos limits and binning
0112   int nbineta;
0113   int nbineta2D;
0114   double etamin;
0115   double etamax;
0116   int nbinphi;
0117   int nbinphi2D;
0118   double phimin;
0119   double phimax;
0120   int nbinpt;
0121   int nbinpteff;
0122   int nbinpt2D;
0123   double ptmax;
0124   int nbinp;
0125   int nbinp2D;
0126   double pmax;
0127   int nbineop;
0128   int nbineop2D;
0129   double eopmax;
0130   double eopmaxsht;
0131   int nbindeta;
0132   double detamin;
0133   double detamax;
0134   int nbindphi;
0135   double dphimin;
0136   double dphimax;
0137   int nbindetamatch;
0138   int nbindetamatch2D;
0139   double detamatchmin;
0140   double detamatchmax;
0141   int nbindphimatch;
0142   int nbindphimatch2D;
0143   double dphimatchmin;
0144   double dphimatchmax;
0145   int nbinfhits;
0146   double fhitsmax;
0147   int nbinlhits;
0148   double lhitsmax;
0149   int nbinxyz;
0150   int nbinxyz2D;
0151   int nbinpoptrue;
0152   double poptruemin;
0153   double poptruemax;  //NEW
0154   int nbinmee;
0155   double meemin;
0156   double meemax;  //NEW
0157   int nbinhoe;
0158   double hoemin;
0159   double hoemax;  //NEW
0160                   //    bool set_EfficiencyFlag ; bool set_StatOverflowFlag ;
0161 
0162   //=========================================
0163   // general attributes and utility methods
0164   //=========================================
0165 
0166   unsigned int nEvents_;
0167 
0168   float computeInvMass(const reco::GsfElectron &e1, const reco::GsfElectron &e2);
0169 
0170   bool selected(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP);
0171   bool generalCut(const reco::GsfElectronCollection::const_iterator &gsfIter);
0172   bool etCut(const reco::GsfElectronCollection::const_iterator &gsfIter);
0173   bool isolationCut(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP);
0174   bool idCut(const reco::GsfElectronCollection::const_iterator &gsfIter);
0175 
0176   //    bool trigger( const edm::Event & e ) ;
0177   //    unsigned int nAfterTrigger_;
0178   //    std::vector<unsigned int> HLTPathsByIndex_;
0179 
0180   edm::ESHandle<TrackerGeometry> pDD;
0181   edm::ESHandle<MagneticField> theMagField;
0182 
0183   float mcEnergy[10], mcEta[10], mcPhi[10], mcPt[10], mcQ[10];
0184   float superclusterEnergy[10], superclusterEta[10], superclusterPhi[10], superclusterEt[10];
0185   float seedMomentum[10], seedEta[10], seedPhi[10], seedPt[10], seedQ[10];
0186 
0187   //=========================================
0188   // histograms
0189   //=========================================
0190 
0191   // general
0192   MonitorElement *h2_beamSpotXvsY;
0193   MonitorElement *py_nElectronsVsLs;
0194   MonitorElement *py_nClustersVsLs;
0195   MonitorElement *py_nGsfTracksVsLs;
0196   MonitorElement *py_nTracksVsLs;
0197   MonitorElement *py_nVerticesVsLs;
0198   MonitorElement *h1_triggers;
0199 
0200   // basic quantities
0201   //    MonitorElement * h1_num_ ; // number of electrons in a single event
0202   //    MonitorElement * h1_charge ;
0203   //    MonitorElement * h1_vertexP ;
0204   //    MonitorElement * h1_Et ;
0205   //    MonitorElement * h1_vertexTIP ;
0206   //    MonitorElement * h1_vertexPhi ;
0207   //    MonitorElement * h1_vertexX ;
0208   //    MonitorElement * h1_vertexY ;
0209   MonitorElement *h1_vertexPt_barrel;
0210   MonitorElement *h1_vertexPt_endcaps;
0211   MonitorElement *h1_vertexEta;
0212   MonitorElement *h2_vertexEtaVsPhi;
0213   MonitorElement *h2_vertexXvsY;
0214   MonitorElement *h1_vertexZ;
0215 
0216   // super-clusters
0217   //    MonitorElement * h1_sclEn ;
0218   //    MonitorElement * h1_sclEta ;
0219   //    MonitorElement * h1_sclPhi ;
0220   MonitorElement *h1_sclEt;
0221 
0222   // gsf tracks
0223   //    MonitorElement * h1_ambiguousTracks ;
0224   //    MonitorElement * h2ele_ambiguousTracksVsEta ;
0225   //    MonitorElement * h2_ambiguousTracksVsPhi ;
0226   //    MonitorElement * h2_ambiguousTracksVsPt ;
0227   MonitorElement *h1_chi2;
0228   MonitorElement *py_chi2VsEta;
0229   MonitorElement *py_chi2VsPhi;
0230   //    MonitorElement * h2_chi2VsPt ;
0231   MonitorElement *h1_foundHits;
0232   MonitorElement *py_foundHitsVsEta;
0233   MonitorElement *py_foundHitsVsPhi;
0234   //    MonitorElement * h2_foundHitsVsPt ;
0235   MonitorElement *h1_lostHits;
0236   MonitorElement *py_lostHitsVsEta;
0237   MonitorElement *py_lostHitsVsPhi;
0238   //    MonitorElement * h2_lostHitsVsPt ;
0239 
0240   // electron matching and ID
0241   //MonitorElement * h_EopOut ;
0242   //MonitorElement * h_dEtaCl_propOut ;
0243   //MonitorElement * h_dPhiCl_propOut ;
0244   //    MonitorElement * h1_Eop ;
0245   //    MonitorElement * h2_EopVsEta ;
0246   MonitorElement *h1_Eop_barrel;
0247   MonitorElement *h1_Eop_endcaps;
0248   MonitorElement *py_EopVsPhi;
0249   //    MonitorElement * h1_EopVsPt ;
0250   //    MonitorElement * h1_EeleOPout ;
0251   //    MonitorElement * h2_EeleOPoutVsEta ;
0252   MonitorElement *h1_EeleOPout_barrel;
0253   MonitorElement *h1_EeleOPout_endcaps;
0254   //    MonitorElement * h2_EeleOPoutVsPhi ;
0255   //    MonitorElement * h2_EeleOPoutVsPt ;
0256   //    MonitorElement * h1_dEtaSc_propVtx ;
0257   //    MonitorElement * h2_dEtaSc_propVtxVsEta ;
0258   MonitorElement *h1_dEtaSc_propVtx_barrel;
0259   MonitorElement *h1_dEtaSc_propVtx_endcapsPos;
0260   MonitorElement *h1_dEtaSc_propVtx_endcapsNeg;
0261   MonitorElement *py_dEtaSc_propVtxVsPhi;
0262   //    MonitorElement * h2_dEtaSc_propVtxVsPt ;
0263   //    MonitorElement * h1_dEtaEleCl_propOut ;
0264   //    MonitorElement * h2_dEtaEleCl_propOutVsEta ;
0265   MonitorElement *h1_dEtaEleCl_propOut_barrel;
0266   MonitorElement *h1_dEtaEleCl_propOut_endcapsPos;
0267   MonitorElement *h1_dEtaEleCl_propOut_endcapsNeg;
0268   //    MonitorElement * h2_dEtaEleCl_propOutVsPhi ;
0269   //    MonitorElement * h2_dEtaEleCl_propOutVsPt ;
0270   //    MonitorElement * h1_dPhiSc_propVtx ;
0271   //    MonitorElement * h2_dPhiSc_propVtxVsEta ;
0272   MonitorElement *h1_dPhiSc_propVtx_barrel;
0273   MonitorElement *h1_dPhiSc_propVtx_endcapsPos;
0274   MonitorElement *h1_dPhiSc_propVtx_endcapsNeg;
0275   MonitorElement *py_dPhiSc_propVtxVsPhi;
0276   //    MonitorElement * h2_dPhiSc_propVtxVsPt ;
0277   //    MonitorElement * h1_dPhiEleCl_propOut ;
0278   //    MonitorElement * h2_dPhiEleCl_propOutVsEta ;
0279   MonitorElement *h1_dPhiEleCl_propOut_barrel;
0280   MonitorElement *h1_dPhiEleCl_propOut_endcapsPos;
0281   MonitorElement *h1_dPhiEleCl_propOut_endcapsNeg;
0282   //    MonitorElement * h2_dPhiEleCl_propOutVsPhi ;
0283   //    MonitorElement * h2_dPhiEleCl_propOutVsPt ;
0284   //    MonitorElement * h1_Hoe ;
0285   //    MonitorElement * h2_HoeVsEta ;
0286   MonitorElement *h1_Hoe_barrel;
0287   MonitorElement *h1_Hoe_endcaps;
0288   MonitorElement *py_HoeVsPhi;
0289   //    MonitorElement * h2_HoeVsPt ;
0290   MonitorElement *h1_sclSigEtaEta_barrel;
0291   MonitorElement *h1_sclSigEtaEta_endcaps;
0292   MonitorElement *h1_sigIEtaIEta5x5_barrel;
0293   MonitorElement *h1_sigIEtaIEta5x5_endcaps;
0294 
0295   // fbrem related variables
0296   //MonitorElement * h_outerP ;
0297   //MonitorElement * h_outerP_mode ;
0298   //    MonitorElement * h_innerPt_mean ;
0299   //    MonitorElement * h_outerPt_mean ;
0300   //    MonitorElement * h_outerPt_mode ;
0301   //    MonitorElement * h_PinMnPout ;
0302   //    MonitorElement * h_PinMnPout_mode ;
0303   MonitorElement *h1_fbrem;
0304   MonitorElement *py_fbremVsEta;
0305   MonitorElement *py_fbremVsPhi;
0306   //    MonitorElement * h2_fbremVsPt ;
0307   MonitorElement *h1_classes;
0308 
0309   // pflow
0310   MonitorElement *h1_mva;
0311   MonitorElement *h1_provenance;
0312 
0313   // isolation
0314   MonitorElement *h1_tkSumPt_dr03;
0315   MonitorElement *h1_ecalRecHitSumEt_dr03;
0316   MonitorElement *h1_hcalTowerSumEt_dr03;
0317   MonitorElement *h1_PFch_dr03;
0318   MonitorElement *h1_PFem_dr03;
0319   MonitorElement *h1_PFnh_dr03;
0320   //    MonitorElement * h1_hcalDepth1TowerSumEt_dr03 ;
0321   //    MonitorElement * h1_hcalDepth2TowerSumEt_dr03 ;
0322   //    MonitorElement * h1_tkSumPt_dr04 ;
0323   //    MonitorElement * h1_ecalRecHitSumEt_dr04 ;
0324   //    MonitorElement * h1_hcalTowerSumEt_dr04 ;
0325   ////    MonitorElement * h1_hcalDepth1TowerSumEt_dr04 ;
0326   ////    MonitorElement * h1_hcalDepth2TowerSumEt_dr04 ;
0327 
0328   // di-electron mass
0329   MonitorElement *h1_mee;
0330   MonitorElement *h1_mee_os;
0331   MonitorElement *h1_mee_os_bb;
0332   MonitorElement *h1_mee_os_ee;
0333   MonitorElement *h1_mee_os_eb;
0334 
0335   // histos for matching and matched objects
0336 
0337   //    MonitorElement * h1_matchedEle_eta ;
0338   //    MonitorElement * h1_matchedEle_eta_golden ;
0339   //    MonitorElement * h1_matchedEle_eta_shower ;
0340   //    //MonitorElement * h1_matchedEle_eta_bbrem ;
0341   //    //MonitorElement * h1_matchedEle_eta_narrow ;
0342 
0343   MonitorElement *h1_matchedObject_Eta;
0344   //    MonitorElement * h1_matchedObject_AbsEta ;
0345   MonitorElement *h1_matchedObject_Pt;
0346   MonitorElement *h1_matchedObject_Phi;
0347   //    MonitorElement * h1_matchedObject_Z ;
0348 
0349   //    MonitorElement * h1_matchingObject_Num ;
0350   MonitorElement *h1_matchingObject_Eta;
0351   //    MonitorElement * h1_matchingObject_AbsEta ;
0352   //    MonitorElement * h1_matchingObject_P ;
0353   MonitorElement *h1_matchingObject_Pt;
0354   MonitorElement *h1_matchingObject_Phi;
0355   //    MonitorElement * h1_matchingObject_Z ;
0356 };
0357 
0358 #endif