MyStackingAction Class Reference

#include <MyStackingAction.hh>

List of all members.

Public Member Functions

 MyStackingAction ()
 ~MyStackingAction ()
void SetStackManager (G4StackManager *value)
G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack)
void NewStage ()
void PrepareNewEvent ()
void SetEleCut (G4double val)
void SetPosCut (G4double val)
void SetGamCut (G4double val)
G4double GetEleCut ()
G4double GetPosCut ()
G4double GetGamCut ()
void add_white_list (int val)
void add_black_list (int val)
void clear_white_list ()
void clear_black_list ()
void set_no_PC (bool val)
void set_no_MC (bool val)
void set_no_sec (bool val)
G4int GetDepthFromParent (G4int aTrack, G4int parentTrack)

Private Attributes

MyStackingActionMessengerfStackingActionMessenger
TTrackIDMapfTrackIDMap
G4double fEleCut
G4double fPosCut
G4double fGamCut
bool m_no_PC
bool m_no_MC
bool m_no_sec
std::vector< int > m_white_list
std::vector< int > m_black_list

Detailed Description

Definition at line 31 of file MyStackingAction.hh.


Constructor & Destructor Documentation

MyStackingAction::MyStackingAction (  ) 

Definition at line 18 of file MyStackingAction.cc.

References fStackingActionMessenger, m_black_list, m_no_MC, m_no_PC, m_no_sec, and m_white_list.

00019 : fTrackIDMap(NULL), fEleCut(0), fPosCut(0), fGamCut(0) {
00020     fStackingActionMessenger = new MyStackingActionMessenger(this);
00021     m_white_list.clear();
00022     m_black_list.clear();
00023     m_no_sec=false;
00024     m_no_MC=false;
00025     m_no_PC=false;
00026 }

MyStackingAction::~MyStackingAction (  ) 

Definition at line 29 of file MyStackingAction.cc.

References fTrackIDMap.

00029                                     {
00030     delete fTrackIDMap;
00031 }


Member Function Documentation

void MyStackingAction::add_black_list ( int  val  )  [inline]

Definition at line 123 of file MyStackingAction.hh.

References m_black_list.

00123 {m_black_list.push_back(val);};

void MyStackingAction::add_white_list ( int  val  )  [inline]

Definition at line 122 of file MyStackingAction.hh.

References m_white_list.

00122 {m_white_list.push_back(val);};

G4ClassificationOfNewTrack MyStackingAction::ClassifyNewTrack ( const G4Track *  aTrack  ) 

Definition at line 35 of file MyStackingAction.cc.

References fEleCut, fGamCut, fPosCut, fTrackIDMap, McTruthSvc::GetMcTruthSvc(), m_black_list, m_no_MC, m_no_PC, m_no_sec, m_white_list, and McTruthSvc::SetValuePre().

00035                                                         {
00036     G4ParticleDefinition* aPart = aTrack->GetDefinition();
00037     G4int aPDGEncoding = aPart->GetPDGEncoding();
00038     G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
00039 
00040     //
00041     // Store the parent-daughter relation.
00042     //
00043     G4int aTrackID = aTrack->GetTrackID();
00044     G4int aParentTrackID = aTrack->GetParentID();
00045     if ( (fTrackIDMap->find(aTrackID)) == fTrackIDMap->end() ) {
00046         fTrackIDMap->insert( TTrackIDMapValue(aTrackID, aParentTrackID));
00047     }
00048 
00049     //
00050     // Assign the tracking priorities
00051     //
00052     G4ClassificationOfNewTrack aClassification = fWaiting;
00053 
00054     if ( aPDGEncoding ==
00055     particleTable->FindParticle("e-")->GetPDGEncoding() ) {
00056         if ( aTrack->GetTotalEnergy() >= fEleCut ) {
00057             aClassification = fUrgent;
00058         }
00059         else {
00060             aClassification = fKill;
00061         }
00062 
00063     } else if ( aPDGEncoding ==
00064     particleTable->FindParticle("e+")->GetPDGEncoding() ) {
00065         if ( aTrack->GetTotalEnergy() >= fPosCut ) {
00066             aClassification = fUrgent;
00067         }
00068         else {
00069             aClassification = fKill;
00070         }
00071     } else if ( aPDGEncoding ==
00072     particleTable->FindParticle("gamma")->GetPDGEncoding() ) {
00073         if ( aTrack->GetTotalEnergy() >= fGamCut ) {
00074             aClassification = fUrgent;
00075         }
00076         else {
00077             aClassification = fKill;
00078         }
00079 
00080     }
00081 
00082         if (m_no_MC||m_no_PC||m_no_sec){
00083                 G4String processName;
00084                 const G4VProcess* process = aTrack->GetCreatorProcess();
00085                 if (process) {
00086                         processName = process->GetProcessName();
00087                 }
00088                 else{
00089                         processName = "NULL";
00090                 }
00091                 if (processName=="muMinusCaptureAtRest"&&m_no_MC){
00092                         aClassification = fKill;
00093                         McTruthSvc::GetMcTruthSvc()->SetValuePre(aTrack);
00094                 }
00095                 if (processName=="hBertiniCaptureAtRest"&&m_no_PC){
00096                         aClassification = fKill;
00097                         McTruthSvc::GetMcTruthSvc()->SetValuePre(aTrack);
00098                 }
00099                 if (processName!="NULL"&&m_no_sec){
00100                         aClassification = fKill;
00101                         McTruthSvc::GetMcTruthSvc()->SetValuePre(aTrack);
00102                 }
00103         }
00104 
00105         if (aTrackID!=1){
00106                 bool foundit=false;
00107                 if (m_white_list.size()!=0){
00108                         foundit=false;
00109                         for (int i = 0; i< m_white_list.size(); i++){
00110                                 if (aPDGEncoding==m_white_list[i]){
00111                                         foundit=true;
00112                                         break;
00113                                 }
00114                         }
00115                         if (!foundit){
00116                                 aClassification = fKill;
00117                         }
00118                 }
00119                 foundit=false;
00120                 for (int i = 0; i< m_black_list.size(); i++){
00121                         if (aPDGEncoding==m_black_list[i]){
00122                                 foundit=true;
00123                                 break;
00124                         }
00125                 }
00126                 if (foundit){
00127                         aClassification = fKill;
00128                 }
00129         }
00130 
00131     return aClassification;
00132 }

void MyStackingAction::clear_black_list (  )  [inline]

Definition at line 125 of file MyStackingAction.hh.

References m_black_list.

00125 {m_black_list.clear();};

void MyStackingAction::clear_white_list (  )  [inline]

Definition at line 124 of file MyStackingAction.hh.

References m_white_list.

00124 {m_white_list.clear();};

G4int MyStackingAction::GetDepthFromParent ( G4int  aTrack,
G4int  parentTrack 
)

Definition at line 144 of file MyStackingAction.cc.

References fTrackIDMap.

00144                                                                           {
00145     G4int trackID = aTrackID;
00146     G4int depth = 0;
00147     G4bool found = false;
00148 
00149     if ( aParentID <= 0 || aTrackID <= 0 ) {
00150         return -1;
00151     }
00152     else if ( aTrackID == aParentID ) {
00153         return 0;
00154     }
00155     else {
00156         depth = 1;
00157         while ( trackID != 0 ) {
00158             //      G4cout << "(" << (*(fTrackIDMap->find(trackID))).first
00159             //       << "," << (*(fTrackIDMap->find(trackID))).second << ")"
00160             //       << G4endl;
00161             if ( (*(fTrackIDMap->find(trackID))).second == aParentID ) {
00162                 found = true;
00163                 break;
00164             }
00165             trackID = (*(fTrackIDMap->find(trackID))).second;
00166             ++depth;
00167         }
00168         if ( found ) {
00169             return depth;
00170         }
00171         else {
00172             return -1;
00173         }
00174     }
00175 
00176     return found;
00177 }

G4double MyStackingAction::GetEleCut (  )  [inline]

Definition at line 118 of file MyStackingAction.hh.

References fEleCut.

00118 {return fEleCut;};

G4double MyStackingAction::GetGamCut (  )  [inline]

Definition at line 120 of file MyStackingAction.hh.

References fGamCut.

00120 {return fGamCut;};

G4double MyStackingAction::GetPosCut (  )  [inline]

Definition at line 119 of file MyStackingAction.hh.

References fPosCut.

00119 {return fPosCut;};

void MyStackingAction::NewStage (  ) 

Definition at line 135 of file MyStackingAction.cc.

00136 {;}

void MyStackingAction::PrepareNewEvent (  ) 

Definition at line 138 of file MyStackingAction.cc.

References fTrackIDMap.

00138                                        {
00139     delete fTrackIDMap;
00140     fTrackIDMap = new TTrackIDMap;
00141 }

void MyStackingAction::set_no_MC ( bool  val  )  [inline]

Definition at line 127 of file MyStackingAction.hh.

References m_no_MC.

00127 {m_no_MC=val;};

void MyStackingAction::set_no_PC ( bool  val  )  [inline]

Definition at line 126 of file MyStackingAction.hh.

References m_no_PC.

00126 {m_no_PC=val;};

void MyStackingAction::set_no_sec ( bool  val  )  [inline]

Definition at line 128 of file MyStackingAction.hh.

References m_no_sec.

00128 {m_no_sec=val;};

void MyStackingAction::SetEleCut ( G4double  val  )  [inline]

Definition at line 114 of file MyStackingAction.hh.

References fEleCut.

00114 {fEleCut = val;};

void MyStackingAction::SetGamCut ( G4double  val  )  [inline]

Definition at line 116 of file MyStackingAction.hh.

References fGamCut.

00116 {fGamCut = val;};

void MyStackingAction::SetPosCut ( G4double  val  )  [inline]

Definition at line 115 of file MyStackingAction.hh.

References fPosCut.

00115 {fPosCut = val;};

void MyStackingAction::SetStackManager ( G4StackManager *  value  )  [inline]

Definition at line 36 of file MyStackingAction.hh.

00037             { stackManager = value; }


Member Data Documentation

G4double MyStackingAction::fEleCut [private]

Definition at line 146 of file MyStackingAction.hh.

Referenced by ClassifyNewTrack(), GetEleCut(), and SetEleCut().

G4double MyStackingAction::fGamCut [private]

Definition at line 148 of file MyStackingAction.hh.

Referenced by ClassifyNewTrack(), GetGamCut(), and SetGamCut().

G4double MyStackingAction::fPosCut [private]

Definition at line 147 of file MyStackingAction.hh.

Referenced by ClassifyNewTrack(), GetPosCut(), and SetPosCut().

Definition at line 142 of file MyStackingAction.hh.

Referenced by MyStackingAction().

std::vector<int> MyStackingAction::m_black_list [private]
bool MyStackingAction::m_no_MC [private]

Definition at line 151 of file MyStackingAction.hh.

Referenced by ClassifyNewTrack(), MyStackingAction(), and set_no_MC().

bool MyStackingAction::m_no_PC [private]

Definition at line 150 of file MyStackingAction.hh.

Referenced by ClassifyNewTrack(), MyStackingAction(), and set_no_PC().

Definition at line 152 of file MyStackingAction.hh.

Referenced by ClassifyNewTrack(), MyStackingAction(), and set_no_sec().

std::vector<int> MyStackingAction::m_white_list [private]

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

Generated on 15 Jun 2016 for g4sim by  doxygen 1.6.1