diff --git a/ecal/emcal_electrons.sh b/ecal/emcal_electrons.sh index 29ec061704e40659f1436f5d54c86a3cee993108..b8af5703a19c9b62d34036ecdbf096c03a26d4e3 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 dd6e9caa4d55989e47a683bab6e77d0c472e6d10..2387fbf4811194eaedc8156f81f9644006f5deaf 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 5717dd9eb3d719989a447f011aa3bb3ae597be5c..c88b044e79a4051ed4cac10b8adfc07ac025ec6e 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 )