7. B2BII

The b2bii package in basf2 converts Belle MDST files (BASF data format) to Belle II MDST (basf2 data format). This enables performing physics analysis using data collected with Belle detector with the analysis software and algorithms developed for the analysis of data collected with the Belle II detector. The B2BII converter allows for estimation and validation of performances of various advanced algorithms being developed for Belle II.

Note

For an introduction and important caveats regarding Belle MDST to Belle II MDST Conversion, please see this confluence page.

Hint

For an introductory lesson, take a look at Section 26.4.11.

7.1. b2biiConversion

b2biiConversion.convertBelleMdstToBelleIIMdst(inputBelleMDSTFile, applySkim=True, useBelleDBServer=None, convertBeamParameters=True, generatorLevelReconstruction=False, generatorLevelMCMatching=False, path=None, entrySequences=None, matchType2E9oE25Threshold=- 1.1, enableNisKsFinder=True, HadronA=True, HadronB=True, enableRecTrg=False, enableEvtcls=True, SmearTrack=2, enableLocalDB=True)[source]

Loads Belle MDST file and converts in each event the Belle MDST dataobjects to Belle II MDST data objects and loads them to the StoreArray.

Parameters
  • inputBelleMDSTFile (str) – Name of the file(s) to be loaded.

  • applySkim (bool) – Apply skim conditions in B2BIIFixMdst.

  • useBelleDBServer (str) – None to use the recommended BelleDB server.

  • convertBeamParameters (bool) – Convert beam parameters or use information stored in Belle II database.

  • generatorLevelReconstruction (bool) – Enables to bypass skims and corrections applied in B2BIIFixMdst.

  • generatorLevelMCMatching (bool) – Enables to switch MCTruth matching to generator-level particles.

  • path (basf2.Path) – Path to add modules in.

  • entrySequences (list(str)) – The number sequences (e.g. 23:42,101) defining the entries which are processed for each inputFileName.

  • matchType2E9oE25Threshold (float) – Clusters with a E9/E25 value above this threshold are classified as neutral even if tracks are matched to their connected region (matchType == 2 in basf).

  • enableNisKsFinder (bool) – Enables to convert nisKsFinder information.

  • HadronA (bool) – Enables to switch on HadronA skim in B2BIIFixMdst module.

  • HadronB (bool) – Enables to switch on HadronB skim in B2BIIFixMdst module.

  • enableRecTrg (bool) – Enables to convert RecTrg_summary3 table.

  • enableEvtcls (bool) – Enables to convert Evtcls and Evtcls_hadronic tables.

  • SmearTrack (float) – Smear the MC tracks to match real data. Apart from the recommended default value of 2 it can also be set to 1. Details about the difference between those two options can be found here. Set to 0 to skip smearing (automatically set to 0 internally for real data).

  • enableLocalDB (bool) – Enables to use local payloads.

b2biiConversion.parse_process_url(url)[source]

Handle process_url style requests. If url is a list just return it without looking at it. If the url starts with http(s):// return the list of files provided by that url, otherwise check if a file with the name given as url exists and return this as a list with one item. If not such file exists return an empty list

>>> parse_process_url(["foo", "bar"])
['foo', 'bar']
>>> parse_process_url("/dev/null")
['/dev/null']
>>> parse_process_url("missing_file.mdst")
[]
>>> parse_process_url("http://bweb3.cc.kek.jp/mdst.php?ex=55&rs=1&re=5&skm=HadronBorJ&dt=on_resonance&bl=caseB")         
['/group/belle/bdata_b/dstprod/dat/e000055/HadronBJ/0127/on_resonance/00/HadronBJ-e000055r000003-b20090127_0910.mdst',
 '/group/belle/bdata_b/dstprod/dat/e000055/HadronBJ/0127/on_resonance/00/HadronBJ-e000055r000004-b20090127_0910.mdst',
 '/group/belle/bdata_b/dstprod/dat/e000055/HadronBJ/0127/on_resonance/00/HadronBJ-e000055r000005-b20090127_0910.mdst']

Some files are missing and thus marked with “### LOST ###”, make sure we don’t pick them up

>>> parse_process_url("http://bweb3.cc.kek.jp/mdst.php?ex=65&rs=1&re=30&skm=ypipi")
[]

If the URL cannot be found an error is raised and an empty list is returned. Also for other http errors or non existing urls

>>> parse_process_url("http://httpbin.org/status/404")
[]
>>> parse_process_url("http://httpbin.org/status/500")
[]
>>> parse_process_url("http://nosuchurl")
[]
b2biiConversion.setupBelleDatabaseServer()[source]

Sets the Belle DB server to the one recommended in /sw/belle/local/var/belle_postgres_server.

If the user does not have the access rights to the above file, the can01 server is set by default.

b2biiConversion.setupBelleMagneticField(path)[source]

This function set the Belle Magnetic field (constant).

7.2. b2biiMonitors

b2biiMonitors.addBeamParamsConversionMonitors(outputRootFile='b2biiBeamParamsConversionMonitors.root', path=None)[source]

In each event saves HER, LER, CMS, x-angle to histograms for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path

b2biiMonitors.addConvertedPhotonConversionMonitors(outputRootFile='b2biiConvertedPhotonConversionMonitors.root', path=None)[source]

Creates copies of gamma particles from ‘gamma:v0mdst’ ParticleList and fills them to a new ParticleList called ‘gamma:v0_b2bii_monitor’. For each gamma candidate several quantities are stored to histograms with ‘VariablesToHistogram’ module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path

b2biiMonitors.addKlongConversionMonitors(outputRootFile='b2biiKlongConversionMonitors.root', path=None)[source]

Creates copies of KLong particles from ‘K_L0:mdst’ ParticleList and fills them to a new ParticleList called ‘K_L0:b2bii_monitor’. For each Klong candidate several quantities are stored to histograms with ‘VariablesToHistogram’ module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path

b2biiMonitors.addKshortConversionMonitors(outputRootFile='b2biiKshortConversionMonitors.root', path=None)[source]

Creates copies of KShort particles from ‘K_S0:mdst’ ParticleList and fills them to a new ParticleList called ‘K_S0:b2bii_monitor’. For each KShort candidate several quantities are stored to histograms with ‘VariablesToHistogram’ module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path

b2biiMonitors.addLambda0ConversionMonitors(outputRootFile='b2biiLambda0ConversionMonitors.root', path=None)[source]

Creates copies of Lambda0 particles from ‘Lambda0:mdst’ ParticleList and c.c. and fills them to a new ParticleList called ‘Lambda0:b2bii_monitor’. For each Lambda0 candidate several quantities are stored to histograms with ‘VariablesToHistogram’ module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path

b2biiMonitors.addMCParticlesConversionMonitors(outputRootFile='b2biiMCParticlesConversionMonitors.root', path=None)[source]

‘HistoManager’ and ‘B2BIIMCParticlesMonitor’ modules create and fill the monitoring histograms using all MCParticles.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path

b2biiMonitors.addNeutralsConversionMonitors(gammaOutputRootFile='b2biiGammaConversionMonitors.root', neutralPiOutputRootFile='b2biiPi0ConversionMonitors.root', MCneutralPiOutputRootFile='b2biiMCPi0ConversionMonitors.root', path=None)[source]

Creates ‘gamma:b2bii_monitor’ and ‘pi0:b2bii_monitor’ from already existing ‘gamma:mdst’ and ‘pi0:mdst’ ParticleList and fills it with all converted neutral gammas. For each object several quantities are stored to histograms with ‘VariablesToHistogram’ module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path

b2biiMonitors.addTrackConversionMonitors(outputRootFile='b2biiTrackConversionMonitors.root', path=None)[source]

Creates ‘pi+:b2bii_monitor’ ParticleLists and fills it with all converted charged tracks as charged pions. For each charged pion (track) several quantities are stored to histograms with ‘VariablesToHistogram’ module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.

Parameters
  • outputRootFile – name of the output ROOT file to which the histograms are saved.

  • path – modules are added to this path