CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h

Go to the documentation of this file.
00001 #ifndef SimDataFormats_TrackingVertex_h
00002 #define SimDataFormats_TrackingVertex_h
00003 
00013 #include "DataFormats/Common/interface/RefVector.h"
00014 #include "DataFormats/Math/interface/LorentzVector.h"
00015 #include "DataFormats/Math/interface/Point3D.h"
00016 
00017 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
00018 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00019 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
00020 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
00021 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00022 
00023 class TrackingVertex
00024 {
00025 
00026     friend std::ostream& operator<< (std::ostream& s, const TrackingVertex & tv);
00027 
00028 public:
00029 
00030     typedef edm::RefVector<edm::HepMCProduct, HepMC::GenVertex > GenVertexRefVector;
00031     typedef edm::Ref<edm::HepMCProduct, HepMC::GenVertex >       GenVertexRef;
00032     typedef math::XYZTLorentzVectorD                             LorentzVector;
00033     typedef        GenVertexRefVector::iterator                  genv_iterator;
00034     typedef    std::vector<SimVertex>::const_iterator            g4v_iterator;
00035     typedef TrackingParticleRefVector::iterator                  tp_iterator;
00036 
00037 // Default constructor and constructor from values
00038     TrackingVertex();
00039     TrackingVertex(const LorentzVector &position, const bool inVolume,
00040                    const EncodedEventId e = EncodedEventId(0));
00041 
00042 // Setters
00043     void setEventId(EncodedEventId e)
00044     {
00045         eId_=e;
00046     };
00047 
00048 // Track and vertex iterators
00049     genv_iterator genVertices_begin() const; // Ref's to HepMC and Geant4
00050     genv_iterator genVertices_end()   const; // vertices associated with
00051     g4v_iterator   g4Vertices_begin() const; // this vertex, respectively
00052     g4v_iterator   g4Vertices_end()   const; // ....
00053 
00054     tp_iterator    daughterTracks_begin() const; // Ref's to daughter and source
00055     tp_iterator    daughterTracks_end()   const; // tracks associated with
00056     tp_iterator      sourceTracks_begin() const; // this vertex, respectively
00057     tp_iterator      sourceTracks_end()   const; // ....
00058 
00059     unsigned int nG4Vertices()     const
00060     {
00061         return     g4Vertices_.size();
00062     };
00063     unsigned int nGenVertices()    const
00064     {
00065         return    genVertices_.size();
00066     };
00067     unsigned int nDaughterTracks() const
00068     {
00069         return daughterTracks_.size();
00070     };
00071     unsigned int nSourceTracks()   const
00072     {
00073         return   sourceTracks_.size();
00074     };
00075 
00076 // Add references to TrackingParticles, Geant4, and HepMC vertices to containers
00077     void addG4Vertex(     const SimVertex&       );
00078     void addGenVertex(    const GenVertexRef&       );
00079     void addDaughterTrack(const TrackingParticleRef&);
00080     void addParentTrack(  const TrackingParticleRef&);
00081     void clearDaughterTracks();
00082     void clearParentTracks();
00083 
00084 // Getters for RefVectors
00085     const std::vector<SimVertex>&        g4Vertices() const;
00086     const GenVertexRefVector&           genVertices() const;
00087     const TrackingParticleRefVector&   sourceTracks() const;
00088     const TrackingParticleRefVector& daughterTracks() const;
00089 
00090 // Getters for other info
00091     const LorentzVector& position() const
00092     {
00093         return position_;
00094     };
00095     const EncodedEventId& eventId() const
00096     {
00097         return eId_;
00098     };
00099     const bool            inVolume() const
00100     {
00101         return inVolume_;
00102     };
00103 
00104 private:
00105 
00106     LorentzVector  position_; // Vertex position and time
00107     bool           inVolume_; // Is it inside tracker volume?
00108     EncodedEventId eId_;
00109 
00110 // References to G4 and generator vertices and TrackingParticles
00111 
00112     std::vector<SimVertex>        g4Vertices_;
00113     GenVertexRefVector           genVertices_;
00114     TrackingParticleRefVector daughterTracks_;
00115     TrackingParticleRefVector   sourceTracks_;
00116 };
00117 
00118 #endif