1. What’s New¶
This page explains the new features in the current release. This cannot cover all the changes in all packages but should help users to find out what needs to be adapted when changing to the new release.
Table of Contents
1.1. Changes since release-05¶
HepMCInput, HepevtInput and LHEInput modules do not anymore boost the MCParticles
The modules HepMCInput, HepevtInput and LHEInput do not anymore boost the MCParticles, and the
paramater boost2Lab is now removed from the modules. These modules can not read the BeamParameters
payloads from the conditions database, so having the particles boosted correctly and in a reproducible way was
non-trivial.
A new module, BoostMCParticles, is added for boosting into the laboratory frame the MCParticles using the
information stored in the conditions database. The module must be appended to the steering path just after the
HepMCInput, HepevtInput or LHEInput module and before running the detector simulation.
The jitter of the L1 trigger is included in the standard simulation
The L1 trigger jitter is randomly extracted from a double gaussian whose parameters have been tuned with 2020 data. The machine filling pattern is taken into account in the simulation of the jitter.
The L1 trigger simulation is included in simulation.add_simulation()
The L1 trigger simulation (tsim) is now executed in the standard simulation: before SVD and PXD simulation but
after the simulation of the rest of the subdetectors. For this reason, the python function add_tsim() is
deprecated. If you already have a add_simulation in your path, you already get L1 trigger simulation.
If you do not have add_simulation, and you need the L1 trigger simulation, please use
L1trigger.add_trigger_simulation().
Discontinue the support of the old “fullFormat” for cDSTs and extend the “rawFormat” cDSTs to MC
The support of the fullFormat cDSTs is discontinued. reconstruction.add_cdst_output() does not store
anymore additional branches when the option rawFormat=False is selected, being simply an alias of
mdst.add_mdst_output(). The users have to explicitly define the additional branches they want to store
using the additionalBranches paramenter.
The only supported format is the rawFormat, that is now extended to MC. If rawFormat=True and mc=False are
selected, the rawdata + tracking data objects are stored, while with rawFormat=True and mc=True the digits +
tracking data objects, including the MCParticles and the relations between them and the digits, are stored.
Removal of old and deprecated database functions
Some functions used in the past to handle the conditions database (like basf2.use_local_database or basf2.reset_database) are removed, and any script using them does not work anymore.
This removal does not imply any functionality loss, since the users can use the basf2.conditions object to properly configure the conditions database in their steering files (see also Configuring the Conditions Database).
Photons generated by PHOTOS in continuum events
Fixed the issue where PHOTOS photons were not correctly flagged in continuum events, e.g., charm decays (BII-5934).
This was present in release-05-00-01 and earlier, including MC13 files.
Unification of B2BII settings
A single switch between Belle and Belle II settings has been implemented, which is automatically set when reading in a Belle type mdst. No individual options have to be set in modular analysis functions.
1.1.1. Changes in the analysis package since release-05-02¶
Vertex Fitting¶
KFit has been extended to be able to handle vertex fits (with and without mass constraint) that involve an eta particle reconstructed in
eta -> gamma gamma.Added a method
scaleErrorin order to scale up helix errors and avoid underestimation of vertex error.Added a new fit-type option
massfourCto functionvertex.kFit(). The kinematic fit is performed with the 4 momentum constraint of a mother particle and mass constraints of intermediate particles specified by the optionmassConstraint, simultaneously.Changed the treatment of Bremsstrahlungs-corrected tracks in
vertex.treeFit. The previous implementation exhibited bad performance when a Bremsstrahlungs-photon is applied. The new implementation fits the corrected Track as a single particle, analogous to, what KFit does.
Variables¶
Variables
SoftwareTriggerResult,SoftwareTriggerResultNonPrescaledandSoftwareTriggerPrescalingnow silently return NAN if the trigger is not found.Warning
this no longer dumps all possible trigger names instead please see
b2hlt_triggersfor a list of all possible names.See also
b2hlt_triggers print --database online --format listVariables
recQ2Bh,recMissM2,recQ2BhSimplehave been moved to a new variable groupSpecific kinematic variables, andrecQ2Bhis now using a diamond frame methodAdded the new variable
photonHasOverlap, which determines whether a particle’s cluster is sharing its connected region with another cluster. A cut string can be provided to ignore cluster that do not satisfy the specified criteria.Variables
clusterThetaIDandclusterPhiIDhave both been added as a new variableEvent-based variables from
clustercollection have been moved into a newevent_level_clustercollection, collections of ROE and recoil variables have been expandedA few binary PID variables have been added to the PID variable collection.
Added a new variable
nROE_Compositesto count V0 particles in ROE.Added meta variables corresponding to existing variables that access the MC matched particles of given daughters
mcDaughterDiffOf,mcDaughterDiffOfPhi,mcDaughterDiffOfPhiCMS,mcDaughterAngle.Added the new variable
mcCosThetaBetweenParticleAndNominalB. This is an MC version ofcosThetaBetweenParticleAndNominalBin which all descendant neutrino momenta are subtracted from the B momentum during the calculation.Reinstated SVD for standard PID variables
electronID,muonID,pionID,kaonID,protonID. Temporarily, special ID variables that exclude the SVD information (pionID_noSVD,kaonID_noSVD, etc.) are kept so that analysts and performance experts can easily compare the effect.Added a new variable to clusters,
beamBackgroundProbabilityMVA, which uses shower shape variables to separate between true photons and beam backgrounds.Added
b2help-variableswhich behaves identical tobasf2 variables.pybut more in-keeping with theb2help-<something>theme.The variables
EventTypeandtrackMatchTypehave been declared deprecated. Instead the variablesisMCandclusterTrackMatchshould be used.New MCTruthVariable
isBBCrossfeedchecks for crossfeed in the reconstruction of the given B meson.Modified the
L1 Triggervariables (L1PSNM,L1PSNMBit, etc.) to returnNANinstead of0in case the requested trigger bit or number does not exist. These variables now return0only when the requested bit is not fired.Added new variables
L1TimeQualityandisPoissonTriggerInInjectionVetofor returning the L1 trigger time quality and the injection veto flag. Renamed the variableL1TimTypeintoL1TimeType.Added a new variable
minC2TDistIDand a metavariableminC2TDistVar, which allow to call any variable for the nearest track to a given photon.New variables have been added to classify the true decay mode of an event (e.g.
BplusModeandB0Mode). They serve as an alternative to the Topology analysis. Further information about the meaning of the variable values can be found in Generated decay modes.Added new variables
useParticleRestFrameanduseRecoilParticleRestFramefor computing variables in the rest frame of a given Particle (or in the rest frame of the recoiling system of a given Particle). If the ParticleList passed to these variables contains more than one Particle, only the first one in the list will be considered.Added new variables that are derived from the TriggerTimeDistribution (TTD), i.e. variables related to trigger and injections. So far, only available for actual data or if BGOverlay from data was used. The variables related to triggering are
timeSincePrevTriggerClockTicks(in 127MHz=RF/4) andtimeSincePrevTriggerMicroSeconds,triggeredBunchNumberTTD(bunch number as provided by TTD) andtriggeredBunchNumber(‘global’ bunch number of SKB). The variables related to injections arehasRecentInjection(to see if an injection actually happened recently),injectionInHER(injection in HER/LER), andtimeSinceLastInjectionSignalClockTicks(in 127MHz=RF/4) andtimeSinceLastInjectionSignalMicroSeconds(please note, there is an offset between this time of the injection pre-kick signal and the actual injection, which is also different for HER/LER). ‘Corrected’ variables taking this offset into account aretimeSinceLastInjectionClockTicks(in 127MHz=RF/4) andtimeSinceLastInjectionMicroSeconds. Finally,revolutionCounter2returns the lowest bit of the revolution counter (even or odd), which is mostly interesting for PXD (full read out of PXD takes about 2 revolutions).
Modules¶
Added a module
TrackIsoCalculator, which takes as input a standard charged particle list, and calculates for every particle’s track in the list the 3D distance to the closest track in the event. The distance is calculated as the 3D separation between the points where two extrapolated track helices cross a given detector’s inner surface, where the detector is an input parameter to the module. This variable can be used to parametrise charged particle identification efficiencies and mis-identification probabilities, as they can depend on the activity around each charged particle candidate.The
InclusiveDstarReconstructioncreates antiparticle lists correctly now. The module’s input changed to a DecayString of the formD* -> piand MC Matching is applicable (one can useisSignal).In
BtubeCreatormodule, functionality to apply a cut on the confidence level of the fit of fully reconstructed B to the beamspot is added.The
EventKinematicsmodule can now compute event kinematics using generated particles as an input.Arguments of
writePi0EtaVetohave been updated.downloadFlagandworkingDirectoryhave been removed since the download processes can be skipped. New arguments have been added for several reasons.suffixallows to calculate this veto for multiple photons.hardParticleallows to call this function for a given particle other than a photon. Four new arguments have been added to override the payload names and soft photon selections,pi0PayloadNameOverride,etaPayloadNameOverride,pi0SoftPhotonCutOverride, andetaSoftPhotonCutOverride.A new helper method
updateROEUsingV0Listshas been added to facilitate application of V0Finder results in Rest Of Event.Added a possibility to add a ROE mask for KLM-based particles and an experimental option of including KLM-based particles into ROE 4-vector computation.
Warning
The option
useKLMEnergyofRestOfEventBuildermodule is only meant for performance studies and NOT for a physics analysis.The
PrintMCParticlesmodule and thus also theprintMCParticlesfunction has a completely new layout that should be much easier to parse, especially for complicated events. By default it shows much less information but in an easier to parse tree representation. See the documentation ofprintMCParticlesfor details.The
ParticleLoadernow creates photon candidates from KLMCluster if the parameterloadPhotonsFromKLMis set to true. It is off by default.Warning
Photons from KLMCluster should only be used in specific use-cases and after a thorough study of their effect.
In
BtubeCreator, new extrainfoTubeB_p_estimatedwas added. This returns the magnitude of the estimated momentum of the B which should fly in the direction of the Btube.Added a module
HelixErrorScaler, which multiplies constant scaling factors to helix errors of input charged particles and stores them in a new list.In
ParticleStatsadd functionality to produce a json containing the information printed on stdout. Added also a tool b2plot-particleStats: Analyze a json produced by ParticleStats to produce plot of retention rate and pass matrix to analyze the json and produce some plots.The
TrackingMomentummodule has been extended. A ParticleList of composite particles can now be processed as well. In that case the momenta of all track-based daughter particles are scaled by the provided factor.The wrapper functions for the tracking systematics modules have been renamed from
trackingMomentumtoscaleTrackMomentaand fromtrackingEfficiencytoremoveTracksForTrackingEfficiencyCalculation.Added the
TauDecayModemodule, which is an actualization of theTauDecayMarkermodule for the new TauolaBelle decays. Using a txt file, which defines the mapping between decay strings and decay numbers from TauolaBelle, the module assigns a decay number for each tau in the event. This decay number is stored in the variablestauMinusMCModeandtauPlusMCMode. It’s possible to provide the path of a different txt file for the mapping as a parameter to the module.Added a
EnergyBiasCorrectionmodule, sub-percent correction only applied to E of photons not on clusterE and should only be applied on data.correctEnergyBiasis a corresponding wrapper function.The
ChargedPidMVAandChargedPidMVAMulticlassmodules now apply by default charge-dependent BDT training for particle identification. The charge-independent training can be used optionally.Added a
PhotonEfficiencySystematicsmodule which adds photon detection efficiency Data/MC ratios, systematic, statistical and total uncertainties as variables in extrainfo to a given photon list. Ratios can only added for particles in photon lists.addPhotonEfficiencyRatioVariablesis a corresponding wrapper function.Bug fixed in
FlavorTaggerInfoBuilderandFlavorTaggerInfoFiller: FlavorTaggerInfoMap is created now in the builder to make it accessible in main paths outside the ROE loops. This permits now to save the FT outputs for everyB-meson candidate.
Full Event Interpretation¶
Added option to reconstruct strange B mesons (at Y(5S)) in 51 decay channels. Can be switched on with the
strangeBflag infei.get_default_channels().The FEI has been retrained with MC14 and release-05. The prefix
FEIv4_2021_MC14_release_05_01_12has to be set in the FEI configuration.
Standard Particle Lists¶
The selection criteria of the pi0 standard particle lists have been updated from the January 2020 to the May 2020 recommendations.
Defined new
stdCharged.stdEandstdCharged.stdMulepton lists, based on uniform target efficiency selection working points. Available both for likelihood-ratio based PID selection and new BDT-based selection, both global and binary (\(\ell\) vs. \(\pi\)). These are recommended for analysis once correction factors payloads become available.
1.1.2. Changes in the analysis package since release-05-01¶
Variables¶
Added
b2help-variableswhich behaves identical tobasf2 variables.pybut more in-keeping with theb2help-<something>theme.
Full Event Interpretation¶
Background sampling for \(B^{0} \rightarrow J/\psi K_{S}^{0}\) and \(B^{+} \rightarrow J/\psi K^{+}\) are deactivated.
The baryonic tagging modes are activated by default.
1.1.3. Changes in the analysis package since release-05-00¶
Bremsstrahlung correction¶
Fixed that the copies of particles to which Bremsstrahlung was applied (whether this resulted in a added photon or not) are considered as sources of tracks. This allows to update the daughters in vertex fits that involve brems-corrected particles.
Variables¶
Variable
TagVmcLBoostrenamed tomcTagVLBoostand variableTagVmcOBoostrenamed tomcTagVOBoostVariable
mcDeltaLrenamed tomcDeltaBoostas it represents mc-truth version ofDeltaBoostvariableAdded variables to get track information of V0 daughters from TrackFitResult in V0 objects:
v0DaughterNCDCHits,v0DaughterNSVDHits,v0DaughterNPXDHits,v0DaughterNVXDHits,v0DaughterFirstSVDLayer,v0DaughterFirstPXDLayer,v0DaughterFirstCDCLayer,v0DaughterLastCDCLayer,v0DaughterPValue,v0DaughterD0,v0DaughterPhi0,v0DaughterOmega,v0DaughterZ0,v0DaughterTanLambda,v0DaughterD0Error,v0DaughterPhi0Error,v0DaughterOmegaError,v0DaughterZ0Error,v0DaughterTanLambdaError,v0DaughterD0PullWithTrueVertexAsPivot,v0DaughterPhi0PullWithTrueVertexAsPivot,v0DaughterOmegaPullWithTrueVertexAsPivot,v0DaughterZ0PullWithTrueVertexAsPivot,v0DaughterTanLambdaPullWithTrueVertexAsPivot,v0DaughterD0PullWithOriginAsPivot,v0DaughterPhi0PullWithOriginAsPivot,v0DaughterOmegaPullWithOriginAsPivot,v0DaughterZ0PullWithOriginAsPivot,v0DaughterTanLambdaPullWithOriginAsPivot,v0DaughterTau,v0DaughterCovin a new variable groupV0Daughter. These variables can also be used for the V0s from reconstructDecay, but the information are taken from the TrackFitResult of daughters.Added new generated event kinematics variables
genMissingMass2OfEvent,genMissingEnergyOfEventCMS,genMissingMomentumOfEventCMS,genTotalPhotonsEnergyOfEvent,genVisibleEnergyOfEventCMSand a corresponding collectionmc_event_kinematics.Fixed the variable
isDescendantOfList, which did not work if the ParticleLoader was used to fill a ParticleList with descendants of an existing list or exclude them.Added new B2BII variables for the first and last hit position in the tracking system
BelleFirstCDCHitX,BelleLastCDCHitX, etc. and a new variable collectionbelle_track_hit.Added new variables
ndfandchi2to return track NDF and Chi2Added new variable
YAnglecontaining value of the vertical beam crossing angle (in the y-z plane) in the MCAdded the variable
particleSource, which returns the mdst source, i.e. whether the particle was created from a track, an ECL cluster, or a KLM cluster, is a V0 object, an MC particle, or a composite particle.Exclude SVD from definition of standard global and binary PID variables (like
electronID,pionIDetc.). This change is introduced because physical SVD PDFs are available only for some particle hypotheses, but not for others yet.Added the variable
binaryPID, which takes two PID codes as arguments and calculates the binary PID between them.Hint
The hadron PID group recommends to try out the binary PID in analyses and compare the performance with the global PID.
Modules¶
Added the new wrapper function
applyRandomCandidateSelection, which uses theBestCandidateSelectionmodule to reduce the number of candidates in the input particle list to one candidate per event based on a random value.In
TagVertex, all charged particles from the ROE are loaded to be included in the tag vertex fit (and not only those with a pion hypothesis)The
ParticleCombinerFromMCand thereconstructMCDecayfunction can set decayModeID extraInfo with an argumentdmID. One can decide whether charge conjugated mode should be reconstructed with new boolean argumentchargeConjugation(true by default).The special treatment of MCMatching for the tau-decay is fixed. The treatment was working fine in release-04, but it was broken in the release-05.
1.1.4. Changes in the framework package since release-05-01¶
Added
b2help-moduleswhich behaves identical tobasf2 -mbut more in-keeping with theb2help-<something>theme.
Conditions Database¶
The format in which local database payloads are created has changed slightly, see Creation of new payloads
b2conditionsdb-tag-mergehas been added to merge a number of globaltags into a single globaltag in the order they are given. The result is equivalent to having multiple globaltags setup in the conditions access for basf2.b2conditionsdb-tag-runningupdatehas been added to calculate and apply the necessary updates to a running globaltag with a given staging globaltag.b2conditionsdb-downloadhas learned a new argument to clean all payload files not mentioned in the database file from the download area.
Tools¶
Added
b2rundb-queryto perform simple rundb queries from the command line.
Python Interface¶
The
ANSIColorsclass has been added to the moduleterminal_utilsto very easily add color output to the terminal.Added a
RunDBclass which makes writing scripts using the rundb more straightforward.
1.2. Changes since release-04¶
Neutral hadrons from ECLClusters get momentum from the cluster energy
Since release-04 it has been possible to load ECLClusters under the neutral hadron hypothesis.
Previously we assumed a mass when calculating the particle momentum, however this leads to problems when, for example, a \(K_L^0\) deposits less than its mass energy in the ECL. This happens about 50% of the time.
The momentum of neutral hadrons from the ECL is now set to the clusterE.
Bremsstrahlung correction
The BremsFinder module has been developed to find relations between tracks
and photons that are likely to have been emitted by these tracks via
Bremsstrahlung. The matching quality figure of merit is based on the angular
distance between the photon ECL cluster and the extrapolated hit position of
the track at the ECL. The function correctBrems performs the actual
correction. There is also a reimplementation of Belle’s Bremsstrahlung
correction approach of looking for photons in a cone around tracks
(correctBremsBelle), which is recommended for b2bii analyses.
Warning
While it is technically possible to perform a TreeFit after applying Bremsstrahlung correction, the fit performance is unfortunately quite bad. However, there is already an improvement in the pipeline that should fix this issue. It will probably be available in one of the next light releases.
MC reconstruction and MC matching
The ParticleCombinerFromMC module and its corresponding wrapper
function reconstructMCDecay should be used instead of findMCDecay to
reconstruct decay modes based on MC information.
The DecayStringGrammar has been extended with new exception markers for Bremsstrahlung, decay in flight, and misidentification.
Exceptions for the MC matching of daughter particles with the DecayStringGrammar are propagated to the mother particle.
Redefinition of angle variables
The kinematic variables decayAngle, daughterAngle and
pointingAngle now return the angle instead of its cosine.
Protection of ParticleLists and particle combinations
It is no longer allowed to use the label "all" for a particle list if a
cut is applied. Reconstructed decays need to preserve electric charge.
However, this can be deactivated if you know what you are doing, e.g. in
searches for New Physics.
1.2.1. Changes in the analysis package since release-04-02¶
Warning
Global includes like
from basf2 import *are almost completely removed from the analysis package.
Vertex Fitting¶
Warning
The convenience function for the
TreeFittermodule has been renamed fromvertexTreetovertex.treeFit().Warning
The KFit convenience functions have been merged to the new function
vertex.kFit(). One of its input arguments isfit_type, which specifies whether you want to perform a mass fit (fit_type=mass), a vertex fit (fit_type=vertex), a mass-constrained vertex fit (fit_type=massvertex), or a vertex fit with the mother constrained to the beam four-momentum (fit_type=fourC).
Added
smearingparameter tovertex.kFit. When you perform a vertex fit with an IP tube constraint (fit_type=vertexandconstraint=iptube), the IP profile is smeared by the given value. The IP tube is defined by a neutral track pointing towards the boost direction starting from the smeared IP profile. Settingsmearing=0gives the originaliptubeoption, which is an elongated ellipsoid in boost direction.Fixed TreeFitter bias on V0s by propagating the correct TrackFitResult from V0 daughters (see BII-6336).
Added
FeedthroughParticleandInternalTracktovertex.treeFit. This now provides compatibility of TreeFitter with the bremsstrahlung recovery modules. In principle, TreeFitter can now be used for decays for which Bremsstrahlung correction has been applied. However, there are massive performance issues. Do not blindly use TreeFit but cross-check your results with KFit. Further improvements are planned.
Standard Particle Lists¶
The list label
"all"is now forbidden from use with cuts. This can introduce some very subtle bugs in user scripts. The following code will no longer work:fillParticleList("gamma:all", "clusterE > 0.02", path=mypath)Instead you should replace it with a meaningful name of your choice. For example:
fillParticleList("gamma:myMinimumThresholdList", "clusterE > 0.02", path=mypath)Added stdHyperons.py, this analysis script reconstructs the standard hyperons Xi-, Xi0, and Omega-.
The default vertex fitter for the V0 lists
stdKshortsandstdLambdashas been changed fromRavetoTreeFit. However, a new option calledfitterhas been added that allows to change the vertex fitter back toraveFitor tokFit. This change is motivated by a much faster execution time (see BII-5699) and a compatible performance as summarized here.Added a new standard list
stdCharged.stdMostLikelywhich creates 5 mutually-exclusive lists of track-based particles under their most likely hypothesis.Moved the KlId check from
ParticleLoadertostdKlongs. This modification does not change the definition of theK_L0:alllist and, in general, of the user-defined \(K_{L}^0\) lists.Removed the functions
mergedKshortsandmergedLambdas, which returned the standard V0 lists anyway.Removed the deprecated pi0 lists
pi0:looseandpi0:veryloosestdPi0s and stdPhotons updated to match Jan2020 recommendations. Naming scheme updated to indicate date of optimization.
Variables¶
Note
All variables will return a quietNaN instead of -999 or other out-of-the-sky numbers in case of errors. To study the failures use the meta variable
ifNANgiveX, which replaces nan with a value of your choice.Warning
The variables
decayAngle,daughterAngleandpointingAnglenow return an angle instead of a cosine.
Renamed
mcDX,mcDY,mcDZ, andmcDRhotomcDecayVertexFromIPX,mcDecayVertexFromIPY,mcDecayVertexFromIPZ, andmcDecayVertexFromIPRho.Renamed
mdstSourcetouniqueParticleIdentifier.Renamed
MCDeltaTtomcDeltaTRenamed
mcX,mcY,mcZ, andmcRhotomcDecayVertexX,mcDecayVertexY,mcDecayVertexZ, andmcDecayVertexRho.Renamed
mcProdVertexX,mcProdVertexY, andmcProdVertexZtomcProductionVertexX,mcProductionVertexY, andmcProductionVertexZ.Renamed
mcProdVertexDX,mcProdVertexDY, andmcProdVertexDZtomcProductionVertexFromIPX,mcProductionVertexFromIPY, andmcProductionVertexFromIPZ.Renamed
mcDistancetomcDecayVertexFromIPDistance.Added
varForFirstMCAncestorOfTypevariable that returns requested variable of the first gen-level ancestor of the given type.Now vertex variables
dr, dx, dy, dz, dphi, dcosTheta...take into account the nontrivial transformation of track parameters relative to IP when used for tracks.drdid not center at zero before and now it does.Added
isDescendantOfListandisMCDescendantOfListmeta variables that allow to check whether the particle is the descendant of the list (or if it is matched to the descendant of the list) at any generation. The variables have recursive search inside, they extendisDaughterOfListandisGrandDaughterOfList.Renamed some Rest Of Event variables for consistency across the
VariableManager. Variables startingWE_XXX,ROE_XXX, andRec_XXXare nowweXXX,roeXXX, andrecXXX. For exampleROE_deltaeis nowroeDeltae.Fixed calculation of
cosHelicityAngleMomentumfor decays with bremscorrected electronsFixed
clusterEoPfor particles with Bremsstrahlung correction by adding the energy of the added photon(s)Added
isSignalAcceptBremsPhotonsto ignore any reconstructed brems photons.Note
This is not the generator-level match (see BII-5741) but simply ignores photons added by the
BremsFinder.
Added
useTagSideRecoilRestFrame, which allows variables to be calculated in the rest frame recoiling against the tag side B meson. This variable is intended to be used on Upsilon(4S) particle lists only. The variable gives access to the signal B rest frame in semi-leptonic decays, where the four momentum of the signal B can not be entirely reconstructed due to the presence of neutrinos in the decay.Added new variables for fully-inclusive analysis:
nDaughterPhotons,nDaughterChargedetc., which allow to count specific daughters easily, anddaughterAverageOf, which is similar to thedaughterSumOf, but outputs the mean value of a variable.Fixed
goodBelleKshort, now it returnsextraInfo(goodKs)if the variable exists.Added two new variables
pidMostLikelyPDGwhich is the PDG code of the most likely hypothesis for this track, andpidIsMostLikelywhich returns true if the particle is under its most likely hypothesis.Added PID prior hypothesis to the
pidMostLikelyPDGand thepidIsMostLikelyvariables.Added several variables that related to the quality of the tag B vertex fit and the tracks used in that fit:
TagVNFitTracks,TagVDistanceToConstraint,TagVDistanceToConstraintErr,TagTrackMomentumX,TagTrackMomentumX,TagTrackMomentumZ,TagTrackRaveWeight,TagTrackDistanceToConstraint,TagTrackDistanceToConstraintErr,TagTrackDistanceToTagV,TagTrackDistanceToTagVErr,TagTrackTrueDistanceToTagV. Meta-variables can be used to compute the average, weighted average, min or max of these variables, e.g. by doingTagTrackAverage(TagTrackTrueDistanceToTagV)Added
mcDeltaLdescribing the true distance between Sig and Tag vertices in the Y(4S) boost directionAdded
mcDeltaTapproxto getmcDeltaTin the kinematic approximation, i.e. based onmcDeltaLvariableAdded
pidChargedBDTScoreandpidPairChargedBDTScorefor global and binary BDT-based charged particle identification, respectively. Require booking theChargedPidMVAMulticlass(ChargedPidMVA) module in the path.Bug fix for the
isCloneTrackvariable. Antiparticles have been falsely classified which is now fixed (see BII-5973)Added
isChargedBEventandisUnmixedBEventvariablesThe variables
daughterAngleanddaughterAngleInBetweenhave been merged using the name of the former but the extended functionality of the latter.Removed the variable
SigMBF, which was supposed to return the mass significance before a vertex fit but was only a pseudo-significance.Hint
It is recommended to use
variablesToExtraInfoprior to a vertex fit to access pre-fit values, not only for mass significances but also for vertex positions, etc.
Fixed truth kinematic variables (
mcPX,mcPY, …) to respect the current reference frame, so that they can be accessed not only in the lab frame but for example as well in the CMS frame usinguseCMSFrame.Extended functionality of recoil kinematics variables (
pxRecoil,pyRecoil, …) to be usable with any requested frame.Added
isFromV0to identify particles that come from tracking-level V0’s (as opposed to those created at analysis-level usingmodularAnalysis.reconstructDecay).Removed
isExtendedSignalwhose exact behavior is mirrored byisSignalAcceptWrongFSPs.Added the new variable collection
event_kinematicswhich contains all variables available after running theEventKinematicsmodule.Added
unmask, which unmasks certain indicated bits in a variable (set certain bits in a variable to zero).Added a new variable util
create_isSignal_aliaswhich creates customizedisSignal, accepting certain match errors.Removed the previously deprecated variable
clusterHypothesis.Added
firstCDCLayer, returns the ID of the CDC layer closest to the IP with a hit attributed to the particles trackAdded the new variable collection
cluster_average. It contains the cluster variables that can only be executed for particles with daughters, currentlymaxWeightedDistanceFromAverageECLTimeandweightedAverageECLTime.Added a variable for TDCPV resolution study
DeltaTResand legacy BelleDeltaTBelle.Clarified the documentation of the measured interaction point variables (
IPXff).
Modules¶
When merging ParticleLists using the
ParticleListManipulator(modularAnalysis.copyLists) duplicates (not multiple candidates) are removed on a first-come, first-served basis, i.e. the order of the input particles matters. Now, the new parametervariablecan be provided to determine which duplicate should be preferred. The logic is the same as for theBestCandidateSelectionmodule. Furthermore, duplicates, which differ only by the order of their daughter particles, are now identified.The
ParticleLoadercan create neutron particle lists now. ECL cluster with the hadron hypothesis as well as KLM cluster are used as source.Tweaks to the
ParticleLoaderfor how it creates particles from V0s, it now preserves the link to the mdst object. These changes are all under-the-hood and require no actions by users.In
TreeFitterbugfix in mass constraint: chi2 correctly calculated now.In
TreeFitterchange of initialisation values increases performance in all fits with tracks.In
TreeFittermax iterations set to 100, increases efficiency slightly in many cases.Removed module
CreateBsigFromFullRecoBtagIn BtubeCreator module, functionality to associate Btube to user’s chosen B is added.
Removed module
FSRCorrectionin favour ofBremsFinderandBelleBremRecovery.In
ChargedPidMVAmodule, remove handling of particle list modified by the removedFSRCorrectionmodule.In
ChargedPidMVAmodule, apply MVA category cuts retrieved from the DB payload.Added
ChargedPidMVAMulticlassmodule to allow performing global PID (one-vs-rest), using an MVA trained in multi-class mode.Added a
BremsFinderto unpack the bremsstrahlung relations provided by tracking.Hint
This tool is the recommended way to correct for bremsstrahlung photons in Belle II analyses.
Modified
writePi0EtaVetofunction and addedoldwritePi0EtaVetofunction. The weight files used in release-03 were not available in release-04. The latter uses old weight files optimized with MC9, while new weight files, which are optimized with MC12, are used inwritePi0EtaVetoEnabled to select daughters which will be used to perform fitting with KFit. One can use the selector
^to select daughters.KFit can be used to fit vertices of fully-inclusive particles, for which it ignores the daughters without defined p-value.
RestOfEventBuilder,EventKinematicsandEventShapeCalculatormodules can use most likely charged particle hypothesis according to PID information.Added the
ParticleCombinerFromMCmodule and thereconstructMCDecayto find and createParticleListfrom a given DecayString. They can be used instead of theMCDecayFinderandfindMCDecaywhich are not fully tested and maintained.In
TagVertexadded Btube as a possible constraint for the tag B vertex fit. TheuseFitAlgorithmparameter in the module is replaced byconstraintType(which can be set totube) andtrackFindingType. All computations done in the module are now using double precision. The module is also updated to allow for the computations of new variables related to the tracks used in the tag vertex fit.Added a
InclusiveDstarReconstructionto inclusively reconstruct D* mesons by estimating the four vector using slow pions.In the
TagVfunction, added the possibility to use KFit instead of Rave to perform the tag vertex fit.Both flavor taggers support ROE masks. Added new maskName argument.
Added new DecayString grammar for
c_AddedRecoBremsPhoton,c_DecayInFlight, andc_MisID. If one uses?addbremsin own DecayString,c_AddedRecoBremsPhotonis ignored, thusisSignalworks asisSignalAcceptBremsPhotons. One can add(decay)and/or(misID)to the beginning of the particle name to acceptc_DecayInFlightand/orc_MisID. The following is an example,'reconstructDecay('D0:sig -> (misID)K-:loose (decay)pi+:loose', '', path=mypath)'Modified
modularAnalysis.matchMCTruthto work always recursively. Once one callsmodularAnalysis.matchMCTruthfor a particle, the MC Matching is done for not only the particle but also all daughters of the particle correctly. This modification does not change the MC Matching of the particle for whichmodularAnalysis.matchMCTruthis called.Added feature to add multiple TTrees to the same output file via the
VariablesToEventBasedTreemodule.Rest Of Event can be created using MCParticles using
modularAnalysis.buildRestOfEventFromMCRemoved
-->,=>, and==>from the list of allowed arrow types for the DecayString.In
TagVertexmodule, added the possibility to use the truth information from the tag particles in the vertex fit. The optionuseTruthInFit = Trueswitches that on.In
TagVertexmodule, implemented an internal change: tag particles are loaded asParticleobject from theROEand not anymore asTrackFitResult. This should have no effect to users.Added a warning to the
ParticleCombinermodule for decay strings violating electric charge conservation which can be turned off by settingallowChargeViolation=True.In
TagVertexmodule, added the possibility to perform vertex fit with the tag particle tracks rolled back to their primary vertex points. The optionuseRollBack = Trueswitches that on.Added an argument to the
ParticleCombinermodule that allows to deactivate the automatic reconstruction of the charge-conjugated mode. InreconstructDecaythe option is calledchargeConjugation, which isTrueby default.The MC matching with the DecayString properly works in hierarchical decay. For example,
from modularAnalysis import reconstructDecay, matchMCTruth reconstructDecay('B0:signal -> mu+ mu- ... ?gamma', '', path=mypath) reconstructDecay('B0:generic -> D*-:Dpi pi+:all', '', path=mypath) reconstructDecay('Upsilon(4S):BB -> B0:generic B0:signal', '', path=mypath) matchMCTruth('Upsilon(4S)', path=mypath)In the above case, missing daughters (massive FSP and gamma) of
B0:signalare accepted for not onlyB0:signalbut alsoUpsilon(4S), so thatisSignalcan be 1. Another example,reconstructDecay('D-:pipi0 -> pi-:all pi0:all', '', path=mypath) reconstructDecay('B0:Dpi -> D-:pipi0 pi+:all ...', '', path=mypath) matchMCTruth('B0:Dpi', path=mypath)In this case, one wants to accept missing massive daughters in
B0:Dpidecay but not inD-:pipi0decay. So, if the decay ofD-:pipi0in the MC truth level isD- -> pi+ pi- pi- pi0,isSignalofD-:pipi0andB0:Dpiwill be 0, since there are missing daughters inD-:pipi0decay. If one wants to accept missing daughters inD-:pipi0, please use the DecayString grammar in the reconstruction ofD-:pipi0or useisSignalAcceptMissingvariable instead ofisSignal.
Utilities and core objects¶
A set of functions
DistanceToolshas been added to compute distances between (straight) tracks and vertices.Added a relation between Track-based Particles and TrackFitResults.
Added a
getTrackFitResultmethod to Particle.Added a function to retrieve electric charge of a particle based on its pdg code.
Added a
RotationTools.hfile with few functions related to rotation
Tutorials and Examples¶
Added a tutorial about creating aliases (
examples/VariableManager/variableAliases.py)
1.2.2. Changes in the analysis package since release-04-00¶
Variables¶
Now vertex variables
dr, dx, dy, dz, dphi, dcosTheta...take into account the nontrivial transformation of track parameters relative to IP when used for tracks.drdid not center at zero before and now it does.Added
isDescendantOfListandisMCDescendantOfListmeta variables that allow to check whether the particle is the descendant of the list (or if it is matched to the descendant of the list) at any generation. The variables have recursive search inside, they extendisDaughterOfListandisGrandDaughterOfList.Added
mcParticleIsInMCListwhich checks the underlying MC particles (either matched or generator level).Fixed bug and renamed
mcFlavorOfOtherB0variable tomcFlavorOfOtherB, which accepts now neutral and charged B candidates.Removed
clusterCRIDwhich duplicatesclusterConnectedRegionID.Fixed
goodBelleLambdaand now it returnsextraInfo(goodLambda)on Belle data.Allow use of meta variables in creation of aliases by replacing non alphanumeric characters with underscores in the alias name
Modified
daughterAngleto accept generalized variable indices instead of simple indices. A generalized index is a column-separated string of daughter indexes belonging to different generations, starting from the root particle. For example,0:2:1indicates the second daughter (0) of the third daughter (2) of the first daughter (0) of the particle. Of course, conventional indexes are still working as expected:1still indicates the second daughter of the particle.Added
daughterCombination, that returns a variable calculated on the sum of an arbitrary number of daughters. Generalized indexes are supported. This variable is mostly intended to calculate the invariant mass or the recoil mass of any set of particles belonging to a decay tree.Fixed
isSignal, which always acceptedc_MissingResonanceandc_MissFSR/c_MissPHOTOSeven if one used=direct=>,=norad=>, or=exact=>. Now it correctly respects the decay string grammar. The other isSignal* variables, such asisSignalAcceptMissing, are also fixed.Added
useAlternativeDaughterHypothesis, that returns a variable re-calculated using alternative mass assumptions for the particle’s daughters.Restructured the
mc_flight_infocollection by removing the non-sense error variables and replacingmc_flightTimeandmc_flightDistance, which were aliases created usingmatchedMC, with the dedicated variablesmcFlightTimeandmcFlightDistance, respectively.Removed
output_variableoption in the Deep Flavor Tagger and introduced a standard variableDNN_qrCombinedfor the output. The new variable returns the flavor times the dilution factor as the category-based Flavor Tagger output variablesFBDT_qrCombinedandFANN_qrCombineddo. Now we can evaluate the output of both taggers in the same way.Bug fix to guard against range exceptions in
KSFWVariables(see BII-6138).
Modules¶
In
TreeFitterfixed a bug in life time calculation. A constant in the jacobian was missing. As a result the propagated error was slightly overestimated.Fix to nested RestOfEvent objects (see BII-5649)
Fixed bugs in
MCDecayFinderandfindMCDecay. Inefficiency and large background when one used=direct=>or sub-decay such asD*+ -> [D0 -> pi+ pi- pi0] pi+are fixed. But still the module has some bugs if one uses K_S0.
Conditions DB¶
In
ChargedPidMVAWeightspayload class, added MVA category cut strings in basf2-compliant format.
Full Event Interpretation¶
Addition of hadronic FEI channels involving baryons. This includes the addition to default channels the following particles: p, Lambda_c+, Sigma+ and Lambda0. Baryonic modes must be switched on when calling particles = fei.get_default_channels(baryonic = True) using a flag (baryonic = True).
1.2.3. Changes in the framework package since release-04-00-00¶
Conditions Database¶
b2conditionsdb: Conditions DB interface has been optimized to work with larger globaltags.
b2conditionsdb-diffandb2conditionsdb-iovby default don’t show any database internal ids anymore but those can be re-enabled with--show-idsb2conditionsdb-dumphas learned a new argument to show the content of a payload valid for a given run in a given globaltagThere are new python classes to handle iovs, see
conditions_db.iov
Logging¶
Added support to escape newlines in all log messages by setting
logging.enable_escape_newlines.Added support to suppress messages if they repeated for a certain number of times. This is disabled by default but can be enabled with
logging.max_repetitions.
Miscellaneous¶
Added support for writing
udstfiles as output from BGxN N>0 files in light releases (see BII-3622). This means skimming is fully supported with a light release.Added support for b2bii in light releases. However, this comes at the cost of no longer being able to convert ExtHits and ECLHits.
The
RootInputwill now by default skip events which have an error flag set. This can be changed with thediscardErrorEventsparameter.Added the function
basf2.get_file_metadatato quickly obtain the FileMetaData object of a given basf2 output file.Added the tools
b2code-sphinx-buildandb2code-sphinx-warningsto build the sphinx documentation or check for warnings when building the documentation.
1.2.4. Changes in the decfiles package since release-04-02¶
Note
The decfiles directory was part of the analysis package until release-03-02. For documentation on earlier changes, please refer to the comments at the top of DECAY_BELLE2.DEC.
Changes to DECAY_BELLE2.DEC¶
Note
All changes listed below are documented in BELLE2-NOTE-PH-2020-008 - please refer to this note for a more detailed and specific description of updates.
Updates to charm hadron decays
Substantial changes to D0, anti-D0, D+, D-, D_s+, and D_s- decay tables
Changes to charm baryon decay tables
Other updates
Added decay table for sigma_0 particle, previously missing from decay file
1.2.5. Changes in the b2bii package since release-04-01¶
Warning
b2biiConversion.setupB2BIIDatabase()will be deprecated soon.
convertBelleMdstToBelleIIMdst¶
Added a switch to deactivate
nisKsFinder.Renamed
applyHadronBJSkimtoapplySkim, and added switches to deactivateHadronAandHadronBskims.Added a switch to deactivate converting
RecTrg_Summary3table.
Conversion¶
Removed
convertECLCrystalEnergies()andconvertExtHits()in the conversion.Added mass-constraint fit information of
pi0:mdst, including chiSquared, ndf and pValue asextraInfo().Added
m_final(3)inRecTrg_Summary3table aseventExtraInfo(rectrg_summary3_m_final).
1.3. Changes since release-03¶
Removal of default analysis path and NtupleTools
Warning
The default path (”analysis_main”) and the NtupleTools are now removed.
This is a major backward-compatibility breaking change.
Please update your user scripts to create your own path (basf2.create_path) and to use the variable manager tools (such as VariablesToNtuple).
If your previously working example script from release-03 looked something like this:
from basf2 import *
from stdCharged import stdPi
from modularAnalysis import *
stdPi("good")
ntupleFile("myFile.root") # <-- now removed
ntupleTree("pi+:good", ['pi+', 'Momentum']) # <-- now removed
process(analysis_main)
print(statistics)
You should update it to this:
import basf2 # better not to import all
from stdCharged import stdPi
from modularAnalysis import variablesToNtuple
mypath = basf2.Path() # create your own path (call it what you like)
stdPi("good", path=mypath)
variablesToNtuple("pi+:good", ['px', 'py', 'pz', 'E'], path=mypath)
basf2.process(mypath)
print(basf2.statistics)
See also
The example scripts available here:
$BELLE2_RELEASE_DIR/analysis/examples/VariableManager
Switch of beam spot information from nominal to measured values.
The interaction point position and its uncertainties are now taken from the database with values provided by the tracking group. All beam kinematics information is also moved to the database, which will eventually be measured on data. For now they are the values provided by the accelerator.
Warning
The previous definition of the boost included a small rotation to align it with the HER. This is no longer possible with the new structure. The definition of CMS is therefore slightly changed. The impact should be at the percent level.
If you have a physics analysis sensitive to this change: please discuss with the software / performance groups and add a comment to BII-4360.
Note
As a consequence of this, there is now a difference between the variables
( dx, dy, dz ) compared to ( x, y, z );
and similarly for variables ( mcDecayVertexX, mcDecayVertexY, mcDecayVertexZ ) compared to ( mcDecayVertexFromIPX, mcDecayVertexFromIPY and mcDecayVertexFromIPZ ).
Redesign of the Conditions Database Interface
The configuration and handling of the connection to the conditions database has been completely rewritten in a more coherent and modular way. We now have a new and consistent configuration interface, global tag replay and advanced checks: If users specify a global tag to be used which is either marked as invalid in the database or which cannot be found in the database the processing is now aborted. See Conditions Database Overview for details.
Restrict usage of useDB=False for Geometry creation
Creating the geometry from XML files instead of the configuration in the
Database may lead to wrong results. So while the option useDB=False is
still necessary to debug changes to the geometry definitions it is now
restricted to only be used for exp, run = 0, 0 to protect users from
mistakes.
This also changes the behavior of add_simulation() and add_reconstruction(): If a list of components is provided this
will now only change the digitization or reconstruction setup but will always
use the full geometry from the database.
Loading ECLClusters under multiple hypotheses
It is now possible to load \(K_L^0\) particles from clusters in the ECL.
This has several important consequences for the creation of particles and using combinations containing \(K_L^0\) s or other neutral hadrons in the analysis package.
This is handled correctly by the ParticleLoader and ParticleCombiner (the corresponding convenience functions are modularAnalysis.fillParticleList and modularAnalysis.reconstructDecay).
Essentially: it is forbidden from now onwards for any other analysis modules to create particles.
Deprecated RAVE for analysis use
The (external) RAVE vertex fitter is not maintained. Its use in analysis is therefore deprecated. We do not expect to remove it, but do not recommend its use for any real physics analyses other than benchmarking or legacy studies.
Instead we recommend you use either KFit (vertex.kFit) for fast/simple fits, or TreeFit (vertex.treeFit) for more complex fits and fitting the full decay chain.
Please check the Tree Fitter pages for details about the constraints available.
If you are unable to use TreeFitter because of missing functionality, please submit a feature request!
Warning
The default fitter for vertex.fitVertex has been changed to KFit.
Tidy up and rename of Helicity variables.
Renamed helicity variables in the VariableManager following consistent logic.
We added the new variable cosAcoplanarityAngle.
Warning
cosHelicityAngle is now cosHelicityAngleMomentum, and cosHelicityAngle has a new definition (as in the PDG 2018, p. 722).
Old name |
New name |
|---|---|
|
|
|
|
|
New DecayStringGrammar for custom MCMatching
Users can use new DecayStringGrammar to set properties of the MCMatching. Then isSignal, mcErrors and other MCTruthVariables behave according to the property.
Once DecayStringGrammar is used with reconstructDecay, users can use isSignal instead of several specific variables such as isSignalAcceptMissingNeutrino.
If one doesn’t use any new DecayStringGrammar, all MCTruthVariables work same as before.
The grammar is useful to analyze inclusive processes with both fully-inclusive-method and sum-of-exclusive-method.
There are also new helper functions genNMissingDaughter and genNStepsToDaughter to obtain the detailed MC information.
You can find examples of usage in Marker of unspecified particle, Grammar for custom MCMatching.
1.3.1. Changes in the analysis package¶
TreeFitter¶
Fix the \(\phi\)-dependent loss of performance for displaced vertices (BII-4753).
Flavor Tagger¶
Default Expert (testing mode) does not create repositories and does not save weight files locally. It only loads the payloads directly from the database using the database payload names as mva identifiers.
BtagToWBosonVariables adapted to work with the new ROE.
All release validation and performance evaluation scripts added to
$BELLE2_RELEASE_DIR/analysis/release-validation/CPVTools.The flavor tagger creates and adds default aliases into the collection list
flavor_tagging.
Vertex Fitting¶
Added IP tube constraint to KFit.
The parameter confidenceLevel of the
ParticleVertexFitternow always rejects the particle candidates with a p-value lower than the specified one. Specifically, setting confidenceLevel to 0 does not reject candidates with p-value equal to 0 anymore. Thus, the meaning of this parameter is now the same as for theTreeFitter.
FEI¶
Removed the backward compatibility layer (
pid_renaming_oktober_2017). Only FEI trainings from release-02 are supported. Please update toFEIv4_2018_MC9_release_02_00_01or newer.
Variables¶
Warning
we overhauled the helicity variables and added new ones to replace the NtupleHelicityTool.
We renamed cosHelicityAngle to cosHelicityAngleMomentum,
cosHelicityAnglePi0Dalitz to cosHelicityAngleMomentumPi0Dalitz, and
cosHelicityAngleIfCMSIsTheMother to cosHelicityAngleBeamMomentum.
We added the variables cosHelicityAngle and cosAcoplanarityAngle
defining them as the PDG 2018, p. 722.
The function to create variable aliases for particles selected from a decay string has been fixed and extended to allow better customization (BII-4437)
Added a variable that returns the distance between a KLMCluster and its associated Track
klmClusterTrackDistanceAccess to tag vertexing quality indicators for resolution function study,
TagVNDF,TagVChi2, andTagVChi2IP.Statistically correct combination of p-values
pValueCombinationAdded the meta variable
clusterHasFailedTimingto check if the ECL cluster’s timing fit failed.Added the meta variable
clusterHasFailedErrorTimingto check if the calculation of the ECL cluster’s error on the timing failed.The chi2 and ndf from KFit vertices are stored as extraInfo for debugging.
Added
trackFitHypothesisPDGwhich returns the PDG code of the successful track fit hypothesis that was used to create this particle (that might be different from the PDG code of the particle list)Added variables for 2D Armenteros-Podolanski plot,
ArmenterosLongitudinalMomentumAsymmetry,ArmenterosDaughter1Qt, andArmenterosDaughter2QtFall-back value changed from zero to NaN for several track variables.
Added
sourceObjectIsInListwhich checks whether there are particles from the same underlying track or cluster in a given particle list. Similar toisInListbut a tighter check.Added
isCloneOfSignalSideandhasAncestorFromSignalSidevariables to monitor the clone particle contamination in ROE. These variables use generator information.The variables for the fast reco HLT trigger stage have been removed, as we are currently not planning to have it in the early data taking.
The event-based variable
KLMEnergyis removed. It is completely meaningless (BII-5002).The variables (
dx,dy,dz,dr,dphi,dcosTheta) are now with respect to the interaction point (as documented). This now makes them different with respect to the cartesian position (x,y,z) with respect to the origin.. This is similarly true for (mcDecayVertexFromIPX,mcDecayVertexFromIPY,mcDecayVertexFromIPZ) versus (mcDecayVertexX,mcDecayVertexYandmcDecayVertexZ).Added the meta variable
eclClusterSpecialTrackMatchedto check if any track related to an ECL cluster satisfies certain criteria. It can be used to apply an individual track-cluster matching.Added missing error variables
DeltaZErrandDeltaBoostErr. Fixed bug in TagV error functions.Replaced
pValue(tracking variable) withchiProb(vertexing variable) in the collection of vertexing variables.Replaced
pValue(always the track-fit pvalue) withchiProb(context-dependent \(\chi^2\) probability variable) in the vertexing variable collection.Added the meta variables
averageValueInListandmedianValueInListwhich calculate the arithmetic mean and median of a given variable in a given particle list.Removed
nECLClusters(BII-4476). The number ofECLClustersis not a good measure for anything except the age of the input mdst file. Recent changes to the handling of ECLClusters and their hypotheses have changed this (already arbitrary) number to another (equally arbitrary but different) number.Hint
For most common use cases, the recommended alternative is the total number of photons (unique photon hypothesis clusters) in the event:
from variables import variables from stdPhotons import stdPhotons stdPhotons("cdc", path=mypath) # creates the all and cdc lists variables.addAlias("nPhotonsAll", "nParticlesInList(gamma:all)") variables.addAlias("nPhotonsCDC", "nParticlesInList(gamma:cdc)") variables.addAlias("totalPhotonEECL", "totalEnergyOfParticlesInList(gamma:all)")
Deprecated
clusterHypothesisfollowing changes to the ECLCluster storage on mdst. Please useclusterHasNPhotonsandclusterHasNeutralHadron.Removed
ClusterHadronIntensityandclusterUniqueID.Added helix extrapolation from charged tracks.
Added
clusterMdstIndexvariable to get ECLCluster mdst index for particles that do not originate from ECLCluster.Added a convenience
M2, that returns the invariant mass squared of a given Particle (determined from the particle’s 4-momentum vector).Added
eclClusterOnlyInvariantMass, that returns the invariant mass of the particles, computed with cluster informationAdded
grandDaughterDiffOf,grandDaughterDiffOfPhi, andgrandDaughterDiffOfClusterPhi. They behave likedaughterDiffOf, but use grandDaughters’ information rather than daughters’.Renamed
ClusterHasPulseShapeDiscriminationtoclusterHasPulseShapeDiscrimination,PulseShapeDiscriminationMVAtoclusterPulseShapeDiscriminationMVA, andClusterNumberOfHadronDigitsto :b2:var`clusterNumberOfHadronDigits`.Removed the misleading variable
McFlavorOfTagSide.Added a variable
mcFlavorOfOtherBwhich returns the tag-side flavor by checking the other Upsilon4S daughter without using the ROE. This variable is part of the defaultflavor_taggingcollection.The name of the variable
MCTagBFlavorchanged tointernalTagVMCFlavor. It should be used only by experts for debugging.Added MC flight information variables,
mcFlightDistanceandmcFlightTime
Modules¶
Added the new module
AllParticleCombinerwhich is also available via the functionmodularAnalysis.combineAllParticles. It creates a new Particle as the combination of all unique Particles from the passed input ParticleLists.The
ParticleLoadercan load Rest Of Event as a particle using a new functionmodularAnalysis.fillParticleListFromROE. This ROE particle can be combined with any other particle or written down using usual variables.Another option is to load missing momentum as a particle by supplementing
useMissing = Trueargument to the function, mentioned above.Fixed a bug in the
BestCandidateSelectionmodule: WhenallowMultiRank=Truethere always at least two candidates with rank of one, even if they didn’t have the same variable value (BII-4460)This affects all users of
modularAnalysis.rankByLowest()andmodularAnalysis.rankByHighest()if they passedallowMultiRank=TrueFixed a bug in the
BestCandidateSelectionmodule: now thenumBestparameter works as expected.Removal of the unsupported ECLClusterInfoModule.
Added
vertex.fitPseudofunction and a pseudo vertex fitting module to add a covariance matrix when a vertex fit is not possible. E.g. for \(\pi^0\) decays.Added the new module
SignalSideVariablesToDaughterExtraInfo. It adds ExtraInfo to a specified particle (typically a daughter on the signal side). The corresponding information is calculated in the RestOfEvent so it is supposed to be executed only in for_each ROE paths.Fixed a bug and extended the functionality of the
RestOfEventBuildermodule. When providing a ParticleList of composite particles as an additional source for building the ROE, the composite particles are now decomposed and their final state daughters are added to the ROE (unless they are part of the signal side or already present in the ROE). Previously, composite particles were not decomposed and the first composite particle of the first ParticleList of composite particles (and only this one) was always added to the ROE.The module
VertexFitUpdateDaughtersnow always updates the daughters (as advertised).
Modular Analysis¶
A new boolean argument has been added to the function
modularAnalysis.buildRestOfEvent. It is calledbelle_sourcesand should be switched to True (default is False) if you are analyzing converted Belle MC or data. It triggers the ROE to be constructed from all tracks and from Belle’s specific gamma:mdst list.Added signal region function
modularAnalysis.signalRegion. By default, this function enables a new variableisSignalRegionand excludes the defined area when processing is done on data.
Standard Particle Lists¶
Updated V0 lists. The standard list became the merged list, a combined list of particles coming from V0 objects merged with a list of particles combined using the analysis
ParticleCombinermodule.stdV0s.stdKshortsreturns a Ks list calledK_S0:mergedstdV0s.stdLambdasreturns a Lambda list calledLambda0:mergedmergedKshorts() and mergedLambdas() are now deprecated, and return the standard lists.
The definition of the standard V0 lists slightly changed. For Lambdas, the modularAnalysis.markDuplicate() function is now used to detect duplicates among the same list (V0 and ReconstructDecay), rather than between different lists. For Ks, the modularAnalysis.markDuplicate() function is no longer used.
Updated V0 lists by making them explicitly call the appropriate vertex fit.
Fixed a bug in the merged Lambda list, which used an incorrect mass window.
Fix the
stdKlongs.stdKlongslists.Updated charged standard PID cut values to reflect the correct efficiencies. This recovers the efficiency loss reported in BIIDP-1065.
Tutorials¶
Fix B2A202 to load Klongs as advertised.
Fix B2A801 to use JPsiKs as signal channel and to show how to run on Belle data/MC. Central database global tag updated.
1.3.2. Changes in the framework package¶
Job Information File¶
basf2 has a new command line parameter --job-information=<filename> to
create a json file with some statistics on the processing and detailed
information on all created output files.
Python Interface¶
Additional utility function
b2test_utils.check_error_freeused to automate a code quality (or indeed any) tool check. It requires execution without any output as part of the unit tests. For example the analysis package now requires no doxygen or cppcheck warnings.Additional utility function
b2test_utils.configure_logging_for_teststo improve reproducibility of log output for testing purposes by replacing certain setup dependent names of directories with placeholders.The
Pagerclass has been moved to a new moduleterminal_utilswhich now also contains a new classInputEditorto open a editor when asking the user for a long message similar togit commitThe compatibility imports of
sys,osand thefwobject have been removed frombasf2. Every method which was previously part of thefwobject is now just a function in thebasf2module.
Core Framework¶
Addition of helpful
StoreArray::hasRelationToandStoreArray::hasRelationFrommethods.Deprecated static methods to register
StoreArrayinstances have been removed.
Command line Tools¶
b2file-metadata-add will now only update the file in the FileCatalog if it is already registered. It will also now correctly remove the old LFN from the file catalog.
b2file-merge will by default no longer register files in the file catalog. You can either supply
--add-to-catalogas argument or runb2file-catalog-addon the output file. Use the latter if you want to write scripts which work also with older releases.b2file-normalize has been added to remove timestamps and similar non-reproducible features from ROOT files.
b2file-remove-branches has been added to remove obsolete branches from old files.
the commands of the b2conditionsdb tool are now also available with dashed version, e.g.
b2conditionsb-tag-showA number of old tool names which were kept for compatibility have been removed. The old tool names still exist but raise an error pointing to the new name.
Modules¶
b2:mod:
RootOutputmodule: changed default value forupdateFileCatalogto False. This will avoid creatingBelle2FileCatalog.xmlor warning about overwriting entries in the file catalog by default. The file catalog is only needed when loading parent files and can always be created later usingb2file-catalog-addSee also
1.3.3. Changes in the ecl package¶
Modules¶
Remove all getHypothesisId() calls and logic by a new logic that allows clusters to have multiple flags to indicate their hypothesis. This is used to remove duplicate clusters that are identical under different hypothesis.
1.4. Changes since release-02-01¶
Moved to C++17
The whole software including the ROOT in the externals is now compiled using the C++17 standard. This should not affect many users but there are a few rare cases where this might lead to compilation problems of analysis code as some deprecated features have been removed. The most notable are
throw(TypeName)exception specifiers, just remove them.
std::auto_ptrwhich should be replaced bystd::unique_ptrsome older parts of the
<functional>header.
In particular if you compile a standalone program that links against the ROOT
in the Belle2 externals this now also needs to be compiled in C++17 mode. You
can do this by adding -std=c++17 to the compiler arguments.
Note
It’s best to directly pass the output of root-config --cflags to
the compiler. That way you always pass the correct flags needed for the
particular ROOT version setup.
Build system moved to Python3
This is a major update of SCons but most users should not notice any difference except for two instances:
If you update an existing working directory from an older release you might run into an error
scons: *** [...] TypeError : intern() argument 1 must be string, not unicode scons: building terminated because of errors. TypeError: intern() argument 1 must be string, not unicode: [...]
In this case please remove all
.scon*files in the top level of your software directory and rerunsconsIn the unlikely case that you have custom
SConscriptfiles which are not Python 3 compatible you will have to update them.
1.4.1. Changes in the analysis package¶
Variables¶
There have been improvements and additions to the variables available in the variable manager. Some older, unhelpful, or deprecated variables have been removed, but this should be less than previous major releases. As usual, please ask at https://questions.belle2.org if anything is unclear or your favourite variable seems to have been removed. There is likely a good reason.
Addition of vertex information, flight distance information, and MC hierarchy information (
mcMotherandmcDaughtermetavariables).Some variables that check lists (
isInListandisDaughterOfList).Additions and fixes to the RestOfEvent variables. Kinematics related to the Rest Of Event now obey the reference frame syntax (e.g.
useCMSFrame).Bug-fixes to L1 trigger information (prescales are now available in
L1PSNMBitPrescale), and event level tracking information.Special variables to return the \(\phi\) angle difference between two daughters (
daughterDiffOfPhic.f.daughterDiffOf).Removal of the PhysicsTriggerVariables (all of which were experimental and only intended for use in the study of triggers).
See also
Pull request [PR#2581]
New Modular Analysis Tools¶
Multiple particle lists may be written to the same file with VariablesToNtuple.
A new improved Rest Of Event which takes particle lists as input. The syntax is mostly backward-compatible, but please check the updated documentation if your analysis relies on this functionality. In addition some new features are added (such as nested Rest Of Event).
Separation of EventShape and EventKinematics and addition of many global event shape variables based on particle lists.
See also
This event shape / continuum suppression tutorial (October 2018) for more details.
Fitters¶
Many improvements to TreeFitter, which is now the recommended vertex fitter almost all use cases, even for simple vertices with two tracks. Please refer to the TreeFitter documentation for full details.
See also
This TreeFitter tutorial (October 2018).
Bug fixes to OrcaKinFit.
KFit is now accessible from other
basf2modules.
Loading V0 Particles¶
When loading V0 particles (i.e. \(K_S^0\), \(\Lambda^0\), or converted photons) using the ParticleLoader (
fillParticleList) you must now specify the daughters in a decay string. For example, to load \(\Lambda^0\to p^+\pi^-\) decays from V0s:from modularAnalysis import fillParticleList fillParticleList('Lambda0 -> p+ pi-', '0.9 < M < 1.3', path=mypath)
Tutorials and Examples¶
The style of many of the tutorial scripts have been updated to assist with and provide examples of these new changes. See:
$BELLE2_RELEASE_DIR/analysis/examples/tutorials
1.4.2. Changes in the framework package¶
Python Interface¶
The basf2 python interface has been restructured into multiple files to ease
maintenance. For the user this should be transparent. Some changes the user
might notice are
There is now a new utility function
basf2.find_fileto allow looking for files in the release directory or separate examples or validation directories.There is now an automatic Jupyter integration: Calling
basf2.processin a Jupyter notebook should now automatically run the processing in a separate process and show a nice progress bar.The obsolete “fw” object has been deprecated and all functionality which previously was accessed using
basf2.fw.*is now directly accessible asbasf2.*. If you usebasf2.fwyou will get a deprecation warning.When using
from basf2 import *thesysandospackages were also silently imported and available in the current script. This has been deprecated. In general, usingimport *is not recommended but if you have to use it and use thesysorosmodule in the script please make sure you import them yourself afterfrom basf2 import *Display and colouring of log messages in Jupyter has been significantly improved and should now be much faster.
There’s a new implementation for
pager.Pagerwhich can also show output from C++ programs and will display the output incrementally instead of waiting for all output before showing everything.
Command Line Tools¶
b2file-check now supports files with zero events correctly.
b2file-merge now checks that real/MC data flag is consistent for all input files and refuse to merge mixed real/MC files.
The subcommands
iovanddiffof b2conditionsdb have improved output and learned the new option--human-readableto convert the IntervalOfValidity numbers to easier to read strings.There is a new sub command
dumpfor b2conditionsdb to dump the contents of a payload file in a human readable form on the terminal for quick inspection.There is a new command b2conditionsdb-extract which allows to convert a payload to a TTree with one entry per requested run number. This allows to easily monitor how payloads change over the course of time.
There is a new command b2conditionsdb-recommend which will recommend users a global tag to use when processing a given input file.
There is a new command b2conditionsdb-request to allow requesting the inclusion of locally prepared database payload into the official global tags.
Core Framework¶
Environment::isMC()is now available to consistently distinguish between real and MC data. To use it in C++ please use#include <framework/core/Environment.h> bool isMC = Environment::Instance().isMC();
and for use in python
from ROOT import Belle2 isMC = Belle2.Environment.Instance().isMC();
We have now a new prototype for advanced multi processing using ZMQ. It is disabled by default but can be activated using
from ROOT import Belle2 env = Belle2.Environment.Instance().setUseZMQ(True)
See also
Pull request [PR#2790]
There is now support for named relations to allow multiple relations between the same pair of
StoreArray.
Core Modules¶
The
ProgressBarmodule will now notice if the output is written to a log file instead of the terminal and behave accordingly which should clean up logfiles considerably when this module is used.The
RootOutputmodule now allows to split output files after a certain file size is reached using theoutputSplitSizeparameter.Warning
This will set the amount of generated events stored in the file metadata to zero as it is not possible to determine which fraction ends up in which output file.
Also the user can now choose the compression algorithm to choose either no compression, zlib, LZMA or LZ4 compression. LZ4 is a newer compression standard with slightly worse compression than zlib but much faster decompression speed.
removed
CrashHandlermoduleremoved
FileLoggermodule
Conditions Database:
Database objects are now immutable (
const) to prevent accidental modification of conditions data.The old and outdated fallback database in
framework/data/database.txthas been removed. If you still set this by hand in your steering file your script will fail. Please use/cvmfs/belle.cern.ch/conditionsif you really have to set a fallback database manually.The
RunInfodatabase object which is supposed to contain all necessary information about each run now has support to contain the trigger pre-scale information.
Logging System¶
We now have “Log message variables” which allow to send the same log message with varying content. This greatly helps with filtering log messages as it allows to group messages which have the same content and just differ in their variables. In C++ they can be used by adding a
LogVarinstance to the output,B2INFO("This is a log message" << LogVar("number", 3.14) << LogVar("text", "some text"));
while in python the variables can be given as additional keyword arguments,
basf2.B2INFO("This is a log message", number=3.14, text="some text")
In both cases the names of the variables can be chosen feely and the output should be something like
[INFO] This is a log message number = 3.14 text = some textSee also
The logging system is now able to send its message to python
sys.stdoutobjects to allow intercepting log messages in python. To enable please setbasf2.logging.enable_python_loggingtoTrue. This is automatically enabled when running inside of a jupyter notebook.Log messages can also be formatted as json objects where each log message will be printed as a one line json object to allow parsing of logfiles using scripts.
See also
Utilities¶
We have a new and advanced formula parser implementation in the framework package. It manages to handle
**correctly as in python and now allows using normal parenthesis for grouping operations in addition to square brackets.See also
formulavariableWe now provide a variety of RAII scope guards to free or restore a resource or value when the guard object goes out of scope. For example to make sure a variable is reset to is original value one could use
#include <framework/utilities/ScopeGuard.h> int main() { int myValue{5}; { auto guard = Belle2::ScopeGuard::guardValue(myValue, 32); // now myValue is 32 } // now myValue is reverted to 5 independently of how the scope // is left (normal, return statement, exception) }
We provide convenience functions to guard simple values, pointer deletion, output stream flags and the current working directory but the interface is general enough that almost anything can be guarded by this
ScopeGuardobject.There is now
RootFileManagerto allow multiple modules to write to the same root output file. It will take care to open the file when the first module requests it and close it when the last module is finished with the root file. The primary use case is for theVariablesToNtupleand similar modules to allow having multiple ntuples or trees in the same root file.We now have a implementation of the c++17 std::visit overloaded pattern in
framework/utils/Utils.hcalledBelle2::Utils::VisitOverload.