def __init__(self, geoFile): self.fgeo = ROOT.TFile.Open(geoFile) #load geo dictionary upkl = Unpickler(self.fgeo) self.snd_geo = upkl.load('ShipGeo') # -----Create geometry---------------------------------------------- run = "notNeeded" self.modules = sndDet_conf.configure(run, self.snd_geo) self.sGeo = self.fgeo.FAIRGeom self.modules['Scifi'].SiPMmapping() lsOfGlobals = ROOT.gROOT.GetListOfGlobals() for m in self.modules: lsOfGlobals.Add(self.modules[m]) temp = {} for o1 in self.snd_geo: key = o1 x = self.snd_geo[o1] if not hasattr(x, 'items'): temp[key] = x else: for o2 in x: key = o1 + '/' + o2 y = x[o2] if not hasattr(y, 'items'): temp[key] = y else: for o3 in y: key = o1 + '/' + o2 + '__' + o3 z = y[o3] if not hasattr(z, 'items'): temp[key] = z for key in temp: if not key.find('MuFilter') < 0: self.modules['MuFilter'].SetConfPar(key, temp[key]) if not key.find('Scifi') < 0: self.modules['Scifi'].SetConfPar(key, temp[key])
timer.Start() # ------------------------------------------------------------------------ # -----Create simulation run---------------------------------------- run = ROOT.FairRunSim() run.SetName(mcEngine) # Transport engine run.SetOutputFile(outFile) # Output file run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C rtdb = run.GetRuntimeDb() # add user task if userTask: userTask = MyTask() run.AddTask(userTask) # -----Create geometry---------------------------------------------- import shipLHC_conf as sndDet_conf modules = sndDet_conf.configure(run, snd_geo) # -----Create PrimaryGenerator-------------------------------------- primGen = ROOT.FairPrimaryGenerator() # -----Particle Gun----------------------- if simEngine == "PG": myPgun = ROOT.FairBoxGenerator(options.pID, 1) myPgun.SetPRange(options.Estart, options.Eend) myPgun.SetPhiRange(0, 360) # // Azimuth angle range [degree] myPgun.SetXYZ(options.EVx * u.cm, options.EVy * u.cm, options.EVz * u.cm) myPgun.SetThetaRange(0, 0) # // Polar angle in lab system range [degree] primGen.AddGenerator(myPgun) ROOT.FairLogger.GetLogger().SetLogScreenLevel( "WARNING") # otherwise stupid printout for each event # -----muon DIS Background------------------------
parInput1 = ROOT.FairParRootFileIo() parInput1.open(options.ParFile) rtdb.setFirstInput(parInput1) fMan= ROOT.FairEventManager() fMan.SetMaxEnergy(5000.) # default is 25 GeV only ! fMan.SetMinEnergy(0.1) # 100 MeV fMan.SetEvtMaxEnergy(5000.) # what is the difference between EvtMaxEnergy and MaxEnergy ? fMan.SetPriOnly(False) # display everything upkl = Unpickler( fRun.GetGeoFile() ) ShipGeo = upkl.load('ShipGeo') # -----Create geometry---------------------------------------------- import shipLHC_conf as sndDet_conf modules = sndDet_conf.configure(fRun,ShipGeo) if isMC: mcHits = {} mcHits['MuFilterPoints'] = ROOT.FairMCPointDraw("MuFilterPoint", ROOT.kBlue, ROOT.kFullSquare) mcHits['ScifiPoints'] = ROOT.FairMCPointDraw("ScifiPoint", ROOT.kGreen, ROOT.kFullCircle) mcHits['EmulsionDetPoints'] = ROOT.FairMCPointDraw("EmulsionDetPoint", ROOT.kMagenta, ROOT.kFullDiamond) for x in mcHits: fMan.AddTask(mcHits[x]) fMan.Init(1,4,10) # default Init(visopt=1, vislvl=3, maxvisnds=10000) #visopt, set drawing mode : # option=0 (default) all nodes drawn down to vislevel # option=1 leaves and nodes at vislevel drawn # option=2 path is drawn # vislvl #