00001 // $Id: GiGaTrajectory.h,v 1.24 2008/10/20 10:24:48 robbep Exp $ 00002 // ============================================================================ 00003 // CVS tag $Name: v19r4 $ 00004 // ============================================================================ 00005 // $Log: GiGaTrajectory.h,v $ 00006 // Revision 1.24 2008/10/20 10:24:48 robbep 00007 // Add link to MCParticle 00008 // 00009 // Revision 1.23 2005/12/16 19:50:27 gcorti 00010 // adapt to LHCb namespace 00011 // 00012 // Revision 1.22 2004/04/07 15:23:08 gcorti 00013 // transfer signal info 00014 // 00015 // Revision 1.21 2004/02/22 19:01:50 ibelyaev 00016 // add new data fields to GiGaTrajectoryPoint 00017 // 00018 // Revision 1.20 2004/02/20 18:13:34 ibelyaev 00019 // major update in GiGaBase and GiGaTrajectory 00020 // 00021 // ============================================================================ 00022 #ifndef GIGA_GIGATRAJECTORY_H 00023 #define GIGA_GIGATRAJECTORY_H 1 00024 // ============================================================================ 00026 #include <vector> 00028 #include "G4VTrajectory.hh" 00030 #include "GiGa/GiGaTrajectoryPoint.h" 00032 class G4ParticleDefinition; 00033 class G4Track ; 00034 class G4Step ; 00035 class G4VProcess ; 00036 namespace LHCb { 00037 class HepMCEvent ; 00038 class MCParticle ; 00039 } 00040 00042 00053 class GiGaTrajectory: public G4VTrajectory , 00054 public std::vector<GiGaTrajectoryPoint*> 00055 { 00056 public: 00057 00059 GiGaTrajectory ( ); 00060 00064 GiGaTrajectory ( const G4Track* track ); 00065 00069 GiGaTrajectory ( const GiGaTrajectory & right ); 00070 00072 virtual ~GiGaTrajectory(); 00073 00075 void* operator new ( size_t ) ; 00076 00078 void operator delete ( void* ) ; 00079 00083 virtual GiGaTrajectory* clone() const ; 00084 00086 inline int operator == (const GiGaTrajectory& right) const 00087 {return ( &right == this );} 00088 00090 inline const int& trackID () const 00091 { return m_trackID ; } 00092 inline const int& parentID () const 00093 { return m_parentID ; } 00094 inline const CLHEP::HepLorentzVector& fourMomentum () const 00095 { return momentum() ; } 00096 inline const CLHEP::HepLorentzVector& momentum () const 00097 { return m_4vect ; } 00098 inline const CLHEP::HepLorentzVector& Get4Momentum () const 00099 { return fourMomentum() ; } 00101 bool hasOscillated() const 00102 { return m_hasOscillated ; } 00103 bool isSignal () const 00104 { return m_isSignal ; } 00105 int signalBarcode() const 00106 { return m_signalBarcode ; } 00107 LHCb::HepMCEvent * pHepMCEvent () const 00108 { return m_pHepMCEvent ; } 00109 LHCb::MCParticle * motherMCParticle() const 00110 { return m_motherMCParticle ; } 00111 00113 G4int GetTrackID () const 00114 { return trackID () ; } 00115 G4int GetParentID () const 00116 { return parentID() ; } 00117 00118 inline const G4ParticleDefinition* partDef () const 00119 { return m_partDef ; } 00121 virtual void ShowTrajectory ( std::ostream& os = std::cout ) const; 00122 00123 virtual void DrawTrajectory ( G4int i_mode=0 ) const ; 00124 virtual void AppendStep ( const G4Step* ) ; 00125 virtual void MergeTrajectory ( G4VTrajectory* ) ; 00127 virtual int GetPointEntries( ) const 00128 { return size() ; } 00129 virtual G4VTrajectoryPoint* GetPoint ( int index ) const 00130 { return point( index ) ; } 00131 00132 G4VTrajectoryPoint* point ( int index ) const 00133 { return (size_t) index < size() ? *(begin()+index) : 0 ; } 00134 00135 00136 virtual G4String GetParticleName () const ; 00137 virtual G4double GetCharge () const ; 00138 virtual G4int GetPDGEncoding () const ; 00139 virtual G4ThreeVector GetInitialMomentum () const ; 00140 00142 inline const G4VProcess* creator() const { return m_creator ; } 00143 00145 inline void setCreator( const G4VProcess* value ) 00146 { m_creator = value ; } 00147 00148 inline void setHasOscillated( bool flag ) 00149 { m_hasOscillated = flag ; } 00150 00151 inline void setIsSignal( bool sig ) 00152 { m_isSignal = sig ; } 00153 00154 inline void setSignalBarcode( int code ) 00155 { m_signalBarcode = code ; } 00156 00157 inline void setHepMCEvent( LHCb::HepMCEvent * event ) 00158 { m_pHepMCEvent = event ; } 00159 00160 inline void setMotherMCParticle( LHCb::MCParticle * p ) 00161 { m_motherMCParticle = p ; } 00162 00163 // get the name of the creator process 00164 const std::string& processname() const ; 00165 00166 void setProcessName ( const std::string& ) {} 00167 00168 protected: 00169 00174 bool appendStep ( const G4Step* step ) ; 00175 00176 private: 00178 GiGaTrajectory& operator=( const GiGaTrajectory& ); 00179 private: 00181 int m_trackID ; 00182 int m_parentID ; 00183 const G4ParticleDefinition* m_partDef ; 00184 CLHEP::HepLorentzVector m_4vect ; 00185 const G4VProcess* m_creator ; 00186 bool m_hasOscillated ; 00187 bool m_isSignal ; 00188 int m_signalBarcode ; 00189 LHCb::HepMCEvent* m_pHepMCEvent ; 00190 LHCb::MCParticle * m_motherMCParticle ; 00192 }; 00193 // ============================================================================ 00194 00195 // ============================================================================ 00203 // ============================================================================ 00204 inline GiGaTrajectory* gigaTrajectory( G4VTrajectory* g4 ) 00205 { 00206 GiGaUtil::FastCast<G4VTrajectory,GiGaTrajectory> cast ; 00207 return cast( g4 ); 00208 }; 00209 // ============================================================================ 00210 00211 // ============================================================================ 00219 // ============================================================================ 00220 inline const GiGaTrajectory* gigaTrajectory( const G4VTrajectory* g4 ) 00221 { 00222 GiGaUtil::FastCast<const G4VTrajectory,const GiGaTrajectory> cast ; 00223 return cast( g4 ); 00224 }; 00225 // ============================================================================ 00226 00227 00228 // ============================================================================ 00229 #endif 00230 // ============================================================================ 00231 00232 00233 00234 00235 00236 00237