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

#include <ExN04StackingAction.hh>

Inheritance diagram for ExN04StackingAction:
Collaboration diagram for ExN04StackingAction:

Public Member Functions

 ExN04StackingAction ()
 
virtual ~ExN04StackingAction ()
 
virtual G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack)
 
virtual void NewStage ()
 
virtual void PrepareNewEvent ()
 
void SetNRequestMuon (G4int val)
 
G4int GetNRequestMuon () const
 
void SetNRequestIsoMuon (G4int val)
 
G4int GetNRequestIsoMuon () const
 
void SetNIsolation (G4int val)
 
G4int GetNIsolation () const
 
void SetRoIAngle (G4double val)
 
G4double GetRoIAngle () const
 
 ExN04StackingAction ()
 
virtual ~ExN04StackingAction ()
 
virtual G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack)
 
virtual void NewStage ()
 
virtual void PrepareNewEvent ()
 
void SetNRequestMuon (G4int val)
 
G4int GetNRequestMuon () const
 
void SetNRequestIsoMuon (G4int val)
 
G4int GetNRequestIsoMuon () const
 
void SetNIsolation (G4int val)
 
G4int GetNIsolation () const
 
void SetRoIAngle (G4double val)
 
G4double GetRoIAngle () const
 
- Public Member Functions inherited from G4UserStackingAction
 G4UserStackingAction ()
 
virtual ~G4UserStackingAction ()
 
void SetStackManager (G4StackManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserStackingAction
G4StackManagerstackManager
 

Detailed Description

Definition at line 44 of file ExN04StackingAction.hh.

Constructor & Destructor Documentation

ExN04StackingAction::ExN04StackingAction ( )

Definition at line 45 of file ExN04StackingAction.cc.

46  : trkHits(0), muonHits(0), stage(0)
47 {
48  angRoI = 30.0*deg;
49  reqMuon = 2;
50  reqIso = 10;
51  theMessenger = new ExN04StackingActionMessenger(this);
52 }
static constexpr double deg
Definition: G4SIunits.hh:152
ExN04StackingAction::~ExN04StackingAction ( )
virtual

Definition at line 55 of file ExN04StackingAction.cc.

56 { delete theMessenger; }
ExN04StackingAction::ExN04StackingAction ( )
virtual ExN04StackingAction::~ExN04StackingAction ( )
virtual

Member Function Documentation

G4ClassificationOfNewTrack ExN04StackingAction::ClassifyNewTrack ( const G4Track aTrack)
virtual

Reimplemented from G4UserStackingAction.

Definition at line 60 of file ExN04StackingAction.cc.

61 {
62  G4ClassificationOfNewTrack classification = fWaiting;
63  switch(stage)
64  {
65  case 0: // Stage 0 : Primary muons only
66  if(aTrack->GetParentID()==0)
67  {
68  G4ParticleDefinition * particleType = aTrack->GetDefinition();
69  if((particleType==G4MuonPlus::MuonPlusDefinition())
70  ||(particleType==G4MuonMinus::MuonMinusDefinition()))
71  { classification = fUrgent; }
72  }
73  break;
74 
75  case 1: // Stage 1 : Charged primaries only
76  // Suspended tracks will be sent to the waiting stack
77  if(aTrack->GetParentID()!=0) { break; }
78  if(aTrack->GetTrackStatus()==fSuspend) { break; }
79  if(aTrack->GetDefinition()->GetPDGCharge()==0.) { break; }
80  classification = fUrgent;
81  break;
82 
83  default: // Stage 2 : Accept all primaries
84  // Accept all secondaries in RoI
85  // Kill secondaries outside RoI
86  if(aTrack->GetParentID()==0)
87  {
88  classification = fUrgent;
89  break;
90  }
91  if((angRoI<0.)||InsideRoI(aTrack,angRoI))
92  {
93  classification = fUrgent;
94  break;
95  }
96  classification = fKill;
97  }
98  return classification;
99 }
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
G4TrackStatus GetTrackStatus() const
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
G4double GetPDGCharge() const

Here is the call graph for this function:

virtual G4ClassificationOfNewTrack ExN04StackingAction::ClassifyNewTrack ( const G4Track aTrack)
virtual

Reimplemented from G4UserStackingAction.

G4int ExN04StackingAction::GetNIsolation ( ) const
inline

Definition at line 58 of file ExN04StackingAction.hh.

58 { return reqIso; }

Here is the caller graph for this function:

G4int ExN04StackingAction::GetNIsolation ( ) const
inline

Definition at line 76 of file ExN04StackingAction.hh.

76 { return reqIso; }
G4int ExN04StackingAction::GetNRequestIsoMuon ( ) const
inline

Definition at line 56 of file ExN04StackingAction.hh.

56 { return reqIsoMuon; }

Here is the caller graph for this function:

G4int ExN04StackingAction::GetNRequestIsoMuon ( ) const
inline

Definition at line 74 of file ExN04StackingAction.hh.

74 { return reqIsoMuon; }
G4int ExN04StackingAction::GetNRequestMuon ( ) const
inline

Definition at line 54 of file ExN04StackingAction.hh.

54 { return reqMuon; }

Here is the caller graph for this function:

G4int ExN04StackingAction::GetNRequestMuon ( ) const
inline

Definition at line 72 of file ExN04StackingAction.hh.

72 { return reqMuon; }
G4double ExN04StackingAction::GetRoIAngle ( ) const
inline

Definition at line 60 of file ExN04StackingAction.hh.

60 { return angRoI; }

Here is the caller graph for this function:

G4double ExN04StackingAction::GetRoIAngle ( ) const
inline

Definition at line 78 of file ExN04StackingAction.hh.

78 { return angRoI; }
void ExN04StackingAction::NewStage ( )
virtual

Reimplemented from G4UserStackingAction.

Definition at line 139 of file ExN04StackingAction.cc.

140 {
141  stage++;
142  G4int nhits;
143  if(stage==1)
144  {
145  // Stage 0->1 : check if at least "reqMuon" hits on muon chamber
146  // otherwise abort current event
147  if(!muonHits)
148  { muonHits = (ExN04MuonHitsCollection*)GetCollection("muonCollection"); }
149  if(!muonHits)
150  { G4cerr << "muonCollection NOT FOUND" << G4endl;
151  return; }
152  nhits = muonHits->entries();
153  G4cout << "Stage 0->1 : " << nhits << " hits found in the muon chamber."
154  << G4endl;
155  if(nhits<reqMuon)
156  {
157  stackManager->clear();
158  G4cout << "++++++++ event aborted" << G4endl;
159  return;
160  }
162  return;
163  }
164 
165  else if(stage==2)
166  {
167  // Stage 1->2 : check the isolation of muon tracks
168  // at least "reqIsoMuon" isolated muons
169  // otherwise abort current event.
170  // Isolation requires "reqIso" or less hits
171  // (including own hits) in the RoI region
172  // in the tracker layers.
173  nhits = muonHits->entries();
174  if(!trkHits)
175  { trkHits =
176  (ExN04TrackerHitsCollection*)GetCollection("trackerCollection"); }
177  if(!trkHits)
178  { G4cerr << "trackerCollection NOT FOUND" << G4endl;
179  return; }
180  G4int nTrkhits = trkHits->entries();
181  G4int isoMuon = 0;
182  for(G4int j=0;j<nhits;j++)
183  {
184  G4ThreeVector hitPos = (*muonHits)[j]->GetPos();
185  G4int nhitIn = 0;
186  for(G4int jj=0;(jj<nTrkhits)&&(nhitIn<=reqIso);jj++)
187  {
188  G4ThreeVector trkhitPos = (*trkHits)[jj]->GetPos();
189  if(trkhitPos.angle(hitPos)<angRoI) nhitIn++;
190  }
191  if(nhitIn<=reqIso) isoMuon++;
192  }
193  G4cout << "Stage 1->2 : " << isoMuon << " isolated muon found." << G4endl;
194  if(isoMuon<reqIsoMuon)
195  {
196  stackManager->clear();
197  G4cout << "++++++++ event aborted" << G4endl;
198  return;
199  }
201  return;
202  }
203 
204  else
205  {
206  // Other stage change : just re-classify
208  }
209 }
double angle(const Hep3Vector &) const
G4int entries() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4StackManager * stackManager
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

virtual void ExN04StackingAction::NewStage ( )
virtual

Reimplemented from G4UserStackingAction.

void ExN04StackingAction::PrepareNewEvent ( )
virtual

Reimplemented from G4UserStackingAction.

Definition at line 212 of file ExN04StackingAction.cc.

213 {
214  stage = 0;
215  trkHits = 0;
216  muonHits = 0;
217 }
virtual void ExN04StackingAction::PrepareNewEvent ( )
virtual

Reimplemented from G4UserStackingAction.

void ExN04StackingAction::SetNIsolation ( G4int  val)
inline

Definition at line 57 of file ExN04StackingAction.hh.

57 { reqIso = val; }
void ExN04StackingAction::SetNIsolation ( G4int  val)
inline

Definition at line 75 of file ExN04StackingAction.hh.

75 { reqIso = val; }
void ExN04StackingAction::SetNRequestIsoMuon ( G4int  val)
inline

Definition at line 55 of file ExN04StackingAction.hh.

55 { reqIsoMuon = val; }
void ExN04StackingAction::SetNRequestIsoMuon ( G4int  val)
inline

Definition at line 73 of file ExN04StackingAction.hh.

73 { reqIsoMuon = val; }
void ExN04StackingAction::SetNRequestMuon ( G4int  val)
inline

Definition at line 53 of file ExN04StackingAction.hh.

53 { reqMuon = val; }
void ExN04StackingAction::SetNRequestMuon ( G4int  val)
inline

Definition at line 71 of file ExN04StackingAction.hh.

71 { reqMuon = val; }
void ExN04StackingAction::SetRoIAngle ( G4double  val)
inline

Definition at line 59 of file ExN04StackingAction.hh.

59 { angRoI = val; }
void ExN04StackingAction::SetRoIAngle ( G4double  val)
inline

Definition at line 77 of file ExN04StackingAction.hh.

77 { angRoI = val; }

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