18def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, groupsToMonitor):
19 from LArMonitoring.GlobalVariables import lArDQGlobals
20 from AthenaCommon.Logging import logging
21 log = logging.getLogger('LArCoherentNoisefractionConfigCore ')
22
23 larCoherentNoisefractionMonAlg = helper.addAlgorithm(algoinstance,'larCoherentNoisefractionMonAlg')
24
25
26 allGroups=["tot","top","bot","left","right","q1","q2","q3","q4","qs11","qs22","qs3","qs4"]
27 groupsNChan=[128,64,64,64,64,32,32,32,32,32,32,32,32]
28 allMonitor=[True,True,True,True,True,True,True,True,True,True,True,True,True]
29
30
31
32 try:
33 larCoherentNoisefractionMonAlg.IsCalibrationRun = inputFlags.LArMon.calibRun
34 except AttributeError:
35 larCoherentNoisefractionMonAlg.IsCalibrationRun = False
36 try:
37 larCoherentNoisefractionMonAlg.LArDigitContainerKey = inputFlags.LArMon.LArDigitKey
38 except AttributeError:
39 larCoherentNoisefractionMonAlg.LArDigitContainerKey = 'FREE'
40 larCoherentNoisefractionMonAlg.ListOfGroupNames = allGroups
41 larCoherentNoisefractionMonAlg.GroupNchan = groupsNChan
42 if len(groupsToMonitor) == 0:
43 customGroupstoMonitor = allMonitor
44 else:
45 if len(customGroupstoMonitor) != len(allMonitor):
46 from AthenaCommon.Logging import logging
47 logging.getLogger().warning("Wrong list of groups to monitor, setting all !")
48 customGroupstoMonitor = allMonitor
49 else:
50 customGroupstoMonitor = groupsToMonitor
51 larCoherentNoisefractionMonAlg.GroupsToMonitor = customGroupstoMonitor
52 log.info("GroupsToMonitor: ",customGroupstoMonitor)
53
54 try:
55 customFEBStoMonitor = inputFlags.LArMon.customFEBsToMonitor
56 except AttributeError:
57 customFEBStoMonitor = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"]
58
59
60 from ROOT import LArStrHelper
62 customFEBStoMonitor=[larStrHelp.fixFEBname(nm) for nm in customFEBStoMonitor]
63
64
65 larCoherentNoisefractionMonAlg.TriggerChain = "HLT_noalg_zb_L1ZB, HLT_noalg_cosmiccalo_L1RD1_EMPTY"
66
67
68 setCustomFEBS=
set(customFEBStoMonitor)
69 febsToMonitorBarrelA=list(setCustomFEBS.intersection(lArDQGlobals.febsBarrelA))
70 febsToMonitorEndcapA=list(setCustomFEBS.intersection(lArDQGlobals.febsEndcapA))
71 febsToMonitorBarrelC=list(setCustomFEBS.intersection(lArDQGlobals.febsBarrelC))
72 febsToMonitorEndcapC=list(setCustomFEBS.intersection(lArDQGlobals.febsEndcapC))
73
74 if len(febsToMonitorBarrelA)==0 and len(febsToMonitorEndcapA)==0 and len(febsToMonitorBarrelC)==0 and len(febsToMonitorEndcapC)==0:
75 log.warning(" None of the following FEBs were recognised, no plot will be produced")
76 log.warning(customFEBStoMonitor)
77 larCoherentNoisefractionMonAlg.PlotsOFF=True
78 larCoherentNoisefractionMonAlg.PlotCustomFEBSset=False
79 larCoherentNoisefractionMonAlg.FEBlist=[]
80 else:
81
82 larCoherentNoisefractionMonAlg.PlotCustomFEBSset=True
83 larCoherentNoisefractionMonAlg.FEBlist=febsToMonitorBarrelA+febsToMonitorBarrelC+febsToMonitorEndcapA+febsToMonitorEndcapC
84 pass
85
86
87 for grp in range(0,len(allGroups)):
88 if not customGroupstoMonitor[grp]: continue
89
90
91 cnfArray = helper.addArray([larCoherentNoisefractionMonAlg.FEBlist],larCoherentNoisefractionMonAlg,allGroups[grp])
92
93 hist_path='/LAr/CNF/'
94
95 tot_plot_name=allGroups[grp]+"_cnf_tot"
96 tot_var_and_name="SumDev;"+tot_plot_name
97 cnfArray.defineHistogram(tot_var_and_name,
98 title=tot_plot_name,
99 type='TH1F',
100 path=hist_path+'BarrelA',
101 xbins=lArDQGlobals.CNFN_tot, xmin=lArDQGlobals.CNFXmin_tot, xmax=lArDQGlobals.CNFXmax_tot,
102 pattern=febsToMonitorBarrelA)
103
104 cnfArray.defineHistogram(tot_var_and_name,
105 title=tot_plot_name,
106 type='TH1F',
107 path=hist_path+'BarrelC',
108 xbins=lArDQGlobals.CNFN_tot, xmin=lArDQGlobals.CNFXmin_tot, xmax=lArDQGlobals.CNFXmax_tot,
109 pattern=febsToMonitorBarrelC)
110
111 cnfArray.defineHistogram(tot_var_and_name,
112 title=tot_plot_name,
113 type='TH1F',
114 path=hist_path+'EndcapA',
115 xbins=lArDQGlobals.CNFN_tot, xmin=lArDQGlobals.CNFXmin_tot, xmax=lArDQGlobals.CNFXmax_tot,
116 pattern=febsToMonitorEndcapA)
117
118
119 cnfArray.defineHistogram(tot_var_and_name,
120 title=tot_plot_name,
121 type='TH1F',
122 path=hist_path+'EndcapC',
123 xbins=lArDQGlobals.CNFN_tot, xmin=lArDQGlobals.CNFXmin_tot, xmax=lArDQGlobals.CNFXmax_tot,
124 pattern=febsToMonitorEndcapC)
125
126
127 noncoh_plot_name=allGroups[grp]+"_cnf_noncoh"
128 noncoh_var_and_name="Dev;"+noncoh_plot_name
129
130 cnfArray.defineHistogram(noncoh_var_and_name,
131 title=noncoh_plot_name,
132 type='TH1F',
133 path=hist_path+'BarrelA',
134 xbins=lArDQGlobals.CNFN_ncoh, xmin=lArDQGlobals.CNFXmin_ncoh, xmax=lArDQGlobals.CNFXmax_ncoh,
135 pattern=febsToMonitorBarrelA)
136
137 cnfArray.defineHistogram(noncoh_var_and_name,
138 title=noncoh_plot_name,
139 type='TH1F',
140 path=hist_path+'BarrelC',
141 xbins=lArDQGlobals.CNFN_ncoh, xmin=lArDQGlobals.CNFXmin_ncoh, xmax=lArDQGlobals.CNFXmax_ncoh,
142 pattern=febsToMonitorBarrelC)
143
144 cnfArray.defineHistogram(noncoh_var_and_name,
145 title=noncoh_plot_name,
146 type='TH1F',
147 path=hist_path+'EndcapA',
148 xbins=lArDQGlobals.CNFN_ncoh, xmin=lArDQGlobals.CNFXmin_ncoh, xmax=lArDQGlobals.CNFXmax_ncoh,
149 pattern=febsToMonitorEndcapA)
150
151 cnfArray.defineHistogram(noncoh_var_and_name,
152 title=noncoh_plot_name,
153 type='TH1F',
154 path=hist_path+'EndcapC',
155 xbins=lArDQGlobals.CNFN_ncoh, xmin=lArDQGlobals.CNFXmin_ncoh, xmax=lArDQGlobals.CNFXmax_ncoh,
156 pattern=febsToMonitorEndcapC)
157
158 log.info(cnfArray.toolList())
159
160 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
161 cfg=ComponentAccumulator()
162 cfg.merge(helper.result())
163 return cfg
164
165
Helper class to manipulate strings for LArOnlineID names.