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 auto planeHitsAllMU = Monitored::Scalar<int>("planeHitsAllMU", 0);
132 auto weightAllPlanes = Monitored::Scalar<float>("weightAllPlanes", 1.0);
133
134 auto numberOfHitsPerStation = Monitored::Scalar<int>("numberOfHitsPerStation", 0);
135
136 auto lbEvents = Monitored::Scalar<int>("lbEvents", 0);
137 auto lbHits = Monitored::Scalar<int>("lbHits", 0);
138 auto lbEventsStations = Monitored::Scalar<int>("lbEventsStations", 0);
139 auto lbEventsStationsAll = Monitored::Scalar<int>("lbEventsStationsAll", 0);
140
141 auto planes = Monitored::Scalar<int>("planes", 0);
142
143 auto eventsPerStation = Monitored::Scalar<int>("eventsPerStation", 0);
144
145 auto clusterToT = Monitored::Scalar<int>("clusterToT", 0);
146
147 lb = eventInfo->lumiBlock();
148 lbEvents = eventInfo->lumiBlock();
149
151 if (muPerBX == 0.0) {
152 ATH_MSG_DEBUG(
"AverageInteractionsPerCrossing is 0, forcing to 1.0");
153 muPerBX=1.0;
154 }
155 fill(
"AFPSiLayerTool",
lb, muPerBX);
156 fill(
"AFPSiLayerTool", lbEvents);
157
158
160 if(! afpHitContainer.isValid())
161 {
163 return StatusCode::SUCCESS;
164 }
165
166 ATH_CHECK( afpHitContainer.initialize() );
167
168 nSiHits = afpHitContainer->size();
169 fill(
"AFPSiLayerTool",
lb, nSiHits);
170
171 int eventsInStations[4] = {};
172 int numberOfHitsPerPlane[4][4] = {};
173
175 {
176 lb = eventInfo->lumiBlock();
177 lbHits = eventInfo->lumiBlock();
178 lbEventsStations = eventInfo->lumiBlock();
179 lbEventsStationsAll = eventInfo->lumiBlock();
180 pixelRowIDChip = hitsItr->pixelRowIDChip();
181 pixelColIDChip = hitsItr->pixelColIDChip();
183
184
185 if (hitsItr->stationID()<4 && hitsItr->stationID()>=0 && hitsItr->pixelLayerID()<4 && hitsItr->pixelLayerID()>=0)
186 {
187 ++eventsInStations[hitsItr->stationID()];
188
193
194 planeHits = hitsItr->pixelLayerID();
196
197 ++numberOfHitsPerPlane[hitsItr->stationID()][hitsItr->pixelLayerID()];
198 planeHitsAllMU = reorganizePlanes(hitsItr->stationID(), hitsItr->pixelLayerID());
199 weightAllPlanes = 1 / muPerBX;
200 fill(
"AFPSiLayerTool", planeHitsAllMU, weightAllPlanes);
201 weightAllPlanes = 1.0;
202
203 numberOfHitsPerStation = hitsItr->stationID();
204 fill(
"AFPSiLayerTool", numberOfHitsPerStation);
205
206 fill(
"AFPSiLayerTool", lbHits);
207 }
208 else ATH_MSG_WARNING(
"Unrecognised station index: " << hitsItr->stationID());
209 }
210
211 auto hitsPerPlaneProfile = Monitored::Scalar<float>("hitsPerPlaneProfile", 0.0);
212 auto lbhitsPerPlaneProfile = Monitored::Scalar<int>("lbhitsPerPlaneProfile", 0);
213
214 lbhitsPerPlaneProfile = eventInfo->lumiBlock();
215 for(int i_station = 0; i_station < 4; i_station++)
216 for(int j_layer = 0; j_layer < 4; j_layer++)
217 {
218 hitsPerPlaneProfile = numberOfHitsPerPlane[i_station][j_layer]/muPerBX;
220 }
221
222
223 bool noEventsInStations = true;
224 for(
int i=0;
i<4;
i++)
225 {
226 if(eventsInStations[i]>0) {
228
229 eventsPerStation =
i * 4;
230 fill(
"AFPSiLayerTool", eventsPerStation);
231 ++eventsPerStation;
232 fill(
"AFPSiLayerTool", eventsPerStation);
233 ++eventsPerStation;
234 fill(
"AFPSiLayerTool", eventsPerStation);
235 ++eventsPerStation;
236 fill(
"AFPSiLayerTool", eventsPerStation);
237
238 noEventsInStations = false;
239 }
240 }
241 if(!noEventsInStations)
242 {
243 fill(
"AFPSiLayerTool", lbEventsStationsAll);
244 }
245
246
247 AFPMon::AFPFastReco
fast(afpHitContainer.get());
249
250
251 unsigned int totalTracksAll[4] = {};
252 unsigned int totalTracksFront[4] = {};
253 unsigned int totalTracksMiddle[4] = {};
254 unsigned int totalTracksEnd[4] = {};
255
256 for (
const auto& track :
fast.tracks())
257 {
258 trackX =
track.x * 1.0;
259 trackY =
track.y * 1.0;
261
262 if (position == FRONT)
263 {
264 ++totalTracksFront[
track.station];
265 ++totalTracksAll[
track.station];
266 }
267 else if (position == MIDDLE)
268 {
269 ++totalTracksMiddle[
track.station];
270 ++totalTracksAll[
track.station];
271 }
272 else if (position == END)
273 {
274 ++totalTracksEnd[
track.station];
275 ++totalTracksAll[
track.station];
276 }
277 }
278
279 auto lbTracksAll = Monitored::Scalar<int>("lbTracksAll", 0);
280 auto lbTracksFront = Monitored::Scalar<int>("lbTracksFront", 0);
281 auto lbTracksMiddle = Monitored::Scalar<int>("lbTracksMiddle", 0);
282 auto lbTracksEnd = Monitored::Scalar<int>("lbTracksEnd", 0);
283
284 auto Total_tracks_All_profile = Monitored::Scalar<float>("Total_tracks_All_profile", 0.0);
285 auto Total_tracks_Front_profile = Monitored::Scalar<float>("Total_tracks_Front_profile", 0.0);
286 auto Total_tracks_Middle_profile = Monitored::Scalar<float>("Total_tracks_Middle_profile", 0.0);
287 auto Total_tracks_End_profile = Monitored::Scalar<float>("Total_tracks_End_profile", 0.0);
288
289 lbTracksAll = eventInfo->lumiBlock();
290 lbTracksFront = eventInfo->lumiBlock();
291 lbTracksMiddle = eventInfo->lumiBlock();
292 lbTracksEnd = eventInfo->lumiBlock();
293
294 for(
int i = 0;
i < 4;
i++)
295 {
296 Total_tracks_All_profile = totalTracksAll[
i] / muPerBX;
298 totalTracksAll[
i] = 0;
299
300 Total_tracks_Front_profile = totalTracksFront[
i] / muPerBX;
301 if (position == FRONT)
303 totalTracksFront[
i] = 0;
304
305 Total_tracks_Middle_profile = totalTracksMiddle[
i] / muPerBX;
306 if (position == MIDDLE)
308 totalTracksMiddle[
i] = 0;
309
310 Total_tracks_End_profile = totalTracksEnd[
i] / muPerBX;
311 if (position == END)
313 totalTracksEnd[
i] = 0;
314 }
315
316
317 unsigned int totalClustersAll[4][4] = {};
318 unsigned int totalClustersFront[4][4] = {};
319 unsigned int totalClustersMiddle[4][4] = {};
320 unsigned int totalClustersEnd[4][4] = {};
321
322 auto clustersPerPlaneAllPP = Monitored::Scalar<float>("clustersPerPlaneAllPP", 0.0);
323 auto clustersPerPlaneFrontPP = Monitored::Scalar<float>("clustersPerPlaneFrontPP", 0.0);
324 auto clustersPerPlaneMiddlePP = Monitored::Scalar<float>("clustersPerPlaneMiddlePP", 0.0);
325 auto clustersPerPlaneEndPP = Monitored::Scalar<float>("clustersPerPlaneEndPP", 0.0);
326
327 auto lbClustersPerPlanesAll = Monitored::Scalar<int>("lbClustersPerPlanesAll", 0);
328 auto lbClustersPerPlanesFront = Monitored::Scalar<int>("lbClustersPerPlanesFront", 0);
329 auto lbClustersPerPlanesMiddle = Monitored::Scalar<int>("lbClustersPerPlanesMiddle", 0);
330 auto lbClustersPerPlanesEnd = Monitored::Scalar<int>("lbClustersPerPlanesEnd", 0);
331
332 lbClustersPerPlanesAll = eventInfo->lumiBlock();
333 lbClustersPerPlanesFront = eventInfo->lumiBlock();
334 lbClustersPerPlanesMiddle = eventInfo->lumiBlock();
335 lbClustersPerPlanesEnd = eventInfo->lumiBlock();
336
337 for(
const auto& cluster :
fast.clusters())
338 {
339 clusterX = cluster.x * 1.0;
340 clusterY = cluster.y * 1.0;
342 if (cluster.station == 0 || cluster.station == 1)
343 {
344 clustersInPlanes = reorganizePlanes(cluster.station, cluster.layer);
345 }
346 else
347 {
348 clustersInPlanes = (cluster.station*4)+cluster.layer;
349 }
350 fill(
"AFPSiLayerTool", clustersInPlanes);
351
352 clusterToT = cluster.sumToT;
354
355 if (position == FRONT)
356 {
357 ++totalClustersFront[cluster.station][cluster.layer];
358 ++totalClustersAll[cluster.station][cluster.layer];
359 }
360 else if (position == MIDDLE)
361 {
362 ++totalClustersMiddle[cluster.station][cluster.layer];
363 ++totalClustersAll[cluster.station][cluster.layer];
364 }
365 else if (position == END)
366 {
367 ++totalClustersEnd[cluster.station][cluster.layer];
368 ++totalClustersAll[cluster.station][cluster.layer];
369 }
370 }
371
372 for(int i_station = 0; i_station < 4; i_station++)
373 for(int j_layer = 0; j_layer < 4; j_layer++)
374 {
375 clustersPerPlaneAllPP = totalClustersAll[i_station][j_layer] / muPerBX;
377 totalClustersAll[i_station][j_layer] = 0;
378
379 clustersPerPlaneFrontPP = totalClustersFront[i_station][j_layer] / muPerBX;
380 if (position == FRONT)
382 totalClustersFront[i_station][j_layer] = 0;
383
384 clustersPerPlaneMiddlePP = totalClustersMiddle[i_station][j_layer] / muPerBX;
385 if (position == MIDDLE)
387 totalClustersMiddle[i_station][j_layer] = 0;
388
389 clustersPerPlaneEndPP = totalClustersEnd[i_station][j_layer] / muPerBX;
390 if (position == END)
392 totalClustersEnd[i_station][j_layer] = 0;
393 }
394
396}
#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