Skip to content
Snippets Groups Projects
Commit 3c11084b authored by Kristian Zarebski's avatar Kristian Zarebski
Browse files

Added Output Location and removed unneeded files

parent 7582ad29
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,8 @@ G4double thickness = 0.3; //in mm
G4String dimu_xsec_fac = "1000";
G4String output_dir = ".";
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -97,8 +99,14 @@ int main(int argc,char** argv) {
++i;
}
if(G4String(argv[i]) == "--outputdir")
{
++i;
output_dir = G4String(argv[i]);
++i;
}
}
//choose the Random engine
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
......@@ -120,7 +128,7 @@ int main(int argc,char** argv) {
//set user action classes
RunAction* RunAct;
runManager->SetUserAction(RunAct = new RunAction(det, energy, thickness, nEvts));
runManager->SetUserAction(RunAct = new RunAction(det, energy, thickness, nEvts, output_dir));
runManager->SetUserAction(new SteppingAction(RunAct));
runManager->SetUserAction(new StackingAction);
......
......@@ -51,14 +51,14 @@ class G4Run;
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction*, G4double, G4double, G4int);
RunAction(DetectorConstruction*, G4double, G4double, G4int, G4String);
~RunAction();
public:
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void CountProcesses(G4String);
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
void CountProcesses(G4String);
private:
DetectorConstruction* fDetector;
ProcessesCount* fProcCounter;
......
......@@ -16,6 +16,7 @@ parser.add_argument("--energies", default="[1000]", help="Energies List")
parser.add_argument("--thickness", default="[0.3]", help="List of thicknesses")
parser.add_argument("--scale", default="100000", help="Scale DiMuon Conversion Cross Section by factor")
parser.add_argument("--debug", default=False, action="store_true", help="Debug Mode")
parser.add_argument("--outputdir", default="G4GammaCVTestROOTFiles", help="Output Location")
args = parser.parse_args()
......@@ -39,6 +40,9 @@ except TypeError:
_logger.error("Invalid Input for Number of Events")
exit(0)
_logger.debug("Creating Test Output Directory...")
subprocess.check_call("mkdir -p {}".format(args.outputdir), shell=True)
for energy in energies:
for t in thickness:
......@@ -46,17 +50,18 @@ for energy in energies:
"\n\tNumber of Events :\t%s "+
"\n\tBeam Energy :\t%s GeV"+
"\n\tTarget Thickness :\t%s mm"+
"\n\tDiMuon XSec Scale Factor :\t%s\n",
'='*40, args.nevts, energy, t, args.scale)
"\n\tDiMuon XSec Scale Factor :\t%s"+
"\n\tOutput Directory :\t%s\n",
'='*40, args.nevts, energy, t, args.scale, args.outputdir)
_logger.info('='*40)
subprocess.check_call("G4GammaToDiLeptonConversionTest.exe --nevts {} --energy {} --thickness {} --scale {}".format(args.nevts, energy, t, args.scale), shell=True)
subprocess.check_call("G4GammaToDiLeptonConversionTest.exe --nevts {} --energy {}".format(args.nevts, energy) +
" --thickness {} --scale {} --outputdir {}".format(t, args.scale, args.outputdir), shell=True)
_logger.info("Creating Single Combined Plots ROOT File...")
import ROOT
_output = ROOT.TFile.Open("G4GammaToDiLeptonConversionTest.root", "NEW")
_output = ROOT.TFile.Open("G4GammaCVTestROOTFiles/G4GammaToDiLeptonConversionTest.root", "NEW")
_histo_dim_dict = {'DiElectron' : {'Hist' : {'InvMass' : (100, 0, 100),
'ThetaSep' : (50, 0, 6E-4),
......@@ -73,8 +78,8 @@ _histo_dim_dict = {'DiElectron' : {'Hist' : {'InvMass' : (100, 0, 100),
for energy in energies:
for t in thickness:
_logger.debug("Opening file '%s'", "TestEM6_Al_{}mm_{}GeV_{}.root".format(t, energy, args.nevts))
_tmp = ROOT.TFile.Open("TestEM6_Al_{}mm_{}GeV_{}.root".format(t, energy, args.nevts))
_logger.debug("Opening file '%s'", "{}/TestEM6_Al_{}mm_{}GeV_{}.root".format(args.outputdir, t, energy, args.nevts))
_tmp = ROOT.TFile.Open("{}/TestEM6_Al_{}mm_{}GeV_{}.root".format(args.outputdir, t, energy, args.nevts))
for particle in _histo_dim_dict.keys():
_logger.debug("Attempting to retrieve TTree '%s'", particle)
......
......@@ -51,11 +51,12 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, G4double e, G4double t, G4int n)
RunAction::RunAction(DetectorConstruction* det, G4double e, G4double t, G4int n, G4String dir)
: G4UserRunAction(),fDetector(det),fProcCounter(0),fAnalysis(0),fMat(0)
{
std::stringstream file_name;
file_name << "TestEM6_Al_";
file_name << dir;
file_name << "/TestEM6_Al_";
file_name << t;
file_name << "mm_";
file_name << e;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment