Skip to content
Snippets Groups Projects
Commit 0c16bbe9 authored by guofangyi@ihep.ac.cn's avatar guofangyi@ihep.ac.cn
Browse files

Delete test scripts

parent 5d3a2ba9
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import os
from Gaudi.Configuration import *
from Configurables import k4DataSvc
dsvc = k4DataSvc("EventDataSvc", input="rec_v01.root")
from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_
seed = [12340]
# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi
rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_("RndmGenSvc.Engine") # The default engine in Geant4
rndmengine.SetSingleton = True
rndmengine.Seeds = seed
rndmgensvc = RndmGenSvc("RndmGenSvc")
rndmgensvc.Engine = rndmengine.name()
geometry_option = "TDR_o1_v01/TDR_o1_v01-onlyCalo.xml"
if not os.getenv("DETCRDROOT"):
print("Can't find the geometry. Please setup envvar DETCRDROOT." )
sys.exit(-1)
geometry_path = os.path.join(os.getenv("DETCRDROOT"), "compact", geometry_option)
if not os.path.exists(geometry_path):
print("Can't find the compact geometry file: %s"%geometry_path)
sys.exit(-1)
from Configurables import DetGeomSvc
geosvc = DetGeomSvc("GeomSvc")
geosvc.compact = geometry_path
from Configurables import MarlinEvtSeeder
evtseeder = MarlinEvtSeeder("EventSeeder")
from Configurables import GearSvc
gearsvc = GearSvc("GearSvc")
from Configurables import TrackSystemSvc
tracksystemsvc = TrackSystemSvc("TrackSystemSvc")
from Configurables import SimplePIDSvc
pidsvc = SimplePIDSvc("SimplePIDSvc")
cepcswdatatop = "/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/data/latest"
pidsvc.ParFile = os.path.join(cepcswdatatop, "CEPCSWData/offline-data/Service/SimplePIDSvc/data/dNdx_TPC.root")
from Configurables import PodioInput
podioinput = PodioInput("PodioReader", collections=[
# "EventHeader",
"MCParticle",
"EcalBarrelCollection",
"EcalBarrelContributionCollection",
"EcalEndcapsCollection",
"EcalEndcapsContributionCollection",
"HcalBarrelCollection",
"HcalBarrelContributionCollection",
"HcalEndcapsCollection",
"HcalEndcapsContributionCollection"
])
########## Digitalization ################
##ECAL##
from Configurables import EcalDigiAlg
EcalDigi = EcalDigiAlg("EcalDigiAlg")
EcalDigi.SimCaloHitCollection = ["EcalBarrelCollection", "EcalEndcapsCollection"]
EcalDigi.ReadOutName = ["EcalBarrelCollection", "EcalEndcapsCollection"]
EcalDigi.CaloHitCollection = ["ECALBarrel", "ECALEndcaps"]
EcalDigi.CaloAssociationCollection = ["ECALBarrelAssoCol", "ECALEndcapsAssoCol"]
EcalDigi.CaloMCPAssociationCollection = ["ECALBarrelParticleAssoCol", "ECALEndcapsParticleAssoCol"]
EcalDigi.SkipEvt = 0
EcalDigi.Seed = 2079
#Digitalization parameters
EcalDigi.TimeResolution = 0.7 # 0.7 ns
EcalDigi.EcalMIPEnergy = 13.35 # MIP energy 13.35 MeV for 1.5 cm BGO
EcalDigi.EcalMIP_Thre = 0.05 # 0.05 mip at each side, 0.1 mip for one bar
EcalDigi.UseRealisticDigi = 1
# scintillation
EcalDigi.UseDigiScint = 1
EcalDigi.EcalCryIntLY = 8200 #intrinsic LY 8200 [p.e./MIP]
EcalDigi.EcalCryMipLY = 300 #Detected effective LY 300 [p.e./MIP]
EcalDigi.AttenuationLength = 1e8 # 8000 mm for 5% non-uniformity
# SiPM
EcalDigi.SiPMDigiVerbose = 2 # 0:w/o response, w/o correction; 1:w/ response, w/o correction; 2:w/ response, w/ simple correction; 3:w/ response, w/ full correction
EcalDigi.EcalSiPMPDE = 0.25 # NDL-EQR06, PDE 0.25
EcalDigi.EcalSiPMDCR = 0 # NDL-EQR06, dark count rate 2500000 [Hz]
EcalDigi.EcalTimeInterval = 0. # Time interval 0.000002 [s]. DCR*TimeInterval = dark count noise
EcalDigi.EcalSiPMCT = 0. # SiPM crosstalk Probability 12%
EcalDigi.EcalSiPMGainMean = 5 # 5 [ADC/p.e.]
EcalDigi.EcalSiPMGainSigma = 0.08 # 0.08
#EcalDigi.EcalSiPMNoiseSigma = 0 # 0
# ADC
EcalDigi.ADC = 8192 # 13-bit, 8192
EcalDigi.ADCSwitch = 8000 # 8000
EcalDigi.Pedestal = 50 # Pedestal 50 ADC
EcalDigi.GainRatio_12 = 30 # Gain ratio 30
EcalDigi.GainRatio_23 = 10 # Gain ratio 10
EcalDigi.EcalASICNoiseSigma = 4
EcalDigi.EcalFEENoiseSigma = 5
EcalDigi.ADCNonLinearity = 0 # ADC non-linearity 0
# temperature control
EcalDigi.UseCryTemp = 0
EcalDigi.UseCryTempCor = 0
EcalDigi.UseSiPMTemp = 0
EcalDigi.UseSiPMTempCor = 0
EcalDigi.EcalTempGrad = 3./27 # 3./27 = 3K from 0 to 27 layer
EcalDigi.EcalBGOTempCoef = -0.0138 # -0.0138 [%/K]
EcalDigi.EcalSiPMGainTempCoef = -0.03 # -0.03 [%/K]
EcalDigi.EcalSiPMDCRTempCoef = 3.34/80 # 3.34/80 [10^{k*deltaT}]
EcalDigi.WriteNtuple = 0
EcalDigi.OutFileName = "Digi_ECAL.root"
#########################################
##HCAL##
from Configurables import HcalDigiAlg
HcalDigi = HcalDigiAlg("HcalDigiAlg")
HcalDigi.SimCaloHitCollection = ["HcalBarrelCollection", "HcalEndcapsCollection"]
HcalDigi.ReadOutName = ["HcalBarrelCollection", "HcalEndcapsCollection"]
HcalDigi.CaloHitCollection = ["HCALBarrel", "HCALEndcaps"]
HcalDigi.CaloAssociationCollection = ["HCALBarrelAssoCol", "HCALEndcapsAssoCol"]
HcalDigi.CaloMCPAssociationCollection = ["HCALBarrelParticleAssoCol", "HCALEndcapsParticleAssoCol"]
HcalDigi.SkipEvt = 0
HcalDigi.Seed = 2079
HcalDigi.CalibrHCAL = 1.
#Digitalization parameters
HcalDigi.UseRealisticDigi = 0 #---------Flag to use digitization model.
HcalDigi.MIPResponse = 0.007126 # 0.007.126 GeV / MIP
HcalDigi.MIPThreshold = 0.1 # ----------Unit: MIP
HcalDigi.TemperatureVariation = 0 # Temperature variation 1K
# Scintillation
HcalDigi.UseTileLYMap = 0
HcalDigi.MIPLY = 80 # Glass LY
HcalDigi.LYTempCoef = 0 # Glass LY with temperature
HcalDigi.TileNonUniformity = 0.0
# SiPM
HcalDigi.SiPMPixel = 57600 #---------57600 for 6025PE (6*6 mm, 25 um pixel pitch)
HcalDigi.SiPMDCR = 1600 #---------1600 for 6025PE (6*6 mm, 25 um pixel pitch), 3200 for 6015PS ()
HcalDigi.SiPMCT = 0.0 #---------SiPM crosstalk Probability 0.12
HcalDigi.TimeInterval = 0. #---------Shaping time 2 us
HcalDigi.SiPMGainTempCoef = 0 #---------Temperature dependence of SiPM gain (-3%/K)
HcalDigi.SiPMDCRTempCoef = 0 #---------Temperature dependence of SiPM DCR (10^{k*deltaT}, k=3.34/80)
# ADC
HcalDigi.ADC = 8192
HcalDigi.ADCSwitch = 1e7 # Switch at 8000
HcalDigi.GainRatio_12 = 50
HcalDigi.GainRatio_23 = 60
HcalDigi.SiPMGainMean = 20 # SiPM gain: 2 ADC / p.e.
HcalDigi.SiPMGainSigma = 0.08 # Fluctuation of ADC / p.e.
HcalDigi.SiPMNoiseSigma = 0 # SiPM noise sigma
HcalDigi.Pedestal = 50 # Pedestal 50 ADC
HcalDigi.PedestalSigma = 4 # Sigma of electronic noise (4 ADC)
HcalDigi.WriteNtuple = 0
HcalDigi.OutFileName = "Digi_HCAL.root"
# output
from Configurables import PodioOutput
out = PodioOutput("outputalg")
out.filename = "CaloDigi_TDR_o1_v01_00.root"
out.outputCommands = ["keep *"]
# ApplicationMgr
from Configurables import ApplicationMgr
mgr = ApplicationMgr(
TopAlg = [podioinput, EcalDigi, HcalDigi, out],
EvtSel = 'NONE',
EvtMax = 10,
ExtSvc = [dsvc, rndmengine, rndmgensvc, geosvc],
HistogramPersistency = 'ROOT',
OutputLevel = ERROR
)
import os, sys
from Gaudi.Configuration import *
############## GeomSvc #################
geometry_option = "TDR_o1_v01/TDR_o1_v01-onlyCalo.xml"
if not os.getenv("DETCRDROOT"):
print("Can't find the geometry. Please setup envvar DETCRDROOT." )
sys.exit(-1)
geometry_path = os.path.join(os.getenv("DETCRDROOT"), "compact", geometry_option)
if not os.path.exists(geometry_path):
print("Can't find the compact geometry file: %s"%geometry_path)
sys.exit(-1)
from Configurables import DetGeomSvc
geomsvc = DetGeomSvc("GeomSvc")
geomsvc.compact = geometry_path
geomsvc.fastinit = True
geomsvc.metadata_path = "sim_v02.root"
#######################################
########### k4DataSvc ####################
from Configurables import k4DataSvc
podioevent = k4DataSvc("EventDataSvc", input="CaloDigi_TDR_o1_v01_00.root")
##########################################
########## CEPCSWData #################
cepcswdatatop ="/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/data/latest"
#######################################
########## CrystalEcalEnergyCorrectionSvc ########
from Configurables import CrystalEcalEnergyCorrectionSvc
crystalecalcorr = CrystalEcalEnergyCorrectionSvc("CrystalEcalEnergyCorrectionSvc")
crystalecalcorr.CorrectionFile = os.path.join(cepcswdatatop, "CEPCSWData/offline-data/Service/CrystalEcalSvc/data/CrackRegionEnergyCorrection.root")
##################################################
########## Podio Input ###################
from Configurables import PodioInput
inp = PodioInput("InputReader")
inp.collections = [
"ECALBarrel",
"ECALBarrelParticleAssoCol",
"ECALEndcaps",
"ECALEndcapsParticleAssoCol",
"HCALBarrel",
"HCALBarrelParticleAssoCol",
"HCALEndcaps",
"HCALEndcapsParticleAssoCol",
"MCParticle",
"CompleteTracks",
"CompleteTracksParticleAssociation",
"RecTofCollection",
"DndxTracks"]
##########################################
######### Reconstruction ################
from Configurables import CyberPFAlg
CyberPFAlg = CyberPFAlg("CyberPFAlg")
##----Global parameters----
CyberPFAlg.Seed = 1024
CyberPFAlg.BField = 3.
CyberPFAlg.Debug = 0
CyberPFAlg.SkipEvt = 0
CyberPFAlg.WriteAna = 0
CyberPFAlg.AnaFileName = "RecAnaTuple_TDR_o1_v01.root"
CyberPFAlg.UseMCPTrack = 0
CyberPFAlg.UseTruthMatchTrack = 0
CyberPFAlg.DoCleanTrack = 1
CyberPFAlg.TrackIDFile = "/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/data/latest/CEPCSWData/offline-data/Reconstruction/CyberPFA_trackID/TrkID_BDT_BDTG.weights.xml"
CyberPFAlg.TrackIDMethod = "BDTG"
CyberPFAlg.EcalChargedCalib = 1.26
CyberPFAlg.HcalChargedCalib = 4.0
CyberPFAlg.EcalNeutralCalib = 1.0
CyberPFAlg.HcalNeutralCalib = 4.0
##----Readin collections----
CyberPFAlg.MCParticleCollection = "MCParticle"
CyberPFAlg.TrackCollections = ["CompleteTracks"]
CyberPFAlg.MCRecoTrackParticleAssociationCollection = "CompleteTracksParticleAssociation"
CyberPFAlg.ECalCaloHitCollections = ["ECALBarrel","ECALEndcaps"]
CyberPFAlg.ECalReadOutNames = ["EcalBarrelCollection","EcalEndcapsCollection"]
CyberPFAlg.ECalMCPAssociationName = ["ECALBarrelParticleAssoCol", "ECALEndcapsParticleAssoCol"]
CyberPFAlg.HCalCaloHitCollections = ["HCALBarrel", "HCALEndcaps"]
CyberPFAlg.HCalReadOutNames = ["HcalBarrelCollection", "HcalEndcapsCollection"]
CyberPFAlg.HCalMCPAssociationName = ["HCALBarrelParticleAssoCol", "HCALEndcapsParticleAssoCol"]
##--- Output collections ---
CyberPFAlg.OutputPFO = "outputPFO";
CyberPFAlg.RecoPFOCollection = "CyberPFO"
#----Algorithms----
CyberPFAlg.AlgList = ["GlobalClusteringAlg", #1
"LocalMaxFindingAlg", #2
"TrackMatchingAlg", #3
"HoughClusteringAlg", #4
"ConeClustering2DAlg", #5
"AxisMergingAlg", #6
"EnergySplittingAlg", #9
"EnergyTimeMatchingAlg", #11
"HcalClusteringAlg", #12
"TruthClusteringAlg", #15
"TrackClusterConnectingAlg", #16
"PFOReclusteringAlg" ] #17
CyberPFAlg.AlgParNames = [ ["InputECALBars","OutputECAL1DClusters","OutputECALHalfClusters"],#1
["OutputLocalMaxName"],#2
["ReadinLocalMaxName","OutputLongiClusName"],#3
["ReadinLocalMaxName","LeftLocalMaxName","OutputLongiClusName"],#4
["ReadinLocalMaxName", "OutputLongiClusName"], #5
["OutputAxisName"], #6
["ReadinAxisName", "OutputClusName", "OutputTowerName"], #9
["ReadinHFClusterName", "ReadinTowerName","OutputClusterName"], #11
["OutputHCALClusters"], #12
["DoECALClustering","DoHCALClustering","OutputHCALClusters"], #15
["ReadinECALClusterName", "ReadinHCALClusterName", "OutputCombPFO"], #16
["ECALChargedCalib", "HCALChargedCalib", "ECALNeutralCalib", "HCALNeutralCalib"] ]#17
CyberPFAlg.AlgParTypes = [ ["string","string","string"],#1
["string"],#2
["string","string"],#3
["string","string","string"],#4
["string","string"], #5
["string"], #6
["string","string","string"], #9
["string","string","string"], #11
["string"], #12
["bool","bool","string"], #15
["string","string","string"], #16
["double","double", "double","double"] ]#17
CyberPFAlg.AlgParValues = [ ["BarCol","Cluster1DCol","HalfClusterCol"],#1
["AllLocalMax"],#2
["AllLocalMax","TrackAxis"],#3
["AllLocalMax","LeftLocalMax","HoughAxis"],#4
["LeftLocalMax","ConeAxis"], #5
["MergedAxis"], #6
["MergedAxis","ESHalfCluster","ESTower"], #9
["ESHalfCluster","ESTower","EcalCluster"], #11
["SimpleHCALCluster"], #12
["0","1","HCALCluster"], #15
["EcalCluster", "SimpleHCALCluster", "outputPFO"], #16
["1.26","4.", "1.", "4."] ]#17
from Configurables import FinalPIDAlg
pid = FinalPIDAlg("FinalPIDAlg")
pid.OutputPFOName = "CyberPFOPID"
from Configurables import GenMatch
genmatch = GenMatch("GenMatch")
genmatch.InputPFOs = "CyberPFOPID"
genmatch.nJets = 2
genmatch.R = 0.6
genmatch.OutputFile = "Jets_TDR_o1_v01.root"
##############################################################################
# POD I/O
##############################################################################
from Configurables import PodioOutput
out = PodioOutput("outputalg")
out.filename = "Rec_TDR_o1_v01_00.root"
out.outputCommands = ["keep *"]
########################################
from Configurables import ApplicationMgr
ApplicationMgr(
TopAlg=[inp, CyberPFAlg, pid, out ],
EvtSel="NONE",
EvtMax=5,
ExtSvc=[podioevent, geomsvc],
#OutputLevel=DEBUG
)
#!/bin/bash
##############################################################################
# Run script for CEPCSW:
# - run a simple job
#
# Usage:
# $ ./run.sh Examples/options/helloalg.py
# or:
# $
#
# Author: Tao Lin <lintao@ihep.ac.cn>
##############################################################################
function info:() {
echo "INFO: $*" 1>&2
}
function error:() {
echo "ERROR: $*" 1>&2
}
function check-cepcsw-envvar() {
# CEPCSWEXTERNAL is defined in /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/
if [ -z "${CEPCSWEXTERNAL}" ]; then
error: "The CEPCSW is not setup. Please source setup.sh."
return 1
fi
}
function build-dir() {
local blddir=build
if [ -n "${bldtool}" ]; then
blddir=${blddir}.${bldtool}
fi
# If detect the extra env var, append it to the build dir
if [ -n "${lcg_version}" ]; then
blddir=${blddir}.${lcg_version}
fi
if [ -n "${lcg_platform}" ]; then
blddir=${blddir}.${lcg_platform}
fi
echo $blddir
}
function check-working-builddir() {
local blddir=$(build-dir)
if [ ! -d "$blddir" ]; then
mkdir $blddir || {
error: "Failed to create $blddir"
return 1
}
fi
}
function run-job() {
# local blddir=$(build-dir)
# $blddir/run gaudirun.py $*
gaudirun.py $*
}
##############################################################################
# Parse the command line options
##############################################################################
# The current default platform
lcg_platform=x86_64-centos7-gcc11-opt
lcg_version=103.0.2
bldtool=${CEPCSW_BLDTOOL} # make, ninja # set in env var
check-cepcsw-envvar || exit -1
#check-working-builddir || exit -1
run-job $* || exit -1
#!/usr/bin/env python
import os
from Gaudi.Configuration import *
from Configurables import k4DataSvc
dsvc = k4DataSvc("EventDataSvc")
from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_
seed = [12340]
# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi
rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_("RndmGenSvc.Engine") # The default engine in Geant4
rndmengine.SetSingleton = True
rndmengine.Seeds = seed
rndmgensvc = RndmGenSvc("RndmGenSvc")
rndmgensvc.Engine = rndmengine.name()
# option for standalone tracker study
#geometry_option = "TDR_o1_v01/TDR_o1_v01-oldVersion.xml"
#geometry_option = "TDR_o1_v01/TDR_o1_v01-patchOTK.xml"
geometry_option = "TDR_o1_v01/TDR_o1_v01.xml"
if not os.getenv("DETCRDROOT"):
print("Can't find the geometry. Please setup envvar DETCRDROOT." )
sys.exit(-1)
geometry_path = os.path.join(os.getenv("DETCRDROOT"), "compact", geometry_option)
if not os.path.exists(geometry_path):
print("Can't find the compact geometry file: %s"%geometry_path)
sys.exit(-1)
from Configurables import DetGeomSvc
geosvc = DetGeomSvc("GeomSvc")
geosvc.compact = geometry_path
##############################################################################
# Physics Generator
##############################################################################
from Configurables import GenAlgo
from Configurables import GtGunTool
from Configurables import StdHepRdr
from Configurables import SLCIORdr
from Configurables import HepMCRdr
from Configurables import GenPrinter
########### Particle Gun ##############
#gun = GtGunTool("GtGunTool")
#gun.PositionXs = [0]
#gun.PositionYs = [0]
#gun.PositionZs = [0]
#gun.Particles = ["mu-"]
#gun.EnergyMins = [1]
#gun.EnergyMaxs = [100]
#gun.ThetaMins = [8]
#gun.ThetaMaxs = [172]
#gun.PhiMins = [0]
#gun.PhiMaxs = [360]
#genprinter = GenPrinter("GenPrinter")
#genalg = GenAlgo("GenAlgo")
#genalg.GenTools = ["GtGunTool"]
############ Physics generator in stdhep
stdheprdr = StdHepRdr("StdHepRdr")
stdheprdr.Input = "/cefs/higgs/zhangkl/stdhep/E240/higgs_JOI/E240.Pnnh_gg.e0.p0.whizard195/nnh_gg_1050.e0.p0.0001.stdhep"
genalg = GenAlgo("GenAlgo")
genalg.GenTools = ["StdHepRdr"]
##############################################################################
# Detector Simulation
##############################################################################
from Configurables import DetSimSvc
detsimsvc = DetSimSvc("DetSimSvc")
from Configurables import Edm4hepWriterAnaElemTool
edm4hep_writer = Edm4hepWriterAnaElemTool("Edm4hepWriterAnaElemTool")
edm4hep_writer.TrackerCollections = ["VXD", "ITKBarrel", "ITKEndcap", "TPC", "TPCLowPt", "TPCSpacePoint",
"OTKBarrel", "OTKEndcap", "COIL", "MuonBarrel", "MuonEndcap"]
from Configurables import DetSimAlg
detsimalg = DetSimAlg("DetSimAlg")
detsimalg.RandomSeeds = seed
# detsimalg.VisMacs = ["vis.mac"]
detsimalg.RunCmds = [
# "/tracking/verbose 1",
]
detsimalg.AnaElems = [
# example_anatool.name()
# "ExampleAnaElemTool"
"Edm4hepWriterAnaElemTool"
]
detsimalg.RootDetElem = "WorldDetElemTool"
from Configurables import Edm4hepWriterAnaElemTool
detsim_anatool = Edm4hepWriterAnaElemTool("Edm4hepWriterAnaElemTool")
detsim_anatool.IsTrk2Primary = False # True: primary; False: ancestor
from Configurables import TimeProjectionChamberSensDetTool
tpc_sensdettool = TimeProjectionChamberSensDetTool("TimeProjectionChamberSensDetTool")
tpc_sensdettool.TypeOption = 1
tpc_sensdettool.DoHeedSim = False #True
dedxoption = "TrackHeedSimTool"
tpc_sensdettool.DedxSimTool = dedxoption
from Configurables import TrackHeedSimTool
dedx_simtool = TrackHeedSimTool("TrackHeedSimTool")
dedx_simtool.detector = "TPC"
dedx_simtool.only_primary = False#True
dedx_simtool.use_max_step = False#True
dedx_simtool.max_step = 1#mm
dedx_simtool.save_mc = True
#dedx_simtool.OutputLevel = DEBUG
from Configurables import CalorimeterSensDetTool
from Configurables import DriftChamberSensDetTool
cal_sensdettool = CalorimeterSensDetTool("CalorimeterSensDetTool")
cal_sensdettool.CalNamesMergeDisable = ["EcalBarrel", "EcalEndcap", "HcalBarrel", "HcalEndcap"]
cal_sensdettool.CalNamesApplyBirks = ["EcalBarrel", "EcalEndcap", "HcalBarrel","HcalEndcap"]
cal_sensdettool.CalNamesBirksConstants = [0.008415, 0.008415, 0.01, 0.01] # BGO and Glass scintillator
from Configurables import MarlinEvtSeeder
evtseeder = MarlinEvtSeeder("EventSeeder")
from Configurables import GeomMetaWriter
metaWriter = GeomMetaWriter("GeomMetaWriter")
# output
from Configurables import PodioOutput
out = PodioOutput("outputalg")
out.filename = "sim_v01.root"
out.outputCommands = ["keep *"]
# ApplicationMgr
from Configurables import ApplicationMgr
mgr = ApplicationMgr(
TopAlg = [genalg, detsimalg, metaWriter, out],
EvtSel = 'NONE',
EvtMax = 10,
ExtSvc = [rndmengine, rndmgensvc, dsvc, geosvc],
HistogramPersistency = 'ROOT',
OutputLevel = ERROR
)
#!/usr/bin/env python
import os
from Gaudi.Configuration import *
from Configurables import k4DataSvc
dsvc = k4DataSvc("EventDataSvc", input="sim_v01.root")
from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_
seed = [12340]
# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi
rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_("RndmGenSvc.Engine") # The default engine in Geant4
rndmengine.SetSingleton = True
rndmengine.Seeds = seed
rndmgensvc = RndmGenSvc("RndmGenSvc")
rndmgensvc.Engine = rndmengine.name()
#geometry_option = "TDR_o1_v01/TDR_o1_v01.xml"
geometry_option = "TDR_o1_v01/TDR_o1_v01-onlyTracker.xml"
if not os.getenv("DETCRDROOT"):
print("Can't find the geometry. Please setup envvar DETCRDROOT." )
sys.exit(-1)
geometry_path = os.path.join(os.getenv("DETCRDROOT"), "compact", geometry_option)
if not os.path.exists(geometry_path):
print("Can't find the compact geometry file: %s"%geometry_path)
sys.exit(-1)
from Configurables import DetGeomSvc
geosvc = DetGeomSvc("GeomSvc")
geosvc.compact = geometry_path
#geosvc.fastinit = True
#geosvc.metadata_path = "sim_v01.root"
from Configurables import MarlinEvtSeeder
evtseeder = MarlinEvtSeeder("EventSeeder")
from Configurables import GearSvc
gearsvc = GearSvc("GearSvc")
from Configurables import TrackSystemSvc
tracksystemsvc = TrackSystemSvc("TrackSystemSvc")
from Configurables import SimplePIDSvc
pidsvc = SimplePIDSvc("SimplePIDSvc")
cepcswdatatop = "/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/data/latest"
pidsvc.ParFile = os.path.join(cepcswdatatop, "CEPCSWData/offline-data/Service/SimplePIDSvc/data/tdr25.1.1/dNdx_TPC.root")
from Configurables import PodioInput
podioinput = PodioInput("PodioReader", collections=[
# "EventHeader",
"MCParticle",
"VXDCollection",
"ITKBarrelCollection",
"ITKEndcapCollection",
"TPCCollection",
"OTKBarrelCollection",
"OTKEndcapCollection",
"MuonBarrelCollection",
"MuonEndcapCollection"
])
##################
# Digitization
##################
## Config ##
vxdhitname = "VXDTrackerHits"
sithitname = "ITKBarrelTrackerHits"
ftdhitname = "ITKEndcapTrackerHits"
gashitname = "TPCTrackerHits"
sethitname = "OTKBarrelTrackerHits"
etdhitname = "OTKEndcapTrackerHits"
from Configurables import SmearDigiTool,SiTrackerDigiAlg
## VXD ##
vxdtool = SmearDigiTool("VXD")
vxdtool.ResolutionU = [0.005]
vxdtool.ResolutionV = [0.005]
vxdtool.EnergyThreshold = 0.00001 #GeV
#vxdtool.OutputLevel = DEBUG
digiVXD = SiTrackerDigiAlg("VXDDigi")
digiVXD.SimTrackHitCollection = "VXDCollection"
digiVXD.TrackerHitCollection = vxdhitname
digiVXD.TrackerHitAssociationCollection = "VXDTrackerHitAssociation"
digiVXD.DigiTool = "SmearDigiTool/VXD"
#digiVXD.OutputLevel = DEBUG
## ITKBarrel ##
itkbtool = SmearDigiTool("ITKBarrel")
itkbtool.ResolutionU = [0.008]
itkbtool.ResolutionV = [0.040]
itkbtool.EnergyThreshold = 0.00005 #GeV
#itkbtool.OutputLevel = DEBUG
digiITKB = SiTrackerDigiAlg("ITKBarrelDigi")
digiITKB.SimTrackHitCollection = "ITKBarrelCollection"
digiITKB.TrackerHitCollection = sithitname
digiITKB.TrackerHitAssociationCollection = "ITKBarrelTrackerHitAssociation"
digiITKB.DigiTool = "SmearDigiTool/ITKBarrel"
#digiITKB.OutputLevel = DEBUG
## ITKEndcap ##
itketool = SmearDigiTool("ITKEndcap")
itketool.ResolutionU = [0.008]
itketool.ResolutionV = [0.040]
itketool.EnergyThreshold = 0.00005 #GeV
#itketool.OutputLevel = DEBUG
digiITKE = SiTrackerDigiAlg("ITKEndcapDigi")
digiITKE.SimTrackHitCollection = "ITKEndcapCollection"
digiITKE.TrackerHitCollection = ftdhitname
digiITKE.TrackerHitAssociationCollection = "ITKEndcapTrackerHitAssociation"
digiITKE.DigiTool = "SmearDigiTool/ITKEndcap"
#digiITKE.OutputLevel = DEBUG
## OTKBarrel ##
otkbtool = SmearDigiTool("OTKBarrel")
otkbtool.ResolutionU = [0.010]
otkbtool.ResolutionV = [1.000]
otkbtool.EnergyThreshold = 0.00005 #GeV
#otkbtool.OutputLevel = DEBUG
digiOTKB = SiTrackerDigiAlg("OTKBarrelDigi")
digiOTKB.SimTrackHitCollection = "OTKBarrelCollection"
digiOTKB.TrackerHitCollection = sethitname
digiOTKB.TrackerHitAssociationCollection = "OTKBarrelTrackerHitAssociation"
digiOTKB.DigiTool = "SmearDigiTool/OTKBarrel"
#digiOTKB.OutputLevel = DEBUG
## OTKEndcap ##
otketool = SmearDigiTool("OTKEndcap")
otketool.ResolutionU = [0.010]
otketool.ResolutionV = [1.000]
otketool.EnergyThreshold = 0.00005 #GeV
#otketool.OutputLevel = DEBUG
digiOTKE = SiTrackerDigiAlg("OTKEndcapDigi")
digiOTKE.SimTrackHitCollection = "OTKEndcapCollection"
digiOTKE.TrackerHitCollection = etdhitname
digiOTKE.TrackerHitAssociationCollection = "OTKEndcapTrackerHitAssociation"
digiOTKE.DigiTool = "SmearDigiTool/OTKEndcap"
#digiOTKE.OutputLevel = DEBUG
## TPC ##
from Configurables import TPCDigiAlg
digiTPC = TPCDigiAlg("TPCDigi")
digiTPC.TPCCollection = "TPCCollection"
digiTPC.TPCLowPtCollection = "TPCLowPtCollection"
digiTPC.TPCTrackerHitsCol = gashitname
#default value, modify them according to future Garfield simulation results
#digiTPC.PixelClustering = True
#digiTPC.PointResolutionRPhi = 0.144
#digiTPC.DiffusionCoeffRPhi = 0.0323
#digiTPC.PointResolutionZ = 0.4
#digiTPC.DiffusionCoeffZ = 0.23
#digiTPC.N_eff = 30
#digiTPC.OutputLevel = DEBUG
## Muon Detector ##
from Configurables import MuonDigiAlg
digiMuon = MuonDigiAlg("MuonDigiAlg")
digiMuon.MuonBarrelHitsCollection = "MuonBarrelCollection"
digiMuon.MuonEndcapHitsCollection = "MuonEndcapCollection"
digiMuon.MuonBarrelTrackerHits = "MuonBarrelTrackerHits"
digiMuon.MuonEndcapTrackerHits = "MuonEndcapTrackerHits"
digiMuon.WriteNtuple = 0
digiMuon.OutFileName = "Digi_MUON.root"
digiMuon.SiPMEff = 1
digiMuon.EdepMin = 0.0 # no cut on GeV energy deposition
digiMuon.HitEdepMin = 6.0 # ADC counts
digiMuon.HitEdepMax = -1 # ADC counts, -1 means no upper cut
digiMuon.TimeResolution = 2.0 # Digi hit time resolution, in unit ns
#digiMuon.OutputLevel = DEBUG
#########################################
################
# Tracking
################
from Configurables import KalTestTool
# Close multiple scattering and smooth, used by clupatra
kt010 = KalTestTool("KalTest010")
kt010.MSOn = False
kt010.Smooth = False
#kt010.OutputLevel = DEBUG
# Open multiple scattering, energy loss and smooth (default)
kt111 = KalTestTool("KalTest111")
#kt111.OutputLevel = DEBUG
# Close smooth
kt110 = KalTestTool("KalTest110")
kt110.Smooth = False
#kt110.OutputLevel = DEBUG
# Close energy loss
kt101 = KalTestTool("KalTest101")
kt101.EnergyLossOn = False
#kt101.OutputLevel = DEBUG
from Configurables import SiliconTrackingAlg
tracking = SiliconTrackingAlg("SiliconTracking")
tracking.LayerCombinations = [8,7,6, 8,7,5, 8,7,4, 8,7,3, 8,7,2, 8,7,1, 8,7,0,
8,6,5, 8,6,4, 8,6,3, 8,6,2, 8,6,1, 8,6,0,
7,6,5, 7,6,4, 7,6,3, 7,6,2, 7,6,1, 7,6,0,
7,5,3, 7,5,2, 7,5,1, 7,5,0, 7,4,3, 7,4,2, 7,4,1, 7,4,0,
6,5,3, 6,5,2, 6,5,1, 6,5,0, 6,4,3, 6,4,2, 6,4,1, 6,4,0,
6,3,2, 6,3,1, 6,3,0, 6,2,1, 6,2,0, 6,1,0,
5,3,2, 5,3,1, 5,3,0, 5,2,1, 5,2,0, 5,1,0,
4,3,2, 4,3,1, 4,3,0, 4,2,1, 4,2,0, 4,1,0,
3,2,1, 3,2,0, 3,1,0, 2,1,0]
tracking.LayerCombinationsFTD = []
tracking.HeaderCol = "EventHeader"
tracking.VTXHitCollection = vxdhitname
tracking.SITHitCollection = sithitname
tracking.FTDPixelHitCollection = ftdhitname
tracking.SITRawHitCollection = "NotNeedForPixelSIT"
tracking.FTDRawHitCollection = ftdhitname
tracking.UseSIT = True
tracking.SmoothOn = False
tracking.NDivisionsInTheta = 10
tracking.NDivisionsInPhi = 60
tracking.NDivisionsInPhiFTD = 16
tracking.MinDistCutAttach = 50
# for p=1GeV, theta=10degree, Chi2FitCut = 1500, HelixMaxChi2 = 1000000, Chi2WZ = 0.02
tracking.Chi2FitCut = 200
tracking.MaxChi2PerHit = 200
tracking.HelixMaxChi2 = 50000
tracking.Chi2WZTriplet = 0.1
tracking.Chi2WZQuartet = 0.1
tracking.Chi2WZSeptet = 0.1
#tracking.FitterTool = "KalTestTool/KalTest111"
#tracking.OutputLevel = DEBUG
from Configurables import ForwardTrackingAlg
forward = ForwardTrackingAlg("ForwardTracking")
forward.FTDPixelHitCollection = ftdhitname
#forward.FTDSpacePointCollection = ftdspname
forward.FTDRawHitCollection = ftdhitname
forward.Chi2ProbCut = 0.0
forward.HitsPerTrackMin = 3
forward.BestSubsetFinder = "SubsetSimple"
forward.Criteria = ["Crit2_DeltaPhi","Crit2_StraightTrackRatio","Crit3_3DAngle","Crit3_ChangeRZRatio","Crit3_IPCircleDist","Crit4_3DAngleChange","Crit4_DistToExtrapolation",
"Crit2_DeltaRho","Crit2_RZRatio","Crit3_PT"]
forward.CriteriaMin = [0, 0.9, 0, 0.995, 0, 0.8, 0, 20, 1.002, 0.1, 0, 0.99, 0, 0.999, 0, 0.99, 0]
forward.CriteriaMax = [30, 1.02, 10, 1.015, 20, 1.3, 1.0, 150, 1.08, 99999999, 0.8, 1.01, 0.35, 1.001, 1.5, 1.01, 0.05]
#forward.FitterTool = "KalTestTool/KalTest110"
#forward.OutputLevel = DEBUG
from Configurables import TrackSubsetAlg
subset = TrackSubsetAlg("TrackSubset")
subset.TrackInputCollections = ["ForwardTracks", "SiTracks"]
subset.RawTrackerHitCollections = [vxdhitname, sithitname, ftdhitname]
subset.TrackSubsetCollection = "SubsetTracks"
#subset.FitterTool = "KalTestTool/KalTest111"
#subset.OutputLevel = DEBUG
from Configurables import ClupatraAlg
clupatra = ClupatraAlg("Clupatra")
clupatra.TPCHitCollection = gashitname
#clupatra.OutputLevel = DEBUG
from Configurables import FullLDCTrackingAlg
full = FullLDCTrackingAlg("FullTracking")
full.VTXTrackerHits = vxdhitname
full.SITTrackerHits = sithitname
full.TPCTrackerHits = gashitname
full.SETTrackerHits = sethitname
full.FTDPixelTrackerHits = ftdhitname
#full.FTDSpacePoints = ftdspname
full.ETDTrackerHits = etdhitname
full.SITRawHits = "NotNeedForPixelSIT"
full.SETRawHits = "NotNeedForPixelSET"
full.FTDRawHits = ftdhitname
full.TPCTracks = "ClupatraTracks" # add standalone TPC track
full.SiTracks = "SiTracks"
full.OutputTracks = "CompleteTracks" # default name
full.FTDHitToTrackDistance = 5.
full.SITHitToTrackDistance = 3.
full.SETHitToTrackDistance = 5.
#according to particle gun
full.ETDHitToTrackDistance = 40.
full.MinChi2ProbForSiliconTracks = 0
full.MaxChi2PerHit = 200
full.ForceSiTPCMerging = True
full.ForceTPCSegmentsMerging = True
#full.OutputLevel = DEBUG
from Configurables import TPCDndxAlg
tpc_dndx = TPCDndxAlg("TPCDndxAlg")
tpc_dndx.Method = "Simple"
from Configurables import TofRecAlg
tof = TofRecAlg("TofRecAlg")
#tof.OutputLevel = DEBUG
from Configurables import TrackParticleRelationAlg
tpr = TrackParticleRelationAlg("Track2Particle")
tpr.MCParticleCollection = "MCParticle"
tpr.TrackList = ["CompleteTracks"]
tpr.TrackerAssociationList = ["VXDTrackerHitAssociation", "ITKBarrelTrackerHitAssociation", "ITKEndcapTrackerHitAssociation",
"OTKBarrelTrackerHitAssociation", "OTKEndcapTrackerHitAssociation", "TPCTrackerHitAss"]
#tpr.OutputLevel = DEBUG
from Configurables import TrueMuonTagAlg
tmt = TrueMuonTagAlg("TrueMuonTag")
tmt.MCParticleCollection = "MCParticle"
tmt.TrackList = ["CompleteTracks"]
tmt.TrackerAssociationList = ["VXDTrackerHitAssociation", "ITKBarrelTrackerHitAssociation", "ITKEndcapTrackerHitAssociation",
"OTKBarrelTrackerHitAssociation", "OTKEndcapTrackerHitAssociation", "TPCTrackerHitAss"]
tmt.MuonTagEfficiency = 0.95 # muon true tag efficiency, default is 1.0 (100%)
tmt.MuonDetTanTheta = 1.2 # muon det barrel/endcap separation tan(theta)
#tmt.OutputLevel = DEBUG
# output
from Configurables import PodioOutput
out = PodioOutput("outputalg")
out.filename = "rec_v01.root"
out.outputCommands = ["keep *"]
# ApplicationMgr
from Configurables import ApplicationMgr
mgr = ApplicationMgr(
TopAlg = [podioinput, digiVXD, digiITKB, digiITKE, digiOTKB, digiOTKE, digiTPC, digiMuon, tracking, clupatra, full, tpr, tpc_dndx, tof, tmt, out],
EvtSel = 'NONE',
EvtMax = 50,
ExtSvc = [rndmengine, rndmgensvc, dsvc, evtseeder, geosvc, gearsvc, tracksystemsvc, pidsvc],
HistogramPersistency = 'ROOT',
OutputLevel = ERROR
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment