#include <BLManager.hh>
Note it is uses all the G4 user action classes, implemented as classes under BLManager.
TrackID-s: It is non-trivial to preserve TrackID-s from input files, because Geant4 considers TrackID to be an internal variable, and it assigns them in a non-customizable manner. So BLManager keeps a trackIDMap[] that converts from internal (Geant4) to external (User) TrackID-s. It also uses BLTrackInfo to associate the external IDs with the track -- the external trackID is determined either in BLBeam (when the track is created), or in BLManager::PreUserTrackingAction for secondaries.
Public Member Functions | |
void | delayedConstruction () |
delayedConstruction() performs things which must wait until all static initializers have executed (e.g. in Geant4 routines). | |
~BLManager () | |
Destructor. | |
BLManagerState | getState () |
getState() returns the current state. | |
void | setState (BLManagerState _state) |
setState sets the state | |
int | getSteppingVerbose () |
getSteppingVerbose() returns steppingVerbose. NOTE: use this during tracking instead of Param.getInt("steppingVerbose"); | |
void | setSteppingVerbose (int v) |
setSteppingVerbose() updates steppingVerbose. -- NOTE: many other classes relay on the Parameter, not the valud in this class. | |
int | getEventTimeLimit () |
getEventTimeLimit() returns the CPU time limit for events (seconds). -1 mean infinite. | |
void | setEventTimeLimit (int sec) |
setEventTimeLimit() sets the CPU time limit for events (seconds). -1 mean infinite. | |
G4int | getEventID () const |
getEventID() gets the current eventID; | |
void | setEventID (int evId) |
setEventID() sets the current eventID; | |
bool | skipEvent (int EventID) |
skipEvent() will check the eventList vector (which comes from the eventCut file). | |
void | incrEventsProcessed (int eventID) |
incrEventsProcessed() will increment eventsProcessed. For special uses only (e.g.MPI). | |
void | registerSteppingAction (SteppingAction *sa) |
registerSteppingAction() registers a SteppingAction to be called for each step (regardless of state). | |
void | registerSteppingAction (G4VPhysicalVolume *physicalVol, SteppingAction *sa) |
registerSteppingAction() registers a SteppingAction to be called for each step (regardless of state), for every step involving the physicalVol. The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). If physicalVol==0 it is called every reference particle step. LIMITATION: only one callback can be registered for a given physicalVol (except 0). | |
void | registerTuneParticleStep (G4VPhysicalVolume *physicalVol, SteppingAction *sa) |
registerTuneParticleStep() registers a SteppingAction to be called for every tune particle step involving the physicalVol. The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). If physicalVol==0 it is called every tune particle step. LIMITATION: only one callback can be registered for a given physicalVol (except 0). | |
void | registerReferenceParticleStep (G4VPhysicalVolume *physicalVol, SteppingAction *sa) |
registerReferenceParticleStep() registers a SteppingAction to be called for every reference particle step involving the physicalVol. The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). If physicalVol==0 it is called every reference particle step. LIMITATION: only one callback can be registered for a given physicalVol (except 0). | |
void | registerBeamStep (G4VPhysicalVolume *physicalVol, SteppingAction *sa) |
registerBeamStep() registers a SteppingAction to be called for every beam step involving the physicalVol. (beam particles are everything except reference and tune.) The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). if physicalVol==0 it is called every beam step. LIMITATION: only one callback can be registered for a given physicalVol (except 0). | |
void | registerZStep (G4double z, ZSteppingAction *sa, G4int when=7) |
registerZStep() will force a step to occur near the given z position, and will call the ZSteppingAction for it, interpolating to the desired z value (Centerline coords). when is a bitwise OR of 1=tune, 2=reference, 4=beam. | |
void | registerStackingAction (StackingAction *sa) |
registerStackingAction() registers a StackingAction to be called by the Geant4 stacking manager. | |
void | setSteppingFormat () |
setSteppingFormat() sets the verbose printing format according to parameter "steppingFormat". | |
G4String | getFormatHelp () |
getFormatHelp() returns a string with help text about valid format items. | |
void | appendVerboseFormat (G4String fmt) |
appendVerboseFormat() appends fmt to the format for printing when param steppingVerbose is nonzero | |
void | steppingVerbosePrint (const G4Step *step, const G4Track *track, int header=0) |
steppingVerbosePrint() will print this step according to the current verboseFormat. Prints header if header != 0). | |
void | setSteppingManager (G4SteppingManager *p) |
setSteppingManager() sets the pointer to the current G4SteppingManager. | |
G4SteppingManager * | getSteppingManager () |
getSteppingManager() returns a pointer to the current G4SteppingManager. | |
void | setTrackingManager (G4TrackingManager *p) |
setTrackingManager() sets the pointer to the current G4TrackingManager. | |
void | initialize () |
initialize() will initialize the BLManager object, and the geant4 kernel, thus constructing the geometry in the world group. Note that registerPhysics() must be called before initialize() (normally done by a "physics" command in the input file). | |
void | trackTuneAndReferenceParticles () |
trackTuneAndReferenceParticles() will generate and track the tune particle and then the reference particle. | |
void | trackBeam () |
trackBeam() will generate the defined beam and track each event. | |
void | displayVisual () |
displayVisual() will display the detector visually. | |
void | displayGeometry (G4VPhysicalVolume *phys=0, int level=0) |
displayGeometry() will display the geant4 geometry. This is a hierarchical ASCII listing of all volumes. if phys==0 then use the worldPhysicalVolume. | |
void | registerPhysics (BLPhysics *_physics) |
registerPhysics() registers the BLPhysics object. It also sets the physics list to the BLRunManager, so following commands can find particle by name. | |
BLPhysics * | getPhysics () |
getPhysics returns the registered BLPhysics object. | |
void | registerBeam (BLBeam *_beam) |
registerBeam() registers a BLBeam object for beam generation. Multiple BLBeam objects can be registered, used in order. | |
void | registerReference (BLBeam *_beam) |
registerReference() registers a BLBeam object for reference particle generation. Multiple BLBeam objects can be registered, used in order. | |
int | nReference () |
nReference() returns the number of reference particles registered. | |
void | registerRunAction (RunAction *a, G4bool beamOnly=true) |
registerRunAction() registers a UserRunAction. If beamOnly is true (the default), the callback is made only if state==BEAM. | |
void | registerEventAction (EventAction *a, G4bool beamOnly=true) |
registerEventAction() registers a UserEventAction. If beamOnly is true (the default), the callback is made only if state==BEAM. | |
void | registerTrackingAction (TrackingAction *a) |
registerTrackingAction() registers a UserTackingAction. | |
void | registerUserCode (BLUserCode *instance) |
registerUserCode() registers a BLUserCode instance. | |
std::vector< BLUserCode * > | getUserCodeInstances (G4String type) |
getUserCodeInstances() returns a vector of all registered instances of BLUserCode with the specified type. | |
void | registerCallback (BLCallback *cb, int type) |
registerCallback() registers a BLCallback. type=0 for pre-Tune particle, type=1 for post-Reference (pre-beam tracking), type=2 for post-beam tracking. type=3 for replacing the main program loop. type=4 for visualization. NOTE: if there are type=3 callbacks, when the last one returns the closes up by summarizing NTuples and callng handleCallbacks(2), and then the program exits. This prevents the main program loop from executing. type=3 callbacks are called just after the type=1 callbacks (i.e. after the post-Reference callbacks). | |
void | handleCallbacks (int type) |
handleCallbacks() calls all applicable registered callbacks. type=0 for pre-reference particle, type=1 for post-center (pre-beam tracking), type=2 for post-beam tracking (just before program exit). type=3 for replacing the main program loop. type=4 for visualization. | |
G4VPhysicalVolume * | getWorldPhysicalVolume () |
getWorldPhysicalVolume() returns a pointer to the world PV. Note that it must already have been consructed, so this function returns NULL before construct() is called (by main). | |
void | setPRNGSeedMethod (PRNGSeedMethod method) |
setPRNGSeedMethod() will set the method used to seed the pseudo random number generator at the start of each event. | |
PRNGSeedMethod | getPRNGSeedMethod () |
getPRNGSeedMethod() will return the method used to seed the pseudo random number generator at the start of each event. | |
void | setEventCutFile (G4String &f) |
setEventCutFile() will set the file containing event s for cutting. The file is ASCII, with one event number per line; lines beginning with # are ignored. | |
void | UserSteppingAction (const G4Step *step) |
UserSteppingAction() from G4UserSteppingAction. | |
G4VPhysicalVolume * | Construct () |
Construct() from G4VUserDetectorConstruction. | |
void | PreUserTrackingAction (const G4Track *track) |
PreUserTrackingAction() from G4UserTrackingAction. | |
void | PostUserTrackingAction (const G4Track *track) |
PostUserTrackingAction() from G4UserTrackingAction. | |
void | BeginOfRunAction (const G4Run *run) |
BeginOfRunAction() from G4UserRunAction. | |
void | EndOfRunAction (const G4Run *run) |
EndOfRunAction() from G4UserRunAction. | |
void | BeginOfEventAction (const G4Event *event) |
BeginOfEventAction() from G4UserEventAction. | |
void | EndOfEventAction (const G4Event *event) |
EndOfEventAction() from G4UserEventAction. | |
void | GeneratePrimaries (G4Event *event) |
GeneratePrimaries() from G4VUserPrimaryGeneratorAction. | |
G4ClassificationOfNewTrack | ClassifyNewTrack (const G4Track *) |
ClassifyNewTrack() from G4UserStackingAction. | |
void | NewStage () |
NewStage() from G4userStackingAction. | |
void | PrepareNewEvent () |
PrepareNewEvent() from G4StackingAction. | |
void | clearTrackIDMap () |
clearTrackIDMap() clears the TrackID map. | |
void | setNextSecondaryTrackID (int next) |
setNextSecondaryTrackID() sets the external TrackID for the next secondary track. Automatically incremented for subsequent secondaries. | |
int | getNextSecondaryTrackID () |
int | getExternalTrackID (const G4Track *track) |
getExternalTrackID() returns the external TrackID for the given track. In collective mode, internal and external trackID-s are the same. | |
int | getExternalParentID (const G4Track *track) |
getExternalParentID() returns the external ParentID for the given track. In collective mode, internal and external trackID-s are the same. | |
void | setExternalTrackID (G4Track *track, int trackID, int parentID) |
setExternalTrackID() will set the external trackID and parentID. if trackID<0 uses nextSecondarTrackID++. | |
int | getPrimaryTrackID () |
getPrimaryTrackID() returns the primaryTrackID set by the beam command | |
int | getPrimaryParentID () |
getPrimaryParentID() returns the primaryParentID set by the beam command | |
void | setPrimaryTrackID (int t, int p) |
setPrimaryTrackID() sets track and parent IDs for a primary track. | |
G4bool | Notify (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description) |
Notify() from G4VExceptionHandler. | |
void | exceptionSummary () |
exceptionSummary() prints a summary of all exceptions | |
Static Public Member Functions | |
static BLManager * | getObject () |
getObject() will return a pointer to the single BLManager object, creating it if necessary. Does only the immediate constructor, not delayedConstruction(). that means it is Ok to register capabilities, but not much else. | |
static bool | isInitialized () |
isInitialized() returns true if the BLManager has been initialized. | |
Private Member Functions | |
BLManager () | |
private constructor -- immediate construction only. | |
void | insertZStep (std::vector< ZStep > &vector, G4double z, ZSteppingAction *action) |
void | readEventCutFile () |
Private Attributes | |
BLRunManager * | runManager |
BLManagerState | state |
G4int | steppingVerbose |
unsigned int | beamIndex |
G4int | histoUpdate |
time_t | startRun |
time_t | startEvent |
G4int | eventTimeLimit |
BLPhysics * | physics |
G4VPhysicalVolume * | worldPhysicalVolume |
G4int | eventID |
G4int | trackID |
G4ParticleDefinition * | trackParticleDef |
G4int | fatalExceptions |
G4int | eventsAborted |
G4int | tracksAborted |
G4int | warnings |
G4int | prevEventID |
G4int | eventsProcessed |
bool | endRun |
PRNGSeedMethod | seedMethod |
G4String | eventCutFile |
std::set< int > | eventList |
G4SteppingManager * | fpSteppingManager |
G4TrackingManager * | fpTrackingManager |
std::vector< BLBeam * > | beamVector |
std::vector< BLBeam * > | referenceVector |
std::vector< RunAction * > | runActionVector |
std::vector< RunAction * > | beamRunActionVector |
std::vector< EventAction * > | eventActionVector |
std::vector< EventAction * > | beamEventActionVector |
std::vector< TrackingAction * > | trackingActionVector |
std::vector< BLCallback * > | preReferenceCallbackVector |
std::vector< BLCallback * > | postReferenceCallbackVector |
std::vector< BLCallback * > | postTrackingCallbackVector |
std::vector< BLCallback * > | replaceMainLoopCallbackVector |
std::vector< BLCallback * > | visualizationCallbackVector |
std::vector< SteppingAction * > | allStepVector |
std::map< G4VPhysicalVolume *, SteppingAction * > | allStepMap |
std::map< G4VPhysicalVolume *, SteppingAction * > | tpStepMap |
std::map< G4VPhysicalVolume *, SteppingAction * > | rpStepMap |
std::vector< SteppingAction * > | tpStepVector |
std::vector< SteppingAction * > | rpStepVector |
std::map< G4VPhysicalVolume *, SteppingAction * > | beamStepMap |
std::vector< SteppingAction * > | beamStepVector |
std::vector< int > | verboseFormat |
G4double | zTolerance |
std::vector< ZStep > | tuneZStep |
std::vector< ZStep > | referenceZStep |
std::vector< ZStep > | beamZStep |
std::vector< ZStep > * | currentZStep |
unsigned | indexZStep |
G4double | prevZ |
G4int | nStuck |
std::vector< StackingAction * > | stackingActionVector |
int | nextSecondaryTrackID |
std::map< G4int, G4int > | trackIDMap |
int | primaryTrackID |
int | primaryParentID |
std::vector< BLUserCode * > | userCodeVector |
std::map< G4String, int > | exceptionCount |
Static Private Attributes | |
static BLManager * | blManager = 0 |
static bool | initialized = false |
Classes | |
class | EventAction |
class | PrimaryGeneratorAction |
class | RunAction |
class | StackingAction |
class | SteppingAction |
class | TrackingAction |
struct | ZStep |
class | ZSteppingAction |
BLManager::BLManager | ( | ) | [private] |
private constructor -- immediate construction only.
References beamIndex, beamZStep, blManager, CL, currentZStep, endRun, EVENT_NUMBER, eventCutFile, eventID, eventsAborted, eventsProcessed, eventTimeLimit, fatalExceptions, BLParam::getDouble(), GLOBAL, histoUpdate, IDLE, indexZStep, BLAlarm::init(), KE, NEWLINE, nextSecondaryTrackID, NSTEP, nStuck, Param, physics, prevEventID, prevZ, primaryParentID, primaryTrackID, PROCESS, referenceZStep, runManager, seedMethod, startEvent, startRun, state, STEP, steppingVerbose, trackID, trackParticleDef, tracksAborted, tuneZStep, verboseFormat, VOL, warnings, worldPhysicalVolume, and zTolerance.
Referenced by getObject().
00200 : G4VUserDetectorConstruction(), 00201 G4VExceptionHandler(), eventList(), 00202 beamVector(), referenceVector(), 00203 runActionVector(), beamRunActionVector(), 00204 eventActionVector(), beamEventActionVector(), 00205 trackingActionVector(), preReferenceCallbackVector(), 00206 postReferenceCallbackVector(), postTrackingCallbackVector(), 00207 replaceMainLoopCallbackVector(), visualizationCallbackVector(), 00208 allStepVector(), allStepMap(), tpStepMap(), rpStepMap(), 00209 tpStepVector(), rpStepVector(), 00210 beamStepMap(), beamStepVector(), verboseFormat(), 00211 tuneZStep(), referenceZStep(), beamZStep(), 00212 stackingActionVector(), trackIDMap(), userCodeVector(), 00213 exceptionCount() 00214 { 00215 // Parameter definitions (variables are all unused): 00216 BLSetParam unused_1("histoFile","g4beamline", 00217 "Default (Root) NTuple output filename"); 00218 BLSetParam unused_2("histoUpdate","0", 00219 "Output update interval (events)"); 00220 BLSetParam unused_3("viewer","none", 00221 "Visualization driver selected (default=none)"); 00222 BLSetParam unused_4("eventTimeLimit","30", 00223 "CPU Time Limit (sec)"); 00224 BLSetParam unused_5("steppingVerbose","0", 00225 "Set nonzero to print each step"); 00226 BLSetParam unused_6("steppingFormat", "N GLOBAL CL KE STEP VOL PROCESS", 00227 "Format for printing steps"); 00228 BLSetParam unused_7("zTolerance","2.0", 00229 "Tolerance for Z steps (mm)"); 00230 00231 if(blManager) 00232 G4Exception("BLManager","Object Already Exists",FatalException, 00233 ""); 00234 blManager = this; 00235 00236 state = IDLE; 00237 steppingVerbose = 0; 00238 00239 // ensure ZStep vectors have bookends 00240 tuneZStep.push_back(ZStep(-DBL_MAX,0)); 00241 tuneZStep.push_back(ZStep(DBL_MAX,0)); 00242 referenceZStep.push_back(ZStep(-DBL_MAX,0)); 00243 referenceZStep.push_back(ZStep(DBL_MAX,0)); 00244 beamZStep.push_back(ZStep(-DBL_MAX,0)); 00245 beamZStep.push_back(ZStep(DBL_MAX,0)); 00246 currentZStep = &beamZStep; 00247 indexZStep = 1; 00248 zTolerance = Param.getDouble("zTolerance"); 00249 prevZ = -DBL_MAX; 00250 00251 // default verbose format 00252 verboseFormat.push_back(NSTEP); 00253 verboseFormat.push_back(GLOBAL); 00254 verboseFormat.push_back(CL); 00255 verboseFormat.push_back(KE); 00256 verboseFormat.push_back(STEP); 00257 verboseFormat.push_back(VOL); 00258 verboseFormat.push_back(PROCESS); 00259 verboseFormat.push_back(NEWLINE); 00260 00261 runManager = 0; 00262 state = IDLE; 00263 beamIndex = 0; 00264 histoUpdate = 0; 00265 startRun = 0; 00266 startEvent = 0; 00267 eventTimeLimit = 30; 00268 physics = 0; 00269 worldPhysicalVolume = 0; 00270 eventID = 1; 00271 trackID=-9999; 00272 trackParticleDef = 0; 00273 fatalExceptions = 0; 00274 eventsAborted=0; 00275 tracksAborted = 0; 00276 warnings=0; 00277 prevEventID = 0; 00278 eventsProcessed = 0; 00279 endRun = false; 00280 seedMethod = EVENT_NUMBER; 00281 eventCutFile = ""; 00282 nStuck = 0; 00283 primaryTrackID = -1; 00284 primaryParentID = -1; 00285 nextSecondaryTrackID = 1001; 00286 00287 BLAlarm::init(); 00288 00289 G4StateManager * stateManager = G4StateManager::GetStateManager(); 00290 stateManager->SetExceptionHandler(this); 00291 }
BLManager::~BLManager | ( | ) |
Destructor.
References blManager.
00301 { 00302 // cannot delete runManager, as it deletes the detector, 00303 // steppingaction, eventaction, ..., and that becomes multiple 00304 // deletes of this object. But we are exiting, so we don't really 00305 // need to delete anything. 00306 //delete runManager; 00307 00308 // Instead of deleting things, just open the geometry to avoid 00309 // warnings when exit() is called. 00310 G4GeometryManager::GetInstance()->OpenGeometry(); 00311 00312 blManager = 0; 00313 }
void BLManager::insertZStep | ( | std::vector< ZStep > & | vector, | |
G4double | z, | |||
ZSteppingAction * | action | |||
) | [private] |
Referenced by registerZStep().
00387 { 00388 // the bookends in vector (see BLManager()) ensure this works 00389 std::vector<ZStep>::iterator i; 00390 for(i=vector.begin(); i<vector.end(); ++i) { 00391 if(z < i->z) { // preserve order for == 00392 ZStep zs(z,action); 00393 vector.insert(i,zs); 00394 break; 00395 } 00396 } 00397 }
void BLManager::readEventCutFile | ( | ) | [private] |
References BLAssert, eventCutFile, and eventList.
Referenced by BeginOfRunAction().
01507 { 01508 eventList.clear(); 01509 if(eventCutFile.size() == 0) return; 01510 01511 FILE *in = fopen(eventCutFile.c_str(),"r"); 01512 if(!in) { 01513 printf("WARNING: Cannot read eventCutFile '%s' -- IGNORED\n", 01514 eventCutFile.c_str()); 01515 return; 01516 } 01517 01518 char line[1025]; 01519 while(fgets(line,sizeof(line),in)) { 01520 BLAssert(strlen(line) < sizeof(line)-1); 01521 if(line[0] == '#') continue; 01522 long ev = strtol(line,0,0); 01523 eventList.insert(ev); 01524 } 01525 01526 fclose(in); 01527 01528 // eventList is ignored if empty, so insert a crazy entry 01529 if(eventList.size() == 0) eventList.insert(0x80000000); 01530 }
BLManager * BLManager::getObject | ( | ) | [static] |
getObject() will return a pointer to the single BLManager object, creating it if necessary. Does only the immediate constructor, not delayedConstruction(). that means it is Ok to register capabilities, but not much else.
References BLManager(), and blManager.
Referenced by FOR009NTuple::appendRow(), TrackFileNTuple::appendRow(), BLTrackNTuple::appendTrack(), BLRunManager::BeamOn(), BLRunManager::beamOnCollective(), BLCMDmovie::beamStep(), BLRunManager::beginEvent(), BLRunManager::beginRun(), BLVirtualDetectorNTuple::BLVirtualDetectorNTuple(), BLCMDzntuple::callback(), BLCMDtrackermode::callback(), BLCMDtotalenergy::callback(), BLCMDshowmaterial::callback(), BLCMDgeometry::callback(), BLCMDtrackcuts::ClassifyNewTrack(), BLCMDcollective::collectiveStep(), BLCMDzntuple::command(), BLCMDusertrackfilter::command(), BLCMDtune::command(), BLCMDtrackermode::command(), BLCMDtracker::command(), BLCMDtrackcuts::command(), BLCMDtrace::command(), BLCMDtotalenergy::command(), BLCMDtimentuple::command(), BLCMDshowmaterial::command(), BLCMDsetdecay::command(), BLCMDreference::command(), BLCMDrandomseed::command(), BLCMDprofile::command(), BLCMDprobefield::command(), BLCMDprintfield::command(), BLCMDprintf::command(), BLCMDphysics::command(), BLCMDparticlesource::command(), BLCMDparticlecolor::command(), BLCMDntuple::command(), BLCMDnewparticlentuple::command(), BLCMDmuminuscapturefix::command(), BLCMDmovie::command(), BLCMDlist::command(), BLCMDhelp::command(), BLCMDgeometry::command(), BLCMDg4ui::command(), BLCMDfieldntuple::command(), BLCMDeventcuts::command(), BLCMDcosmicraybeam::command(), BLCMDbug1021::command(), BLCMDbeamlossntuple::command(), BLCMDbeam::command(), BLCMDvirtualdetector::construct(), BLCMDusertrackfilter::construct(), BLCMDtubs::construct(), BLCMDtrap::construct(), BLCMDtrackerplane::construct(), BLCMDtorus::construct(), BLCMDsphere::construct(), BLCMDsolenoid::construct(), BLCMDpolycone::construct(), BLCMDpillbox::construct(), BLCMDparticlefilter::construct(), BLCMDmultipole::construct(), BLCMDidealsectorbend::construct(), BLCMDhelicaldipole::construct(), BLCMDgenericquad::construct(), BLCMDgenericbend::construct(), BLCMDextrusion::construct(), BLCMDcorner::construct(), BLCMDbox::construct(), BLRunManager::endEvent(), BLCMDparticlecolor::EndOfEventAction(), BLRunManager::endRun(), SetDecayInstance::fatalError(), BLCMDtracker::fitTrack(), BLCMDreference::generateReferenceParticle(), BLRunManager::getNextBeamEventAndTrack(), BLCMDparticlecolor::getVisAttributes(), BLCMDtracker::handlePreviousTracks(), BLCMDparam::help(), BLCoordinates::init(), BLCMDlist::listParticles(), main(), BLCMDparticlesource::nextBeamEvent(), BLCMDbeam::nextBeamEvent(), BLCMDtracker::operator()(), ParticleFilterPlacement::ParticleFilterPlacement(), BLCoordinates::ReferenceCoordinates::PostUserTrackingAction(), BLCMDtracker::PostUserTrackingAction(), BLCMDreference::PostUserTrackingAction(), BLCMDparticlecolor::PostUserTrackingAction(), BLCMDbeamlossntuple::PostUserTrackingAction(), BLCoordinates::ReferenceCoordinates::PreUserTrackingAction(), BLCMDtracker::PreUserTrackingAction(), BLCMDreference::PreUserTrackingAction(), BLCMDparticlecolor::PreUserTrackingAction(), BLCMDnewparticlentuple::PreUserTrackingAction(), BLCoordinates::ReferenceCoordinates::ReferenceCoordinates(), BLUserCode::registerUserCode(), BLBeam::setRandomSeedToGenerate(), BLEvaluator::setTrackVariables(), BLCoordinates::start(), steppingVerbosePrint(), Surface::Surface(), TraceNTuple::TraceNTuple(), BLCoordinates::ReferenceCoordinates::UserSteppingAction(), BLVirtualDetectorNTuple::UserSteppingAction(), BLCMDusertrackfilter::UserSteppingAction(), TrackerPlaneInstance::UserSteppingAction(), TimeNTuple::UserSteppingAction(), PillboxField::UserSteppingAction(), ParticleFilterPlacement::UserSteppingAction(), BLCMDzntuple::Entry::UserZSteppingAction(), BLCMDtune::UserZSteppingAction(), BLCMDtracker::UserZSteppingAction(), BLCMDreference::UserZSteppingAction(), BLCMDprofile::Entry::UserZSteppingAction(), and BLCMDprintf::UserZSteppingAction().
void BLManager::delayedConstruction | ( | ) |
delayedConstruction() performs things which must wait until all static initializers have executed (e.g. in Geant4 routines).
References runManager.
Referenced by main().
00294 { 00295 runManager = new BLRunManager(); 00296 G4StateManager * stateManager = G4StateManager::GetStateManager(); 00297 stateManager->SetExceptionHandler(this); 00298 }
BLManagerState BLManager::getState | ( | ) | [inline] |
getState() returns the current state.
References state.
Referenced by BLCMDparticlecolor::EndOfEventAction(), BLCMDtracker::fitTrack(), BLCMDparticlecolor::getVisAttributes(), BLCMDtracker::PostUserTrackingAction(), BLCMDreference::PostUserTrackingAction(), BLCMDparticlecolor::PostUserTrackingAction(), BLCMDmovie::PostUserTrackingAction(), BLCMDbeamlossntuple::PostUserTrackingAction(), BLCMDtracker::PreUserTrackingAction(), BLCMDreference::PreUserTrackingAction(), BLCMDparticlecolor::PreUserTrackingAction(), BLCMDnewparticlentuple::PreUserTrackingAction(), BLCMDmovie::PreUserTrackingAction(), BLVirtualDetectorNTuple::UserSteppingAction(), TrackerPlaneInstance::UserSteppingAction(), BLCMDtrace::UserSteppingAction(), TimeNTuple::UserSteppingAction(), BLCMDmovie::UserSteppingAction(), BLCMDzntuple::Entry::UserZSteppingAction(), BLCMDprofile::Entry::UserZSteppingAction(), and BLCMDprintf::UserZSteppingAction().
00187 { return state; }
void BLManager::setState | ( | BLManagerState | _state | ) | [inline] |
setState sets the state
References state.
Referenced by BLRunManager::beamOnCollective(), BLRunManager::beginRun(), BLCMDtrackermode::callback(), BLRunManager::endRun(), BLRunManager::getNextBeamEventAndTrack(), and BLCMDtracker::handlePreviousTracks().
00190 { state = _state; }
int BLManager::getSteppingVerbose | ( | ) | [inline] |
getSteppingVerbose() returns steppingVerbose. NOTE: use this during tracking instead of Param.getInt("steppingVerbose");
References steppingVerbose.
Referenced by BLVirtualDetectorNTuple::BLVirtualDetectorNTuple(), BLCoordinates::init(), and BLCoordinates::start().
00194 { return steppingVerbose; }
void BLManager::setSteppingVerbose | ( | int | v | ) | [inline] |
setSteppingVerbose() updates steppingVerbose. -- NOTE: many other classes relay on the Parameter, not the valud in this class.
References steppingVerbose.
00198 { steppingVerbose = v; }
int BLManager::getEventTimeLimit | ( | ) | [inline] |
getEventTimeLimit() returns the CPU time limit for events (seconds). -1 mean infinite.
References eventTimeLimit.
00202 { return eventTimeLimit; }
void BLManager::setEventTimeLimit | ( | int | sec | ) | [inline] |
setEventTimeLimit() sets the CPU time limit for events (seconds). -1 mean infinite.
References eventTimeLimit.
Referenced by BLRunManager::beamOnCollective().
00206 { eventTimeLimit = sec; }
G4int BLManager::getEventID | ( | ) | const [inline] |
getEventID() gets the current eventID;
References eventID.
Referenced by FOR009NTuple::appendRow(), TrackFileNTuple::appendRow(), BLCMDparticlesource::nextBeamEvent(), BLCMDbeam::nextBeamEvent(), and BLCMDusertrackfilter::UserSteppingAction().
00209 { return eventID; }
void BLManager::setEventID | ( | int | evId | ) | [inline] |
setEventID() sets the current eventID;
References eventID, and prevEventID.
Referenced by BLRunManager::beamOnCollective(), displayVisual(), GeneratePrimaries(), BLCMDtracker::handlePreviousTracks(), trackBeam(), and trackTuneAndReferenceParticles().
00212 { eventID=evId; prevEventID=evId-1; }
bool BLManager::skipEvent | ( | int | EventID | ) | [inline] |
skipEvent() will check the eventList vector (which comes from the eventCut file).
References eventID, and eventList.
Referenced by GeneratePrimaries().
void BLManager::incrEventsProcessed | ( | int | eventID | ) |
incrEventsProcessed() will increment eventsProcessed. For special uses only (e.g.MPI).
References eventsProcessed, BLRunManager::getCollectiveMode(), runManager, startRun, and BLTime::time().
Referenced by EndOfEventAction().
01088 { 01089 // print event number, if appropriate 01090 ++eventsProcessed; 01091 if(!runManager->getCollectiveMode()) { 01092 if(eventsProcessed <= 10 || 01093 (eventsProcessed < 100 && eventsProcessed%10 == 0) || 01094 (eventsProcessed < 1000 && eventsProcessed%100 == 0) || 01095 eventsProcessed%1000 == 0) { 01096 printf("Event %d Completed",eventID); 01097 int t = BLTime::time() - startRun; 01098 if(t <= 0) t = 1; 01099 printf(" %d events realTime=%d sec %.1f ev/sec", 01100 eventsProcessed,t,(double)eventsProcessed/t); 01101 printf("\n"); 01102 fflush(stdout); 01103 } 01104 } 01105 }
void BLManager::registerSteppingAction | ( | SteppingAction * | sa | ) | [inline] |
registerSteppingAction() registers a SteppingAction to be called for each step (regardless of state).
References allStepVector.
Referenced by BLCMDtrackcuts::command(), BLCMDtrace::command(), BLCMDusertrackfilter::construct(), BLCMDparticlefilter::construct(), and BLCMDcorner::construct().
00226 { allStepVector.push_back(sa); }
void BLManager::registerSteppingAction | ( | G4VPhysicalVolume * | physicalVol, | |
SteppingAction * | sa | |||
) | [inline] |
registerSteppingAction() registers a SteppingAction to be called for each step (regardless of state), for every step involving the physicalVol. The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). If physicalVol==0 it is called every reference particle step. LIMITATION: only one callback can be registered for a given physicalVol (except 0).
References allStepMap, and allStepVector.
00238 { if(physicalVol != 0) allStepMap[physicalVol] = sa; 00239 else allStepVector.push_back(sa); }
void BLManager::registerTuneParticleStep | ( | G4VPhysicalVolume * | physicalVol, | |
SteppingAction * | sa | |||
) | [inline] |
registerTuneParticleStep() registers a SteppingAction to be called for every tune particle step involving the physicalVol. The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). If physicalVol==0 it is called every tune particle step. LIMITATION: only one callback can be registered for a given physicalVol (except 0).
References tpStepMap, and tpStepVector.
Referenced by BLCMDpillbox::construct().
00250 { if(physicalVol != 0) tpStepMap[physicalVol] = sa; 00251 else tpStepVector.push_back(sa); }
void BLManager::registerReferenceParticleStep | ( | G4VPhysicalVolume * | physicalVol, | |
SteppingAction * | sa | |||
) | [inline] |
registerReferenceParticleStep() registers a SteppingAction to be called for every reference particle step involving the physicalVol. The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). If physicalVol==0 it is called every reference particle step. LIMITATION: only one callback can be registered for a given physicalVol (except 0).
References rpStepMap, and rpStepVector.
Referenced by BLCMDmovie::command(), BLCMDvirtualdetector::construct(), BLCMDtrackerplane::construct(), and BLCoordinates::ReferenceCoordinates::ReferenceCoordinates().
00263 { if(physicalVol != 0) rpStepMap[physicalVol] = sa; 00264 else rpStepVector.push_back(sa); }
void BLManager::registerBeamStep | ( | G4VPhysicalVolume * | physicalVol, | |
SteppingAction * | sa | |||
) | [inline] |
registerBeamStep() registers a SteppingAction to be called for every beam step involving the physicalVol. (beam particles are everything except reference and tune.) The callback will be called if physicalVol is either the pre- or post-step physical volume (once if both). if physicalVol==0 it is called every beam step. LIMITATION: only one callback can be registered for a given physicalVol (except 0).
References beamStepMap, and beamStepVector.
Referenced by BLCMDtotalenergy::command(), BLCMDtimentuple::command(), BLCMDmovie::command(), BLCMDvirtualdetector::construct(), and BLCMDtrackerplane::construct().
00276 { if(physicalVol != 0) beamStepMap[physicalVol] = sa; 00277 else beamStepVector.push_back(sa); }
void BLManager::registerZStep | ( | G4double | z, | |
ZSteppingAction * | sa, | |||
G4int | when = 7 | |||
) |
registerZStep() will force a step to occur near the given z position, and will call the ZSteppingAction for it, interpolating to the desired z value (Centerline coords). when is a bitwise OR of 1=tune, 2=reference, 4=beam.
References beamZStep, insertZStep(), referenceZStep, and tuneZStep.
Referenced by BLCMDzntuple::callback(), BLCMDtune::command(), BLCMDtracker::command(), BLCMDreference::command(), BLCMDprofile::command(), and BLCMDprintf::command().
00400 { 00401 if(when & 1) insertZStep(tuneZStep,z,sa); 00402 if(when & 2) insertZStep(referenceZStep,z,sa); 00403 if(when & 4) insertZStep(beamZStep,z,sa); 00404 }
void BLManager::registerStackingAction | ( | StackingAction * | sa | ) | [inline] |
registerStackingAction() registers a StackingAction to be called by the Geant4 stacking manager.
References stackingActionVector.
Referenced by BLCMDtrackcuts::command().
00288 { stackingActionVector.push_back(sa); }
void BLManager::setSteppingFormat | ( | ) |
setSteppingFormat() sets the verbose printing format according to parameter "steppingFormat".
References appendVerboseFormat(), BLParam::getString(), Param, and BLCommand::parseArgs().
Referenced by initialize().
01213 { 01214 G4String fmt = Param.getString("steppingFormat"); 01215 BLArgumentVector args; 01216 BLArgumentMap namedArgs; 01217 01218 // convert "," to " " 01219 G4String s; 01220 for(unsigned i=0; i<fmt.size(); ++i) 01221 s += (fmt[i]==',' ? ' ' : fmt[i]); 01222 01223 BLCommand::parseArgs(s,args,namedArgs); 01224 appendVerboseFormat(""); 01225 for(unsigned i=0; i<args.size(); ++i) 01226 appendVerboseFormat(args[i]); 01227 appendVerboseFormat("NEWLINE"); 01228 }
G4String BLManager::getFormatHelp | ( | ) |
getFormatHelp() returns a string with help text about valid format items.
01231 { 01232 G4String s = 01233 " EXT toggle extended precision (3 more digits)\n" 01234 " TAG print a '>' (useful to grep output)\n" 01235 " N step number\n" 01236 " NSTEP Synonym of N\n" 01237 " GLOBAL X,Y,Z,T in global coords\n" 01238 " XYZT Synonym of GLOBAL\n" 01239 " CL X,Y,Z,dxdz,dydz in CL coords\n" 01240 " CLX extended precision CL\n" 01241 " KE kinetic energy\n" 01242 " STEP step length\n" 01243 " STEPLEN Synonym of STEP\n" 01244 " VOL volume name\n" 01245 " VOLNAME Synonym of VOL\n" 01246 " PROCESS process name\n" 01247 " B magnetic field\n" 01248 " E electric field\n" 01249 " P 3-momentum\n" 01250 " MAT material name\n" 01251 " ID event ID, track ID, parent ID\n" 01252 " PART particle name\n" 01253 " SEG centerline coord segment number\n" 01254 " WT weight\n" 01255 " NL <newline>\n" 01256 " NEWLINE Synonym of NL\n" 01257 " \\n Synonym of NL\n"; 01258 01259 return s; 01260 }
void BLManager::appendVerboseFormat | ( | G4String | fmt | ) |
appendVerboseFormat() appends fmt to the format for printing when param steppingVerbose is nonzero
References B, CL, CLX, E, EXT, GLOBAL, ID, KE, MAT, NEWLINE, NSTEP, P, PART, PROCESS, SEG, STEP, TAG, verboseFormat, VOL, and WT.
Referenced by setSteppingFormat().
01263 { 01264 G4String f; 01265 for(const char *p=fmt.c_str(); *p; ++p) 01266 f += toupper(*p); 01267 if(f == "") verboseFormat.clear(); 01268 else if(f == "TAG") verboseFormat.push_back(TAG); 01269 else if(f == "EXT") verboseFormat.push_back(EXT); 01270 else if(f == "N") verboseFormat.push_back(NSTEP); 01271 else if(f == "NSTEP") verboseFormat.push_back(NSTEP); 01272 else if(f == "GLOBAL") verboseFormat.push_back(GLOBAL); 01273 else if(f == "XYZT") verboseFormat.push_back(GLOBAL); 01274 else if(f == "CL") verboseFormat.push_back(CL); 01275 else if(f == "CLX") verboseFormat.push_back(CLX); 01276 else if(f == "KE") verboseFormat.push_back(KE); 01277 else if(f == "STEP") verboseFormat.push_back(STEP); 01278 else if(f == "STEPLEN") verboseFormat.push_back(STEP); 01279 else if(f == "VOL") verboseFormat.push_back(VOL); 01280 else if(f == "VOLNAME") verboseFormat.push_back(VOL); 01281 else if(f == "PROCESS") verboseFormat.push_back(PROCESS); 01282 else if(f == "B") verboseFormat.push_back(B); 01283 else if(f == "E") verboseFormat.push_back(E); 01284 else if(f == "P") verboseFormat.push_back(P); 01285 else if(f == "MAT") verboseFormat.push_back(MAT); 01286 else if(f == "ID") verboseFormat.push_back(ID); 01287 else if(f == "PART") verboseFormat.push_back(PART); 01288 else if(f == "SEG") verboseFormat.push_back(SEG); 01289 else if(f == "WT") verboseFormat.push_back(WT); 01290 else if(f == "\n") verboseFormat.push_back(NEWLINE); 01291 else if(f == "NL") verboseFormat.push_back(NEWLINE); 01292 else if(f == "NEWLINE") verboseFormat.push_back(NEWLINE); 01293 else printf("BLManager: invalid verbose format '%s'\n", 01294 fmt.c_str()); 01295 }
void BLManager::steppingVerbosePrint | ( | const G4Step * | step, | |
const G4Track * | track, | |||
int | header = 0 | |||
) |
steppingVerbosePrint() will print this step according to the current verboseFormat. Prints header if header != 0).
References B, BLCOORD_CENTERLINE, CL, CLX, E, EXT, BLCoordinates::getCoords(), getExternalParentID(), getExternalTrackID(), BLGlobalField::GetFieldValue(), getObject(), BLGlobalField::getObject(), BLCoordinates::getRotation(), BLCoordinates::getSegmentCL(), GLOBAL, ID, BLCoordinates::isValid(), KE, MAT, NEWLINE, NSTEP, P, PART, PROCESS, runManager, SEG, STEP, TAG, verboseFormat, VOL, and WT.
Referenced by UserSteppingAction().
01299 { 01300 G4StepPoint *prePoint=0; 01301 G4VPhysicalVolume *preVol=0; 01302 G4StepPoint *postPoint=0; 01303 G4double time=0; 01304 G4ThreeVector position; 01305 G4Material *mat=0; 01306 int eventNum = -999; 01307 int nstep=0; 01308 const char *procName=0; 01309 BLCoordinates *coord = (track!=0 ? (BLCoordinates *)track->GetUserInformation() : 0); 01310 if(coord && !coord->isValid()) coord = 0; 01311 01312 if(!header) { 01313 prePoint = step->GetPreStepPoint(); 01314 preVol = prePoint->GetPhysicalVolume(); 01315 postPoint = step->GetPostStepPoint(); 01316 time = track->GetGlobalTime(); 01317 position = track->GetPosition(); 01318 mat = preVol->GetLogicalVolume()->GetMaterial(); 01319 nstep = track->GetCurrentStepNumber(); 01320 procName = (postPoint->GetProcessDefinedStep() ? 01321 postPoint->GetProcessDefinedStep()->GetProcessName().c_str() : 01322 "UserLimit"); 01323 const G4Event* event = runManager->GetCurrentEvent(); 01324 eventNum = event->GetEventID(); 01325 } 01326 01327 bool extended=false; 01328 for(unsigned i=0; i<verboseFormat.size(); ++i) { 01329 switch(verboseFormat[i]) { 01330 case EXT: 01331 extended = !extended; 01332 break; 01333 case TAG: 01334 if(header) printf(" "); 01335 else printf(">"); 01336 break; 01337 case NSTEP: 01338 if(header) printf(" Step"); 01339 else printf(" %4d",nstep); 01340 break; 01341 case GLOBAL: 01342 if(!extended) { 01343 if(header) printf(" X(mm) Y(mm) Z(mm) T(ns)"); 01344 else printf(" %7.1f %7.1f %7.1f %8.2f", 01345 position[0],position[1],position[2], 01346 time); 01347 } else { 01348 if(header) printf(" X(mm) Y(mm) Z(mm) T(ns) "); 01349 else printf(" %10.4f %10.4f %10.4f %11.5f", 01350 position[0],position[1],position[2], 01351 time); 01352 } 01353 break; 01354 case CL: 01355 if(extended) goto clx; 01356 if(header) { 01357 printf(" CL: X Y Z dxdz dydz"); 01358 } else { 01359 G4ThreeVector dir = track->GetMomentumDirection(); 01360 // transform to centerline coordinates 01361 G4ThreeVector clpos; 01362 coord->getCoords(BLCOORD_CENTERLINE,clpos); 01363 dir = coord->getRotation() * dir; 01364 printf(" %8.1f %8.1f %8.1f %7.4f %7.4f", 01365 clpos[0],clpos[1],clpos[2], 01366 dir[0]/dir[2],dir[1]/dir[2]); 01367 } 01368 break; 01369 case CLX: 01370 clx: if(header) { 01371 printf(" CL: X Y Z dxdz dydz "); 01372 } else { 01373 G4ThreeVector dir = track->GetMomentumDirection(); 01374 // transform to centerline coordinates 01375 G4ThreeVector clpos; 01376 coord->getCoords(BLCOORD_CENTERLINE,clpos); 01377 dir = coord->getRotation() * dir; 01378 printf(" %11.4f %11.4f %11.4f %10.7f %10.7f", 01379 clpos[0],clpos[1],clpos[2], 01380 dir[0]/dir[2],dir[1]/dir[2]); 01381 } 01382 break; 01383 case KE: 01384 if(!extended) { 01385 if(header) printf(" KE(MeV)"); 01386 else printf(" %8.1f",track->GetKineticEnergy()); 01387 } else { 01388 if(header) printf(" KE(MeV) "); 01389 else printf(" %11.4f",track->GetKineticEnergy()); 01390 } 01391 break; 01392 case STEP: 01393 if(!extended) { 01394 if(header) printf(" StepLen"); 01395 else printf(" %8.2f",step->GetStepLength()); 01396 } else { 01397 if(header) printf(" StepLen "); 01398 else printf(" %11.5f",step->GetStepLength()); 01399 } 01400 break; 01401 case VOL: 01402 if(header) printf(" This Volume "); 01403 else printf(" %-16s",preVol->GetName().c_str()); 01404 break; 01405 case PROCESS: 01406 if(header) printf(" Process "); 01407 else printf(" %-16s",procName); 01408 break; 01409 case B: 01410 if(header) { 01411 printf(" Bx,By,Bz (Tesla) "); 01412 } else { 01413 G4double point[4], field[6]; 01414 point[0]=position[0],point[1]=position[1],point[2]=position[2]; 01415 point[3]=time; 01416 BLGlobalField::getObject()->GetFieldValue(point,field); 01417 G4ThreeVector B(field[0],field[1],field[2]); 01418 B = coord->getRotation(BLCOORD_CENTERLINE) * B; 01419 printf(" %8.4f %8.4f %8.4f", 01420 B[0]/tesla,B[1]/tesla,B[2]/tesla); 01421 } 01422 break; 01423 case E: 01424 if(header) { 01425 printf(" Ex,Ey,Ez (MV/meter) "); 01426 } else { 01427 G4double point[4], field[6]; 01428 point[0]=position[0],point[1]=position[1],point[2]=position[2]; 01429 point[3]=time; 01430 BLGlobalField::getObject()->GetFieldValue(point,field); 01431 G4ThreeVector E(field[3],field[4],field[5]); 01432 E = coord->getRotation(BLCOORD_CENTERLINE) * E; 01433 printf(" %8.4f %8.4f %8.4f",E[0]/(megavolt/meter), 01434 E[1]/(megavolt/meter),E[2]/(megavolt/meter)); 01435 } 01436 break; 01437 case P: 01438 if(!extended) { 01439 if(header) { 01440 printf(" Px,Py,Pz (MeV/c) "); 01441 } else { 01442 G4ThreeVector P = track->GetMomentum(); 01443 P = coord->getRotation(BLCOORD_CENTERLINE) * P; 01444 printf(" %8.1f %8.1f %8.1f",P[0]/(MeV), 01445 P[1]/(MeV),P[2]/(MeV)); 01446 } 01447 } else { 01448 if(header) { 01449 printf(" Px,Py,Pz (MeV/c) "); 01450 } else { 01451 G4ThreeVector P = track->GetMomentum(); 01452 P = coord->getRotation(BLCOORD_CENTERLINE) * P; 01453 printf(" %11.4f %11.4f %11.4f",P[0]/(MeV), 01454 P[1]/(MeV),P[2]/(MeV)); 01455 } 01456 } 01457 break; 01458 case MAT: 01459 if(header) { 01460 printf(" Material "); 01461 } else { 01462 printf(" %-9s",mat->GetName().c_str()); 01463 } 01464 break; 01465 case ID: 01466 if(header) { 01467 printf(" Event# Trk Prnt"); 01468 } else { 01469 printf(" %6d %3d %4d",eventNum, 01470 BLManager::getObject()-> 01471 getExternalTrackID(track), 01472 BLManager::getObject()-> 01473 getExternalParentID(track)); 01474 } 01475 break; 01476 case PART: 01477 if(header) { 01478 printf(" Particle"); 01479 } else { 01480 printf(" %8s",track->GetDefinition()->GetParticleName().c_str()); 01481 } 01482 break; 01483 case SEG: 01484 if(header) { 01485 printf(" Seg"); 01486 } else { 01487 printf(" %3d",coord->getSegmentCL()); 01488 } 01489 break; 01490 case WT: 01491 if(header) { 01492 printf(" Wt "); 01493 } else { 01494 printf(" %.3f",track->GetWeight()); 01495 } 01496 break; 01497 case NEWLINE: 01498 printf("\n"); 01499 break; 01500 } 01501 } 01502 01503 fflush(stdout); // help debugging location of crashes 01504 }
void BLManager::setSteppingManager | ( | G4SteppingManager * | p | ) | [inline] |
setSteppingManager() sets the pointer to the current G4SteppingManager.
References fpSteppingManager.
Referenced by BLManager_UserSteppingAction::UserSteppingAction().
00310 { fpSteppingManager = p; }
G4SteppingManager* BLManager::getSteppingManager | ( | ) | [inline] |
getSteppingManager() returns a pointer to the current G4SteppingManager.
References fpSteppingManager.
Referenced by PillboxField::UserSteppingAction(), BLCMDtune::UserZSteppingAction(), and BLCMDreference::UserZSteppingAction().
00314 { return fpSteppingManager; }
void BLManager::setTrackingManager | ( | G4TrackingManager * | p | ) | [inline] |
setTrackingManager() sets the pointer to the current G4TrackingManager.
References fpTrackingManager.
Referenced by BLManager_UserTrackingAction::PreUserTrackingAction().
00318 { fpTrackingManager = p; }
void BLManager::initialize | ( | ) |
initialize() will initialize the BLManager object, and the geant4 kernel, thus constructing the geometry in the world group. Note that registerPhysics() must be called before initialize() (normally done by a "physics" command in the input file).
physics->getPhysicsList() is set in registerPhysicsList()
References beamIndex, beamVector, eventTimeLimit, BLParam::getDouble(), BLParam::getInt(), histoUpdate, initialized, Param, physics, referenceVector, runManager, setSteppingFormat(), steppingVerbose, and zTolerance.
Referenced by BLCMDlist::command(), and main().
00316 { 00317 if(initialized) { 00318 G4Exception("BLManager","Already Initialized",FatalException, 00319 ""); 00320 } 00321 initialized = true; 00322 00323 G4UImanager* UI = G4UImanager::GetUIpointer(); 00324 00325 if(!physics) { 00326 G4Exception("BLManager","No physics registered",FatalException, 00327 ""); 00328 } 00329 00330 setSteppingFormat(); 00331 00332 // set initialization and user classes 00333 runManager->SetUserInitialization((G4VUserDetectorConstruction*)this); 00334 /// physics->getPhysicsList() is set in registerPhysicsList() 00335 runManager->SetUserAction(new BLManager_UserSteppingAction(this)); 00336 runManager->SetUserAction(new BLManager_UserTrackingAction(this)); 00337 runManager->SetUserAction(new BLManager_UserRunAction(this)); 00338 runManager->SetUserAction(new BLManager_UserEventAction(this)); 00339 runManager->SetUserAction(new BLManager_PrimaryGeneratorAction(this)); 00340 runManager->SetUserAction(new BLManager_UserStackingAction(this)); 00341 00342 // apply initial range cuts 00343 UI->ApplyCommand("/range/cutG 2 mm"); 00344 UI->ApplyCommand("/range/cutE 2 mm"); 00345 00346 // initialize the RunManager, construct the apparatus, etc. 00347 runManager->Initialize(); 00348 00349 // set initial verbosities 00350 UI->ApplyCommand("/control/verbose 0"); 00351 UI->ApplyCommand("/run/verbose 0"); 00352 UI->ApplyCommand("/event/verbose 0"); 00353 UI->ApplyCommand("/tracking/verbose 0"); 00354 UI->ApplyCommand("/hits/verbose 0"); 00355 UI->ApplyCommand("/material/verbose 0"); 00356 UI->ApplyCommand("/process/setVerbose 0 all"); 00357 UI->ApplyCommand("/process/verbose 0"); 00358 UI->ApplyCommand("/process/eLoss/verbose 0"); 00359 G4HadronicProcessStore::Instance()->SetVerbose(0); 00360 00361 steppingVerbose = Param.getInt("steppingVerbose"); 00362 00363 // get various parameter values (may have changed since constructor) 00364 histoUpdate = Param.getInt("histoUpdate"); 00365 eventTimeLimit = Param.getInt("eventTimeLimit"); 00366 zTolerance = Param.getDouble("zTolerance"); 00367 00368 // initialize the beam 00369 for(beamIndex=0; beamIndex<beamVector.size(); ++beamIndex) 00370 beamVector[beamIndex]->init(); 00371 for(unsigned i=0; i<referenceVector.size(); ++i) 00372 referenceVector[i]->init(); 00373 beamIndex = 0; 00374 00375 // create the ZStepLimiter 00376 new ZStepLimiter(); 00377 }
static bool BLManager::isInitialized | ( | ) | [inline, static] |
isInitialized() returns true if the BLManager has been initialized.
References initialized.
Referenced by BLCMDlist::command().
00328 { return initialized; }
void BLManager::trackTuneAndReferenceParticles | ( | ) |
trackTuneAndReferenceParticles() will generate and track the tune particle and then the reference particle.
References beamIndex, BLRunManager::BeamOn(), FORCE_OFF, BLRunManager::getCollectiveMode(), IDLE, NORMAL, physics, REFERENCE, referenceVector, runManager, BLRunManager::setCollectiveMode(), BLPhysics::setDoStochastics(), setEventID(), state, and TUNE.
Referenced by main().
00407 { 00408 if(referenceVector.size() == 0) 00409 return; 00410 00411 if(!physics) { 00412 G4Exception("BLManager","No physics registered",FatalException, 00413 ""); 00414 } 00415 00416 // Tune and Reference particles cannot use collective mode 00417 bool collectiveMode = runManager->getCollectiveMode(); 00418 runManager->setCollectiveMode(false); 00419 00420 printf("================= Prepare Tune Particle(s) ===========\n"); 00421 physics->setDoStochastics(FORCE_OFF); 00422 runManager->Initialize(); 00423 00424 printf("================= Begin Tune Particle(s) =============\n"); 00425 state = TUNE; 00426 setEventID(-2); 00427 beamIndex = 0; 00428 runManager->BeamOn(referenceVector.size()); 00429 state = IDLE; 00430 00431 // now track center particle 00432 printf("================== Begin Reference Particle(s) ===============\n"); 00433 state = REFERENCE; 00434 setEventID(-1); 00435 beamIndex = 0; 00436 runManager->BeamOn(referenceVector.size()); 00437 state = IDLE; 00438 beamIndex = 0; 00439 00440 physics->setDoStochastics(NORMAL); 00441 runManager->setCollectiveMode(collectiveMode); 00442 }
void BLManager::trackBeam | ( | ) |
trackBeam() will generate the defined beam and track each event.
References BEAM, beamIndex, BLRunManager::BeamOn(), beamVector, IDLE, NORMAL, physics, runManager, BLPhysics::setDoStochastics(), setEventID(), and state.
Referenced by main().
00445 { 00446 if(beamVector.size() == 0) { 00447 G4Exception("BLManager","No beam registered",FatalException, 00448 ""); 00449 } 00450 if(!physics) { 00451 G4Exception("BLManager","No physics registered",FatalException, 00452 ""); 00453 } 00454 00455 printf("================== Prepare Tracking Beam ==================\n"); 00456 physics->setDoStochastics(NORMAL); 00457 runManager->Initialize(); 00458 00459 printf("================== Begin Tracking Beam ===============\n"); 00460 state = BEAM; 00461 setEventID(1); 00462 beamIndex = 0; 00463 runManager->BeamOn(0x7FFFFFFF); 00464 for(beamIndex=0; beamIndex<beamVector.size(); ++beamIndex) 00465 beamVector[beamIndex]->summary(); 00466 beamIndex = 0; 00467 state = IDLE; 00468 }
void BLManager::displayVisual | ( | ) |
displayVisual() will display the detector visually.
References beamIndex, BLParam::getString(), handleCallbacks(), IDLE, BLVisManager::init(), NORMAL, Param, physics, runManager, BLPhysics::setDoStochastics(), setEventID(), state, and VISUAL.
Referenced by main().
00471 { 00472 #ifdef G4VIS_USE 00473 printf("================== Prepare Visualization ==================\n"); 00474 state = VISUAL; 00475 physics->setDoStochastics(NORMAL); 00476 runManager->Initialize(); 00477 setEventID(1); 00478 beamIndex = 0; 00479 00480 BLVisManager *visManager = new BLVisManager(Param.getString("viewer")); 00481 visManager->init(); 00482 00483 handleCallbacks(4); 00484 00485 printf("To display a run with 10 events in the viewer, type '/run/beamOn 10<cr>'\n"); 00486 G4UIterminal *terminal = new G4UIterminal(0,false); 00487 terminal->SessionStart(); 00488 00489 delete terminal; 00490 delete visManager; 00491 state = IDLE; 00492 beamIndex = 0; 00493 #else 00494 G4Exception("BLManager","G4VIS_USE not defined",FatalException,""); 00495 #endif 00496 }
void BLManager::displayGeometry | ( | G4VPhysicalVolume * | phys = 0 , |
|
int | level = 0 | |||
) |
displayGeometry() will display the geant4 geometry. This is a hierarchical ASCII listing of all volumes. if phys==0 then use the worldPhysicalVolume.
References BLCommand::dumpRotation(), and worldPhysicalVolume.
Referenced by BLCMDgeometry::callback().
00499 { 00500 if(phys == 0) phys = worldPhysicalVolume; 00501 for(int i=0; i<level; ++i) printf(" "); 00502 G4ThreeVector pos = phys->GetObjectTranslation(); 00503 printf("%s x=%.3f y=%.3f z=%.3f\n",phys->GetName().c_str(), 00504 pos[0],pos[1],pos[2]); 00505 G4RotationMatrix rot = phys->GetObjectRotationValue(); 00506 if(!rot.isIdentity()) { 00507 for(int i=0; i<level; ++i) printf(" "); 00508 BLCommand::dumpRotation(&rot,""); 00509 } 00510 G4LogicalVolume *log = phys->GetLogicalVolume(); 00511 int n = log->GetNoDaughters(); 00512 for(int i=0; i<n; ++i) { 00513 G4VPhysicalVolume *p = log->GetDaughter(i); 00514 if(p) 00515 displayGeometry(p,level+1); 00516 } 00517 }
void BLManager::registerPhysics | ( | BLPhysics * | _physics | ) | [inline] |
registerPhysics() registers the BLPhysics object. It also sets the physics list to the BLRunManager, so following commands can find particle by name.
References BLPhysics::getPhysicsList(), physics, and runManager.
Referenced by BLCMDphysics::command().
00349 { physics = _physics; 00350 runManager->SetUserInitialization(physics->getPhysicsList()); 00351 }
BLPhysics* BLManager::getPhysics | ( | ) | [inline] |
getPhysics returns the registered BLPhysics object.
References physics.
Referenced by BLCMDtrackermode::callback(), BLCMDtracker::fitTrack(), BLCMDreference::PostUserTrackingAction(), and BLCMDreference::PreUserTrackingAction().
00354 { return physics; }
void BLManager::registerBeam | ( | BLBeam * | _beam | ) | [inline] |
registerBeam() registers a BLBeam object for beam generation. Multiple BLBeam objects can be registered, used in order.
References beamVector.
Referenced by BLCMDparticlesource::command(), BLCMDcosmicraybeam::command(), and BLCMDbeam::command().
00358 { beamVector.push_back(_beam); }
void BLManager::registerReference | ( | BLBeam * | _beam | ) | [inline] |
registerReference() registers a BLBeam object for reference particle generation. Multiple BLBeam objects can be registered, used in order.
References referenceVector.
Referenced by BLCMDreference::command().
00364 { referenceVector.push_back(_beam); }
int BLManager::nReference | ( | ) | [inline] |
nReference() returns the number of reference particles registered.
References referenceVector.
Referenced by main().
00367 { return referenceVector.size(); }
void BLManager::registerRunAction | ( | RunAction * | a, | |
G4bool | beamOnly = true | |||
) | [inline] |
registerRunAction() registers a UserRunAction. If beamOnly is true (the default), the callback is made only if state==BEAM.
References beamRunActionVector, and runActionVector.
Referenced by BLCMDtune::command(), BLCMDreference::command(), and BLCMDhelicaldipole::construct().
00373 { if(beamOnly) 00374 beamRunActionVector.push_back(a); 00375 else 00376 runActionVector.push_back(a); 00377 }
void BLManager::registerEventAction | ( | EventAction * | a, | |
G4bool | beamOnly = true | |||
) | [inline] |
registerEventAction() registers a UserEventAction. If beamOnly is true (the default), the callback is made only if state==BEAM.
References beamEventActionVector, and eventActionVector.
Referenced by BLCMDparticlecolor::command(), and BLCMDntuple::command().
00383 { if(beamOnly) 00384 beamEventActionVector.push_back(a); 00385 else 00386 eventActionVector.push_back(a); 00387 }
void BLManager::registerTrackingAction | ( | TrackingAction * | a | ) | [inline] |
registerTrackingAction() registers a UserTackingAction.
References trackingActionVector.
Referenced by BLCMDtracker::command(), BLCMDtrace::command(), BLCMDreference::command(), BLCMDparticlecolor::command(), BLCMDntuple::command(), BLCMDnewparticlentuple::command(), BLCMDmovie::command(), BLCMDbeamlossntuple::command(), BLCMDparticlefilter::construct(), and BLCoordinates::ReferenceCoordinates::ReferenceCoordinates().
00391 { trackingActionVector.push_back(a); }
void BLManager::registerUserCode | ( | BLUserCode * | instance | ) | [inline] |
registerUserCode() registers a BLUserCode instance.
References userCodeVector.
Referenced by BLUserCode::registerUserCode().
00395 { userCodeVector.push_back(instance); }
std::vector<BLUserCode*> BLManager::getUserCodeInstances | ( | G4String | type | ) | [inline] |
getUserCodeInstances() returns a vector of all registered instances of BLUserCode with the specified type.
References userCodeVector.
00400 { std::vector<BLUserCode*> ret; 00401 for(unsigned i=0; i<userCodeVector.size(); ++i) { 00402 if(type == userCodeVector[i]->getType()) 00403 ret.push_back(userCodeVector[i]); 00404 } 00405 return ret; 00406 }
void BLManager::registerCallback | ( | BLCallback * | cb, | |
int | type | |||
) | [inline] |
registerCallback() registers a BLCallback. type=0 for pre-Tune particle, type=1 for post-Reference (pre-beam tracking), type=2 for post-beam tracking. type=3 for replacing the main program loop. type=4 for visualization. NOTE: if there are type=3 callbacks, when the last one returns the closes up by summarizing NTuples and callng handleCallbacks(2), and then the program exits. This prevents the main program loop from executing. type=3 callbacks are called just after the type=1 callbacks (i.e. after the post-Reference callbacks).
References postReferenceCallbackVector, postTrackingCallbackVector, preReferenceCallbackVector, replaceMainLoopCallbackVector, and visualizationCallbackVector.
Referenced by BLCMDzntuple::command(), BLCMDusertrackfilter::command(), BLCMDtrackermode::command(), BLCMDtracker::command(), BLCMDtotalenergy::command(), BLCMDshowmaterial::command(), BLCMDsetdecay::command(), BLCMDprofile::command(), BLCMDprobefield::command(), BLCMDprintfield::command(), BLCMDprintf::command(), BLCMDphysics::command(), BLCMDmuminuscapturefix::command(), BLCMDmovie::command(), BLCMDgeometry::command(), BLCMDg4ui::command(), BLCMDfieldntuple::command(), BLCMDbug1021::command(), SetDecayInstance::fatalError(), ParticleFilterPlacement::ParticleFilterPlacement(), and Surface::Surface().
00420 { 00421 if(type==0) preReferenceCallbackVector.push_back(cb); 00422 else if(type==1) postReferenceCallbackVector.push_back(cb); 00423 else if(type==2) postTrackingCallbackVector.push_back(cb); 00424 else if(type==3) replaceMainLoopCallbackVector.push_back(cb); 00425 else if(type==4) visualizationCallbackVector.push_back(cb); 00426 }
void BLManager::handleCallbacks | ( | int | type | ) |
handleCallbacks() calls all applicable registered callbacks. type=0 for pre-reference particle, type=1 for post-center (pre-beam tracking), type=2 for post-beam tracking (just before program exit). type=3 for replacing the main program loop. type=4 for visualization.
References blManager, BLRunManager::callback(), BLNTuple::closeAll(), exceptionSummary(), g4bl_exit(), BLRunManager::getObject(), postReferenceCallbackVector, postTrackingCallbackVector, preReferenceCallbackVector, replaceMainLoopCallbackVector, BLNTuple::summary(), and visualizationCallbackVector.
Referenced by BLCMDlist::command(), displayVisual(), main(), and Notify().
00531 { 00532 // startup sequencing prevents RunManager from registering 00533 BLRunManager::getObject()->callback(type); 00534 00535 if(type == 0) { 00536 for(unsigned i=0; i<preReferenceCallbackVector.size(); ++i) 00537 preReferenceCallbackVector[i]->callback(type); 00538 } else if(type == 1) { 00539 for(unsigned i=0; i<postReferenceCallbackVector.size(); ++i) 00540 postReferenceCallbackVector[i]->callback(type); 00541 } else if(type == 2) { 00542 for(unsigned i=0; i<postTrackingCallbackVector.size(); ++i) 00543 postTrackingCallbackVector[i]->callback(type); 00544 exceptionSummary(); 00545 } else if(type == 3) { 00546 for(unsigned i=0; i<replaceMainLoopCallbackVector.size(); ++i) 00547 replaceMainLoopCallbackVector[i]->callback(type); 00548 if(replaceMainLoopCallbackVector.size() > 0) { 00549 // we have replaced the main loop, so closeup and exit 00550 BLNTuple::summary(); 00551 BLNTuple::closeAll(); 00552 // handle post-tracking callbacks 00553 handleCallbacks(2); 00554 // Instead of deleting things, just open the geometry 00555 // to avoid warnings when exit() is called. 00556 G4GeometryManager::GetInstance()->OpenGeometry(); 00557 blManager = 0; 00558 extern void g4bl_exit(int); 00559 g4bl_exit(0); 00560 } 00561 } else if(type == 4) { 00562 for(unsigned i=0; i<visualizationCallbackVector.size(); ++i) 00563 visualizationCallbackVector[i]->callback(type); 00564 } 00565 }
G4VPhysicalVolume* BLManager::getWorldPhysicalVolume | ( | ) | [inline] |
getWorldPhysicalVolume() returns a pointer to the world PV. Note that it must already have been consructed, so this function returns NULL before construct() is called (by main).
References worldPhysicalVolume.
Referenced by BLCMDtotalenergy::callback(), BLCMDshowmaterial::callback(), and BLCMDmovie::callback().
00440 { return worldPhysicalVolume; }
void BLManager::setPRNGSeedMethod | ( | PRNGSeedMethod | method | ) | [inline] |
setPRNGSeedMethod() will set the method used to seed the pseudo random number generator at the start of each event.
References seedMethod.
Referenced by BLCMDrandomseed::command(), and BLBeam::setRandomSeedToGenerate().
00445 { seedMethod = method; }
PRNGSeedMethod BLManager::getPRNGSeedMethod | ( | ) | [inline] |
getPRNGSeedMethod() will return the method used to seed the pseudo random number generator at the start of each event.
References seedMethod.
00449 { return seedMethod; }
void BLManager::setEventCutFile | ( | G4String & | f | ) | [inline] |
setEventCutFile() will set the file containing event s for cutting. The file is ASCII, with one event number per line; lines beginning with # are ignored.
References eventCutFile.
Referenced by BLCMDeventcuts::command().
00454 { eventCutFile = f; }
void BLManager::UserSteppingAction | ( | const G4Step * | step | ) |
UserSteppingAction() from G4UserSteppingAction.
References allStepMap, allStepVector, BEAM, beamStepMap, beamStepVector, currentZStep, eventTimeLimit, BLCoordinates::getCLZ(), indexZStep, BLCoordinates::isValid(), nStuck, prevZ, REFERENCE, rpStepMap, rpStepVector, ZStepLimiter::setMaxStep(), startEvent, state, steppingVerbose, steppingVerbosePrint(), BLTime::time(), tpStepMap, tpStepVector, tracksAborted, TUNE, BLCoordinates::update(), and zTolerance.
Referenced by BLManager_UserSteppingAction::UserSteppingAction().
00769 { 00770 G4Track *track = step->GetTrack(); 00771 G4StepPoint *prePoint = step->GetPreStepPoint(); 00772 G4StepPoint *postPoint = step->GetPostStepPoint(); 00773 G4VPhysicalVolume *preVol=0; 00774 G4VPhysicalVolume *postVol=0; 00775 if(prePoint) preVol = prePoint->GetPhysicalVolume(); 00776 if(postPoint) postVol = postPoint->GetPhysicalVolume(); 00777 00778 // need to update BLCoordinates before steppingVerbose print. 00779 // So BLCoordinates is not registered with SteppingAction, it 00780 // is handled specially, right here. 00781 BLCoordinates::update(track); 00782 BLCoordinates *coord = (BLCoordinates *)track->GetUserInformation(); 00783 if(!coord || !coord->isValid()) { 00784 G4Exception("BLManager","Coordinates Got Lost",FatalException, 00785 ""); 00786 } 00787 00788 // steppingVerbose print moved to the top of this routine 00789 if(steppingVerbose > 0) { 00790 static bool first=true; 00791 int nstep = track->GetCurrentStepNumber(); 00792 if(first || (nstep <= 1 && !runManager->getCollectiveMode())) 00793 steppingVerbosePrint(0,0,1); 00794 steppingVerbosePrint(step,track,0); 00795 first = false; 00796 } 00797 00798 /* check for stuck track */ 00799 if(step->GetStepLength() > 0.0001*mm || 00800 step->GetDeltaTime() > 0.0001*ns) { 00801 nStuck = 0; 00802 } else { 00803 if(++nStuck >= 100) { 00804 G4Exception("BLManager Stepping Action", 00805 "Stuck Track -- Killed",JustWarning, 00806 "100 steps in a row, each less than 0.1 micron and 0.1 ps"); 00807 ++tracksAborted; 00808 track->SetTrackStatus(fStopAndKill); 00809 } 00810 } 00811 00812 G4TrackStatus status = track->GetTrackStatus(); 00813 if(status == fStopAndKill || status == fKillTrackAndSecondaries) 00814 goto quit; 00815 00816 // check event time limit 00817 if(eventTimeLimit > 0 && BLTime::time()-startEvent > eventTimeLimit) { 00818 G4Exception("BLManager","Event Time Limit",EventMustBeAborted,""); 00819 goto quit; 00820 } 00821 00822 // call ZStep actions 00823 // NOTE: indexZstep points to the next entry in the +Z direction. 00824 // Note also the bookends constrain indexZStep to always be valid. 00825 if(currentZStep->size() > 2) { // i.e. not just 2 bookends 00826 G4double thisZ = coord->getCLZ(); 00827 if(thisZ == prevZ) goto noZstep; 00828 G4double minZ = (thisZ<prevZ ? thisZ : prevZ); 00829 G4double maxZ = (thisZ>prevZ ? thisZ : prevZ); 00830 // find first entry that might be spanned by the step 00831 while(indexZStep > 0 && minZ <= (*currentZStep)[indexZStep-1].z) 00832 --indexZStep; 00833 while(minZ > (*currentZStep)[indexZStep].z) 00834 ++indexZStep; 00835 int indexPrev = indexZStep-1; 00836 // loop over all entries actually spanned by this step 00837 for( ; indexZStep<currentZStep->size()-1; ++indexZStep) { 00838 G4double z=(*currentZStep)[indexZStep].z; 00839 if(maxZ <= z) break; 00840 if((*currentZStep)[indexZStep].action == 0) continue; 00841 // save current values from track 00842 G4ThreeVector pos = track->GetPosition(); 00843 G4ThreeVector mom = track->GetMomentum(); 00844 G4double time = track->GetGlobalTime(); 00845 G4double ke = track->GetKineticEnergy(); 00846 // interpolate linearly to z, global coords 00847 G4ThreeVector deltaPos=step->GetDeltaPosition(); 00848 G4ThreeVector deltaMom=step->GetDeltaMomentum(); 00849 G4double deltaTime=step->GetDeltaTime(); 00850 G4double deltaE=step->GetDeltaEnergy(); 00851 G4double f=(z-thisZ)/(prevZ-thisZ); 00852 track->SetPosition(pos-f*deltaPos); 00853 track->SetMomentumDirection((mom-f*deltaMom).unit()); 00854 track->SetGlobalTime(time-f*deltaTime); 00855 track->SetKineticEnergy(ke-f*deltaE); 00856 BLCoordinates::update(track); 00857 (*currentZStep)[indexZStep].action-> 00858 UserZSteppingAction(track); 00859 // restore current values to track 00860 track->SetPosition(pos); 00861 track->SetMomentumDirection(mom.unit()); 00862 track->SetGlobalTime(time); 00863 track->SetKineticEnergy(ke); 00864 BLCoordinates::update(track); 00865 } 00866 double dz = (thisZ>prevZ ? (*currentZStep)[indexZStep].z-thisZ : 00867 thisZ-(*currentZStep)[indexPrev].z); 00868 dz = (dz>zTolerance*2.0 ? dz : zTolerance*2.0); 00869 ZStepLimiter::setMaxStep(dz); 00870 prevZ = thisZ; 00871 } 00872 noZstep: 00873 00874 // call all-state stepping actions before per-state actions. 00875 { std::vector<BLManager::SteppingAction*>::iterator i; 00876 for(i=allStepVector.begin(); i!=allStepVector.end(); ++i) { 00877 (*i)->UserSteppingAction(step); 00878 if(track->GetTrackStatus() != fAlive) 00879 goto quit; 00880 } 00881 if(preVol && allStepMap.count(preVol) > 0) { 00882 allStepMap[preVol]->UserSteppingAction(step); 00883 if(track->GetTrackStatus() != fAlive) 00884 goto quit; 00885 } 00886 if(postVol && preVol != postVol && allStepMap.count(postVol) > 0) { 00887 allStepMap[postVol]->UserSteppingAction(step); 00888 if(track->GetTrackStatus() != fAlive) 00889 goto quit; 00890 } 00891 } 00892 00893 // call Tune Particle stepping actions 00894 if(state == TUNE) { 00895 std::vector<BLManager::SteppingAction*>::iterator i; 00896 for(i=tpStepVector.begin(); i!=tpStepVector.end(); ++i) { 00897 (*i)->UserSteppingAction(step); 00898 if(track->GetTrackStatus() != fAlive) 00899 goto quit; 00900 } 00901 if(preVol && tpStepMap.count(preVol) > 0) { 00902 tpStepMap[preVol]->UserSteppingAction(step); 00903 if(track->GetTrackStatus() != fAlive) 00904 goto quit; 00905 } 00906 if(postVol && preVol != postVol && 00907 tpStepMap.count(postVol) > 0) { 00908 tpStepMap[postVol]->UserSteppingAction(step); 00909 if(track->GetTrackStatus() != fAlive) 00910 goto quit; 00911 } 00912 } 00913 00914 // call Reference Particle stepping actions 00915 if(state == REFERENCE) { 00916 std::vector<BLManager::SteppingAction*>::iterator i; 00917 for(i=rpStepVector.begin(); i!=rpStepVector.end(); ++i) { 00918 (*i)->UserSteppingAction(step); 00919 if(track->GetTrackStatus() != fAlive) 00920 goto quit; 00921 } 00922 if(preVol && rpStepMap.count(preVol) > 0) { 00923 rpStepMap[preVol]->UserSteppingAction(step); 00924 if(track->GetTrackStatus() != fAlive) 00925 goto quit; 00926 } 00927 if(postVol && preVol != postVol && 00928 rpStepMap.count(postVol) > 0) { 00929 rpStepMap[postVol]->UserSteppingAction(step); 00930 if(track->GetTrackStatus() != fAlive) 00931 goto quit; 00932 } 00933 } 00934 00935 // call beam stepping actions 00936 if(state == BEAM) { 00937 std::vector<BLManager::SteppingAction*>::iterator i; 00938 for(i=beamStepVector.begin(); i!=beamStepVector.end(); ++i) { 00939 (*i)->UserSteppingAction(step); 00940 if(track->GetTrackStatus() != fAlive) 00941 goto quit; 00942 } 00943 if(preVol && beamStepMap.count(preVol) > 0) { 00944 beamStepMap[preVol]->UserSteppingAction(step); 00945 if(track->GetTrackStatus() != fAlive) 00946 goto quit; 00947 } 00948 if(postVol && preVol != postVol && 00949 beamStepMap.count(postVol) > 0) { 00950 beamStepMap[postVol]->UserSteppingAction(step); 00951 if(track->GetTrackStatus() != fAlive) 00952 goto quit; 00953 } 00954 } 00955 00956 quit: ; 00957 }
G4VPhysicalVolume * BLManager::Construct | ( | ) |
Construct() from G4VUserDetectorConstruction.
References BLGroup::constructWorld(), BLGlobalField::getObject(), and worldPhysicalVolume.
00520 { 00521 // ensure the global field is initialized 00522 (void)BLGlobalField::getObject(); 00523 00524 // construct the world 00525 worldPhysicalVolume = BLGroup::constructWorld(); 00526 00527 return worldPhysicalVolume; 00528 }
void BLManager::PreUserTrackingAction | ( | const G4Track * | track | ) |
PreUserTrackingAction() from G4UserTrackingAction.
References beamZStep, BLAssert, currentZStep, eventID, fpTrackingManager, BLCoordinates::getCLZ(), BLRunManager::getCollectiveMode(), getExternalParentID(), BLTrackInfo::getExternalTrackID(), indexZStep, BLCoordinates::isValid(), nextSecondaryTrackID, nStuck, prevZ, primaryParentID, primaryTrackID, REFERENCE, referenceZStep, runManager, BLTrackInfo::setExternalParentID(), BLTrackInfo::setExternalTrackID(), BLCoordinates::setGlobal(), ZStepLimiter::setMaxStep(), state, steppingVerbose, trackID, trackIDMap, trackingActionVector, trackParticleDef, TUNE, tuneZStep, and zTolerance.
Referenced by BLManager_UserTrackingAction::PreUserTrackingAction().
00670 { 00671 static bool first=true; 00672 if(first) { 00673 first=false; 00674 std::vector<BLManager::TrackingAction*>::iterator i; 00675 for(i=trackingActionVector.begin(); 00676 i<trackingActionVector.end(); ++i) { 00677 (*i)->SetTrackingManagerPointer(fpTrackingManager); 00678 } 00679 } 00680 00681 nStuck = 0; 00682 00683 // link a BLTrackInfo into the track (called coord -- historical) 00684 BLTrackInfo *coord = (BLTrackInfo *)track->GetUserInformation(); 00685 if(!coord || !coord->isValid()) { 00686 coord = new BLTrackInfo(); 00687 ((G4Track *)track)->SetUserInformation(coord); 00688 } 00689 coord->setGlobal(track->GetPosition(),track->GetGlobalTime()); 00690 00691 // set the external trackID and parentID 00692 trackID = coord->getExternalTrackID(); 00693 if(trackID <= 0) { 00694 if(primaryTrackID >= 0) { 00695 trackID = primaryTrackID; 00696 coord->setExternalTrackID(trackID); 00697 coord->setExternalParentID(primaryParentID); 00698 primaryTrackID = primaryParentID = -1; 00699 } else { 00700 trackID = nextSecondaryTrackID++; 00701 coord->setExternalTrackID(trackID); 00702 coord->setExternalParentID( 00703 trackIDMap[track->GetParentID()]); 00704 } 00705 } 00706 trackIDMap[track->GetTrackID()] = trackID; 00707 trackParticleDef = track->GetDefinition(); 00708 00709 // print header, if appropriate 00710 if(steppingVerbose && !runManager->getCollectiveMode()) { 00711 printf("=========== EventID %d TrackID %d %s ParentID %d", 00712 eventID,trackID, 00713 trackParticleDef->GetParticleName().c_str(), 00714 getExternalParentID(track)); 00715 if(getExternalParentID(track) == 0) { 00716 printf(" CreatorProcess=Beam"); 00717 } else { 00718 const G4VProcess *proc = track->GetCreatorProcess(); 00719 if(proc != 0) 00720 printf(" CreatorProcess=%s", 00721 proc->GetProcessName().c_str()); 00722 } 00723 printf(" ===========\n"); 00724 } 00725 00726 // set currentZStep 00727 if(state == TUNE) 00728 currentZStep = &tuneZStep; 00729 else if(state == REFERENCE) 00730 currentZStep = &referenceZStep; 00731 else 00732 currentZStep = &beamZStep; 00733 indexZStep = 1; 00734 prevZ = coord->getCLZ(); 00735 while(prevZ > (*currentZStep)[indexZStep].z) { 00736 ++indexZStep; 00737 } 00738 BLAssert(indexZStep < currentZStep->size()); 00739 G4double dz = (*currentZStep)[indexZStep].z - prevZ; 00740 if(dz < zTolerance) dz = zTolerance; 00741 ZStepLimiter::setMaxStep(dz); 00742 00743 // loop over all registered user tracking actions 00744 std::vector<BLManager::TrackingAction*>::iterator i; 00745 for(i=trackingActionVector.begin(); i<trackingActionVector.end(); ++i) { 00746 (*i)->PreUserTrackingAction(track); 00747 } 00748 }
void BLManager::PostUserTrackingAction | ( | const G4Track * | track | ) |
PostUserTrackingAction() from G4UserTrackingAction.
References BLRunManager::getCollectiveMode(), runManager, trackID, trackingActionVector, and trackParticleDef.
Referenced by BLManager_UserTrackingAction::PostUserTrackingAction().
00751 { 00752 std::vector<BLManager::TrackingAction*>::iterator i; 00753 for(i=trackingActionVector.begin(); i<trackingActionVector.end(); ++i) { 00754 (*i)->PostUserTrackingAction(track); 00755 } 00756 00757 // delete the BLcoordinates 00758 G4VUserTrackInformation *ti = track->GetUserInformation(); 00759 if(ti && !runManager->getCollectiveMode()) { 00760 delete ti; 00761 ((G4Track *)track)->SetUserInformation(0); 00762 } 00763 00764 trackID = -9999; 00765 trackParticleDef = 0; 00766 }
void BLManager::BeginOfRunAction | ( | const G4Run * | run | ) |
BeginOfRunAction() from G4UserRunAction.
References BEAM, beamRunActionVector, endRun, eventsProcessed, readEventCutFile(), runActionVector, startEvent, startRun, state, and BLTime::time().
Referenced by BLManager_UserRunAction::BeginOfRunAction().
00568 { 00569 readEventCutFile(); 00570 00571 startEvent = startRun = BLTime::time(); 00572 eventsProcessed = 0; 00573 endRun = false; 00574 00575 G4UImanager* UI = G4UImanager::GetUIpointer(); 00576 UI->ApplyCommand("/control/verbose 0"); 00577 UI->ApplyCommand("/run/verbose 0"); 00578 UI->ApplyCommand("/event/verbose 0"); 00579 UI->ApplyCommand("/tracking/verbose 0"); 00580 UI->ApplyCommand("/hits/verbose 0"); 00581 UI->ApplyCommand("/material/verbose 0"); 00582 UI->ApplyCommand("/process/setVerbose 0 all"); 00583 UI->ApplyCommand("/process/verbose 0"); 00584 UI->ApplyCommand("/process/eLoss/verbose 0"); 00585 00586 for(unsigned int i=0; i<runActionVector.size(); ++i) 00587 runActionVector[i]->BeginOfRunAction(run); 00588 00589 if(state == BEAM) { 00590 for(unsigned int i=0; i<beamRunActionVector.size(); ++i) 00591 beamRunActionVector[i]->BeginOfRunAction(run); 00592 } 00593 }
void BLManager::EndOfRunAction | ( | const G4Run * | run | ) |
EndOfRunAction() from G4UserRunAction.
References BEAM, beamRunActionVector, eventsProcessed, runActionVector, startRun, state, and BLTime::time().
Referenced by BLManager_UserRunAction::EndOfRunAction().
00596 { 00597 if(state == BEAM) { 00598 for(unsigned int i=0; i<beamRunActionVector.size(); ++i) 00599 beamRunActionVector[i]->EndOfRunAction(run); 00600 } 00601 00602 for(unsigned int i=0; i<runActionVector.size(); ++i) 00603 runActionVector[i]->EndOfRunAction(run); 00604 00605 printf("Run complete %d Events %ld seconds\n", 00606 eventsProcessed,(long)(BLTime::time()-startRun)); 00607 }
void BLManager::BeginOfEventAction | ( | const G4Event * | event | ) |
BeginOfEventAction() from G4UserEventAction.
References BEAM, beamEventActionVector, endRun, eventActionVector, eventTimeLimit, BLRunManager::getCollectiveMode(), runManager, BLAlarm::set(), startEvent, state, steppingVerbose, and BLTime::time().
Referenced by BLRunManager::beamOnCollective(), BLRunManager::beginEvent(), and BLManager_UserEventAction::BeginOfEventAction().
00610 { 00611 if(endRun || event->IsAborted()) return; 00612 00613 if(state == BEAM) { 00614 00615 int evId = event->GetEventID(); 00616 if(steppingVerbose && !runManager->getCollectiveMode()) 00617 printf("\n\n=================== Event %d ==================\n", 00618 evId); 00619 00620 // call all registered action-s 00621 std::vector<BLManager::EventAction*>::iterator i; 00622 for(i=beamEventActionVector.begin(); i<beamEventActionVector.end(); ++i) { 00623 (*i)->BeginOfEventAction(event); 00624 } 00625 } 00626 00627 // call all registered action-s 00628 std::vector<BLManager::EventAction*>::iterator i; 00629 for(i=eventActionVector.begin(); i<eventActionVector.end(); ++i) { 00630 (*i)->BeginOfEventAction(event); 00631 } 00632 00633 startEvent = BLTime::time(); 00634 // add 2 seconds so the test in UserSteppingAction() can try first 00635 // (it kills 1 event, BLAlarm kills the entire job). 00636 if(eventTimeLimit > 0) BLAlarm::set(eventTimeLimit+2); 00637 }
void BLManager::EndOfEventAction | ( | const G4Event * | event | ) |
EndOfEventAction() from G4UserEventAction.
References BEAM, beamEventActionVector, BLAlarm::clear(), endRun, eventActionVector, eventsProcessed, BLNTuple::flushAll(), histoUpdate, incrEventsProcessed(), state, and BLNTuple::update().
Referenced by BLRunManager::endEvent(), and BLManager_UserEventAction::EndOfEventAction().
00640 { 00641 BLAlarm::clear(); 00642 00643 if(endRun || event->IsAborted()) return; 00644 00645 // call all registered action-s 00646 std::vector<BLManager::EventAction*>::iterator i; 00647 for(i=eventActionVector.begin(); i<eventActionVector.end(); ++i) { 00648 (*i)->EndOfEventAction(event); 00649 } 00650 00651 if(state != BEAM) return; 00652 00653 // call all registered action-s 00654 for(i=beamEventActionVector.begin(); i<beamEventActionVector.end(); ++i) { 00655 (*i)->EndOfEventAction(event); 00656 } 00657 BLNTuple::update(); 00658 00659 if(endRun) return; 00660 00661 incrEventsProcessed(event->GetEventID()); 00662 00663 // update histogram file, if appropriate 00664 if(histoUpdate > 0 && eventsProcessed%histoUpdate == 0 && 00665 eventsProcessed > 0) 00666 BLNTuple::flushAll(); 00667 }
void BLManager::GeneratePrimaries | ( | G4Event * | event | ) |
GeneratePrimaries() from G4VUserPrimaryGeneratorAction.
References BEAM, beamIndex, beamVector, endRun, eventID, IDLE, prevEventID, REFERENCE, referenceVector, runManager, setEventID(), skipEvent(), SPECIAL, state, TUNE, and VISUAL.
Referenced by BLCMDtrackermode::callback(), and BLManager_PrimaryGeneratorAction::GeneratePrimaries().
00960 { 00961 if(beamVector.size() == 0) { 00962 G4Exception("BLManager","No beam registered",FatalException, 00963 ""); 00964 } 00965 00966 switch(state) { 00967 case IDLE: 00968 case SPECIAL: 00969 G4Exception("BLManager","Erroneous call to GeneratePrimaries", 00970 FatalException,""); 00971 case TUNE: 00972 setEventID(-2); 00973 event->SetEventID(-2); 00974 while(beamIndex < referenceVector.size()) { 00975 if(referenceVector[beamIndex++]-> 00976 generateReferenceParticle(event)) 00977 return; 00978 } 00979 goto end_run; 00980 case REFERENCE: 00981 setEventID(-1); 00982 event->SetEventID(-1); 00983 while(beamIndex < referenceVector.size()) { 00984 if(referenceVector[beamIndex++]-> 00985 generateReferenceParticle(event)) 00986 return; 00987 } 00988 goto end_run; 00989 case VISUAL: 00990 case BEAM: 00991 for(;;) { 00992 // use tempEvent so we can skip events when necessary 00993 G4Event *tempEvent = new G4Event(*event); 00994 // default event # (nextBeamEvent() can change it) 00995 eventID = prevEventID + 1; 00996 event->SetEventID(eventID); 00997 // generate the tempEvent, indexing through beamVector[] 00998 if(beamIndex >= beamVector.size()) { 00999 goto end_run; 01000 } 01001 while(!beamVector[beamIndex]->nextBeamEvent(tempEvent)){ 01002 if(++beamIndex >= beamVector.size()) 01003 goto end_run; 01004 } 01005 // update eventID (may have changed) 01006 eventID = tempEvent->GetEventID(); 01007 prevEventID = eventID; // (this increments it, too) 01008 // skip events when necessary 01009 if(!skipEvent(eventID)) { 01010 *event = *tempEvent; 01011 delete tempEvent; 01012 break; 01013 } 01014 delete tempEvent; 01015 } 01016 break; 01017 } 01018 return; 01019 end_run: 01020 // RunManager cannot abort the event from inside 01021 // UserGeneratePrimaries(), so we do a soft abort 01022 // to the RunManager, and abort the event ourself. 01023 // The result is the same as a hard abort. 01024 runManager->AbortRun(true); 01025 event->SetEventAborted(); 01026 beamIndex = 0; 01027 endRun = true; 01028 }
G4ClassificationOfNewTrack BLManager::ClassifyNewTrack | ( | const G4Track * | track | ) |
ClassifyNewTrack() from G4UserStackingAction.
References stackingActionVector.
Referenced by BLManager_UserStackingAction::ClassifyNewTrack().
01031 { 01032 std::vector<BLManager::StackingAction*>::iterator i; 01033 for(i=stackingActionVector.begin(); i<stackingActionVector.end(); ++i) { 01034 G4ClassificationOfNewTrack c = (*i)->ClassifyNewTrack(track); 01035 if(c == fKill) return c; 01036 } 01037 return fUrgent; 01038 }
void BLManager::NewStage | ( | ) |
NewStage() from G4userStackingAction.
References stackingActionVector.
Referenced by BLManager_UserStackingAction::NewStage().
01041 { 01042 std::vector<BLManager::StackingAction*>::iterator i; 01043 for(i=stackingActionVector.begin(); i<stackingActionVector.end(); ++i) { 01044 (*i)->NewStage(); 01045 } 01046 }
void BLManager::PrepareNewEvent | ( | ) |
PrepareNewEvent() from G4StackingAction.
References stackingActionVector.
Referenced by BLManager_UserStackingAction::PrepareNewEvent().
01049 { 01050 std::vector<BLManager::StackingAction*>::iterator i; 01051 for(i=stackingActionVector.begin(); i<stackingActionVector.end(); ++i) { 01052 (*i)->PrepareNewEvent(); 01053 } 01054 }
void BLManager::clearTrackIDMap | ( | ) | [inline] |
clearTrackIDMap() clears the TrackID map.
References trackIDMap.
Referenced by BLCMDreference::generateReferenceParticle(), BLCMDparticlesource::nextBeamEvent(), and BLCMDbeam::nextBeamEvent().
00499 { trackIDMap.clear(); }
void BLManager::setNextSecondaryTrackID | ( | int | next | ) | [inline] |
setNextSecondaryTrackID() sets the external TrackID for the next secondary track. Automatically incremented for subsequent secondaries.
References nextSecondaryTrackID.
Referenced by BLCMDreference::generateReferenceParticle(), BLCMDparticlesource::nextBeamEvent(), and BLCMDbeam::nextBeamEvent().
00504 { nextSecondaryTrackID = next; }
int BLManager::getNextSecondaryTrackID | ( | ) | [inline] |
References nextSecondaryTrackID.
Referenced by BLRunManager::beamOnCollective().
00505 { return nextSecondaryTrackID; }
int BLManager::getExternalTrackID | ( | const G4Track * | track | ) |
getExternalTrackID() returns the external TrackID for the given track. In collective mode, internal and external trackID-s are the same.
References BLRunManager::getCollectiveMode(), BLTrackInfo::getExternalTrackID(), BLCoordinates::isValid(), runManager, and trackIDMap.
Referenced by BLTrackNTuple::appendTrack(), BLCMDmovie::beamStep(), BLCMDtrace::newTrace(), steppingVerbosePrint(), and BLCMDtracker::UserZSteppingAction().
01057 { 01058 if(runManager->getCollectiveMode()) return track->GetTrackID(); 01059 BLTrackInfo *p = (BLTrackInfo *)track->GetUserInformation(); 01060 if(p && p->isValid()) 01061 return p->getExternalTrackID(); 01062 return trackIDMap[track->GetTrackID()]; 01063 }
int BLManager::getExternalParentID | ( | const G4Track * | track | ) |
getExternalParentID() returns the external ParentID for the given track. In collective mode, internal and external trackID-s are the same.
References BLRunManager::getCollectiveMode(), BLTrackInfo::getExternalParentID(), BLCoordinates::isValid(), runManager, and trackIDMap.
Referenced by BLTrackNTuple::appendTrack(), BLCMDmovie::beamStep(), PreUserTrackingAction(), steppingVerbosePrint(), and BLCMDtracker::UserZSteppingAction().
01066 { 01067 if(runManager->getCollectiveMode()) return track->GetParentID(); 01068 BLTrackInfo *p = (BLTrackInfo *)track->GetUserInformation(); 01069 if(p && p->isValid()) 01070 return p->getExternalParentID(); 01071 return trackIDMap[track->GetParentID()]; 01072 }
void BLManager::setExternalTrackID | ( | G4Track * | track, | |
int | trackID, | |||
int | parentID | |||
) |
setExternalTrackID() will set the external trackID and parentID. if trackID<0 uses nextSecondarTrackID++.
References BLCoordinates::isValid(), nextSecondaryTrackID, BLTrackInfo::setExternalParentID(), and BLTrackInfo::setExternalTrackID().
01075 { 01076 if(trackID < 0) trackID = nextSecondaryTrackID++; 01077 01078 BLTrackInfo *ti = (BLTrackInfo *)track->GetUserInformation(); 01079 if(!ti || !ti->isValid()) { 01080 ti = new BLTrackInfo(); 01081 track->SetUserInformation(ti); 01082 } 01083 ti->setExternalTrackID(trackID); 01084 ti->setExternalParentID(parentID); 01085 }
int BLManager::getPrimaryTrackID | ( | ) | [inline] |
getPrimaryTrackID() returns the primaryTrackID set by the beam command
References primaryTrackID.
Referenced by BLRunManager::beamOnCollective(), and BLRunManager::getNextBeamEventAndTrack().
00522 { return primaryTrackID; }
int BLManager::getPrimaryParentID | ( | ) | [inline] |
getPrimaryParentID() returns the primaryParentID set by the beam command
References primaryParentID.
Referenced by BLRunManager::getNextBeamEventAndTrack().
00525 { return primaryParentID; }
void BLManager::setPrimaryTrackID | ( | int | t, | |
int | p | |||
) | [inline] |
setPrimaryTrackID() sets track and parent IDs for a primary track.
References primaryParentID, and primaryTrackID.
Referenced by BLCMDtracker::fitTrack(), BLCMDreference::generateReferenceParticle(), BLCMDparticlesource::nextBeamEvent(), BLCMDbeam::nextBeamEvent(), and BLCMDtracker::operator()().
00529 { primaryTrackID = t; primaryParentID = p; }
G4bool BLManager::Notify | ( | const char * | originOfException, | |
const char * | exceptionCode, | |||
G4ExceptionSeverity | severity, | |||
const char * | description | |||
) |
Notify() from G4VExceptionHandler.
References BLNTuple::closeAll(), eventID, eventsAborted, exceptionCount, fatalExceptions, g4bl_exit(), handleCallbacks(), BLMPI::isMPI(), runManager, BLNTuple::summary(), trackID, trackParticleDef, and warnings.
01110 { 01111 FILE *out=(BLMPI::isMPI() ? stderr : stdout); // originally was stderr 01112 fflush(stdout); 01113 01114 G4bool toBeAborted = false; 01115 const char *p="UNKNOWN"; 01116 switch(severity) { 01117 case FatalException: 01118 p = "Fatal Exception"; 01119 toBeAborted = true; 01120 ++fatalExceptions; 01121 break; 01122 case FatalErrorInArgument: 01123 p = "Fatal Error in Argument"; 01124 toBeAborted = true; 01125 ++fatalExceptions; 01126 break; 01127 case RunMustBeAborted: 01128 p = "Run Must Be Aborted"; 01129 runManager->AbortRun(false); 01130 toBeAborted = false; 01131 ++fatalExceptions; 01132 break; 01133 case EventMustBeAborted: 01134 p = "Event must be Aborted"; 01135 runManager->AbortEvent(); 01136 toBeAborted = false; 01137 ++eventsAborted; 01138 break; 01139 default: 01140 p = "Warning"; 01141 toBeAborted = false; 01142 ++warnings; 01143 break; 01144 } 01145 01146 // thin out the printing of many similar exceptions 01147 int n = ++exceptionCount[exceptionCode]; 01148 int interval = 1; 01149 if(n >= 1000) 01150 interval = 1000; 01151 else if(n >= 100) 01152 interval = 100; 01153 else if(n >= 10) 01154 interval = 10; 01155 if(n%interval != 0) 01156 return toBeAborted; 01157 01158 fprintf(out,"**************************************************************************\n"); 01159 fprintf(out,"*** G4Exception: %s\n",exceptionCode); 01160 fprintf(out,"*** severity: %s\n",p); 01161 fprintf(out,"*** issued by: %s\n",originOfException); 01162 if(strlen(description) > 0) 01163 fprintf(out,"*** description: %s\n",description); 01164 if(strstr(description,"Missing mandatory data")) { 01165 // brief description already printed, just URL is missing 01166 const char *p = getenv("G4BL_DIR"); 01167 if(!p) p = "Installation_Directory"; 01168 fprintf(out, 01169 "*** The URL is http://geant4.cern.ch\n" 01170 "*** If you unpack it into %s/data\n" 01171 "*** then the g4bl and g4blgui scripts will" 01172 " automatically find it.\n",p); 01173 } else if(G4StateManager::GetStateManager()->GetCurrentState() == 01174 G4State_EventProc && trackParticleDef != 0) { 01175 fprintf(out,"*** EventID: %d TrackID: %d %s\n", 01176 eventID,trackID, 01177 trackParticleDef->GetParticleName().c_str()); 01178 } 01179 if(interval > 1) 01180 fprintf(out,"*** printing: every %d-th occurrence\n", 01181 interval); 01182 fprintf(out,"**************************************************************************\n"); 01183 01184 fflush(out); // (could be stdout) 01185 01186 if(toBeAborted) { 01187 fprintf(out,"g4beamline: attempting to close up after fatal G4Exception...\n"); 01188 BLNTuple::summary(); 01189 BLNTuple::closeAll(); 01190 handleCallbacks(2); 01191 fprintf(out,"g4beamline: simulation aborted\n"); 01192 extern void g4bl_exit(int); 01193 g4bl_exit(99); 01194 } 01195 01196 return toBeAborted; 01197 }
void BLManager::exceptionSummary | ( | ) |
exceptionSummary() prints a summary of all exceptions
References eventsAborted, exceptionCount, fatalExceptions, tracksAborted, and warnings.
Referenced by handleCallbacks().
01200 { 01201 printf("\nException Summary: %d Fatal, %d Events Aborted, " 01202 "%d Tracks Aborted, %d Warnings\n", 01203 fatalExceptions,eventsAborted,tracksAborted,warnings); 01204 std::map<G4String,int>::iterator it; 01205 for(it=exceptionCount.begin(); it!=exceptionCount.end(); ++it) { 01206 G4String except = it->first; 01207 int count = it->second; 01208 printf(" %6d times: %s\n",count,except.c_str()); 01209 } 01210 }
BLManager * BLManager::blManager = 0 [static, private] |
Referenced by BLManager(), getObject(), handleCallbacks(), and ~BLManager().
bool BLManager::initialized = false [static, private] |
Referenced by initialize(), and isInitialized().
BLRunManager* BLManager::runManager [private] |
Referenced by BeginOfEventAction(), BLManager(), delayedConstruction(), displayVisual(), GeneratePrimaries(), getExternalParentID(), getExternalTrackID(), incrEventsProcessed(), initialize(), Notify(), PostUserTrackingAction(), PreUserTrackingAction(), registerPhysics(), steppingVerbosePrint(), trackBeam(), and trackTuneAndReferenceParticles().
BLManagerState BLManager::state [private] |
G4int BLManager::steppingVerbose [private] |
unsigned int BLManager::beamIndex [private] |
Referenced by BLManager(), displayVisual(), GeneratePrimaries(), initialize(), trackBeam(), and trackTuneAndReferenceParticles().
G4int BLManager::histoUpdate [private] |
Referenced by BLManager(), EndOfEventAction(), and initialize().
time_t BLManager::startRun [private] |
Referenced by BeginOfRunAction(), BLManager(), EndOfRunAction(), and incrEventsProcessed().
time_t BLManager::startEvent [private] |
Referenced by BeginOfEventAction(), BeginOfRunAction(), BLManager(), and UserSteppingAction().
G4int BLManager::eventTimeLimit [private] |
Referenced by BeginOfEventAction(), BLManager(), getEventTimeLimit(), initialize(), setEventTimeLimit(), and UserSteppingAction().
BLPhysics* BLManager::physics [private] |
Referenced by BLManager(), displayVisual(), getPhysics(), initialize(), registerPhysics(), trackBeam(), and trackTuneAndReferenceParticles().
G4VPhysicalVolume* BLManager::worldPhysicalVolume [private] |
Referenced by BLManager(), Construct(), displayGeometry(), and getWorldPhysicalVolume().
G4int BLManager::eventID [private] |
Referenced by BLManager(), GeneratePrimaries(), getEventID(), Notify(), PreUserTrackingAction(), setEventID(), and skipEvent().
G4int BLManager::trackID [private] |
Referenced by BLManager(), Notify(), PostUserTrackingAction(), and PreUserTrackingAction().
G4ParticleDefinition* BLManager::trackParticleDef [private] |
Referenced by BLManager(), Notify(), PostUserTrackingAction(), and PreUserTrackingAction().
G4int BLManager::fatalExceptions [private] |
Referenced by BLManager(), exceptionSummary(), and Notify().
G4int BLManager::eventsAborted [private] |
Referenced by BLManager(), exceptionSummary(), and Notify().
G4int BLManager::tracksAborted [private] |
Referenced by BLManager(), exceptionSummary(), and UserSteppingAction().
G4int BLManager::warnings [private] |
Referenced by BLManager(), exceptionSummary(), and Notify().
G4int BLManager::prevEventID [private] |
Referenced by BLManager(), GeneratePrimaries(), and setEventID().
G4int BLManager::eventsProcessed [private] |
Referenced by BeginOfRunAction(), BLManager(), EndOfEventAction(), EndOfRunAction(), and incrEventsProcessed().
bool BLManager::endRun [private] |
Referenced by BeginOfEventAction(), BeginOfRunAction(), BLManager(), EndOfEventAction(), and GeneratePrimaries().
PRNGSeedMethod BLManager::seedMethod [private] |
Referenced by BLManager(), getPRNGSeedMethod(), and setPRNGSeedMethod().
G4String BLManager::eventCutFile [private] |
Referenced by BLManager(), readEventCutFile(), and setEventCutFile().
std::set<int> BLManager::eventList [private] |
Referenced by readEventCutFile(), and skipEvent().
G4SteppingManager* BLManager::fpSteppingManager [private] |
Referenced by getSteppingManager(), and setSteppingManager().
G4TrackingManager* BLManager::fpTrackingManager [private] |
Referenced by PreUserTrackingAction(), and setTrackingManager().
std::vector<BLBeam*> BLManager::beamVector [private] |
Referenced by GeneratePrimaries(), initialize(), registerBeam(), and trackBeam().
std::vector<BLBeam*> BLManager::referenceVector [private] |
Referenced by GeneratePrimaries(), initialize(), nReference(), registerReference(), and trackTuneAndReferenceParticles().
std::vector<RunAction*> BLManager::runActionVector [private] |
Referenced by BeginOfRunAction(), EndOfRunAction(), and registerRunAction().
std::vector<RunAction*> BLManager::beamRunActionVector [private] |
Referenced by BeginOfRunAction(), EndOfRunAction(), and registerRunAction().
std::vector<EventAction*> BLManager::eventActionVector [private] |
Referenced by BeginOfEventAction(), EndOfEventAction(), and registerEventAction().
std::vector<EventAction*> BLManager::beamEventActionVector [private] |
Referenced by BeginOfEventAction(), EndOfEventAction(), and registerEventAction().
std::vector<TrackingAction*> BLManager::trackingActionVector [private] |
Referenced by PostUserTrackingAction(), PreUserTrackingAction(), and registerTrackingAction().
std::vector<BLCallback*> BLManager::preReferenceCallbackVector [private] |
Referenced by handleCallbacks(), and registerCallback().
std::vector<BLCallback*> BLManager::postReferenceCallbackVector [private] |
Referenced by handleCallbacks(), and registerCallback().
std::vector<BLCallback*> BLManager::postTrackingCallbackVector [private] |
Referenced by handleCallbacks(), and registerCallback().
std::vector<BLCallback*> BLManager::replaceMainLoopCallbackVector [private] |
Referenced by handleCallbacks(), and registerCallback().
std::vector<BLCallback*> BLManager::visualizationCallbackVector [private] |
Referenced by handleCallbacks(), and registerCallback().
std::vector<SteppingAction*> BLManager::allStepVector [private] |
Referenced by registerSteppingAction(), and UserSteppingAction().
std::map<G4VPhysicalVolume*,SteppingAction*> BLManager::allStepMap [private] |
Referenced by registerSteppingAction(), and UserSteppingAction().
std::map<G4VPhysicalVolume*,SteppingAction*> BLManager::tpStepMap [private] |
Referenced by registerTuneParticleStep(), and UserSteppingAction().
std::map<G4VPhysicalVolume*,SteppingAction*> BLManager::rpStepMap [private] |
Referenced by registerReferenceParticleStep(), and UserSteppingAction().
std::vector<SteppingAction*> BLManager::tpStepVector [private] |
Referenced by registerTuneParticleStep(), and UserSteppingAction().
std::vector<SteppingAction*> BLManager::rpStepVector [private] |
Referenced by registerReferenceParticleStep(), and UserSteppingAction().
std::map<G4VPhysicalVolume*,SteppingAction*> BLManager::beamStepMap [private] |
Referenced by registerBeamStep(), and UserSteppingAction().
std::vector<SteppingAction*> BLManager::beamStepVector [private] |
Referenced by registerBeamStep(), and UserSteppingAction().
std::vector<int> BLManager::verboseFormat [private] |
Referenced by appendVerboseFormat(), BLManager(), and steppingVerbosePrint().
G4double BLManager::zTolerance [private] |
Referenced by BLManager(), initialize(), PreUserTrackingAction(), and UserSteppingAction().
std::vector<ZStep> BLManager::tuneZStep [private] |
Referenced by BLManager(), PreUserTrackingAction(), and registerZStep().
std::vector<ZStep> BLManager::referenceZStep [private] |
Referenced by BLManager(), PreUserTrackingAction(), and registerZStep().
std::vector<ZStep> BLManager::beamZStep [private] |
Referenced by BLManager(), PreUserTrackingAction(), and registerZStep().
std::vector<ZStep>* BLManager::currentZStep [private] |
Referenced by BLManager(), PreUserTrackingAction(), and UserSteppingAction().
unsigned BLManager::indexZStep [private] |
Referenced by BLManager(), PreUserTrackingAction(), and UserSteppingAction().
G4double BLManager::prevZ [private] |
Referenced by BLManager(), PreUserTrackingAction(), and UserSteppingAction().
G4int BLManager::nStuck [private] |
Referenced by BLManager(), PreUserTrackingAction(), and UserSteppingAction().
std::vector<StackingAction*> BLManager::stackingActionVector [private] |
Referenced by ClassifyNewTrack(), NewStage(), PrepareNewEvent(), and registerStackingAction().
int BLManager::nextSecondaryTrackID [private] |
Referenced by BLManager(), getNextSecondaryTrackID(), PreUserTrackingAction(), setExternalTrackID(), and setNextSecondaryTrackID().
std::map<G4int,G4int> BLManager::trackIDMap [private] |
Referenced by clearTrackIDMap(), getExternalParentID(), getExternalTrackID(), and PreUserTrackingAction().
int BLManager::primaryTrackID [private] |
Referenced by BLManager(), getPrimaryTrackID(), PreUserTrackingAction(), and setPrimaryTrackID().
int BLManager::primaryParentID [private] |
Referenced by BLManager(), getPrimaryParentID(), PreUserTrackingAction(), and setPrimaryTrackID().
std::vector<BLUserCode*> BLManager::userCodeVector [private] |
Referenced by getUserCodeInstances(), and registerUserCode().
std::map<G4String,int> BLManager::exceptionCount [private] |
Referenced by exceptionSummary(), and Notify().