User will overwrite this function. Histogram booking is no longer done in C++. This function is called in execute once the filters are all passed.
53 {
54 using namespace Monitored;
55
56 auto bcidAll = Monitored::Scalar<int>("bcidAll", 0);
57 auto bcidFront = Monitored::Scalar<int>("bcidFront", 0);
58 auto bcidMiddle = Monitored::Scalar<int>("bcidMiddle", 0);
59 auto bcidEnd = Monitored::Scalar<int>("bcidEnd", 0);
60
61 auto numberOfEventsPerLumiblockFront = Monitored::Scalar<int>("numberOfEventsPerLumiblockFront", 0);
62 auto numberOfEventsPerLumiblockMiddle = Monitored::Scalar<int>("numberOfEventsPerLumiblockMiddle", 0);
63 auto numberOfEventsPerLumiblockEnd = Monitored::Scalar<int>("numberOfEventsPerLumiblockEnd", 0);
64
65 SG::ReadHandle<xAOD::EventInfo> eventInfo =
GetEventInfo(ctx);
66 numberOfEventsPerLumiblockFront = eventInfo->lumiBlock();
67 numberOfEventsPerLumiblockMiddle = eventInfo->lumiBlock();
68 numberOfEventsPerLumiblockEnd = eventInfo->lumiBlock();
69
70
71 const unsigned int bcid = eventInfo->bcid();
73 if (!bcidHdl.isValid()) {
74 ATH_MSG_ERROR(
"Unable to retrieve BunchCrossing conditions object (SiT)" );
75 }
76 const BunchCrossingCondData* bcData{*bcidHdl};
77
78
79 enum { FRONT, MIDDLE,
END, NPOS } position = NPOS;
81 {
83 fill(
"AFPSiLayerTool", bcidAll);
85 {
86 position = FRONT;
88 fill(
"AFPSiLayerTool", bcidFront);
89 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockFront);
90 }
91 else
92 {
94 {
95 position = MIDDLE;
97 fill(
"AFPSiLayerTool", bcidMiddle);
98 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockMiddle);
99 }
100 else
101 {
104 fill(
"AFPSiLayerTool", bcidEnd);
105 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockEnd);
106 }
107 }
108 }
109
110
111
112 auto lb = Monitored::Scalar<int>(
"lb", 0);
113 auto muPerBX = Monitored::Scalar<float>("muPerBX", 0.0);
114
115
116 auto nSiHits = Monitored::Scalar<int>(
"nSiHits", 1);
117
118 auto pixelRowIDChip = Monitored::Scalar<int>("pixelRowIDChip", 0);
119 auto pixelColIDChip = Monitored::Scalar<int>("pixelColIDChip", 0);
120
122
123 auto clusterX = Monitored::Scalar<float>("clusterX", 0.0);
124 auto clusterY = Monitored::Scalar<float>("clusterY", 0.0);
125 auto clustersInPlanes = Monitored::Scalar<int>("clustersInPlanes", 0);
126
127 auto trackX = Monitored::Scalar<float>("trackX", 0.0);
128 auto trackY = Monitored::Scalar<float>("trackY", 0.0);
129
130 auto planeHits = Monitored::Scalar<int>("planeHits", 0);
131
132 auto numberOfHitsPerStation = Monitored::Scalar<int>("numberOfHitsPerStation", 0);
133
134 auto lbEvents = Monitored::Scalar<int>("lbEvents", 0);
135 auto lbHits = Monitored::Scalar<int>("lbHits", 0);
136 auto lbEventsStations = Monitored::Scalar<int>("lbEventsStations", 0);
137 auto lbEventsStationsAll = Monitored::Scalar<int>("lbEventsStationsAll", 0);
138
139 auto planes = Monitored::Scalar<int>("planes", 0);
140
141 auto eventsPerStation = Monitored::Scalar<int>("eventsPerStation", 0);
142
143 auto clusterToT = Monitored::Scalar<int>("clusterToT", 0);
144
145 lb = eventInfo->lumiBlock();
146 lbEvents = eventInfo->lumiBlock();
147
149 if (muPerBX == 0.0) {
150 ATH_MSG_DEBUG(
"AverageInteractionsPerCrossing is 0, forcing to 1.0");
151 muPerBX=1.0;
152 }
153 fill(
"AFPSiLayerTool",
lb, muPerBX);
154 fill(
"AFPSiLayerTool", lbEvents);
155
156
158 if(! afpHitContainer.isValid())
159 {
161 return StatusCode::SUCCESS;
162 }
163
164 ATH_CHECK( afpHitContainer.initialize() );
165
166 nSiHits = afpHitContainer->size();
167 fill(
"AFPSiLayerTool",
lb, nSiHits);
168
169 int eventsInStations[4] = {};
170 int numberOfHitsPerPlane[4][4] = {};
171
173 {
174 lb = eventInfo->lumiBlock();
175 lbHits = eventInfo->lumiBlock();
176 lbEventsStations = eventInfo->lumiBlock();
177 lbEventsStationsAll = eventInfo->lumiBlock();
178 pixelRowIDChip = hitsItr->pixelRowIDChip();
179 pixelColIDChip = hitsItr->pixelColIDChip();
181
182
183 if (hitsItr->stationID()<4 && hitsItr->stationID()>=0 && hitsItr->pixelLayerID()<4 && hitsItr->pixelLayerID()>=0)
184 {
185 ++eventsInStations[hitsItr->stationID()];
186
191
192 planeHits = hitsItr->pixelLayerID();
194
195 ++numberOfHitsPerPlane[hitsItr->stationID()][hitsItr->pixelLayerID()];
196 numberOfHitsPerStation = hitsItr->stationID();
197 fill(
"AFPSiLayerTool", numberOfHitsPerStation);
198
199 fill(
"AFPSiLayerTool", lbHits);
200 }
201 else ATH_MSG_WARNING(
"Unrecognised station index: " << hitsItr->stationID());
202 }
203
204 auto hitsPerPlaneProfile = Monitored::Scalar<float>("hitsPerPlaneProfile", 0.0);
205 auto lbhitsPerPlaneProfile = Monitored::Scalar<int>("lbhitsPerPlaneProfile", 0);
206 auto hitsPerPlaneEventsMu = Monitored::Scalar<float>("hitsPerPlaneEventsMu", 0.0);
207 auto hitPerPlaneEventMuIndex = Monitored::Scalar<int>("hitPerPlaneEventMuIndex", 0);
208
209 lbhitsPerPlaneProfile = eventInfo->lumiBlock();
210 for(int i_station = 0; i_station < 4; i_station++)
211 for(int j_layer = 0; j_layer < 4; j_layer++)
212 {
213 hitsPerPlaneProfile = numberOfHitsPerPlane[i_station][j_layer]/muPerBX;
215 if (muPerBX != 0.0) {
216 hitsPerPlaneEventsMu = numberOfHitsPerPlane[i_station][j_layer] / muPerBX;
217 }
218 hitPerPlaneEventMuIndex = reorganizePlanes(i_station, j_layer);
219 fill(
"AFPSiLayerTool", hitPerPlaneEventMuIndex, hitsPerPlaneEventsMu);
220 }
221
222 bool noEventsInStations = true;
223 for(
int i=0;
i<4;
i++)
224 {
225 if(eventsInStations[i]>0) {
227
228 eventsPerStation =
i * 4;
229 fill(
"AFPSiLayerTool", eventsPerStation);
230 ++eventsPerStation;
231 fill(
"AFPSiLayerTool", eventsPerStation);
232 ++eventsPerStation;
233 fill(
"AFPSiLayerTool", eventsPerStation);
234 ++eventsPerStation;
235 fill(
"AFPSiLayerTool", eventsPerStation);
236
237 noEventsInStations = false;
238 }
239 }
240 if(!noEventsInStations)
241 {
242 fill(
"AFPSiLayerTool", lbEventsStationsAll);
243 }
244
245
246 AFPMon::AFPFastReco
fast(afpHitContainer.get());
248
249
250 unsigned int totalTracksAll[4] = {};
251 unsigned int totalTracksFront[4] = {};
252 unsigned int totalTracksMiddle[4] = {};
253 unsigned int totalTracksEnd[4] = {};
254
255 for (
const auto& track :
fast.tracks())
256 {
257 trackX =
track.x * 1.0;
258 trackY =
track.y * 1.0;
260
261 if (position == FRONT)
262 {
263 ++totalTracksFront[
track.station];
264 ++totalTracksAll[
track.station];
265 }
266 else if (position == MIDDLE)
267 {
268 ++totalTracksMiddle[
track.station];
269 ++totalTracksAll[
track.station];
270 }
271 else if (position == END)
272 {
273 ++totalTracksEnd[
track.station];
274 ++totalTracksAll[
track.station];
275 }
276 }
277
278 auto lbTracksAll = Monitored::Scalar<int>("lbTracksAll", 0);
279 auto lbTracksFront = Monitored::Scalar<int>("lbTracksFront", 0);
280 auto lbTracksMiddle = Monitored::Scalar<int>("lbTracksMiddle", 0);
281 auto lbTracksEnd = Monitored::Scalar<int>("lbTracksEnd", 0);
282
283 auto Total_tracks_All_profile = Monitored::Scalar<float>("Total_tracks_All_profile", 0.0);
284 auto Total_tracks_Front_profile = Monitored::Scalar<float>("Total_tracks_Front_profile", 0.0);
285 auto Total_tracks_Middle_profile = Monitored::Scalar<float>("Total_tracks_Middle_profile", 0.0);
286 auto Total_tracks_End_profile = Monitored::Scalar<float>("Total_tracks_End_profile", 0.0);
287
288 lbTracksAll = eventInfo->lumiBlock();
289 lbTracksFront = eventInfo->lumiBlock();
290 lbTracksMiddle = eventInfo->lumiBlock();
291 lbTracksEnd = eventInfo->lumiBlock();
292
293 for(
int i = 0;
i < 4;
i++)
294 {
295 Total_tracks_All_profile = totalTracksAll[
i] / muPerBX;
297 totalTracksAll[
i] = 0;
298
299 Total_tracks_Front_profile = totalTracksFront[
i] / muPerBX;
300 if (position == FRONT)
302 totalTracksFront[
i] = 0;
303
304 Total_tracks_Middle_profile = totalTracksMiddle[
i] / muPerBX;
305 if (position == MIDDLE)
307 totalTracksMiddle[
i] = 0;
308
309 Total_tracks_End_profile = totalTracksEnd[
i] / muPerBX;
310 if (position == END)
312 totalTracksEnd[
i] = 0;
313 }
314
315
316 unsigned int totalClustersAll[4][4] = {};
317 unsigned int totalClustersFront[4][4] = {};
318 unsigned int totalClustersMiddle[4][4] = {};
319 unsigned int totalClustersEnd[4][4] = {};
320
321 auto clustersPerPlaneAllPP = Monitored::Scalar<float>("clustersPerPlaneAllPP", 0.0);
322 auto clustersPerPlaneFrontPP = Monitored::Scalar<float>("clustersPerPlaneFrontPP", 0.0);
323 auto clustersPerPlaneMiddlePP = Monitored::Scalar<float>("clustersPerPlaneMiddlePP", 0.0);
324 auto clustersPerPlaneEndPP = Monitored::Scalar<float>("clustersPerPlaneEndPP", 0.0);
325
326 auto lbClustersPerPlanesAll = Monitored::Scalar<int>("lbClustersPerPlanesAll", 0);
327 auto lbClustersPerPlanesFront = Monitored::Scalar<int>("lbClustersPerPlanesFront", 0);
328 auto lbClustersPerPlanesMiddle = Monitored::Scalar<int>("lbClustersPerPlanesMiddle", 0);
329 auto lbClustersPerPlanesEnd = Monitored::Scalar<int>("lbClustersPerPlanesEnd", 0);
330
331 lbClustersPerPlanesAll = eventInfo->lumiBlock();
332 lbClustersPerPlanesFront = eventInfo->lumiBlock();
333 lbClustersPerPlanesMiddle = eventInfo->lumiBlock();
334 lbClustersPerPlanesEnd = eventInfo->lumiBlock();
335
336 for(
const auto& cluster :
fast.clusters())
337 {
338 clusterX = cluster.x * 1.0;
339 clusterY = cluster.y * 1.0;
341 if (cluster.station == 0 || cluster.station == 1)
342 {
343 clustersInPlanes = reorganizePlanes(cluster.station, cluster.layer);
344 }
345 else
346 {
347 clustersInPlanes = (cluster.station*4)+cluster.layer;
348 }
349 fill(
"AFPSiLayerTool", clustersInPlanes);
350
351 clusterToT = cluster.sumToT;
353
354 if (position == FRONT)
355 {
356 ++totalClustersFront[cluster.station][cluster.layer];
357 ++totalClustersAll[cluster.station][cluster.layer];
358 }
359 else if (position == MIDDLE)
360 {
361 ++totalClustersMiddle[cluster.station][cluster.layer];
362 ++totalClustersAll[cluster.station][cluster.layer];
363 }
364 else if (position == END)
365 {
366 ++totalClustersEnd[cluster.station][cluster.layer];
367 ++totalClustersAll[cluster.station][cluster.layer];
368 }
369 }
370
371 for(int i_station = 0; i_station < 4; i_station++)
372 for(int j_layer = 0; j_layer < 4; j_layer++)
373 {
374 clustersPerPlaneAllPP = totalClustersAll[i_station][j_layer] / muPerBX;
376 totalClustersAll[i_station][j_layer] = 0;
377
378 clustersPerPlaneFrontPP = totalClustersFront[i_station][j_layer] / muPerBX;
379 if (position == FRONT)
381 totalClustersFront[i_station][j_layer] = 0;
382
383 clustersPerPlaneMiddlePP = totalClustersMiddle[i_station][j_layer] / muPerBX;
384 if (position == MIDDLE)
386 totalClustersMiddle[i_station][j_layer] = 0;
387
388 clustersPerPlaneEndPP = totalClustersEnd[i_station][j_layer] / muPerBX;
389 if (position == END)
391 totalClustersEnd[i_station][j_layer] = 0;
392 }
393
395}
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadCondHandleKey< BunchCrossingCondData > m_bunchCrossingKey
std::map< std::string, int > m_StationGroup
virtual StatusCode fillHistogramsPlaneEff(const xAOD::AFPSiHitContainer &) const
std::vector< std::string > m_stationnames
std::vector< std::string > m_pixlayers
std::map< std::string, std::map< std::string, int > > m_StationPlaneGroup
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
bool isFilled(const bcid_type bcid) const
The simplest query: Is the bunch crossing filled or not?
double timeOverThreshold(unsigned int m_word)
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
virtual float lbInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate instantaneous number of interactions, i.e.
float nSiHits(const U &p)
setEventNumber setTimeStamp bcid