CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoTracker/FinalTrackSelectors/interface/TrackMultiSelector.h

Go to the documentation of this file.
00001 #ifndef RecoAlgos_TrackMultiSelector_h
00002 #define RecoAlgos_TrackMultiSelector_h
00003 
00015 #include <utility>
00016 #include <vector>
00017 #include <memory>
00018 #include <algorithm>
00019 #include <map>
00020 #include "FWCore/Framework/interface/EDProducer.h"
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00023 #include "FWCore/Utilities/interface/InputTag.h"
00024 
00025 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00026 #include "DataFormats/TrackReco/interface/Track.h"
00027 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00028 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00029 #include "DataFormats/VertexReco/interface/Vertex.h"
00030 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00031 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00032 
00033 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00034 
00035 namespace reco { namespace modules {
00036 
00037     class TrackMultiSelector : public edm::EDProducer {
00038         private:
00039             struct Block {
00040                 std::pair<double,double> pt;
00041                 std::pair<uint32_t,uint32_t>   vlayers, lhits;
00042                 std::pair<double,double> chi2n;
00043                 double d0, dz,d0Rel,dzRel;
00044 
00045                 explicit Block(const edm::ParameterSet & cfg) ;
00046                 private:
00047                 template<typename T> std::pair<T,T> p2p(const edm::ParameterSet & cfg, const std::string name);
00048             };
00049         public:
00051             explicit TrackMultiSelector( const edm::ParameterSet & cfg ) ;
00053             virtual ~TrackMultiSelector() ;
00054 
00055         private:
00056             typedef math::XYZPoint Point;
00058             void produce( edm::Event& evt, const edm::EventSetup& es ) override;
00060             short select ( const reco::Track &tk, const reco::BeamSpot &beamSpot, const std::vector<Point> &points);
00061             void selectVertices ( const reco::VertexCollection &vtxs, std::vector<Point> &points);
00062             inline bool testVtx ( const reco::Track &tk, const reco::BeamSpot  &beamSpot,
00063                                   const std::vector<Point> &points, const Block &cut);
00065             edm::InputTag src_;
00066             edm::InputTag vertices_;
00067             edm::InputTag beamspot_;
00068             double        beamspotDZsigmas_, beamspotD0_;
00070             bool copyExtras_;
00072             bool copyTrajectories_;
00074             bool splitOutputs_;
00076             std::vector<Block> blocks_; 
00078             int32_t vtxNumber_;
00079             size_t  vtxTracks_;
00080             double  vtxChi2Prob_;
00082             std::vector<std::string> labels_;
00084             std::auto_ptr<reco::TrackCollection> *selTracks_;
00085             std::auto_ptr<reco::TrackExtraCollection> *selTrackExtras_;
00086             std::auto_ptr< TrackingRecHitCollection>  *selHits_;
00087             std::auto_ptr< std::vector<Trajectory> > *selTrajs_;
00088             std::auto_ptr< TrajTrackAssociationCollection >  *selTTAss_;
00089             std::vector<reco::TrackRefProd> rTracks_;
00090             std::vector<reco::TrackExtraRefProd> rTrackExtras_;
00091             std::vector<TrackingRecHitRefProd> rHits_;
00092             std::vector< edm::RefProd< std::vector<Trajectory> > > rTrajectories_;
00093             std::vector< std::pair<short, reco::TrackRef> > whereItWent_;
00094 
00095     };
00096 
00097 } }
00098 
00099 // template method to be implemented here?
00100 template<typename T> std::pair<T,T> reco::modules::TrackMultiSelector::Block::p2p(const edm::ParameterSet & cfg, const std::string name) {
00101     typedef typename std::vector<T> Ts;
00102     Ts ret = cfg.getParameter<Ts>(name);
00103     if (ret.size() != 2) throw cms::Exception("Invalid configuration") << "Parameter '" << name << "' must be given as {min,max}";
00104     return std::pair<T,T>(ret[0],ret[1]);
00105 }
00106 #endif