Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CML2SDWithParticle Class Reference

#include <ML2SDWithParticle.hh>

Inheritance diagram for CML2SDWithParticle:
Collaboration diagram for CML2SDWithParticle:

Public Member Functions

 CML2SDWithParticle ()
 
 CML2SDWithParticle (G4int idType, G4int max_N_particles_in_PhSp_File, G4int seed, G4int nMaxParticlesInRamPhaseSpace, G4String name, G4String PhaseSpaceOutFile, G4bool bSavePhaseSpace, G4bool bStopAtVolatilePhaseSpace, SPrimaryParticle *primaryParticleData, G4double accTargetZPosition)
 
 ~CML2SDWithParticle (void)
 
G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROHist)
 
G4int getTotalNumberOfParticles ()
 
CML2SDWithParticlegetCML2SensitiveDetectorParticle ()
 
Sparticle getParticle (int i)
 
void setActive (G4bool act)
 
void save ()
 
- Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (G4String name)
 
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
 
virtual ~G4VSensitiveDetector ()
 
G4VSensitiveDetectoroperator= (const G4VSensitiveDetector &right)
 
G4int operator== (const G4VSensitiveDetector &right) const
 
G4int operator!= (const G4VSensitiveDetector &right) const
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void PrintAll ()
 
G4bool Hit (G4Step *aStep)
 
void SetROgeometry (G4VReadOutGeometry *value)
 
void SetFilter (G4VSDFilter *value)
 
G4int GetNumberOfCollections () const
 
G4String GetCollectionName (G4int id) const
 
void SetVerboseLevel (G4int vl)
 
void Activate (G4bool activeFlag)
 
G4bool isActive () const
 
G4String GetName () const
 
G4String GetPathName () const
 
G4String GetFullPathName () const
 
G4VReadOutGeometryGetROgeometry () const
 
G4VSDFilterGetFilter () const
 
virtual G4VSensitiveDetectorClone () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VSensitiveDetector
virtual G4int GetCollectionID (G4int i)
 
- Protected Attributes inherited from G4VSensitiveDetector
G4CollectionNameVector collectionName
 
G4String SensitiveDetectorName
 
G4String thePathName
 
G4String fullPathName
 
G4int verboseLevel
 
G4bool active
 
G4VReadOutGeometryROgeometry
 
G4VSDFilterfilter
 

Detailed Description

Definition at line 55 of file ML2SDWithParticle.hh.

Constructor & Destructor Documentation

CML2SDWithParticle::CML2SDWithParticle ( )

Definition at line 48 of file ML2SDWithParticle.cc.

49 : G4VSensitiveDetector("killer_plane"),particles(0)
50 {
51  idType=idSD_KillerPlane;
52  bStopAtPhaseSpace=true;
53  nTotalParticles=0;
54  bActive=true;
55 }
G4VSensitiveDetector(G4String name)
CML2SDWithParticle::CML2SDWithParticle ( G4int  idType,
G4int  max_N_particles_in_PhSp_File,
G4int  seed,
G4int  nMaxParticlesInRamPhaseSpace,
G4String  name,
G4String  PhaseSpaceOutFile,
G4bool  bSavePhaseSpace,
G4bool  bStopAtVolatilePhaseSpace,
SPrimaryParticle primaryParticleData,
G4double  accTargetZPosition 
)

Definition at line 57 of file ML2SDWithParticle.cc.

61 : G4VSensitiveDetector(name),particles(0)
62 {
63  accTargetZPosition=ZPos;
64  max_N_particles_in_PhSp_File=maxPartFile;
65  nMaxParticlesInRamPhaseSpace = nMaxPart;
66  idType=id;
67  primaryParticleData=pData;
68  bActive=true;
69  nParticle=0;
70  nTotalParticles=0;
71  bSavePhaseSpace=bSave;
72  bStopAtPhaseSpace=bStop;
73  if (bSavePhaseSpace)
74  {particles=new Sparticle[nMaxPart];}
75  G4String seedName;
76  char a[10];
77  sprintf(a,"%d", seed);
78  seedName=(G4String)a;
79 
80  fullOutFileData=PhaseSpaceOutFile+"_"+seedName+".txt";
81  fullOutFileData=PhaseSpaceOutFile+"_"+seedName+".txt";
82 }
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
long seed
Definition: chem4.cc:68
G4VSensitiveDetector(G4String name)
CML2SDWithParticle::~CML2SDWithParticle ( void  )

Definition at line 83 of file ML2SDWithParticle.cc.

84 {
85  if (particles!=0)
86  {
87  delete [] particles;
88  }
89 }

Member Function Documentation

CML2SDWithParticle* CML2SDWithParticle::getCML2SensitiveDetectorParticle ( )
inline

Definition at line 63 of file ML2SDWithParticle.hh.

63 {return this;}

Here is the caller graph for this function:

Sparticle CML2SDWithParticle::getParticle ( int  i)
inline

Definition at line 64 of file ML2SDWithParticle.hh.

64 {return particles[i];}
G4int CML2SDWithParticle::getTotalNumberOfParticles ( )
inline

Definition at line 62 of file ML2SDWithParticle.hh.

62 {return nTotalParticles;}

Here is the caller graph for this function:

G4bool CML2SDWithParticle::ProcessHits ( G4Step aStep,
G4TouchableHistory ROHist 
)
virtual

Implements G4VSensitiveDetector.

Definition at line 121 of file ML2SDWithParticle.cc.

122 {
123  if (bActive && (CML2AcceleratorConstruction::GetInstance()->getPhysicalVolume()->GetRotation()->isIdentity()))
124  {
125  G4double energyKin= aStep->GetTrack()->GetKineticEnergy();
126  static bool bFirstTime=true;
127  if (idType==idSD_KillerPlane)
128  {
129  nTotalParticles++;
131  }
132  else
133  {
134  if (energyKin>0.)
135  {
136  particles[nParticle].volumeName="";
137  particles[nParticle].pos=aStep->GetPreStepPoint()->GetPosition();
138  particles[nParticle].dir=aStep->GetPreStepPoint()->GetMomentumDirection();
139  particles[nParticle].kinEnergy=energyKin;
140  particles[nParticle].partPDGE=aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
141  particles[nParticle].primaryParticlePDGE=primaryParticleData->partPDGE;
142  particles[nParticle].nPrimaryPart=primaryParticleData->nPrimaryParticle;
143  nParticle++;
144  nTotalParticles++;
145  if (nTotalParticles==max_N_particles_in_PhSp_File)
146  {
147  if (bFirstTime)
148  {
149  bFirstTime=false;
150  saveHeaderParticles();
151  }
152  saveDataParticles(nParticle);
153  nParticle=0;
154  bActive =false;// to stop the phase space creation
155  }
156  if (nParticle==nMaxParticlesInRamPhaseSpace)
157  {
158  if (bFirstTime)
159  {
160  bFirstTime=false;
161  saveHeaderParticles();
162  }
163  saveDataParticles(nParticle);
164  nParticle=0;
165  }
166 
167  Sparticle *particle=new Sparticle;
168  particle->dir=aStep->GetPreStepPoint()->GetMomentumDirection();
169  particle->pos=aStep->GetPreStepPoint()->GetPosition();
170  particle->kinEnergy=energyKin;
171  particle->nPrimaryPart=nTotalParticles; // to pass the id of this phase space particle
172  particle->partPDGE=aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
173  particle->primaryParticlePDGE=primaryParticleData->partPDGE;
174  particle->volumeId=-1;
175  particle->volumeName="-1";
176  }
177  if (bStopAtPhaseSpace)
178  {aStep->GetTrack()->SetTrackStatus(fStopAndKill);}
179  }
180  }
181  else
182  {
183  if (bStopAtPhaseSpace)
184  {aStep->GetTrack()->SetTrackStatus(fStopAndKill);}
185  }
186 
187  return true;
188 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
static CML2AcceleratorConstruction * GetInstance(void)
G4int partPDGE
G4ThreeVector dir
G4int nPrimaryPart
G4StepPoint * GetPreStepPoint() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4int primaryParticlePDGE
const G4ThreeVector & GetPosition() const
G4ThreeVector pos
G4double kinEnergy
G4String volumeName
G4int volumeId
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const

Here is the call graph for this function:

void CML2SDWithParticle::save ( )

Definition at line 190 of file ML2SDWithParticle.cc.

191 {
192  if ((bActive) && (nParticle>0) && (CML2AcceleratorConstruction::GetInstance()->getPhysicalVolume()->GetRotation()->isIdentity()))
193  {saveDataParticles(nParticle);nParticle=0;}
194 }
static CML2AcceleratorConstruction * GetInstance(void)

Here is the call graph for this function:

Here is the caller graph for this function:

void CML2SDWithParticle::setActive ( G4bool  act)
inline

Definition at line 65 of file ML2SDWithParticle.hh.

65 {bActive=act;}

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