5 from ROOT.Belle2
import Const
12 additionalBranches=[],
16 Add the mDST output module to a path.
17 This function defines the mDST data format.
20 path (basf2.Path): Path to add module to
21 mc (bool): Save Monte Carlo quantities? (MCParticles and corresponding relations)
22 filename (str): Output file name.
23 additionalBranches (list): Additional objects/arrays of event durability to save
24 dataDescription (dict or None): Additional key->value pairs to be added as data description
25 fields to the output FileMetaData
31 'EventLevelTrackingInfo',
33 'TracksToPIDLikelihoods',
35 'ECLClustersToTracksNamedBremsstrahlung',
36 'EventLevelClusteringInfo',
37 'TracksToECLClusters',
42 'SoftwareTriggerResult',
44 persistentBranches = [
'FileMetaData']
46 branches += [
'MCParticles',
'TracksToMCParticles',
47 'ECLClustersToMCParticles',
'KLMClustersToMCParticles']
48 persistentBranches += [
'BackgroundInfo']
49 branches += additionalBranches
51 if dataDescription
is None:
55 dataDescription.setdefault(
"dataLevel",
"mdst")
56 return path.add_module(
"RootOutput", outputFileName=filename, branchNames=branches,
57 branchNamesPersistent=persistentBranches, additionalDataDescription=dataDescription)
60 def add_mdst_dump(path, print_untested=False):
62 Add a PrintObjectsModule to a path for printing the mDST content.
65 path (basf2.Path): Path to add module to
66 print_untested (bool): If True print the names of all methods which are not
67 explicitly printed to make sure we don't miss addition of new members
71 pid_detectors = [Const.PIDDetectorSet(Const.PIDDetectors.c_set[index])
for index
in range(Const.PIDDetectors.c_size)]
72 charged_stables = [Const.ChargedStable(Const.chargedStableSet.at(index))
for index
in range(Const.chargedStableSet.size())]
77 DataStorePrinter(
"EventMetaData", [
78 "getErrorFlag",
"getEvent",
"getRun",
"getSubrun",
"getExperiment",
79 "getProduction",
"getTime",
"getParentLfn",
"getGeneratedWeight",
82 DataStorePrinter(
"Track", [
"getNumberOfFittedHypotheses",
"getQualityIndicator"], {
83 "getTrackFitResult": charged_stables,
84 "getTrackFitResultWithClosestMass": charged_stables,
85 "getRelationsWith": [
"ECLClusters",
"KLMClusters",
"MCParticles",
"PIDLikelihoods"],
87 DataStorePrinter(
"V0", [
"getTracks",
"getTrackFitResults",
"getV0Hypothesis"], {
88 "getRelationsWith": [
"MCParticles"],
90 DataStorePrinter(
"TrackFitResult", [
91 "getPosition",
"getMomentum",
"get4Momentum",
"getEnergy",
"getTransverseMomentum",
92 "getCovariance6",
"getParticleType",
"getChargeSign",
"getPValue",
"getD0",
"getPhi0",
93 "getPhi",
"getOmega",
"getZ0",
"getTanLambda",
"getCotTheta",
94 "getTau",
"getCov",
"getCovariance5",
"getHitPatternCDC",
"getHitPatternVXD",
"getNDF",
"getChi2"
96 DataStorePrinter(
"EventLevelTrackingInfo", [
97 "getNCDCHitsNotAssigned",
"getNCDCHitsNotAssignedPostCleaning",
98 "getNCDCSegments",
"getSVDFirstSampleTime",
"hasAnErrorFlag",
99 "hasUnspecifiedTrackFindingFailure",
"hasVXDTF2AbortionFlag",
100 "hasSVDCKFAbortionFlag",
"hasPXDCKFAbortionFlag"], {
101 "hasCDCLayer": range(56)
103 DataStorePrinter(
"PIDLikelihood", [
"getMostLikely"], {
104 "isAvailable": pid_detectors,
105 "getLogL": charged_stables,
106 "getProbability": charged_stables,
108 DataStorePrinter(
"ECLCluster", [
109 "isTrack",
"isNeutral",
"getStatus",
"getConnectedRegionId",
110 "getClusterId",
"getMinTrkDistance",
"getDeltaL",
111 "getAbsZernike40",
"getAbsZernike51",
"getZernikeMVA",
"getE1oE9",
112 "getE9oE21",
"getClusterHadronIntensity",
"getNumberOfHadronDigits",
113 "getSecondMoment",
"getLAT",
"getNumberOfCrystals",
"getTime",
114 "getDeltaTime99",
"hasFailedFitTime",
"hasFailedTimeResolution",
"getPhi",
"getTheta",
"getR",
"getHypotheses",
115 "getEnergyRaw",
"getEnergyHighestCrystal",
"getUncertaintyEnergy",
116 "getUncertaintyTheta",
"getUncertaintyPhi",
"getClusterPosition",
117 "getCovarianceMatrix3x3",
"getDetectorRegion",
"getUniqueId",
118 "isTriggerCluster",
"hasTriggerClusterMatching",
"hasPulseShapeDiscrimination",
119 "getPulseShapeDiscriminationMVA",
"getMaxECellId",
121 "getEnergy": [16, 32],
122 "hasHypothesis": [16, 32],
123 "getRelationsWith": [
"KlIds",
"MCParticles"],
125 DataStorePrinter(
"EventLevelClusteringInfo", [
126 "getNECLCalDigitsOutOfTimeFWD",
"getNECLCalDigitsOutOfTimeBarrel",
127 "getNECLCalDigitsOutOfTimeBWD",
"getNECLCalDigitsOutOfTime",
128 "getNECLShowersRejectedFWD",
"getNECLShowersRejectedBarrel",
129 "getNECLShowersRejectedBWD",
"getNECLShowersRejected"
131 DataStorePrinter(
"KLMCluster", [
132 "getTime",
"getLayers",
"getInnermostLayer",
133 "getClusterPosition",
"getPosition",
"getMomentumMag",
"getEnergy",
134 "getMomentum",
"getError4x4",
"getError7x7",
135 "getAssociatedEclClusterFlag",
"getAssociatedTrackFlag",
137 "getRelationsWith": [
"KlIds",
"MCParticles"],
139 DataStorePrinter(
"KlId", [
"isKLM",
"isECL",
"getKlId"]),
140 DataStorePrinter(
"TRGSummary", [
141 "getTimType",
"getTimQuality",
"isPoissonInInjectionVeto"
143 "getTRGSummary": range(10),
144 "getPreScale": [[int(i / 32), i % 32]
for i
in list(range(320))],
145 "getInputBits": range(10),
146 "getFtdlBits": range(10),
147 "getPsnmBits": range(10),
149 DataStorePrinter(
"SoftwareTriggerResult", [
"getResults",
"getNonPrescaledResults"], array=
False),
150 DataStorePrinter(
"MCParticle", [
151 "getPDG",
"getStatus",
"getMass",
"getCharge",
"getEnergy",
"hasValidVertex",
152 "getProductionTime",
"getDecayTime",
"getLifetime",
"getVertex",
153 "getProductionVertex",
"getMomentum",
"get4Vector",
"getDecayVertex",
154 "getIndex",
"getArrayIndex",
155 "getFirstDaughter",
"getLastDaughter",
"getDaughters",
"getNDaughters",
"getMother",
156 "getSecondaryPhysicsProcess",
"getSeenInDetector",
157 "isVirtual",
"isInitial",
"isPrimaryParticle",
"getName"
160 path.add_module(PrintObjectsModule(mdst_dataobjects, print_untested))