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

#include <ExN04StackingAction.hh>

Inheritance diagram for ExN04StackingAction:
G4UserStackingAction G4UserStackingAction

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 eventgenerator/HepMC/HepMCEx01/include/ExN04StackingAction.hh.

Constructor & Destructor Documentation

ExN04StackingAction::ExN04StackingAction ( )

Definition at line 45 of file eventgenerator/HepMC/HepMCEx01/src/ExN04StackingAction.cc.

References python.hepunit::deg.

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 }
ExN04StackingAction::~ExN04StackingAction ( )
virtual

Definition at line 55 of file eventgenerator/HepMC/HepMCEx01/src/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 eventgenerator/HepMC/HepMCEx01/src/ExN04StackingAction.cc.

References fKill, fSuspend, fUrgent, fWaiting, G4Track::GetDefinition(), G4Track::GetParentID(), G4ParticleDefinition::GetPDGCharge(), G4Track::GetTrackStatus(), G4MuonMinus::MuonMinusDefinition(), and G4MuonPlus::MuonPlusDefinition().

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
virtual G4ClassificationOfNewTrack ExN04StackingAction::ClassifyNewTrack ( const G4Track aTrack)
virtual

Reimplemented from G4UserStackingAction.

G4int ExN04StackingAction::GetNIsolation ( ) const
inline
G4int ExN04StackingAction::GetNIsolation ( ) const
inline

Definition at line 76 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

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

Definition at line 56 of file eventgenerator/HepMC/HepMCEx01/include/ExN04StackingAction.hh.

Referenced by ExN04StackingActionMessenger::GetCurrentValue().

56 { return reqIsoMuon; }
G4int ExN04StackingAction::GetNRequestIsoMuon ( ) const
inline

Definition at line 74 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

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

Definition at line 72 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

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

Definition at line 78 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

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

Reimplemented from G4UserStackingAction.

Definition at line 139 of file eventgenerator/HepMC/HepMCEx01/src/ExN04StackingAction.cc.

References CLHEP::Hep3Vector::angle(), G4StackManager::clear(), G4THitsCollection< T >::entries(), G4cerr, G4cout, G4endl, G4StackManager::ReClassify(), and G4UserStackingAction::stackManager.

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
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4StackManager * stackManager
G4GLOB_DLL std::ostream G4cerr
virtual void ExN04StackingAction::NewStage ( )
virtual

Reimplemented from G4UserStackingAction.

void ExN04StackingAction::PrepareNewEvent ( )
virtual

Reimplemented from G4UserStackingAction.

Definition at line 212 of file eventgenerator/HepMC/HepMCEx01/src/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 eventgenerator/HepMC/HepMCEx01/include/ExN04StackingAction.hh.

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

Definition at line 75 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

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

Definition at line 55 of file eventgenerator/HepMC/HepMCEx01/include/ExN04StackingAction.hh.

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

Definition at line 73 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

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

Definition at line 53 of file eventgenerator/HepMC/HepMCEx01/include/ExN04StackingAction.hh.

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

Definition at line 71 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

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

Definition at line 59 of file eventgenerator/HepMC/HepMCEx01/include/ExN04StackingAction.hh.

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

Definition at line 77 of file parallel/TopC/ParN04/include/ExN04StackingAction.hh.

77 { angRoI = val; }

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