Geant4  10.02.p03
CCalStackingAction Class Reference

#include <CCalStackingAction.hh>

Inheritance diagram for CCalStackingAction:
Collaboration diagram for CCalStackingAction:

Public Types

enum  stageLevel { firstStage, end }
 
enum  { maxNumberOfSD = 30 }
 

Public Member Functions

 ~CCalStackingAction ()
 
virtual G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack)
 
virtual void NewStage ()
 
virtual void PrepareNewEvent ()
 
- Public Member Functions inherited from G4UserStackingAction
 G4UserStackingAction ()
 
virtual ~G4UserStackingAction ()
 
void SetStackManager (G4StackManager *value)
 

Private Member Functions

 CCalStackingAction ()
 
void initialize ()
 
G4bool trackStartsInCalo (const G4Track *atrack)
 
void setPrimaryID (G4int id)
 

Private Attributes

stageLevel stage
 
int numberOfSD
 
G4String SDName [maxNumberOfSD]
 
int nurgent
 
int acceptSecondaries
 
CCaloSDtheCaloSD [maxNumberOfSD]
 
G4bool isInitialized
 

Friends

class CCalSensAssign
 

Additional Inherited Members

- Protected Attributes inherited from G4UserStackingAction
G4StackManagerstackManager
 

Detailed Description

Definition at line 40 of file CCalStackingAction.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
maxNumberOfSD 

Definition at line 56 of file CCalStackingAction.hh.

◆ stageLevel

Constructor & Destructor Documentation

◆ CCalStackingAction()

CCalStackingAction::CCalStackingAction ( )
private

Definition at line 43 of file CCalStackingAction.cc.

43 : isInitialized(false) {}

◆ ~CCalStackingAction()

CCalStackingAction::~CCalStackingAction ( )

Definition at line 46 of file CCalStackingAction.cc.

46 {}

Member Function Documentation

◆ ClassifyNewTrack()

G4ClassificationOfNewTrack CCalStackingAction::ClassifyNewTrack ( const G4Track *  aTrack)
virtual

PRIMARIES ///

SECONDARIES ///

Reimplemented from G4UserStackingAction.

Definition at line 101 of file CCalStackingAction.cc.

101  {
102 
103  G4ClassificationOfNewTrack classification=fKill;
104  int parentID = aTrack->GetParentID();
105 #ifdef ddebug
106  G4TrackStatus status = aTrack->GetTrackStatus();
107  G4cout << "Classifying track " << aTrack->GetTrackID()
108  << " with status " << aTrack->GetTrackStatus() << G4endl;
109 #endif
110 
111  if (parentID < 0) {
112 #ifdef debug
113  G4cout << "Killing track " << aTrack->GetTrackID()
114  << " from previous event. Should not happen" << G4endl;
115  G4cout << "returning classification= " << classification << G4endl;
116 #endif
117  return classification= fKill;
118  }
119 
120  if (aTrack->GetDefinition()->GetParticleName() == "gamma" &&
121  aTrack->GetKineticEnergy() < 1.*eV) {
122 #ifdef debug
123  G4cout << "Kills particle " << aTrack->GetDefinition()->GetParticleName()
124  << " of energy " << aTrack->GetKineticEnergy()/MeV << " MeV"
125  << G4endl;
126 #endif
127  return classification= fKill;
128  }
129 
130  if (stage<end) {
134  if (parentID == 0 ) {
135  if ( nurgent == 0) {
136  nurgent++;
137  classification = fUrgent;
138  setPrimaryID(aTrack->GetTrackID());
139  }
140  else classification = fWaiting;
141  }
142 
146 
147  if (parentID > 0) {
148  if (acceptSecondaries == 1) {
149  if (trackStartsInCalo(const_cast<G4Track *>(aTrack))!=0 )
150  classification = fUrgent;
151  else
152  classification = fWaiting;
153  } else {
154  if(nurgent == 0){
155  nurgent++;
156  classification = fUrgent;
157  setPrimaryID(aTrack->GetTrackID());
158  } else
159  classification = fWaiting;
160  }
161  }
162 
163 
164  } else
165  classification = G4UserStackingAction::ClassifyNewTrack(aTrack);
166 
167 #ifdef ddebug
168  G4cout << " returning classification= " << classification
169  << " for track "<< aTrack->GetTrackID() << G4endl;
170 #endif
171  return classification;
172 
173 }
static const double MeV
Definition: G4SIunits.hh:211
G4GLOB_DLL std::ostream G4cout
static const double eV
Definition: G4SIunits.hh:212
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
#define G4endl
Definition: G4ios.hh:61
G4bool trackStartsInCalo(const G4Track *atrack)
void setPrimaryID(G4int id)
Here is the call graph for this function:

◆ initialize()

void CCalStackingAction::initialize ( )
private

Definition at line 58 of file CCalStackingAction.cc.

58  {
59 
60  isInitialized = true;
61 
63 #ifdef debug
64  G4cout << "CCalStackingAction look for " << numberOfSD
65  << " calorimeter-like SD" << G4endl;
66 #endif
67  int i = 0;
68  for (i=0; i<numberOfSD; i++) {
69  G4String theName(CCalSDList::getInstance()->getCaloSDName(i));
70  SDName[i] = theName;
71 #ifdef debug
72  G4cout << "Found SD name " << theName << G4endl;
73 #endif
74  theCaloSD[i] = 0;
75  }
76 
78  if (sd != 0) {
79 
80  for (i=0; i<numberOfSD; i++){
81 
83  if (aSD==0) {
84 #ifdef debug
85  G4cout << "CCalStackingAction::initialize: No SD with name " << SDName[i]
86  << " in this Setup " << G4endl;
87 #endif
88  } else {
89  theCaloSD[i] = dynamic_cast<CCaloSD*>(aSD);
90  theCaloSD[i]->SetPrimaryID(0);
91  }
92  }
93 #ifdef debug
94  G4cout << "CCalStackingAction::initialize: Could not get SD Manager !"
95  << G4endl;
96 #endif
97  }
98 
99 }
G4String SDName[maxNumberOfSD]
static CCalSDList * getInstance()
Definition: CCalSDList.cc:37
CCaloSD * theCaloSD[maxNumberOfSD]
G4GLOB_DLL std::ostream G4cout
void SetPrimaryID(int i)
Definition: CCaloSD.hh:74
G4VSensitiveDetector * FindSensitiveDetector(G4String dName, G4bool warning=true)
Definition: G4SDManager.cc:128
int getNumberOfCaloSD()
Definition: CCalSDList.cc:76
#define G4endl
Definition: G4ios.hh:61
static G4SDManager * GetSDMpointerIfExist()
Definition: G4SDManager.cc:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NewStage()

void CCalStackingAction::NewStage ( )
virtual

Reimplemented from G4UserStackingAction.

Definition at line 176 of file CCalStackingAction.cc.

176  {
177 
178 #ifdef ddebug
179  G4cout << "In NewStage with stage = " << stage << G4endl;
180 #endif
181  if (stage <end) {
182  nurgent = 0;
183  setPrimaryID(0);
184  acceptSecondaries = 0;
186  acceptSecondaries = 1;
187  if (stackManager->GetNUrgentTrack() == 0) {
188  stage = stageLevel(stage+1);
189  }
190 
191  }
192 }
G4GLOB_DLL std::ostream G4cout
G4int GetNUrgentTrack() const
#define G4endl
Definition: G4ios.hh:61
G4StackManager * stackManager
void setPrimaryID(G4int id)
Here is the call graph for this function:

◆ PrepareNewEvent()

void CCalStackingAction::PrepareNewEvent ( )
virtual

Reimplemented from G4UserStackingAction.

Definition at line 49 of file CCalStackingAction.cc.

Here is the call graph for this function:

◆ setPrimaryID()

void CCalStackingAction::setPrimaryID ( G4int  id)
private

Definition at line 206 of file CCalStackingAction.cc.

206  {
207 
208  for (int i=0; i<numberOfSD; i++){
209  if(theCaloSD[i] != 0)theCaloSD[i]->SetPrimaryID(id);
210  }
211 
212 }
CCaloSD * theCaloSD[maxNumberOfSD]
void SetPrimaryID(int i)
Definition: CCaloSD.hh:74
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trackStartsInCalo()

G4bool CCalStackingAction::trackStartsInCalo ( const G4Track *  atrack)
private

This method should check that the secondary particle was produced inside the detector calorimeter and really is part of the shower. If it has been produced before the calorimeter for ex. Bremsstrahlung, it should be treated as a new particle producing a new shower.

Definition at line 194 of file CCalStackingAction.cc.

194  {
195 
202 
203  return true;
204 }
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CCalSensAssign

friend class CCalSensAssign
friend

Definition at line 42 of file CCalStackingAction.hh.

Member Data Documentation

◆ acceptSecondaries

int CCalStackingAction::acceptSecondaries
private

Definition at line 63 of file CCalStackingAction.hh.

◆ isInitialized

G4bool CCalStackingAction::isInitialized
private

Definition at line 65 of file CCalStackingAction.hh.

◆ numberOfSD

int CCalStackingAction::numberOfSD
private

Definition at line 60 of file CCalStackingAction.hh.

◆ nurgent

int CCalStackingAction::nurgent
private

Definition at line 62 of file CCalStackingAction.hh.

◆ SDName

G4String CCalStackingAction::SDName[maxNumberOfSD]
private

Definition at line 61 of file CCalStackingAction.hh.

◆ stage

stageLevel CCalStackingAction::stage
private

Definition at line 59 of file CCalStackingAction.hh.

◆ theCaloSD

CCaloSD* CCalStackingAction::theCaloSD[maxNumberOfSD]
private

Definition at line 64 of file CCalStackingAction.hh.


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