Skip to content

Commit

Permalink
adding the flag to switch off AdePT
Browse files Browse the repository at this point in the history
  • Loading branch information
Witold Pokorski committed Oct 20, 2023
1 parent 5ae5b2e commit 9d02391
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
5 changes: 4 additions & 1 deletion examples/Example21/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ The AdePT code is based on Example17.

The example can be run both as full Geant4 simulation or as Geant4 + AdePT simulation where the simulation of the EM particles is done on the GPU.

The FTFP_BERT_AdePT physics list runs Geant4 with AdePT, while the FTFP_BERT_HepEm one runs Geant4 only (with G4HepEm EM models).
By default, the example runs with AdePT on (FTFP_BERT_AdePT physics list).
In order to run without AdePT (Geant4 only) you need to call with the the extra argument --no_AdePT as follows:

<mybin>/example21 -m example21.mac --no_AdePT

The selection of sensitive volumes can be done through:
/example17/detector/addsensitivevolume EAPD_01
Expand Down
21 changes: 16 additions & 5 deletions examples/Example21/example21.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ int main(int argc, char **argv)
bool doBenchmark = false;
bool doValidation = false;
G4bool useInteractiveMode = true;
G4bool useAdePT = true;
G4String helpMsg("Usage: " + G4String(argv[0]) +
" [option(s)] \n No additional arguments triggers an interactive mode "
"executing vis.mac macro. \n Options:\n\t-h\t\tdisplay this help "
Expand All @@ -49,7 +50,9 @@ int main(int argc, char **argv)
} else if (argument == "--do_benchmark") {
doBenchmark = true;
} else if (argument == "--do_validation") {
doValidation = true;
doValidation = true;
} else if (argument == "--no_AdePT") {
useAdePT = false;
} else {
G4Exception("main", "Unknown argument", FatalErrorInArgument,
("Unknown argument passed to " + G4String(argv[0]) + " : " + argument + "\n" + helpMsg).c_str());
Expand Down Expand Up @@ -83,13 +86,21 @@ int main(int argc, char **argv)
//auto *runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Serial);

// Physics list
// auto physicsList = new FTFP_BERT_HepEm();
//
auto* trackingManager = new AdePTTrackingManager;
auto physicsList = new FTFP_BERT_AdePT(trackingManager);
AdePTTrackingManager* trackingManager = nullptr;

if(useAdePT){
trackingManager = new AdePTTrackingManager;
auto* physicsList = new FTFP_BERT_AdePT(trackingManager);
runManager->SetUserInitialization(physicsList);
}
else{
auto* physicsList = new FTFP_BERT_HepEm();
runManager->SetUserInitialization(physicsList);
}

// reduce verbosity of physics lists
G4EmParameters::Instance()->SetVerbose(0);
runManager->SetUserInitialization(physicsList);
G4HadronicProcessStore::Instance()->SetVerbose(0);

// Detector geometry:
Expand Down
2 changes: 1 addition & 1 deletion examples/Example21/src/FTFP_BERT_AdePT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FTFP_BERT_AdePT::FTFP_BERT_AdePT(AdePTTrackingManager* tm, G4int ver)
{
// default cut value (1.0mm)
// defaultCutValue = 1.0*CLHEP::mm;
G4cout << "<<< Geant4 Physics List simulation engine: FTFP_BERT_HepEm" << G4endl;
G4cout << "<<< Geant4 Physics List simulation engine: FTFP_BERT_AdePT" << G4endl;
G4cout << G4endl;
defaultCutValue = 0.7 * CLHEP::mm;
SetVerboseLevel(ver);
Expand Down

0 comments on commit 9d02391

Please sign in to comment.