Geant4  10.02.p03
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)
 

Private Member Functions

G4bool InsideRoI (const G4Track *aTrack, G4double ang)
 
G4VHitsCollectionGetCollection (G4String colName)
 
G4bool InsideRoI (const G4Track *aTrack, G4double ang)
 
G4VHitsCollectionGetCollection (G4String colName)
 

Private Attributes

ExN04TrackerHitsCollectiontrkHits
 
ExN04MuonHitsCollectionmuonHits
 
ExN04StackingActionMessengertheMessenger
 
G4int stage
 
G4int reqMuon
 
G4int reqIsoMuon
 
G4int reqIso
 
G4double angRoI
 

Additional Inherited Members

- Protected Attributes inherited from G4UserStackingAction
G4StackManagerstackManager
 

Detailed Description

Constructor & Destructor Documentation

◆ ExN04StackingAction() [1/2]

◆ ~ExN04StackingAction() [1/2]

ExN04StackingAction::~ExN04StackingAction ( )
virtual

◆ ExN04StackingAction() [2/2]

ExN04StackingAction::ExN04StackingAction ( )

◆ ~ExN04StackingAction() [2/2]

virtual ExN04StackingAction::~ExN04StackingAction ( )
virtual

Member Function Documentation

◆ ClassifyNewTrack() [1/2]

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

Reimplemented from G4UserStackingAction.

Definition at line 60 of file eventgenerator/HepMC/HepMCEx01/src/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 }
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:94
G4bool InsideRoI(const G4Track *aTrack, G4double ang)
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:95
Here is the call graph for this function:

◆ ClassifyNewTrack() [2/2]

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

Reimplemented from G4UserStackingAction.

◆ GetCollection() [1/2]

G4VHitsCollection* ExN04StackingAction::GetCollection ( G4String  colName)
private

◆ GetCollection() [2/2]

G4VHitsCollection * ExN04StackingAction::GetCollection ( G4String  colName)
private

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

125 {
128  int colID = SDMan->GetCollectionID(colName);
129  if(colID>=0)
130  {
131  const G4Event* currentEvent = runMan->GetCurrentEvent();
132  G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
133  return HCE->GetHC(colID);
134  }
135  return 0;
136 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
const G4Event * GetCurrentEvent() const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:185
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNIsolation() [1/2]

G4int ExN04StackingAction::GetNIsolation ( ) const
inline

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

Here is the caller graph for this function:

◆ GetNIsolation() [2/2]

G4int ExN04StackingAction::GetNIsolation ( ) const
inline

◆ GetNRequestIsoMuon() [1/2]

G4int ExN04StackingAction::GetNRequestIsoMuon ( ) const
inline

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

Here is the caller graph for this function:

◆ GetNRequestIsoMuon() [2/2]

G4int ExN04StackingAction::GetNRequestIsoMuon ( ) const
inline

◆ GetNRequestMuon() [1/2]

G4int ExN04StackingAction::GetNRequestMuon ( ) const
inline

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

Here is the caller graph for this function:

◆ GetNRequestMuon() [2/2]

G4int ExN04StackingAction::GetNRequestMuon ( ) const
inline

◆ GetRoIAngle() [1/2]

G4double ExN04StackingAction::GetRoIAngle ( ) const
inline

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRoIAngle() [2/2]

G4double ExN04StackingAction::GetRoIAngle ( ) const
inline

◆ InsideRoI() [1/2]

G4bool ExN04StackingAction::InsideRoI ( const G4Track *  aTrack,
G4double  ang 
)
private

◆ InsideRoI() [2/2]

G4bool ExN04StackingAction::InsideRoI ( const G4Track *  aTrack,
G4double  ang 
)
private

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

103 {
104  if(!muonHits)
105  { muonHits = (ExN04MuonHitsCollection*)GetCollection("muonCollection"); }
106  if(!muonHits)
107  { G4cerr << "muonCollection NOT FOUND" << G4endl;
108  return true; }
109 
110  G4int nhits = muonHits->entries();
111 
112  const G4ThreeVector trPos = aTrack->GetPosition();
113  for(G4int i=0;i<nhits;i++)
114  {
115  G4ThreeVector muHitPos = (*muonHits)[i]->GetPos();
116  G4double angl = muHitPos.angle(trPos);
117  if(angl<ang) { return true; }
118  }
119 
120  return false;
121 }
int G4int
Definition: G4Types.hh:78
double angle(const Hep3Vector &) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NewStage() [1/2]

void ExN04StackingAction::NewStage ( )
virtual

Reimplemented from G4UserStackingAction.

Definition at line 139 of file eventgenerator/HepMC/HepMCEx01/src/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 }
int G4int
Definition: G4Types.hh:78
double angle(const Hep3Vector &) const
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:

◆ NewStage() [2/2]

virtual void ExN04StackingAction::NewStage ( )
virtual

Reimplemented from G4UserStackingAction.

◆ PrepareNewEvent() [1/2]

void ExN04StackingAction::PrepareNewEvent ( )
virtual

◆ PrepareNewEvent() [2/2]

virtual void ExN04StackingAction::PrepareNewEvent ( )
virtual

Reimplemented from G4UserStackingAction.

◆ SetNIsolation() [1/2]

void ExN04StackingAction::SetNIsolation ( G4int  val)
inline

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

Here is the caller graph for this function:

◆ SetNIsolation() [2/2]

void ExN04StackingAction::SetNIsolation ( G4int  val)
inline

◆ SetNRequestIsoMuon() [1/2]

void ExN04StackingAction::SetNRequestIsoMuon ( G4int  val)
inline

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

Here is the caller graph for this function:

◆ SetNRequestIsoMuon() [2/2]

void ExN04StackingAction::SetNRequestIsoMuon ( G4int  val)
inline

◆ SetNRequestMuon() [1/2]

void ExN04StackingAction::SetNRequestMuon ( G4int  val)
inline

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

Here is the caller graph for this function:

◆ SetNRequestMuon() [2/2]

void ExN04StackingAction::SetNRequestMuon ( G4int  val)
inline

◆ SetRoIAngle() [1/2]

void ExN04StackingAction::SetRoIAngle ( G4double  val)
inline

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

Here is the caller graph for this function:

◆ SetRoIAngle() [2/2]

void ExN04StackingAction::SetRoIAngle ( G4double  val)
inline

Member Data Documentation

◆ angRoI

G4double ExN04StackingAction::angRoI
private

◆ muonHits

ExN04MuonHitsCollection * ExN04StackingAction::muonHits
private

◆ reqIso

G4int ExN04StackingAction::reqIso
private

◆ reqIsoMuon

G4int ExN04StackingAction::reqIsoMuon
private

◆ reqMuon

G4int ExN04StackingAction::reqMuon
private

◆ stage

G4int ExN04StackingAction::stage
private

◆ theMessenger

ExN04StackingActionMessenger * ExN04StackingAction::theMessenger
private

◆ trkHits

ExN04TrackerHitsCollection * ExN04StackingAction::trkHits
private

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