10 from modularAnalysis
import inputMdst, fillParticleList, matchMCTruth, variablesToNtuple
11 from variables
import variables
13 charged_path = basf2.Path()
15 variables.addAlias(
'kBinaryID',
'pidPairProbabilityExpert(321,211,ALL)')
16 variables.addAlias(
'eBinaryID',
'pidPairProbabilityExpert(11,211,ALL)')
17 variables.addAlias(
'muBinaryID',
'pidPairProbabilityExpert(13,211,ALL)')
18 variables.addAlias(
'pBinaryID',
'pidPairProbabilityExpert(2212,211,ALL)')
20 if len(sys.argv)
not in [2, 3]:
21 sys.exit(
'Must provide an input file and (optionally) an output file')
24 if len(sys.argv)
is 3:
27 outFile =
'./truth_charged.root'
29 inputMdst(
'default', inFile, path=charged_path)
34 trackQuality =
'thetaInCDCAcceptance and nCDCHits > 20'
35 ipCut =
'd0 < 0.5 and abs(z0) < 2'
36 mcCharged =
'(abs(mcPDG)==11 or abs(mcPDG)==13 or abs(mcPDG)==211 or abs(mcPDG)==321 or abs(mcPDG)==2212)'
37 goodTrack = trackQuality +
' and ' + ipCut
39 fillParticleList(
'pi+:any', goodTrack, path=charged_path)
40 matchMCTruth(
'pi+:any', path=charged_path)
42 fillParticleList(
'K+:any', goodTrack, path=charged_path)
43 matchMCTruth(
'K+:any', path=charged_path)
45 fillParticleList(
'e+:any', goodTrack, path=charged_path)
46 matchMCTruth(
'e+:any', path=charged_path)
48 fillParticleList(
'mu+:any', goodTrack, path=charged_path)
49 matchMCTruth(
'mu+:any', path=charged_path)
51 fillParticleList(
'p+:any', goodTrack, path=charged_path)
52 matchMCTruth(
'p+:any', path=charged_path)
57 ntupleOfInterest = [
'px',
'py',
'pz',
'E',
'p',
'pt',
'theta',
'phi',
58 'mcPX',
'mcPY',
'mcPZ',
'mcE',
'mcP',
'mcPT',
'mcTheta',
'mcPhi',
59 'pionID',
'kaonID',
'electronID',
'muonID',
'protonID',
60 'kBinaryID',
'eBinaryID',
'muBinaryID',
'pBinaryID',
61 'thetaInTOPAcceptance',
'thetaInECLAcceptance',
'thetaInKLMAcceptance',
62 'ptInTOPAcceptance',
'ptInBECLAcceptance',
'ptInBKLMAcceptance',
66 variablesToNtuple(
'pi+:any', ntupleOfInterest,
'pion', outFile, path=charged_path)
68 variablesToNtuple(
'e+:any', ntupleOfInterest,
'electron', outFile, path=charged_path)
69 variablesToNtuple(
'mu+:any', ntupleOfInterest,
'muon', outFile, path=charged_path)
70 variablesToNtuple(
'p+:any', ntupleOfInterest,
'proton', outFile, path=charged_path)