Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes
CexmcTrackPoints Class Reference

#include <CexmcTrackPoints.hh>

Inheritance diagram for CexmcTrackPoints:
CexmcPrimitiveScorer G4VPrimitiveScorer CexmcTrackPointsInLeftRightSet CexmcTrackPointsInCalorimeter

Public Member Functions

 CexmcTrackPoints (const G4String &name)
 
void Initialize (G4HCofThisEvent *hcOfThisEvent)
 
void EndOfEvent (G4HCofThisEvent *hcOfThisEvent)
 
void DrawAll (void)
 
void PrintAll (void)
 
void clear (void)
 
- Public Member Functions inherited from CexmcPrimitiveScorer
 CexmcPrimitiveScorer (const G4String &name)
 
virtual ~CexmcPrimitiveScorer ()
 
void InitializeMessenger (void)
 
- Public Member Functions inherited from G4VPrimitiveScorer
 G4VPrimitiveScorer (G4String name, G4int depth=0)
 
virtual ~G4VPrimitiveScorer ()
 
G4int GetCollectionID (G4int)
 
void SetUnit (const G4String &unit)
 
const G4String & GetUnit () const
 
G4double GetUnitValue () const
 
void SetMultiFunctionalDetector (G4MultiFunctionalDetector *d)
 
G4MultiFunctionalDetector * GetMultiFunctionalDetector () const
 
G4String GetName () const
 
void SetFilter (G4VSDFilter *f)
 
G4VSDFilter * GetFilter () const
 
void SetVerboseLevel (G4int vl)
 
G4int GetVerboseLevel () const
 
void SetNijk (G4int i, G4int j, G4int k)
 

Protected Member Functions

G4int GetTrackId (G4Step *step)
 
G4int GetIndex (G4Step *step)
 
G4bool ProcessHits (G4Step *step, G4TouchableHistory *tHistory)
 
- Protected Member Functions inherited from CexmcPrimitiveScorer
void PrintHeader (G4int nmbOfEntries) const
 
- Protected Member Functions inherited from G4VPrimitiveScorer
void CheckAndSetUnit (const G4String &unit, const G4String &category)
 

Protected Attributes

CexmcTrackPointsCollection * eventMap
 
- Protected Attributes inherited from G4VPrimitiveScorer
G4String primitiveName
 
G4MultiFunctionalDetector * detector
 
G4VSDFilter * filter
 
G4int verboseLevel
 
G4int indexDepth
 
G4String unitName
 
G4double unitValue
 
G4int fNi
 
G4int fNj
 
G4int fNk
 

Detailed Description

Definition at line 61 of file CexmcTrackPoints.hh.

Constructor & Destructor Documentation

CexmcTrackPoints::CexmcTrackPoints ( const G4String &  name)
explicit

Definition at line 51 of file CexmcTrackPoints.cc.

51  :
52  CexmcPrimitiveScorer( name ), hcId( -1 )
53 {
54 }
CexmcPrimitiveScorer(const G4String &name)

Member Function Documentation

void CexmcTrackPoints::clear ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 134 of file CexmcTrackPoints.cc.

References G4THitsMap< T >::clear(), and eventMap.

135 {
136  eventMap->clear();
137 }
void clear()
Definition: G4THitsMap.hh:209
CexmcTrackPointsCollection * eventMap
void CexmcTrackPoints::DrawAll ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 140 of file CexmcTrackPoints.cc.

141 {
142 }
void CexmcTrackPoints::EndOfEvent ( G4HCofThisEvent *  hcOfThisEvent)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 127 of file CexmcTrackPoints.cc.

References G4VPrimitiveScorer::GetVerboseLevel(), and PrintAll().

128 {
129  if ( GetVerboseLevel() > 0 )
130  PrintAll();
131 }
G4int GetVerboseLevel() const
G4int CexmcTrackPoints::GetIndex ( G4Step *  step)
protectedvirtual

Reimplemented from G4VPrimitiveScorer.

Reimplemented in CexmcTrackPointsInLeftRightSet, and CexmcTrackPointsInCalorimeter.

Definition at line 73 of file CexmcTrackPoints.cc.

References GetTrackId().

Referenced by ProcessHits().

74 {
75  return GetTrackId( step );
76 }
G4int GetTrackId(G4Step *step)
G4int CexmcTrackPoints::GetTrackId ( G4Step *  step)
protected

Definition at line 57 of file CexmcTrackPoints.cc.

References CexmcOutputParticleDecayProductTrack, CexmcTrackInfo::GetCopyNumber(), G4Step::GetTrack(), CexmcTrackInfo::GetTrackType(), and G4Track::GetUserInformation().

Referenced by CexmcTrackPointsInCalorimeter::GetIndex(), CexmcTrackPointsInLeftRightSet::GetIndex(), and GetIndex().

58 {
59  /* NB: trackInfo for these tracks shall always exist as far as
60  * track points filter decline tracks without it */
61  CexmcTrackInfo * trackInfo( static_cast< CexmcTrackInfo * >(
62  step->GetTrack()->GetUserInformation() ) );
63 
64  G4int ret( trackInfo->GetTrackType() );
65 
67  ret += trackInfo->GetCopyNumber();
68 
69  return ret;
70 }
int G4int
Definition: G4Types.hh:78
G4VUserTrackInformation * GetUserInformation() const
G4Track * GetTrack() const
void CexmcTrackPoints::Initialize ( G4HCofThisEvent *  hcOfThisEvent)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 115 of file CexmcTrackPoints.cc.

References G4HCofThisEvent::AddHitsCollection(), G4VPrimitiveScorer::detector, eventMap, G4VPrimitiveScorer::GetCollectionID(), G4VSensitiveDetector::GetName(), and G4VPrimitiveScorer::primitiveName.

116 {
118  primitiveName );
119 
120  if ( hcId < 0 )
121  hcId = GetCollectionID( 0 );
122 
123  hcOfEvent->AddHitsCollection( hcId, eventMap );
124 }
CexmcTrackPointsCollection * eventMap
G4THitsMap< CexmcTrackPointInfo > CexmcTrackPointsCollection
G4int GetCollectionID(G4int)
G4MultiFunctionalDetector * detector
void CexmcTrackPoints::PrintAll ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Reimplemented in CexmcTrackPointsInLeftRightSet, and CexmcTrackPointsInCalorimeter.

Definition at line 145 of file CexmcTrackPoints.cc.

References G4THitsMap< T >::entries(), eventMap, G4BestUnit, G4cout, G4endl, G4THitsMap< T >::GetMap(), and CexmcPrimitiveScorer::PrintHeader().

Referenced by EndOfEvent().

146 {
147  G4int nmbOfEntries( eventMap->entries() );
148 
149  if ( nmbOfEntries == 0 )
150  return;
151 
152  PrintHeader( nmbOfEntries );
153 
154  for ( CexmcTrackPointsCollectionData::iterator
155  itr( eventMap->GetMap()->begin() );
156  itr != eventMap->GetMap()->end(); ++itr )
157  {
158  G4cout << " track id " << itr->first << G4endl;
159  G4cout << " , position: " <<
160  G4BestUnit( itr->second->positionLocal, "Length" ) << G4endl;
161  G4cout << " , direction: " <<
162  itr->second->directionLocal << G4endl;
163  G4cout << " , momentum: " <<
164  G4BestUnit( itr->second->momentumAmp, "Energy" ) << G4endl;
165  G4cout << " , particle: " <<
166  itr->second->particle->GetParticleName() << G4endl;
167  }
168 }
CexmcTrackPointsCollection * eventMap
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int entries() const
Definition: G4THitsMap.hh:79
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:68
void PrintHeader(G4int nmbOfEntries) const
#define G4endl
Definition: G4ios.hh:61
G4bool CexmcTrackPoints::ProcessHits ( G4Step *  step,
G4TouchableHistory *  tHistory 
)
protectedvirtual

Implements G4VPrimitiveScorer.

Definition at line 79 of file CexmcTrackPoints.cc.

References CexmcInsipidTrack, eventMap, GetIndex(), G4Step::GetPreStepPoint(), G4Step::GetTrack(), position, and G4THitsMap< T >::set().

80 {
81  G4int index( GetIndex( step ) );
82 
83  if ( ( *eventMap )[ index ] )
84  return false;
85 
86  G4Track * track( step->GetTrack() );
87  G4ParticleDefinition * particle( track->GetDefinition() );
88  CexmcTrackType trackType( CexmcInsipidTrack );
89 
90  G4StepPoint * preStepPoint( step->GetPreStepPoint() );
91  G4ThreeVector position( preStepPoint->GetPosition() );
92  G4ThreeVector direction( preStepPoint->GetMomentumDirection() );
93 
94  const G4AffineTransform & transform( preStepPoint->GetTouchable()->
95  GetHistory()->GetTopTransform() );
96 
97  CexmcTrackInfo * trackInfo( static_cast< CexmcTrackInfo * >(
98  track->GetUserInformation() ) );
99  trackType = trackInfo->GetTrackType();
100 
101  CexmcTrackPointInfo trackPointInfo( transform.TransformPoint( position ),
102  position,
103  transform.TransformAxis( direction ),
104  direction,
105  preStepPoint->GetMomentum().mag(),
106  particle, track->GetTrackID(),
107  trackType );
108 
109  eventMap->set( index, trackPointInfo );
110 
111  return true;
112 }
CexmcTrackPointsCollection * eventMap
int G4int
Definition: G4Types.hh:78
G4StepPoint * GetPreStepPoint() const
G4int GetIndex(G4Step *step)
int position
Definition: filter.cc:7
CexmcTrackType
Definition: CexmcCommon.hh:115
G4Track * GetTrack() const
G4int set(const G4int &key, T *&aHit) const
Definition: G4THitsMap.hh:165

Field Documentation

CexmcTrackPointsCollection* CexmcTrackPoints::eventMap
protected

The documentation for this class was generated from the following files: