Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:53

0001 #ifndef SimDataFormats_TrackingVertex_h
0002 #define SimDataFormats_TrackingVertex_h
0003 
0004 /** \class TrackingVertex
0005  *
0006  * A simulated Vertex with links to TrackingParticles
0007  * for analysis of track and vertex reconstruction
0008  *
0009  *
0010  */
0011 
0012 #include "DataFormats/Common/interface/RefVector.h"
0013 #include "DataFormats/Math/interface/LorentzVector.h"
0014 #include "DataFormats/Math/interface/Point3D.h"
0015 
0016 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0017 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0018 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
0019 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0020 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0021 
0022 class TrackingVertex {
0023   friend std::ostream& operator<<(std::ostream& s, const TrackingVertex& tv);
0024 
0025 public:
0026   typedef edm::RefVector<edm::HepMCProduct, HepMC::GenVertex> GenVertexRefVector;
0027   typedef edm::Ref<edm::HepMCProduct, HepMC::GenVertex> GenVertexRef;
0028   typedef math::XYZTLorentzVectorD LorentzVector;
0029   typedef GenVertexRefVector::iterator genv_iterator;
0030   typedef std::vector<SimVertex>::const_iterator g4v_iterator;
0031   typedef TrackingParticleRefVector::iterator tp_iterator;
0032 
0033   // Default constructor and constructor from values
0034   TrackingVertex();
0035   TrackingVertex(const LorentzVector& position, const bool inVolume, const EncodedEventId e = EncodedEventId(0));
0036 
0037   // Setters
0038   void setEventId(EncodedEventId e) { eId_ = e; };
0039 
0040   // Track and vertex iterators
0041   genv_iterator genVertices_begin() const;  // Ref's to HepMC and Geant4
0042   genv_iterator genVertices_end() const;    // vertices associated with
0043   g4v_iterator g4Vertices_begin() const;    // this vertex, respectively
0044   g4v_iterator g4Vertices_end() const;      // ....
0045 
0046   tp_iterator daughterTracks_begin() const;  // Ref's to daughter and source
0047   tp_iterator daughterTracks_end() const;    // tracks associated with
0048   tp_iterator sourceTracks_begin() const;    // this vertex, respectively
0049   tp_iterator sourceTracks_end() const;      // ....
0050 
0051   unsigned int nG4Vertices() const { return g4Vertices_.size(); };
0052   unsigned int nGenVertices() const { return genVertices_.size(); };
0053   unsigned int nDaughterTracks() const { return daughterTracks_.size(); };
0054   unsigned int nSourceTracks() const { return sourceTracks_.size(); };
0055 
0056   // Add references to TrackingParticles, Geant4, and HepMC vertices to containers
0057   void addG4Vertex(const SimVertex&);
0058   void addGenVertex(const GenVertexRef&);
0059   void addDaughterTrack(const TrackingParticleRef&);
0060   void addParentTrack(const TrackingParticleRef&);
0061   void clearDaughterTracks();
0062   void clearParentTracks();
0063 
0064   // Getters for RefVectors
0065   const std::vector<SimVertex>& g4Vertices() const;
0066   const GenVertexRefVector& genVertices() const;
0067   const TrackingParticleRefVector& sourceTracks() const;
0068   const TrackingParticleRefVector& daughterTracks() const;
0069 
0070   // Getters for other info
0071   const LorentzVector& position() const { return position_; };
0072   const EncodedEventId& eventId() const { return eId_; };
0073   const bool inVolume() const { return inVolume_; };
0074 
0075 private:
0076   LorentzVector position_;  // Vertex position and time
0077   bool inVolume_;           // Is it inside tracker volume?
0078   EncodedEventId eId_;
0079 
0080   // References to G4 and generator vertices and TrackingParticles
0081 
0082   std::vector<SimVertex> g4Vertices_;
0083   GenVertexRefVector genVertices_;
0084   TrackingParticleRefVector daughterTracks_;
0085   TrackingParticleRefVector sourceTracks_;
0086 };
0087 
0088 #endif