Belle II Software  release-05-01-25
B2CAL901-cDSTECLTRG.py
1 #!/usr/bin/env python3
2 
3 import basf2
4 import modularAnalysis as ma
5 from variables import variables
6 
7 
8 outputfilename = 'B2CAL901-cDSTECLTRG'
9 
10 main_path = basf2.create_path()
11 
12 # TODO: A cdst input file is needed!
13 
14 ma.inputMdstList(
15  'default',
16  '',
17  path=main_path)
18 main_path.add_module('Progress')
19 
20 # get ECL trigger information
21 main_path.add_module('ECLTRGInformation', logLevel=basf2.LogLevel.INFO, debugLevel=29)
22 
23 
24 def getL1Variables(n_trigs=80):
25  listL1PSNM = []
26  listL1FTDL = []
27  listL1Prescales = []
28 
29  for ix in range(n_trigs):
30  variables.addAlias('psnm_%i' % ix, 'L1PSNMBit(%i)' % ix)
31  listL1PSNM.append('psnm_%i' % ix)
32 
33  variables.addAlias('ftdl_%i' % ix, 'L1FTDLBit(%i)' % ix)
34  listL1FTDL.append('ftdl_%i' % ix)
35 
36  variables.addAlias('prescale_%i' % ix, 'L1PSNMBitPrescale(%i)' % ix)
37  listL1Prescales.append('prescale_%i' % ix)
38 
39  return listL1PSNM, listL1FTDL, listL1Prescales
40 
41 
42 def getECLTRGVariables():
43  listeclEnergyTC = []
44  listeclEnergyTCECLCalDigit = []
45  for ix in range(1, 577):
46  variables.addAlias('tc_%i' % ix, 'eclEnergyTC(%i)' % ix)
47  listeclEnergyTC.append('tc_%i' % ix)
48 
49  variables.addAlias('tceclcal_%i' % ix, 'eclEnergyTCECLCalDigit(%i)' % ix)
50  listeclEnergyTCECLCalDigit.append('tceclcal_%i' % ix)
51 
52  return listeclEnergyTC, listeclEnergyTCECLCalDigit
53 
54 
55 # L1 trigger
56 listL1PSNM, listL1FTDL, listL1Prescales = getL1Variables()
57 
58 # ECL TC
59 eclEnergyTC, eclEnergyTCECLCalDigit = getECLTRGVariables()
60 
61 variables.addAlias('eclEnergySumTC_2_15', 'eclEnergySumTC(2, 15)')
62 variables.addAlias('eclEnergySumTCECLCalDigit_2_15_0', 'eclEnergySumTCECLCalDigit(2, 15, 0)')
63 variables.addAlias('eclEnergySumTCECLCalDigit_2_15_1', 'eclEnergySumTCECLCalDigit(2, 15, 1)')
64 
65 # dont vertex the leptons
66 ma.variablesToNtuple('',
67  variables=['eclEnergySumTC_2_15', 'eclEnergySumTCECLCalDigit_2_15_0', 'eclEnergySumTCECLCalDigit_2_15_1'] +
68  listL1PSNM +
69  eclEnergyTC +
70  eclEnergyTCECLCalDigit,
71  treename='event',
72  filename=outputfilename + '_event.root',
73  path=main_path)
74 
75 
76 # process the events
77 basf2.process(path=main_path)
78 
79 # print out the summary
80 print(basf2.statistics)
basf2.process
def process(path, max_event=0)
Definition: __init__.py:25