CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/RecoMET/METAlgorithms/interface/TCMETAlgo.h

Go to the documentation of this file.
00001 #ifndef TCMETAlgo_h
00002 #define TCMETAlgo_h
00003 
00018 #include <vector>
00019 #include <string>
00020 #include "FWCore/Framework/interface/Event.h"
00021 #include "DataFormats/Common/interface/Handle.h"
00022 #include "FWCore/Framework/interface/ESHandle.h"
00023 #include "FWCore/Framework/interface/EventSetup.h"
00024 #include "DataFormats/Common/interface/ValueMap.h" 
00025 
00026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00027 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00028 #include "DataFormats/METReco/interface/CommonMETData.h"
00029 #include "DataFormats/METReco/interface/MET.h"
00030 
00031 #include "DataFormats/EgammaCandidates/interface/Electron.h"
00032 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
00033 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00034 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00035 
00036 #include "DataFormats/MuonReco/interface/Muon.h"
00037 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00038 #include "DataFormats/TrackReco/interface/Track.h"
00039 #include "DataFormats/VertexReco/interface/Vertex.h"
00040 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00041 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00042 #include "DataFormats/METReco/interface/CaloMET.h"
00043 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00044 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00045 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
00046 #include "TH2D.h"
00047 #include "TVector3.h"
00048 
00049 class TCMETAlgo 
00050 {
00051  public:
00052   typedef std::vector<const reco::Candidate> InputCollection;
00053   TCMETAlgo();
00054   virtual ~TCMETAlgo();
00055   reco::MET CalculateTCMET(edm::Event& event, const edm::EventSetup& setup);
00056   TH2D* getResponseFunction_fit ( );
00057   TH2D* getResponseFunction_mode ( );
00058   TH2D* getResponseFunction_shower ( );
00059   TH2D* getResponseFunction_noshower ( );
00060   void configure(const edm::ParameterSet &iConfig, int myResponseFunctionType);
00061  private:
00062   double met_x;
00063   double met_y;
00064   double sumEt;
00065 
00066   edm::Handle<reco::MuonCollection> MuonHandle;
00067   edm::Handle<reco::GsfElectronCollection> ElectronHandle;
00068   edm::Handle<edm::View<reco::MET> > metHandle;
00069   edm::Handle<reco::TrackCollection> TrackHandle;
00070   edm::Handle<reco::BeamSpot> beamSpotHandle;
00071   edm::Handle<reco::VertexCollection> VertexHandle;
00072 
00073   edm::Handle<edm::ValueMap<reco::MuonMETCorrectionData> > muon_data_h;
00074   edm::Handle<edm::ValueMap<reco::MuonMETCorrectionData> > tcmet_data_h;
00075 
00076   edm::InputTag muonInputTag_;
00077   edm::InputTag electronInputTag_;
00078   edm::InputTag metInputTag_;
00079   edm::InputTag trackInputTag_;
00080   edm::InputTag beamSpotInputTag_;
00081   edm::InputTag vertexInputTag_;
00082 
00083   edm::InputTag muonDepValueMap_;
00084   edm::InputTag tcmetDepValueMap_;
00085 
00086   edm::InputTag inputTagPFClustersECAL_;
00087   edm::InputTag inputTagPFClustersHCAL_;
00088   edm::InputTag inputTagPFClustersHFEM_;
00089   edm::InputTag inputTagPFClustersHFHAD_;   
00090 
00091   bool    usePFClusters_;
00092   int     nLayers_;
00093   int     nLayersTight_;
00094   int     vertexNdof_;
00095   double  vertexZ_;
00096   double  vertexRho_;
00097   double  vertexMaxDZ_;
00098   double  maxpt_eta25_;
00099   double  maxpt_eta20_;
00100   bool    vetoDuplicates_;
00101   double  dupMinPt_;
00102   double  dupDPhi_;
00103   double  dupDCotTh_;
00104   std::vector<int> duplicateTracks_;
00105 
00106   double  d0cuta_;
00107   double  d0cutb_;
00108   double  maxd0cut_;
00109   double  maxchi2_tight_;
00110   double  minhits_tight_;
00111   double  maxPtErr_tight_;
00112   int     rfType_;
00113   int     nMinOuterHits_;
00114   int     maxTrackAlgo_;
00115   double  usedeltaRRejection_;
00116   double  deltaRShower_;
00117   double  minpt_;
00118   double  maxpt_;
00119   double  maxeta_;
00120   double  maxchi2_;
00121   double  minhits_;
00122   double  maxPtErr_;
00123   double  radius_;
00124   double  zdist_;
00125   double  corner_;
00126   double  eVetoDeltaR_;
00127   double  eVetoDeltaPhi_;
00128   double  eVetoDeltaCotTheta_; 
00129   double  eVetoMinElectronPt_;
00130   double  hOverECut_;
00131   std::vector<int> trkQuality_;
00132   std::vector<int> trkAlgos_;
00133 
00134   bool isCosmics_;
00135   bool correctShowerTracks_;
00136   bool electronVetoCone_;
00137   bool usePvtxd0_;
00138   bool checkTrackPropagation_;
00139 
00140   const class MagneticField* bField;
00141 
00142   class TH2D* response_function;
00143   class TH2D* showerRF;
00144   bool hasValidVertex;
00145   const reco::VertexCollection *vertexColl;
00146 
00147   edm::ValueMap<reco::MuonMETCorrectionData> muon_data;
00148   edm::ValueMap<reco::MuonMETCorrectionData> tcmet_data;
00149 
00150   bool isMuon( unsigned int );
00151   bool isElectron( unsigned int ); 
00152   bool isGoodTrack( const reco::TrackRef , int trk_idx );
00153   bool closeToElectron( const reco::TrackRef );
00154   void correctMETforMuon( const reco::TrackRef, const unsigned int );
00155   void correctSumEtForMuon( const reco::TrackRef, const unsigned int );
00156   void correctMETforMuon( const unsigned int );
00157   void correctSumEtForMuon( const unsigned int );
00158   void correctMETforTrack( const reco::TrackRef , TH2D* rf, const TVector3 );
00159   void correctSumEtForTrack( const reco::TrackRef , TH2D* rf, const TVector3 );
00160   class TVector3 propagateTrack( const reco::TrackRef );
00161   class TVector3 propagateTrackToHCAL( const reco::TrackRef );
00162   void findGoodShowerTracks(std::vector<int>& goodShowerTracks);
00163   bool nearGoodShowerTrack( const reco::TrackRef , std::vector<int> goodShowerTracks );
00164   int nExpectedInnerHits(const reco::TrackRef);
00165   int nExpectedOuterHits(const reco::TrackRef);
00166   int nLayers(const reco::TrackRef);
00167   bool isValidVertex();
00168   void findDuplicateTracks();
00169   int vetoTrack( int i1 , int i2 );
00170 };
00171 
00172 #endif // TCMETAlgo_h
00173