From 8bb1464d548337e9c8d699284a5c3fd31ef1211e Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Fri, 23 Oct 2020 23:57:41 -0500 Subject: [PATCH] Added input collection copiers - Removed env variables in rich script: - removed the momentum/angle env variables from the script. - This is to avoid abusing this mechanism. We really only want to change the detector and # of events. The benchmarks themselves should be static between comparisons otherwise they don't make a good benchmark for comparison. - Adding the rich to the master CI - fixed up scripts and file names --- .gitlab-ci.yml | 1 + rich/forward_hadrons.sh | 28 ++++++---------------------- rich/options/rich_reco.py | 29 +++++++++++++++++++++++------ 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0396a27..6604d584 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,6 +28,7 @@ include: - local: 'ecal/ecal_config.yml' - local: 'tracking/tracking_config.yml' - local: 'clustering/clustering_config.yml' + - local: 'rich/rich_config.yml' final_report: diff --git a/rich/forward_hadrons.sh b/rich/forward_hadrons.sh index 4ef74e96..784a1c34 100644 --- a/rich/forward_hadrons.sh +++ b/rich/forward_hadrons.sh @@ -8,23 +8,7 @@ if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then export JUGGLER_N_EVENTS=100 fi -if [[ ! -n "${P_start}" ]] ; then - export P_start=5.0 -fi - -if [[ ! -n "${P_end}" ]] ; then - export P_end=100.0 -fi - -if [[ ! -n "${Angle_start}" ]] ; then - export Angle_start=3.0 -fi - -if [[ ! -n "${Angle_end}" ]] ; then - export Angle_end=8.0 -fi - -export JUGGLER_FILE_NAME_TAG="emcal_uniform_electrons" +export JUGGLER_FILE_NAME_TAG="rich_forward_hadrons" export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" @@ -47,17 +31,17 @@ popd python rich/scripts/rich_data_gen.py \ ${JUGGLER_FILE_NAME_TAG}.hepmc \ -n ${JUGGLER_N_EVENTS} \ - --pmin ${P_start} \ - --pmax ${P_end} \ - --angmin ${Angle_start} \ - --angmax ${Angle_end} + --pmin 5.0 \ + --pmax 100.0 \ + --angmin 3.0 \ + --angmax 8.0 pushd ${JUGGLER_DETECTOR} ls -l # run geant4 simulations python options/ForwardRICH/simu.py \ --compact=${JUGGLER_DETECTOR}.xml \ - -i ../${JUGGLER_FILE_NAME_TAG} \ + -i ../${JUGGLER_FILE_NAME_TAG}.hepmc \ -o ${JUGGLER_SIM_FILE} -n ${JUGGLER_N_EVENTS} diff --git a/rich/options/rich_reco.py b/rich/options/rich_reco.py index d0557aeb..d6faddc5 100644 --- a/rich/options/rich_reco.py +++ b/rich/options/rich_reco.py @@ -4,29 +4,46 @@ from GaudiKernel import SystemOfUnits as units from GaudiKernel.DataObjectHandleBase import DataObjectHandleBase from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc -geo_service = GeoSvc("GeoSvc", detectors=["topside.xml"]) -podioevent = EICDataSvc("EventDataSvc", inputs=["rich_test.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__Digi__PhotoMultiplierDigi as PhotoMultiplierDigi from Configurables import Jug__Reco__PhotoMultiplierReco as PhotoMultiplierReco from Configurables import Jug__Reco__PhotoRingClusters as PhotoRingClusters +from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier +from Configurables import Jug__Base__InputCopier_dd4pod__PhotoMultiplierHitCollection_dd4pod__PhotoMultiplierHitCollection_ as PMTCopier + qe_data = [(1.0, 0.25), (7.5, 0.25),] podioinput = PodioInput("PodioReader", collections=["mcparticles", "ForwardRICHHits"], OutputLevel=DEBUG) +## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. +# copy these inputs to the output (a bug work around for now...). Note the the output name has a "2" at the end. +copier = MCCopier("MCCopier", inputCollection="mcparticles", outputCollection="mcparticles2",OutputLevel=DEBUG) +pmtcopier = PMTCopier("PMTCopier", inputCollection="ForwardRICHHits", outputCollection="ForwardRICHHits2",OutputLevel=DEBUG) + pmtdigi = PhotoMultiplierDigi(inputHitCollection="ForwardRICHHits", outputHitCollection="DigiForwardRICHHits", quantumEfficiency=[(a*units.eV, b) for a, b in qe_data]) pmtreco = PhotoMultiplierReco(inputHitCollection="DigiForwardRICHHits", outputHitCollection="RecoForwardRICHHits") -richcluster = PhotoRingClusters(inputHitCollection="RecoForwardRICHHits", inputTrackCollection="mcparticles", +richcluster = PhotoRingClusters(inputHitCollection="RecoForwardRICHHits", #inputTrackCollection="mcparticles", outputClusterCollection="RICHClusters") -out = PodioOutput("out", filename="rich_test_reco.root") +out = PodioOutput("out", filename=output_rec_file) out.outputCommands = ["keep *"] ApplicationMgr( - TopAlg = [podioinput, pmtdigi, pmtreco, richcluster, out], + TopAlg = [podioinput, copier, pmtcopier, pmtdigi, pmtreco, richcluster, out], EvtSel = 'NONE', - EvtMax = 100000, + EvtMax = n_events, ExtSvc = [podioevent], OutputLevel=DEBUG ) -- GitLab