CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/ParticleFlowReco/interface/PreId.h

Go to the documentation of this file.
00001 #ifndef PreId_H
00002 #define PreId_H
00003 
00004 // Author F. Beaudette. March 2010
00005 
00006 #include "DataFormats/Math/interface/Point3D.h"
00007 #include "DataFormats/TrackReco/interface/Track.h"
00008 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00009 #include "DataFormats/ParticleFlowReco/interface/PFRecTrackFwd.h"
00010 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
00011 
00012 namespace reco
00013 {
00014   class PreId{
00015   public:
00016         enum MatchingType {
00017         NONE=0,
00018         ECALMATCH=1,
00019         ESMATCH=2,
00020         TRACKFILTERING=3,
00021         MVA=4,
00022         FINAL=10
00023     };
00024 
00025   public:
00026   PreId(unsigned nselection=1):trackRef_(reco::TrackRef()),clusterRef_(reco::PFClusterRef()),
00027       matchingEop_(-999.),EcalPos_(math::XYZPoint()),
00028       meanShower_(math::XYZPoint()),gsfChi2_(-999.),
00029       dpt_(0.),chi2Ratio_(0.){
00030       matching_.resize(nselection,false);
00031       mva_.resize(nselection,-999.);
00032       geomMatching_.resize(5,-999.);
00033     }
00034     void setTrack(reco::TrackRef trackref)     {
00035       trackRef_ = trackref;
00036     }
00037 
00038     void setECALMatchingProperties(PFClusterRef clusterRef, const math::XYZPoint & ecalpos, const math::XYZPoint &meanShower, float deta,float dphi,float chieta,float chiphi, float chi2, float eop){
00039       clusterRef_ = clusterRef;
00040       EcalPos_ = ecalpos;
00041       meanShower_ = meanShower;
00042       geomMatching_[0] = deta;
00043       geomMatching_[1] = dphi;
00044       geomMatching_[2] = chieta;
00045       geomMatching_[3] = chiphi;
00046       geomMatching_[4] = chi2;
00047       matchingEop_= eop;      
00048     }
00049     
00050     void setTrackProperties(float newchi2, float chi2ratio,float dpt){
00051       gsfChi2_=newchi2;
00052       chi2Ratio_ = chi2ratio;
00053       dpt_ = dpt;
00054     }
00055 
00056     void setFinalDecision(bool accepted,unsigned n=0)
00057     {
00058       setMatching(FINAL,accepted,n);
00059     }
00060     void setECALMatching(bool accepted,unsigned n=0)
00061     {
00062       setMatching(ECALMATCH,accepted,n);
00063     }
00064     void setESMatching(bool accepted,unsigned n=0)
00065     {
00066       setMatching(ESMATCH,accepted,n);
00067     }
00068     void setTrackFiltering(bool accepted,unsigned n=0)
00069     {
00070       setMatching(TRACKFILTERING,accepted,n);
00071     }
00072     void setMVA(bool accepted,float mva,unsigned n=0)
00073     {
00074       setMatching(MVA,accepted,n);      
00075       if(n<mva_.size())
00076         mva_[n]=mva;
00077     }
00078     
00079     void setMatching(MatchingType type,bool result,unsigned n=0);
00080     bool matching(MatchingType type, unsigned n=0) const
00081     {
00082       if(n<matching_.size())
00083         {
00084           return matching_[n] & (1 << type);
00085         }
00086       return false;
00087     }
00088 
00090     inline const std::vector<float> & geomMatching() const {return geomMatching_;}
00091     inline float eopMatch() const {return matchingEop_;}
00092     inline float pt() const {return trackRef_->pt();}
00093     inline float eta() const {return trackRef_->eta();}
00094     inline float kfChi2() const {return trackRef_->normalizedChi2();}
00095     inline float kfNHits() const {return trackRef_->found();}
00096 
00097     const math::XYZPoint & ecalPos() const {return EcalPos_;}
00098     const math::XYZPoint & meanShower() const {return meanShower_;}
00099     
00100     inline float chi2Ratio() const {return chi2Ratio_;}
00101     inline float gsfChi2() const {return gsfChi2_;}
00102 
00103     inline bool ecalMatching(unsigned n=0) const {return matching(ECALMATCH,n);}
00104     inline bool esMatching(unsigned n=0) const {return matching(ESMATCH,n);}
00105     inline bool trackFiltered(unsigned n=0) const {return matching(TRACKFILTERING,n);}
00106     inline bool mvaSelected(unsigned n=0) const {return matching(MVA,n);}
00107     inline bool preIded(unsigned n=0) const {return matching(FINAL,n);}
00108 
00109     float mva(unsigned n=0) const;
00110     inline float dpt() const {return dpt_;}
00111     reco::TrackRef trackRef() const {return trackRef_;}
00112     PFClusterRef clusterRef() const {return clusterRef_;}
00113 
00114   private:
00115     reco::TrackRef trackRef_;
00116     PFClusterRef clusterRef_;
00117     
00118 
00119     std::vector<float> geomMatching_;
00120     float matchingEop_;
00121     math::XYZPoint EcalPos_;
00122     math::XYZPoint meanShower_;
00123 
00124     float gsfChi2_;
00125     float dpt_;
00126     float chi2Ratio_;
00127     std::vector<float> mva_;
00128 
00129 //    bool goodpreid_;
00130 //    bool TkId_;
00131 //    bool EcalMatching_;
00132 //    bool PSMatching_;
00133     std::vector<int> matching_;
00134   };
00135 } 
00136 #endif