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