diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx index a69a1cb592f7763b379dc8fbfde6b41bf201fd7e..3465db59057265c896c989110fc0295e4fd12e4f 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @file SCTHitsNoiseMonTool.cxx @@ -17,35 +17,27 @@ #include "AthContainers/DataVector.h" #include "InDetRawData/SCT3_RawData.h" -#include "InDetRawData/InDetRawDataContainer.h" // ? -#include "InDetRawData/InDetRawDataCLASS_DEF.h" // ? #include "InDetIdentifier/SCT_ID.h" -#include "InDetPrepRawData/SCT_ClusterContainer.h" #include "InDetRIO_OnTrack/SiClusterOnTrack.h" #include "LWHists/TH1F_LW.h" #include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" #include "LWHists/TProfile_LW.h" #include "SCT_ConditionsTools/ISCT_ConfigurationConditionsTool.h" #include "StoreGate/ReadHandle.h" #include "TrkEventUtils/RoT_Extractor.h" -#include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkSpacePoint/SpacePoint.h" #include "TrkSpacePoint/SpacePointCollection.h" #include "TrkSpacePoint/SpacePointOverlapCollection.h" #include "TrkSpacePoint/SpacePointCLASS_DEF.h" - -#include "GaudiKernel/IJobOptionsSvc.h" +#include "TrkTrack/Track.h" #include "TMath.h" #include "TH1F.h" -#include "TH2I.h" -#include "TH2F.h" #include "TProfile2D.h" -#include <iostream> -#include <fstream> // for writing an xml summary (debugging) #include <algorithm> +#include <fstream> // for writing an xml summary (debugging) +#include <iostream> using namespace std; using namespace SCT_Monitoring; @@ -53,30 +45,12 @@ using namespace SCT_Monitoring; * Utility functions to use in this file only **/ namespace { // use anonymous namespace to restrict scope to this file, equivalent to 'static' keyword here - // is a variable in the specified range? - template <typename T> - bool - inRange(const T& variable, const T& lo, const T& hi) { - return not ((variable < lo) or (variable > hi)); // assumes both less_than and greater_than exist for this type - } - // Possible timing patterns, IXX is 1XX etc. enum Pattern { IXX=0, XIX, XXI }; - // possible coordinate species - enum - Coordinate { - ETA=0, PHI - }; - // ... and the corresponding names - static const string coordinateNames[] = { - "ETA", "PHI" - }; - // possible histogram species - // string names for the detector parts static const string names[N_REGIONS] = { "Endcap C", "Barrel", "Endcap A" @@ -86,8 +60,6 @@ namespace { // use anonymous namespace to restrict scope to this file, equivalen "ECm", "", "ECp" }; static const string streamDelimiter{"_"}; - static const string pathDelimiter{"/"}; - // is the timebin in the desired pattern? bool @@ -117,9 +89,6 @@ namespace { // use anonymous namespace to restrict scope to this file, equivalen } }// end of anonymous namespace -const double SCTHitsNoiseMonTool::s_thresholds[]{100., 1000., 10000.}; -const string SCTHitsNoiseMonTool::s_thresholdNames[]{"100", "1000", "10000"}; - // ==================================================================================================== /** Constructor, calls base class constructor with parameters * @@ -164,11 +133,11 @@ SCTHitsNoiseMonTool::bookHistograms() { const bool doSystem[N_REGIONS] = { m_doNegativeEndcap, true, m_doPositiveEndcap }; + if (m_doTrackHits and bookGeneralTrackTimeHistos().isFailure()) { + ATH_MSG_WARNING("Error in bookGeneralTrackTimeHistos()"); + } for (unsigned int det{0}; det < N_REGIONS; ++det) { if (doSystem[det]) { - if (m_doTrackHits and bookGeneralTrackTimeHistos(det).isFailure()) { - ATH_MSG_WARNING("Error in bookGeneralTrackTimeHistos()"); - } if (m_doTrackHits and bookGeneralTrackHits(det).isFailure()) { ATH_MSG_WARNING("Error in bookGeneralTrackHits()"); } @@ -181,17 +150,9 @@ SCTHitsNoiseMonTool::bookHistograms() { if (bookGeneralHits(det).isFailure()) { ATH_MSG_WARNING("Error in bookGeneralHits()"); } - // offline only? - if (bookGeneralCluSize(det).isFailure()) { - ATH_MSG_WARNING("Error in bookGeneralSize()"); - } - // } } - if (bookSPvsEventNumber().isFailure()) { - ATH_MSG_WARNING("Error in bookSPvsEventNumber()"); - } if (bookNoiseDistributions().isFailure()) { ATH_MSG_WARNING("Error in bookNoiseDistributions()"); } @@ -208,27 +169,13 @@ SCTHitsNoiseMonTool::bookHistograms() { } if (newRunFlag()) { - string stem{m_stream + "/SCT/GENERAL/hits/summary"}; // book hits histogram MonGroup clu{this, "SCT/GENERAL/hits/summary", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}; m_ncluHisto = new TH1F{"sct_hits", "Total SCT Hits", N_HIT_BINS * 4, FIRST_HIT_BIN, LAST_HIT_BIN * 150.}; m_ncluHisto->GetXaxis()->SetTitle("Total SCT Hits"); m_ncluHisto->GetYaxis()->SetTitle("Entries"); if (clu.regHist(m_ncluHisto).isFailure()) { - ATH_MSG_WARNING("Cannot book Histogram:" << stem + "sct_hits"); - } - if (m_booltxscan) { - if (newEventsBlockFlag()) { - // book histograms for TX scans - m_hitsvstrigger = TH1F_LW::create("hits_vs_trigger", "Hits vs Trigger Type", 32, -0.5, 31.5); - if (clu.regHist(m_hitsvstrigger).isFailure()) { - ATH_MSG_WARNING("Cannot book Histogram:" << stem + "hitsvstrigger"); - } - m_hitsvsL1ID = TH1F_LW::create("hits_vs_L1ID", "Hits vs L1ID", 1000, 0., 10000.); - if (clu.regHist(m_hitsvsL1ID).isFailure()) { - ATH_MSG_WARNING("Cannot book Histogram:" << stem + "hitsvsL1ID"); - } - } + ATH_MSG_WARNING("Cannot book Histogram: SCT/GENERAL/hits/summary/sct_hits"); } if (initializeNoiseMaps().isFailure()) { ATH_MSG_WARNING("Failed to initalize noise occupancy maps!"); @@ -248,12 +195,12 @@ SCTHitsNoiseMonTool::bookHistogramsRecurrent() { const bool doSystem[N_REGIONS] = { m_doNegativeEndcap, true, m_doPositiveEndcap - }; + }; + if (m_doTrackHits and bookGeneralTrackTimeHistos().isFailure()) { + ATH_MSG_WARNING("Error in bookGeneralTrackTimeHistos()"); + } for (unsigned int det{0}; det < N_REGIONS; ++det) { if (doSystem[det]) { - if (m_doTrackHits and bookGeneralTrackTimeHistos(det).isFailure()) { - ATH_MSG_WARNING("Error in bookGeneralTrackTimeHistos()"); - } if (m_doTrackHits and bookGeneralTrackHits(det).isFailure()) { ATH_MSG_WARNING("Error in bookGeneralTrackHits()"); } @@ -266,17 +213,9 @@ SCTHitsNoiseMonTool::bookHistogramsRecurrent() { if (bookGeneralHits(det).isFailure()) { ATH_MSG_WARNING("Error in bookGeneralHits()"); } - // offline only? - if (bookGeneralCluSize(det).isFailure()) { - ATH_MSG_WARNING("Error in bookGeneralSize()"); - } - // } } - if (bookSPvsEventNumber().isFailure()) { - ATH_MSG_WARNING("Error in bookSPvsEventNumber()"); - } if (bookNoiseDistributions().isFailure()) { ATH_MSG_WARNING("Error in bookNoiseDistributions()"); } @@ -292,25 +231,13 @@ SCTHitsNoiseMonTool::bookHistogramsRecurrent() { ATH_MSG_WARNING("Error in bookClusterSize()"); } - string stem{m_stream + "/SCT/GENERAL/hits/summary"}; // book hits histogram MonGroup clu{this, "SCT/GENERAL/hits/summary", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}; m_ncluHisto = new TH1F("sct_hits", "Total SCT Hits", N_HIT_BINS * 4, FIRST_HIT_BIN, LAST_HIT_BIN * 150); m_ncluHisto->GetXaxis()->SetTitle("Event Number"); m_ncluHisto->GetYaxis()->SetTitle("Num of SCT Hits"); if (clu.regHist(m_ncluHisto).isFailure()) { - ATH_MSG_WARNING("Cannot book Histogram:" << stem + "sct_hits"); - } - if (m_booltxscan) { - // book histograms for TX scans - m_hitsvstrigger = TH1F_LW::create("hits_vs_trigger", "Hits vs Trigger Type", 32, -0.5, 31.5); - if (clu.regHist(m_hitsvstrigger).isFailure()) { - ATH_MSG_WARNING("Cannot book Histogram:" << stem + "hitsvstrigger"); - } - m_hitsvsL1ID = TH1F_LW::create("hits_vs_L1ID", "Hits vs L1ID", 1000, 0., 10000.); - if (clu.regHist(m_hitsvsL1ID).isFailure()) { - ATH_MSG_WARNING("Cannot book Histogram:" << stem + "hitsvsL1ID"); - } + ATH_MSG_WARNING("Cannot book Histogram: SCT/GENERAL/hits/summary/sct_hits"); } if (initializeNoiseMaps().isFailure()) { ATH_MSG_WARNING("Failed to initalize noise occupancy maps!"); @@ -331,19 +258,13 @@ SCTHitsNoiseMonTool::fillHistograms() { const EventIDBase& pEvent{ctx.eventID()}; int tmp_lb{static_cast<int>(pEvent.lumi_block())}; if ((tmp_lb > m_current_lb) and (m_current_lb<=NBINS_LBs)) { - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - m_noisyM[iThre][m_current_lb] = 0; - m_noisyMTrigger[iThre][m_current_lb] = 0; - m_noisyMWithHO[iThre][m_current_lb] = 0; - m_noisyMWithHOTrigger[iThre][m_current_lb] = 0; - } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { m_occ_lb[jReg][m_current_lb] = 0; m_occTrigger_lb[jReg][m_current_lb] = 0; m_hitocc_lb[jReg][m_current_lb] = 0; m_hitoccTrigger_lb[jReg][m_current_lb] = 0; } - int nlinks[N_REGIONS+1]{0, 0, 0, 0}; + int nlinks[N_REGIONS_INC_GENERAL]{0, 0, 0, 0}; SCT_ID::const_id_iterator planeIterator{m_pSCTHelper->wafer_begin()}; SCT_ID::const_id_iterator planeEnd{m_pSCTHelper->wafer_end()}; for (; planeIterator not_eq planeEnd; ++planeIterator) { @@ -355,34 +276,18 @@ SCTHitsNoiseMonTool::fillHistograms() { continue; } if (m_events_lb > 0) { - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { m_occ_lb[jReg][m_current_lb] += m_occSumUnbiased_lb[jReg][*planeIterator] / m_events_lb; m_hitocc_lb[jReg][m_current_lb] += m_hitoccSumUnbiased_lb[jReg][*planeIterator] / m_events_lb; } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - if ((1E5) * m_occSumUnbiased_lb[GENERAL_INDEX][*planeIterator] / m_events_lb > s_thresholds[iThre]) { - m_noisyM[iThre][m_current_lb]++; - } - if ((1E5) * m_hitoccSumUnbiased_lb[GENERAL_INDEX][*planeIterator] / m_events_lb > s_thresholds[iThre]) { - m_noisyMWithHO[iThre][m_current_lb]++; - } - } } if (m_eventsTrigger_lb > 0) { - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { m_occTrigger_lb[jReg][m_current_lb] += (1E5) * m_occSumUnbiasedTrigger_lb[jReg][*planeIterator] / m_eventsTrigger_lb; m_hitoccTrigger_lb[jReg][m_current_lb] += (1E5) * m_hitoccSumUnbiasedTrigger_lb[jReg][*planeIterator] / m_eventsTrigger_lb; } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - if ((1E5) * m_occSumUnbiasedTrigger_lb[GENERAL_INDEX][*planeIterator] / m_eventsTrigger_lb > s_thresholds[iThre]) { - m_noisyMTrigger[iThre][m_current_lb]++; - } - if ((1E5) * m_hitoccSumUnbiasedTrigger_lb[GENERAL_INDEX][*planeIterator] / m_eventsTrigger_lb > s_thresholds[iThre]) { - m_noisyMWithHOTrigger[iThre][m_current_lb]++; - } - } } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { m_occSumUnbiased_lb[jReg][*planeIterator] = 0; m_occSumUnbiasedTrigger_lb[jReg][*planeIterator] = 0; m_hitoccSumUnbiased_lb[jReg][*planeIterator] = 0; @@ -391,7 +296,7 @@ SCTHitsNoiseMonTool::fillHistograms() { nlinks[systemIndex]++; nlinks[GENERAL_INDEX]++; } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { if (nlinks[jReg]>0) { m_occ_lb[jReg][m_current_lb] /= nlinks[jReg]; m_occTrigger_lb[jReg][m_current_lb] /= nlinks[jReg]; @@ -412,19 +317,16 @@ SCTHitsNoiseMonTool::fillHistograms() { if (generalHistsandNoise().isFailure()) { ATH_MSG_WARNING("Error in generalHists"); } - if (makeSPvsEventNumber().isFailure()) { - ATH_MSG_WARNING("Error in makeSPvsEventNumber"); - } if (m_environment == AthenaMonManager::online) { if ((m_numberOfEvents % m_checkrate) == 0) { - if (checkNoiseMaps(true).isFailure()) { - ATH_MSG_WARNING("Error in checkNoiseMaps(true)"); + if (checkNoiseMaps().isFailure()) { + ATH_MSG_WARNING("Error in checkNoiseMaps()"); } } if ((m_current_lb % m_checkrecent == 0) and (m_current_lb > m_last_reset_lb)) { - if (checkNoiseMaps(true).isFailure()) { - ATH_MSG_WARNING("Error in checkNoiseMaps(true)"); + if (checkNoiseMaps().isFailure()) { + ATH_MSG_WARNING("Error in checkNoiseMaps()"); } if (resetNoiseMapsRecent().isFailure()) { ATH_MSG_WARNING("Error in resetNoiseMapsRecent"); @@ -450,8 +352,8 @@ StatusCode SCTHitsNoiseMonTool::procHistograms() { bool endOfEventsBlock{endOfLumiBlockFlag()}; if (endOfEventsBlock) { - if (checkNoiseMaps(true).isFailure()) { - ATH_MSG_WARNING("Error in checkNoiseMaps(true)"); + if (checkNoiseMaps().isFailure()) { + ATH_MSG_WARNING("Error in checkNoiseMaps()"); } } return StatusCode::SUCCESS; @@ -480,9 +382,6 @@ SCTHitsNoiseMonTool::checkHists(bool /*fromFinalize*/) { // ==================================================================================================== StatusCode SCTHitsNoiseMonTool::generalHistsandNoise() { - const EventContext& ctx{Gaudi::Hive::currentContext()}; - const EventIDBase& pEvent{ctx.eventID()}; - unsigned int current_lb{pEvent.lumi_block()}; SG::ReadHandle<SCT_RDO_Container> p_rdocontainer{m_dataObjectName}; if (not p_rdocontainer.isValid()) { return StatusCode::FAILURE; @@ -496,12 +395,7 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { // Use new IDC int local_tothits{0}; int totalmodules{0}; - int meanhits{0}; int maxrodhits{0}; - int maxhits{0}; - Identifier maxhits_Id; - int minhits{99999}; - Identifier minhits_Id; bool isSelectedTrigger{false}; // EDAVIES - have now changed back to using L1_RD0_EMPTY @@ -600,20 +494,13 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { } if (find(m_RDOsOnTracks.begin(), m_RDOsOnTracks.end(), SCT_Identifier) != m_RDOsOnTracks.end()) { for (int ichan{chan}; ichan < limit; ++ichan) { - m_tbinHisto[systemIndex]->Fill(tbin, 1.); - m_tbinHistoVector[systemIndex][ thisLayerDisk ]->Fill(tbin, 1.); m_ptrackhitsHistoVector[systemIndex][thisElement]->Fill(thisEta, thisPhi); if (m_environment == AthenaMonManager::online) { - m_tbinHistoRecent[systemIndex]->Fill(tbin, 1.); - m_tbinHistoVectorRecent[systemIndex][ thisLayerDisk ]->Fill(tbin, 1.); m_ptrackhitsHistoVectorRecent[systemIndex][thisElement]->Fill(thisEta, thisPhi); } // Fill the track hits histogram double dTbin{static_cast<double>((tbin == 2) or (tbin == 3))}; - m_tbinfracVsLB[systemIndex]->Fill(current_lb, dTbin); m_tbinfracall->Fill(thisBec+0.5, dTbin); - int layersidenum{thisLayerDisk * N_SIDES + thisSide}; - m_tbinfrac[systemIndex][layersidenum]->Fill(thisEta, thisPhi, dTbin); } } histogram->Fill(thisEta, thisPhi, numberOfStrips); @@ -621,8 +508,6 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { histogram_recent->Fill(thisEta, thisPhi, numberOfStrips); } numberOfHitsFromAllRDOs += numberOfStrips; - // Fill hits per lumi block histogram - m_numHitsPerLumiBlock[systemIndex]->Fill(thisLayerDisk, numberOfStrips); // Record number of hits in space points if timebin filtering is on hits not in bin X1X are counted as in space // points if (mySetOfSPIds.find(SCT_Identifier) != mySetOfSPIds.end()) { @@ -643,15 +528,6 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { } // End of Loop on SCT_Collection, so end of loop over the RDOs in the RDO container // We can now do the NO calculation for this wafer // For the Time Dependent plots - if (maxhits < maxrodhits) { - maxhits_Id = theWaferIdentifierOfTheRDOCollection; - maxhits = maxrodhits; - } - if (minhits > maxrodhits) { - minhits_Id = theWaferIdentifierOfTheRDOCollection; - minhits = maxrodhits; - } - meanhits = local_tothits / totalmodules; if (numberOfHitsFromAllRDOs > 0) { unsigned int systemIndex{bec2Index(Bec)}; @@ -661,7 +537,6 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { float sumocc{0.}; if (diff < 0) { num = 0; - m_skipEvents++; ATH_MSG_WARNING("Too many reconstructed space points for number of real hits"); } if (den > 0) { @@ -673,13 +548,9 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { if (isSelectedTrigger) { m_occSumUnbiasedTrigger[theWaferIdentifierOfTheRDOCollection] += sumocc; } - m_NallHits_vsLB[systemIndex]->Fill(m_current_lb, numberOfHitsFromAllRDOs); - m_NSPHits_vsLB[systemIndex]->Fill(m_current_lb, numberOfHitsFromSPs); m_occSumUnbiased_lb[systemIndex][theWaferIdentifierOfTheRDOCollection] += sumocc; m_occSumUnbiased_lb[GENERAL_INDEX][theWaferIdentifierOfTheRDOCollection] += sumocc; if (isSelectedTrigger) { - m_NallHitsTrigger_vsLB[systemIndex]->Fill(m_current_lb, numberOfHitsFromAllRDOs); - m_NSPHitsTrigger_vsLB[systemIndex]->Fill(m_current_lb, numberOfHitsFromSPs); m_occSumUnbiasedTrigger_lb[systemIndex][theWaferIdentifierOfTheRDOCollection] += sumocc; m_occSumUnbiasedTrigger_lb[GENERAL_INDEX][theWaferIdentifierOfTheRDOCollection] += sumocc; } @@ -723,96 +594,6 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { } } - if (m_environment == AthenaMonManager::online) { - // Time Dependent plots only online - bool badmodule{false}; - m_nHits_buf[m_nHits_pos] = meanhits; - m_nmaxHits_buf[m_nHits_pos] = maxhits; - m_nmaxModule_buf[m_nHits_pos] = maxhits_Id; - m_nminHits_buf[m_nHits_pos] = minhits; - m_nminModule_buf[m_nHits_pos] = minhits_Id; - m_nHits_pos++; - if (m_nHits_pos == m_evtsbins) { - m_nHits_pos = 0; - } - - if (m_numberOfEvents % m_checkrate == 0) { - m_nHits->Reset(); - m_nmaxHits->Reset(); - int latest_nHits_pos{m_nHits_pos}; - m_nminHits->Reset(); - // Check if the same module is the noisiest one for at least 10 events - // Need to add a similar check for modules with the minimum number of hits - if (m_nHits_pos > 10) { - for (int s{10}; s > 0; --s) { - int npos{m_nHits_pos - s}; - if (m_nmaxModule_buf[npos] == m_nmaxModule_buf[npos - 1]) { - badmodule = true; - } else { - badmodule = false; - } - } - } else if ((m_nHits_pos < 10) and (m_numberOfEvents > m_evtsbins)) { - for (int s{10}; s > 0; --s) { - int npos{m_nHits_pos - s}; - int nppos{m_nHits_pos - s - 1}; - if (npos < 0) { - npos = m_evtsbins + npos; - } - // copy-and-paste error? coverity id 29910 - if (nppos < 0) { - nppos = m_evtsbins + nppos; - } - if (m_nmaxModule_buf[npos] == m_nmaxModule_buf[nppos]) { - badmodule = true; - } else { - badmodule = false; - } - } - } - // Fill the histograms with the values from the buffer - for (int i{1}; i < m_evtsbins; ++i) { - if (latest_nHits_pos == m_evtsbins) { - latest_nHits_pos = 0; - } - - if (m_numberOfEvents < m_evtsbins) { - if (i < m_nHits_pos) { - m_nHits->SetBinContent(i, m_nHits_buf[i]); - m_nmaxHits->SetBinContent(i, m_nmaxHits_buf[i]); - m_nminHits->SetBinContent(i, m_nminHits_buf[i]); - } else { - m_nHits->SetBinContent(i, 0); - m_nmaxHits->SetBinContent(i, 0); - m_nminHits->SetBinContent(i, 0); - } - } else { - // Fill average histo - m_nHits->SetBinContent(i, m_nHits_buf[latest_nHits_pos]); - m_nHits->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents); - // Fill max histo - m_nmaxHits->SetBinContent(i, m_nmaxHits_buf[latest_nHits_pos]); - m_nmaxHits->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents); - // Fill min histo - m_nminHits->SetBinContent(i, m_nminHits_buf[latest_nHits_pos]); - m_nminHits->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents); - // Change color of the Line if found a noisy module - // Need to add similar system for minimum histogram - if (badmodule) { - m_nmaxHits->SetFillColor(2); - } else { - m_nmaxHits->SetLineColor(0); - } - } - latest_nHits_pos++; - if (latest_nHits_pos == m_evtsbins) { - latest_nHits_pos = 0; - } - } - } - } - - // if (m_environment!=AthenaMonManager::online) { // Uncomment this line to turn off cluster hists in online // Fill Cluster size histogram SG::ReadHandle<InDet::SCT_ClusterContainer> p_clucontainer{m_clusContainerKey}; if (not p_clucontainer.isValid()) { @@ -833,11 +614,7 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { if ((thisBec==BARREL) or ((thisBec==ENDCAP_A) and m_doPositiveEndcap) or ((thisBec==ENDCAP_C) and m_doNegativeEndcap)) { - m_clusizeHistoVector[systemIndex][elementIndex]->Fill(GroupSize, 1.); m_clusizedist[systemIndex][elementIndex]->Fill(thisEta, thisPhi, GroupSize); - if (m_environment == AthenaMonManager::online) { - m_clusizeHistoVectorRecent[systemIndex][elementIndex]->Fill(GroupSize, 1.); - } } if (m_environment == AthenaMonManager::online) { @@ -847,12 +624,6 @@ SCTHitsNoiseMonTool::generalHistsandNoise() { } // } // Uncomment this line as well to turn off cluster hists in online - if ((m_numberOfEvents % m_checkrate) == 0) { - if (checkHists(false).isFailure()) { - ATH_MSG_WARNING("Error in checkHists(false)"); - } - } - return StatusCode::SUCCESS; } @@ -867,7 +638,6 @@ StatusCode SCTHitsNoiseMonTool::book1DHitHists() { if (newRunFlag()) { m_phitmapHistoVector.clear(); - string stem; MonGroup HitHists[N_REGIONS]{{this, "SCT/SCTEC/hitmaps", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}, {this, "SCT/SCTB/hitmaps", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}, {this, "SCT/SCTEA/hitmaps", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}}; @@ -903,25 +673,8 @@ SCTHitsNoiseMonTool::bookGeneralHits(const unsigned int systemIndex) { static const unsigned int limits[N_REGIONS] = { N_DISKSx2, N_BARRELSx2, N_DISKSx2 }; - static const string hitHistNames[N_REGIONS]{"numHitsPerLBECm", "numBarrelHitsPerLB", "numHitsPerLBECp"}; - static const string spHistNames[N_REGIONS]{"numSPPerLBECm", "numBarrelSPPerLB", "numSPPerLBECp"}; static const string titles[N_REGIONS]{"Endcap C", "barrel", "Endcap A"}; // - if (newLumiBlockFlag()) { - MonGroup lumiHits{this, paths[systemIndex], lumiBlock, ATTRIB_UNMANAGED}; - int binSize{(bec==BARREL) ? N_BARRELS : N_DISKS}; - m_numHitsPerLumiBlock[systemIndex] = h1Factory(hitHistNames[systemIndex], - ("Number of "+titles[systemIndex]+" hits in a luminosity block").c_str(), - lumiHits, 0., binSize, binSize); - m_numHitsPerLumiBlock[systemIndex]->GetXaxis()->SetTitle((bec==BARREL) ? "Layer" : "Disk"); - m_numHitsPerLumiBlock[systemIndex]->GetYaxis()->SetTitle("Num of Hits Per LumiBlock"); - - m_numSPPerLumiBlock[systemIndex] = h1Factory(spHistNames[systemIndex], - ("Number of "+titles[systemIndex]+" spacepoints in a luminosity block").c_str(), - lumiHits, 0., binSize, binSize); - m_numSPPerLumiBlock[systemIndex]->GetXaxis()->SetTitle((bec==BARREL) ? "Layer" : "Disk"); - m_numSPPerLumiBlock[systemIndex]->GetYaxis()->SetTitle("Num of SpacePoint Per LumiBlock"); - } if (newRunFlag()) { m_phitsHistoVector[systemIndex].clear(); m_phitsHistoVectorRecent[systemIndex].clear(); @@ -984,16 +737,6 @@ SCTHitsNoiseMonTool::bookClusterSize() { m_clusize = h1Factory("clu_size", "SCT Cluster size", BarrelCluSize, 0., 200., 200); m_clusize->GetXaxis()->SetTitle("Cluster Size"); m_clusize->GetYaxis()->SetTitle("Num of Events"); - for (unsigned int iReg{0}; iReg<N_REGIONS; iReg++) { - for (int ld{0}; ld < ((iReg==BARREL_INDEX) ? N_BARRELSx2 : N_DISKSx2); ld++) { - m_clusizeHistoVector[iReg][ld]->GetXaxis()->SetTitle("Cluster Size"); - m_clusizeHistoVector[iReg][ld]->GetYaxis()->SetTitle("Num of Events"); - if (m_environment == AthenaMonManager::online) { - m_clusizeHistoVectorRecent[iReg][ld]->GetXaxis()->SetTitle("Cluster Size"); - m_clusizeHistoVectorRecent[iReg][ld]->GetYaxis()->SetTitle("Num of Events"); - } - } - } if (m_environment == AthenaMonManager::online) { m_clusizeRecent = h1Factory("clu_size_recent", "SCT Cluster size from recent events", BarrelCluSize, 0., 200., 200); @@ -1004,43 +747,6 @@ SCTHitsNoiseMonTool::bookClusterSize() { return m_clusize ? (StatusCode::SUCCESS) : (StatusCode::FAILURE); } -StatusCode -SCTHitsNoiseMonTool::bookGeneralCluSize(const unsigned int systemIndex) { - const Bec bec{index2Bec(systemIndex)}; - - static const string paths[N_REGIONS] = { - "SCT/SCTEC/hits", "SCT/SCTB/hits", "SCT/SCTEA/hits" - }; - static const unsigned int limits[N_REGIONS] = { - N_DISKSx2, N_BARRELSx2, N_DISKSx2 - }; - - if (bec == INVALID_SYSTEM) { - ATH_MSG_FATAL("Invalid subsystem index, should be 0-2, was " << systemIndex); - return StatusCode::FAILURE; - } - vector<TH1F_LW*>& clusterSizeVector{m_clusizeHistoVector[systemIndex]}; - vector<TH1F_LW*>& clusterSizeVectorRecent{m_clusizeHistoVectorRecent[systemIndex]}; - if (newRunFlag()) { - clusterSizeVector.clear(); - clusterSizeVectorRecent.clear(); - MonGroup clusterSize{this, paths[systemIndex], run, ATTRIB_UNMANAGED}; - for (unsigned int i{0}; i < limits[systemIndex]; ++i) { - LayerSideFormatter layerSide{i, systemIndex}; - const string streamclusize{"clusize" + abbreviations[systemIndex] + "_" + layerSide.name()}; - string histotitle{"SCT " + names[systemIndex] + " Cluster size: " + layerSide.title()}; - h1Factory(streamclusize, histotitle, clusterSize, clusterSizeVector, 0., 200., 200); - if (m_environment == AthenaMonManager::online) { - const string streamclusizerecent{"clusize_recent" + abbreviations[systemIndex] + "_" + layerSide.name()}; - string histotitlerecent{"SCT " + names[systemIndex] + " Cluster size from recent events: " + - layerSide.title()}; - h1Factory(streamclusizerecent, histotitlerecent, clusterSize, clusterSizeVectorRecent, 0., 200., 200); - } - } - } - return StatusCode::SUCCESS; -} - StatusCode SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemIndex) { static const string paths[N_REGIONS] = { @@ -1058,13 +764,11 @@ SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemInde } if (newRunFlag()) { MonGroup noiseOccMaps{this, paths[systemIndex], run, ATTRIB_UNMANAGED}; - m_pnoiseoccupancymapHistoVector[systemIndex].clear(); m_pnoiseoccupancymapHistoVectorTrigger[systemIndex].clear(); m_pnoiseoccupancymapHistoVectorRecent[systemIndex].clear(); // book 2D "noise" maps, containing hits that aren't associated to tracks for (unsigned int i{0}; i < limits[systemIndex]; ++i) { LayerSideFormatter layerSide{i, systemIndex}; - const string streamhitmap{"noiseoccupancymap" + abbreviations[systemIndex] + "_" + layerSide.name()}; const string streamhitmaptrigger{"noiseoccupancymaptrigger" + abbreviations[systemIndex] + "_" + layerSide.name()}; const string streamhitmaprecent{"noiseoccupancymaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; @@ -1073,7 +777,6 @@ SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemInde names[systemIndex] + ": " + layerSide.title()}; string histotitlerecent{"SCT Noise Occupancy map in recent events for " + names[systemIndex] + ": " + layerSide.title()}; - prof2Factory(streamhitmap, histotitle, bec, noiseOccMaps, m_pnoiseoccupancymapHistoVector[systemIndex]); prof2Factory(streamhitmaptrigger, histotitletrigger, bec, noiseOccMaps, m_pnoiseoccupancymapHistoVectorTrigger[systemIndex]); if (m_environment == AthenaMonManager::online) { prof2Factory(streamhitmaprecent, histotitlerecent, bec, noiseOccMaps, m_pnoiseoccupancymapHistoVectorRecent[systemIndex]); @@ -1082,39 +785,6 @@ SCTHitsNoiseMonTool::bookGeneralNoiseOccupancyMaps(const unsigned int systemInde string histNames[N_REGIONS]{"ECm", "BAR", "ECp"}; string histTitles[N_REGIONS]{"ECm", "Barrel", "ECp"}; - m_NallHits_vsLB[systemIndex] = TProfile_LW::create(("h_NallHits"+histNames[systemIndex]+"_vsLB").c_str(), - ("Average num of all Hits in "+histTitles[systemIndex]+" vs LB").c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NallHits_vsLB[systemIndex]->GetXaxis()->SetTitle("LumiBlock"); - m_NallHits_vsLB[systemIndex]->GetYaxis()->SetTitle("Average number of all Hits"); - if (noiseOccMaps.regHist(m_NallHits_vsLB[systemIndex]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NallHits_vsLB[systemIndex]->GetName()); - } - m_NSPHits_vsLB[systemIndex] = TProfile_LW::create(("h_NSPHits"+histNames[systemIndex]+"_vsLB").c_str(), - ("Average num of SP Hits in "+histTitles[systemIndex]+" vs LB").c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NSPHits_vsLB[systemIndex]->GetXaxis()->SetTitle("LumiBlock"); - m_NSPHits_vsLB[systemIndex]->GetYaxis()->SetTitle("Average number of SP Hits"); - if (noiseOccMaps.regHist(m_NSPHits_vsLB[systemIndex]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NSPHits_vsLB[systemIndex]->GetName()); - } - - m_NallHitsTrigger_vsLB[systemIndex] = TProfile_LW::create(("h_NallHitsTrigger"+histNames[systemIndex]+"_vsLB").c_str(), - ("Average num of all Hits in "+histTitles[systemIndex]+" with trigger vs LB").c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NallHitsTrigger_vsLB[systemIndex]->GetXaxis()->SetTitle("LumiBlock"); - m_NallHitsTrigger_vsLB[systemIndex]->GetYaxis()->SetTitle("Average number of all Hits"); - if (noiseOccMaps.regHist(m_NallHitsTrigger_vsLB[systemIndex]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NallHitsTrigger_vsLB[systemIndex]->GetName()); - } - m_NSPHitsTrigger_vsLB[systemIndex] = TProfile_LW::create(("h_NSPHitsTrigger"+histNames[systemIndex]+"_vsLB").c_str(), - ("Average num of SP Hits in "+histTitles[systemIndex]+" with trigger vs LB").c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NSPHitsTrigger_vsLB[systemIndex]->GetXaxis()->SetTitle("LumiBlock"); - m_NSPHitsTrigger_vsLB[systemIndex]->GetYaxis()->SetTitle("Average number of SP Hits"); - if (noiseOccMaps.regHist(m_NSPHitsTrigger_vsLB[systemIndex]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NSPHitsTrigger_vsLB[systemIndex]->GetName()); - } string histNamesNO[N_REGIONS]{"ECC", "BAR", "ECA"}; string histTitlesNO[N_REGIONS]{"EndCap C", "Barrel", "EndCap A"}; @@ -1158,20 +828,17 @@ SCTHitsNoiseMonTool::bookGeneralHitOccupancyMaps(const unsigned int systemIndex) MonGroup hitOccMaps{this, paths[systemIndex], run, ATTRIB_UNMANAGED}; m_phitoccupancymapHistoVector[systemIndex].clear(); - m_phitoccupancymapHistoVectorTrigger[systemIndex].clear(); m_phitoccupancymapHistoVectorRecent[systemIndex].clear(); // book 2D "noise" maps, containing hits that aren't associated to tracks for (unsigned int i{0}; i < limits[systemIndex]; ++i) { LayerSideFormatter layerSide{i, systemIndex}; const string streamhitmapR{"hitoccupancymap" + abbreviations[systemIndex] + "_" + layerSide.name()}; - const string streamhitmaptriggerR{"hitoccupancymaptrigger" + abbreviations[systemIndex] + "_" + layerSide.name()}; const string streamhitmaprecentR{"hitoccupancymaprecent" + abbreviations[systemIndex] + "_" + layerSide.name()}; string histotitleR{"SCT Hit Occupancy map for " + names[systemIndex] + ": " + layerSide.title()}; string histotitletriggerR{"SCT Hit Occupancy map for " + m_NOTriggerItem + " Trigger and " + names[systemIndex] + ": " + layerSide.title()}; string histotitlerecentR{"SCT Hit Occupancy map in recent events for " + names[systemIndex] + ": " + layerSide.title()}; prof2Factory(streamhitmapR, histotitleR, bec, hitOccMaps, m_phitoccupancymapHistoVector[systemIndex]); - prof2Factory(streamhitmaptriggerR, histotitletriggerR, bec, hitOccMaps, m_phitoccupancymapHistoVectorTrigger[systemIndex]); if (m_environment == AthenaMonManager::online) { prof2Factory(streamhitmaprecentR, histotitlerecentR, bec, hitOccMaps, m_phitoccupancymapHistoVectorRecent[systemIndex]); } @@ -1241,24 +908,23 @@ SCTHitsNoiseMonTool::bookGeneralHitOccupancyMaps(const unsigned int systemIndex) // efficiency, occupancy, rms histograms, etc from the basic ones // ==================================================================================================== StatusCode -SCTHitsNoiseMonTool::checkNoiseMaps(bool final) { +SCTHitsNoiseMonTool::checkNoiseMaps() { IdentifierHash next; vector<float> vectorOfOccupancies; - if (final) { - if (m_doSpacePointBasedNoise) { - // CAM Added code for track and SP algorithms - //////////////////////////////////////////////////////// - if (m_environment == AthenaMonManager::online) { // Reset histos for online so there is proper weighting of events - if (resetNoiseMapHists().isFailure()) { - ATH_MSG_WARNING("Failed to reset noise occupancy maps!"); - } + if (m_doSpacePointBasedNoise) { + // CAM Added code for track and SP algorithms + //////////////////////////////////////////////////////// + if (m_environment == AthenaMonManager::online) { // Reset histos for online so there is proper weighting of events + if (resetNoiseMapHists().isFailure()) { + ATH_MSG_WARNING("Failed to reset noise occupancy maps!"); } - if (m_occSumUnbiased.size() and m_numberOfEvents) { - for (pair<const Identifier, float>& val: m_occSumUnbiased) { + + if (m_occSumUnbiasedRecent.size() and m_numberOfEventsRecent) { + for (pair<const Identifier, float>& val: m_occSumUnbiasedRecent) { Identifier wafer_id{val.first}; int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; - float occ{(m_numberOfEvents > 0) ? val.second / (m_numberOfEvents) : val.second}; + float occ{(m_numberOfEventsRecent > 0) ? val.second / (m_numberOfEventsRecent) : val.second}; int eta{m_pSCTHelper->eta_module(wafer_id)}; int phi{m_pSCTHelper->phi_module(wafer_id)}; int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; @@ -1266,95 +932,50 @@ SCTHitsNoiseMonTool::checkNoiseMaps(bool final) { if ((barrel_ec == BARREL) or ((barrel_ec == ENDCAP_A) and m_doPositiveEndcap) or ((barrel_ec == ENDCAP_C) and m_doNegativeEndcap)) { - m_pnoiseoccupancymapHistoVector[systemIndex][element]->Fill(eta, phi, occ * 1E5); - m_NO[systemIndex]->Fill(occ * 1E5); - m_NO[GENERAL_INDEX]->Fill(occ * 1E5); + m_pnoiseoccupancymapHistoVectorRecent[systemIndex][element]->Fill(eta, phi, occ * 1E5); } } } - if (m_environment == AthenaMonManager::online) { - if (m_occSumUnbiasedRecent.size() and m_numberOfEventsRecent) { - for (pair<const Identifier, float>& val: m_occSumUnbiasedRecent) { - Identifier wafer_id{val.first}; - int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; - float occ{(m_numberOfEventsRecent > 0) ? val.second / (m_numberOfEventsRecent) : val.second}; - int eta{m_pSCTHelper->eta_module(wafer_id)}; - int phi{m_pSCTHelper->phi_module(wafer_id)}; - int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; - unsigned int systemIndex{bec2Index(barrel_ec)}; - if ((barrel_ec == BARREL) or - ((barrel_ec == ENDCAP_A) and m_doPositiveEndcap) or - ((barrel_ec == ENDCAP_C) and m_doNegativeEndcap)) { - m_pnoiseoccupancymapHistoVectorRecent[systemIndex][element]->Fill(eta, phi, occ * 1E5); - } - } - } - } - if (m_occSumUnbiasedTrigger.size() and m_numberOfEventsTrigger) { - for (pair<const Identifier, float>&val: m_occSumUnbiasedTrigger) { - Identifier wafer_id{val.first}; - int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; - float occ{(m_numberOfEventsTrigger > 0) ? val.second / (m_numberOfEventsTrigger) : val.second}; - int eta{m_pSCTHelper->eta_module(wafer_id)}; - int phi{m_pSCTHelper->phi_module(wafer_id)}; - int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; - unsigned int systemIndex{bec2Index(barrel_ec)}; - if ((barrel_ec == BARREL) or - ((barrel_ec == ENDCAP_A) and m_doPositiveEndcap) or - ((barrel_ec == ENDCAP_C) and m_doNegativeEndcap)) { - m_pnoiseoccupancymapHistoVectorTrigger[systemIndex][element]->Fill(eta, phi, occ * 1E5); - m_NOTrigger[systemIndex]->Fill(occ * 1E5); - m_NOTrigger[GENERAL_INDEX]->Fill(occ * 1E5); - } + } + if (m_occSumUnbiasedTrigger.size() and m_numberOfEventsTrigger) { + for (pair<const Identifier, float>&val: m_occSumUnbiasedTrigger) { + Identifier wafer_id{val.first}; + int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; + float occ{(m_numberOfEventsTrigger > 0) ? val.second / (m_numberOfEventsTrigger) : val.second}; + int eta{m_pSCTHelper->eta_module(wafer_id)}; + int phi{m_pSCTHelper->phi_module(wafer_id)}; + int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; + unsigned int systemIndex{bec2Index(barrel_ec)}; + if ((barrel_ec == BARREL) or + ((barrel_ec == ENDCAP_A) and m_doPositiveEndcap) or + ((barrel_ec == ENDCAP_C) and m_doNegativeEndcap)) { + m_pnoiseoccupancymapHistoVectorTrigger[systemIndex][element]->Fill(eta, phi, occ * 1E5); } } + } - if (m_hitoccSumUnbiased.size() and m_numberOfEvents) { - for (pair<const Identifier, float>& val: m_hitoccSumUnbiased) { - Identifier wafer_id{val.first}; - int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; - float hitocc{(m_numberOfEvents > 0) ? val.second / (m_numberOfEvents) : val.second}; - int eta{m_pSCTHelper->eta_module(wafer_id)}; - int phi{m_pSCTHelper->phi_module(wafer_id)}; - int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; - unsigned int systemIndex{bec2Index(barrel_ec)}; - if ((barrel_ec==BARREL) or - ((barrel_ec==ENDCAP_A) and m_doPositiveEndcap) or - ((barrel_ec==ENDCAP_C) and m_doNegativeEndcap)) { - m_phitoccupancymapHistoVector[systemIndex][element]->Fill(eta, phi, hitocc * 1E5); - } - - if ((barrel_ec==BARREL) or - ((barrel_ec==ENDCAP_A) and m_doPositiveEndcap) or - ((barrel_ec==ENDCAP_C) and m_doNegativeEndcap)) { - m_HO[systemIndex]->Fill(hitocc * 1E5); - m_HO[GENERAL_INDEX]->Fill(hitocc * 1E5); - } - } - } - if (m_environment == AthenaMonManager::online) { - if (m_hitoccSumUnbiasedRecent.size() and m_numberOfEventsRecent) { - for (pair<const Identifier, float>& val: m_hitoccSumUnbiasedRecent) { - Identifier wafer_id{val.first}; - int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; - float hitocc{(m_numberOfEventsRecent > 0) ? val.second / (m_numberOfEventsRecent) : val.second}; - int eta{m_pSCTHelper->eta_module(wafer_id)}; - int phi{m_pSCTHelper->phi_module(wafer_id)}; - int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; - unsigned int systemIndex{bec2Index(barrel_ec)}; - if ((barrel_ec==BARREL) or - ((barrel_ec==ENDCAP_A) and m_doPositiveEndcap) or - ((barrel_ec==ENDCAP_C) and m_doNegativeEndcap)) { - m_phitoccupancymapHistoVectorRecent[systemIndex][element]->Fill(eta, phi, hitocc * 1E5); - } - } + if (m_hitoccSumUnbiased.size() and m_numberOfEvents) { + for (pair<const Identifier, float>& val: m_hitoccSumUnbiased) { + Identifier wafer_id{val.first}; + int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; + float hitocc{(m_numberOfEvents > 0) ? val.second / (m_numberOfEvents) : val.second}; + int eta{m_pSCTHelper->eta_module(wafer_id)}; + int phi{m_pSCTHelper->phi_module(wafer_id)}; + int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; + unsigned int systemIndex{bec2Index(barrel_ec)}; + if ((barrel_ec==BARREL) or + ((barrel_ec==ENDCAP_A) and m_doPositiveEndcap) or + ((barrel_ec==ENDCAP_C) and m_doNegativeEndcap)) { + m_phitoccupancymapHistoVector[systemIndex][element]->Fill(eta, phi, hitocc * 1E5); } } - if (m_hitoccSumUnbiasedTrigger.size() and m_numberOfEventsTrigger) { - for (pair<const Identifier, float>& val: m_hitoccSumUnbiasedTrigger) { + } + if (m_environment == AthenaMonManager::online) { + if (m_hitoccSumUnbiasedRecent.size() and m_numberOfEventsRecent) { + for (pair<const Identifier, float>& val: m_hitoccSumUnbiasedRecent) { Identifier wafer_id{val.first}; int element{N_SIDES * m_pSCTHelper->layer_disk(wafer_id) + m_pSCTHelper->side(wafer_id)}; - float hitocc{(m_numberOfEventsTrigger > 0) ? val.second / (m_numberOfEventsTrigger) : val.second}; + float hitocc{(m_numberOfEventsRecent > 0) ? val.second / (m_numberOfEventsRecent) : val.second}; int eta{m_pSCTHelper->eta_module(wafer_id)}; int phi{m_pSCTHelper->phi_module(wafer_id)}; int barrel_ec{m_pSCTHelper->barrel_ec(wafer_id)}; @@ -1362,129 +983,78 @@ SCTHitsNoiseMonTool::checkNoiseMaps(bool final) { if ((barrel_ec==BARREL) or ((barrel_ec==ENDCAP_A) and m_doPositiveEndcap) or ((barrel_ec==ENDCAP_C) and m_doNegativeEndcap)) { - m_phitoccupancymapHistoVectorTrigger[systemIndex][element]->Fill(eta, phi, hitocc * 1E5); - } - if ((barrel_ec == BARREL) or - ((barrel_ec == ENDCAP_A) and m_doPositiveEndcap) or - ((barrel_ec == ENDCAP_C) and m_doNegativeEndcap)) { - m_HOTrigger[systemIndex]->Fill(hitocc * 1E5); - m_HOTrigger[GENERAL_INDEX]->Fill(hitocc * 1E5); + m_phitoccupancymapHistoVectorRecent[systemIndex][element]->Fill(eta, phi, hitocc * 1E5); } } } + } - if (m_current_lb<=NBINS_LBs) { - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - m_noisyM[iThre][m_current_lb] = 0; - m_noisyMTrigger[iThre][m_current_lb] = 0; - m_noisyMWithHO[iThre][m_current_lb] = 0; - m_noisyMWithHOTrigger[iThre][m_current_lb] = 0; - } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - m_occ_lb[jReg][m_current_lb] = 0; - m_occTrigger_lb[jReg][m_current_lb] = 0; - m_hitocc_lb[jReg][m_current_lb] = 0; - m_hitoccTrigger_lb[jReg][m_current_lb] = 0; + if (m_current_lb<=NBINS_LBs) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { + m_occ_lb[jReg][m_current_lb] = 0; + m_occTrigger_lb[jReg][m_current_lb] = 0; + m_hitocc_lb[jReg][m_current_lb] = 0; + m_hitoccTrigger_lb[jReg][m_current_lb] = 0; + } + int nlinks[N_REGIONS_INC_GENERAL]{0, 0, 0, 0}; + SCT_ID::const_id_iterator planeIterator{m_pSCTHelper->wafer_begin()}; + SCT_ID::const_id_iterator planeEnd{m_pSCTHelper->wafer_end()}; + for (; planeIterator not_eq planeEnd; ++planeIterator) { + Identifier planeId{*planeIterator}; + const int bec{m_pSCTHelper->barrel_ec(planeId)}; + const unsigned int systemIndex{bec2Index(bec)}; + // Don't initialize a value for disabled modules + if (not m_ConfigurationTool->isGood(*planeIterator, InDetConditions::SCT_SIDE)) { + continue; } - int nlinks[N_REGIONS+1]{0, 0, 0, 0}; - SCT_ID::const_id_iterator planeIterator{m_pSCTHelper->wafer_begin()}; - SCT_ID::const_id_iterator planeEnd{m_pSCTHelper->wafer_end()}; - for (; planeIterator not_eq planeEnd; ++planeIterator) { - Identifier planeId{*planeIterator}; - const int bec{m_pSCTHelper->barrel_ec(planeId)}; - const unsigned int systemIndex{bec2Index(bec)}; - // Don't initialize a value for disabled modules - if (not m_ConfigurationTool->isGood(*planeIterator, InDetConditions::SCT_SIDE)) { - continue; - } - if (m_events_lb > 0) { - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - m_occ_lb[jReg][m_current_lb] += (1E5) * m_occSumUnbiased_lb[jReg][*planeIterator] / m_events_lb; - m_hitocc_lb[jReg][m_current_lb] += (1E5) * m_hitoccSumUnbiased_lb[jReg][*planeIterator] / m_events_lb; - } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - if ((1E5) * m_occSumUnbiased_lb[GENERAL_INDEX][*planeIterator] / m_events_lb > s_thresholds[iThre]) { - m_noisyM[iThre][m_current_lb]++; - } - if ((1E5) * m_hitoccSumUnbiased_lb[GENERAL_INDEX][*planeIterator] / m_events_lb > s_thresholds[iThre]) { - m_noisyMWithHO[iThre][m_current_lb]++; - } - } + if (m_events_lb > 0) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { + m_occ_lb[jReg][m_current_lb] += (1E5) * m_occSumUnbiased_lb[jReg][*planeIterator] / m_events_lb; + m_hitocc_lb[jReg][m_current_lb] += (1E5) * m_hitoccSumUnbiased_lb[jReg][*planeIterator] / m_events_lb; } - if (m_eventsTrigger_lb > 0) { - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - m_occTrigger_lb[jReg][m_current_lb] += (1E5) * m_occSumUnbiasedTrigger_lb[jReg][*planeIterator] / m_eventsTrigger_lb; - m_hitoccTrigger_lb[jReg][m_current_lb] += (1E5) * m_hitoccSumUnbiasedTrigger_lb[jReg][*planeIterator] / m_eventsTrigger_lb; - } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - if ((1E5) * m_occSumUnbiasedTrigger_lb[GENERAL_INDEX][*planeIterator] / m_eventsTrigger_lb > s_thresholds[iThre]) { - m_noisyMTrigger[iThre][m_current_lb]++; - } - if ((1E5) * m_hitoccSumUnbiasedTrigger_lb[GENERAL_INDEX][*planeIterator] / m_eventsTrigger_lb > s_thresholds[iThre]) { - m_noisyMWithHOTrigger[iThre][m_current_lb]++; - } - } - } - nlinks[systemIndex]++; - nlinks[GENERAL_INDEX]++; } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - if (nlinks[jReg]>0) { - m_occ_lb[jReg][m_current_lb] /= nlinks[jReg]; - m_occTrigger_lb[jReg][m_current_lb] /= nlinks[jReg]; - m_hitocc_lb[jReg][m_current_lb] /= nlinks[jReg]; - m_hitoccTrigger_lb[jReg][m_current_lb] /= nlinks[jReg]; + if (m_eventsTrigger_lb > 0) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { + m_occTrigger_lb[jReg][m_current_lb] += (1E5) * m_occSumUnbiasedTrigger_lb[jReg][*planeIterator] / m_eventsTrigger_lb; + m_hitoccTrigger_lb[jReg][m_current_lb] += (1E5) * m_hitoccSumUnbiasedTrigger_lb[jReg][*planeIterator] / m_eventsTrigger_lb; } } + nlinks[systemIndex]++; + nlinks[GENERAL_INDEX]++; + } + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { + if (nlinks[jReg]>0) { + m_occ_lb[jReg][m_current_lb] /= nlinks[jReg]; + m_occTrigger_lb[jReg][m_current_lb] /= nlinks[jReg]; + m_hitocc_lb[jReg][m_current_lb] /= nlinks[jReg]; + m_hitoccTrigger_lb[jReg][m_current_lb] /= nlinks[jReg]; + } } + } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - m_NO_vsLB[jReg]->Reset(); - m_NOTrigger_vsLB[jReg]->Reset(); - m_HO_vsLB[jReg]->Reset(); - m_HOTrigger_vsLB[jReg]->Reset(); - } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - m_NoisyModules_vsLB[iThre]->Reset(); - m_NoisyModulesTrigger_vsLB[iThre]->Reset(); - m_NoisyModulesWithHO_vsLB[iThre]->Reset(); - m_NoisyModulesWithHOTrigger_vsLB[iThre]->Reset(); - } - // - for (int bin{1}; bin <= NBINS_LBs; bin++) { - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - if (m_occ_lb[jReg][bin] != 0) { - m_NO_vsLB[jReg]->Fill(bin, m_occ_lb[jReg][bin]); - } - if (m_occTrigger_lb[jReg][bin] != 0) { - m_NOTrigger_vsLB[jReg]->Fill(bin, m_occTrigger_lb[jReg][bin]); - } + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { + m_NO_vsLB[jReg]->Reset(); + m_NOTrigger_vsLB[jReg]->Reset(); + m_HO_vsLB[jReg]->Reset(); + m_HOTrigger_vsLB[jReg]->Reset(); + } + for (int bin{1}; bin <= NBINS_LBs; bin++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { + if (m_occ_lb[jReg][bin] != 0) { + m_NO_vsLB[jReg]->Fill(bin, m_occ_lb[jReg][bin]); } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - if (m_noisyM[iThre][bin] != 0) { - m_NoisyModules_vsLB[iThre]->Fill(bin, m_noisyM[iThre][bin]); - } - if (m_noisyMTrigger[iThre][bin] != 0) { - m_NoisyModulesTrigger_vsLB[iThre]->Fill(bin, m_noisyMTrigger[iThre][bin]); - } + if (m_occTrigger_lb[jReg][bin] != 0) { + m_NOTrigger_vsLB[jReg]->Fill(bin, m_occTrigger_lb[jReg][bin]); } } - for (int bin{1}; bin <= NBINS_LBs; bin++) { - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - if (m_hitocc_lb[jReg][bin] != 0) { - m_HO_vsLB[jReg]->Fill(bin, m_hitocc_lb[jReg][bin]); - } - if (m_hitoccTrigger_lb[jReg][bin] != 0) { - m_HOTrigger_vsLB[jReg]->Fill(bin, m_hitoccTrigger_lb[jReg][bin]); - } + } + for (int bin{1}; bin <= NBINS_LBs; bin++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { + if (m_hitocc_lb[jReg][bin] != 0) { + m_HO_vsLB[jReg]->Fill(bin, m_hitocc_lb[jReg][bin]); } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - if (m_noisyMWithHO[iThre][bin] != 0) { - m_NoisyModulesWithHO_vsLB[iThre]->Fill(bin, m_noisyMWithHO[iThre][bin]); - } - if (m_noisyMWithHOTrigger[iThre][bin] != 0) { - m_NoisyModulesWithHOTrigger_vsLB[iThre]->Fill(bin, m_noisyMWithHOTrigger[iThre][bin]); - } + if (m_hitoccTrigger_lb[jReg][bin] != 0) { + m_HOTrigger_vsLB[jReg]->Fill(bin, m_hitoccTrigger_lb[jReg][bin]); } } } @@ -1509,14 +1079,14 @@ SCTHitsNoiseMonTool::initializeNoiseMaps() { m_occSumUnbiased[*planeIterator] = 0.; m_occSumUnbiasedTrigger[*planeIterator] = 0.; m_occSumUnbiasedRecent[*planeIterator] = 0.; - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { m_occSumUnbiased_lb[jReg][*planeIterator] = 0.; m_occSumUnbiasedTrigger_lb[jReg][*planeIterator] = 0.; } m_hitoccSumUnbiased[*planeIterator] = 0.; m_hitoccSumUnbiasedTrigger[*planeIterator] = 0.; m_hitoccSumUnbiasedRecent[*planeIterator] = 0.; - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { + for (unsigned int jReg{0}; jReg<N_REGIONS_INC_GENERAL; jReg++) { m_hitoccSumUnbiased_lb[jReg][*planeIterator] = 0.; m_hitoccSumUnbiasedTrigger_lb[jReg][*planeIterator] = 0.; } @@ -1534,18 +1104,12 @@ SCTHitsNoiseMonTool::initializeNoiseMaps() { StatusCode SCTHitsNoiseMonTool::resetNoiseMapHists() { for (unsigned int iReg{0}; iReg<N_REGIONS; iReg++) { - if (resetVecProf2(m_pnoiseoccupancymapHistoVector[iReg]).isFailure()) { - ATH_MSG_WARNING("Failed to reset m_pnoiseoccupancymapHistoVector[" << iReg << "]!"); - } if (resetVecProf2(m_pnoiseoccupancymapHistoVectorTrigger[iReg]).isFailure()) { ATH_MSG_WARNING("Failed to reset m_pnoiseoccupancymapHistoVectorTrigger[" << iReg << "]!"); } if (resetVecProf2(m_phitoccupancymapHistoVector[iReg]).isFailure()) { ATH_MSG_WARNING("Failed to reset m_phitoccupancymapHistoVector[" << iReg << "]!"); } - if (resetVecProf2(m_phitoccupancymapHistoVectorTrigger[iReg]).isFailure()) { - ATH_MSG_WARNING("Failed to reset m_phitoccupancymapHistoVectorTrigger[" << iReg << "]!"); - } if (m_environment == AthenaMonManager::online) { if (resetVecProf2(m_pnoiseoccupancymapHistoVectorRecent[iReg]).isFailure()) { ATH_MSG_WARNING("Failed to reset m_pnoiseoccupancymapHistoVectorRecent[" << iReg << "]!"); @@ -1556,13 +1120,6 @@ SCTHitsNoiseMonTool::resetNoiseMapHists() { } } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - m_NO[jReg]->Reset(); - m_NOTrigger[jReg]->Reset(); - m_HO[jReg]->Reset(); - m_HOTrigger[jReg]->Reset(); - } - return StatusCode::SUCCESS; } @@ -1596,16 +1153,9 @@ SCTHitsNoiseMonTool::resetHitMapHists() { if (resetVecH2(m_ptrackhitsHistoVectorRecent[iReg]).isFailure()) { ATH_MSG_WARNING("Failed to reset m_ptrackhitsHistoVectorRecent[" << iReg << "]!"); } - if (resetVecH1(m_tbinHistoVectorRecent[iReg]).isFailure()) { - ATH_MSG_WARNING("Failed to reset m_tbinHistoVectorRecent!"); - } if (resetVecH2(m_phitsHistoVectorRecent[iReg]).isFailure()) { ATH_MSG_WARNING("Failed to reset m_phitsHistoVectorRecent[" << iReg << "]!"); } - if (resetVecH1(m_clusizeHistoVectorRecent[iReg]).isFailure()) { - ATH_MSG_WARNING("Failed to reset m_clusizeHistoVectorRecent[" << iReg << "]!"); - } - m_tbinHistoRecent[iReg]->Reset(); } m_clusizeRecent->Reset(); } @@ -1647,23 +1197,6 @@ SCTHitsNoiseMonTool::resetVecH2(vector<TH2F_LW*>& hists) const { return StatusCode::SUCCESS; } -// ==================================================================================================== -// SCTHitsNoiseMonTool :: resetVecH1 -// DD 23/07/2011 -// Resets entries for all histograms in a vector of TH1s -// -// ==================================================================================================== -StatusCode -SCTHitsNoiseMonTool::resetVecH1(vector<TH1F_LW*>& hists) const { - for (unsigned int i{0}; i < hists.size(); ++i) { - if (hists[i]==nullptr) { - continue; - } - hists[i]->Reset(); - } - return StatusCode::SUCCESS; -} - // ==================================================================================================== // SCTHitsNoiseMonTool :: book1DNoiseHists // Book noise occupancy histograms for all present SCT modules @@ -1674,47 +1207,8 @@ SCTHitsNoiseMonTool::resetVecH1(vector<TH1F_LW*>& hists) const { // ==================================================================================================== StatusCode SCTHitsNoiseMonTool::bookNoiseDistributions() { - static const int bins{8000}; - static const double xmin{1e-1}; - static const double xmax{20000}; - static const double logxmin{log10(xmin)}; - static const double logxmax{log10(xmax)}; - static const double binwidth{(logxmax - logxmin) / bins}; - static const string histNames[N_REGIONS+1]{"ECC", "barrel", "ECA", "SCT"}; - static const string histTitles[N_REGIONS+1]{"EndCap C", "Barrel", "EndCap A", "SCT"}; - if (newRunFlag()) { MonGroup NoiseDistributions{this, "SCT/GENERAL/noise", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}; - double xbins[bins + 1]; - xbins[0] = xmin; - if (m_doLogXNoise) { - for (int i{1}; i <= bins; ++i) { - xbins[i] = xmin + TMath::Power(10, logxmin + i * binwidth); - } - } - - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - m_NO[jReg] = new TH1F((histNames[jReg]+"NOdistribution").c_str(), ("NO Distribution for the "+histTitles[jReg]).c_str(), bins, xmin, xmax); - m_NO[jReg]->GetXaxis()->SetTitle("Noise Occupancy [10^{-5}]"); - m_NO[jReg]->GetYaxis()->SetTitle("Modules"); - if (m_doLogXNoise) { - m_NO[jReg]->SetBins(bins, xbins); - } - if (NoiseDistributions.regHist(m_NO[jReg]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NO[jReg]->GetName()); - } - - string NO_title{"NO Distribution for the " + histTitles[jReg] + " for " + m_NOTriggerItem + " trigger"}; - m_NOTrigger[jReg] = new TH1F((histNames[jReg]+"NOdistributionTrigger").c_str(), NO_title.c_str(), bins, xmin, xmax); - m_NOTrigger[jReg]->GetXaxis()->SetTitle("Noise Occupancy [10^{-5}]"); - m_NOTrigger[jReg]->GetYaxis()->SetTitle("Modules"); - if (m_doLogXNoise) { - m_NOTrigger[jReg]->SetBins(bins, xbins); - } - if (NoiseDistributions.regHist(m_NOTrigger[jReg]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NOTrigger[jReg]->GetName()); - } - } m_NO_vsLB[GENERAL_INDEX] = TProfile_LW::create("NO_vsLB", "NO vs LB for all region (SP noise)", NBINS_LBs, 0.5, NBINS_LBs + 0.5); m_NO_vsLB[GENERAL_INDEX]->GetXaxis()->SetTitle("LumiBlock"); @@ -1723,26 +1217,6 @@ SCTHitsNoiseMonTool::bookNoiseDistributions() { ATH_MSG_WARNING("Couldn't book SCTNO_vsLB"); } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - m_NoisyModulesTrigger_vsLB[iThre] = TProfile_LW::create(("NoisyModulesTrigger"+s_thresholdNames[iThre]+"_vsLB").c_str(), - ("NoisyModules"+s_thresholdNames[iThre]+" with trigger vs LB for all region (SP noise)").c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NoisyModulesTrigger_vsLB[iThre]->GetXaxis()->SetTitle("LumiBlock"); - m_NoisyModulesTrigger_vsLB[iThre]->GetYaxis()->SetTitle("Noisy Modules"); - if (NoiseDistributions.regHist(m_NoisyModulesTrigger_vsLB[iThre]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NoisyModulesTrigger_vsLB[iThre]->GetName()); - } - - m_NoisyModules_vsLB[iThre] = TProfile_LW::create(("NoisyModules"+s_thresholdNames[iThre]+"_vsLB").c_str(), - ("NoisyModules"+s_thresholdNames[iThre]+" vs LB for all region (SP noise)").c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NoisyModules_vsLB[iThre]->GetXaxis()->SetTitle("LumiBlock"); - m_NoisyModules_vsLB[iThre]->GetYaxis()->SetTitle("Noisy Modules"); - if (NoiseDistributions.regHist(m_NoisyModules_vsLB[iThre]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NoisyModules_vsLB[iThre]->GetName()); - } - } - m_NOTrigger_vsLB[GENERAL_INDEX] = TProfile_LW::create("NOTrigger_vsLB", "NO with trigger vs LB for all region (SP noise)", NBINS_LBs, 0.5, NBINS_LBs + 0.5); m_NOTrigger_vsLB[GENERAL_INDEX]->GetXaxis()->SetTitle("LumiBlock"); @@ -1751,33 +1225,6 @@ SCTHitsNoiseMonTool::bookNoiseDistributions() { ATH_MSG_WARNING("Couldn't book SCTNOTrigger_vsLB"); } - for (unsigned int jReg{0}; jReg<N_REGIONS+1; jReg++) { - m_HO[jReg] = new TH1F((histNames[jReg]+"HOdistribution").c_str(), - ("HO Distribution for the "+histTitles[jReg]).c_str(), - bins, xmin, xmax); - m_HO[jReg]->GetXaxis()->SetTitle("Hit Occupancy [10^{-5}]"); - m_HO[jReg]->GetYaxis()->SetTitle("Modules"); - if (m_doLogXNoise) { - m_HO[jReg]->SetBins(bins, xbins); - } - if (NoiseDistributions.regHist(m_HO[jReg]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_HO[jReg]->GetName()); - } - - string HO_title{"HO Distribution for the "+histTitles[jReg]+" for " + m_NOTriggerItem + " trigger"}; - m_HOTrigger[jReg] = new TH1F((histNames[jReg]+"HOdistributionTrigger").c_str(), - HO_title.c_str(), - bins, xmin, xmax); - m_HOTrigger[jReg]->GetXaxis()->SetTitle("Hit Occupancy [10^{-5}]"); - m_HOTrigger[jReg]->GetYaxis()->SetTitle("Modules"); - if (m_doLogXNoise) { - m_HOTrigger[jReg]->SetBins(bins, xbins); - } - if (NoiseDistributions.regHist(m_HOTrigger[jReg]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_HOTrigger[jReg]->GetName()); - } - } - m_HO_vsLB[GENERAL_INDEX] = TProfile_LW::create("HO_vsLB", "HO vs LB for all region (SP noise)", NBINS_LBs, 0.5, NBINS_LBs + 0.5); m_HO_vsLB[GENERAL_INDEX]->GetXaxis()->SetTitle("LumiBlock"); @@ -1786,17 +1233,6 @@ SCTHitsNoiseMonTool::bookNoiseDistributions() { ATH_MSG_WARNING("Couldn't book " << m_HO_vsLB[GENERAL_INDEX]->GetName()); } - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - m_NoisyModulesWithHOTrigger_vsLB[iThre] = TProfile_LW::create(("NoisyModulesWithHOTrigger"+s_thresholdNames[iThre]+"_vsLB").c_str(), - ("NoisyModules"+s_thresholdNames[iThre]+" with HO with trigger vs LB for all region with threshold "+s_thresholdNames[iThre]).c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NoisyModulesWithHOTrigger_vsLB[iThre]->GetXaxis()->SetTitle("LumiBlock"); - m_NoisyModulesWithHOTrigger_vsLB[iThre]->GetYaxis()->SetTitle("Noisy Modules with HO"); - if (NoiseDistributions.regHist(m_NoisyModulesWithHOTrigger_vsLB[iThre]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NoisyModulesWithHOTrigger_vsLB[iThre]->GetName()); - } - } - m_HOTrigger_vsLB[GENERAL_INDEX] = TProfile_LW::create("HOTrigger_vsLB", "HO with trigger vs LB for all region (SP noise)", NBINS_LBs, 0.5, NBINS_LBs + 0.5); m_HOTrigger_vsLB[GENERAL_INDEX]->GetXaxis()->SetTitle("LumiBlock"); @@ -1804,122 +1240,10 @@ SCTHitsNoiseMonTool::bookNoiseDistributions() { if (NoiseDistributions.regHist(m_HOTrigger_vsLB[GENERAL_INDEX]).isFailure()) { ATH_MSG_WARNING("Couldn't book " << m_HOTrigger_vsLB[GENERAL_INDEX]->GetName()); } - - for (unsigned int iThre{0}; iThre<nThreshes; iThre++) { - m_NoisyModulesWithHO_vsLB[iThre] = TProfile_LW::create(("NoisyModulesWithHO"+s_thresholdNames[iThre]+"_vsLB").c_str(), - ("NoisyModulesWithHO vs LB for all region with threshold "+s_thresholdNames[iThre]).c_str(), - NBINS_LBs, 0.5, NBINS_LBs + 0.5); - m_NoisyModulesWithHO_vsLB[iThre]->GetXaxis()->SetTitle("LumiBlock"); - m_NoisyModulesWithHO_vsLB[iThre]->GetYaxis()->SetTitle("Noisy Modules with HO"); - if (NoiseDistributions.regHist(m_NoisyModulesWithHO_vsLB[iThre]).isFailure()) { - ATH_MSG_WARNING("Couldn't book " << m_NoisyModulesWithHO_vsLB[iThre]->GetName()); - } - } - } - return StatusCode::SUCCESS; -} - -// ==================================================================================================== -// SCTHitsNoiseMonTool :: bookSPvsEventNumber -// Book 1D histogram of number of spacepoints vs event number -// ==================================================================================================== -StatusCode -SCTHitsNoiseMonTool::bookSPvsEventNumber() { - if (newRunFlag()) { - MonGroup BarrelSPHist{this, "SCT/GENERAL/hits", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}; - // Book a histogram - m_nSP = th1Factory("sct_sp_vs_en", "Number of Spacepoints vs Event Number", BarrelSPHist, 1, m_evtsbins + 1, - m_evtsbins); - m_nSP->GetXaxis()->SetTitle("Event Number"); - m_nSP->GetYaxis()->SetTitle("Num of Spacepoints"); - m_nSP_buf.reserve(m_evtsbins); - m_nSP_pos = 0; - - m_nHits = th1Factory("sct_av_hits_vs_en", "Number of Average Hits vs Event Number", BarrelSPHist, 1, m_evtsbins + 1, - m_evtsbins); - m_nHits->GetXaxis()->SetTitle("Event Number"); - m_nHits->GetYaxis()->SetTitle("Num of Average Hits"); - m_nHits_buf.reserve(m_evtsbins); - m_nHits_pos = 0; - - m_nmaxHits = th1Factory("sct_max_hits_vs_en", "Max Number of Hits vs Event Number", BarrelSPHist, 1, m_evtsbins + 1, - m_evtsbins); - m_nmaxHits->GetXaxis()->SetTitle("Event Number"); - m_nmaxHits->GetYaxis()->SetTitle("Num of Max Hits"); - m_nmaxHits_buf.reserve(m_evtsbins); - m_nmaxModule_buf.reserve(m_evtsbins); - - m_nminHits = th1Factory("sct_min_hits_vs_en", "Min Number of Hits vs Event Number", BarrelSPHist, 1, m_evtsbins + 1, - m_evtsbins); - m_nminHits->GetXaxis()->SetTitle("Event Number"); - m_nminHits->GetYaxis()->SetTitle("Num of Min Hits"); - m_nminHits_buf.reserve(m_evtsbins); - m_nminModule_buf.reserve(m_evtsbins); } return StatusCode::SUCCESS; } -// ==================================================================================================== -// SCTHitsNoiseMonTool :: makeSPvsEventNumber -// ==================================================================================================== -StatusCode -SCTHitsNoiseMonTool::makeSPvsEventNumber() { - // Retrieve the spacepoint collection - SG::ReadHandle<SpacePointContainer> SCT_spcontainer{m_SCTSPContainerName}; - - // get space points for SCT from TDS - if (not SCT_spcontainer.isValid()) { - ATH_MSG_WARNING("Si SpacePoint container for SCT not found"); - return StatusCode::FAILURE; - } - int sct_nspacepoints{0}; - // loop over SCT space points collections - for (const SpacePointCollection* colNext: *SCT_spcontainer) { - if (colNext==nullptr) { - continue; - } - // Identify the spacepoint collection and gets its barrel_ec to update the num SP histogram - int thisBec{m_pSCTHelper->barrel_ec(colNext->identify())}; - int thisLayerDisk{m_pSCTHelper->layer_disk(colNext->identify())}; - m_numSPPerLumiBlock[bec2Index(thisBec)]->Fill(thisLayerDisk, colNext->size()); - sct_nspacepoints += static_cast<int>(colNext->size()); - } - - if (m_environment == AthenaMonManager::online) { - // Time Dependent SP plots only online - m_nSP_buf[m_nSP_pos] = sct_nspacepoints; - m_nSP_pos++; - if (m_nSP_pos == m_evtsbins) { - m_nSP_pos = 0; - } - if (m_numberOfEvents % m_checkrate == 0) { - m_nSP->Reset(); - int latest_nSP_pos{m_nSP_pos}; - for (int i{1}; i < m_evtsbins; i++) { - if (latest_nSP_pos == m_evtsbins) { - latest_nSP_pos = 0; - } - if (m_numberOfEvents < m_evtsbins) { - if (i < m_nSP_pos) { - m_nSP->SetBinContent(i, m_nSP_buf[i]); - } else { - m_nSP->SetBinContent(i, 0); - } - } else { - m_nSP->SetBinContent(i, m_nSP_buf[latest_nSP_pos]); - m_nSP->GetXaxis()->Set(m_evtsbins, m_numberOfEvents - m_evtsbins, m_numberOfEvents); - } - latest_nSP_pos++; - if (latest_nSP_pos == m_evtsbins) { - latest_nSP_pos = 0; - } - } - } - } - - return StatusCode::SUCCESS; -} - string SCTHitsNoiseMonTool::positionString(const Identifier& plane) const { ostringstream position_txt; @@ -1987,7 +1311,6 @@ SCTHitsNoiseMonTool::makeVectorOfTrackRDOIdentifiers() { return StatusCode::SUCCESS; } -// StatusCode SCTHitsNoiseMonTool::bookGeneralTrackHits(bool isNewRun, const unsigned int systemIndex) { StatusCode SCTHitsNoiseMonTool::bookGeneralTrackHits(const unsigned int systemIndex) { static const string paths[N_REGIONS] = { @@ -2003,7 +1326,6 @@ SCTHitsNoiseMonTool::bookGeneralTrackHits(const unsigned int systemIndex) { ATH_MSG_FATAL("Invalid subsystem index, should be 0-2, was " << systemIndex); return StatusCode::FAILURE; } - string stem{m_stream + "/" + paths[systemIndex] + "mapsOfHitsOnTracks"}; MonGroup tracksMon{this, paths[systemIndex] + "mapsOfHitsOnTracks", run, ATTRIB_UNMANAGED}; if (newRunFlag()) { m_ptrackhitsHistoVector[systemIndex].clear(); @@ -2015,7 +1337,6 @@ SCTHitsNoiseMonTool::bookGeneralTrackHits(const unsigned int systemIndex) { "trackhitsmap_" + layerSide.name()}; const string streamhitmaprecent{"mapsOfHitsOnTracksRecent" + abbreviations[systemIndex] + streamDelimiter + "trackhitsmap_" + layerSide.name()}; - string histoName{stem + streamhitmap}; string histotitle{"SCT hits on tracks for " + names[systemIndex] + " " + layerSide.title()}; string histotitlerecent{"SCT hits on tracks from recent events for " + names[systemIndex] + " " + layerSide.title()}; @@ -2029,102 +1350,10 @@ SCTHitsNoiseMonTool::bookGeneralTrackHits(const unsigned int systemIndex) { } StatusCode -SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos(const unsigned int systemIndex) { - static const string path[N_REGIONS] = { - "SCT/SCTEC/tbin/tracks/", "SCT/SCTB/tbin/tracks/", "SCT/SCTEA/tbin/tracks/" - }; - static const unsigned int limits[N_REGIONS] = { - N_DISKS, N_BARRELS, N_DISKS - }; - static const unsigned int nBins{8}; - static const string tbinsNames[nBins] = { - "000", "001", "010", "011", "100", "101", "110", "111" - }; - static const string disksidenameEC[N_DISKSx2] = { - "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", "8_0", "8_1" - }; - static const string layersidenameB[N_BARRELSx2] = { - "0_0", "0_1", "1_0", "1_1", "2_0", "2_1", "3_0", "3_1" - }; - +SCTHitsNoiseMonTool::bookGeneralTrackTimeHistos() { if (newRunFlag()) { - // - vector<TH1F_LW*>& tbinHistoVector{m_tbinHistoVector[systemIndex]}; - vector<TH1F_LW*>& tbinHistoVectorRecent{m_tbinHistoVectorRecent[systemIndex]}; - tbinHistoVector.clear(); - tbinHistoVectorRecent.clear(); - MonGroup timeGroup{this, path[systemIndex], run, ATTRIB_UNMANAGED}; MonGroup tbinGroup{this, "SCT/GENERAL/tbin", ManagedMonitorToolBase::run, ATTRIB_UNMANAGED}; - string stem{m_stream + pathDelimiter + path[systemIndex]}; - string histoName{"TrackTimeBin" + abbreviations[systemIndex]}; - string histoTitle{"RDO Track TimeBin for " + names[systemIndex]}; - string histoNameRecent{"TrackTimeBinRecent" + abbreviations[systemIndex]}; - string histoTitleRecent{"RDO Track TimeBin from recent events for " + names[systemIndex]}; m_tbinfracall = profFactory("TBinFracAll", "fraction of 01X for each region", tbinGroup); - - m_tbinHisto[systemIndex] = h1Factory(histoName, histoTitle, timeGroup, -0.5, 7.5, nBins); - - if (systemIndex==ENDCAP_C_INDEX) { - for (int i{0}; i < N_DISKSx2; i++) { - string nameECmfrac{"TBinFracEC_" + disksidenameEC[i]}; - string titleECmfrac{"fraction of 01X in EndcapC" + disksidenameEC[i]}; - m_tbinfrac[systemIndex][i] = prof2DFactory(nameECmfrac, titleECmfrac, timeGroup, 3, -0.5, 2.5, 52, -0.5, 51.5); - } - m_tbinfracVsLB[systemIndex] = profFactory("TBinFrac01XVsLBEC", "fraction of 01X vs LumiBlock in EndcapC", timeGroup, 2000, 0, 2000); - } else if (systemIndex==BARREL_INDEX) { - for (int i{0}; i < N_BARRELSx2; i++) { - string nameBfrac{"TBinFrac_" + layersidenameB[i]}; - string titleBfrac{"fraction of 01X in Barrel" + layersidenameB[i]}; - m_tbinfrac[systemIndex][i] = prof2DFactory(nameBfrac, titleBfrac, timeGroup, 13, -6.5, 6.5, 56, -0.5, 55.5); - } - m_tbinfracVsLB[systemIndex] = profFactory("TBinFrac01XVsLB", "fraction of 01X vs LumiBlock in Barrel", timeGroup, 2000, 0, 2000); - } else if (systemIndex==ENDCAP_A_INDEX) { - for (int i{0}; i < N_ENDCAPSx2; i++) { - string nameECpfrac{"TBinFracEA_" + disksidenameEC[i]}; - string titleECpfrac{"fraction of 01X in EndcapA" + disksidenameEC[i]}; - m_tbinfrac[systemIndex][i] = prof2DFactory(nameECpfrac, titleECpfrac, timeGroup, 3, -0.5, 2.5, 52, -0.5, 51.5); - } - m_tbinfracVsLB[systemIndex] = profFactory("TBinFrac01XVsLBEA", "fraction of 01X vs LumiBlock in EndcapA", timeGroup, 2000, 0, 2000); - } - - for (unsigned int bin{0}; bin < nBins; bin++) { - m_tbinHisto[systemIndex]->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str()); - } - m_tbinHisto[systemIndex]->GetXaxis()->SetTitle("TimeBin"); - if (m_environment == AthenaMonManager::online) { - m_tbinHistoRecent[systemIndex] = h1Factory(histoNameRecent, histoTitleRecent, timeGroup, -0.5, 7.5, nBins); - m_tbinHistoRecent[systemIndex]->GetXaxis()->SetTitle("TimeBin"); - for (unsigned int bin{0}; bin < nBins; bin++) { - m_tbinHistoRecent[systemIndex]->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str()); - } - } - - for (unsigned int i{0}; i < limits[systemIndex]; ++i) { - const string streamlayer{to_string(i)}; - const string streamhitmap{"TrackTimeBin" + abbreviations[systemIndex] + streamDelimiter + streamlayer}; - const string streamhitmaprecent{"TrackTimeBinRecent" + abbreviations[systemIndex] + streamDelimiter + streamlayer}; - histoName = stem + streamhitmap; - histoNameRecent = stem + streamhitmaprecent; - histoTitle = "RDO Track TimeBin: layer " + streamlayer; - histoTitleRecent = "RDO Track TimeBin form recent events: layer " + streamlayer; - if (systemIndex != BARREL_INDEX) { - histoTitle = "RDO Track TimeBin: disk " + streamlayer; - histoTitleRecent = "RDO Track TimeBin form recent events: disk " + streamlayer; - } - h1Factory(streamhitmap, histoTitle, timeGroup, m_tbinHistoVector[systemIndex], -0.5, 7.5, nBins); - for (unsigned int bin{0}; bin < nBins; bin++) { - tbinHistoVector[i]->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str()); - } - tbinHistoVector[i]->GetXaxis()->SetTitle("TimeBin"); - if (m_environment == AthenaMonManager::online) { - h1Factory(streamhitmaprecent, histoTitleRecent, timeGroup, m_tbinHistoVectorRecent[systemIndex], -0.5, 7.5, nBins); - for (unsigned int bin{0}; bin < nBins; bin++) { - tbinHistoVectorRecent[i]->GetXaxis()->SetBinLabel(bin + 1, tbinsNames[bin].c_str()); - } - tbinHistoVectorRecent[i]->GetXaxis()->SetTitle("TimeBin"); - } - } } return StatusCode::SUCCESS; } @@ -2154,20 +1383,6 @@ SCTHitsNoiseMonTool::h2Factory(const string& name, const string& title, const Be return success ? tmp : nullptr; } -TH2I_LW* -SCTHitsNoiseMonTool::h2IFactory(const string& name, const string& title, MonGroup& registry, int nbinx, - float xlo, float xhi, int nbiny, float ylo, float yhi) const { - TH2I_LW* tmp{TH2I_LW::create(name.c_str(), title.c_str(), nbinx, xlo, xhi, nbiny, ylo, yhi)}; - - tmp->SetXTitle("module #"); - tmp->SetYTitle("Time bin"); - bool success{registry.regHist(tmp).isSuccess()}; - if (not success) { - ATH_MSG_WARNING("Cannot book SCT histogram: " << name); - } - return success ? tmp : nullptr; -} - TProfile2D* SCTHitsNoiseMonTool::prof2DFactory(const string& name, const string& title, MonGroup& registry, int nbinx, float xlo, float xhi, int nbiny, float ylo, float yhi) const { @@ -2182,20 +1397,6 @@ SCTHitsNoiseMonTool::prof2DFactory(const string& name, const string& title, MonG return success ? tmp : nullptr; } -TProfile_LW* -SCTHitsNoiseMonTool::profFactory(const string& name, const string& title, MonGroup& registry, int nbin, - float lo, float hi) const { - TProfile_LW* tmp{TProfile_LW::create(name.c_str(), title.c_str(), nbin, lo, hi)}; - - tmp->SetXTitle("LumiBlock"); - tmp->SetYTitle("Fraction of 01X"); - bool success{registry.regHist(tmp).isSuccess()}; - if (not success) { - ATH_MSG_WARNING("Cannot book SCT histogram: " << name); - } - return success ? tmp : nullptr; -} - TProfile_LW* SCTHitsNoiseMonTool::profFactory(const string& name, const string& title, MonGroup& registry) const { TProfile_LW* tmp{TProfile_LW::create(name.c_str(), title.c_str(), 3, 0, 3)}; @@ -2260,28 +1461,3 @@ SCTHitsNoiseMonTool::h1Factory(const string& name, const string& title, MonGroup storageVector.push_back(tmp); return success ? tmp : nullptr; } - -TH1F* -SCTHitsNoiseMonTool::th1Factory(const string& name, const string& title, MonGroup& registry, const float lo, - const float hi, const unsigned int nbins) const { - TH1F* tmp{new TH1F{name.c_str(), title.c_str(), static_cast<int>(nbins), lo, hi}}; - bool success{registry.regHist(tmp).isSuccess()}; - - if (not success) { - ATH_MSG_WARNING("Cannot book SCT histogram: " << name); - } - return success ? tmp : nullptr; -} - -TH1F* -SCTHitsNoiseMonTool::th1Factory(const string& name, const string& title, MonGroup& registry, - vector<TH1F*>& storageVector, const float lo, const float hi, const unsigned int nbins) const { - TH1F* tmp{new TH1F{name.c_str(), title.c_str(), static_cast<int>(nbins), lo, hi}}; - bool success{registry.regHist(tmp).isSuccess()}; - - if (not success) { - ATH_MSG_WARNING("Cannot book SCT histogram: " << name); - } - storageVector.push_back(tmp); - return success ? tmp : nullptr; -} diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.h b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.h index 3c6c521dd69cb39bb152777b39f0b2bbd6dd658f..c1244dc4360ef8f70b2edf376a1236309c89b709 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.h +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.h @@ -31,7 +31,6 @@ #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadHandleKey.h" #include "TrkSpacePoint/SpacePointContainer.h" -#include "TrkTrack/Track.h" #include "TrkTrack/TrackCollection.h" #include "GaudiKernel/ToolHandle.h" @@ -44,17 +43,13 @@ class ISCT_ConfigurationConditionsTool; class SCT_ID; -class TH1F; -class TH2F; -class TH1I; -class TH2I; class TH1F_LW; class TH2F_LW; -class TH2I_LW; -class TProfile; -class TProfile2D; class TProfile_LW; +class TH1F; +class TProfile2D; + class SCTHitsNoiseMonTool : public ManagedMonitorToolBase { public: SCTHitsNoiseMonTool(const std::string& type, const std::string& name,const IInterface* parent); @@ -74,93 +69,26 @@ class SCTHitsNoiseMonTool : public ManagedMonitorToolBase { //@} private: - enum Thresholds {thresh100, thresh1000, thresh10000, nThreshes}; - static const double s_thresholds[nThreshes]; - static const std::string s_thresholdNames[nThreshes]; - static constexpr int s_commonSize{std::max(SCT_Monitoring::N_BARRELSx2, SCT_Monitoring::N_DISKSx2)}; - /// stream stem for the ROOT histograms - std::string m_stream{"/stat"}; - - int m_current_lb{0}; - int m_last_reset_lb{0}; - //Count number of events - int m_numberOfEvents{0}; - //Count number of events in the selected stream - int m_numberOfEventsTrigger{0}; - //Count number of events since last reset - int m_numberOfEventsRecent{0}; - //CAM adds skip events counter - int m_skipEvents{0}; - - int m_noisyM[nThreshes][SCT_Monitoring::NBINS_LBs+1]{}; - int m_occ_lb[SCT_Monitoring::N_REGIONS+1][SCT_Monitoring::NBINS_LBs+1]{}; - int m_events_lb{0}; - int m_noisyMTrigger[nThreshes][SCT_Monitoring::NBINS_LBs+1]{}; - int m_occTrigger_lb[SCT_Monitoring::N_REGIONS+1][SCT_Monitoring::NBINS_LBs+1]{}; - int m_eventsTrigger_lb{0}; - - int m_noisyMWithHO[nThreshes][SCT_Monitoring::NBINS_LBs+1]{}; - int m_hitocc_lb[SCT_Monitoring::N_REGIONS+1][SCT_Monitoring::NBINS_LBs+1]{}; - int m_noisyMWithHOTrigger[nThreshes][SCT_Monitoring::NBINS_LBs+1]{}; - int m_hitoccTrigger_lb[SCT_Monitoring::N_REGIONS+1][SCT_Monitoring::NBINS_LBs+1]{}; - - std::vector<int> m_nSP_buf{}; - int m_nSP_pos{0}; - std::vector<int> m_nHits_buf{}; - int m_nHits_pos{0}; - std::vector<int> m_nmaxHits_buf{}; - std::vector<Identifier> m_nmaxModule_buf{}; - std::vector<int> m_nminHits_buf{}; - std::vector<Identifier> m_nminModule_buf{}; - - std::vector<Identifier> m_RDOsOnTracks; - - ///additional maps for track NO to compare with SP NO calc - std::map<Identifier, int> m_RDOs; - - std::map<Identifier, float> m_occSumUnbiased; - std::map<Identifier, float> m_occSumUnbiasedTrigger; - std::map<Identifier, float> m_occSumUnbiasedRecent; - - std::map<Identifier, float> m_occSumUnbiased_lb[SCT_Monitoring::N_REGIONS+1]; - std::map<Identifier, float> m_occSumUnbiasedTrigger_lb[SCT_Monitoring::N_REGIONS+1]; - - std::map<Identifier, float> m_hitoccSumUnbiased{}; - std::map<Identifier, float> m_hitoccSumUnbiasedTrigger{}; - std::map<Identifier, float> m_hitoccSumUnbiasedRecent{}; - - std::map<Identifier, float> m_hitoccSumUnbiased_lb[SCT_Monitoring::N_REGIONS+1]{}; - std::map<Identifier, float> m_hitoccSumUnbiasedTrigger_lb[SCT_Monitoring::N_REGIONS+1]{}; - /// Name of the L1 Type to use for filling the extra NO histograms StringProperty m_NOTriggerItem{this, "NOTrigger", "L1_RD0_EMPTY"}; BooleanProperty m_doTrigger{this, "doTrigger", false}; /// Switch on or off the hitmaps histograms BooleanProperty m_boolhitmaps{this, "doHitmapHistos", false}; - /// Set bin width to increase exponentially (fixed width on a Log-X plot) - BooleanProperty m_doLogXNoise{this, "doLogXNoise", true}; /// Switch on or off the endcaps BooleanProperty m_doPositiveEndcap{this, "doPositiveEndcap", true}; BooleanProperty m_doNegativeEndcap{this, "doNegativeEndcap", true}; ///Select the noise algorithm - BooleanProperty m_doTrackBasedNoise{this, "doTrackBasedNoise", false}; BooleanProperty m_doSpacePointBasedNoise{this, "doSpacePointBasedNoise", true}; /// Add time-bin filtering to space point NO algorithm BooleanProperty m_doTimeBinFilteringForNoise{this, "doTimeBinFilteringForNoise", true}; - /// Switch on or off the hits histos as a function of TriggerType and L1ID for TX scan - BooleanProperty m_booltxscan{this, "doTXScan", false}; /// CheckHists() frequency IntegerProperty m_checkrate{this, "CheckRate", 1000}; IntegerProperty m_checkrecent{this, "CheckRecent", 30}; - /// ChechHists() frequency - IntegerProperty m_evtsbins{this, "EvtsBins", 5000}; //Things for doing time bin distributions for track hits BooleanProperty m_doTrackHits{this, "doTrackHits", true}; UnsignedIntegerProperty m_maxTracks{this, "MaxTracks", 1000}; - ///Determines whether a local summary is written - IntegerProperty m_localSummary{this, "localSummary", 0}; /// Name of the Track collection to use SG::ReadHandleKey<TrackCollection> m_tracksName{this, "tracksName", "CombinedInDetTracks"}; @@ -184,174 +112,145 @@ class SCTHitsNoiseMonTool : public ManagedMonitorToolBase { const SCT_ID* m_pSCTHelper{nullptr}; //@} + int m_current_lb{0}; // Used in fillHistograms, generalHistsandNoise, checkNoiseMaps + int m_last_reset_lb{0}; // Used in fillHistograms + //Count number of events + int m_numberOfEvents{0}; // Used in bookHistograms, bookHistogramsRecurrent, fillHistograms, generalHistsandNoise, checkNoiseMaps + //Count number of events in the selected stream + int m_numberOfEventsTrigger{0}; // Used in generalHistsandNoise, checkNoiseMaps + //Count number of events since last reset + int m_numberOfEventsRecent{0}; // Used in fillHistograms, checkNoiseMaps + + int m_occ_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL][SCT_Monitoring::NBINS_LBs+1]{}; // Used in fillHistograms, checkNoiseMaps + int m_events_lb{0}; // Used in fillHistograms, generalHistsandNoise, checkNoiseMaps + int m_occTrigger_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL][SCT_Monitoring::NBINS_LBs+1]{}; // Used in fillHistograms, checkNoiseMaps + int m_eventsTrigger_lb{0}; // Used in fillHistograms, generalHistsandNoise, checkNoiseMaps + + int m_hitocc_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL][SCT_Monitoring::NBINS_LBs+1]{}; // Used in fillHistograms, checkNoiseMaps + int m_hitoccTrigger_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL][SCT_Monitoring::NBINS_LBs+1]{}; // Used in fillHistograms, checkNoiseMaps + + std::vector<Identifier> m_RDOsOnTracks; // Used in generalHistsandNoise, makeVectorOfTrackRDOIdentifiers + + std::map<Identifier, float> m_occSumUnbiased; // Used in generalHistsandNoise, checkNoiseMaps, initializeNoiseMaps + std::map<Identifier, float> m_occSumUnbiasedTrigger; // Used in generalHistsandNoise, checkNoiseMaps, initializeNoiseMaps + std::map<Identifier, float> m_occSumUnbiasedRecent; // Used in generalHistsandNoise, initializeNoiseMaps, resetNoiseMapsRecent + + std::map<Identifier, float> m_occSumUnbiased_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL]; // Used in fillHistograms, generalHistsandNoise, checkNoiseMaps, initializeNoiseMaps + std::map<Identifier, float> m_occSumUnbiasedTrigger_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL]; // Used in fillHistograms, generalHistsandNoise, checkNoiseMaps, initializeNoiseMaps + + std::map<Identifier, float> m_hitoccSumUnbiased{}; // Used in checkNoiseMaps, generalHistsandNoise, initializeNoiseMaps + std::map<Identifier, float> m_hitoccSumUnbiasedTrigger{}; // Used in checkNoiseMaps, generalHistsandNoise, initializeNoiseMaps + std::map<Identifier, float> m_hitoccSumUnbiasedRecent{}; // Used in checkNoiseMaps, initializeNoiseMaps, resetNoiseMapsRecent, generalHistsandNoise + + std::map<Identifier, float> m_hitoccSumUnbiased_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL]{}; // Used in fillHistograms, initializeNoiseMaps, checkNoiseMaps + std::map<Identifier, float> m_hitoccSumUnbiasedTrigger_lb[SCT_Monitoring::N_REGIONS_INC_GENERAL]{}; // Used in fillHistograms, generalHistsandNoise, initializeNoiseMaps, checkNoiseMaps + /// --------------------------------------- //@name Histograms related members //@{ /// Vector of pointers to hitmaps histograms - std::vector<TH1F_LW*> m_phitmapHistoVector; + std::vector<TH1F_LW*> m_phitmapHistoVector; // Used in generalHistsandNoise, book1DHitHists /// Vector of pointers to histogram of SCT modules hits; 1 histo per layer and side - std::vector<TH2F_LW*> m_phitsHistoVector[SCT_Monitoring::N_REGIONS]; - std::vector<TH2F_LW*> m_phitsHistoVectorRecent[SCT_Monitoring::N_REGIONS]; - std::vector<TProfile2D*> m_pnoiseoccupancymapHistoVector[SCT_Monitoring::N_REGIONS]; - std::vector<TProfile2D*> m_pnoiseoccupancymapHistoVectorRecent[SCT_Monitoring::N_REGIONS]; - std::vector<TProfile2D*> m_pnoiseoccupancymapHistoVectorTrigger[SCT_Monitoring::N_REGIONS]; + std::vector<TH2F_LW*> m_phitsHistoVector[SCT_Monitoring::N_REGIONS]; // Used in bookGeneralHits, generalHistsandNoise + std::vector<TH2F_LW*> m_phitsHistoVectorRecent[SCT_Monitoring::N_REGIONS]; // Used in bookGeneralHits, generalHistsandNoise, resetHitMapHists + std::vector<TProfile2D*> m_pnoiseoccupancymapHistoVectorRecent[SCT_Monitoring::N_REGIONS]; // Used in bookGeneralNoiseOccupancyMaps, checkNoiseMaps, resetNoiseMapHists + std::vector<TProfile2D*> m_pnoiseoccupancymapHistoVectorTrigger[SCT_Monitoring::N_REGIONS]; // Used in bookGeneralNoiseOccupancyMaps, checkNoiseMaps, resetNoiseMapHists - TH1F* m_nSP{nullptr}; - TH1F* m_nHits{nullptr}; - TH1F* m_nmaxHits{nullptr}; - TH1F* m_nminHits{nullptr}; - - //Histograms with hits per luminosity block - TH1F_LW* m_numHitsPerLumiBlock[SCT_Monitoring::N_REGIONS]{}; - - //Histograms with SPs per luminsity block - TH1F_LW* m_numSPPerLumiBlock[SCT_Monitoring::N_REGIONS]{}; - - TH2F_LW* m_rioMap{nullptr}; //@} - //Histograms with NO distribution - TH1F* m_NO[SCT_Monitoring::N_REGIONS+1]{}; - TH1F* m_NOTrigger[SCT_Monitoring::N_REGIONS+1]{}; //---- results required no triggers - // # of hits vs LBs - TProfile_LW* m_NallHits_vsLB[SCT_Monitoring::N_REGIONS]{}; - TProfile_LW* m_NSPHits_vsLB[SCT_Monitoring::N_REGIONS]{}; // NO with hits subtracted by SP - TProfile_LW* m_NO_vsLB[SCT_Monitoring::N_REGIONS+1]{}; - TProfile_LW* m_NoisyModules_vsLB[nThreshes]{}; + TProfile_LW* m_NO_vsLB[SCT_Monitoring::N_REGIONS_INC_GENERAL]{}; // Used in bookGeneralNoiseOccupancyMaps, checkNoiseMaps, bookNoiseDistributions //---- results required trigger - // # of hits vs LBs - TProfile_LW* m_NallHitsTrigger_vsLB[SCT_Monitoring::N_REGIONS]{}; - TProfile_LW* m_NSPHitsTrigger_vsLB[SCT_Monitoring::N_REGIONS]{}; // NO with hits subtracted by SP - TProfile_LW* m_NOTrigger_vsLB[SCT_Monitoring::N_REGIONS+1]{}; - TProfile_LW* m_NoisyModulesTrigger_vsLB[nThreshes]{}; + TProfile_LW* m_NOTrigger_vsLB[SCT_Monitoring::N_REGIONS_INC_GENERAL]{}; // Used in bookGeneralNoiseOccupancyMaps, checkNoiseMaps, bookNoiseDistributions - //Online code- template vector - std::vector<TH1F_LW*> m_pstripmapTemplateVector{}; - TH1F_LW* m_MaxOccupancyStripHist{nullptr}; - TH1F_LW* m_MinOccupancyStripHist{nullptr}; /// Pointers to histogram of SCT cluster width. - TH1F_LW* m_clusize{nullptr}; - TH1F_LW* m_clusizeRecent{nullptr}; - - /// Pointers to histogram of hits as a function of TriggerType. - TH1F_LW* m_hitsvstrigger{nullptr}; - - /// Pointers to histogram of hits as a function of L1ID. - TH1F_LW* m_hitsvsL1ID{nullptr}; - - /// Pointers to vector of histograms of SCT cluster width; 1 histo per layer and side. - std::vector<TH1F_LW*> m_clusizeHistoVector[SCT_Monitoring::N_REGIONS]{}; - std::vector<TH1F_LW*> m_clusizeHistoVectorRecent[SCT_Monitoring::N_REGIONS]{}; + TH1F_LW* m_clusize{nullptr}; // Used in generalHistsandNoise, bookClusterSize + TH1F_LW* m_clusizeRecent{nullptr}; // Used in generalHistsandNoise, bookClusterSize, resetHitMapHists /// Pointer to 1D histogram of Number of SCT Clusters per Event TH1F* m_ncluHisto{nullptr}; /// Vector of pointers to 1D histogram of Number of SCT Clusters per Event; 1 histo per layer and side - std::vector<TH1F_LW*> m_ncluHistoVector[SCT_Monitoring::N_REGIONS]{}; - - //Pointer to histogram of time bin coincidences - TH2I_LW* m_coincidenceHist{nullptr}; - - std::vector<TH2F_LW*> m_ptrackhitsHistoVector[SCT_Monitoring::N_REGIONS]; - std::vector<TH2F_LW*> m_ptrackhitsHistoVectorRecent[SCT_Monitoring::N_REGIONS]; - std::vector<TH1F_LW*> m_tbinHistoVector[SCT_Monitoring::N_REGIONS]{}; - std::vector<TH1F_LW*> m_tbinHistoVectorRecent[SCT_Monitoring::N_REGIONS]{}; - TH1F_LW* m_tbinHisto[SCT_Monitoring::N_REGIONS]{}; - TH1F_LW* m_tbinHistoRecent[SCT_Monitoring::N_REGIONS]{}; - TProfile2D* m_tbinfrac[SCT_Monitoring::N_REGIONS][s_commonSize]{}; - TProfile2D* m_clusizedist[SCT_Monitoring::N_REGIONS][s_commonSize]{}; - TProfile_LW* m_tbinfracall{nullptr}; - TProfile_LW* m_tbinfracVsLB[SCT_Monitoring::N_REGIONS]{}; - - std::vector<TProfile2D*> m_phitoccupancymapHistoVector[SCT_Monitoring::N_REGIONS]{}; - std::vector<TProfile2D*> m_phitoccupancymapHistoVectorRecent[SCT_Monitoring::N_REGIONS]{}; - std::vector<TProfile2D*> m_phitoccupancymapHistoVectorTrigger[SCT_Monitoring::N_REGIONS]{}; - - //Histograms with HO distribution - TH1F* m_HO[SCT_Monitoring::N_REGIONS+1]{}; - TH1F* m_HOTrigger[SCT_Monitoring::N_REGIONS+1]{}; + std::vector<TH1F_LW*> m_ncluHistoVector[SCT_Monitoring::N_REGIONS]{}; // Used in bookGeneralHits, generalHistsandNoise, + + std::vector<TH2F_LW*> m_ptrackhitsHistoVector[SCT_Monitoring::N_REGIONS]; // Used in bookGeneralTrackHitso, generalHistsandNoise, resetHitMapHists + std::vector<TH2F_LW*> m_ptrackhitsHistoVectorRecent[SCT_Monitoring::N_REGIONS]; // Used in bookGeneralTrackHitso, generalHistsandNoise, resetHitMapHists + TProfile2D* m_clusizedist[SCT_Monitoring::N_REGIONS][s_commonSize]{}; // Used in generalHistsandNoise, bookClusterSize + TProfile_LW* m_tbinfracall{nullptr}; // Used in bookGeneralTrackTimeHistos, generalHistsandNoise + + std::vector<TProfile2D*> m_phitoccupancymapHistoVector[SCT_Monitoring::N_REGIONS]{}; // Used in bookGeneralHitOccupancyMaps, checkNoiseMaps, resetNoiseMapHists + std::vector<TProfile2D*> m_phitoccupancymapHistoVectorRecent[SCT_Monitoring::N_REGIONS]{}; // Used in bookGeneralHitOccupancyMaps, checkNoiseMaps, resetNoiseMapHists //---- results required no triggers // # of hits vs LBs - TProfile_LW* m_HallHits_vsLB[SCT_Monitoring::N_REGIONS]{}; - TProfile_LW* m_HSPHits_vsLB[SCT_Monitoring::N_REGIONS]{}; + TProfile_LW* m_HallHits_vsLB[SCT_Monitoring::N_REGIONS]{}; // Used in generalHistsandNoise, bookGeneralHitOccupancyMaps + TProfile_LW* m_HSPHits_vsLB[SCT_Monitoring::N_REGIONS]{}; // Used in generalHistsandNoise, bookGeneralHitOccupancyMaps // HO with hits subtracted by SP - TProfile_LW* m_HO_vsLB[SCT_Monitoring::N_REGIONS+1]{}; - TProfile_LW* m_NoisyModulesWithHO_vsLB[nThreshes]{}; + TProfile_LW* m_HO_vsLB[SCT_Monitoring::N_REGIONS_INC_GENERAL]{}; // Used in checkNoiseMaps, bookNoiseDistributions, bookGeneralHitOccupancyMaps //---- results required trigger // # of hits vs LBs - TProfile_LW* m_HallHitsTrigger_vsLB[SCT_Monitoring::N_REGIONS]{}; - TProfile_LW* m_HSPHitsTrigger_vsLB[SCT_Monitoring::N_REGIONS]{}; + TProfile_LW* m_HallHitsTrigger_vsLB[SCT_Monitoring::N_REGIONS]{}; // Used in generalHistsandNoise, bookGeneralHitOccupancyMaps + TProfile_LW* m_HSPHitsTrigger_vsLB[SCT_Monitoring::N_REGIONS]{}; // Used in generalHistsandNoise, bookGeneralHitOccupancyMaps // HO with hits - TProfile_LW* m_HOTrigger_vsLB[SCT_Monitoring::N_REGIONS+1]{}; - TProfile_LW* m_NoisyModulesWithHOTrigger_vsLB[nThreshes]{}; + TProfile_LW* m_HOTrigger_vsLB[SCT_Monitoring::N_REGIONS_INC_GENERAL]{}; // Used in bookGeneralHitOccupancyMaps, checkNoiseMaps, bookNoiseDistributions - StatusCode makeVectorOfTrackRDOIdentifiers(); - //@name Histograms related methods //@{ - - StatusCode bookGeneralTrackHits(const unsigned int systemIndex); - StatusCode bookGeneralTrackTimeHistos(const unsigned int systemIndex); - - // Book Hitmaps Histograms - StatusCode book1DHitHists(); - - StatusCode bookHitMaps(); - StatusCode bookSPvsEventNumber(); - StatusCode makeSPvsEventNumber(); - // Book noise map histograms - StatusCode bookNoiseMaps(); - StatusCode bookNoiseDistributions(); - - // Book noise occupancy map histograms - StatusCode bookGeneralNoiseOccupancyMaps(const unsigned int systemIndex); - //Book hit occupancy map histograms - StatusCode bookGeneralHitOccupancyMaps(const unsigned int systemIndex); - - // Book Hits Histograms - StatusCode bookGeneralHits(const unsigned int systemIndex); + // Used in bookHistograms and bookHistogramsRecurrent + StatusCode bookGeneralTrackHits(const unsigned int systemIndex); + StatusCode bookGeneralTrackTimeHistos(); + StatusCode book1DHitHists(); // Book Hitmaps Histograms + StatusCode bookNoiseDistributions(); // Book noise map histograms + StatusCode bookGeneralNoiseOccupancyMaps(const unsigned int systemIndex); // Book noise occupancy map histograms + StatusCode bookGeneralHitOccupancyMaps(const unsigned int systemIndex); // Book hit occupancy map histograms + StatusCode bookGeneralHits(const unsigned int systemIndex); // Book Hits Histograms StatusCode bookClusterSize(); - StatusCode bookGeneralCluSize(const unsigned int systemIndex); - //@} - - //Do checking of noise maps - StatusCode checkNoiseMaps(bool final); StatusCode initializeNoiseMaps(); - StatusCode resetNoiseMapHists(); + + // Used in fillHistograms + StatusCode makeVectorOfTrackRDOIdentifiers(); StatusCode resetNoiseMapsRecent(); StatusCode resetHitMapHists(); StatusCode generalHistsandNoise(); - StatusCode resetVecProf2(std::vector<TProfile2D*>& hists) const; - StatusCode resetVecH2(std::vector<TH2F_LW*>& hists) const; - StatusCode resetVecH1(std::vector<TH1F_LW*>& hists) const; + // Used in fillHistograms and procHistograms + StatusCode checkNoiseMaps(); // Do checking of noise maps + // Used in book1DHitHists, bookGeneralHits, bookGeneralCluSize, bookGeneralTrackTimeHistos TH1F_LW* h1Factory(const std::string& name, const std::string& title, MonGroup& registry, std::vector<TH1F_LW*>& storageVector, const float lo, const float hi, const unsigned int nbins) const; + // Used in bookGeneralHits, bookClusterSize, bookGeneralTrackTimeHistos TH1F_LW* h1Factory(const std::string& name, const std::string& title, MonGroup& registry, const float lo, const float hi, const unsigned int nbins) const; - TH1F* th1Factory(const std::string& name, const std::string& title, MonGroup& registry, std::vector<TH1F*>& storageVector, const float lo, const float hi, const unsigned int nbins) const; - TH1F* th1Factory(const std::string& name, const std::string& title, MonGroup& registry, const float lo, const float hi, const unsigned int nbins) const; - + // Used in bookGeneralHits, bookGeneralTrackHits TH2F_LW* h2Factory(const std::string& name, const std::string& title, const SCT_Monitoring::Bec bec, MonGroup& registry, std::vector<TH2F_LW*>& storageVector) const; - TH2I_LW* h2IFactory(const std::string& name, const std::string& title, MonGroup& registry, int nbinx, float xlo, float xhi, int nbiny, float ylo, float yhi) const; - + // Used in bookGeneralNoiseOccupancyMaps, bookGeneralHitOccupancyMaps TProfile2D* prof2Factory(const std::string& name, const std::string& title, const SCT_Monitoring::Bec bec, MonGroup& registry, std::vector<TProfile2D*>& storageVector) const; + // Used in bookClusterSize, bookGeneralTrackTimeHistos TProfile2D* prof2DFactory(const std::string& name, const std::string& title, MonGroup& registry, int nbinx, float xlo, float xhi, int nbiny, float ylo, float yhi) const; - TProfile_LW* profFactory(const std::string& name, const std::string& title, MonGroup& registry, int nbin, float lo, float hi) const; + // Used in bookGeneralTrackTimeHistos TProfile_LW* profFactory(const std::string& name, const std::string& title, MonGroup& registry) const; - ///Format the position as a string - std::string positionString(const Identifier& plane) const; + // Used in book1DHitHists + std::string positionString(const Identifier& plane) const; /// Format the position as a string + + // Used in resetNoiseMapHists + StatusCode resetVecProf2(std::vector<TProfile2D*>& hists) const; + + // Used in resetHitMapHists + StatusCode resetVecH2(std::vector<TH2F_LW*>& hists) const; + + // Used in checkNoiseMaps + StatusCode resetNoiseMapHists(); + + //@} }; #endif // SCTHITSNOISEMONTOOL_H