00001 #ifndef RecoAlgos_CosmicTrackSelector_h 00002 #define RecoAlgos_CosmicTrackSelector_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/EventPrincipal.h" 00022 #include "FWCore/Framework/interface/Event.h" 00023 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00024 #include "FWCore/Utilities/interface/InputTag.h" 00025 00026 #include "DataFormats/TrackReco/interface/TrackFwd.h" 00027 #include "DataFormats/TrackReco/interface/Track.h" 00028 #include "DataFormats/TrackReco/interface/TrackExtra.h" 00029 #include "DataFormats/VertexReco/interface/VertexFwd.h" 00030 #include "DataFormats/BeamSpot/interface/BeamSpot.h" 00031 #include "TrackingTools/PatternTools/interface/Trajectory.h" 00032 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" 00033 00034 00035 namespace reco { namespace modules { 00036 00037 class CosmicTrackSelector : public edm::EDProducer { 00038 private: 00039 public: 00040 // constructor 00041 explicit CosmicTrackSelector( const edm::ParameterSet & cfg ) ; 00042 // destructor 00043 virtual ~CosmicTrackSelector() ; 00044 00045 private: 00046 typedef math::XYZPoint Point; 00047 // process one event 00048 void produce( edm::Event& evt, const edm::EventSetup& es ) ; 00049 // return class, or -1 if rejected 00050 bool select (const reco::BeamSpot &vertexBeamSpot, const reco::Track &tk); 00051 // source collection label 00052 edm::InputTag src_; 00053 edm::InputTag beamspot_; 00054 // copy only the tracks, not extras and rechits (for AOD) 00055 bool copyExtras_; 00056 // copy also trajectories and trajectory->track associations 00057 bool copyTrajectories_; 00058 00059 // save all the tracks 00060 bool keepAllTracks_; 00061 // do I have to set a quality bit? 00062 bool setQualityBit_; 00063 TrackBase::TrackQuality qualityToSet_; 00064 00065 // parameters for adapted optimal cuts on chi2 and primary vertex compatibility 00066 std::vector<double> res_par_; 00067 double chi2n_par_; 00068 00069 // Impact parameter absolute cuts 00070 double max_d0_; 00071 double max_z0_; 00072 // Trackk parameter cuts 00073 double min_pt_; 00074 double max_eta_; 00075 // Cut on number of valid hits 00076 uint32_t min_nHit_; 00077 // Cut on number of valid Pixel hits 00078 uint32_t min_nPixelHit_; 00079 // Cuts on numbers of layers with hits/3D hits/lost hits. 00080 uint32_t min_layers_; 00081 uint32_t min_3Dlayers_; 00082 uint32_t max_lostLayers_; 00083 00084 // storage 00085 std::auto_ptr<reco::TrackCollection> selTracks_; 00086 std::auto_ptr<reco::TrackExtraCollection> selTrackExtras_; 00087 std::auto_ptr< TrackingRecHitCollection> selHits_; 00088 std::auto_ptr< std::vector<Trajectory> > selTrajs_; 00089 std::auto_ptr< std::vector<const Trajectory *> > selTrajPtrs_; 00090 std::auto_ptr< TrajTrackAssociationCollection > selTTAss_; 00091 reco::TrackRefProd rTracks_; 00092 reco::TrackExtraRefProd rTrackExtras_; 00093 TrackingRecHitRefProd rHits_; 00094 edm::RefProd< std::vector<Trajectory> > rTrajectories_; 00095 std::vector<reco::TrackRef> trackRefs_; 00096 00097 }; 00098 00099 } } 00100 00101 #endif