ATLAS Offline Software
Loading...
Searching...
No Matches
CscCalibMonToolBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef CSCCALIBMONITORING_CSCCALIBMONTOOLBASE_H
6#define CSCCALIBMONITORING_CSCCALIBMONTOOLBASE_H
7
8
9
10#include "Rtypes.h"
11
13
15#include "GaudiKernel/MsgStream.h"
16
20
22
23#include "GaudiKernel/ServiceHandle.h"
25
26#include <vector>
27#include <set>
28#include <string>
29
30class TH1I;
31class TH1F;
32class TH2F;
33class TProfile;
34
35
36class CscCondDbData;
37
39
54
56{
57
58 public:
59
63 CscCalibMonToolBase (const std::string & type, const std::string & name,
64 const IInterface* parent);
65
67
71 virtual StatusCode initialize();
72
76 virtual StatusCode finalize();
77
83 virtual StatusCode bookHistograms();
84
91 virtual StatusCode fillHistograms();
92
102 virtual StatusCode procHistograms();
103
109 virtual StatusCode checkHists(bool fromFinalise);
110
111
112 protected:
113 unsigned int m_maxHashId{};
114 unsigned int m_maxChamId{};
115 unsigned int m_numBad{};
117
118
124
125
126
130
134
136 std::string m_hashName,
152
155
160
163 std::map<std::string, MonGroup*> m_monGroupMap;
164
166 std::string m_calibResultKey;
167
168 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
169
171 SG::ReadCondHandleKey<CscCondDbData> m_readKey{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"};
172
173
180 {
181
182 ProcSetupInfo() : badHist(NULL), overDiff(NULL), overChi2(NULL),
183 missingChans(NULL),
184 badBin(0), missingBadBin(0),
185 chi2BadBin(0), maxDiff(0.0), chi2Max(9999.), expectedVal(9999.), doChi2(false),
186 dbName(""),vals(NULL),errors(NULL),oldVals(NULL),
187 diffs(NULL),chi2s(NULL)
188 {}
189
190 TH1I *badHist{};
191 TH1F *overDiff{}, *overChi2{} ;
195 std::set<int> expectedChannels;
196 bool doChi2{};
197 std::string dbName;
198 //float *vals,*errors,*oldVals,*diffs,*chi2s;
199 std::vector<float> *vals{}, *errors{}, *oldVals{}, *diffs{},* chi2s{};
200 };
201
207 ignoreY(false),
208 hashHist(NULL), allChan1dHistX(NULL), allChan1dHistY(NULL), allChan2dHist(NULL), chamProf(NULL),
209 layHistVect(NULL), laySummVect(NULL), chamSummVect(NULL), chamHistVect(NULL), abs2d(true)
210 {}
211
212 HistCollection(int arraySize, int errorSize = 0):
213 ignoreY(false),
214 hashHist(NULL), allChan1dHistX(NULL), allChan1dHistY(NULL), allChan2dHist(NULL), chamProf(NULL),
215 layHistVect(NULL), laySummVect(NULL), chamSummVect(NULL), chamHistVect(NULL), abs2d(true)
216 {
217 data.resize(arraySize);
218 if(errorSize)
219 errors.resize(errorSize);
220 }
221
223 if (layHistVect != NULL)
224 delete layHistVect;
225 if (laySummVect != NULL)
226 delete laySummVect;
227 if (chamSummVect)
228 delete chamSummVect;
229 }
231 std::vector<float> data;
232 std::vector<float> errors;
233 std::vector<TH1F *> cscSpec{};
234 TH1F * hashHist{};
238 TProfile * chamProf{};
239 std::vector<TH1F*> * layHistVect{};
240 std::vector<TH1F*> * laySummVect{};
241 std::vector<TH1F*> * chamSummVect{};
242 std::vector<TH1F*> * chamHistVect{};
243 bool abs2d{};
244 };
245
246 //Stat bit from database
249
250 protected:
266 virtual StatusCode bookHistCollection(HistCollection *histCollection,
267 const std::string & dataTypeName, const std::string & dataTypeTitle, const std::string & categoryName, const std::string & categoryTitle,
268 const std::string & axisLabel, int numBins, float lowBound, float highBound, const std::string & parDir ="",
269 uint16_t toSkip =0);
270
284 virtual StatusCode bookLayHists(const std::string & histTypeDir, const std::string & parTypeDir,
285 std::vector<TH1F*> &vector,
286 const std::string & namePrefix, const std::string & titlePrefix,
287 const std::string & xaxis, const std::string & yaxis, bool chanView = true,
288 bool ignoreY = false, unsigned int numBins = 100,
289 float lowBound = 0, float highbound = 100);
290
291
302 virtual StatusCode bookChamHists(const std::string & histTypeDir, const std::string & parTypeDir,
303 std::vector<TH1F*>& histVector,
304 const std::string & namePrefix, const std::string & titlePrefix,
305 const std::string & xaxis = "", const std::string & yaxis = "", bool chanView = true, bool ignoreY = false,
306 unsigned int numBins = 100, float lowBound = 0, float highbound = 100);
307
313 virtual StatusCode handleParameter(const CscCalibResultCollection *parVals);
314
328 virtual StatusCode procParameter(const CscCalibResultCollection *parVals,
329 ProcSetupInfo* simpleSet);
334 virtual StatusCode copyDataToHists(HistCollection * histCollection);
335
339 virtual StatusCode postProc();
340
342 virtual int getLayIndex(int measuresPhi, int stationEta, int sector, int layer);
344 virtual int getChamIndex(int measuresPhi, int stationEta, int sector);
346 virtual int getSector(int stationPhi, int stationSize);
348 std::string getEndCap(int eta);
349
356 std::string getGeoPath( int eta = -9999, int sector = -9999,
357 int wireLayer = -9999,int measuresPhi = -9999 , int channel =-9999);
358
364 std::string getFullPath(const std::string& geoPath, const std::string& histTypeDir, const std::string& parTypeDir);
365
366};
367
368#endif
Scalar eta() const
pseudorapidity method
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual int getSector(int stationPhi, int stationSize)
Produces a sector number from the phi and size of a station.
std::set< int > m_expectedHashIdsPrec
virtual StatusCode postProc()
Run after handleParameter.
std::string getEndCap(int eta)
Gets the letter endcap (A or C) for a given eta index (1,-1)
std::map< std::string, MonGroup * > m_monGroupMap
std::string getGeoPath(int eta=-9999, int sector=-9999, int wireLayer=-9999, int measuresPhi=-9999, int channel=-9999)
getGeoPath creates a directory structure for a histogram based upon where it is in the CSC geometry.
std::string m_calibResultKey
Calibration result storegate key.
virtual StatusCode handleParameter(const CscCalibResultCollection *parVals)
Should be written by user in derived class.
std::string m_hashName
Naming info.
virtual StatusCode bookLayHists(const std::string &histTypeDir, const std::string &parTypeDir, std::vector< TH1F * > &vector, const std::string &namePrefix, const std::string &titlePrefix, const std::string &xaxis, const std::string &yaxis, bool chanView=true, bool ignoreY=false, unsigned int numBins=100, float lowBound=0, float highbound=100)
Books a vector of histograms where each one corresponds to a layer of the CSC secbers.
SG::ReadCondHandleKey< CscCondDbData > m_readKey
Access to COOL database.
std::set< int > m_expectedHashIdsAll
unsigned int m_expectedChamberLayer
virtual StatusCode procHistograms()
At end of run this processes the calibration results and fills the histograms.
virtual int getLayIndex(int measuresPhi, int stationEta, int sector, int layer)
produces a unique number for every layer in the detector
virtual StatusCode fillHistograms()
Standard function for a ManagedMonitorToolBase.
virtual int getChamIndex(int measuresPhi, int stationEta, int sector)
Produces a unique number for every secber in the detector.
virtual StatusCode bookChamHists(const std::string &histTypeDir, const std::string &parTypeDir, std::vector< TH1F * > &histVector, const std::string &namePrefix, const std::string &titlePrefix, const std::string &xaxis="", const std::string &yaxis="", bool chanView=true, bool ignoreY=false, unsigned int numBins=100, float lowBound=0, float highbound=100)
Books a vector of histograms where each one corresponds to a secber of the CSC secbers.
bool m_onlyExpectPrecisionHashIds
Hash Ids one would expect to be in calibration data.
virtual StatusCode initialize()
initializes services, tools, etc.
CscCalibMonToolBase(const std::string &type, const std::string &name, const IInterface *parent)
constructor
HistCollection * m_statDbColl
DataVector< MonGroup > * m_monGroupVec
Keeps track of MonGroups.
std::string getFullPath(const std::string &geoPath, const std::string &histTypeDir, const std::string &parTypeDir)
Geo path creates a directory structure for a histogram based upon its geoPath, the hist type dir (spe...
virtual StatusCode finalize()
deletes private members
virtual StatusCode bookHistCollection(HistCollection *histCollection, const std::string &dataTypeName, const std::string &dataTypeTitle, const std::string &categoryName, const std::string &categoryTitle, const std::string &axisLabel, int numBins, float lowBound, float highBound, const std::string &parDir="", uint16_t toSkip=0)
Initializes the histograms in a histCollection and books them.
virtual StatusCode checkHists(bool fromFinalise)
Standard function for a ManagedMonitorToolBase.
virtual StatusCode copyDataToHists(HistCollection *histCollection)
Fills the histograms in the histCollection based on the data in the std::vector in the HistCollection...
int m_maxDetailedChannels
To keep track of channels that should have more data printed to root file.
std::string m_generic_path_csccalibmonitoring
Path of histograms.
bool m_makeHashHists
Data output options.
virtual StatusCode bookHistograms()
Standard function for a ManagedMonitorToolBase.
virtual StatusCode procParameter(const CscCalibResultCollection *parVals, ProcSetupInfo *simpleSet)
Processors a parameter type.
Derived DataVector<T>.
Definition DataVector.h:795
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Contains an array with data on a per-channel basis, as well as various histograms that give different...
HistCollection(int arraySize, int errorSize=0)