From 6cf9732b7b22c235fdd344e58cf109fac83183ce Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Wed, 21 Oct 2020 00:35:58 -0500 Subject: [PATCH] Added output copies of input collections. - using copier algo to get around bug (for now). - note the "2" appended to the output collection names. --- ecal/emcal_electrons.sh | 2 +- ecal/emcal_pi0s.sh | 2 +- ecal/options/crystal_calorimeter_reco.py | 27 ++++++++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ecal/emcal_electrons.sh b/ecal/emcal_electrons.sh index 29ec0617..b8af5703 100644 --- a/ecal/emcal_electrons.sh +++ b/ecal/emcal_electrons.sh @@ -49,7 +49,7 @@ npsim --runType batch \ --inputFiles ../${JUGGLER_FILE_NAME_TAG}.hepmc \ --outputFile ${JUGGLER_SIM_FILE} # Need to figure out how to pass file name to juggler from the commandline -xenv -x /usr/local/Juggler.xenv gaudirun.py ../ecal/options/example_crystal.py +xenv -x /usr/local/Juggler.xenv gaudirun.py ../ecal/options/crystal_calorimeter_reco.py ls -l popd diff --git a/ecal/emcal_pi0s.sh b/ecal/emcal_pi0s.sh index dd6e9caa..2387fbf4 100644 --- a/ecal/emcal_pi0s.sh +++ b/ecal/emcal_pi0s.sh @@ -47,7 +47,7 @@ npsim --runType batch \ --outputFile ${JUGGLER_SIM_FILE} # Need to figure out how to pass file name to juggler from the commandline -xenv -x /usr/local/Juggler.xenv gaudirun.py ../ecal/options/example_crystal.py +xenv -x /usr/local/Juggler.xenv gaudirun.py ../ecal/options/crystal_calorimeter_reco.py ls -l popd diff --git a/ecal/options/crystal_calorimeter_reco.py b/ecal/options/crystal_calorimeter_reco.py index 5717dd9e..c88b044e 100644 --- a/ecal/options/crystal_calorimeter_reco.py +++ b/ecal/options/crystal_calorimeter_reco.py @@ -1,19 +1,38 @@ from Gaudi.Configuration import * +import os from GaudiKernel.DataObjectHandleBase import DataObjectHandleBase from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc from GaudiKernel import SystemOfUnits as units -geo_service = GeoSvc("GeoSvc", detectors=["topside.xml"]) -podioevent = EICDataSvc("EventDataSvc", inputs=["sim_emcal_electrons.root"], OutputLevel=DEBUG) +detector_name = "topside" +if "JUGGLER_DETECTOR" in os.environ : + detector_name = str(os.environ["JUGGLER_DETECTOR"]) + +# todo add checks +input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) +output_rec_file = str(os.environ["JUGGLER_REC_FILE"]) +n_events = str(os.environ["JUGGLER_N_EVENTS"]) + +geo_service = GeoSvc("GeoSvc", detectors=["{}.xml".format(detector_name)]) +podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=DEBUG) from Configurables import PodioInput +from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier +from Configurables import Jug__Base__InputCopier_dd4pod__CalorimeterHitCollection_dd4pod__CalorimeterHitCollection_ as CalCopier + + from Configurables import Jug__Digi__CrystalEndcapsDigi as CrystalEndcapsDigi from Configurables import Jug__Reco__CrystalEndcapsReco as CrystalEndcapsReco from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG podioinput = PodioInput("PodioReader", collections=["mcparticles","CrystalEcalHits"], OutputLevel=DEBUG) + +## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. +copier = MCCopier("MCCopier", inputCollection="mcparticles", outputCollection="mcparticles2",OutputLevel=DEBUG) +calcopier = CalCopier("CalCopier", inputCollection="CrystalEcalHits", outputCollection="CrystalEcalHits2",OutputLevel=DEBUG) + emcaldigi = CrystalEndcapsDigi("ecal_digi", inputHitCollection="CrystalEcalHits", outputHitCollection="RawDigiEcalHits") emcalreco = CrystalEndcapsReco("ecal_reco", inputHitCollection="RawDigiEcalHits", outputHitCollection="RecoEcalHits", minModuleEdep=1.0*units.MeV) @@ -21,14 +40,14 @@ emcalcluster = IslandCluster("emcal_cluster", inputHitCollection="RecoEcalHits", minClusterCenterEdep=30*units.MeV, groupRange=2.0) clusterreco = RecoCoG("cluster_reco", clusterCollection="EcalClusters", logWeightBase=4.2, moduleDimZName="CrystalBox_z_length") -out = PodioOutput("out", filename="sim_emcal_electrons_output.root") +out = PodioOutput("out", filename=output_rec_file) out.outputCommands = ["keep *"] ApplicationMgr( TopAlg = [podioinput, emcaldigi, emcalreco, emcalcluster, clusterreco, out], EvtSel = 'NONE', - EvtMax = 100000, + EvtMax = n_events, ExtSvc = [podioevent], OutputLevel=DEBUG ) -- GitLab