36 #include "TProfile2D.h"
55 "Endcap C",
"Barrel",
"Endcap A"
58 static const std::string abbreviations[
N_REGIONS] = {
61 static const std::string streamDelimiter{
"_"};
65 timeBinInPattern(
const int tbin,
const Pattern xxx) {
73 return ((tbin == 2) or (tbin == 3) or (tbin == 6) or (tbin == 7));
78 return ((tbin == 1) or (tbin == 3) or (tbin == 5) or (tbin == 7));
100 const std::string&
name,
101 const IInterface*
parent) :
174 m_ncluHisto->GetXaxis()->SetTitle(
"Total SCT Hits");
177 ATH_MSG_WARNING(
"Cannot book Histogram: SCT/GENERAL/hits/summary/sct_hits");
184 return StatusCode::SUCCESS;
236 m_ncluHisto->GetXaxis()->SetTitle(
"Total SCT Hits");
239 ATH_MSG_WARNING(
"Cannot book Histogram: SCT/GENERAL/hits/summary/sct_hits");
245 return StatusCode::SUCCESS;
256 const EventContext& ctx{Gaudi::Hive::currentContext()};
257 const EventIDBase& pEvent{ctx.eventID()};
258 const int lb{
static_cast<int>(pEvent.lumi_block())};
290 return StatusCode::SUCCESS;
302 if (endOfEventsBlock) {
307 return StatusCode::SUCCESS;
319 return StatusCode::SUCCESS;
333 const EventIDBase& pEvent{ctx.eventID()};
334 const int lb{
static_cast<int>(pEvent.lumi_block())};
337 if (not rdoContainer.isValid()) {
338 return StatusCode::FAILURE;
342 if (not spacePointContainer.isValid()) {
343 return StatusCode::FAILURE;
347 std::vector<float> occ(wafer_hash_max, 0.);
348 std::vector<float> hitOcc(wafer_hash_max, 0.);
351 int local_tothits{0};
353 bool isSelectedTrigger{
false};
358 isSelectedTrigger =
true;
363 std::vector<int> barrel_local_nhitslayer(
N_BARRELSx2, 0);
364 std::vector<int> ECp_local_nhitslayer(
N_DISKSx2, 0);
365 std::vector<int> ECm_local_nhitslayer(
N_DISKSx2, 0);
366 std::vector<int>* hitsInLayer[
N_REGIONS] = {
367 &ECm_local_nhitslayer, &barrel_local_nhitslayer, &ECp_local_nhitslayer
369 const bool doThisSubsystem[
N_REGIONS] = {
374 if (rdoCollection==
nullptr) {
378 const Identifier wafer_id{rdoCollection->identify()};
379 const IdentifierHash wafer_hash{rdoCollection->identifyHash()};
382 IdentifierHash theModuleHash1;
389 const int thisElement{(
N_SIDES * thisLayerDisk) + thisSide};
390 unsigned int systemIndex{
bec2Index(thisBec)};
392 int numberOfHitsFromSPs{0};
393 int numberOfHitsFromAllRDOs{0};
397 std::unordered_set<Identifier> mySetOfSPIds;
399 auto spContainer{spacePointContainer->indexFindPtr(
side==0 ? theModuleHash0 : theModuleHash1)};
400 if (spContainer==
nullptr)
continue;
402 const std::vector<Identifier>& rdoList{(
side==thisSide ? sp->clusterList().first->rdoList() : sp->clusterList().second->rdoList())};
403 mySetOfSPIds.insert(rdoList.begin(), rdoList.end());
408 const Identifier strip_id{rdo->identify()};
410 const int numberOfStrips{rdo->getGroupSize()};
413 if (doThisSubsystem[systemIndex]) {
421 TH2F_LW* histogram_recent{
nullptr};
432 double dTbin{
static_cast<double>((tbin == 2) or (tbin == 3))};
438 histogram_recent->Fill(thisEta,
thisPhi, numberOfStrips);
440 numberOfHitsFromAllRDOs += numberOfStrips;
443 if (mySetOfSPIds.find(strip_id) != mySetOfSPIds.end()) {
444 numberOfHitsFromSPs += numberOfStrips;
446 numberOfHitsFromSPs += numberOfStrips;
449 (*hitsInLayer[systemIndex])[thisElement] += numberOfStrips;
450 local_tothits += numberOfStrips;
461 if (numberOfHitsFromAllRDOs > 0) {
464 if (isSelectedTrigger) {
469 int den{
N_STRIPS - numberOfHitsFromSPs};
470 int num{numberOfHitsFromAllRDOs - numberOfHitsFromSPs};
473 ATH_MSG_WARNING(
"Too many reconstructed space points for number of real hits");
476 occ[wafer_hash] =
static_cast<float>(
num) /
static_cast<float>(den) * 1.E5;
478 hitOcc[wafer_hash] =
static_cast<float>(numberOfHitsFromAllRDOs) /
static_cast<float>(
N_STRIPS) * 1.E5;
483 sumocc =
num /
static_cast<float> (den);
488 float sumhitocc{
static_cast<float> (numberOfHitsFromAllRDOs) /
static_cast<float> (
N_STRIPS)};
495 for (
unsigned int iHash{0}; iHash<wafer_hash_max; iHash++) {
496 const IdentifierHash wafer_hash{iHash};
501 const unsigned int systemIndex{
bec2Index(barrel_ec)};
506 if (isSelectedTrigger) {
512 if (doThisSubsystem[systemIndex]) {
524 for (
unsigned int iReg{0}; iReg<
N_REGIONS; iReg++) {
537 if (not clusterContainer.isValid()) {
542 long unsigned int GroupSize{cluster->rdoList().size()};
553 return StatusCode::SUCCESS;
573 for (; planeIterator not_eq planeEnd; ++planeIterator) {
574 Identifier planeId{*planeIterator};
577 const std::string formattedPosition{
positionString(*planeIterator)};
578 std::string histotitle{std::string(
"SCT ") +
names[systemIndex] +
" Hitmap: plane " + formattedPosition};
585 return StatusCode::SUCCESS;
593 ATH_MSG_FATAL(
"Invalid subsystem index, should be 0-2, was " << systemIndex);
594 return StatusCode::FAILURE;
597 "SCT/SCTEC/hits",
"SCT/SCTB/hits",
"SCT/SCTEA/hits"
599 static const unsigned int limits[
N_REGIONS] = {
602 static const std::string titles[
N_REGIONS]{
"Endcap C",
"barrel",
"Endcap A"};
609 for (
unsigned int i{0};
i < limits[systemIndex]; ++
i) {
611 std::string streamhitmap{
"hitsmap" + abbreviations[systemIndex] +
"_" + layerSide.name()};
612 std::string streamhitmaprecent{
"hitsmaprecent" + abbreviations[systemIndex] +
"_" + layerSide.name()};
613 std::string streamhits{
"hits" + abbreviations[systemIndex] +
"_" + layerSide.name()};
614 std::string histotitle{
"SCT Hitmap for " +
names[systemIndex] +
": " + layerSide.title()};
615 std::string histotitlerecent{
"SCT Hitmap from recent events for " +
names[systemIndex] +
": " +
621 histotitle =
"SCT Hits for " +
names[systemIndex] +
": " + layerSide.title();
628 return StatusCode::SUCCESS;
637 "0_0",
"0_1",
"1_0",
"1_1",
"2_0",
"2_1",
"3_0",
"3_1"
639 std::string disksidenameECp[
N_DISKSx2] = {
640 "0_0",
"0_1",
"1_0",
"1_1",
"2_0",
"2_1",
"3_0",
"3_1",
"4_0",
"4_1",
"5_0",
"5_1",
"6_0",
"6_1",
"7_0",
"7_1",
643 std::string disksidenameECm[
N_DISKSx2] = {
644 "0_0",
"0_1",
"1_0",
"1_1",
"2_0",
"2_1",
"3_0",
"3_1",
"4_0",
"4_1",
"5_0",
"5_1",
"6_0",
"6_1",
"7_0",
"7_1",
656 m_clusizeRecent =
h1Factory(
"clu_size_recent",
"SCT Cluster size from recent events", BarrelCluSize, 0., 200., 200);
661 return m_clusize ? (StatusCode::SUCCESS) : (StatusCode::FAILURE);
667 "SCT/SCTEC/Noise",
"SCT/SCTB/Noise",
"SCT/SCTEA/Noise"
669 static const unsigned int limits[
N_REGIONS] = {
676 ATH_MSG_FATAL(
"Invalid subsystem index, should be 0-2, was " << systemIndex);
677 return StatusCode::FAILURE;
684 for (
unsigned int i{0};
i < limits[systemIndex]; ++
i) {
686 const std::string streamhitmaptrigger{
"noiseoccupancymaptrigger" + abbreviations[systemIndex] +
"_" +
688 const std::string streamhitmaprecent{
"noiseoccupancymaprecent" + abbreviations[systemIndex] +
"_" + layerSide.name()};
689 std::string histotitle{
"SCT Noise Occupancy map for " +
names[systemIndex] +
": " + layerSide.title()};
690 std::string histotitletrigger{
"SCT Noise Occupancy map for " +
m_NOTriggerItem +
" Trigger and " +
691 names[systemIndex] +
": " + layerSide.title()};
692 std::string histotitlerecent{
"SCT Noise Occupancy map in recent events for " +
names[systemIndex] +
": " +
700 std::string histNames[
N_REGIONS]{
"ECm",
"BAR",
"ECp"};
701 std::string histTitles[
N_REGIONS]{
"ECm",
"Barrel",
"ECp"};
703 std::string histNamesNO[
N_REGIONS]{
"ECC",
"BAR",
"ECA"};
704 std::string histTitlesNO[
N_REGIONS]{
"EndCap C",
"Barrel",
"EndCap A"};
706 (
"NO vs LB for the "+histTitlesNO[systemIndex]+
" (SP noise)").c_str(),
707 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
710 if (noiseOccMaps.regHist(
m_NO_vsLB[systemIndex]).isFailure()) {
715 (
"NO with trigger vs LB for the "+histTitlesNO[systemIndex]+
" (SP noise)").c_str(),
716 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
723 return StatusCode::SUCCESS;
728 static const std::string
paths[
N_REGIONS]{
"SCT/SCTEC/Noise",
"SCT/SCTB/Noise",
"SCT/SCTEA/Noise"};
730 static const std::string profileNames[
N_REGIONS]{
"ECm",
"BAR",
"ECp"};
731 static const std::string profileTitles[
N_REGIONS]{
"ECm",
"Barrel",
"ECp"};
732 static const std::string profileNames2[
N_REGIONS]{
"ECC",
"BAR",
"ECA"};
733 static const std::string profileTitles2[
N_REGIONS]{
"EndCap C",
"Barrel",
"EndCap A"};
738 ATH_MSG_FATAL(
"Invalid subsystem index, should be 0-2, was " << systemIndex);
739 return StatusCode::FAILURE;
748 for (
unsigned int i{0};
i < limits[systemIndex]; ++
i) {
750 const std::string streamhitmapR{
"hitoccupancymap" + abbreviations[systemIndex] +
"_" + layerSide.name()};
751 const std::string streamhitmaprecentR{
"hitoccupancymaprecent" + abbreviations[systemIndex] +
"_" + layerSide.name()};
752 std::string histotitleR{
"SCT Hit Occupancy map for " +
names[systemIndex] +
": " + layerSide.title()};
753 std::string histotitletriggerR{
"SCT Hit Occupancy map for " +
m_NOTriggerItem +
" Trigger and " +
names[systemIndex] +
": " + layerSide.title()};
754 std::string histotitlerecentR{
"SCT Hit Occupancy map in recent events for " +
names[systemIndex] +
": " + layerSide.title()};
762 (
"Average num of all Hits in "+profileNames[systemIndex]+
" vs LB").c_str(),
763 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
771 (
"Average num of all Hits in "+profileNames[systemIndex]+
" with trigger vs LB").c_str(),
772 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
780 (
"Average num of SP Hits in "+profileNames[systemIndex]+
" vs LB").c_str(),
781 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
784 if (hitOccMaps.regHist(
m_HSPHits_vsLB[systemIndex]).isFailure()) {
789 (
"Average num of SP Hits in "+profileNames[systemIndex]+
" with trigger vs LB").c_str(),
790 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
798 (
"HO vs LB for the "+profileTitles2[systemIndex]+
" (SP noise)").c_str(),
799 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
802 if (hitOccMaps.regHist(
m_HO_vsLB[systemIndex]).isFailure()) {
807 (
"HO with trigger vs LB for the "+profileTitles2[systemIndex]+
" (SP noise)").c_str(),
808 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
815 return StatusCode::SUCCESS;
826 std::vector<float> vectorOfOccupancies;
838 Identifier wafer_id{
val.first};
844 unsigned int systemIndex{
bec2Index(barrel_ec)};
845 if ((barrel_ec ==
BARREL) or
855 Identifier wafer_id{
val.first};
861 unsigned int systemIndex{
bec2Index(barrel_ec)};
862 if ((barrel_ec==
BARREL) or
872 return StatusCode::SUCCESS;
893 return StatusCode::SUCCESS;
904 for (
unsigned int iReg{0}; iReg<
N_REGIONS; iReg++) {
906 ATH_MSG_WARNING(
"Failed to reset m_pnoiseoccupancymapHistoVectorTrigger[" << iReg <<
"]!");
909 ATH_MSG_WARNING(
"Failed to reset m_phitoccupancymapHistoVector[" << iReg <<
"]!");
913 ATH_MSG_WARNING(
"Failed to reset m_pnoiseoccupancymapHistoVectorRecent[" << iReg <<
"]!");
916 ATH_MSG_WARNING(
"Failed to reset hitoccupancymapHistoVectorRecent[" << iReg <<
"]!");
921 return StatusCode::SUCCESS;
938 return StatusCode::SUCCESS;
950 for (
unsigned int iReg{0}; iReg<
N_REGIONS; iReg++) {
952 ATH_MSG_WARNING(
"Failed to reset m_ptrackhitsHistoVectorRecent[" << iReg <<
"]!");
955 ATH_MSG_WARNING(
"Failed to reset m_phitsHistoVectorRecent[" << iReg <<
"]!");
961 return StatusCode::SUCCESS;
972 for (
unsigned int i{0};
i <
hists.size(); ++
i) {
978 return StatusCode::SUCCESS;
989 for (
unsigned int i{0};
i <
hists.size(); ++
i) {
995 return StatusCode::SUCCESS;
1019 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
1027 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
1035 NBINS_LBs, 0.5, NBINS_LBs + 0.5);
1042 return StatusCode::SUCCESS;
1047 std::ostringstream position_txt;
1051 return position_txt.str();
1059 if (not rdoContainer.isValid()) {
1061 return StatusCode::FAILURE;
1067 if (not tracks.isValid()) {
1069 return StatusCode::FAILURE;
1074 <<
" tracks. Don't do hits-on-track-hists");
1075 return StatusCode::SUCCESS;
1081 if (trackStates ==
nullptr) {
1082 ATH_MSG_WARNING(
"for current track is TrackStateOnSurfaces == Null, no data will be written for this track");
1090 if (RawDataClus ==
nullptr) {
1095 if (RawDataClus->detectorElement()->isSCT()) {
1096 const std::vector<Identifier>& rdoList{RawDataClus->rdoList()};
1097 m_RDOsOnTracks[RawDataClus->detectorElement()->identifyHash()].insert(rdoList.begin(), rdoList.end());
1103 return StatusCode::SUCCESS;
1109 "SCT/SCTEC/hits/",
"SCT/SCTB/hits/",
"SCT/SCTEA/hits/"
1111 static const unsigned int limits[
N_REGIONS] = {
1118 ATH_MSG_FATAL(
"Invalid subsystem index, should be 0-2, was " << systemIndex);
1119 return StatusCode::FAILURE;
1126 for (
unsigned int i{0};
i < limits[systemIndex]; ++
i) {
1128 const std::string streamhitmap{
"mapsOfHitsOnTracks" + abbreviations[systemIndex] + streamDelimiter +
1129 "trackhitsmap_" + layerSide.name()};
1130 const std::string streamhitmaprecent{
"mapsOfHitsOnTracksRecent" + abbreviations[systemIndex] + streamDelimiter +
1131 "trackhitsmap_" + layerSide.name()};
1132 std::string histotitle{
"SCT hits on tracks for " +
names[systemIndex] +
" " + layerSide.title()};
1133 std::string histotitlerecent{
"SCT hits on tracks from recent events for " +
names[systemIndex] +
" " +
1141 return StatusCode::SUCCESS;
1150 return StatusCode::SUCCESS;
1168 tmp->SetXTitle(
"Index in the direction of #eta");
1169 tmp->SetYTitle(
"Index in the direction of #phi");
1174 storageVector.push_back(
tmp);
1175 return success ?
tmp :
nullptr;
1180 float xlo,
float xhi,
int nbiny,
float ylo,
float yhi)
const {
1183 tmp->SetXTitle(
"Index in the direction of #eta");
1184 tmp->SetYTitle(
"Index in the direction of #phi");
1189 return success ?
tmp :
nullptr;
1196 tmp->SetYTitle(
"Fraction of 01X");
1197 tmp->GetXaxis()->SetBinLabel(1,
"Endcap C");
1198 tmp->GetXaxis()->SetBinLabel(2,
"Barrel");
1199 tmp->GetXaxis()->SetBinLabel(3,
"Endcap A");
1204 return success ?
tmp :
nullptr;
1222 tmp->SetXTitle(
"Index in the direction of #eta");
1223 tmp->SetYTitle(
"Index in the direction of #phi");
1228 storageVector.push_back(
tmp);
1229 return success ?
tmp :
nullptr;
1234 const float hi,
const unsigned int nbins)
const {
1241 return success ?
tmp :
nullptr;
1246 std::vector<TH1F_LW*>& storageVector,
const float lo,
const float hi,
const unsigned int nbins)
const {
1253 storageVector.push_back(
tmp);
1254 return success ?
tmp :
nullptr;