16 constexpr
int reorganizePlanes(
const int station,
const int layer)
18 bool reverse = station == 0 || station == 1;
26 , m_afpHitContainerKey(
"AFPSiHitContainer")
66 numberOfEventsPerLumiblockFront = eventInfo->
lumiBlock();
67 numberOfEventsPerLumiblockMiddle = eventInfo->
lumiBlock();
68 numberOfEventsPerLumiblockEnd = eventInfo->
lumiBlock();
71 const unsigned int bcid = eventInfo->
bcid();
74 ATH_MSG_ERROR(
"Unable to retrieve BunchCrossing conditions object (SiT)" );
79 enum { FRONT, MIDDLE,
END, NPOS } position = NPOS;
80 if(bcData->isFilled(
bcid))
83 fill(
"AFPSiLayerTool", bcidAll);
84 if(!bcData->isFilled(
bcid-1))
88 fill(
"AFPSiLayerTool", bcidFront);
89 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockFront);
93 if(bcData->isFilled(
bcid+1))
97 fill(
"AFPSiLayerTool", bcidMiddle);
98 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockMiddle);
104 fill(
"AFPSiLayerTool", bcidEnd);
105 fill(
"AFPSiLayerTool", numberOfEventsPerLumiblockEnd);
174 if (muPerBX == 0.0) {
175 ATH_MSG_DEBUG(
"AverageInteractionsPerCrossing is 0, forcing to 1.0");
178 fill(
"AFPSiLayerTool",
lb, muPerBX);
179 fill(
"AFPSiLayerTool", lbEvents);
183 if(! afpHitContainer.
isValid())
186 return StatusCode::SUCCESS;
194 int eventsInStations[4] = {};
195 int numberOfHitsPerPlane[4][4] = {};
201 lbEventsStations = eventInfo->
lumiBlock();
202 lbEventsStationsAll = eventInfo->
lumiBlock();
203 pixelRowIDChip = hitsItr->pixelRowIDChip();
204 pixelColIDChip = hitsItr->pixelColIDChip();
208 if (hitsItr->stationID()<4 && hitsItr->stationID()>=0 && hitsItr->pixelLayerID()<4 && hitsItr->pixelLayerID()>=0)
210 ++eventsInStations[hitsItr->stationID()];
218 planeHits = hitsItr->pixelLayerID();
221 ++numberOfHitsPerPlane[hitsItr->stationID()][hitsItr->pixelLayerID()];
222 planeHitsAll = reorganizePlanes(hitsItr->stationID(), hitsItr->pixelLayerID());
223 planeHitsAllMU = reorganizePlanes(hitsItr->stationID(), hitsItr->pixelLayerID());
224 weightAllPlanes = 1 / muPerBX;
225 fill(
"AFPSiLayerTool", planeHitsAll);
226 fill(
"AFPSiLayerTool", planeHitsAllMU, weightAllPlanes);
227 weightAllPlanes = 1.0;
229 numberOfHitsPerStation = hitsItr->stationID();
230 fill(
"AFPSiLayerTool", numberOfHitsPerStation);
232 fill(
"AFPSiLayerTool", lbHits);
234 lbHitsPerPlanes = eventInfo->
lumiBlock();
235 lbHitsPerPlanes_full = eventInfo->
lumiBlock();
236 weightHitsByMU = 1 / muPerBX;
239 weightHitsByMU = 1.0;
241 else ATH_MSG_WARNING(
"Unrecognised station index: " << hitsItr->stationID());
244 bool noEventsInStations =
true;
245 for(
int i=0;
i<4;
i++)
247 if(eventsInStations[
i]>0) {
250 eventsPerStation =
i * 4;
251 fill(
"AFPSiLayerTool", eventsPerStation);
253 fill(
"AFPSiLayerTool", eventsPerStation);
255 fill(
"AFPSiLayerTool", eventsPerStation);
257 fill(
"AFPSiLayerTool", eventsPerStation);
259 noEventsInStations =
false;
262 if(!noEventsInStations)
264 fill(
"AFPSiLayerTool", lbEventsStationsAll);
267 for(
int i=0;
i<4;
i++)
269 hitsCounterStationsTProfile = numberOfHitsPerPlane[
i][0] + numberOfHitsPerPlane[
i][1] + numberOfHitsPerPlane[
i][2] + numberOfHitsPerPlane[
i][3];
271 for(
int j=0; j<4; j++)
273 if(numberOfHitsPerPlane[
i][j]>0)
275 hitsCounterPlanesTProfile = numberOfHitsPerPlane[
i][j];
286 unsigned int totalTracksAll[4] = {};
287 unsigned int totalTracksFront[4] = {};
288 unsigned int totalTracksMiddle[4] = {};
289 unsigned int totalTracksEnd[4] = {};
293 trackX =
track.x * 1.0;
294 trackY =
track.y * 1.0;
297 if (position == FRONT)
299 ++totalTracksFront[
track.station];
300 ++totalTracksAll[
track.station];
302 else if (position == MIDDLE)
304 ++totalTracksMiddle[
track.station];
305 ++totalTracksAll[
track.station];
307 else if (position ==
END)
309 ++totalTracksEnd[
track.station];
310 ++totalTracksAll[
track.station];
339 lbTracksAll_full = eventInfo->
lumiBlock();
340 lbTracksFront_full = eventInfo->
lumiBlock();
341 lbTracksMiddle_full = eventInfo->
lumiBlock();
342 lbTracksEnd_full = eventInfo->
lumiBlock();
344 lbTracksAll_full = eventInfo->
lumiBlock();
345 lbTracksFront_full = eventInfo->
lumiBlock();
346 lbTracksMiddle_full = eventInfo->
lumiBlock();
347 lbTracksEnd_full = eventInfo->
lumiBlock();
349 for(
int i = 0;
i < 4;
i++)
351 weightTracksAll = totalTracksAll[
i] / muPerBX;
352 weightTracksAll_full = totalTracksAll[
i];
355 totalTracksAll[
i] = 0;
357 weightTracksFront = totalTracksFront[
i] / muPerBX;
358 weightTracksFront_full = totalTracksFront[
i];
361 totalTracksFront[
i] = 0;
363 weightTracksMiddle = totalTracksMiddle[
i] / muPerBX;
364 weightTracksMiddle_full = totalTracksMiddle[
i];
367 totalTracksMiddle[
i] = 0;
369 weightTracksEnd = totalTracksEnd[
i] / muPerBX;
370 weightTracksEnd_full = totalTracksEnd[
i];
373 totalTracksEnd[
i] = 0;
377 for(
const auto& cluster :
fast.clusters())
379 clusterX = cluster.x * 1.0;
380 clusterY = cluster.y * 1.0;
382 if (cluster.station == 0 || cluster.station == 1)
384 clustersInPlanes = reorganizePlanes(cluster.station, cluster.layer);
388 clustersInPlanes = (cluster.station*4)+cluster.layer;
390 fill(
"AFPSiLayerTool", clustersInPlanes);
392 clusterToT = cluster.sumToT;
395 lbClustersPerPlanes = eventInfo->
lumiBlock();
396 lbClustersPerPlanes_full = eventInfo->
lumiBlock();
397 weightClustersByMU = 1/muPerBX;
400 weightClustersByMU = 1.0;
402 return StatusCode::SUCCESS;