CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h

Go to the documentation of this file.
00001 #ifndef SimDataFormats_TrackingParticle_h
00002 #define SimDataFormats_TrackingParticle_h
00003 
00008 #include <map>
00009 
00010 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
00011 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00012 #include "SimDataFormats/TrackingAnalysis/interface/ParticleBase.h"
00013 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h"
00014 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
00015 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00016 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00017 #include "DataFormats/DetId/interface/DetId.h"
00018 
00019 namespace HepMC
00020 {
00021 class GenParticle;
00022 }
00023 class TrackingVertex;
00024 
00025 class TrackingParticle : public ParticleBase
00026 {
00027 
00028     friend std::ostream& operator<< (std::ostream& s, TrackingParticle const & tp);
00029 
00030 public:
00031 
00033     typedef edm::RefVector<edm::HepMCProduct, HepMC::GenParticle > GenParticleRefVector;
00034     typedef edm::Ref<edm::HepMCProduct, HepMC::GenParticle >       GenParticleRef;
00035     typedef GenParticleRefVector::iterator                         genp_iterator;
00036     typedef std::vector<SimTrack>::const_iterator                  g4t_iterator;
00037 
00038     typedef std::vector<TrackingVertex>                TrackingVertexCollection;
00039     typedef edm::Ref<TrackingVertexCollection>         TrackingVertexRef;
00040     typedef edm::RefVector<TrackingVertexCollection>   TrackingVertexRefVector;
00041     typedef TrackingVertexRefVector::iterator          tv_iterator;
00042 
00043     typedef std::multimap<DetId::Detector, PSimHit> DetectorToPSimHit;
00044 
00046     TrackingParticle() {}
00047     
00049     TrackingParticle( char q, const LorentzVector & p4, const Point & vtx,
00050                       double t, const int pdgId,  const int status, const EncodedEventId eventId);
00051 
00052     // destructor
00053     ~TrackingParticle();
00054 
00056     int pdgId() const
00057     {
00058         return pdgId_;
00059     }
00060     EncodedEventId eventId() const
00061     {
00062         return eventId_;
00063     }
00064 
00066     genp_iterator genParticle_begin() const;
00067     genp_iterator genParticle_end()   const;
00068     g4t_iterator  g4Track_begin()     const;
00069     g4t_iterator  g4Track_end()       const;
00070 
00072     const std::vector<PSimHit>::const_iterator  pSimHit_begin() const;
00074     const std::vector<PSimHit>::const_iterator  pSimHit_end()   const;
00075 
00076     // Setters for G4 and HepMC
00077     void addG4Track(const SimTrack&);
00078     void addGenParticle(const GenParticleRef&);
00079 
00080     void addPSimHit(const PSimHit&);
00081     void setParentVertex(const TrackingVertexRef&);
00082     void addDecayVertex(const TrackingVertexRef&);
00083     void clearParentVertex();
00084     void clearDecayVertices();
00085     void setMatchedHit(const int&);
00086     void setVertex(const Point & vtx, double t);
00087 
00088     // Getters for Embd and Sim Tracks
00089     const GenParticleRefVector&     genParticle() const
00090     {
00091         return genParticles_;
00092     }
00093     const std::vector<SimTrack>&       g4Tracks() const
00094     {
00095         return g4Tracks_ ;
00096     }
00097     const TrackingVertexRef&       parentVertex() const
00098     {
00099         return parentVertex_;
00100     }
00102     const std::vector<PSimHit>&    trackPSimHit() const
00103     {
00104         return trackPSimHit_;
00105     }
00106 
00107     // PSimHits discriminated by subdetector
00108     std::vector<PSimHit> trackPSimHit(DetId::Detector) const;
00109 
00110     // Accessors for vector of decay vertices
00111     const TrackingVertexRefVector& decayVertices() const
00112     {
00113         return decayVertices_;
00114     }
00115     tv_iterator decayVertices_begin()       const
00116     {
00117         return decayVertices_.begin();
00118     }
00119     tv_iterator decayVertices_end()         const
00120     {
00121         return decayVertices_.end();
00122     }
00123     int matchedHit() const
00124     {
00125         return matchedHit_;
00126     }
00127 
00128 private:
00129 
00131     float t_;
00133     int pdgId_;
00134     EncodedEventId eventId_;
00135 
00137     int matchedHit_;
00138 
00140     std::vector<SimTrack> g4Tracks_;
00141     GenParticleRefVector  genParticles_;
00142 
00143     // TrackPSimHitRefVector trackPSimHit_;
00144     std::vector<PSimHit> trackPSimHit_;
00145 
00146     // Source and decay vertices
00147     TrackingVertexRef parentVertex_;
00148     TrackingVertexRefVector decayVertices_;
00149 };
00150 
00151 #endif // SimDataFormats_TrackingParticle_H