Commit ded5fb56 authored by Valentina Fioretti's avatar Valentina Fioretti
Browse files

setting Geant4 reference physics list

parent de6b418a
Loading
Loading
Loading
Loading
+23 −6
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ GeoClassFactory::map_type * GeoClassFactory::map = NULL;
PhysClassFactory::map_type * PhysClassFactory::map = NULL;

#include "PhysClassFactory.hh"
#include "FTFP_BERT.hh"
#include "G4PhysListFactory.hh"

//std::map<std::string, std::function<std::shared_ptr<G4VUserDetectorConstruction>()>> ClassFactory::classMap;

@@ -86,15 +86,32 @@ BoGEMMSApplication::~BoGEMMSApplication() {}
void BoGEMMSApplication::DefinePhysicList(G4RunManager * runManager) {

 
    G4PhysListFactory factory;
    
    cout << "Physics class activated: " << gm.physVersion << endl;
    if (factory.IsReferencePhysList(gm.physVersion)) {
        cout << "* Geant4 reference physics list *" << endl;
        G4VModularPhysicsList* refPhysList = factory.GetReferencePhysList(gm.physVersion);
        
        //cut off
        G4double inputCutValue = 1.*mm;
        G4String prefix = gm.physVersion;
        gm.config->readInto(inputCutValue, prefix + ".DEFAULT.CUT");
        G4cout << prefix + ".DEFAULT.CUT: " << inputCutValue << G4endl;
        
        G4double defaultCutValue = inputCutValue*mm;
        refPhysList->SetDefaultCutValue(defaultCutValue);
        
        runManager->SetUserInitialization(refPhysList);
        
    } else {
        auto obj = PhysClassFactory::createInstance(gm.physVersion);
        if (obj) {
            runManager->SetUserInitialization(obj);
        //obj->AddPhysicsList(hadronname);
        } else {
            std::cout << "Physics class not found." << std::endl;
        }
    }

}