Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-16 23:02:14

0001 #ifndef VertexHistory_h
0002 #define VertexHistory_h
0003 
0004 #include "DataFormats/VertexReco/interface/Vertex.h"
0005 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0006 
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/EventSetup.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 
0013 #include "SimDataFormats/Associations/interface/VertexAssociation.h"
0014 #include "SimTracker/TrackHistory/interface/HistoryBase.h"
0015 #include "SimTracker/TrackHistory/interface/Utils.h"
0016 
0017 //! This class traces the simulated and generated history of a given track.
0018 class VertexHistory : public HistoryBase {
0019 public:
0020   //! Constructor by pset.
0021   /* Creates a VertexHistory with association given by pset.
0022 
0023      /param[in] config with the configuration values
0024   */
0025   VertexHistory(const edm::ParameterSet &, edm::ConsumesCollector);
0026 
0027   //! Pre-process event information (for accessing reconstruction information)
0028   void newEvent(const edm::Event &, const edm::EventSetup &);
0029 
0030   //! Evaluate track history using a TrackingParticleRef.
0031   /* Return false when the history cannot be determined upto a given depth.
0032      If not depth is pass to the function no restriction are apply to it.
0033 
0034      /param[in] trackingVertexRef of a simulated track
0035      /param[in] depth of the vertex history
0036      /param[out] boolean that is true when history can be determined
0037   */
0038   bool evaluate(TrackingVertexRef tvr) {
0039     if (enableSimToReco_) {
0040       std::pair<reco::VertexBaseRef, double> result = match(tvr, simToReco_, bestMatchByMaxValue_);
0041       recovertex_ = result.first;
0042       quality_ = result.second;
0043     }
0044     return HistoryBase::evaluate(tvr);
0045   }
0046 
0047   //! Evaluate reco::Vertex history using a given association.
0048   /* Return false when the track association is not possible (fake track).
0049 
0050      /param[in] VertexRef to a reco::track
0051      /param[out] boolean that is false when a fake track is detected
0052   */
0053   bool evaluate(reco::VertexBaseRef);
0054 
0055   //! Return a reference to the reconstructed track.
0056   const reco::VertexBaseRef &recoVertex() const { return recovertex_; }
0057 
0058   //! Return the quality of the match.
0059   double quality() const { return quality_; }
0060 
0061 private:
0062   bool bestMatchByMaxValue_;
0063 
0064   bool enableRecoToSim_, enableSimToReco_;
0065 
0066   double quality_;
0067 
0068   edm::InputTag vertexProducer_;
0069 
0070   edm::InputTag trackingTruth_;
0071 
0072   edm::InputTag vertexAssociator_;
0073 
0074   reco::VertexBaseRef recovertex_;
0075 
0076   reco::VertexRecoToSimCollection recoToSim_;
0077 
0078   reco::VertexSimToRecoCollection simToReco_;
0079 };
0080 
0081 #endif