ATLAS Offline Software
Loading...
Searching...
No Matches
SCTCalibWriteTool.h
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7/*
8 * @file SCTCalibWriteTool.h
9 *
10 * @brief Header file for the SCTCalibWriteTool class
11 *
12 * @author Jose E. Garcia
13 **/
14
15#ifndef SCTCalibWriteTool_H
16#define SCTCalibWriteTool_H
17
18// Athena includes
24
27
28#include "CoralBase/AttributeListSpecification.h"
29
30// Gaudi includes
31#include "GaudiKernel/IInterface.h"
32#include "GaudiKernel/ToolHandle.h"
33#include "GaudiKernel/ServiceHandle.h"
34#include "GaudiKernel/StatusCode.h"
36//STL
37#include <map>
38#include <memory>
39#include <mutex>
40#include <string>
41
42//forward declarations
43class IdentifierHash;
44class Identifier;
45class SCT_ID;
47
52
53 public:
54 // Constructor
55 SCTCalibWriteTool(const std::string& type, const std::string& name, const IInterface* parent);
56
57 // overloading functions
58 virtual StatusCode initialize() override;
59
60 std::string
61 addDefect(const std::string& defectlist,const int defectBeginChannel,const int defectEndChannel) const;
62
63 std::string
64 addNumber(const std::string& numStr,const unsigned long long number) const;
65
66 std::string
67 createDefectString(const int defectBeginChannel,const int defectEndChannel) const;
68
69 StatusCode createCondObjects ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
70 (const Identifier& wafer_id,
71 const SCT_ID* m_sctId,
72 const int samplesize,
73 const std::string& defectType,
74 const float threshold,
75 const std::string& defectList) const;
76
77 StatusCode createListStrip ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
78 (const Identifier& wafer_id,
79 const SCT_ID* m_sctId,
80 const int samplesize,
81 const std::string& defectType,
82 const float threshold,
83 const std::string& defectList) const;
84
85 StatusCode createListChip ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
86 (const Identifier& wafer_id,
87 const SCT_ID* m_sctId,
88 const int samplesize,
89 const std::string& defectType,
90 const float threshold,
91 const std::string& defectList) const;
92
93 StatusCode createListEff ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
94 (const Identifier& wafer_id,
95 const SCT_ID* m_sctId,
96 const int samplesize,
97 const float eff) const;
98
99 StatusCode createListNO ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
100 (const Identifier& wafer_id,
101 const SCT_ID* m_sctId,
102 const int samplesize,
103 const float noise_occ) const;
104
105 StatusCode createListRawOccu ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
106 (const Identifier& wafer_id,
107 const SCT_ID* m_sctId,
108 const int samplesize,
109 const float raw_occu) const;
110
111 StatusCode createListBSErr ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
112 (const Identifier& wafer_id,
113 const SCT_ID* m_sctId,
114 const int samplesize,
115 const std::string& errorList,
116 const std::string& probList) const ;
117
118 StatusCode createListLA ATLAS_NOT_THREAD_SAFE // Thread unsafe CondAttrListCollection::add is used.
119 (const Identifier& wafer_id,
120 const SCT_ID* m_sctId,
121 const int samplesize,
122 const int module,
123 const float lorentz,
124 const float err_lorentz,
125 const float chisq,
126 const float fitParam_a,
127 const float err_a,
128 const float fitParam_b,
129 const float err_b,
130 const float fitParam_sigma,
131 const float err_sigma,
132 const float MCW,
133 const float err_MCW) const;
134
135 StatusCode wrapUpNoisyChannel();
136 StatusCode wrapUpDeadStrips();
137 StatusCode wrapUpDeadChips();
138 StatusCode wrapUpEfficiency();
139 StatusCode wrapUpNoiseOccupancy();
140 StatusCode wrapUpRawOccupancy();
141 StatusCode wrapUpBSErrors();
142 StatusCode wrapUpLorentzAngle();
143
144 private:
145 int stringToInt(const std::string& s) const;
146
147 StatusCode streamOutCondObjects(const std::string& foldername);
148 StatusCode streamOutCondObjectsWithErrMsg(const std::string& foldername);
149
150 StatusCode registerCondObjects(const std::string& foldername,const std::string& tagname) const;
151 StatusCode recordAndStream(std::unique_ptr<CondAttrListCollection> pCollection,const std::string& foldername, bool& flag);
152 StatusCode registerCondObjectsWithErrMsg(const std::string& foldername,const std::string& tagname) const;
153
154 coral::AttributeListSpecification* createBasicDbSpec(const bool capsFormat) const;
155 void setBasicValues(coral::AttributeList& attrList, const Identifier& wafer_id, const int samplesize,const SCT_ID* m_sctId, const bool capsFormat) const;
156 // small helper function
157 unsigned int computeIstrip4moncond(const Identifier& elementId) const;
158
159 const CondAttrListCollection* getAttrListCollectionByFolder(const std::string&) const;
160
161 // would it make sense to change the strings to properties?
162 // that would be a fairly simple fix
163 static const std::string s_separator;
164 static const std::string s_defectFolderName;
165 static const std::string s_deadStripFolderName;
166 static const std::string s_deadChipFolderName;
167 static const std::string s_effFolderName;
168 static const std::string s_noFolderName;
169 static const std::string s_RawOccuFolderName;
170 static const std::string s_BSErrFolderName;
171 static const std::string s_LAFolderName;
172
173 // cache for the Collections, access by foldername
174 mutable std::mutex m_mutex{};
175 mutable std::map<const std::string, const CondAttrListCollection*> m_attrListCollectionMap ATLAS_THREAD_SAFE; // Guarded by m_mutex
176 std::unique_ptr<CondAttrListCollection> m_attrListColl;
177 std::unique_ptr<CondAttrListCollection> m_attrListColl_deadStrip;
178 std::unique_ptr<CondAttrListCollection> m_attrListColl_deadChip;
179 std::unique_ptr<CondAttrListCollection> m_attrListColl_eff;
180 std::unique_ptr<CondAttrListCollection> m_attrListColl_no;
181 std::unique_ptr<CondAttrListCollection> m_attrListColl_RawOccu;
182 std::unique_ptr<CondAttrListCollection> m_attrListColl_BSErr;
183 std::unique_ptr<CondAttrListCollection> m_attrListColl_LA;
184 BooleanProperty m_writeCondObjs{this, "WriteCondObjs", true};
185 BooleanProperty m_regIOV{this, "RegisterIOV", true};
186 BooleanProperty m_readWriteCool{this, "ReadWriteCool", true};
187 BooleanProperty m_twoStepWriteReg{this, "TwoStepWriteReg", false};
188 BooleanProperty m_manualiov{this, "ManualIOV", true};
189 IntegerProperty m_version{this, "Version", 0};
190 IntegerProperty m_beginRun{this, "BeginRun", IOVTime::MINRUN};
191 IntegerProperty m_endRun{this, "EndRun", IOVTime::MAXRUN};
192 StringProperty m_streamName{this, "StreamName", "SCTCalibStream"};
193 StringProperty m_tagID4NoisyStrips{this, "TagID4NoisyStrips", ""};
194 StringProperty m_tagID4DeadStrips{this, "TagID4DeadStrips", ""};
195 StringProperty m_tagID4DeadChips{this, "TagID4DeadChips", ""};
196 StringProperty m_tagID4Efficiency{this, "TagID4Efficiency", ""};
197 StringProperty m_tagID4NoiseOccupancy{this, "TagID4NoiseOccupancy", ""};
198 StringProperty m_tagID4RawOccupancy{this, "TagID4RawOccupancy", ""};
199 StringProperty m_tagID4BSErrors{this, "TagID4BSErrors", ""};
200 StringProperty m_tagID4LorentzAngle{this, "TagID4LorentzAngle", ""};
201
203 ToolHandle<IAthenaOutputStreamTool> m_streamer{nullptr};
205
206 bool m_defectRecorded{false};
209 bool m_effRecorded{false};
210 bool m_noRecorded{false};
211 bool m_RawOccuRecorded{false};
212 bool m_BSErrRecorded{false};
213 bool m_LARecorded{false};
214 const SCT_ID* m_pHelper{nullptr};
215
216};
217
218#endif // SCTCalibWriteTool.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
Interface to an output stream tool.
Abstract interface to IOVDbSvc to access IOVRange and tag information.
This is an interface to a tool used to register conditions objects in the Interval of Validity (IOV) ...
Basic time unit for IOVSvc.
Header containing the InDetHierarchy enum, to avoid pulling in a class every time it is needed and na...
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
This class is a collection of AttributeLists where each one is associated with a channel number.
This is a tool that allows streaming out of DataObjects.
static constexpr uint32_t MAXRUN
Definition IOVTime.h:48
static constexpr uint32_t MINRUN
Definition IOVTime.h:44
This is a "hash" representation of an Identifier.
IntegerProperty m_version
BooleanProperty m_twoStepWriteReg
StatusCode registerCondObjectsWithErrMsg(const std::string &foldername, const std::string &tagname) const
static const std::string s_defectFolderName
static const std::string s_deadChipFolderName
std::unique_ptr< CondAttrListCollection > m_attrListColl
static const std::string s_separator
StatusCode wrapUpNoiseOccupancy()
std::unique_ptr< CondAttrListCollection > m_attrListColl_deadStrip
int stringToInt(const std::string &s) const
static const std::string s_LAFolderName
BooleanProperty m_readWriteCool
StatusCode wrapUpDeadStrips()
const SCT_ID * m_pHelper
StringProperty m_tagID4NoiseOccupancy
std::unique_ptr< CondAttrListCollection > m_attrListColl_LA
std::unique_ptr< CondAttrListCollection > m_attrListColl_no
StatusCode wrapUpEfficiency()
std::unique_ptr< CondAttrListCollection > m_attrListColl_RawOccu
BooleanProperty m_regIOV
static const std::string s_effFolderName
static const std::string s_BSErrFolderName
std::map< const std::string, const CondAttrListCollection * > m_attrListCollectionMap ATLAS_THREAD_SAFE
ServiceHandle< IIOVRegistrationSvc > m_regSvc
StatusCode createCondObjects ATLAS_NOT_THREAD_SAFE(const Identifier &wafer_id, const SCT_ID *m_sctId, const int samplesize, const std::string &defectType, const float threshold, const std::string &defectList) const
StringProperty m_tagID4DeadChips
StatusCode wrapUpNoisyChannel()
StringProperty m_tagID4DeadStrips
static const std::string s_deadStripFolderName
SCTCalibWriteTool(const std::string &type, const std::string &name, const IInterface *parent)
static const std::string s_RawOccuFolderName
ToolHandle< IAthenaOutputStreamTool > m_streamer
IntegerProperty m_endRun
StatusCode wrapUpLorentzAngle()
std::unique_ptr< CondAttrListCollection > m_attrListColl_BSErr
StringProperty m_tagID4Efficiency
IntegerProperty m_beginRun
std::string addNumber(const std::string &numStr, const unsigned long long number) const
StringProperty m_tagID4LorentzAngle
StringProperty m_streamName
StatusCode streamOutCondObjectsWithErrMsg(const std::string &foldername)
StatusCode recordAndStream(std::unique_ptr< CondAttrListCollection > pCollection, const std::string &foldername, bool &flag)
coral::AttributeListSpecification * createBasicDbSpec(const bool capsFormat) const
std::string addDefect(const std::string &defectlist, const int defectBeginChannel, const int defectEndChannel) const
BooleanProperty m_manualiov
StatusCode wrapUpRawOccupancy()
void setBasicValues(coral::AttributeList &attrList, const Identifier &wafer_id, const int samplesize, const SCT_ID *m_sctId, const bool capsFormat) const
std::unique_ptr< CondAttrListCollection > m_attrListColl_deadChip
const CondAttrListCollection * getAttrListCollectionByFolder(const std::string &) const
std::unique_ptr< CondAttrListCollection > m_attrListColl_eff
StringProperty m_tagID4BSErrors
StringProperty m_tagID4NoisyStrips
StringProperty m_tagID4RawOccupancy
virtual StatusCode initialize() override
std::string createDefectString(const int defectBeginChannel, const int defectEndChannel) const
StatusCode streamOutCondObjects(const std::string &foldername)
static const std::string s_noFolderName
unsigned int computeIstrip4moncond(const Identifier &elementId) const
StatusCode registerCondObjects(const std::string &foldername, const std::string &tagname) const
ServiceHandle< IIOVDbSvc > m_IOVDbSvc
BooleanProperty m_writeCondObjs
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186