Skip to content
Snippets Groups Projects

add benchmark for pion0

Merged Chao Peng requested to merge add_pi0_benchmark into master
3 files
+ 225
0
Compare changes
  • Side-by-side
  • Inline
Files
3
import os
import ROOT
from Gaudi.Configuration import *
from GaudiKernel.SystemOfUnits import mm, MeV, rad, ns
from GaudiKernel.DataObjectHandleBase import DataObjectHandleBase
from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
from Configurables import PodioInput
from Configurables import Jug__Digi__CalorimeterHitDigi as CalHitDigi
from Configurables import Jug__Reco__CalorimeterHitReco as CalHitReco
from Configurables import Jug__Reco__CalorimeterHitsEtaPhiProjector as CalHitsProj
from Configurables import Jug__Reco__CalorimeterIslandCluster as IslandCluster
from Configurables import Jug__Reco__ClusterRecoCoG as RecoCoG
# input arguments through environment variables
kwargs = dict()
kwargs['sf'] = float(os.environ.get('CB_EMCAL_SCFI, SAMP_FRAC', '0.0134'))
kwargs['input'] = os.environ.get('CB_EMCAL_SIM_FILE', '../topside/barrel_pion0_5GeV.root')
kwargs['output'] = os.environ.get('CB_EMCAL_REC_FILE', 'barrel_pion0_5GeV_cluster.root')
kwargs['compact'] = os.environ.get('CB_EMCAL_COMPACT_PATH', '../topside/test.xml')
kwargs['nev'] = int(os.environ.get('CB_EMCAL_NUMEV', 100))
if kwargs['nev'] < 1:
f = ROOT.TFile(kwargs['input'])
kwargs['nev'] = f.events.GetEntries()
print(kwargs)
# get sampling fraction from system environment variable, 1.0 by default
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', 'EcalBarrelHits'], OutputLevel=DEBUG)
podout = PodioOutput('out', filename=kwargs['output'])
# use the same daq_setting for digi/reco pair
imcal_barrel_daq = dict(
dynamicRangeADC=3.*MeV,
capacityADC=32768,
pedestalMean=400,
pedestalSigma=50)
imcal_barrel_digi = CalHitDigi('imcal_barrel_digi',
inputHitCollection='EcalBarrelHits',
outputHitCollection='EcalBarrelHitsDigi',
**imcal_barrel_daq)
imcal_barrel_reco = CalHitReco('imcal_barrel_reco',
inputHitCollection=imcal_barrel_digi.outputHitCollection,
outputHitCollection='EcalBarrelHitsReco',
thresholdFactor=5.0,
readoutClass='EcalBarrelHits',
localDetFields=['system', 'module'], # use local coordinates in each module (stave)
**imcal_barrel_daq)
# merge hits to eta, phi bins
imcal_barrel_merger = CalHitsProj('imcal_barrel_merger',
# OutputLevel=DEBUG,
inputHitCollection=imcal_barrel_reco.outputHitCollection,
outputHitCollection='EcalBarrelHitsMerge',
gridSizes=[0.004, 0.004*rad])
imcal_barrel_cl = IslandCluster('imcal_barrel_cl',
# OutputLevel=DEBUG,
inputHitCollection=imcal_barrel_merger.outputHitCollection,
outputHitCollection='EcalBarrelClusterHits',
minClusterCenterEdep=1.*MeV,
minClusterHitEdep=0.1*MeV,
splitCluster=True,
globalDistEtaPhi=[0.005, 0.005*rad])
imcal_barrel_clreco = RecoCoG('imcal_barrel_clreco',
# OutputLevel=DEBUG,
inputHitCollection=imcal_barrel_cl.outputHitCollection,
outputClusterCollection='EcalBarrelClusters',
logWeightBase=6.2,
samplingFraction=kwargs['sf'])
podout.outputCommands = ['keep *']
ApplicationMgr(
TopAlg=[podin,
imcal_barrel_digi, imcal_barrel_reco,
imcal_barrel_merger, imcal_barrel_cl, imcal_barrel_clreco,
podout],
EvtSel='NONE',
EvtMax=kwargs['nev'],
ExtSvc=[podioevent],
OutputLevel=DEBUG
)
Loading