121def _define_histograms(partition, part_index, montool, alg):
122 common_args = {
123 'path': '{0}',
124 'pattern': [partition],
125 'opt' : 'kAlwaysCreate'
126
127 }
128 hargs2d = {
129 **common_args,
130 'type': 'TH2I',
131 **_superslot_channel_axis_ranges(partition),
132 }
133 lumiblock_binning = {'xbins': 3000, 'xmin': 0.5, 'xmax': 3000.5}
134 title = ' as a function of FEB and channel in {0};' \
135 'Halfcrate (+ increasing slot);Channel'
136 sigma_pos = '{:g}#sigma'.format(alg.pos_noise_thresholds[part_index])
137 sigma_neg = '{:g}#sigma'.format(alg.neg_noise_thresholds[part_index])
138 montool.defineHistogram(
139 'S,C;{0}_occupancy', **hargs2d,
140 cutmask='occ',
141 title='Number of events above {:g} MeV{}'.format(
142 alg.occupancy_thresholds[part_index] / MeV,
143 title))
144 hargs2d['type'] = 'TProfile2D'
145 title = title.replace('{0}', '{0} (no LArEventInfo::ERROR)')
146 if alg.monitor_signal:
147 montool.defineHistogram(
148 'S,C,E;{0}_signal_AVG', **hargs2d,
149 cutmask='sig',
150 title='{0}{1};{0}'.format('Average Energy (MeV)', title))
151 montool.defineHistogram(
152 'S,C,G;{0}_gain', **hargs2d,
153 cutmask='sig',
154 title='{0}{1};{0}'.format('Average gain', title))
155 title += ';Percentage Accepted'
156 percent = 'Percentage of events '
157 if alg.monitor_positive_noise:
158 montool.defineHistogram(
159 'S,C,posn;{0}_acceptance_AVG', **hargs2d,
160 title='{} above {} total noise{}'.format(
161 percent, sigma_pos, title))
162 if alg.monitor_negative_noise:
163 montool.defineHistogram(
164 'S,C,negn;{0}_noise_acceptance_AVG', **hargs2d,
165 title='{} below -{} total noise{}'.format(
166 percent, sigma_neg, title))
167 if alg.monitor_quality:
168 montool.defineHistogram(
169 'S,C,Q4k;{0}_quality_AVG', **hargs2d,
170 title='{} with q-factor above {:g}{}'.format(
171 percent, alg.quality_threshold, title))
172 if alg.monitor_quality:
173 montool.defineHistogram(
174 'nQ4k;{0}_quality_nChannel', **common_args,
175 type='TH1D', xbins=50, xmin=-0.5, xmax=49.5,
176 title = 'Number of channels in {{0}} with q-factor > {};' \
177 'Number of channels;Number of events per channel'.format(
178 alg.quality_threshold))
179 montool.defineHistogram(
180 'lb;{0}_quality_burst', **common_args,
181 type='TH1D', **lumiblock_binning, cutmask='qburst',
182 title = 'Number of events with more than {:g}% ' \
183 'of all channels in {{0}} reporting q-factor > {};' \
184 'Luminosity Block;Number of events per LB'.format(
185 alg.noise_burst_percent_threshold[part_index],
186 alg.quality_threshold))
187 if alg.monitor_burst:
188 title = 'Yield of channels with E > +{t} in {{0}}{cut};' \
189 'Percent of channels;Number of events per 0.02%'
190 hargs = {
191 **common_args,
192 'type': 'TH1D',
193 'xbins': 375,
194 'xmin': 0.,
195 'xmax': 7.5
196 }
197 name = '%noisy;{0}_noise_fraction'
198 montool.defineHistogram(
199 name, **hargs, title=title.format(t=sigma_pos, cut=''))
200 montool.defineHistogram(
201 '%noisy_neg;{0}_noise_fraction_Neg', **hargs,
202 title=title.replace('> +', '< -').format(t=sigma_neg, cut=''))
203 montool.defineHistogram(
204 name + '_W', **hargs, cutmask='quietW',
205 title=title.format(t=sigma_pos, cut=' (no LArNoisyRO_StdOpt)'))
206 montool.defineHistogram(
207 name + '_NoLArNoisyRO', **hargs, cutmask='quiet',
208 title=title.format(t=sigma_pos, cut=' (no LArNoisyRO_Std)'))
209 montool.defineHistogram(
210 name + '_TimeVetoLArNoisyRO', **hargs, cutmask='quietITW',
211 title=title.format(t=sigma_pos, cut=' (time vetoed)'))
212 title = 'Number of events with Y(3#sigma) > {t} in {{0}}{cut};' \
213 'Luminosity Block;Number of events per LB'
214 hargs = {**common_args, 'type': 'TH1D', **lumiblock_binning}
215 tb = '{:g}%'.format(alg.noise_burst_percent_threshold[part_index])
216 montool.defineHistogram(
217 'lb;{0}_burst', **hargs, cutmask='burst',
218 title=title.format(t=tb, cut=''))
219 montool.defineHistogram(
220 'lb;{0}_timeVetoBurst', **hargs, cutmask='burst_quietW',
221 title=title.format(t=tb, cut=' (time vetoed)'))
222 if alg.monitor_time:
223 montool.defineHistogram(
224 'T;{0}_mean_feb_time', **common_args, type='TH1D',
225 xbins=101, xmin=-50.5, xmax=50.5,
226 title='Average time of channels in each FEB of {{0}} ' \
227 'reporting E > {} #sigma;<t(FEB)> - <t(event)> (ns);' \
228 'Number of FEBs per ns'.format(alg.time_threshold))
229 if alg.monitor_signal:
230 montool.defineHistogram(
231 'lb,detE;{0}_pedestal_evolution', **common_args, type='TProfile',
232 **lumiblock_binning, cutmask='quietW',
233 title='Energy sum (time vetoed) in {0};' \
234 'Luminosity Block;Mean total energy(MeV)')
235 montool.defineHistogram(
236 'bc,detE;{0}_sumE_vs_BCID', **common_args, type='TProfile',
237 xbins=3564, xmin=0.5, xmax=3564.5,
238 title = 'Energy sum per bunch crossing in {0};' \
239 'Bunch Crossing ID;Mean total energy (MeV)')
240
241