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();
72 const unsigned int run_number = eventInfo->runNumber();
74 if (!bcidHdl.isValid()) {
75 ATH_MSG_ERROR(
"Unable to retrieve BunchCrossing conditions object (SiT)" );
76 }
77 const BunchCrossingCondData* bcData{*bcidHdl};
78
79 int bx_diff =
int(run_number) >= 521800 ? 2 : 1;
80
83 {
85 fill(
"AFPSiLayerTool", bcidAll);
87 {
90 fill(
"AFPSiLayerTool", bcidFront);
91 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockFront);
92 }
93 else
94 {
96 {
99 fill(
"AFPSiLayerTool", bcidMiddle);
100 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockMiddle);
101 }
102 else
103 {
106 fill(
"AFPSiLayerTool", bcidEnd);
107 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockEnd);
108 }
109 }
110 }
111
112
113
114 auto lb = Monitored::Scalar<int>(
"lb", 0);
115 auto muPerBX = Monitored::Scalar<float>("muPerBX", 0.0);
116
117
118 auto nSiHits = Monitored::Scalar<int>(
"nSiHits", 1);
119
120 auto pixelRowIDChip = Monitored::Scalar<int>("pixelRowIDChip", 0);
121 auto pixelColIDChip = Monitored::Scalar<int>("pixelColIDChip", 0);
122
124
125 auto clusterX = Monitored::Scalar<float>("clusterX", 0.0);
126 auto clusterY = Monitored::Scalar<float>("clusterY", 0.0);
127 auto clustersInPlanes = Monitored::Scalar<int>("clustersInPlanes", 0);
128
129 auto trackX = Monitored::Scalar<float>("trackX", 0.0);
130 auto trackY = Monitored::Scalar<float>("trackY", 0.0);
131
132 auto planeHits = Monitored::Scalar<int>("planeHits", 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 numberOfHitsPerStation = hitsItr->stationID();
199 fill(
"AFPSiLayerTool", numberOfHitsPerStation);
200
201 fill(
"AFPSiLayerTool", lbHits);
202 }
203 else ATH_MSG_WARNING(
"Unrecognised station index: " << hitsItr->stationID());
204 }
205
206 auto hitsPerPlaneProfile = Monitored::Scalar<float>("hitsPerPlaneProfile", 0.0);
207 auto lbhitsPerPlaneProfile = Monitored::Scalar<int>("lbhitsPerPlaneProfile", 0);
208 auto hitsPerPlaneEventsMu = Monitored::Scalar<float>("hitsPerPlaneEventsMu", 0.0);
209 auto hitPerPlaneEventMuIndex = Monitored::Scalar<int>("hitPerPlaneEventMuIndex", 0);
210
211 lbhitsPerPlaneProfile = eventInfo->lumiBlock();
212 for(int i_station = 0; i_station < 4; i_station++)
213 for(int j_layer = 0; j_layer < 4; j_layer++)
214 {
215 hitsPerPlaneProfile = numberOfHitsPerPlane[i_station][j_layer]/muPerBX;
217 if (muPerBX != 0.0) {
218 hitsPerPlaneEventsMu = numberOfHitsPerPlane[i_station][j_layer] / muPerBX;
219 }
220 hitPerPlaneEventMuIndex = reorganizePlanes(i_station, j_layer);
221 fill(
"AFPSiLayerTool", hitPerPlaneEventMuIndex, hitsPerPlaneEventsMu);
222 }
223
224 bool noEventsInStations = true;
225 for(
int i=0;
i<4;
i++)
226 {
227 if(eventsInStations[i]>0) {
229
230 eventsPerStation =
i * 4;
231 fill(
"AFPSiLayerTool", eventsPerStation);
232 ++eventsPerStation;
233 fill(
"AFPSiLayerTool", eventsPerStation);
234 ++eventsPerStation;
235 fill(
"AFPSiLayerTool", eventsPerStation);
236 ++eventsPerStation;
237 fill(
"AFPSiLayerTool", eventsPerStation);
238
239 noEventsInStations = false;
240 }
241 }
242 if(!noEventsInStations)
243 {
244 fill(
"AFPSiLayerTool", lbEventsStationsAll);
245 }
246
247
248 AFPMon::AFPFastReco
fast(afpHitContainer.get());
250
251
252 unsigned int totalTracksAll[4] = {};
253 unsigned int totalTracksFront[4] = {};
254 unsigned int totalTracksMiddle[4] = {};
255 unsigned int totalTracksEnd[4] = {};
256
257 for (
const auto& track :
fast.tracks())
258 {
259 trackX =
track.x * 1.0;
260 trackY =
track.y * 1.0;
262
263 if (position == FRONT)
264 {
265 ++totalTracksFront[
track.station];
266 ++totalTracksAll[
track.station];
267 }
268 else if (position == MIDDLE)
269 {
270 ++totalTracksMiddle[
track.station];
271 ++totalTracksAll[
track.station];
272 }
273 else if (position == END)
274 {
275 ++totalTracksEnd[
track.station];
276 ++totalTracksAll[
track.station];
277 }
278 }
279
280 auto lbTracksAll = Monitored::Scalar<int>("lbTracksAll", 0);
281 auto lbTracksFront = Monitored::Scalar<int>("lbTracksFront", 0);
282 auto lbTracksMiddle = Monitored::Scalar<int>("lbTracksMiddle", 0);
283 auto lbTracksEnd = Monitored::Scalar<int>("lbTracksEnd", 0);
284
285 auto Total_tracks_All_profile = Monitored::Scalar<float>("Total_tracks_All_profile", 0.0);
286 auto Total_tracks_Front_profile = Monitored::Scalar<float>("Total_tracks_Front_profile", 0.0);
287 auto Total_tracks_Middle_profile = Monitored::Scalar<float>("Total_tracks_Middle_profile", 0.0);
288 auto Total_tracks_End_profile = Monitored::Scalar<float>("Total_tracks_End_profile", 0.0);
289
290 lbTracksAll = eventInfo->lumiBlock();
291 lbTracksFront = eventInfo->lumiBlock();
292 lbTracksMiddle = eventInfo->lumiBlock();
293 lbTracksEnd = eventInfo->lumiBlock();
294
295 for(
int i = 0;
i < 4;
i++)
296 {
297 Total_tracks_All_profile = totalTracksAll[
i] / muPerBX;
299 totalTracksAll[
i] = 0;
300
301 Total_tracks_Front_profile = totalTracksFront[
i] / muPerBX;
302 if (position == FRONT)
304 totalTracksFront[
i] = 0;
305
306 Total_tracks_Middle_profile = totalTracksMiddle[
i] / muPerBX;
307 if (position == MIDDLE)
309 totalTracksMiddle[
i] = 0;
310
311 Total_tracks_End_profile = totalTracksEnd[
i] / muPerBX;
312 if (position == END)
314 totalTracksEnd[
i] = 0;
315 }
316
317
318 unsigned int totalClustersAll[4][4] = {};
319 unsigned int totalClustersFront[4][4] = {};
320 unsigned int totalClustersMiddle[4][4] = {};
321 unsigned int totalClustersEnd[4][4] = {};
322
323 auto clustersPerPlaneAllPP = Monitored::Scalar<float>("clustersPerPlaneAllPP", 0.0);
324 auto clustersPerPlaneFrontPP = Monitored::Scalar<float>("clustersPerPlaneFrontPP", 0.0);
325 auto clustersPerPlaneMiddlePP = Monitored::Scalar<float>("clustersPerPlaneMiddlePP", 0.0);
326 auto clustersPerPlaneEndPP = Monitored::Scalar<float>("clustersPerPlaneEndPP", 0.0);
327
328 auto lbClustersPerPlanesAll = Monitored::Scalar<int>("lbClustersPerPlanesAll", 0);
329 auto lbClustersPerPlanesFront = Monitored::Scalar<int>("lbClustersPerPlanesFront", 0);
330 auto lbClustersPerPlanesMiddle = Monitored::Scalar<int>("lbClustersPerPlanesMiddle", 0);
331 auto lbClustersPerPlanesEnd = Monitored::Scalar<int>("lbClustersPerPlanesEnd", 0);
332
333 lbClustersPerPlanesAll = eventInfo->lumiBlock();
334 lbClustersPerPlanesFront = eventInfo->lumiBlock();
335 lbClustersPerPlanesMiddle = eventInfo->lumiBlock();
336 lbClustersPerPlanesEnd = eventInfo->lumiBlock();
337
338 for(
const auto& cluster :
fast.clusters())
339 {
340 clusterX = cluster.x * 1.0;
341 clusterY = cluster.y * 1.0;
343 if (cluster.station == 0 || cluster.station == 1)
344 {
345 clustersInPlanes = reorganizePlanes(cluster.station, cluster.layer);
346 }
347 else
348 {
349 clustersInPlanes = (cluster.station*4)+cluster.layer;
350 }
351 fill(
"AFPSiLayerTool", clustersInPlanes);
352
353 clusterToT = cluster.sumToT;
355
356 if (position == FRONT)
357 {
358 ++totalClustersFront[cluster.station][cluster.layer];
359 ++totalClustersAll[cluster.station][cluster.layer];
360 }
361 else if (position == MIDDLE)
362 {
363 ++totalClustersMiddle[cluster.station][cluster.layer];
364 ++totalClustersAll[cluster.station][cluster.layer];
365 }
366 else if (position == END)
367 {
368 ++totalClustersEnd[cluster.station][cluster.layer];
369 ++totalClustersAll[cluster.station][cluster.layer];
370 }
371 }
372
373 for(int i_station = 0; i_station < 4; i_station++)
374 for(int j_layer = 0; j_layer < 4; j_layer++)
375 {
376 clustersPerPlaneAllPP = totalClustersAll[i_station][j_layer] / muPerBX;
378 totalClustersAll[i_station][j_layer] = 0;
379
380 clustersPerPlaneFrontPP = totalClustersFront[i_station][j_layer] / muPerBX;
381 if (position == FRONT)
383 totalClustersFront[i_station][j_layer] = 0;
384
385 clustersPerPlaneMiddlePP = totalClustersMiddle[i_station][j_layer] / muPerBX;
386 if (position == MIDDLE)
388 totalClustersMiddle[i_station][j_layer] = 0;
389
390 clustersPerPlaneEndPP = totalClustersEnd[i_station][j_layer] / muPerBX;
391 if (position == END)
393 totalClustersEnd[i_station][j_layer] = 0;
394 }
395
397}
#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) const
Calculate instantaneous number of interactions, i.e.
float nSiHits(const U &p)
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
setEventNumber setTimeStamp bcid