00001 #ifndef TrackHistory_h 00002 #define TrackHistory_h 00003 00004 #include "DataFormats/TrackReco/interface/TrackFwd.h" 00005 00006 #include "FWCore/Framework/interface/Event.h" 00007 #include "FWCore/Framework/interface/ESHandle.h" 00008 #include "FWCore/Framework/interface/EventSetup.h" 00009 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00010 00011 #include "SimTracker/TrackAssociation/interface/TrackAssociatorBase.h" 00012 #include "SimTracker/TrackHistory/interface/HistoryBase.h" 00013 #include "SimTracker/TrackHistory/interface/Utils.h" 00014 00016 class TrackHistory : public HistoryBase 00017 { 00018 00019 public: 00020 00022 /* Creates a TrackHistory with association given by pset. 00023 00024 /param[in] pset with the configuration values 00025 */ 00026 TrackHistory(const edm::ParameterSet &); 00027 00029 void newEvent(const edm::Event &, const edm::EventSetup &); 00030 00032 /* Return false when the history cannot be determined upto a given depth. 00033 If not depth is pass to the function no restriction are apply to it. 00034 00035 /param[in] TrackingParticleRef of a simulated track 00036 /param[in] depth of the track history 00037 /param[out] boolean that is true when history can be determined 00038 */ 00039 bool evaluate(TrackingParticleRef tpr) 00040 { 00041 if ( enableSimToReco_ ) 00042 { 00043 std::pair<reco::TrackBaseRef, double> result = match(tpr, simToReco_, bestMatchByMaxValue_); 00044 recotrack_ = result.first; 00045 quality_ = result.second; 00046 } 00047 return HistoryBase::evaluate(tpr); 00048 } 00049 00050 00052 /* Return false when the track association is not possible (fake track). 00053 00054 /param[in] TrackRef to a reco::track 00055 /param[out] boolean that is false when a fake track is detected 00056 */ 00057 bool evaluate (reco::TrackBaseRef); 00058 00060 const reco::TrackBaseRef & recoTrack() const 00061 { 00062 return recotrack_; 00063 } 00064 00065 double quality() const 00066 { 00067 return quality_; 00068 } 00069 00070 private: 00071 00072 bool newEvent_; 00073 00074 bool bestMatchByMaxValue_; 00075 00076 bool enableRecoToSim_, enableSimToReco_; 00077 00078 double quality_; 00079 00080 edm::InputTag trackProducer_; 00081 00082 edm::InputTag trackingTruth_; 00083 00084 std::string trackAssociator_; 00085 00086 reco::TrackBaseRef recotrack_; 00087 00088 reco::RecoToSimCollection recoToSim_; 00089 00090 reco::SimToRecoCollection simToReco_; 00091 00092 }; 00093 00094 #endif