CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/RecoParticleFlow/PFTracking/interface/PFDisplacedVertexHelper.h

Go to the documentation of this file.
00001 #ifndef RecoParticleFlow_PFTracking_PFDisplacedVertexHelper_h
00002 #define RecoParticleFlow_PFTracking_PFDisplacedVertexHelper_h 
00003 
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00007 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h"
00008 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00009 #include "DataFormats/TrackReco/interface/Track.h"
00010 
00012 
00017 class PFDisplacedVertexHelper {
00018 
00019  public:
00020 
00021   PFDisplacedVertexHelper(); 
00022   ~PFDisplacedVertexHelper();
00023 
00025   void setTracksSelector(const edm::ParameterSet& ps){
00026     tracksSelector_ = TracksSelector(ps);
00027   };
00028 
00030   void setVertexIdentifier(const edm::ParameterSet& ps){
00031     vertexIdentifier_ = VertexIdentifier(ps);
00032   };
00033 
00035   void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle, 
00036                         edm::Handle< reco::BeamSpot > beamSpotHandle);
00037 
00038 
00040   bool isTrackSelected(const reco::Track& trk, 
00041                        const reco::PFDisplacedVertex::VertexTrackType vertexTrackType) const;
00042 
00044   reco::PFDisplacedVertex::VertexType identifyVertex(const reco::PFDisplacedVertex& v) const;
00045 
00047   math::XYZPoint primaryVertex() const { return pvtx_;}
00048 
00049   void Dump(std::ostream& out = std::cout) const;
00050 
00051  private:
00052 
00053 
00055   int    lambdaCP(const reco::PFDisplacedVertex& v) const;
00056   bool isKaonMass(const reco::PFDisplacedVertex& v) const;
00057 
00058 
00060   struct TracksSelector {
00061     TracksSelector() : 
00062       bSelectTracks_(false),
00063       nChi2_min_(0), nChi2_max_(100), 
00064       pt_min_(0), dxy_min_(0), 
00065       nHits_min_(3), nOuterHits_max_(100),
00066       quality_("loose"){}
00067   
00068     TracksSelector(const edm::ParameterSet& ps){
00069       bSelectTracks_  = ps.getParameter<bool>("bSelectTracks");
00070       nChi2_min_      = ps.getParameter<double>("nChi2_min");
00071       nChi2_max_      = ps.getParameter<double>("nChi2_max");
00072       pt_min_         = ps.getParameter<double>("pt_min");
00073       dxy_min_        = ps.getParameter<double>("dxy_min");
00074       nHits_min_      = ps.getParameter<int>("nHits_min");
00075       nOuterHits_max_ = ps.getParameter<int>("nOuterHits_max");
00076       std::string quality_ = ps.getParameter<std::string>("quality");
00077     }
00078     
00079     bool selectTracks() const {return bSelectTracks_;}
00080     double nChi2_min() const {return nChi2_min_;}
00081     double nChi2_max() const {return nChi2_max_;}
00082     double pt_min() const {return pt_min_;}
00083     double dxy_min() const {return dxy_min_;}
00084     int nHits_min() const {return nHits_min_;}
00085     int nOuterHits_max() const {return nOuterHits_max_;}
00086     std::string quality() const {return quality_;}
00087     double dxy(const reco::Track& trk) const {return trk.dxy(pvtx_);}
00088 
00089     bool bSelectTracks_;
00090     double nChi2_min_;
00091     double nChi2_max_;
00092     double pt_min_;
00093     double dxy_min_;
00094     int nHits_min_;
00095     int nOuterHits_max_;
00096     math::XYZPoint pvtx_;
00097     std::string quality_;
00098 
00099     void Dump(std::ostream& out = std::cout) const {
00100       if(! out ) return;
00101       std::string s =  bSelectTracks_ ? "On" : "Off";
00102 
00103       out << "" << std::endl;
00104       out << "      ==== The TrackerSelector is " << s.data() << " ====    " << std::endl;
00105 
00106       out << " nChi2_min_ = " << nChi2_min_
00107           << " nChi2_max_ = " << nChi2_max_ << std::endl
00108           << " pt_min_ = " << pt_min_
00109           << " dxy_min_ = " << dxy_min_ << std::endl
00110           << " nHits_min_ = " << nHits_min_  
00111           << " nOuterHits_max_ = " << nOuterHits_max_ << std::endl
00112           << " quality = " << quality_ << std::endl; 
00113     
00114     }
00115 
00116   };
00117 
00119   struct VertexIdentifier {
00120     VertexIdentifier():
00121       bIdentifyVertices_(false),
00122       pt_min_(0.2),
00123       pt_kink_min_(1.4),
00124       looper_eta_max_(0.1),
00125       logPrimSec_min_(0.2){
00126 
00127       double m[] = {0.050, 0.470, 0.525, 0.470, 0.525, 1.107, 1.125, 0.200};
00128       std::vector< double > masses(m, m+8);
00129       masses_ = masses;
00130 
00131       double a[] = {60, 40};
00132       std::vector< double > angles(a, a+1);
00133       angles_ = angles;
00134 
00135     };
00136   
00137     VertexIdentifier(const edm::ParameterSet& ps){
00138       bIdentifyVertices_  = ps.getParameter<bool>("bIdentifyVertices");
00139       angles_             = ps.getParameter< std::vector<double> >("angles");
00140       masses_             = ps.getParameter< std::vector<double> >("masses");
00141       pt_min_             = ps.getParameter<double>("pt_min");
00142       pt_kink_min_        = ps.getParameter<double>("pt_kink_min");
00143       looper_eta_max_     = ps.getParameter<double>("looper_eta_max");
00144       logPrimSec_min_     = ps.getParameter<double>("logPrimSec_min");
00145     }
00146 
00147     bool identifyVertices() const {return bIdentifyVertices_;}
00148 
00149     double angle_max() const {return angles_[0];}
00150     double angle_V0Conv_max() const {return angles_[1];}
00151     
00152     double pt_min() const {return pt_min_;}
00153     double pt_kink_min() const {return pt_kink_min_;}
00154 
00155     double mConv_max() const {return masses_[0];}
00156     double mK0_min() const {return masses_[1];}
00157     double mK0_max() const {return masses_[2];}
00158     double mK_min() const {return masses_[3];}
00159     double mK_max() const {return masses_[4];}
00160     double mLambda_min() const {return masses_[5];}
00161     double mLambda_max() const {return masses_[6];}
00162     double mNucl_min() const {return masses_[7];}
00163     
00164     double looper_eta_max() const {return looper_eta_max_;}
00165     double logPrimSec_min() const {return logPrimSec_min_;}
00166 
00167     bool bIdentifyVertices_;
00168     std::vector<double> angles_;
00169     std::vector<double> masses_;
00170     double pt_min_;
00171     double pt_kink_min_;
00172     double looper_eta_max_;
00173     double logPrimSec_min_;
00174 
00175     void Dump(std::ostream& out = std::cout) const {
00176       if(! out ) return;
00177       std::string s =  bIdentifyVertices_ ? "On" : "Off";
00178       out << "" << std::endl;
00179       out << "      ==== The Vertex Identifier is " << s.data() << " ====    " << std::endl;
00180 
00181       out << " pt_min_ = " << pt_min_
00182           << " pt_kink_min_ = " << pt_kink_min_ << std::endl
00183           << " looper_eta_max_ = " << looper_eta_max_  
00184           << " log10(P_Prim/P_Sec)_min " << logPrimSec_min_ << std::endl   
00185           << " Mass_conv > " << mConv_max() << std::endl
00186           << " " << mK0_min() << " < Mass_K0 < " << mK0_max() << std::endl
00187           << " " << mK_min() << " < Mass_K+- < " << mK_max() << std::endl
00188           << " " << mLambda_min() << " < Mass_Lambda < " << mLambda_max() << std::endl
00189           << " Mass_Nucl_ee > " << mNucl_min() << std::endl
00190           << " angle_max = " << angle_max() 
00191           << " angle_V0Conv_max = " << angle_V0Conv_max()  << std::endl; 
00192     
00193     }
00194 
00195 
00196 
00197   };
00198 
00199 
00200   TracksSelector tracksSelector_;
00201   VertexIdentifier vertexIdentifier_;
00203   math::XYZPoint pvtx_;
00204 
00206   static const double pion_mass2;
00207   static const double muon_mass2;
00208   static const double proton_mass2;
00209 
00210 };
00211 
00212 #endif
00213 
00214