From 6eac7c252eb14f33d33ce1b56435cdd43252e6c9 Mon Sep 17 00:00:00 2001 From: Haoyu Shi Date: Sat, 2 Mar 2024 11:04:57 +0000 Subject: [PATCH 1/3] Upload New File --- Examples/options/test_detsimbg.py | 148 ++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 Examples/options/test_detsimbg.py diff --git a/Examples/options/test_detsimbg.py b/Examples/options/test_detsimbg.py new file mode 100644 index 000000000..fb83397b8 --- /dev/null +++ b/Examples/options/test_detsimbg.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python + +import os +import sys +# sys.exit(0) + +from Gaudi.Configuration import * + +############################################################################## +# Random Number Svc +############################################################################## +from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ + +seed = [42] + +# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi +rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_("RndmGenSvc.Engine") # The default engine in Geant4 +rndmengine.SetSingleton = True +rndmengine.Seeds = seed + +rndmgensvc = RndmGenSvc("RndmGenSvc") +rndmgensvc.Engine = rndmengine.name() + + +############################################################################## +# Event Data Svc +############################################################################## +from Configurables import k4DataSvc +dsvc = k4DataSvc("EventDataSvc") + + +############################################################################## +# Geometry Svc +############################################################################## + +# geometry_option = "CepC_v4-onlyTracker.xml" +geometry_option = "CepC_v4.xml" + +if not os.getenv("DETCEPCV4ROOT"): + print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." ) + sys.exit(-1) + +geometry_path = os.path.join(os.getenv("DETCEPCV4ROOT"), "compact", geometry_option) +if not os.path.exists(geometry_path): + print("Can't find the compact geometry file: %s"%geometry_path) + sys.exit(-1) + +from Configurables import GeomSvc +geosvc = GeomSvc("GeomSvc") +geosvc.compact = geometry_path + +from Configurables import TimeProjectionChamberSensDetTool +tpc_sensdettool = TimeProjectionChamberSensDetTool("TimeProjectionChamberSensDetTool") +tpc_sensdettool.TypeOption = 1 + +############################################################################## +# Physics Generator +############################################################################## +from Configurables import GenAlgo +from Configurables import GtGunTool +from Configurables import StdHepRdr +from Configurables import SLCIORdr +from Configurables import HepMCRdr +from Configurables import GenPrinter +from Configurables import GtBeamBackgroundTool + +bg = GtBeamBackgroundTool("GtBeamBackgroundTool") +bg.InputFileMap={"default":"Test/0/ToCEPCSW.out"} +bg.InputBeamEnergyMap={"default":120.}#GeV +bg.RotationAlongYMap={"default":16.5e-3} # radian + +#gun.Particles = ["pi+"] +#gun.EnergyMins = [100.] # GeV +#gun.EnergyMaxs = [100.] # GeV + +#gun.ThetaMins = [0] # rad; 45deg +#gun.ThetaMaxs = [180.] # rad; 45deg + +#gun.PhiMins = [0] # rad; 0deg +#gun.PhiMaxs = [360.] # rad; 360deg + +# stdheprdr = StdHepRdr("StdHepRdr") +# stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep" + +# lciordr = SLCIORdr("SLCIORdr") +# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio" + +# hepmcrdr = HepMCRdr("HepMCRdr") +# hepmcrdr.Input = "example_UsingIterators.txt" + +genprinter = GenPrinter("GenPrinter") + +genalg = GenAlgo("GenAlgo") +genalg.GenTools = ["GtBeamBackgroundTool"] +# genalg.GenTools = ["StdHepRdr"] +# genalg.GenTools = ["StdHepRdr", "GenPrinter"] +# genalg.GenTools = ["SLCIORdr", "GenPrinter"] +# genalg.GenTools = ["HepMCRdr", "GenPrinter"] + +############################################################################## +# Detector Simulation +############################################################################## +from Configurables import DetSimSvc + +detsimsvc = DetSimSvc("DetSimSvc") + +# from Configurables import ExampleAnaElemTool +# example_anatool = ExampleAnaElemTool("ExampleAnaElemTool") + +from Configurables import DetSimAlg + +detsimalg = DetSimAlg("DetSimAlg") +detsimalg.RandomSeeds = seed + +# detsimalg.VisMacs = ["vis.mac"] + +detsimalg.RunCmds = [ +# "/tracking/verbose 1", +] +detsimalg.AnaElems = [ + # example_anatool.name() + # "ExampleAnaElemTool" + "Edm4hepWriterAnaElemTool" +] +detsimalg.RootDetElem = "WorldDetElemTool" + +from Configurables import AnExampleDetElemTool +example_dettool = AnExampleDetElemTool("AnExampleDetElemTool") + + +############################################################################## +# POD I/O +############################################################################## +from Configurables import PodioOutput +out = PodioOutput("outputalg") +out.filename = "Test/0/test-detsim10.root" +out.outputCommands = ["keep *"] + +############################################################################## +# ApplicationMgr +############################################################################## + +from Configurables import ApplicationMgr +ApplicationMgr( TopAlg = [genalg, detsimalg, out], + EvtSel = 'NONE', + EvtMax = 3000, + ExtSvc = [rndmengine, rndmgensvc, dsvc, geosvc], +) From f130181f5bb9555efd0b78e9cc0299cfaa7cde9b Mon Sep 17 00:00:00 2001 From: Haoyu Shi Date: Wed, 6 Mar 2024 00:43:30 +0000 Subject: [PATCH 2/3] Update file BeamBackgroundFileParserV0.cpp --- Generator/src/BeamBackgroundFileParserV0.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generator/src/BeamBackgroundFileParserV0.cpp b/Generator/src/BeamBackgroundFileParserV0.cpp index 025934282..261443eb2 100644 --- a/Generator/src/BeamBackgroundFileParserV0.cpp +++ b/Generator/src/BeamBackgroundFileParserV0.cpp @@ -38,8 +38,8 @@ bool BeamBackgroundFileParserV0::load(IBeamBackgroundFileParser::BeamBackgroundD ss >> loss_turn; if (ss.fail()) { continue; } ss >> z; if (ss.fail()) { continue; } ss >> x; if (ss.fail()) { continue; } - ss >> y; if (ss.fail()) { continue; } ss >> cosx; if (ss.fail()) { continue; } + ss >> y; if (ss.fail()) { continue; } ss >> cosy; if (ss.fail()) { continue; } ss >> dz; if (ss.fail()) { continue; } ss >> dp; if (ss.fail()) { continue; } From 66f8f4c9f764fe39c698371ddeb52f6e61f544fb Mon Sep 17 00:00:00 2001 From: Haoyu Shi Date: Thu, 7 Mar 2024 08:10:35 +0000 Subject: [PATCH 3/3] Delete test_detsimbg.py --- Examples/options/test_detsimbg.py | 148 ------------------------------ 1 file changed, 148 deletions(-) delete mode 100644 Examples/options/test_detsimbg.py diff --git a/Examples/options/test_detsimbg.py b/Examples/options/test_detsimbg.py deleted file mode 100644 index fb83397b8..000000000 --- a/Examples/options/test_detsimbg.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -# sys.exit(0) - -from Gaudi.Configuration import * - -############################################################################## -# Random Number Svc -############################################################################## -from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ - -seed = [42] - -# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi -rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_("RndmGenSvc.Engine") # The default engine in Geant4 -rndmengine.SetSingleton = True -rndmengine.Seeds = seed - -rndmgensvc = RndmGenSvc("RndmGenSvc") -rndmgensvc.Engine = rndmengine.name() - - -############################################################################## -# Event Data Svc -############################################################################## -from Configurables import k4DataSvc -dsvc = k4DataSvc("EventDataSvc") - - -############################################################################## -# Geometry Svc -############################################################################## - -# geometry_option = "CepC_v4-onlyTracker.xml" -geometry_option = "CepC_v4.xml" - -if not os.getenv("DETCEPCV4ROOT"): - print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." ) - sys.exit(-1) - -geometry_path = os.path.join(os.getenv("DETCEPCV4ROOT"), "compact", geometry_option) -if not os.path.exists(geometry_path): - print("Can't find the compact geometry file: %s"%geometry_path) - sys.exit(-1) - -from Configurables import GeomSvc -geosvc = GeomSvc("GeomSvc") -geosvc.compact = geometry_path - -from Configurables import TimeProjectionChamberSensDetTool -tpc_sensdettool = TimeProjectionChamberSensDetTool("TimeProjectionChamberSensDetTool") -tpc_sensdettool.TypeOption = 1 - -############################################################################## -# Physics Generator -############################################################################## -from Configurables import GenAlgo -from Configurables import GtGunTool -from Configurables import StdHepRdr -from Configurables import SLCIORdr -from Configurables import HepMCRdr -from Configurables import GenPrinter -from Configurables import GtBeamBackgroundTool - -bg = GtBeamBackgroundTool("GtBeamBackgroundTool") -bg.InputFileMap={"default":"Test/0/ToCEPCSW.out"} -bg.InputBeamEnergyMap={"default":120.}#GeV -bg.RotationAlongYMap={"default":16.5e-3} # radian - -#gun.Particles = ["pi+"] -#gun.EnergyMins = [100.] # GeV -#gun.EnergyMaxs = [100.] # GeV - -#gun.ThetaMins = [0] # rad; 45deg -#gun.ThetaMaxs = [180.] # rad; 45deg - -#gun.PhiMins = [0] # rad; 0deg -#gun.PhiMaxs = [360.] # rad; 360deg - -# stdheprdr = StdHepRdr("StdHepRdr") -# stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep" - -# lciordr = SLCIORdr("SLCIORdr") -# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio" - -# hepmcrdr = HepMCRdr("HepMCRdr") -# hepmcrdr.Input = "example_UsingIterators.txt" - -genprinter = GenPrinter("GenPrinter") - -genalg = GenAlgo("GenAlgo") -genalg.GenTools = ["GtBeamBackgroundTool"] -# genalg.GenTools = ["StdHepRdr"] -# genalg.GenTools = ["StdHepRdr", "GenPrinter"] -# genalg.GenTools = ["SLCIORdr", "GenPrinter"] -# genalg.GenTools = ["HepMCRdr", "GenPrinter"] - -############################################################################## -# Detector Simulation -############################################################################## -from Configurables import DetSimSvc - -detsimsvc = DetSimSvc("DetSimSvc") - -# from Configurables import ExampleAnaElemTool -# example_anatool = ExampleAnaElemTool("ExampleAnaElemTool") - -from Configurables import DetSimAlg - -detsimalg = DetSimAlg("DetSimAlg") -detsimalg.RandomSeeds = seed - -# detsimalg.VisMacs = ["vis.mac"] - -detsimalg.RunCmds = [ -# "/tracking/verbose 1", -] -detsimalg.AnaElems = [ - # example_anatool.name() - # "ExampleAnaElemTool" - "Edm4hepWriterAnaElemTool" -] -detsimalg.RootDetElem = "WorldDetElemTool" - -from Configurables import AnExampleDetElemTool -example_dettool = AnExampleDetElemTool("AnExampleDetElemTool") - - -############################################################################## -# POD I/O -############################################################################## -from Configurables import PodioOutput -out = PodioOutput("outputalg") -out.filename = "Test/0/test-detsim10.root" -out.outputCommands = ["keep *"] - -############################################################################## -# ApplicationMgr -############################################################################## - -from Configurables import ApplicationMgr -ApplicationMgr( TopAlg = [genalg, detsimalg, out], - EvtSel = 'NONE', - EvtMax = 3000, - ExtSvc = [rndmengine, rndmgensvc, dsvc, geosvc], -)