Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-02-05 23:51:51

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