17 from modularAnalysis
import inputMdst, fillParticleList, matchMCTruth, variablesToNtuple
18 from variables
import variables
20 charged_path = basf2.Path()
22 variables.addAlias(
'kBinaryID',
'pidPairProbabilityExpert(321,211,ALL)')
23 variables.addAlias(
'eBinaryID',
'pidPairProbabilityExpert(11,211,ALL)')
24 variables.addAlias(
'muBinaryID',
'pidPairProbabilityExpert(13,211,ALL)')
25 variables.addAlias(
'pBinaryID',
'pidPairProbabilityExpert(2212,211,ALL)')
27 if len(sys.argv)
not in [2, 3]:
28 sys.exit(
'Must provide an input file and (optionally) an output file')
31 if len(sys.argv) == 3:
34 outFile =
'./truth_charged.root'
36 inputMdst(inFile, path=charged_path)
41 trackQuality =
'thetaInCDCAcceptance and nCDCHits > 20'
42 ipCut =
'd0 < 0.5 and abs(z0) < 2'
43 mcCharged =
'(abs(mcPDG)==11 or abs(mcPDG)==13 or abs(mcPDG)==211 or abs(mcPDG)==321 or abs(mcPDG)==2212)'
44 goodTrack = trackQuality +
' and ' + ipCut
46 fillParticleList(
'pi+:any', goodTrack, path=charged_path)
47 matchMCTruth(
'pi+:any', path=charged_path)
49 fillParticleList(
'K+:any', goodTrack, path=charged_path)
50 matchMCTruth(
'K+:any', path=charged_path)
52 fillParticleList(
'e+:any', goodTrack, path=charged_path)
53 matchMCTruth(
'e+:any', path=charged_path)
55 fillParticleList(
'mu+:any', goodTrack, path=charged_path)
56 matchMCTruth(
'mu+:any', path=charged_path)
58 fillParticleList(
'p+:any', goodTrack, path=charged_path)
59 matchMCTruth(
'p+:any', path=charged_path)
64 ntupleOfInterest = [
'px',
'py',
'pz',
'E',
'p',
'pt',
'theta',
'phi',
65 'mcPX',
'mcPY',
'mcPZ',
'mcE',
'mcP',
'mcPT',
'mcTheta',
'mcPhi',
66 'pionID',
'kaonID',
'electronID',
'muonID',
'protonID',
67 'kBinaryID',
'eBinaryID',
'muBinaryID',
'pBinaryID',
68 'thetaInTOPAcceptance',
'thetaInECLAcceptance',
'thetaInKLMAcceptance',
69 'ptInTOPAcceptance',
'ptInBECLAcceptance',
'ptInBKLMAcceptance',
73 variablesToNtuple(
'pi+:any', ntupleOfInterest,
'pion', outFile, path=charged_path)
75 variablesToNtuple(
'e+:any', ntupleOfInterest,
'electron', outFile, path=charged_path)
76 variablesToNtuple(
'mu+:any', ntupleOfInterest,
'muon', outFile, path=charged_path)
77 variablesToNtuple(
'p+:any', ntupleOfInterest,
'proton', outFile, path=charged_path)
82 basf2.process(charged_path)