diff --git a/benchmarks/clustering/options/full_cal_reco.py b/benchmarks/clustering/options/full_cal_reco.py index 99370ba90a8d1d23878e152cc8a11dd8a0af400e..e2d29aedcf943b8d2b724a63cf9c0b3696265974 100644 --- a/benchmarks/clustering/options/full_cal_reco.py +++ b/benchmarks/clustering/options/full_cal_reco.py @@ -9,11 +9,19 @@ import ROOT from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, GeoSvc from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad -detector_name = str(os.environ.get("JUGGLER_DETECTOR_CONFIG", "athena")) +detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) +detector_config = str(os.environ.get("JUGGLER_DETECTOR_CONFIG", detector_name)) detector_version = str(os.environ.get("JUGGLER_DETECTOR_VERSION", "master")) detector_path = str(os.environ.get("DETECTOR_PATH", ".")) -compact_path = os.path.join(detector_path, detector_name) +compact_path = os.path.join(detector_path, detector_config) + +# Detector features that affect reconstruction +has_ecal_barrel_scfi = False +if 'athena' in detector_name: + has_ecal_barrel_scfi = True +if 'ecce' in detector_name and 'imaging' in detector_config: + has_ecal_barrel_scfi = True # input arguments from calibration file with open(f'{detector_path}/calibrations/emcal_barrel_calibration.json') as f: @@ -36,7 +44,7 @@ output_rec = str(os.environ["JUGGLER_REC_FILE"]) n_events = int(os.environ["JUGGLER_N_EVENTS"]) # geometry service -geo_service = GeoSvc("GeoSvc", detectors=["{}.xml".format(compact_path)], OutputLevel=INFO) +geo_service = GeoSvc("GeoSvc", detectors=["{}.xml".format(compact_path)], OutputLevel=WARNING) # data service podioevent = EICDataSvc("EventDataSvc", inputs=input_sims) @@ -56,12 +64,12 @@ from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco # branches needed from simulation root file sim_coll = [ "MCParticles", + "EcalBarrelHits", + "EcalBarrelHitsContributions", "EcalEndcapNHits", "EcalEndcapNHitsContributions", "EcalEndcapPHits", "EcalEndcapPHitsContributions", - "EcalBarrelHits", - "EcalBarrelHitsContributions", "HcalBarrelHits", "HcalBarrelHitsContributions", "HcalEndcapPHits", @@ -70,7 +78,7 @@ sim_coll = [ "HcalEndcapNHitsContributions", ] -if 'athena' in detector_name: +if has_ecal_barrel_scfi: sim_coll += [ "EcalBarrelScFiHits", "EcalBarrelScFiHitsContributions", @@ -173,7 +181,7 @@ ci_ecal_clreco = RecoCoG("ci_ecal_clreco", algs.append(ci_ecal_clreco) # Central Barrel Ecal -if 'athena' in detector_name: +if has_ecal_barrel_scfi: # Imaging calorimeter cb_ecal_daq = dict( dynamicRangeADC=3*MeV, diff --git a/benchmarks/ecal/options/barrel.py b/benchmarks/ecal/options/barrel.py index 18d34a5144aad815764376fa70374fd5bcf8b783..149dfb6d64ef568d3db5c2f9acf1bfebd82cb2fa 100644 --- a/benchmarks/ecal/options/barrel.py +++ b/benchmarks/ecal/options/barrel.py @@ -9,10 +9,19 @@ import ROOT from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, GeoSvc from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad -detector_name = str(os.environ.get("JUGGLER_DETECTOR_CONFIG", "athena")) +detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) +detector_config = str(os.environ.get("JUGGLER_DETECTOR_CONFIG", detector_name)) +detector_version = str(os.environ.get("JUGGLER_DETECTOR_VERSION", "master")) detector_path = str(os.environ.get("DETECTOR_PATH", ".")) compact_path = str(os.environ.get("JUGGLER_COMPACT_PATH", "{}.xml".format(os.path.join(detector_path, detector_name)))) +# Detector features that affect reconstruction +has_ecal_barrel_scfi = False +if 'athena' in detector_name: + has_ecal_barrel_scfi = True +if 'ecce' in detector_name and 'imaging' in detector_config: + has_ecal_barrel_scfi = True + # input and output input_sims = [f.strip() for f in str.split(os.environ["JUGGLER_SIM_FILE"], ",") if f.strip()] output_rec = str(os.environ["JUGGLER_REC_FILE"]) @@ -32,6 +41,9 @@ podioevent = EICDataSvc("EventDataSvc", inputs=input_sims) # juggler components from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi +from Configurables import Jug__Reco__CalorimeterHitReco as CalHitReco +from Configurables import Jug__Reco__CalorimeterHitsMerger as CalHitsMerger +from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster from Configurables import Jug__Reco__ImagingPixelReco as ImCalPixelReco from Configurables import Jug__Reco__ImagingTopoCluster as ImagingCluster from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco @@ -43,25 +55,31 @@ sim_coll = [ "EcalBarrelHitsContributions", ] +algorithms = [] + # input and output podin = PodioInput("PodioReader", collections=sim_coll) +algorithms.append(podin) podout = PodioOutput("out", filename=output_rec) +algorithms.append(podout) - -# Central Barrel Ecal (Imaging Cal.) -cb_ecal_daq = dict( +# Central Barrel Ecal +if has_ecal_barrel_scfi: + # Central Barrel Ecal (Imaging Cal.) + cb_ecal_daq = dict( dynamicRangeADC=3*MeV, capacityADC=8192, pedestalMean=400, pedestalSigma=20) # about 6 keV -cb_ecal_digi = CalHitDigi("cb_ecal_digi", + cb_ecal_digi = CalHitDigi("cb_ecal_digi", inputHitCollection="EcalBarrelHits", outputHitCollection="EcalBarrelImagingHitsDigi", energyResolutions=[0., 0.02, 0.], # 2% flat resolution **cb_ecal_daq) + algorithms.append(cb_ecal_digi) -cb_ecal_reco = ImCalPixelReco("cb_ecal_reco", + cb_ecal_reco = ImCalPixelReco("cb_ecal_reco", inputHitCollection=cb_ecal_digi.outputHitCollection, outputHitCollection="EcalBarrelImagingHitsReco", samplingFraction=cb_ecal_sf, @@ -70,20 +88,64 @@ cb_ecal_reco = ImCalPixelReco("cb_ecal_reco", layerField="layer", # field to get layer id sectorField="module", # field to get sector id **cb_ecal_daq) + algorithms.append(cb_ecal_reco) -cb_ecal_cl = ImagingCluster("cb_ecal_cl", + cb_ecal_cl = ImagingCluster("cb_ecal_cl", inputHitCollection=cb_ecal_reco.outputHitCollection, outputProtoClusterCollection="EcalBarrelImagingProtoClusters", localDistXY=[2.*mm, 2*mm], # same layer layerDistEtaPhi=[10*mrad, 10*mrad], # adjacent layer neighbourLayersRange=2, # id diff for adjacent layer sectorDist=3.*cm) # different sector + algorithms.append(cb_ecal_cl) -cb_ecal_clreco = ImagingClusterReco("cb_ecal_clreco", + cb_ecal_clreco = ImagingClusterReco("cb_ecal_clreco", inputProtoClusters=cb_ecal_cl.outputProtoClusterCollection, outputClusters="EcalBarrelImagingClusters", outputLayers="EcalBarrelImagingLayers", mcHits="EcalBarrelHits") + algorithms.append(cb_ecal_clreco) + +else: + # SciGlass calorimeter + sciglass_ecal_daq = dict( + dynamicRangeADC=5.*GeV, + capacityADC=32768, + pedestalMean=400, + pedestalSigma=3) + + sciglass_ecal_digi = CalHitDigi("sciglass_ecal_digi", + inputHitCollection="EcalBarrelHits", + outputHitCollection="EcalBarrelHitsDigi", + energyResolutions=[0., 0.02, 0.], # 2% flat resolution + **sciglass_ecal_daq) + algorithms.append(sciglass_ecal_digi) + + sciglass_ecal_reco = CalHitReco("sciglass_ecal_reco", + inputHitCollection=sciglass_ecal_digi.outputHitCollection, + outputHitCollection="EcalBarrelHitsReco", + thresholdFactor=3, # about 20 keV + readoutClass="EcalBarrelHits", # readout class + sectorField="sector", # field to get sector id + samplingFraction=0.998, # this accounts for a small fraction of leakage + **sciglass_ecal_daq) + algorithms.append(sciglass_ecal_reco) + + sciglass_ecal_cl = IslandCluster("sciglass_ecal_cl", + inputHitCollection=sciglass_ecal_reco.outputHitCollection, + outputProtoClusterCollection="EcalBarrelProtoClusters", + splitCluster=False, + minClusterHitEdep=1.0*MeV, # discard low energy hits + minClusterCenterEdep=30*MeV, + sectorDist=5.0*cm) + algorithms.append(sciglass_ecal_cl) + + sciglass_ecal_clreco = ImagingClusterReco("sciglass_ecal_clreco", + inputProtoClusters=sciglass_ecal_cl.outputProtoClusterCollection, + mcHits="EcalBarrelHits", + outputClusters="EcalBarrelClusters", + outputLayers="EcalBarrelLayers") + algorithms.append(sciglass_ecal_clreco) podout.outputCommands = ['drop *', 'keep MCParticles', @@ -92,9 +154,7 @@ podout.outputCommands = ['drop *', 'keep *Cluster*'] ApplicationMgr( - TopAlg = [podin, - cb_ecal_digi, cb_ecal_reco, cb_ecal_cl, cb_ecal_clreco, - podout], + TopAlg = algorithms, EvtSel = 'NONE', EvtMax = n_events, ExtSvc = [podioevent], diff --git a/benchmarks/imaging_ecal/config.yml b/benchmarks/imaging_ecal/config.yml index 44e321a0f21bd5c890423d3958fd83125bf2c41c..1688f2e6ff748f9d25be1b4a45aa79b633837824 100644 --- a/benchmarks/imaging_ecal/config.yml +++ b/benchmarks/imaging_ecal/config.yml @@ -44,5 +44,8 @@ imaging_ecal_pion_rejection:bench: script: - ls -lhtR - compile_analyses.py imaging_ecal - - root -b -q benchmarks/imaging_ecal/analysis/emcal_barrel_pion_rejection_analysis.cxx+ - #- bash run_pion_rej_analysis.sh + - | + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + root -b -q benchmarks/imaging_ecal/analysis/emcal_barrel_pion_rejection_analysis.cxx+ + fi diff --git a/benchmarks/imaging_ecal/options/hybrid_cluster.py b/benchmarks/imaging_ecal/options/hybrid_cluster.py index 96e0de7487062de36fc58a05c78e062f07bf65b9..731c33d387ae3cc7f85866b8d152e9272b6ee561 100644 --- a/benchmarks/imaging_ecal/options/hybrid_cluster.py +++ b/benchmarks/imaging_ecal/options/hybrid_cluster.py @@ -2,7 +2,7 @@ import json import os import ROOT from Gaudi.Configuration import * -from GaudiKernel.SystemOfUnits import MeV, mm, cm, mrad, rad, ns +from GaudiKernel.SystemOfUnits import GeV, MeV, mm, cm, mrad, rad, ns from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc from Configurables import PodioInput @@ -15,8 +15,19 @@ from Configurables import Jug__Reco__ImagingPixelReco as ImagingPixelReco from Configurables import Jug__Reco__ImagingTopoCluster as ImagingTopoCluster from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco +detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) +detector_config = str(os.environ.get("JUGGLER_DETECTOR_CONFIG", detector_name)) +detector_version = str(os.environ.get("JUGGLER_DETECTOR_VERSION", "master")) + detector_path = str(os.environ.get("DETECTOR_PATH", ".")) +# Detector features that affect reconstruction +has_ecal_barrel_scfi = False +if 'athena' in detector_name: + has_ecal_barrel_scfi = True +if 'ecce' in detector_name and 'imaging' in detector_config: + has_ecal_barrel_scfi = True + # input arguments from calibration file with open(f'{detector_path}/calibrations/emcal_barrel_calibration.json') as f: calib_data = json.load(f)['electron'] @@ -49,27 +60,41 @@ sim_colls = [ 'MCParticles', 'EcalBarrelHits', 'EcalBarrelHitsContributions', +] +ecal_barrel_scfi_collections = [ 'EcalBarrelScFiHits', - 'EcalBarrelScFiHitsContributions', + 'EcalBarrelScFiHitsContributions' ] +if has_ecal_barrel_scfi: + sim_colls += ecal_barrel_scfi_collections + +# list of algorithms +algorithms = [] + podin = PodioInput('PodioReader', collections=sim_colls, OutputLevel=DEBUG) -podout = PodioOutput('podout', filename=kwargs['output']) +algorithms.append(podin) + + +# Central Barrel Ecal +if has_ecal_barrel_scfi: + # Central ECAL Imaging Calorimeter -# use the same daq_setting for digi/reco pair -imcaldaq = dict( + # use the same daq_setting for digi/reco pair + imcaldaq = dict( dynamicRangeADC=3*MeV, capacityADC=32767, pedestalMean=400, pedestalSigma=50) # 50/32767*3 MeV ~ 5 keV - -imcaldigi = CalHitDigi('imcal_digi', + imcaldigi = CalHitDigi('imcal_digi', OutputLevel=DEBUG, inputHitCollection='EcalBarrelHits', outputHitCollection='DigiEcalBarrelImagingHits', energyResolutions=[0., 0.02, 0.], **imcaldaq) -imcalreco = ImagingPixelReco('imcal_reco', + algorithms.append(imcaldigi) + + imcalreco = ImagingPixelReco('imcal_reco', #OutputLevel=DEBUG, inputHitCollection=imcaldigi.outputHitCollection, outputHitCollection='RecoEcalBarrelImagingHits', @@ -78,8 +103,9 @@ imcalreco = ImagingPixelReco('imcal_reco', sectorField='module', samplingFraction=kwargs['img_sf'], **imcaldaq) + algorithms.append(imcalreco) -imcalcluster = ImagingTopoCluster('imcal_cluster', + imcalcluster = ImagingTopoCluster('imcal_cluster', #OutputLevel=DEBUG, inputHitCollection=imcalreco.outputHitCollection, outputProtoClusterCollection='EcalBarrelImagingProtoClusters', @@ -88,26 +114,30 @@ imcalcluster = ImagingTopoCluster('imcal_cluster', neighbourLayersRange=2, minClusterEdep= 0.5*MeV/kwargs['img_sf'], sectorDist=3.*cm) -clusterreco = ImagingClusterReco('imcal_clreco', + algorithms.append(imcalcluster) + + clusterreco = ImagingClusterReco('imcal_clreco', #OutputLevel=DEBUG, inputProtoClusters=imcalcluster.outputProtoClusterCollection, outputLayers='EcalBarrelImagingClustersLayers', outputClusters='EcalBarrelImagingClusters', mcHits="EcalBarrelHits") + algorithms.append(clusterreco) -# scfi layers -scfi_barrel_daq = dict( + # scfi layers + scfi_barrel_daq = dict( dynamicRangeADC=50.*MeV, capacityADC=32768, pedestalMean=400, pedestalSigma=10) -scfi_barrel_digi = CalHitDigi("scfi_barrel_digi", + scfi_barrel_digi = CalHitDigi("scfi_barrel_digi", inputHitCollection="EcalBarrelScFiHits", outputHitCollection="EcalBarrelScFiHitsDigi", **scfi_barrel_daq) + algorithms.append(scfi_barrel_digi) -scfi_barrel_reco = CalHitReco("scfi_barrel_reco", + scfi_barrel_reco = CalHitReco("scfi_barrel_reco", inputHitCollection=scfi_barrel_digi.outputHitCollection, outputHitCollection="EcalBarrelScFiHitsReco", thresholdFactor=5.0, @@ -117,17 +147,19 @@ scfi_barrel_reco = CalHitReco("scfi_barrel_reco", localDetFields=["system", "module"], # use local coordinates in each module (stave) samplingFraction=kwargs['scfi_sf'], **scfi_barrel_daq) + algorithms.append(scfi_barrel_reco) -# merge hits in different layer (projection to local x-y plane) -scfi_barrel_merger = CalHitsMerger("scfi_barrel_merger", + # merge hits in different layer (projection to local x-y plane) + scfi_barrel_merger = CalHitsMerger("scfi_barrel_merger", #OutputLevel=DEBUG, inputHitCollection=scfi_barrel_reco.outputHitCollection, outputHitCollection="EcalBarrelScFiGridReco", fields=["fiber"], fieldRefNumbers=[1], readoutClass="EcalBarrelScFiHits") + algorithms.append(scfi_barrel_merger) -scfi_barrel_cl = IslandCluster("scfi_barrel_cl", + scfi_barrel_cl = IslandCluster("scfi_barrel_cl", #OutputLevel=DEBUG, inputHitCollection=scfi_barrel_merger.outputHitCollection, outputProtoClusterCollection="EcalBarrelScFiProtoClusters", @@ -135,14 +167,59 @@ scfi_barrel_cl = IslandCluster("scfi_barrel_cl", minClusterCenterEdep=10.*MeV, localDistXZ=[30*mm, 30*mm], sectorDist=5.*cm) + algorithms.append(scfi_barrel_cl) + + scfi_barrel_clreco = RecoCoG("scfi_barrel_clreco", + inputProtoClusterCollection=scfi_barrel_cl.outputProtoClusterCollection, + outputClusterCollection="EcalBarrelScFiClusters", + logWeightBase=6.2) + algorithms.append(scfi_barrel_clreco) + +else: + # SciGlass calorimeter + sciglass_ecal_daq = dict( + dynamicRangeADC=5.*GeV, + capacityADC=32768, + pedestalMean=400, + pedestalSigma=3) + + sciglass_ecal_digi = CalHitDigi("sciglass_ecal_digi", + inputHitCollection="EcalBarrelHits", + outputHitCollection="EcalBarrelHitsDigi", + energyResolutions=[0., 0.02, 0.], # 2% flat resolution + **sciglass_ecal_daq) + algorithms.append(sciglass_ecal_digi) + + sciglass_ecal_reco = CalHitReco("sciglass_ecal_reco", + inputHitCollection=sciglass_ecal_digi.outputHitCollection, + outputHitCollection="EcalBarrelHitsReco", + thresholdFactor=3, # about 20 keV + readoutClass="EcalBarrelHits", # readout class + sectorField="sector", # field to get sector id + samplingFraction=0.998, # this accounts for a small fraction of leakage + **sciglass_ecal_daq) + algorithms.append(sciglass_ecal_reco) + + sciglass_ecal_cl = IslandCluster("sciglass_ecal_cl", + inputHitCollection=sciglass_ecal_reco.outputHitCollection, + outputProtoClusterCollection="EcalBarrelProtoClusters", + splitCluster=False, + minClusterHitEdep=1.0*MeV, # discard low energy hits + minClusterCenterEdep=30*MeV, + sectorDist=5.0*cm) + algorithms.append(sciglass_ecal_cl) + + sciglass_ecal_clreco = ImagingClusterReco("sciglass_ecal_clreco", + inputProtoClusters=sciglass_ecal_cl.outputProtoClusterCollection, + mcHits="EcalBarrelHits", + outputClusters="EcalBarrelClusters", + outputLayers="EcalBarrelLayers") + algorithms.append(sciglass_ecal_clreco) -scfi_barrel_clreco = RecoCoG("scfi_barrel_clreco", - inputProtoClusterCollection=scfi_barrel_cl.outputProtoClusterCollection, - outputClusterCollection="EcalBarrelScFiClusters", - logWeightBase=6.2) # TODO: merge two types of clusters +podout = PodioOutput('podout', filename=kwargs['output']) podout.outputCommands = ['drop *', 'keep MCParticles', 'keep *Reco*', @@ -150,12 +227,10 @@ podout.outputCommands = ['drop *', 'keep *Cluster*', 'keep *Layer*', ] +algorithms.append(podout) ApplicationMgr( - TopAlg=[podin, - imcaldigi, imcalreco, imcalcluster, clusterreco, - scfi_barrel_digi, scfi_barrel_reco, scfi_barrel_merger, scfi_barrel_cl, scfi_barrel_clreco, - podout], + TopAlg=algorithms, EvtSel='NONE', EvtMax=kwargs['nev'], ExtSvc=[podioevent], diff --git a/benchmarks/imaging_ecal/options/scfi_cluster.py b/benchmarks/imaging_ecal/options/scfi_cluster.py index bb55aba30a55e2090c825d7d1eaff0d89010fd79..802cf6b43043df8e405c48e63ec3cb2f365b58ce 100644 --- a/benchmarks/imaging_ecal/options/scfi_cluster.py +++ b/benchmarks/imaging_ecal/options/scfi_cluster.py @@ -12,8 +12,19 @@ from Configurables import Jug__Reco__CalorimeterHitsMerger as CalHitsMerger from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG +detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena")) +detector_config = str(os.environ.get("JUGGLER_DETECTOR_CONFIG", detector_name)) +detector_version = str(os.environ.get("JUGGLER_DETECTOR_VERSION", "master")) + detector_path = str(os.environ.get("DETECTOR_PATH", ".")) +# Detector features that affect reconstruction +has_ecal_barrel_scfi = False +if 'athena' in detector_name: + has_ecal_barrel_scfi = True +if 'ecce' in detector_name and 'imaging' in detector_config: + has_ecal_barrel_scfi = True + # input arguments from calibration file with open(f'{detector_path}/calibrations/emcal_barrel_calibration.json') as f: calib_data = json.load(f)['electron'] @@ -38,22 +49,38 @@ sf = float(os.environ.get('CB_EMCAL_SAMP_FRAC', '1.0')) geo_service = GeoSvc("GeoSvc", detectors=kwargs['compact'].split(','), OutputLevel=INFO) podioevent = EICDataSvc("EventDataSvc", inputs=kwargs['input'].split(','), OutputLevel=DEBUG) -podin = PodioInput("PodioReader", collections=["MCParticles", "EcalBarrelScFiHits", "EcalBarrelScFiHitsContributions"], OutputLevel=DEBUG) +sim_coll = [ + "MCParticles", +] +if has_ecal_barrel_scfi: + sim_coll += [ + "EcalBarrelHits", + "EcalBarrelHitsContributions", + ] + +algorithms = [] + +podin = PodioInput("PodioReader", collections=sim_coll, OutputLevel=DEBUG) +algorithms.append(podin) + podout = PodioOutput("out", filename=kwargs['output']) +algorithms.append(podout) -# use the same daq_setting for digi/reco pair -scfi_barrel_daq = dict( +if has_ecal_barrel_scfi: + # use the same daq_setting for digi/reco pair + scfi_barrel_daq = dict( dynamicRangeADC=50.*MeV, capacityADC=32768, pedestalMean=400, pedestalSigma=10) -scfi_barrel_digi = CalHitDigi("scfi_barrel_digi", + scfi_barrel_digi = CalHitDigi("scfi_barrel_digi", inputHitCollection="EcalBarrelScFiHits", outputHitCollection="EcalBarrelScFiHitsDigi", **scfi_barrel_daq) + algorithms.append(scfi_barrel_digi) -scfi_barrel_reco = CalHitReco("scfi_barrel_reco", + scfi_barrel_reco = CalHitReco("scfi_barrel_reco", inputHitCollection=scfi_barrel_digi.outputHitCollection, outputHitCollection="EcalBarrelScFiHitsReco", thresholdFactor=5.0, @@ -62,31 +89,34 @@ scfi_barrel_reco = CalHitReco("scfi_barrel_reco", sectorField="module", localDetFields=["system", "module"], # use local coordinates in each module (stave) **scfi_barrel_daq) + algorithms.append(scfi_barrel_reco) -# merge hits in different layer (projection to local x-y plane) -scfi_barrel_merger = CalHitsMerger("scfi_barrel_merger", + # merge hits in different layer (projection to local x-y plane) + scfi_barrel_merger = CalHitsMerger("scfi_barrel_merger", # OutputLevel=DEBUG, inputHitCollection=scfi_barrel_reco.outputHitCollection, outputHitCollection="EcalBarrelScFiGridReco", fields=["fiber"], fieldRefNumbers=[1], readoutClass="EcalBarrelScFiHits") + algorithms.append(scfi_barrel_merger) -scfi_barrel_cl = IslandCluster("scfi_barrel_cl", + scfi_barrel_cl = IslandCluster("scfi_barrel_cl", # OutputLevel=DEBUG, inputHitCollection=scfi_barrel_reco.outputHitCollection, outputProtoClusterCollection="EcalBarrelScFiProtoClusters", splitCluster=False, minClusterCenterEdep=10.*MeV, localDistXZ=[30*mm, 30*mm]) + algorithms.append(scfi_barrel_cl) -scfi_barrel_clreco = RecoCoG("scfi_barrel_clreco", + scfi_barrel_clreco = RecoCoG("scfi_barrel_clreco", inputProtoClusterCollection=scfi_barrel.outputProtoClusterCollection, outputClusterCollection="EcalBarrelScFiClusters", mcHits="EcalBarrelScFiHits", logWeightBase=6.2, samplingFraction=kwargs['sf']) - + algorithms.append(scfi_barrel_clreco) podout.outputCommands = ["keep *"] diff --git a/benchmarks/imaging_ecal/run_emcal_barrel.sh b/benchmarks/imaging_ecal/run_emcal_barrel.sh index b5126af002f2392e713e7051d6a3d8f29975835e..c89bc7f4c7e880ba1a271de2fbca8a658855adf2 100644 --- a/benchmarks/imaging_ecal/run_emcal_barrel.sh +++ b/benchmarks/imaging_ecal/run_emcal_barrel.sh @@ -127,18 +127,21 @@ for iev in "${ADDR[@]}"; do continue fi - python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \ - ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running analysis script: draw_cluster_layers" - exit 1 - fi - - python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \ - ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running analysis script: draw_cluster" - exit 1 + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \ + ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} + if [[ "$?" -ne "0" ]] ; then + echo "ERROR running analysis script: draw_cluster_layers" + exit 1 + fi + + python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \ + ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} + if [[ "$?" -ne "0" ]] ; then + echo "ERROR running analysis script: draw_cluster" + exit 1 + fi fi done diff --git a/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh b/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh index d2c22c3f9c25de4378c00f35e2f2244c2431f2e0..a4a9c7dc646a5f0ee0d12f21d880b2b90e7777a8 100755 --- a/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh +++ b/benchmarks/imaging_ecal/run_emcal_barrel_pion_rej.sh @@ -128,18 +128,21 @@ for iev in "${ADDR[@]}"; do continue fi - python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \ - ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running analysis script: draw_cluster_layers" - exit 1 - fi - - python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \ - ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} - if [[ "$?" -ne "0" ]] ; then - echo "ERROR running analysis script: draw_cluster" - exit 1 + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \ + ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} + if [[ "$?" -ne "0" ]] ; then + echo "ERROR running analysis script: draw_cluster_layers" + exit 1 + fi + + python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \ + ${CB_EMCAL_REC_FILE} -e ${iev} --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/${particle} + if [[ "$?" -ne "0" ]] ; then + echo "ERROR running analysis script: draw_cluster" + exit 1 + fi fi done diff --git a/benchmarks/imaging_ecal/scripts/utils.py b/benchmarks/imaging_ecal/scripts/utils.py index 25699a1ce8de9f0a5b85d6671cad02e274dc96d3..efdc8424f80ac7d7d8373053378256b23c2dfe97 100644 --- a/benchmarks/imaging_ecal/scripts/utils.py +++ b/benchmarks/imaging_ecal/scripts/utils.py @@ -110,7 +110,7 @@ def get_all_mcp(path, evnums=None, branch='MCParticles'): return pd.DataFrame(data=dbuf[:idb], columns=['event', 'px', 'py', 'pz', 'pid', 'status', 'vex', 'vey', 'vez']) # read hits data from root file -def get_hits_data(path, evnums=None, branch='RecoEcalBarreImaginglHits'): +def get_hits_data(path, evnums=None, branch='RecoEcalBarrelImaginglHits'): f = ROOT.TFile(path) events = f.events if evnums is None: diff --git a/benchmarks/imaging_shower_ML/config.yml b/benchmarks/imaging_shower_ML/config.yml index 9e2314639b75cff68d8404368c09c3aaaa07c849..458a6842b913f9e0c344e9da65a63877d89059a0 100644 --- a/benchmarks/imaging_shower_ML/config.yml +++ b/benchmarks/imaging_shower_ML/config.yml @@ -4,8 +4,11 @@ ml_shower:tagging_epimuphka_100: script: - pwd - ls -l - - python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_epimuphka_100 -n 100 --particles "electron,pion-,muon,photon,kaon-" - --pmin 0.5 --pmax 10 + - | + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_epimuphka_100 -n 100 --particles "electron,pion-,muon,photon,kaon-" --pmin 0.5 --pmax 10 + fi ml_shower:tagging_epimuphka: extends: .rec_benchmark @@ -13,24 +16,33 @@ ml_shower:tagging_epimuphka: stage: benchmarks1 script: - ls -hal - - python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_epimuphka -n 10000 --particles "electron,pion-,muon,photon,kaon-" - --pmin 0.5 --pmax 10 + - | + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_epimuphka -n 10000 --particles "electron,pion-,muon,photon,kaon-" --pmin 0.5 --pmax 10 + fi ml_shower:tagging_e: extends: .rec_benchmark when: manual stage: benchmarks1 script: - - python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_e -n 100 - --particles "electron" --pmin 0.5 --pmax 10 + - | + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_e -n 100 --particles "electron" --pmin 0.5 --pmax 10 + fi ml_shower:tagging_pi: extends: .rec_benchmark when: manual stage: benchmarks1 script: - - python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_pi -n 100 - --particles "pion-" --pmin 0.5 --pmax 10 + - | + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python3 benchmarks/imaging_shower_ML/sim_rec_tag.py -t imcal_pi -n 100 --particles "pion-" --pmin 0.5 --pmax 10 + fi ml_shower:training_100: extends: .rec_benchmark @@ -38,7 +50,11 @@ ml_shower:training_100: needs: ["ml_shower:tagging_epimuphka_100"]#, "ml_shower:tagging_e", "ml_shower:tagging_pi"] script: - python3 -m pip install tensorflow particle - - python3 benchmarks/imaging_shower_ML/scripts/ml_training.py -t imcal_epimuphka_100 --pmin 0.5 --pmax 10 + - | + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python3 benchmarks/imaging_shower_ML/scripts/ml_training.py -t imcal_epimuphka_100 --pmin 0.5 --pmax 10 + fi ml_shower:training: extends: .rec_benchmark @@ -47,7 +63,11 @@ ml_shower:training: needs: ["ml_shower:tagging_epimuphka"]#, "ml_shower:tagging_e", "ml_shower:tagging_pi"] script: - python3 -m pip install tensorflow particle - - python3 benchmarks/imaging_shower_ML/scripts/ml_training.py -t imcal_epimuphka --pmin 0.5 --pmax 10 + - | + if [[ ${JUGGLER_DETECTOR} =~ athena + || ${JUGGLER_DETECTOR} =~ ecce && ${JUGGLER_DETECTOR_CONFIG} =~ imaging ]] ; then + python3 benchmarks/imaging_shower_ML/scripts/ml_training.py -t imcal_epimuphka --pmin 0.5 --pmax 10 + fi ml_shower:test: extends: .rec_benchmark