15. KLM (\(K_{L}^0\) and Muon Detector)#

In the following we describe the klm package (documentation still under development).

15.1. Modules#

This is a list of the klm modules. Some modules (in the klm/bklm and klm/eklm subfolders) that are currently used only for debugging or specific studies are omitted here.

KLMChannelStatusCollector#

Module for KLM channel status calibration (data collection).

Package

klm

Library

libKLMChannelStatusCollector.so

Parameters
  • granularity (str, default=’run’)

    Granularity of data collection. Data is separated by runs (=run) or not separated at all (=all)

  • maxEventsPerRun (int, default=-1)

    Maximum number of events that will be collected per run. Effectively the code in the collect() function is only run for this number of events on each run. Then the collect() function is switched off until a new run that hasn’t collected the maximum yet begins. -1 is the default and means that the collector runs over all events.

    Note that this is useful for debugging and hard limiting the number of events passed to the collected. However you should be limiting the collected data yourself! Check if your collected data object has enough entries for an algorithm to complete and then stop filling. Controlling this limit via a module param is encouraged.

  • preScale (float, default=1.0)

    This controls the rate at which events are actually passed to the collect() function. An event passing through this module will only have the collect() function run on it it passes a random selection scaled by this parameter i.e. For preScale=1.0 all events are collected, but for preScale=0.5 only 50 percent will be. Since this is based on a random choice, you should set the random seed to a fixed value if you want repeatable results.

    Should be a float in range [0.0,1.0], default=1.0

KLMClusterAna#

Module for extracting KLM cluster shape information via PCA.

Package

klm

Library

libKLMClusterAna.so

KLMClusterEfficiency#

Module for KLM cluster reconstruction efficiency studies.

Package

klm

Library

libKLMClusterEfficiency.so

Parameters
  • EventsClusterHistograms (int, default=0)

    Draw cluster histograms for this number of events.

  • OutputFile (str, default=’KLMClusterEfficiency.root’)

    Output file.

  • SaveClusterData (bool, default=False)

    Whether to save cluster data or not.

  • SaveReconstructionData (bool, default=True)

    Whether to save reconstruction data or not.

KLMClustersReconstructor#

Unified BKLM/EKLM module for the reconstruction of KLMClusters.

Package

klm

Library

libKLMClustersReconstructor.so

Parameters
  • ClusterMode (str, default=’AnyHit’)

    Clusterization mode (‘AnyHit’ or ‘FirstHit’).

  • ClusteringAngle (float, default=0.26)

    Clustering angle (rad).

  • PositionMode (str, default=’FirstLayer’)

    Vertex position calculation mode (‘FullAverage’ or ‘FirstLayer’).

KLMDQM#

KLM data quality monitor.

Package

klm

Library

libKLMDQM.so

Parameters
  • BKLMScintTimeMax (float, default=-4300.0)

    Max time for BKLM scintillator time histogram.

  • BKLMScintTimeMin (float, default=-5300.0)

    Min time for BKLM scintillator time histogram.

  • EKLMScintTimeMax (float, default=-4300.0)

    Max time for EKLM scintillator time histogram.

  • EKLMScintTimeMin (float, default=-5300.0)

    Min time for EKLM scintillator time histogram.

  • RPCTimeMax (float, default=-199.5)

    Max time for RPC time histogram.

  • RPCTimeMin (float, default=-1223.5)

    Min time for RPC time histogram.

  • histogramDirectoryName (str, default=’KLM’)

    Directory for KLM DQM histograms in ROOT file.

KLMDQM2#

Additional Module for KLMDQM plots after HLT filters

An additional module developed to display plane efficiencies for the KLM during runs (i.e. for online analyses). This module would be called after HLT filter in order to use mumu-tight skim to select reasonable events. The output histograms would be plane efficiencies = MatchedDigits/AllExtits.

Package

klm

Library

libKLMDQM2.so

Parameters
  • AllowedDistance1D (float, default=8.0)

    Maximal distance in the units of strip number from ExtHit to matching KLMDigit (not for multi-strip hits).

  • IgnoreBackwardPropagation (bool, default=False)

    Whether to ignore ExtHits with backward propagation.

  • MinimalMatchingDigits (int, default=0)

    Minimal number of matching digits.

  • MinimalMatchingDigitsOuterLayers (int, default=0)

    Minimal number of matching digits in outer layers.

  • MinimalMomentumNoOuterLayers (float, default=0.0)

    Minimal momentum in case there are no hits in outer layers.

  • MuonListName (str, default=’mu+:all’)

    Muon list name.

  • RemoveUnusedMuons (bool, default=False)

    Whether to remove unused muons.

  • SoftwareTriggerName (str, default=’software_trigger_cut&skim&accept_mumutight’)

    Software Trigger for event selection

  • histogramDirectoryName (str, default=’KLMEfficiencyDQM’)

    Directory for KLM DQM histograms in ROOT file.

KLMDigitTimeShifter#

Shift the time of KLMDigits according to the cable delay corrections.

Package

klm

Library

libKLMDigitTimeShifter.so

KLMDigitizer#

KLM digitization module: create KLMDigits from KLMSimHits.

Package

klm

Library

libKLMDigitizer.so

Parameters
  • CreateMultiStripDigits (bool, default=True)

    Whether to create multi-strip digits in Run 1 data (not used for Run 2+).

  • Debug (bool, default=False)

    Debug mode (generates additional output files with histograms).

  • DigitizationInitialTime (int, default=-5)

    Initial digitization time in CTIME periods.

  • Efficiency (str, default=’Plane’)

    Efficiency determination mode (“Strip” or “Plane”).

  • SaveFPGAFit (bool, default=False)

    Save FPGA fit data and set a relation with KLMDigits.

  • SimulationMode (str, default=’Generic’)

    Simulation mode (“Generic” or “ChannelSpecific”).

KLMPacker#

KLM raw data packer (creates RawKLM from KLMDigits).

Package

klm

Library

libKLMPacker.so

KLMReconstructor#

Create BKLMHit1ds from KLMDigits and then create KLMHit2ds from BKLMHit1ds; create KLMHit2ds from KLMDigits.

Package

klm

Library

libKLMReconstructor.so

Parameters
  • CheckSegmentIntersection (bool, default=True)

    Check if segments intersect.

  • EventT0Correction (bool, default=True)

    Perform EventT0 correction (true) or not (false)

  • IfAlign (bool, default=True)

    Perform alignment correction (true) or not (false).

  • IgnoreHotChannels (bool, default=True)

    Use only Normal and Dead (for debugging) channels during 2d hit reconstruction

  • IgnoreScintillators (bool, default=False)

    Ignore scintillators (to debug their electronics mapping).

  • TimeCableDelayCorrection (bool, default=True)

    Perform cable delay time correction (true) or not (false).

KLMScintillatorSimulator#

Standalone generation and studies of ADC output.

Package

klm

Library

libKLMScintillatorSimulator.so

Parameters
  • Mode (str, default=’Strips’)

    Mode (“Shape” or “Strips”).

  • OutputFile (str, default=’KLMScintillatorSimulator.root’)

    Output file.

KLMStripEfficiencyCollector#

Module for KLM strip efficiency data collection.

Package

klm

Library

libKLMStripEfficiencyCollector.so

Parameters
  • AllowedDistance1D (float, default=8.0)

    Maximal distance in the units of strip number from ExtHit to matching KLMDigit (not for multi-strip hits).

  • Debug (bool, default=False)

    Debug mode.

  • DebugFileName (str, default=’matching.root’)

    Debug file name.

  • IgnoreBackwardPropagation (bool, default=False)

    Whether to ignore ExtHits with backward propagation.

  • MinimalMatchingDigits (int, default=0)

    Minimal number of matching digits.

  • MinimalMatchingDigitsOuterLayers (int, default=0)

    Minimal number of matching digits in outer layers.

  • MinimalMomentumNoOuterLayers (float, default=0.0)

    Minimal momentum in case there are no hits in outer layers.

  • MuonListName (str, default=’mu+:all’)

    Muon list name.

  • RemoveUnusedMuons (bool, default=False)

    Whether to remove unused muons.

  • granularity (str, default=’run’)

    Granularity of data collection. Data is separated by runs (=run) or not separated at all (=all)

  • maxEventsPerRun (int, default=-1)

    Maximum number of events that will be collected per run. Effectively the code in the collect() function is only run for this number of events on each run. Then the collect() function is switched off until a new run that hasn’t collected the maximum yet begins. -1 is the default and means that the collector runs over all events.

    Note that this is useful for debugging and hard limiting the number of events passed to the collected. However you should be limiting the collected data yourself! Check if your collected data object has enough entries for an algorithm to complete and then stop filling. Controlling this limit via a module param is encouraged.

  • preScale (float, default=1.0)

    This controls the rate at which events are actually passed to the collect() function. An event passing through this module will only have the collect() function run on it it passes a random selection scaled by this parameter i.e. For preScale=1.0 all events are collected, but for preScale=0.5 only 50 percent will be. Since this is based on a random choice, you should set the random seed to a fixed value if you want repeatable results.

    Should be a float in range [0.0,1.0], default=1.0

KLMTimeCollector#

Module for KLM time calibration (data collection).

Package

klm

Library

libKLMTimeCollector.so

Parameters
  • IgnoreBackwardPropagation (bool, default=False)

    Whether to ignore ExtHits with backward propagation.

  • granularity (str, default=’run’)

    Granularity of data collection. Data is separated by runs (=run) or not separated at all (=all)

  • inputParticleList (str, default=’mu+:cali’)

    input particle list.

  • maxEventsPerRun (int, default=-1)

    Maximum number of events that will be collected per run. Effectively the code in the collect() function is only run for this number of events on each run. Then the collect() function is switched off until a new run that hasn’t collected the maximum yet begins. -1 is the default and means that the collector runs over all events.

    Note that this is useful for debugging and hard limiting the number of events passed to the collected. However you should be limiting the collected data yourself! Check if your collected data object has enough entries for an algorithm to complete and then stop filling. Controlling this limit via a module param is encouraged.

  • preScale (float, default=1.0)

    This controls the rate at which events are actually passed to the collect() function. An event passing through this module will only have the collect() function run on it it passes a random selection scaled by this parameter i.e. For preScale=1.0 all events are collected, but for preScale=0.5 only 50 percent will be. Since this is based on a random choice, you should set the random seed to a fixed value if you want repeatable results.

    Should be a float in range [0.0,1.0], default=1.0

  • useEventT0 (bool, default=True)

    Use event T0 or not.

KLMUnpacker#

KLM unpacker (creates KLMDigits from RawKLM).

Package

klm

Library

libKLMUnpacker.so

Parameters
  • DAQChannelBKLMScintillators (bool, default=False)

    Record DAQ channel for BKLM scintillators.

  • DAQChannelModule (int, default=-1)

    Record DAQ channel for specific module.

  • DebugElectronicsMap (bool, default=False)

    Debug electronics map (record DAQ channel instead of strip).

  • IgnoreStrip0 (bool, default=True)

    Ignore hits with strip = 0 (normally expected for certain firmware versions).

  • IgnoreWrongHits (bool, default=False)

    Ignore wrong hits (i.e. no B2ERROR).

  • WriteDigitRaws (bool, default=False)

    Record raw data in dataobject format (e.g. for debugging).

  • WriteWrongHits (bool, default=False)

    Record wrong hits (e.g. for debugging).

  • keepEvenPackages (bool, default=False)

    Keep packages that have even length normally indicating that data was corrupted

  • outputKLMDigitsName (str, default=’’)

    Name of KLMDigit store array.

MCMatcherKLMClusters#

Module for MC matching for KLM clusters.

Package

klm

Library

libMCMatcherKLMClusters.so

Parameters
  • Hit2dRelations (bool, default=False)

    Add also relations for KLMHit2d and KLMHit2d.

15.2. Clusterization#

Few words about how a KLMCluster is built starting from KLMHit2d are more than desirable.

15.3. Muon identification#

15.4. Calibration#

15.5. Tools#

15.5.1. b2klm-create-dqm: Create DQM reference plots#

Tool used to generate the KLM DQM reference plots and to mask the (very) hot channels if necessary.

usage: b2klm-create-dqm [-h] -i FILE [FILE ...] [-n EVENTS]
                        [--prepend_gt [GT [GT ...]]]
                        [--append_gt [GT [GT ...]]] [--raw] [--no_mask]
                        [--output_dqm OUTPUT_DQM]

Optional Arguments

-i, --input

input file names; it is possible to use the wildcard “*” to pass multiple files in input

-n, --events

maximum number of events to be processed

--prepend_gt

Global Tags to be prepended

--append_gt

Global Tags to be appended

--raw

flag for raw input files; it must be used if data must be unpacked and reconstructed from scratch

--no_mask

flag for disable masking of (very) hot channels; the masking is disabled for .sroot files, please convert them to .root if this is necessary

--output_dqm

name of the output .root file containing plots with masked channels

15.5.2. b2klm-mask-dqm: Mask very hot channels in DQM reference plots#

Tool used to mask the (very) hot channels in KLM DQM reference plots.

usage: b2klm-mask-dqm [-h] --exp EXP_NUMBER --run RUN_NUMBER [-i INPUT_FILE]
                      [-o OUTPUT_FILE] --globaltags GT [GT ...]

Optional Arguments

--exp

experiment number

--run

run number

-i, --input

input file name

-o, --output

output file name

--globaltags

Global Tags to be used