File indexing completed on 2024-09-27 07:03:47
0001 import os
0002 import ROOT
0003 from Gaudi.Configuration import *
0004 from GaudiKernel import SystemOfUnits as units
0005
0006 from GaudiKernel.DataObjectHandleBase import DataObjectHandleBase
0007 from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
0008
0009 from Configurables import PodioInput
0010 from Configurables import Jug__Base__InputCopier_dd4pod__Geant4ParticleCollection_dd4pod__Geant4ParticleCollection_ as MCCopier
0011 from Configurables import Jug__Base__InputCopier_dd4pod__CalorimeterHitCollection_dd4pod__CalorimeterHitCollection_ as CalCopier
0012 from Configurables import Jug__Digi__CalorimeterHitDigi as CalorimeterHitDigi
0013 from Configurables import Jug__Reco__ImagingPixelReco as ImagingPixelReco
0014 from Configurables import Jug__Reco__ImagingTopoCluster as ImagingTopoCluster
0015 from Configurables import Jug__Reco__ImagingClusterReco as ImagingClusterReco
0016
0017
0018
0019 kwargs = dict()
0020 kwargs['sf'] = float(os.environ.get('CB_EMCAL_SAMP_FRAC', '1.0'))
0021 kwargs['input'] = os.environ.get('CB_EMCAL_SIM_FILE', '../topside/barrel_pion0_5GeV.root')
0022 kwargs['output'] = os.environ.get('CB_EMCAL_REC_FILE', 'barrel_pion0_5GeV_cluster.root')
0023 kwargs['compact'] = os.environ.get('CB_EMCAL_COMPACT_PATH', '../topside/test.xml')
0024 kwargs['nev'] = int(os.environ.get('CB_EMCAL_NUMEV', 10000))
0025
0026 if kwargs['nev'] < 1:
0027 f = ROOT.TFile(kwargs['input'])
0028 kwargs['nev'] = f.events.GetEntries()
0029
0030 print(kwargs)
0031
0032
0033 sf = float(os.environ.get('CB_EMCAL_SAMP_FRAC', '1.0'))
0034
0035 geo_service = GeoSvc("GeoSvc", detectors=kwargs['compact'].split(','))
0036 podioevent = EICDataSvc("EventDataSvc", inputs=kwargs['input'].split(','), OutputLevel=DEBUG)
0037 out = PodioOutput("out", filename=kwargs['output'])
0038
0039 podioinput = PodioInput("PodioReader", collections=["mcparticles", "EcalBarrelHits"], OutputLevel=DEBUG)
0040
0041 copier = MCCopier("MCCopier",
0042 inputCollection="mcparticles",
0043 outputCollection="mcparticles2",
0044 OutputLevel=DEBUG)
0045 calcopier = CalCopier("CalCopier",
0046 inputCollection="EcalBarrelHits",
0047 outputCollection="EcalBarrelHits2",
0048 OutputLevel=DEBUG)
0049
0050 imcaldigi = CalorimeterHitDigi("imcal_digi",
0051 inputHitCollection="EcalBarrelHits",
0052 outputHitCollection="DigiEcalBarrelHits",
0053 inputEnergyUnit=units.GeV,
0054 inputTimeUnit=units.ns,
0055 energyResolutions=[0., 0.02, 0.],
0056 dynamicRangeADC=3*units.MeV,
0057 pedestalSigma=40,
0058 OutputLevel=DEBUG)
0059 imcalreco = ImagingPixelReco("imcal_reco",
0060 inputHitCollection="DigiEcalBarrelHits",
0061 outputHitCollection="RecoEcalBarrelHits",
0062 dynamicRangeADC=3.*units.MeV,
0063 pedestalSigma=40,
0064 readoutClass="EcalBarrelHits",
0065 layerField="layer",
0066 sectorField="module")
0067 imcalcluster = ImagingTopoCluster(inputHitCollection="RecoEcalBarrelHits",
0068 outputClusterCollection="EcalBarrelClusters",
0069 localRanges=[2.*units.mm, 2*units.mm],
0070 adjLayerRanges=[10*units.mrad, 10*units.mrad],
0071 adjLayerDiff=2,
0072 adjSectorDist=3.*units.cm)
0073 clusterreco = ImagingClusterReco(inputClusterCollection="EcalBarrelClusters",
0074 outputLayerCollection="EcalBarrelClustersLayers",
0075 samplingFraction=sf,
0076 OutputLevel=DEBUG)
0077
0078 out.outputCommands = ["keep *"]
0079
0080 ApplicationMgr(
0081 TopAlg=[podioinput, copier, calcopier, imcaldigi, imcalreco, imcalcluster, clusterreco, out],
0082 EvtSel='NONE',
0083 EvtMax=kwargs['nev'],
0084 ExtSvc=[podioevent],
0085 OutputLevel=DEBUG
0086 )
0087