Skip to content
Snippets Groups Projects

modify clustering to use the latest components

Merged Chao Peng requested to merge update_clustering into master
4 files
+ 178
139
Compare changes
  • Side-by-side
  • Inline
Files
4
from Gaudi.Configuration import *
import os
import ROOT
from GaudiKernel.DataObjectHandleBase import DataObjectHandleBase
from Configurables import ApplicationMgr, EICDataSvc, PodioInput, PodioOutput, GeoSvc
from GaudiKernel.SystemOfUnits import MeV, GeV, cm
detector_name = str(os.environ.get("JUGGLER_DETECTOR", "athena"))
detector_path = str(os.environ.get("DETECTOR_PATH", "."))
compact_path = os.path.join(detector_path, detector_name)
# get sampling fractions from system environment variable, 1.0 by default
cb_ecal_sf = float(os.environ.get("CB_EMCAL_SAMP_FRAC", 1.0))
cb_hcal_sf = float(os.environ.get("CB_HCAL_SAMP_FRAC", 1.0))
# 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"])
n_events = int(os.environ["JUGGLER_N_EVENTS"])
# geometry service
geo_service = GeoSvc("GeoSvc", detectors=["{}.xml".format(detector_name)])
# data service
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
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__ClusterRecoCoG as RecoCoG
from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco
# branches needed from simulation root file
sim_coll = [
"mcparticles",
"CrystalEcalHits",
"EcalBarrelHits",
"HcalBarrelHits",
]
# input and output
podin = PodioInput("PodioReader", collections=sim_coll)
podout = PodioOutput("out", filename=output_rec_file)
# 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
ce_ecal_digi = CalHitDigi("ce_ecal_digi",
inputHitCollection="CrystalEcalHits",
outputHitCollection="CrystalEcalHitsDigi",
energyResolutions=[0., 0.02, 0.],
dynamicRangeADC=5.*GeV, # digi settings must match with reco
capacityADC=32768,
pedestalMean=400,
pedestalSigma=3)
ce_ecal_reco = CalHitReco("ce_ecal_reco",
inputHitCollection="CrystalEcalHitsDigi",
outputHitCollection="CrystalEcalHitsReco",
dynamicRangeADC=5.*GeV,
capacityADC=32768,
pedestalMean=400,
pedestalSigma=3,
thresholdFactor=4, # 4 sigma
minimumHitEdep=1.0*MeV) # discard low energy hits
ce_ecal_cl = IslandCluster("ce_ecal_cl",
# OutputLevel=DEBUG,
inputHitCollection="CrystalEcalHitsReco",
outputClusterCollection="CrystalEcalClusters",
splitCluster=False,
minClusterCenterEdep=30*units.MeV,
groupRanges=[2.2*cm, 2.2*cm])
ce_ecal_clreco = RecoCoG("ce_ecal_clreco",
clusterCollection="CrystalEcalClusters",
logWeightBase=4.6)
# central barrel Ecal
cb_ecal_digi = CalHitDigi("cb_ecal_digi",
inputHitCollection="EcalBarrelHits",
outputHitCollection="EcalBarrelHitsDigi",
energyResolutions=[0., 0.02, 0.], # 2% flat resolution
dynamicRangeADC=3*MeV,
capacityADC=8192,
pedestalMean=400,
pedestalSigma=20) # about 6 keV
cb_ecal_reco = ImaCalPixelReco("cb_ecal_reco",
inputHitCollection="EcalBarrelHitsDigi",
outputHitCollection="EcalBarrelHitsReco",
dynamicRangeADC=3.*MeV,
capacityADC=8192,
pedestalMean=400,
pedestalSigma=20,
thresholdFactor=3, # about 20 keV
readoutClass="EcalBarrelHits", # readout class
layerField="layer", # field to get layer id
sectorField="module") # field to get sector id
cb_ecal_cl = ImagingCluster("cb_ecal_cl",
inputHitCollection="EcalBarrelHitsReco",
outputClusterCollection="EcalBarrelClusters",
localRanges=[2.*units.mm, 2*units.mm], # same layer
adjLayerRanges=[10*units.mrad, 10*units.mrad], # adjacent layer
adjLayerDiff=2, # id diff for adjacent layer
adjSectorDist=3.*units.cm) # different sector
cb_ecal_clreco = ImagingClusterReco("cb_ecal_clreco",
inputClusterCollection="EcalBarrelClusters",
outputLayerCollection="EcalBarrelLayers")
# central barrel hcal
cb_hcal_digi = CalHitDigi("cb_hcal_digi",
inputHitCollection="HcalBarrelHits",
outputHitCollection="HcalBarrelHitsDigi",
dynamicRangeADC=50.*MeV,
capacityADC=32768,
pedestalMean=400,
pedestalSigma=10)
cb_hcal_reco = CalHitReco("cb_hcal_reco",
inputHitCollection="HcalBarrelHitsDigi",
outputHitCollection="HcalBarrelHitsReco",
dynamicRangeADC=50.*MeV,
capacityADC=32768,
pedestalMean=400,
pedestalSigma=10,
thresholdFactor=5.0)
# merge hits in different layer (projection to local x-y plane)
cb_hcal_merger = CalHitsMerger("cb_hcal_merger",
fields=["layer", "slice"],
fieldRefNumbers=[1, 0],
inputHitCollection="HcalBarrelHitsReco",
outputHitCollection="HcalBarrelHitsRecoXY")
cb_hcal_cl = IslandCluster("cb_hcal_cl",
inputHitCollection="HcalBarrelHitsRecoXY",
outputClusterCollection="HcalBarrelClusters",
splitCluster=False,
minClusterCenterEdep=30.*MeV,
groupRanges=[15.*cm, 15.*cm],
OutputLevel=DEBUG)
cb_hcal_clreco = RecoCoG("cb_hcal_clreco",
clusterCollection="HcalBarrelClusters",
logWeightBase=6.2,
samplingFraction=cb_hcal_sf,
OutputLevel=DEBUG)
out.outputCommands = ["keep *"]
ApplicationMgr(
TopAlg = [podioinput, copier,
ce_ecal_digi, ce_ecal_reco, ce_ecal_cl, ce_ecal_clreco,
cb_ecal_digi, cb_ecal_reco, cb_ecal_cl, cb_ecal_clreco,
cb_hcal_digi, cb_hcal_reco, cb_hcal_cl, cb_hcal_clreco,
out],
EvtSel = 'NONE',
EvtMax = n_events,
ExtSvc = [podioevent],
OutputLevel=DEBUG
)
Loading