From d90c02a336b859a1d11fe1bb0fe34650d04a9f3c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wouter.deconinck@umanitoba.ca> Date: Wed, 6 Oct 2021 22:32:03 +0000 Subject: [PATCH] mcparticles2 -> mcparticles, remove copiers, keep mcparticles --- benchmarks/clustering/options/full_cal_reco.py | 7 ++----- .../scripts/deprecated/barrel_clusters.cxx | 4 ++-- benchmarks/ecal/options/barrel.py | 7 ++----- benchmarks/ecal/options/endcap_e.py | 7 ++----- benchmarks/ecal/options/endcap_i.py | 7 ++----- .../analysis/rec_far_forward_protons.cxx | 4 ++-- .../options/far_forward_reconstruction.py | 9 +-------- .../imaging_ecal/options/hybrid_cluster.py | 10 ++-------- .../imaging_ecal/options/imaging_2dcluster.py | 8 +------- .../imaging_ecal/options/imaging_topocluster.py | 13 +------------ benchmarks/imaging_ecal/scripts/draw_cluster.py | 4 ++-- .../imaging_ecal/scripts/draw_cluster_layers.py | 2 +- benchmarks/imaging_ecal/scripts/utils.py | 6 +++--- .../imaging_shower_ML/options/imaging_ml_data.py | 7 +------ .../scripts/prepare_tf_dataset.py | 4 ++-- benchmarks/rich/options/rich_reco.py | 9 +-------- .../options/track_reconstruction.py | 16 +--------------- .../scripts/rec_multiple_tracks.cxx | 4 ++-- .../options/track_reconstruction.py | 16 +--------------- .../scripts/rec_multiple_tracks.cxx | 4 ++-- .../track_fitting/scripts/rec_single_tracks.cxx | 4 ++-- benchmarks/tracking/central_electrons.sh | 2 +- .../tracking/options/track_reconstruction.py | 16 +--------------- benchmarks/tracking/run_tracking_benchmarks.py | 6 ++---- .../tracking/scripts/rec_central_electrons.cxx | 4 ++-- .../tracking/scripts/rec_central_pions.cxx | 4 ++-- .../tracking/scripts/rec_multiple_tracks.cxx | 4 ++-- .../tracking/scripts/tracking_performance.py | 2 +- 28 files changed, 46 insertions(+), 144 deletions(-) diff --git a/benchmarks/clustering/options/full_cal_reco.py b/benchmarks/clustering/options/full_cal_reco.py index cd983a4b..24ef7bbe 100644 --- a/benchmarks/clustering/options/full_cal_reco.py +++ b/benchmarks/clustering/options/full_cal_reco.py @@ -40,7 +40,6 @@ podioevent = EICDataSvc("EventDataSvc", inputs=input_sims) # juggler components -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi from Configurables import Jug__Reco__CalorimeterHitReco as CalHitReco from Configurables import Jug__Reco__CalorimeterHitsMerger as CalHitsMerger @@ -67,8 +66,6 @@ sim_coll = [ # input and output podin = PodioInput("PodioReader", collections=sim_coll) podout = PodioOutput("out", filename=output_rec) -# copier needed to get around input --> output copy bug. So truth (mcparticles) can be saved in output file -copier = MCCopier("MCCopier", inputCollection="mcparticles", outputCollection="mcparticles2") # Crystal Endcap Ecal @@ -367,14 +364,14 @@ ce_hcal_clreco = RecoCoG("ce_hcal_clreco", podout.outputCommands = ['drop *', - 'keep mcparticles2', + 'keep mcparticles', 'keep *Digi', 'keep *Reco*', 'keep *Cluster*', 'keep *Layers'] ApplicationMgr( - TopAlg = [podin, copier, + TopAlg = [podin, ce_ecal_digi, ce_ecal_reco, ce_ecal_cl, ce_ecal_clreco, ci_ecal_digi, ci_ecal_reco, ci_ecal_merger, ci_ecal_cl, ci_ecal_clreco, cb_ecal_digi, cb_ecal_reco, cb_ecal_cl, cb_ecal_clreco, diff --git a/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx b/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx index 8968d48d..5720c7ea 100644 --- a/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx +++ b/benchmarks/clustering/scripts/deprecated/barrel_clusters.cxx @@ -91,8 +91,8 @@ int barrel_clusters(const char* in_fname = "topside/rec_barrel_clusters.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", in_fname); - auto d0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto d0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("thrownEta", eta, {"thrownParticles"}) .Define("thrownTheta", theta, {"thrownP"}) diff --git a/benchmarks/ecal/options/barrel.py b/benchmarks/ecal/options/barrel.py index 58b7bef2..1919fbf0 100644 --- a/benchmarks/ecal/options/barrel.py +++ b/benchmarks/ecal/options/barrel.py @@ -31,7 +31,6 @@ podioevent = EICDataSvc("EventDataSvc", inputs=input_sims) # juggler components -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi from Configurables import Jug__Reco__ImagingPixelReco as ImCalPixelReco from Configurables import Jug__Reco__ImagingTopoCluster as ImagingCluster @@ -46,8 +45,6 @@ sim_coll = [ # input and output podin = PodioInput("PodioReader", collections=sim_coll) podout = PodioOutput("out", filename=output_rec) -# copier needed to get around input --> output copy bug. So truth (mcparticles) can be saved in output file -copier = MCCopier("MCCopier", inputCollection="mcparticles", outputCollection="mcparticles2") # Central Barrel Ecal (Imaging Cal.) @@ -89,13 +86,13 @@ cb_ecal_clreco = ImagingClusterReco("cb_ecal_clreco", mcHits="EcalBarrelHits") podout.outputCommands = ['drop *', - 'keep mcparticles2', + 'keep mcparticles', 'keep *HitsReco', 'keep *HitsDigi', 'keep *Cluster*'] ApplicationMgr( - TopAlg = [podin, copier, + TopAlg = [podin, cb_ecal_digi, cb_ecal_reco, cb_ecal_cl, cb_ecal_clreco, podout], EvtSel = 'NONE', diff --git a/benchmarks/ecal/options/endcap_e.py b/benchmarks/ecal/options/endcap_e.py index 5a29973b..9eb12ffe 100644 --- a/benchmarks/ecal/options/endcap_e.py +++ b/benchmarks/ecal/options/endcap_e.py @@ -24,7 +24,6 @@ podioevent = EICDataSvc("EventDataSvc", inputs=input_sims) # juggler components -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi from Configurables import Jug__Reco__CalorimeterHitReco as CalHitReco from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster @@ -39,8 +38,6 @@ sim_coll = [ # input and output podin = PodioInput("PodioReader", collections=sim_coll) podout = PodioOutput("out", filename=output_rec) -# copier needed to get around input --> output copy bug. So truth (mcparticles) can be saved in output file -copier = MCCopier("MCCopier", inputCollection="mcparticles", outputCollection="mcparticles2") # Crystal Endcap Ecal @@ -83,13 +80,13 @@ ce_ecal_clreco = RecoCoG("ce_ecal_clreco", logWeightBase=4.6) podout.outputCommands = ['drop *', - 'keep mcparticles2', + 'keep mcparticles', 'keep *HitsReco', 'keep *HitsDigi', 'keep *Cluster*'] ApplicationMgr( - TopAlg = [podin, copier, + TopAlg = [podin, ce_ecal_digi, ce_ecal_reco, ce_ecal_cl, ce_ecal_clreco, podout], EvtSel = 'NONE', diff --git a/benchmarks/ecal/options/endcap_i.py b/benchmarks/ecal/options/endcap_i.py index 1a7fd342..aaa00dc7 100644 --- a/benchmarks/ecal/options/endcap_i.py +++ b/benchmarks/ecal/options/endcap_i.py @@ -26,7 +26,6 @@ podioevent = EICDataSvc("EventDataSvc", inputs=input_sims) # juggler components -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi from Configurables import Jug__Reco__CalorimeterHitReco as CalHitReco from Configurables import Jug__Reco__CalorimeterHitsMerger as CalHitsMerger @@ -42,8 +41,6 @@ sim_coll = [ # input and output podin = PodioInput("PodioReader", collections=sim_coll) podout = PodioOutput("out", filename=output_rec) -# copier needed to get around input --> output copy bug. So truth (mcparticles) can be saved in output file -copier = MCCopier("MCCopier", inputCollection="mcparticles", outputCollection="mcparticles2") # Endcap sampling Ecal @@ -92,13 +89,13 @@ ci_ecal_clreco = RecoCoG("ci_ecal_clreco", samplingFraction=ci_ecal_sf) podout.outputCommands = ['drop *', - 'keep mcparticles2', + 'keep mcparticles', 'keep *HitsReco*', 'keep *HitsDigi', 'keep *Cluster*'] ApplicationMgr( - TopAlg = [podin, copier, + TopAlg = [podin, ci_ecal_digi, ci_ecal_reco, ci_ecal_merger, ci_ecal_cl, ci_ecal_clreco, podout], EvtSel = 'NONE', diff --git a/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx b/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx index a12c2d40..9e0ae6b8 100644 --- a/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx +++ b/benchmarks/far_forward/analysis/rec_far_forward_protons.cxx @@ -86,8 +86,8 @@ int rec_far_forward_protons(const char* fname = "topside/rec_far_forward_protons ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - auto df0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("p_thrown", momentum, {"thrownP"}) .Define("theta_thrown", theta, {"thrownP"}) diff --git a/benchmarks/far_forward/options/far_forward_reconstruction.py b/benchmarks/far_forward/options/far_forward_reconstruction.py index 0a28e70b..7145ae96 100644 --- a/benchmarks/far_forward/options/far_forward_reconstruction.py +++ b/benchmarks/far_forward/options/far_forward_reconstruction.py @@ -26,7 +26,6 @@ from Configurables import Jug__Reco__FarForwardParticles as FarForwardParticles from Configurables import Jug__Reco__TrackFindingAlgorithm as TrackFindingAlgorithm from Configurables import Jug__Reco__ParticlesFromTrackFit as ParticlesFromTrackFit -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Reco__TrackerHitReconstruction as TrackerHitReconstruction @@ -44,12 +43,6 @@ algorithms = [] podin = PodioInput("PodioReader", collections=sim_colls) algorithms.append(podin) -## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. -mccopier = MCCopier("MCCopier", - inputCollection="mcparticles", - outputCollection="mcparticles2") -algorithms.append(mccopier) - ## Roman pots ffi_romanpot_digi = TrackerDigi("ffi_romanpot_digi", inputHitCollection = "ForwardRomanPotHits", @@ -134,7 +127,7 @@ podout.outputCommands = [ "drop trajectories", "drop outputSourceLinks", "drop outputInitialTrackParameters", - "drop mcparticles", + "keep mcparticles", ] algorithms.append(podout) diff --git a/benchmarks/imaging_ecal/options/hybrid_cluster.py b/benchmarks/imaging_ecal/options/hybrid_cluster.py index 295be391..223b6169 100644 --- a/benchmarks/imaging_ecal/options/hybrid_cluster.py +++ b/benchmarks/imaging_ecal/options/hybrid_cluster.py @@ -6,7 +6,6 @@ from GaudiKernel.SystemOfUnits import MeV, mm, cm, mrad, rad, ns from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc from Configurables import PodioInput -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi from Configurables import Jug__Reco__CalorimeterHitReco as CalHitReco from Configurables import Jug__Reco__CalorimeterHitsMerger as CalHitsMerger @@ -50,11 +49,6 @@ sim_colls = [ podin = PodioInput('PodioReader', collections=sim_colls, OutputLevel=DEBUG) podout = PodioOutput('podout', filename=kwargs['output']) -mccopier = MCCopier('MCCopier', - # OutputLevel=DEBUG, - inputCollection='mcparticles', - outputCollection='mcparticles2') - # use the same daq_setting for digi/reco pair imcaldaq = dict( dynamicRangeADC=3*MeV, @@ -145,7 +139,7 @@ scfi_barrel_clreco = RecoCoG("scfi_barrel_clreco", # TODO: merge two types of clusters podout.outputCommands = ['drop *', - 'keep mcparticles2', + 'keep mcparticles', 'keep *Reco*', 'keep *Digi*', 'keep *Cluster*', @@ -153,7 +147,7 @@ podout.outputCommands = ['drop *', ] ApplicationMgr( - TopAlg=[podin, mccopier, + TopAlg=[podin, imcaldigi, imcalreco, imcalcluster, clusterreco, scfi_barrel_digi, scfi_barrel_reco, scfi_barrel_merger, scfi_barrel_cl, scfi_barrel_clreco, podout], diff --git a/benchmarks/imaging_ecal/options/imaging_2dcluster.py b/benchmarks/imaging_ecal/options/imaging_2dcluster.py index 9374a8f7..b4ac4a6d 100644 --- a/benchmarks/imaging_ecal/options/imaging_2dcluster.py +++ b/benchmarks/imaging_ecal/options/imaging_2dcluster.py @@ -6,7 +6,6 @@ from GaudiKernel.SystemOfUnits import mm, MeV, rad, ns from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc from Configurables import PodioInput -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi from Configurables import Jug__Reco__CalorimeterHitReco as CalHitReco from Configurables import Jug__Reco__CalorimeterHitsEtaPhiProjector as CalHitsProj @@ -39,11 +38,6 @@ podin = PodioInput('PodioReader', collections=['mcparticles', 'EcalBarrelHits'], podout = PodioOutput('out', filename=kwargs['output']) -mccopier = MCCopier('MCCopier', - # OutputLevel=DEBUG, - inputCollection='mcparticles', - outputCollection='mcparticles2') - # use the same daq_setting for digi/reco pair imcal_barrel_daq = dict( dynamicRangeADC=3.*MeV, @@ -93,7 +87,7 @@ imcal_barrel_clreco = RecoCoG('imcal_barrel_clreco', podout.outputCommands = ['keep *'] ApplicationMgr( - TopAlg=[podin, mccopier, + TopAlg=[podin, imcal_barrel_digi, imcal_barrel_reco, imcal_barrel_merger, imcal_barrel_cl, imcal_barrel_clreco, podout], diff --git a/benchmarks/imaging_ecal/options/imaging_topocluster.py b/benchmarks/imaging_ecal/options/imaging_topocluster.py index a42c3a10..fe243a18 100644 --- a/benchmarks/imaging_ecal/options/imaging_topocluster.py +++ b/benchmarks/imaging_ecal/options/imaging_topocluster.py @@ -7,8 +7,6 @@ from GaudiKernel import SystemOfUnits as units from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc 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__CalorimeterHitDigi as CalorimeterHitDigi from Configurables import Jug__Reco__ImagingPixelReco as ImagingPixelReco from Configurables import Jug__Reco__ImagingTopoCluster as ImagingTopoCluster @@ -40,15 +38,6 @@ out = PodioOutput("out", filename=kwargs['output']) podioinput = PodioInput("PodioReader", collections=["mcparticles", "EcalBarrelHits"], OutputLevel=DEBUG) -copier = MCCopier("MCCopier", - # OutputLevel=DEBUG, - inputCollection="mcparticles", - outputCollection="mcparticles2") -calcopier = CalCopier("CalCopier", - # OutputLevel=DEBUG, - inputCollection="EcalBarrelHits", - outputCollection="EcalBarrelHits2") - # use the same daq_setting for digi/reco pair daq_setting = dict( dynamicRangeADC=3*units.MeV, @@ -91,7 +80,7 @@ clusterreco = ImagingClusterReco("imcal_clreco", out.outputCommands = ["keep *"] ApplicationMgr( - TopAlg=[podioinput, copier, calcopier, imcaldigi, imcalreco, imcalcluster, clusterreco, out], + TopAlg=[podioinput, imcaldigi, imcalreco, imcalcluster, clusterreco, out], EvtSel='NONE', EvtMax=kwargs['nev'], ExtSvc=[podioevent], diff --git a/benchmarks/imaging_ecal/scripts/draw_cluster.py b/benchmarks/imaging_ecal/scripts/draw_cluster.py index 6dedc2f6..6ad5c05a 100644 --- a/benchmarks/imaging_ecal/scripts/draw_cluster.py +++ b/benchmarks/imaging_ecal/scripts/draw_cluster.py @@ -148,7 +148,7 @@ if __name__ == '__main__': df['eta'] = -np.log(np.tan(df['theta'].values/1000./2.)) # Read all mc particles - dfallmcp = get_all_mcp(args.file, args.iev, 'mcparticles2') + dfallmcp = get_all_mcp(args.file, args.iev, 'mcparticles') pdgbase = ROOT.TDatabasePDG() # Select decaying particles dftemp = dfallmcp[dfallmcp['g4Parent'] == 1.0] @@ -165,7 +165,7 @@ if __name__ == '__main__': dfdecaymcp['eta'] = -np.log(np.tan(dfdecaymcp['theta'].values/1000./2.)) # truth - dfmcp = get_mcp_simple(args.file, args.iev, 'mcparticles2').iloc[0] + dfmcp = get_mcp_simple(args.file, args.iev, 'mcparticles').iloc[0] #pdgbase = ROOT.TDatabasePDG() inpart = pdgbase.GetParticle(int(dfmcp['pid'])) print("Incoming particle = {}, pdgcode = {}, charge = {}, mass = {}"\ diff --git a/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py b/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py index b0a06b12..89578104 100644 --- a/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py +++ b/benchmarks/imaging_ecal/scripts/draw_cluster_layers.py @@ -98,7 +98,7 @@ if __name__ == '__main__': df['eta'] = -np.log(np.tan(df['theta'].values/1000./2.)) # truth - dfmcp = get_mcp_simple(args.file, args.iev, 'mcparticles2').iloc[0] + dfmcp = get_mcp_simple(args.file, args.iev, 'mcparticles').iloc[0] pdgbase = ROOT.TDatabasePDG() inpart = pdgbase.GetParticle(int(dfmcp['pid'])) print("Incoming particle = {}, pdgcode = {}, charge = {}, mass = {}"\ diff --git a/benchmarks/imaging_ecal/scripts/utils.py b/benchmarks/imaging_ecal/scripts/utils.py index 51f48c4a..0f4e40a2 100644 --- a/benchmarks/imaging_ecal/scripts/utils.py +++ b/benchmarks/imaging_ecal/scripts/utils.py @@ -37,7 +37,7 @@ def load_root_macros(arg_macros): # read mc particles from root file -def get_mcp_data(path, evnums=None, branch='mcparticles2'): +def get_mcp_data(path, evnums=None, branch='mcparticles'): f = ROOT.TFile(path) events = f.events if evnums is None: @@ -61,7 +61,7 @@ def get_mcp_data(path, evnums=None, branch='mcparticles2'): # read mc particles from root file -def get_mcp_simple(path, evnums=None, branch='mcparticles2'): +def get_mcp_simple(path, evnums=None, branch='mcparticles'): f = ROOT.TFile(path) events = f.events if evnums is None: @@ -86,7 +86,7 @@ def get_mcp_simple(path, evnums=None, branch='mcparticles2'): ####################################### # read all mc particles from root file ####################################### -def get_all_mcp(path, evnums=None, branch='mcparticles2'): +def get_all_mcp(path, evnums=None, branch='mcparticles'): f = ROOT.TFile(path) events = f.events if evnums is None: diff --git a/benchmarks/imaging_shower_ML/options/imaging_ml_data.py b/benchmarks/imaging_shower_ML/options/imaging_ml_data.py index 7cf23956..22c87d9d 100644 --- a/benchmarks/imaging_shower_ML/options/imaging_ml_data.py +++ b/benchmarks/imaging_shower_ML/options/imaging_ml_data.py @@ -6,7 +6,6 @@ from GaudiKernel import SystemOfUnits as units from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc from Configurables import PodioInput -from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier from Configurables import Jug__Digi__CalorimeterHitDigi as CalorimeterHitDigi from Configurables import Jug__Reco__ImagingPixelReco as ImagingPixelReco from Configurables import Jug__Reco__ImagingPixelMerger as ImagingPixelMerger @@ -35,10 +34,6 @@ podev = EICDataSvc('EventDataSvc', inputs=[f.strip() for f in kwargs['input'].sp podin = PodioInput('PodioReader', collections=['mcparticles', 'EcalBarrelHits']) podout = PodioOutput('out', filename=kwargs['output']) -copier = MCCopier('MCCopier', - OutputLevel=DEBUG, - inputCollection='mcparticles', - outputCollection='mcparticles2') imcaldigi = CalorimeterHitDigi('imcal_digi', inputHitCollection='EcalBarrelHits', outputHitCollection='EcalBarrelHitsDigi', @@ -66,7 +61,7 @@ imcaldata = ImagingPixelMerger('imcal_merger', podout.outputCommands = ['keep *'] ApplicationMgr( - TopAlg=[podin, copier, imcaldigi, imcalreco, imcaldata, podout], + TopAlg=[podin, imcaldigi, imcalreco, imcaldata, podout], EvtSel='NONE', EvtMax=kwargs['nev'], ExtSvc=[podev], diff --git a/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py b/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py index 9355b5d9..ea5ac2a1 100644 --- a/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py +++ b/benchmarks/imaging_shower_ML/scripts/prepare_tf_dataset.py @@ -31,7 +31,7 @@ def get_ml_data(path, evnums=None, shape=(20, 20, 3), branch='EcalBarrelHitsML') # execute this script # read mc particles from root file -def get_mcp_simple(path, evnums=None, branch='mcparticles2'): +def get_mcp_simple(path, evnums=None, branch='mcparticles'): f = ROOT.TFile(path) events = f.events if evnums is None: @@ -83,7 +83,7 @@ if __name__ == '__main__': os.makedirs(args.outdir, exist_ok=True) load_root_macros(args.macros) data = get_ml_data(args.file, shape=[int(i.strip()) for i in args.shape.split(',')]) - dfmcp = get_mcp_simple(args.file, branch='mcparticles2') + dfmcp = get_mcp_simple(args.file, branch='mcparticles') # dfmcp = dfmcp[dfmcp['status'] == 24578] dfmcp.loc[:, 'p'] = np.linalg.norm(dfmcp[['px', 'py', 'pz']].values, axis=1) dfmcp['phi'] = np.arctan2(dfmcp['py'].values, dfmcp['px'].values) diff --git a/benchmarks/rich/options/rich_reco.py b/benchmarks/rich/options/rich_reco.py index edf86520..43a3d4bc 100644 --- a/benchmarks/rich/options/rich_reco.py +++ b/benchmarks/rich/options/rich_reco.py @@ -22,15 +22,8 @@ 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]) @@ -42,7 +35,7 @@ out = PodioOutput("out", filename=output_rec_file) out.outputCommands = ["keep *"] ApplicationMgr( - TopAlg = [podioinput, copier, pmtcopier, pmtdigi, pmtreco, richcluster, out], + TopAlg = [podioinput, pmtdigi, pmtreco, richcluster, out], EvtSel = 'NONE', EvtMax = n_events, ExtSvc = [podioevent], diff --git a/benchmarks/track_finding/options/track_reconstruction.py b/benchmarks/track_finding/options/track_reconstruction.py index 0831e95f..1b428cc4 100644 --- a/benchmarks/track_finding/options/track_reconstruction.py +++ b/benchmarks/track_finding/options/track_reconstruction.py @@ -20,9 +20,6 @@ geo_service = GeoSvc("GeoSvc", detectors=["{}/{}.xml".format(detector_path,dete podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING) 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__Base__InputCopier_dd4pod__TrackerHitCollection_dd4pod__TrackerHitCollection_ as TrkCopier from Configurables import Jug__Digi__SiliconTrackerDigi as TrackerDigi @@ -47,17 +44,6 @@ podioinput = PodioInput("PodioReader", collections=["mcparticles","TrackerEndcapHits","TrackerBarrelHits","VertexBarrelHits","VertexEndcapHits","GEMTrackerEndcapHits"]) algorithms.append( podioinput ) -## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. -copier = MCCopier("MCCopier", - inputCollection="mcparticles", - outputCollection="mcparticles2") -algorithms.append( copier ) - -trkcopier = TrkCopier("TrkCopier", - inputCollection="TrackerBarrelHits", - outputCollection="TrackerBarrelHits2") -algorithms.append( trkcopier ) - trk_b_digi = TrackerDigi("trk_b_digi", inputHitCollection="TrackerBarrelHits", outputHitCollection="TrackerBarrelRawHits", @@ -188,7 +174,7 @@ out.outputCommands = ["keep *", "drop trajectories", "drop outputSourceLinks", "drop outputInitialTrackParameters", - "drop mcparticles" + "keep mcparticles" ] algorithms.append(out) diff --git a/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx b/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx index 788b9e2a..9b3e5512 100644 --- a/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx +++ b/benchmarks/track_finding/scripts/rec_multiple_tracks.cxx @@ -87,8 +87,8 @@ int rec_multiple_tracks(const char* fname = "topside/rec_multiple_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - auto df0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("nThrown", "thrownParticles.size()") .Define("nProto", "outputProtoTracks.size()") diff --git a/benchmarks/track_fitting/options/track_reconstruction.py b/benchmarks/track_fitting/options/track_reconstruction.py index b46c8804..fa6613a1 100644 --- a/benchmarks/track_fitting/options/track_reconstruction.py +++ b/benchmarks/track_fitting/options/track_reconstruction.py @@ -20,9 +20,6 @@ geo_service = GeoSvc("GeoSvc", detectors=["{}/{}.xml".format(detector_path,dete podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING) 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__Base__InputCopier_dd4pod__TrackerHitCollection_dd4pod__TrackerHitCollection_ as TrkCopier from Configurables import Jug__Digi__SiliconTrackerDigi as TrackerDigi @@ -47,17 +44,6 @@ podioinput = PodioInput("PodioReader", collections=["mcparticles","TrackerEndcapHits","TrackerBarrelHits","VertexBarrelHits","VertexEndcapHits","GEMTrackerEndcapHits"])#, OutputLevel=DEBUG) algorithms.append( podioinput ) -## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. -copier = MCCopier("MCCopier", - inputCollection="mcparticles", - outputCollection="mcparticles2") -algorithms.append( copier ) - -trkcopier = TrkCopier("TrkCopier", - inputCollection="TrackerBarrelHits", - outputCollection="TrackerBarrelHits2") -algorithms.append( trkcopier ) - trk_b_digi = TrackerDigi("trk_b_digi", inputHitCollection="TrackerBarrelHits", outputHitCollection="TrackerBarrelRawHits", @@ -180,7 +166,7 @@ out.outputCommands = ["keep *", "drop trajectories", "drop outputSourceLinks", "drop outputInitialTrackParameters", - "drop mcparticles" + "keep mcparticles" ] algorithms.append(out) diff --git a/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx b/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx index 02bd77de..ada976a3 100644 --- a/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx +++ b/benchmarks/track_fitting/scripts/rec_multiple_tracks.cxx @@ -84,8 +84,8 @@ int rec_multiple_tracks(const char* fname = "topside/rec_multiple_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - auto df0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("p_thrown", momentum, {"thrownP"}) .Define("theta_thrown", theta, {"thrownP"}) diff --git a/benchmarks/track_fitting/scripts/rec_single_tracks.cxx b/benchmarks/track_fitting/scripts/rec_single_tracks.cxx index 20c42392..9aad6734 100644 --- a/benchmarks/track_fitting/scripts/rec_single_tracks.cxx +++ b/benchmarks/track_fitting/scripts/rec_single_tracks.cxx @@ -87,8 +87,8 @@ int rec_single_tracks(const char* fname = "topside/rec_single_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - auto df0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("p_thrown", momentum, {"thrownP"}) .Define("theta_thrown", theta, {"thrownP"}) diff --git a/benchmarks/tracking/central_electrons.sh b/benchmarks/tracking/central_electrons.sh index 0a278d96..1c0fe1ba 100644 --- a/benchmarks/tracking/central_electrons.sh +++ b/benchmarks/tracking/central_electrons.sh @@ -97,7 +97,7 @@ rootls -t ${JUGGLER_SIM_FILE} if [[ -z "${ANALYSIS_ONLY}" ]] ; then # Need to figure out how to pass file name to juggler from the commandline - xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv gaudirun.py benchmarks/tracking/options/track_reconstruction.py + gaudirun.py benchmarks/tracking/options/track_reconstruction.py if [[ "$?" -ne "0" ]] ; then echo "ERROR running juggler" exit 1 diff --git a/benchmarks/tracking/options/track_reconstruction.py b/benchmarks/tracking/options/track_reconstruction.py index 764659b7..27430cf3 100644 --- a/benchmarks/tracking/options/track_reconstruction.py +++ b/benchmarks/tracking/options/track_reconstruction.py @@ -20,9 +20,6 @@ geo_service = GeoSvc("GeoSvc", detectors=["{}/{}.xml".format(detector_path,dete podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING) 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__Base__InputCopier_dd4pod__TrackerHitCollection_dd4pod__TrackerHitCollection_ as TrkCopier from Configurables import Jug__Digi__SiliconTrackerDigi as TrackerDigi @@ -47,17 +44,6 @@ podioinput = PodioInput("PodioReader", collections=["mcparticles","TrackerEndcapHits","TrackerBarrelHits","VertexBarrelHits","VertexEndcapHits","GEMTrackerEndcapHits"])#, OutputLevel=DEBUG) algorithms.append( podioinput ) -## copiers to get around input --> output copy bug. Note the "2" appended to the output collection. -copier = MCCopier("MCCopier", - inputCollection="mcparticles", - outputCollection="mcparticles2") -algorithms.append( copier ) - -trkcopier = TrkCopier("TrkCopier", - inputCollection="TrackerBarrelHits", - outputCollection="TrackerBarrelHits2") -algorithms.append( trkcopier ) - trk_b_digi = TrackerDigi("trk_b_digi", inputHitCollection="TrackerBarrelHits", outputHitCollection="TrackerBarrelRawHits", @@ -186,7 +172,7 @@ out.outputCommands = ["keep *", "drop trajectories", "drop outputSourceLinks", "drop outputInitialTrackParameters", - "drop mcparticles" + "keep mcparticles" ] algorithms.append(out) diff --git a/benchmarks/tracking/run_tracking_benchmarks.py b/benchmarks/tracking/run_tracking_benchmarks.py index cc65ad63..f474dada 100755 --- a/benchmarks/tracking/run_tracking_benchmarks.py +++ b/benchmarks/tracking/run_tracking_benchmarks.py @@ -80,9 +80,7 @@ if 'rec' in procs: os.environ['JUGGLER_COMPACT_PATH'] = args.compact os.environ['JUGGLER_N_EVENTS'] = '{}'.format(args.nev) - juggler_xenv = os.path.join(os.environ.get('JUGGLER_INSTALL_PREFIX', '../local'), 'Juggler.xenv') - - rec_cmd = ['xenv', '-x', juggler_xenv, 'gaudirun.py', os.path.join(sdir, 'options', option_script)] + rec_cmd = ['gaudirun.py', os.path.join(sdir, 'options', option_script)] return_code = subprocess.run(rec_cmd).returncode if return_code is not None and return_code != 0: print('ERROR running juggler ({})!'.format(opt)) @@ -93,7 +91,7 @@ if 'rec' in procs: if 'ana' in procs: os.makedirs('results', exist_ok=True) ana_cmd = ['python', analysis_script, rec_file, - '--mc-collection', 'mcparticles2', + '--mc-collection', 'mcparticles', '--tracking-collection', 'outputTrackParameters', '-o', 'results', '-t', args.nametag] return_code = subprocess.run(ana_cmd).returncode diff --git a/benchmarks/tracking/scripts/rec_central_electrons.cxx b/benchmarks/tracking/scripts/rec_central_electrons.cxx index 9bb12315..8c3708f1 100644 --- a/benchmarks/tracking/scripts/rec_central_electrons.cxx +++ b/benchmarks/tracking/scripts/rec_central_electrons.cxx @@ -84,8 +84,8 @@ int rec_central_electrons(const char* fname = "topside/rec_central_electrons.roo ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - auto df0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("p_thrown", momentum, {"thrownP"}) .Define("theta_thrown", theta, {"thrownP"}) diff --git a/benchmarks/tracking/scripts/rec_central_pions.cxx b/benchmarks/tracking/scripts/rec_central_pions.cxx index f761b66f..516ecb2b 100644 --- a/benchmarks/tracking/scripts/rec_central_pions.cxx +++ b/benchmarks/tracking/scripts/rec_central_pions.cxx @@ -84,8 +84,8 @@ int rec_central_pions(const char* fname = "topside/rec_central_pions.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - auto df0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("p_thrown", momentum, {"thrownP"}) .Define("theta_thrown", theta, {"thrownP"}) diff --git a/benchmarks/tracking/scripts/rec_multiple_tracks.cxx b/benchmarks/tracking/scripts/rec_multiple_tracks.cxx index 02bd77de..ada976a3 100644 --- a/benchmarks/tracking/scripts/rec_multiple_tracks.cxx +++ b/benchmarks/tracking/scripts/rec_multiple_tracks.cxx @@ -84,8 +84,8 @@ int rec_multiple_tracks(const char* fname = "topside/rec_multiple_tracks.root") ROOT::EnableImplicitMT(); ROOT::RDataFrame df("events", fname); - auto df0 = df.Define("isThrown", "mcparticles2.genStatus == 1") - .Define("thrownParticles", "mcparticles2[isThrown]") + auto df0 = df.Define("isThrown", "mcparticles.genStatus == 1") + .Define("thrownParticles", "mcparticles[isThrown]") .Define("thrownP", fourvec, {"thrownParticles"}) .Define("p_thrown", momentum, {"thrownP"}) .Define("theta_thrown", theta, {"thrownP"}) diff --git a/benchmarks/tracking/scripts/tracking_performance.py b/benchmarks/tracking/scripts/tracking_performance.py index 58256fb1..66f6d73b 100644 --- a/benchmarks/tracking/scripts/tracking_performance.py +++ b/benchmarks/tracking/scripts/tracking_performance.py @@ -47,7 +47,7 @@ def flatten_collection(rdf, collection, cols=None): dfp.loc[:, 'event'] = evns return dfp -def thrown_particles_figure(rdf, save, mcbranch="mcparticles2"): +def thrown_particles_figure(rdf, save, mcbranch="mcparticles"): # define truth particle info dft = flatten_collection(rdf, mcbranch, ['genStatus', 'pdgID', 'ps.x', 'ps.y', 'ps.z', 'mass']) dft.rename(columns={c: c.replace(mcbranch + '.', '') for c in dft.columns}, inplace=True) -- GitLab