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.
45 {
46 using namespace Monitored;
47
48 auto bcidAll = Monitored::Scalar<int>("bcidAll", 0);
49 auto bcidFront = Monitored::Scalar<int>("bcidFront", 0);
50 auto bcidMiddle = Monitored::Scalar<int>("bcidMiddle", 0);
51 auto bcidEnd = Monitored::Scalar<int>("bcidEnd", 0);
52
53 auto numberOfEventsPerLumiblockFront = Monitored::Scalar<int>("numberOfEventsPerLumiblockFront", 0);
54 auto numberOfEventsPerLumiblockMiddle = Monitored::Scalar<int>("numberOfEventsPerLumiblockMiddle", 0);
55 auto numberOfEventsPerLumiblockEnd = Monitored::Scalar<int>("numberOfEventsPerLumiblockEnd", 0);
56
57 SG::ReadHandle<xAOD::EventInfo> eventInfo =
GetEventInfo(ctx);
58 numberOfEventsPerLumiblockFront = eventInfo->lumiBlock();
59 numberOfEventsPerLumiblockMiddle = eventInfo->lumiBlock();
60 numberOfEventsPerLumiblockEnd = eventInfo->lumiBlock();
61
62
63 const unsigned int bcid = eventInfo->bcid();
64 const unsigned int run_number = eventInfo->runNumber();
66 if (!bcidHdl.isValid()) {
67 ATH_MSG_ERROR(
"Unable to retrieve BunchCrossing conditions object (SiT)" );
68 }
69 const BunchCrossingCondData* bcData{*bcidHdl};
70
71 int bx_diff =
int(run_number) >= 521800 ? 2 : 1;
72
75 {
77 fill(
"AFPSiLayerTool", bcidAll);
79 {
82 fill(
"AFPSiLayerTool", bcidFront);
83 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockFront);
84 }
85 else
86 {
88 {
91 fill(
"AFPSiLayerTool", bcidMiddle);
92 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockMiddle);
93 }
94 else
95 {
98 fill(
"AFPSiLayerTool", bcidEnd);
99 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockEnd);
100 }
101 }
102 }
103
104
105
106 auto lb = Monitored::Scalar<int>(
"lb", 0);
107 auto muPerBX = Monitored::Scalar<float>("muPerBX", 0.0);
108
109
110 auto nSiHits = Monitored::Scalar<int>(
"nSiHits", 1);
111
112 auto pixelRowIDChip = Monitored::Scalar<int>("pixelRowIDChip", 0);
113 auto pixelColIDChip = Monitored::Scalar<int>("pixelColIDChip", 0);
114
116
117 auto clusterX = Monitored::Scalar<float>("clusterX", 0.0);
118 auto clusterY = Monitored::Scalar<float>("clusterY", 0.0);
119 auto clustersInPlanes = Monitored::Scalar<int>("clustersInPlanes", 0);
120
121 auto trackX = Monitored::Scalar<float>("trackX", 0.0);
122 auto trackY = Monitored::Scalar<float>("trackY", 0.0);
123
124 auto planeHits = Monitored::Scalar<int>("planeHits", 0);
125
126 auto numberOfHitsPerStation = Monitored::Scalar<int>("numberOfHitsPerStation", 0);
127
128 auto lbEvents = Monitored::Scalar<int>("lbEvents", 0);
129 auto lbHits = Monitored::Scalar<int>("lbHits", 0);
130 auto lbEventsStations = Monitored::Scalar<int>("lbEventsStations", 0);
131 auto lbEventsStationsAll = Monitored::Scalar<int>("lbEventsStationsAll", 0);
132
133 auto planes = Monitored::Scalar<int>("planes", 0);
134
135 auto eventsPerStation = Monitored::Scalar<int>("eventsPerStation", 0);
136
137 auto clusterToT = Monitored::Scalar<int>("clusterToT", 0);
138
139 lb = eventInfo->lumiBlock();
140 lbEvents = eventInfo->lumiBlock();
141
143 if (muPerBX == 0.0) {
144 ATH_MSG_DEBUG(
"AverageInteractionsPerCrossing is 0, forcing to 1.0");
145 muPerBX=1.0;
146 }
147 fill(
"AFPSiLayerTool",
lb, muPerBX);
148 fill(
"AFPSiLayerTool", lbEvents);
149
150
152 if(! afpHitContainer.isValid())
153 {
155 return StatusCode::SUCCESS;
156 }
157
158 ATH_CHECK( afpHitContainer.initialize() );
159
160 nSiHits = afpHitContainer->size();
161 fill(
"AFPSiLayerTool",
lb, nSiHits);
162
163 int eventsInStations[4] = {};
164 int numberOfHitsPerPlane[4][4] = {};
165
167 {
168 lb = eventInfo->lumiBlock();
169 lbHits = eventInfo->lumiBlock();
170 lbEventsStations = eventInfo->lumiBlock();
171 lbEventsStationsAll = eventInfo->lumiBlock();
172 pixelRowIDChip = hitsItr->pixelRowIDChip();
173 pixelColIDChip = hitsItr->pixelColIDChip();
175
176
177 if (hitsItr->stationID()<4 && hitsItr->stationID()>=0 && hitsItr->pixelLayerID()<4 && hitsItr->pixelLayerID()>=0)
178 {
179 ++eventsInStations[hitsItr->stationID()];
180
185
186 planeHits = hitsItr->pixelLayerID();
188
189 ++numberOfHitsPerPlane[hitsItr->stationID()][hitsItr->pixelLayerID()];
190 numberOfHitsPerStation = hitsItr->stationID();
191 fill(
"AFPSiLayerTool", numberOfHitsPerStation);
192
193 fill(
"AFPSiLayerTool", lbHits);
194 }
195 else ATH_MSG_WARNING(
"Unrecognised station index: " << hitsItr->stationID());
196 }
197
198 auto hitsPerPlaneProfile = Monitored::Scalar<float>("hitsPerPlaneProfile", 0.0);
199 auto lbhitsPerPlaneProfile = Monitored::Scalar<int>("lbhitsPerPlaneProfile", 0);
200 auto hitsPerPlaneEventsMu = Monitored::Scalar<float>("hitsPerPlaneEventsMu", 0.0);
201 auto hitPerPlaneEventMuIndex = Monitored::Scalar<int>("hitPerPlaneEventMuIndex", 0);
202
203 lbhitsPerPlaneProfile = eventInfo->lumiBlock();
204 for(int i_station = 0; i_station < 4; i_station++)
205 for(int j_layer = 0; j_layer < 4; j_layer++)
206 {
207 hitsPerPlaneProfile = numberOfHitsPerPlane[i_station][j_layer]/muPerBX;
209 if (muPerBX != 0.0) {
210 hitsPerPlaneEventsMu = numberOfHitsPerPlane[i_station][j_layer] / muPerBX;
211 }
212 hitPerPlaneEventMuIndex = reorganizePlanes(i_station, j_layer);
213 fill(
"AFPSiLayerTool", hitPerPlaneEventMuIndex, hitsPerPlaneEventsMu);
214 }
215
216 bool noEventsInStations = true;
217 for(
int i=0;
i<4;
i++)
218 {
219 if(eventsInStations[i]>0) {
221
222 eventsPerStation =
i * 4;
223 fill(
"AFPSiLayerTool", eventsPerStation);
224 ++eventsPerStation;
225 fill(
"AFPSiLayerTool", eventsPerStation);
226 ++eventsPerStation;
227 fill(
"AFPSiLayerTool", eventsPerStation);
228 ++eventsPerStation;
229 fill(
"AFPSiLayerTool", eventsPerStation);
230
231 noEventsInStations = false;
232 }
233 }
234 if(!noEventsInStations)
235 {
236 fill(
"AFPSiLayerTool", lbEventsStationsAll);
237 }
238
239
240 AFPMon::AFPFastReco
fast(afpHitContainer.get());
242
243
244 unsigned int totalTracksAll[4] = {};
245 unsigned int totalTracksFront[4] = {};
246 unsigned int totalTracksMiddle[4] = {};
247 unsigned int totalTracksEnd[4] = {};
248
249 for (
const auto& track :
fast.tracks())
250 {
251 trackX =
track.x * 1.0;
252 trackY =
track.y * 1.0;
254
255 if (position == FRONT)
256 {
257 ++totalTracksFront[
track.station];
258 ++totalTracksAll[
track.station];
259 }
260 else if (position == MIDDLE)
261 {
262 ++totalTracksMiddle[
track.station];
263 ++totalTracksAll[
track.station];
264 }
265 else if (position == END)
266 {
267 ++totalTracksEnd[
track.station];
268 ++totalTracksAll[
track.station];
269 }
270 }
271
272 auto lbTracksAll = Monitored::Scalar<int>("lbTracksAll", 0);
273 auto lbTracksFront = Monitored::Scalar<int>("lbTracksFront", 0);
274 auto lbTracksMiddle = Monitored::Scalar<int>("lbTracksMiddle", 0);
275 auto lbTracksEnd = Monitored::Scalar<int>("lbTracksEnd", 0);
276
277 auto Total_tracks_All_profile = Monitored::Scalar<float>("Total_tracks_All_profile", 0.0);
278 auto Total_tracks_Front_profile = Monitored::Scalar<float>("Total_tracks_Front_profile", 0.0);
279 auto Total_tracks_Middle_profile = Monitored::Scalar<float>("Total_tracks_Middle_profile", 0.0);
280 auto Total_tracks_End_profile = Monitored::Scalar<float>("Total_tracks_End_profile", 0.0);
281
282 lbTracksAll = eventInfo->lumiBlock();
283 lbTracksFront = eventInfo->lumiBlock();
284 lbTracksMiddle = eventInfo->lumiBlock();
285 lbTracksEnd = eventInfo->lumiBlock();
286
287 for(
int i = 0;
i < 4;
i++)
288 {
289 Total_tracks_All_profile = totalTracksAll[
i] / muPerBX;
291 totalTracksAll[
i] = 0;
292
293 Total_tracks_Front_profile = totalTracksFront[
i] / muPerBX;
294 if (position == FRONT)
296 totalTracksFront[
i] = 0;
297
298 Total_tracks_Middle_profile = totalTracksMiddle[
i] / muPerBX;
299 if (position == MIDDLE)
301 totalTracksMiddle[
i] = 0;
302
303 Total_tracks_End_profile = totalTracksEnd[
i] / muPerBX;
304 if (position == END)
306 totalTracksEnd[
i] = 0;
307 }
308
309
310 unsigned int totalClustersAll[4][4] = {};
311 unsigned int totalClustersFront[4][4] = {};
312 unsigned int totalClustersMiddle[4][4] = {};
313 unsigned int totalClustersEnd[4][4] = {};
314
315 auto clustersPerPlaneAllPP = Monitored::Scalar<float>("clustersPerPlaneAllPP", 0.0);
316 auto clustersPerPlaneFrontPP = Monitored::Scalar<float>("clustersPerPlaneFrontPP", 0.0);
317 auto clustersPerPlaneMiddlePP = Monitored::Scalar<float>("clustersPerPlaneMiddlePP", 0.0);
318 auto clustersPerPlaneEndPP = Monitored::Scalar<float>("clustersPerPlaneEndPP", 0.0);
319
320 auto lbClustersPerPlanesAll = Monitored::Scalar<int>("lbClustersPerPlanesAll", 0);
321 auto lbClustersPerPlanesFront = Monitored::Scalar<int>("lbClustersPerPlanesFront", 0);
322 auto lbClustersPerPlanesMiddle = Monitored::Scalar<int>("lbClustersPerPlanesMiddle", 0);
323 auto lbClustersPerPlanesEnd = Monitored::Scalar<int>("lbClustersPerPlanesEnd", 0);
324
325 lbClustersPerPlanesAll = eventInfo->lumiBlock();
326 lbClustersPerPlanesFront = eventInfo->lumiBlock();
327 lbClustersPerPlanesMiddle = eventInfo->lumiBlock();
328 lbClustersPerPlanesEnd = eventInfo->lumiBlock();
329
330 for(
const auto& cluster :
fast.clusters())
331 {
332 clusterX = cluster.x * 1.0;
333 clusterY = cluster.y * 1.0;
335 if (cluster.station == 0 || cluster.station == 1)
336 {
337 clustersInPlanes = reorganizePlanes(cluster.station, cluster.layer);
338 }
339 else
340 {
341 clustersInPlanes = (cluster.station*4)+cluster.layer;
342 }
343 fill(
"AFPSiLayerTool", clustersInPlanes);
344
345 clusterToT = cluster.sumToT;
347
348 if (position == FRONT)
349 {
350 ++totalClustersFront[cluster.station][cluster.layer];
351 ++totalClustersAll[cluster.station][cluster.layer];
352 }
353 else if (position == MIDDLE)
354 {
355 ++totalClustersMiddle[cluster.station][cluster.layer];
356 ++totalClustersAll[cluster.station][cluster.layer];
357 }
358 else if (position == END)
359 {
360 ++totalClustersEnd[cluster.station][cluster.layer];
361 ++totalClustersAll[cluster.station][cluster.layer];
362 }
363 }
364
365 for(int i_station = 0; i_station < 4; i_station++)
366 for(int j_layer = 0; j_layer < 4; j_layer++)
367 {
368 clustersPerPlaneAllPP = totalClustersAll[i_station][j_layer] / muPerBX;
370 totalClustersAll[i_station][j_layer] = 0;
371
372 clustersPerPlaneFrontPP = totalClustersFront[i_station][j_layer] / muPerBX;
373 if (position == FRONT)
375 totalClustersFront[i_station][j_layer] = 0;
376
377 clustersPerPlaneMiddlePP = totalClustersMiddle[i_station][j_layer] / muPerBX;
378 if (position == MIDDLE)
380 totalClustersMiddle[i_station][j_layer] = 0;
381
382 clustersPerPlaneEndPP = totalClustersEnd[i_station][j_layer] / muPerBX;
383 if (position == END)
385 totalClustersEnd[i_station][j_layer] = 0;
386 }
387
389}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
SG::ReadCondHandleKey< BunchCrossingCondData > m_bunchCrossingKey
std::map< std::string, int > m_StationGroup
virtual StatusCode fillHistogramsPlaneEff(const xAOD::AFPSiHitContainer &) const
SG::ReadHandleKey< xAOD::AFPSiHitContainer > m_afpHitContainerKey
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