25 static const std::string abbreviations[
N_REGIONS] = {
35 bool timeBinInPattern(
const int tbin,
const Pattern xxx) {
43 return ((tbin == 2) or (tbin == 3) or (tbin == 6) or (tbin == 7));
48 return ((tbin == 1) or (tbin == 3) or (tbin == 5) or (tbin == 7));
84 return StatusCode::RECOVERABLE;
95 std::array<std::unordered_set<Identifier>,
N_WAFERS> rdosOnTracks;
108 return StatusCode::SUCCESS;
112 static const unsigned int limits[
N_REGIONS] = {
116 const EventIDBase& pEvent{ctx.eventID()};
117 const int lumi_block{
static_cast<int>(pEvent.lumi_block())};
120 if (not rdoContainer.isValid()) {
122 return StatusCode::FAILURE;
126 if (not spacePointContainer.isValid()) {
128 return StatusCode::FAILURE;
131 bool isSelectedTrigger{
false};
136 isSelectedTrigger =
true;
142 if (isSelectedTrigger) {
146 std::vector<float> occ(
N_WAFERS, 0.);
147 std::vector<float> hitOcc(
N_WAFERS, 0.);
149 int local_tothits{0};
151 std::vector<int> barrel_local_nhitslayer(
N_BARRELSx2, 0);
152 std::vector<int> ECp_local_nhitslayer(
N_DISKSx2, 0);
153 std::vector<int> ECm_local_nhitslayer(
N_DISKSx2, 0);
154 std::vector<int>* hitsInLayer[
N_REGIONS] = {
155 &ECm_local_nhitslayer, &barrel_local_nhitslayer, &ECp_local_nhitslayer
157 const bool doThisSubsystem[
N_REGIONS] = {
162 std::vector<int> vNumberOfHitsFromAllRDOs[
N_REGIONS];
163 std::vector<int> vNumberOfHitsFromSPs[
N_REGIONS];
164 std::vector<bool> vIsSelectedTriggerHits[
N_REGIONS];
165 for (
unsigned int jReg{0}; jReg<
N_REGIONS; jReg++) {
166 unsigned int size{0};
169 vLumiBlock[jReg].reserve(
size);
170 vNumberOfHitsFromAllRDOs[jReg].reserve(
size);
171 vNumberOfHitsFromSPs[jReg].reserve(
size);
172 vIsSelectedTriggerHits[jReg].reserve(
size);
175 std::vector<int> vEtaOnTrack;
176 std::vector<int> vPhiOnTrack;
177 std::vector<float> vSystemIndexOnTrack;
178 std::vector<bool> vDTbinOnTrack;
180 std::vector<int> vEta;
181 std::vector<int> vPhi;
182 std::vector<int> vNumberOfStrips;
187 const Identifier wafer_id{rdoCollection->identify()};
188 const IdentifierHash wafer_hash{rdoCollection->identifyHash()};
191 IdentifierHash theModuleHash1;
194 const unsigned int systemIndex{
bec2Index(barrel_ec)};
200 const int thisElement{(
N_SIDES * thisLayerDisk) + thisSide};
204 int numberOfHitsFromSPs{0};
205 int numberOfHitsFromAllRDOs{0};
209 std::unordered_set<Identifier> mySetOfSPIds;
211 auto spContainerIterator{spacePointContainer->indexFindPtr(
side==0 ? theModuleHash0 : theModuleHash1)};
212 if (spContainerIterator==
nullptr)
continue;
214 const std::vector<Identifier>& rdoList{(thisSide==
side ? sp->clusterList().first : sp->clusterList().second)->rdoList()};
215 mySetOfSPIds.insert(rdoList.begin(), rdoList.end());
223 vNumberOfStrips.clear();
227 const int numberOfStrips{rdo->getGroupSize()};
228 (*hitsInLayer[systemIndex])[thisElement] += numberOfStrips;
229 local_tothits += numberOfStrips;
231 if (doThisSubsystem[systemIndex]) {
241 if (rdosOnTracks[wafer_hash].
find(strip_id) != rdosOnTracks[wafer_hash].end()) {
243 vEtaOnTrack.push_back(thisEta);
244 vPhiOnTrack.push_back(
thisPhi);
245 vDTbinOnTrack.push_back((tbin == 2) or (tbin == 3));
246 vSystemIndexOnTrack.push_back(systemIndex);
249 vEta.push_back(thisEta);
251 vNumberOfStrips.push_back(numberOfStrips);
253 numberOfHitsFromAllRDOs += numberOfStrips;
256 if (mySetOfSPIds.find(strip_id) != mySetOfSPIds.end()) {
257 numberOfHitsFromSPs += numberOfStrips;
259 numberOfHitsFromSPs += numberOfStrips;
267 const std::string streamhitmap{
"mapsOfHitsOnTracks" + abbreviations[systemIndex] +
"_" +
268 "trackhitsmap_" + layerSide.name()};
272 fill(
"SCTHitsNoiseMonitor_" +
std::to_string(systemIndex), etaMapsOfHitsOnTracksAcc, phiMapsOfHitsOnTracksAcc);
274 const std::string hitmap{
"hitsmap" + abbreviations[systemIndex] +
"_" + layerSide.name()};
279 fill(
"SCTHitsNoiseMonitor_" +
std::to_string(systemIndex), etahitsmapAcc, phihitsmapAcc, numberOfStripsAcc);
282 const std::string hitmaprecent{
"hitsmaprecent" + abbreviations[systemIndex] +
"_" + layerSide.name()};
285 auto numberOfStripsRecentAcc{
Monitored::Collection(
"numberOfStrips_"+hitmaprecent, vNumberOfStrips)};
286 fill(
"SCTHitsNoiseMonitor_" +
std::to_string(systemIndex), etahitsmapRecentAcc, phihitsmapRecentAcc, numberOfStripsAcc);
289 if (numberOfHitsFromAllRDOs > 0) {
290 int den{
N_STRIPS - numberOfHitsFromSPs};
291 int num{numberOfHitsFromAllRDOs - numberOfHitsFromSPs};
294 ATH_MSG_WARNING(
"Too many reconstructed space points for number of real hits");
297 occ[wafer_hash] =
static_cast<float>(
num) /
static_cast<float>(den) * 1.E5;
300 hitOcc[wafer_hash] =
static_cast<float>(numberOfHitsFromAllRDOs) /
static_cast<float>(
N_STRIPS) * 1.E5;
302 vLumiBlock[systemIndex].push_back(lumi_block);
303 vNumberOfHitsFromAllRDOs[systemIndex].push_back(numberOfHitsFromAllRDOs);
304 vNumberOfHitsFromSPs[systemIndex].push_back(numberOfHitsFromSPs);
305 vIsSelectedTriggerHits[systemIndex].push_back(isSelectedTrigger);
312 fill(
"SCTHitsNoiseMonitorGeneral", Bec_TBinFracAllAcc, TBin_TBinFracAllAcc);
314 for (
unsigned int jReg{0}; jReg<
N_REGIONS; jReg++) {
316 auto numberOfHitsFromAllRDOsAcc{
Monitored::Collection(
"numberOfHitsFromAllRDOs", vNumberOfHitsFromAllRDOs[jReg])};
317 auto numberOfHitsFromSPsAcc{
Monitored::Collection(
"numberOfHitsFromSPs", vNumberOfHitsFromSPs[jReg])};
318 auto isSelectedTriggerHitsAcc{
Monitored::Collection(
"isSelectedTriggerHits", vIsSelectedTriggerHits[jReg])};
319 fill(
"SCTHitsNoiseMonitor_" +
std::to_string(jReg), lbHitsAcc, numberOfHitsFromAllRDOsAcc, numberOfHitsFromSPsAcc, isSelectedTriggerHitsAcc);
324 if (not clusterContainer.isValid()) {
328 std::vector<long unsigned int> vGroupSize;
331 vGroupSize.push_back(cluster->rdoList().size());
335 fill(
"SCTHitsNoiseMonitorGeneral", cluSizeAcc);
337 fill(
"SCTHitsNoiseMonitorGeneral", hitsAcc);
345 std::vector<std::vector<float>> vNO2D[
N_REGIONS];
346 std::vector<std::vector<float>> vHO2D[
N_REGIONS];
347 std::vector<std::vector<int>> vEtaNOHO[
N_REGIONS];
348 std::vector<std::vector<int>> vPhiNOHO[
N_REGIONS];
349 std::vector<std::vector<bool>> vIsSelectedTriggerNOHO[
N_REGIONS];
354 vLB[jReg].reserve(
size);
355 vNO[jReg].reserve(
size);
356 vHO[jReg].reserve(
size);
357 vIsSelectedTrigger[jReg].reserve(
size);
360 vNO2D[jReg].resize(limits[jReg], {});
361 vHO2D[jReg].resize(limits[jReg], {});
362 vEtaNOHO[jReg].resize(limits[jReg], {});
363 vPhiNOHO[jReg].resize(limits[jReg], {});
364 vIsSelectedTriggerNOHO[jReg].resize(limits[jReg], {});
365 for (
unsigned int element{0}; element< limits[jReg]; ++element) {
367 vNO2D[jReg][element].reserve(nWafers);
368 vHO2D[jReg][element].reserve(nWafers);
369 vEtaNOHO[jReg][element].reserve(nWafers);
370 vPhiNOHO[jReg][element].reserve(nWafers);
371 vIsSelectedTriggerNOHO[jReg][element].reserve(nWafers);
376 for (
unsigned int iHash{0}; iHash<
N_WAFERS; iHash++) {
377 const IdentifierHash wafer_hash{iHash};
382 const unsigned int systemIndex{
bec2Index(barrel_ec)};
383 vLB[systemIndex].push_back(lumi_block);
384 vNO[systemIndex].push_back(occ[iHash]);
385 vHO[systemIndex].push_back(hitOcc[iHash]);
386 vIsSelectedTrigger[systemIndex].push_back(isSelectedTrigger);
390 vIsSelectedTrigger[
GENERAL_INDEX].push_back(isSelectedTrigger);
391 if (doThisSubsystem[systemIndex]) {
393 vNO2D[systemIndex][element].push_back(occ[iHash]);
394 vHO2D[systemIndex][element].push_back(hitOcc[iHash]);
397 vIsSelectedTriggerNOHO[systemIndex][element].push_back(isSelectedTrigger);
403 if (jReg==
GENERAL_INDEX) monitor =
"SCTHitsNoiseMonitorGeneral";
410 fill(monitor, LBAcc, noAcc, hoAcc, IsSelectedTriggerAcc);
413 for (
unsigned int jReg{0}; jReg<
N_REGIONS; ++jReg){
414 for (
unsigned int element{0}; element < limits[jReg]; ++element) {
416 const std::string occMap{
"occupancymap" + abbreviations[jReg] +
"_" + layerSide.
name()};
421 auto isSelectedTriggerAcc{
Monitored::Collection(
"IsSelectedTrigger_"+occMap, vIsSelectedTriggerNOHO[jReg][element])};
422 fill(
"SCTHitsNoiseMonitor_" +
std::to_string(jReg), etaEacc, phiAcc, hoAcc, noAcc, isSelectedTriggerAcc);
425 auto isSelectedTriggerRecentAcc{
Monitored::Collection(
"IsSelectedTriggerRecent_"+occMap, vIsSelectedTriggerNOHO[jReg][element])};
426 fill(
"SCTHitsNoiseMonitor_" +
std::to_string(jReg), etaEacc, phiAcc, hoAcc, noAcc, isSelectedTriggerRecentAcc);
432 return StatusCode::SUCCESS;
438 rdosOnTracks.fill(std::unordered_set<Identifier>());
440 if (not rdoContainer.isValid()) {
442 return StatusCode::FAILURE;
448 if (not tracks.isValid()) {
450 return StatusCode::FAILURE;
455 <<
" tracks. Don't do hits-on-track-hists");
456 return StatusCode::SUCCESS;
460 if (
track ==
nullptr) {
466 if (trackStates ==
nullptr) {
467 ATH_MSG_WARNING(
"for current track is TrackStateOnSurfaces == Null, no data will be written for this track");
475 if (RawDataClus ==
nullptr) {
480 if (RawDataClus->detectorElement()->isSCT()) {
481 const std::vector<Identifier>& rdoList{RawDataClus->rdoList()};
482 rdosOnTracks[RawDataClus->detectorElement()->identifyHash()].insert(rdoList.begin(), rdoList.end());
488 return StatusCode::SUCCESS;
492 return StatusCode::SUCCESS;