2 # -*- coding: utf-8 -*-
9 self.pwd = os.getenv("PWD")
12 def mkDirStructure(self):
13 os.system("mkdir -p simulations/single")
14 os.system("mkdir -p simulations/pi0")
17 os.system("cp ConfigSingle.C simulations/single/Config.C")
18 os.system("cp ConfigPi0.C simulations/pi0/Config.C")
19 os.system("cp sim.C simulations/single/sim.C")
20 os.system("cp sim.C simulations/pi0/sim.C")
23 os.system("rm simulations/single/ -rf")
24 os.system("rm simulations/pi0/ -rf")
26 def initSimulation(self):
31 def runSimulation(self, nevents, dophos, doemcal, dotm):
32 simargs = str(nevents) + ", " + str(int(dophos)) + ", " + str(int(doemcal)) + ", " + str(int(dotm))
33 command = "cd simulations/single/ && aliroot -b -q sim.C\'(" + simargs + ")\'"
35 os.system("cd " + self.pwd)
42 self.pwd = os.getenv("PWD")
43 os.system("rm -rf tests/all/")
44 os.system("mkdir -p tests/all/single")
45 os.system("cp rec_hlt_calo.C tests/all/single/.")
46 os.system("cp runAll.C tests/all/single/.")
47 os.system("cp read_HLT_ESDs.C tests/all/single/.")
49 def run(self, dophos, doemcal, dotm):
51 runargs = "\"./\", \"./\", " + str(int(dophos)) + ", " + str(int(doemcal)) + ", " + str(int(dotm))
52 path = self.pwd + "/simulations/single/."
53 command = "cd tests/all/single/; ln -s " + path + "/raw* .; ln -s " + path + "/GRP . ; aliroot runAll.C\'(" + runargs + ")\'"
55 os.system("cd " + self.pwd)
57 from optparse import OptionParser
59 parser = OptionParser()
61 parser.add_option("-s", "--simulatedata", action="store_true", dest="simulatedata",
62 default=False, help="Simulate data for the tests")
63 parser.add_option("-n", "--nevents", dest="nevents",
64 default=100, help="Specify the number of events to simulate. If you change this the reference histograms will be useless")
65 parser.add_option("", "--no-phos", action="store_false", dest="runphos",
66 default=True, help="Testing: Don't run PHOS tests. Simulation: Don't simulate for PHOS")
67 parser.add_option("", "--no-emcal", action="store_false", dest="runemcal",
68 default=True, help="Testing: Don't run EMCAL tests. Simulation: Don't simulate for EMCAL")
69 parser.add_option("", "--no-trackmatching", action="store_false", dest="runtm",
70 default=True, help="Testing: Don't run the track matcher, Simulation: Don't simulate TPC")
72 (options, args) = parser.parse_args()
74 if options.simulatedata:
75 simulator = Simulator()
76 simulator.initSimulation()
77 simulator.runSimulation(options.nevents, options.runphos, options.runemcal, options.runtm)
83 tester.run(options.runphos, options.runemcal, options.runtm)