Belle II Software  release-05-01-25
analyzeRawData.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
17 
18 import basf2
19 
20 # Add a Global Tag
21 basf2.conditions.override_globaltags()
22 basf2.conditions.append_globaltag('data_reprocessing_prompt_bucket7')
23 basf2.conditions.append_globaltag('data_reprocessing_prompt_rel4_patch')
24 
25 # Create the main path
26 main = basf2.create_path()
27 
28 # Add the input files and the progress bar
29 main.add_module('SeqRootInput')
30 main.add_module('Progress')
31 
32 # Add the unpacker
33 main.add_module('KLMUnpacker')
34 
35 # Add the digit analyzer
36 # Note that it must go after the unpacker
37 main.add_module('BKLMDigitAnalyzer',
38  outputRootName='bklmHitmap') # Note that .root is not needed!
39 
40 # Process the main path
41 basf2.process(main)
42 print(basf2.statistics)
43 
44 # Prodce a .pdf file with the hitmap
45 # Here we process only the last file produced
46 # by the BKLMDigitAnalyzer module
47 # The command to be executed is:
48 # root -b 'drawHitmap.cxx("./bklmHitmap_runXXX.root")'
49 import glob
50 import os
51 allFiles = glob.glob('./bklmHitmap*root') # list all the hitmap .root files
52 latestFile = max(allFiles, key=os.path.getctime) # pick the latest hitmap file
53 bashCommand = "root -b 'drawHitmap.cxx" + '("' + latestFile + '")' + "'"
54 os.system(bashCommand)
basf2.process
def process(path, max_event=0)
Definition: __init__.py:25