Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:21

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