13 from ROOT.Belle2
import Const
18 'ECLClustersToTracksNamedBremsstrahlung',
19 'EventLevelClusteringInfo',
20 'EventLevelTrackingInfo',
21 'EventLevelTriggerTimeInfo',
25 'SoftwareTriggerResult',
37 additionalBranches=[],
41 Add the mDST output module to a path.
42 This function defines the mDST data format.
45 path (basf2.Path): Path to add module to
46 mc (bool): Save Monte Carlo quantities? (MCParticles and corresponding relations)
47 filename (str): Output file name.
48 additionalBranches (list): Additional objects/arrays of event durability to save
49 dataDescription (dict or None): Additional key->value pairs to be added as data description
50 fields to the output FileMetaData
52 branches = list(MDST_OBJECTS)
53 persistentBranches = [
'FileMetaData']
55 branches += [
'MCParticles']
56 persistentBranches += [
'BackgroundInfo']
57 branches += additionalBranches
59 if dataDescription
is None:
63 dataDescription.setdefault(
"dataLevel",
"mdst")
64 return path.add_module(
"RootOutput", outputFileName=filename, branchNames=branches,
65 branchNamesPersistent=persistentBranches, additionalDataDescription=dataDescription)
68 def add_mdst_dump(path, print_untested=False):
70 Add a PrintObjectsModule to a path for printing the mDST content.
73 path (basf2.Path): Path to add module to
74 print_untested (bool): If True print the names of all methods which are not
75 explicitly printed to make sure we don't miss addition of new members
79 pid_detectors = [Const.PIDDetectorSet(Const.PIDDetectors.c_set[index])
for index
in range(Const.PIDDetectors.c_size)]
80 charged_stables = [Const.ChargedStable(Const.chargedStableSet.at(index))
for index
in range(Const.chargedStableSet.size())]
85 DataStorePrinter(
"EventMetaData", [
86 "getErrorFlag",
"getEvent",
"getRun",
"getSubrun",
"getExperiment",
87 "getProduction",
"getTime",
"getParentLfn",
"getGeneratedWeight",
90 DataStorePrinter(
"Track", [
"getNumberOfFittedHypotheses",
"getQualityIndicator"], {
91 "getTrackFitResult": charged_stables,
92 "getTrackFitResultWithClosestMass": charged_stables,
93 "getRelationsWith": [
"ECLClusters",
"KLMClusters",
"MCParticles",
"PIDLikelihoods"],
95 DataStorePrinter(
"V0", [
"getTracks",
"getTrackFitResults",
"getV0Hypothesis"], {
96 "getRelationsWith": [
"MCParticles"],
98 DataStorePrinter(
"TrackFitResult", [
99 "getPosition",
"getMomentum",
"get4Momentum",
"getEnergy",
"getTransverseMomentum",
100 "getCovariance6",
"getParticleType",
"getChargeSign",
"getPValue",
"getD0",
"getPhi0",
101 "getPhi",
"getOmega",
"getZ0",
"getTanLambda",
"getCotTheta",
102 "getTau",
"getCov",
"getCovariance5",
"getHitPatternCDC",
"getHitPatternVXD",
"getNDF",
"getChi2"
104 DataStorePrinter(
"EventLevelTrackingInfo", [
105 "getNCDCHitsNotAssigned",
"getNCDCHitsNotAssignedPostCleaning",
106 "getNCDCSegments",
"getSVDFirstSampleTime",
"hasAnErrorFlag",
107 "hasUnspecifiedTrackFindingFailure",
"hasVXDTF2AbortionFlag",
108 "hasSVDCKFAbortionFlag",
"hasPXDCKFAbortionFlag",
"hasSVDSpacePointCreatorAbortionFlag"], {
109 "hasCDCLayer": range(56)
111 DataStorePrinter(
"PIDLikelihood", [
"getMostLikely"], {
112 "isAvailable": pid_detectors,
113 "getLogL": charged_stables,
114 "getProbability": charged_stables,
116 DataStorePrinter(
"ECLCluster", [
117 "isTrack",
"isNeutral",
"getStatus",
"getConnectedRegionId",
118 "getClusterId",
"getMinTrkDistance",
"getDeltaL",
119 "getAbsZernike40",
"getAbsZernike51",
"getZernikeMVA",
"getE1oE9",
120 "getE9oE21",
"getNumberOfHadronDigits",
"getR",
"getHypotheses",
121 "getSecondMoment",
"getLAT",
"getNumberOfCrystals",
"getTime",
122 "getDeltaTime99",
"hasFailedFitTime",
"hasFailedTimeResolution",
"getPhi",
"getTheta",
123 "getEnergyRaw",
"getEnergyHighestCrystal",
"getUncertaintyEnergy",
124 "getUncertaintyTheta",
"getUncertaintyPhi",
"getClusterPosition",
125 "getCovarianceMatrix3x3",
"getDetectorRegion",
126 "isTriggerCluster",
"hasTriggerClusterMatching",
"hasPulseShapeDiscrimination",
127 "getPulseShapeDiscriminationMVA",
"getMaxECellId",
"getMinTrkDistanceID"
129 "getEnergy": [16, 32],
130 "hasHypothesis": [16, 32],
131 "getRelationsWith": [
"KlIds",
"MCParticles"],
133 DataStorePrinter(
"EventLevelClusteringInfo", [
134 "getNECLCalDigitsOutOfTimeFWD",
"getNECLCalDigitsOutOfTimeBarrel",
135 "getNECLCalDigitsOutOfTimeBWD",
"getNECLCalDigitsOutOfTime",
136 "getNECLShowersRejectedFWD",
"getNECLShowersRejectedBarrel",
137 "getNECLShowersRejectedBWD",
"getNECLShowersRejected"
139 DataStorePrinter(
"KLMCluster", [
140 "getTime",
"getLayers",
"getInnermostLayer",
141 "getClusterPosition",
"getPosition",
"getMomentumMag",
"getEnergy",
142 "getMomentum",
"getError4x4",
"getError7x7",
143 "getAssociatedEclClusterFlag",
"getAssociatedTrackFlag",
145 "getRelationsWith": [
"KlIds",
"MCParticles"],
147 DataStorePrinter(
"KlId", [
"isKLM",
"isECL",
"getKlId"]),
148 DataStorePrinter(
"TRGSummary", [
150 "getTimType",
"getTimQuality",
"isPoissonInInjectionVeto"
153 "getTRGSummary": range(10),
154 "getPreScale": [[int(i / 32), i % 32]
for i
in list(range(320))],
155 "getInputBits": range(10),
156 "getFtdlBits": range(10),
157 "getPsnmBits": range(10)
159 DataStorePrinter(
"SoftwareTriggerResult", [
"getResults",
"getNonPrescaledResults"], array=
False),
160 DataStorePrinter(
"MCParticle", [
161 "getPDG",
"getStatus",
"getMass",
"getCharge",
"getEnergy",
"hasValidVertex",
162 "getProductionTime",
"getDecayTime",
"getLifetime",
"getVertex",
163 "getProductionVertex",
"getMomentum",
"get4Vector",
"getDecayVertex",
164 "getIndex",
"getArrayIndex",
165 "getFirstDaughter",
"getLastDaughter",
"getDaughters",
"getNDaughters",
"getMother",
166 "getSecondaryPhysicsProcess",
"getSeenInDetector",
167 "isVirtual",
"isInitial",
"isPrimaryParticle",
"getName"
169 DataStorePrinter(
"EventLevelTriggerTimeInfo", [
170 "isValid",
"hasInjection",
"isHER",
"isRevo2",
171 "getTimeSinceLastInjection",
"getTimeSincePrevTrigger",
"getBunchNumber",
172 "getTimeSinceLastInjectionInMicroSeconds",
"getTimeSincePrevTriggerInMicroSeconds",
173 "getTimeSinceInjectedBunch",
"getTimeSinceInjectedBunchInMicroSeconds",
"getTriggeredBunchNumberGlobal"
176 path.add_module(PrintObjectsModule(mdst_dataobjects, print_untested))