Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ExN04StackingAction Class Reference

#include <Doxymodules_eventgenerator.h>

Inheritance diagram for ExN04StackingAction:
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
 

Private Member Functions

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

Private Attributes

ExN04TrackerHitsCollectionfTrkHits
 
ExN04MuonHitsCollectionfMuonHits
 
ExN04StackingActionMessengerfMessenger
 
G4int fStage
 
G4int fReqMuon
 
G4int fReqIsoMuon
 
G4int fReqIso
 
G4double fAngRoI
 

Detailed Description

Definition at line 48 of file Doxymodules_eventgenerator.h.

Constructor & Destructor Documentation

◆ ExN04StackingAction()

ExN04StackingAction::ExN04StackingAction ( )

◆ ~ExN04StackingAction()

ExN04StackingAction::~ExN04StackingAction ( )
virtual

Definition at line 55 of file ExN04StackingAction.cc.

56{ delete fMessenger; }

Member Function Documentation

◆ ClassifyNewTrack()

G4ClassificationOfNewTrack ExN04StackingAction::ClassifyNewTrack ( const G4Track aTrack)
virtual

Definition at line 60 of file ExN04StackingAction.cc.

61{
62 G4ClassificationOfNewTrack classification = fWaiting;
63 switch(fStage)
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((fAngRoI<0.)||InsideRoI(aTrack,fAngRoI))
92 {
93 classification = fUrgent;
94 break;
95 }
96 classification = fKill;
97 }
98 return classification;
99}
G4bool InsideRoI(const G4Track *aTrack, G4double ang)

◆ NewStage()

void ExN04StackingAction::NewStage ( )
virtual

Definition at line 139 of file ExN04StackingAction.cc.

140{
141 fStage++;
142 G4int nhits;
143 if(fStage==1)
144 {
145 // Stage 0->1 : check if at least "fReqMuon" hits on muon chamber
146 // otherwise abort current event
147 if(!fMuonHits)
148 { fMuonHits = (ExN04MuonHitsCollection*)GetCollection("muonCollection"); }
149 if(!fMuonHits)
150 { G4cerr << "muonCollection NOT FOUND" << G4endl;
151 return; }
152 nhits = fMuonHits->entries();
153 G4cout << "Stage 0->1 : " << nhits << " hits found in the muon chamber."
154 << G4endl;
155 if(nhits<fReqMuon)
156 {
157 stackManager->clear();
158 G4cout << "++++++++ event aborted" << G4endl;
159 return;
160 }
161 stackManager->ReClassify();
162 return;
163 }
164
165 else if(fStage==2)
166 {
167 // Stage 1->2 : check the isolation of muon tracks
168 // at least "fReqIsoMuon" isolated muons
169 // otherwise abort current event.
170 // Isolation requires "fReqIso" or less hits
171 // (including own hits) in the RoI region
172 // in the tracker layers.
173 nhits = fMuonHits->entries();
174 if(!fTrkHits)
175 { fTrkHits =
176 (ExN04TrackerHitsCollection*)GetCollection("trackerCollection"); }
177 if(!fTrkHits)
178 { G4cerr << "trackerCollection NOT FOUND" << G4endl;
179 return; }
180 G4int nTrkhits = fTrkHits->entries();
181 G4int isoMuon = 0;
182 for(G4int j=0;j<nhits;j++)
183 {
184 G4ThreeVector hitPos = (*fMuonHits)[j]->GetPos();
185 G4int nhitIn = 0;
186 for(G4int jj=0;(jj<nTrkhits)&&(nhitIn<=fReqIso);jj++)
187 {
188 G4ThreeVector trkhitPos = (*fTrkHits)[jj]->GetPos();
189 if(trkhitPos.angle(hitPos)<fAngRoI) nhitIn++;
190 }
191 if(nhitIn<=fReqIso) isoMuon++;
192 }
193 G4cout << "Stage 1->2 : " << isoMuon << " isolated muon found." << G4endl;
194 if(isoMuon<fReqIsoMuon)
195 {
196 stackManager->clear();
197 G4cout << "++++++++ event aborted" << G4endl;
198 return;
199 }
200 stackManager->ReClassify();
201 return;
202 }
203
204 else
205 {
206 // Other fStage change : just re-classify
207 stackManager->ReClassify();
208 }
209}
G4THitsCollection< ExN04MuonHit > ExN04MuonHitsCollection
G4THitsCollection< ExN04TrackerHit > ExN04TrackerHitsCollection
G4VHitsCollection * GetCollection(G4String colName)

◆ PrepareNewEvent()

void ExN04StackingAction::PrepareNewEvent ( )
virtual

Definition at line 212 of file ExN04StackingAction.cc.

213{
214 fStage = 0;
215 fTrkHits = 0;
216 fMuonHits = 0;
217}

◆ SetNRequestMuon()

void ExN04StackingAction::SetNRequestMuon ( G4int  val)
inline

Definition at line 52 of file ExN04StackingAction.hh.

52{ fReqMuon = val; }

◆ GetNRequestMuon()

G4int ExN04StackingAction::GetNRequestMuon ( ) const
inline

Definition at line 53 of file ExN04StackingAction.hh.

53{ return fReqMuon; }

◆ SetNRequestIsoMuon()

void ExN04StackingAction::SetNRequestIsoMuon ( G4int  val)
inline

Definition at line 54 of file ExN04StackingAction.hh.

54{ fReqIsoMuon = val; }

◆ GetNRequestIsoMuon()

G4int ExN04StackingAction::GetNRequestIsoMuon ( ) const
inline

Definition at line 55 of file ExN04StackingAction.hh.

55{ return fReqIsoMuon; }

◆ SetNIsolation()

void ExN04StackingAction::SetNIsolation ( G4int  val)
inline

Definition at line 56 of file ExN04StackingAction.hh.

56{ fReqIso = val; }

◆ GetNIsolation()

G4int ExN04StackingAction::GetNIsolation ( ) const
inline

Definition at line 57 of file ExN04StackingAction.hh.

57{ return fReqIso; }

◆ SetRoIAngle()

void ExN04StackingAction::SetRoIAngle ( G4double  val)
inline

Definition at line 58 of file ExN04StackingAction.hh.

58{ fAngRoI = val; }

◆ GetRoIAngle()

G4double ExN04StackingAction::GetRoIAngle ( ) const
inline

Definition at line 59 of file ExN04StackingAction.hh.

59{ return fAngRoI; }

◆ InsideRoI()

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

Definition at line 102 of file ExN04StackingAction.cc.

103{
104 if(!fMuonHits)
105 { fMuonHits = (ExN04MuonHitsCollection*)GetCollection("muonCollection"); }
106 if(!fMuonHits)
107 { G4cerr << "muonCollection NOT FOUND" << G4endl;
108 return true; }
109
110 G4int nhits = fMuonHits->entries();
111
112 const G4ThreeVector trPos = aTrack->GetPosition();
113 for(G4int i=0;i<nhits;i++)
114 {
115 G4ThreeVector muHitPos = (*fMuonHits)[i]->GetPos();
116 G4double angl = muHitPos.angle(trPos);
117 if(angl<ang) { return true; }
118 }
119
120 return false;
121}

◆ GetCollection()

G4VHitsCollection * ExN04StackingAction::GetCollection ( G4String  colName)
private

Definition at line 124 of file ExN04StackingAction.cc.

125{
126 G4SDManager* SDMan = G4SDManager::GetSDMpointer();
127 G4RunManager* runMan = G4RunManager::GetRunManager();
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}

Member Data Documentation

◆ fTrkHits

ExN04TrackerHitsCollection* ExN04StackingAction::fTrkHits
private

Definition at line 65 of file ExN04StackingAction.hh.

◆ fMuonHits

ExN04MuonHitsCollection* ExN04StackingAction::fMuonHits
private

Definition at line 66 of file ExN04StackingAction.hh.

◆ fMessenger

ExN04StackingActionMessenger* ExN04StackingAction::fMessenger
private

Definition at line 67 of file ExN04StackingAction.hh.

◆ fStage

G4int ExN04StackingAction::fStage
private

Definition at line 69 of file ExN04StackingAction.hh.

◆ fReqMuon

G4int ExN04StackingAction::fReqMuon
private

Definition at line 70 of file ExN04StackingAction.hh.

◆ fReqIsoMuon

G4int ExN04StackingAction::fReqIsoMuon
private

Definition at line 71 of file ExN04StackingAction.hh.

◆ fReqIso

G4int ExN04StackingAction::fReqIso
private

Definition at line 72 of file ExN04StackingAction.hh.

◆ fAngRoI

G4double ExN04StackingAction::fAngRoI
private

Definition at line 73 of file ExN04StackingAction.hh.


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

Applications | User Support | Publications | Collaboration