00001 #ifndef VertexHistory_h 00002 #define VertexHistory_h 00003 00004 #include "DataFormats/VertexReco/interface/Vertex.h" 00005 #include "DataFormats/VertexReco/interface/VertexFwd.h" 00006 00007 #include "FWCore/Framework/interface/Event.h" 00008 #include "FWCore/Framework/interface/ESHandle.h" 00009 #include "FWCore/Framework/interface/EventSetup.h" 00010 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00011 00012 #include "SimTracker/TrackHistory/interface/HistoryBase.h" 00013 #include "SimTracker/TrackHistory/interface/Utils.h" 00014 #include "SimTracker/VertexAssociation/interface/VertexAssociatorBase.h" 00015 00017 class VertexHistory : public HistoryBase 00018 { 00019 00020 public: 00021 00023 /* Creates a VertexHistory with association given by pset. 00024 00025 /param[in] config with the configuration values 00026 */ 00027 VertexHistory(const edm::ParameterSet &); 00028 00030 void newEvent(const edm::Event &, const edm::EventSetup &); 00031 00033 /* Return false when the history cannot be determined upto a given depth. 00034 If not depth is pass to the function no restriction are apply to it. 00035 00036 /param[in] trackingVertexRef of a simulated track 00037 /param[in] depth of the vertex history 00038 /param[out] boolean that is true when history can be determined 00039 */ 00040 bool evaluate(TrackingVertexRef tvr) 00041 { 00042 if ( enableSimToReco_ ) 00043 { 00044 00045 std::pair<reco::VertexBaseRef, double> result = match(tvr, simToReco_, bestMatchByMaxValue_); 00046 recovertex_ = result.first; 00047 quality_ = result.second; 00048 } 00049 return HistoryBase::evaluate(tvr); 00050 } 00051 00052 00054 /* Return false when the track association is not possible (fake track). 00055 00056 /param[in] VertexRef to a reco::track 00057 /param[out] boolean that is false when a fake track is detected 00058 */ 00059 bool evaluate (reco::VertexBaseRef); 00060 00062 const reco::VertexBaseRef & recoVertex() const 00063 { 00064 return recovertex_; 00065 } 00066 00068 double quality() const 00069 { 00070 return quality_; 00071 } 00072 00073 00074 private: 00075 00076 bool bestMatchByMaxValue_; 00077 00078 bool enableRecoToSim_, enableSimToReco_; 00079 00080 double quality_; 00081 00082 edm::InputTag trackProducer_; 00083 00084 edm::InputTag vertexProducer_; 00085 00086 edm::InputTag trackingTruth_; 00087 00088 std::string trackAssociator_; 00089 00090 std::string vertexAssociator_; 00091 00092 reco::VertexBaseRef recovertex_; 00093 00094 reco::VertexRecoToSimCollection recoToSim_; 00095 00096 reco::VertexSimToRecoCollection simToReco_; 00097 }; 00098 00099 #endif