ATLAS Offline Software
AFPSiLayerMonitor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
10 
12 
13 #include <LWHists/TH1F_LW.h>
14 #include <LWHists/TH2F_LW.h>
15 
16 #include <sstream>
17 
19  const std::string& name,
20  const IInterface* parent) :
22  m_parentMonitor (nullptr),
23  m_hitsInEvent (0),
24  m_hitMap(nullptr),
25  m_hitMultiplicity(nullptr),
26  m_timeOverThreshold(nullptr),
27  m_hitsInEventHotSpot(0),
28  m_hitMultiplicityHotSpot(nullptr)
29 {
30  declareInterface<IAFPSiLayerMonitor>(this);
31 
32  declareProperty("pixelLayerID", m_pixelLayerID = -1, "ID number of pixel layer.");
33  declareProperty("stationID", m_stationID = -1, "ID number of station in which is the monitored layer.");
34 
35  declareProperty("hitsScaleFactor", m_hitsScaleFactor = 0.04, "Scale factor for normalising hits in event to pile-up.");
36 
37  declareProperty("hotSpotStartRow", m_hotSpotStartRow = 0, "First row of the hot-spot (included in the hot-spot).");
38  declareProperty("hotSpotEndRow", m_hotSpotEndRow = 50, "Last row of the hot-spot (included in the hot-spot).");
39  declareProperty("hotSpotStartCol", m_hotSpotStartCol = 0, "First column of the hot-spot (included in the hot-spot).");
40  declareProperty("hotSpotEndCol", m_hotSpotEndCol = 30, "Last column of the hot-spot (included in the hot-spot).");
41 }
42 
44 {
45 }
46 
48 {
49  // set full name
50  std::stringstream fullName;
51  fullName<<"st."<<m_stationID;
52  fullName<<"/lay."<<m_pixelLayerID;
53  m_layerFullName = fullName.str();
54 
55  return StatusCode::SUCCESS;
56 }
57 
59 {
60  return StatusCode::SUCCESS;
61 }
62 
63 // Description: Used for re-booking managed histograms
64 void AFPSiLayerMonitor::bookHistograms(ManagedMonitorToolBase* toolToStoreHistograms, const std::string& histsDirName)
65 {
67 
68  // ********** Per lumi block **********
69  ManagedMonitorToolBase::MonGroup managed_booking_lumiBlock( toolToStoreHistograms, histsDirName.data(), toolToStoreHistograms->lumiBlock); // to re-booked every luminosity block
70  ManagedMonitorToolBase::MonGroup managed_booking_run( toolToStoreHistograms, histsDirName.data(), toolToStoreHistograms->run); // to re-booked every run
71 
72  // ----- hit map -----
73  // create histogram name and title
74  std::string hitMapName = makeHistName("h_hitMap");
75  std::string hitMapTitle = makeHistName("Map of hits");
76 
77  constexpr int nRows = 80;
78  constexpr int nColumns = 336;
79 
80  // create and register histogram
81  m_hitMap = TH2F_LW::create(hitMapName.data(),
82  hitMapTitle.data(),
83  nRows, 0.5, nRows + 0.5,
84  nColumns, 0.5, nColumns + 0.5);
85  m_hitMap->SetXTitle("column ID");
86  m_hitMap->SetYTitle("row ID");
87 
88  toolToStoreHistograms->regHist(m_hitMap, managed_booking_run).ignore();
89 
90 
91  // ----- hit multiplicity -----
92  // create histogram name and title
93  std::string hitMultiplicityName = makeHistName("h_hitMultiplicity");
94  std::string hitMultiplicityTitle = makeHistTitle("Number of hits per event");
95 
96  m_hitMultiplicity = new TH1F(hitMultiplicityName.data(),
97  hitMultiplicityTitle.data(),
98  40, -0.5, 39.5);
99  m_hitMultiplicity->SetStatOverflows(TH1::EStatOverflows::kConsider); // need to use overflows for calculation of mean
100  m_hitMultiplicity->SetXTitle("number of hits in an event");
101  m_hitMultiplicity->SetYTitle("events");
102 
103  toolToStoreHistograms->regHist( m_hitMultiplicity, managed_booking_lumiBlock ).ignore();
104 
105 
106  // create histogram name and title
107  std::string hitMultiplicityNameHotSpot = makeHistName("h_hitMultiplicityHotSpot");
108  std::string hitMultiplicityTitleHotSpot = makeHistTitle("Number of hits per event in the hot spot");
109 
110  m_hitMultiplicityHotSpot = new TH1F(hitMultiplicityNameHotSpot.data(),
111  hitMultiplicityTitleHotSpot.data(),
112  40, -0.5, 39.5);
113  m_hitMultiplicityHotSpot->SetStatOverflows(TH1::EStatOverflows::kConsider); // need to use overflows for calculation of mean
114  m_hitMultiplicityHotSpot->SetXTitle("number of hits in hotspot in an event");
115  m_hitMultiplicityHotSpot->SetYTitle("events");
116 
117  toolToStoreHistograms->regHist( m_hitMultiplicityHotSpot, managed_booking_lumiBlock ).ignore();
118 
119 
120  // ----- hit charge -----
121  // create histogram name and title
122  std::string timeOverThresholdName = makeHistName("h_timeOverThreshold");
123  std::string timeOverThresholdTitle = makeHistTitle("Time over threshold");
124 
125  m_timeOverThreshold = new TH1F(timeOverThresholdName.data(),
126  timeOverThresholdTitle.data(),
127  16, -0.5, 15.5);
128  m_timeOverThreshold->SetStatOverflows(TH1::EStatOverflows::kConsider); // need to use overflows for calculation of mean
129  m_timeOverThreshold->SetXTitle("time-over-threshold");
130  m_timeOverThreshold->SetYTitle("number of hits");
131 
132  toolToStoreHistograms->regHist( m_timeOverThreshold, managed_booking_lumiBlock ).ignore();
133 }
134 
135 
137 {
138  // update variables
139  m_hitsInEvent++;
140 
144 
145  // fill histograms
148 
149  // fill summary histograms
151 }
152 
154 {
155  // fill histograms
158 
160 
161  // reset variables
162  m_hitsInEvent = 0;
164 }
165 
167 {
168 
169 }
170 
171 
172 std::string AFPSiLayerMonitor::makeHistName (const std::string& name) const
173 {
174  std::stringstream histName;
175  histName<<name<<"St"<<m_stationID<<"Layer"<<m_pixelLayerID;
176 
177  return histName.str();
178 }
179 
180 
181 std::string AFPSiLayerMonitor::makeHistTitle (const std::string& title) const
182 {
183  std::stringstream histTitle;
184  histTitle<<title<<" in station "<<m_stationID<<" for layer "<<m_pixelLayerID;
185 
186  return histTitle.str();
187 
188 }
189 
191 {
193 }
TH1F_LW.h
TH2F_LW.h
AFPSiLayerSummaryManager::fillHits
void fillHits(const std::string &binName, const xAOD::AFPSiHit &hit) const
Executes IAFPSiLayerSummaryHit::fillHits() on all objects in AFPSiLayerSummaryManager::m_hits.
Definition: AFPSiLayerSummaryManager.cxx:21
AFPHitsMonitorTool.h
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
ManagedMonitorToolBase::lumiBlock
@ lumiBlock
Definition: ManagedMonitorToolBase.h:114
AFPSiLayerMonitor::m_pixelLayerID
int m_pixelLayerID
ID number of the silicon pixel layer.
Definition: AFPSiLayerMonitor.h:130
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:74
AFPHitsMonitorTool::summaryManager
AFPSiLayerSummaryManager * summaryManager()
Manager of summary distributions m_summaryManager.
Definition: AFPHitsMonitorTool.h:80
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
AFPSiLayerMonitor::histsDirName
const std::string & histsDirName() const override
Returns name of the ROOT file directory where histograms are stored.
Definition: AFPSiLayerMonitor.h:92
xAOD::AFPSiHit_v2
Class representing a hit in silicon detector.
Definition: AFPSiHit_v2.h:30
AFPSiLayerMonitor::m_hitsInEventHotSpot
unsigned int m_hitsInEventHotSpot
Counts number of hits in a hot-spot in an event.
Definition: AFPSiLayerMonitor.h:160
AFPSiLayerMonitor::m_timeOverThreshold
TH1 * m_timeOverThreshold
Distribution of number of time-over-threshold i.e. signal strength for each hit.
Definition: AFPSiLayerMonitor.h:149
LWHist2D::Fill
virtual void Fill(const double &x, const double &y)=0
AFPSiLayerMonitor::bookHistograms
void bookHistograms(ManagedMonitorToolBase *toolToStoreHistograms, const std::string &histsDirName="") override
Creates, adds axes descriptions and books histograms filled by this monitor.
Definition: AFPSiLayerMonitor.cxx:64
AFPSiLayerMonitor::m_histsDirName
std::string m_histsDirName
Name of the ROOT file directory where histograms will be saved.
Definition: AFPSiLayerMonitor.h:135
AFPSiLayerMonitor::makeHistTitle
std::string makeHistTitle(const std::string &title) const override
Returns a title suffixed with station and layer numbers.
Definition: AFPSiLayerMonitor.cxx:181
AFPSiLayerMonitor::m_layerFullName
std::string m_layerFullName
Layer and station name used to label summary histograms bins.
Definition: AFPSiLayerMonitor.h:132
ManagedMonitorToolBase.h
AFPSiLayerSummaryManager::fillEventEnd
void fillEventEnd(const std::string &binName, const IAFPSiLayerMonitor *layer) const
Executes IAFPSiLayerSummaryHit::fillEventEnd() on all objects in AFPSiLayerSummaryManager::m_eventEnd...
Definition: AFPSiLayerSummaryManager.cxx:27
AFPSiLayerMonitor::~AFPSiLayerMonitor
~AFPSiLayerMonitor()
Does nothing
Definition: AFPSiLayerMonitor.cxx:43
ManagedMonitorToolBase::MonGroup
A container of information describing a monitoring object.
Definition: ManagedMonitorToolBase.h:138
xAOD::AFPSiHit_v2::pixelColIDChip
int pixelColIDChip() const
Index of the pixel column in chip coordinate system.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
AFPSiLayerMonitor::AFPSiLayerMonitor
AFPSiLayerMonitor(const std::string &type, const std::string &name, const IInterface *parent)
Declares python properites.
Definition: AFPSiLayerMonitor.cxx:18
covarianceTool.title
title
Definition: covarianceTool.py:542
AFPSiLayerMonitor::endOfLumiBlock
void endOfLumiBlock() override
Process histograms at the end of lumiblock.
Definition: AFPSiLayerMonitor.cxx:166
AFPStationID.h
Definitions of AFP stations identification numbers.
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AFPSiLayerMonitor::m_parentMonitor
AFPHitsMonitorTool * m_parentMonitor
Pointer to the parent monitoring tool.
Definition: AFPSiLayerMonitor.h:134
AFPSiLayerMonitor::initialize
StatusCode initialize() override
Constructs m_layerFullName from m_stationID and m_pixelLayerID.
Definition: AFPSiLayerMonitor.cxx:47
AFPSiLayerMonitor::m_hitMap
LWHist2D * m_hitMap
2D distribution of hits in a layer row vs column (336 x 80)
Definition: AFPSiLayerMonitor.h:141
TH1::Fill
int Fill(double)
Definition: rootspy.cxx:285
AFPSiLayerMonitor.h
AFPSiLayerMonitor::m_hitsInEvent
unsigned int m_hitsInEvent
Number of counted pixels fired in the current event.
Definition: AFPSiLayerMonitor.h:138
AFPSiLayerMonitor::m_hotSpotStartRow
int m_hotSpotStartRow
Defines the first row of a hot spot (including this row).
Definition: AFPSiLayerMonitor.h:152
AFPSiLayerMonitor::makeHistName
std::string makeHistName(const std::string &name) const override
Returns a name suffixed with station and layer numbers.
Definition: AFPSiLayerMonitor.cxx:172
AFPSiLayerMonitor::fillHistograms
void fillHistograms(const xAOD::AFPSiHit &hit) override
Fills histograms which have to be filled for each hit.
Definition: AFPSiLayerMonitor.cxx:136
LWHist::SetXTitle
void SetXTitle(const char *)
Definition: LWHist.cxx:431
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AFPSiLayerMonitor::m_hotSpotStartCol
int m_hotSpotStartCol
Defines the first column of a hot spot (including this column).
Definition: AFPSiLayerMonitor.h:156
AFPSiLayerMonitor::m_hotSpotEndCol
int m_hotSpotEndCol
Defines the last column of a hot spot (including this column).
Definition: AFPSiLayerMonitor.h:158
TH2F_LW::create
static TH2F_LW * create(const char *name, const char *title, unsigned nbinsx, const double &xmin, const double &xmax, unsigned nbinsy, const double &ymin, const double &ymax)
Definition: TH2F_LW.cxx:33
LWHist::SetYTitle
void SetYTitle(const char *)
Definition: LWHist.cxx:440
AFPSiLayerMonitor::finalize
StatusCode finalize() override
Does nothing.
Definition: AFPSiLayerMonitor.cxx:58
AFPSiLayerMonitor::m_hitMultiplicityHotSpot
TH1 * m_hitMultiplicityHotSpot
Distribution of number of hits in a hot-spot in an event.
Definition: AFPSiLayerMonitor.h:169
xAOD::AFPSiHit_v2::timeOverThreshold
float timeOverThreshold() const
Time over threshold of signal for a pixel.
AFPSiLayerMonitor::correctHitsForPileUp
virtual double correctHitsForPileUp(double hits) const override
Normalises number of hits in an event to 0 pile-up.
Definition: AFPSiLayerMonitor.cxx:190
ManagedMonitorToolBase::run
@ run
Definition: ManagedMonitorToolBase.h:116
xAOD::AFPSiHit_v2::pixelRowIDChip
int pixelRowIDChip() const
Index of the pixel row in chip coordinate system.
AFPSiLayerMonitor::m_hotSpotEndRow
int m_hotSpotEndRow
Defines the last row of a hot spot (including this row).
Definition: AFPSiLayerMonitor.h:154
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFPHitsMonitorTool::pileUp
double pileUp() const
Average number of interactions per crossing in a given event.
Definition: AFPHitsMonitorTool.h:83
AFPSiLayerMonitor::m_hitMultiplicity
TH1 * m_hitMultiplicity
Distribution of number of hits in an event.
Definition: AFPSiLayerMonitor.h:146
AFPSiLayerMonitor::m_stationID
int m_stationID
ID number of the station where the pixel layer is mounted.
Definition: AFPSiLayerMonitor.h:131
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
AthAlgTool
Definition: AthAlgTool.h:26
AFPSiLayerMonitor::m_hitsScaleFactor
double m_hitsScaleFactor
Factor for correcting number of hits for pile-up (see AFPSiLayerMonitor::correctHitsForPileUp()
Definition: AFPSiLayerMonitor.h:137
AFPSiLayerMonitor::layerFullName
const std::string & layerFullName() const override
Returns layer and station name used to label bins in summary histograms.
Definition: AFPSiLayerMonitor.h:95
ManagedMonitorToolBase::regHist
virtual StatusCode regHist(TH1 *h, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
Definition: ManagedMonitorToolBase.cxx:1454
AFPSiLayerSummaryManager.h
AFPSiLayerMonitor::eventEnd
void eventEnd() override
Method that should be called when event processing is finished.
Definition: AFPSiLayerMonitor.cxx:153