ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::CoolInserter Class Reference

#include <CoolInserter.h>

Inheritance diagram for MuonCalib::CoolInserter:

Public Member Functions

 CoolInserter (const std::string &name, ISvcLocator *pSvcLocator)
 ~CoolInserter ()=default
StatusCode initialize ()
 Is called at the beginning of the analysis.
StatusCode execute ()
 execute function NOTE: This will read all events at once
StatusCode finalize ()
 finalize functions
bool CoolConnect (const std::string &connection_string, const std::string &tag_t0)
bool StartT0Chamber (const NtupleStationId &sid)
bool AppendT0 (float t0, int validflag, float adc0)
bool StoreT0Chamber (const NtupleStationId &id, const std::string &file, unsigned int creation_flags=0)
bool StoreRtChamber (const NtupleStationId &id, const std::map< int, SamplePoint > &points, const std::string &file, unsigned int creation_flags=0)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool create_folder (const unsigned int &fldr_nr, const bool &is_rt)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_version
std::vector< std::string > m_tagt0
std::vector< std::string > m_tagrt
int m_iov_start = 0
int m_iov_end = 0
long long m_iovt_start
long long m_iovt_end
std::string m_cool_connection_string
std::vector< std::string > m_t0_folder
std::vector< std::string > m_rt_folder
std::vector< bool > m_compressed_t0
std::vector< bool > m_compressed_rt
ToolHandleArray< IMuonCalibConditionsSourcem_calibration_sources {this, "CalibrationSources", {}}
ServiceHandle< RegionSelectionSvcm_reg_sel_svc
cool::IDatabasePtr m_db
std::vector< cool::IFolderPtr > m_mdtt0_fld
std::vector< cool::IFolderPtr > m_mdtrt_fld
cool::Application m_app
std::map< bool, coral::AttributeList > m_mdtt0_cool_row
std::map< bool, coral::AttributeList > m_mdtrt_cool_row
bool m_cool_connect
bool m_t0_created
bool m_rt_created
std::set< NtupleStationIdm_t0_filled
std::set< NtupleStationIdm_rt_filled
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_DetectorManagerKey
std::ostringstream m_data_string
int m_n_tubes_added
int m_n_tubes_chamber
float m_aver_t0
float m_aver_adc
NtupleStationId m_sid
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 32 of file CoolInserter.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CoolInserter()

MuonCalib::CoolInserter::CoolInserter ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 39 of file CoolInserter.cxx.

39 :
40 AthAlgorithm(name, pSvcLocator),
41 m_version("v0.0"),
42 m_reg_sel_svc("RegionSelectionSvc", name),
43 m_cool_connect(false),
44 m_t0_created(false),
45 m_rt_created(false) {
46 declareProperty("CoolConnectionString", m_cool_connection_string);
47 declareProperty("RtVersion", m_version);
48 declareProperty("T0Tag", m_tagt0);
49 declareProperty("RtTag", m_tagrt);
50 declareProperty("IOVStart", m_iov_start);
51 declareProperty("IOVEnd", m_iov_end);
52 declareProperty("T0Folder", m_t0_folder);
53 declareProperty("RtFolder", m_rt_folder);
54 declareProperty("T0FolderCompress", m_compressed_t0);
55 declareProperty("RtFolderCompress", m_compressed_rt);
58 m_iovt_start = 0;
59 m_iovt_end = 0;
60 m_aver_t0 = 0;
61 m_aver_adc = 0;
62 }
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< std::string > m_t0_folder
std::vector< std::string > m_tagrt
std::vector< bool > m_compressed_rt
std::string m_cool_connection_string
std::vector< bool > m_compressed_t0
ServiceHandle< RegionSelectionSvc > m_reg_sel_svc
std::vector< std::string > m_tagt0
std::vector< std::string > m_rt_folder

◆ ~CoolInserter()

MuonCalib::CoolInserter::~CoolInserter ( )
inlinedefault

Member Function Documentation

◆ AppendT0()

bool MuonCalib::CoolInserter::AppendT0 ( float t0,
int validflag,
float adc0 )

Definition at line 184 of file CoolInserter.cxx.

184 {
185 if (m_n_tubes_added >= m_n_tubes_chamber) { return false; }
186 m_data_string << t0 << "," << validflag << "," << adc0 << ",";
188 m_aver_t0 += t0;
189 m_aver_adc += adc0;
190 return true;
191 }
static Double_t t0
std::ostringstream m_data_string

◆ CoolConnect()

bool MuonCalib::CoolInserter::CoolConnect ( const std::string & connection_string,
const std::string & tag_t0 )

◆ create_folder()

bool MuonCalib::CoolInserter::create_folder ( const unsigned int & fldr_nr,
const bool & is_rt )
inlineprivate

Definition at line 319 of file CoolInserter.cxx.

319 {
320 std::string folder;
321 std::string description;
322 if (is_rt) {
323 folder = m_rt_folder[fldr_nr];
324 description = std::string(
325 "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" "
326 "/></addrHeader><typeName>CondAttrListCollection</typeName><key>") +
327 folder + "</key>";
328 } else {
329 folder = m_t0_folder[fldr_nr];
330 description = std::string(
331 "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" "
332 "/></addrHeader><typeName>CondAttrListCollection</typeName><key>") +
333 folder + "</key>";
334 }
335
336 bool compressed(false);
337 if (is_rt) {
338 if (m_compressed_rt.size() > fldr_nr)
339 if (m_compressed_rt[fldr_nr]) compressed = true;
340 } else {
341 if (m_compressed_t0.size() > fldr_nr)
342 if (m_compressed_t0[fldr_nr]) compressed = true;
343 }
344 cool::RecordSpecification spec;
345 spec.extend("tech", cool::StorageType::Int32);
346 if (compressed) {
347 spec.extend("file", cool::StorageType::String255);
348 spec.extend("data", cool::StorageType::Blob64k);
349 } else {
350 spec.extend("file", cool::StorageType::String4k);
351 if (is_rt) {
352 spec.extend("data", cool::StorageType::String4k);
353 } else {
354 spec.extend("data", cool::StorageType::String16M);
355 }
356 }
357 cool::FolderSpecification fspec(cool::FolderVersioning::MULTI_VERSION, spec);
358 m_db->createFolder(folder, fspec, description, true);
359 return true;
360 }
cool::IDatabasePtr m_db
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonCalib::CoolInserter::execute ( )

execute function NOTE: This will read all events at once

Definition at line 143 of file CoolInserter.cxx.

143 {
144 for (unsigned int i = 0; i < m_calibration_sources.size(); i++) {
145 ATH_MSG_INFO("Now running " << m_calibration_sources[i]);
146 if (!m_calibration_sources[i]->InstertCalibration(this, static_cast<bool>(m_t0_folder.size()),
147 static_cast<bool>(m_rt_folder.size()))) {
148 ATH_MSG_FATAL("Calibration Source " << m_calibration_sources[i].name() << " failed!");
149 return StatusCode::FAILURE;
150 }
151 }
152 return StatusCode::SUCCESS;
153 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
ToolHandleArray< IMuonCalibConditionsSource > m_calibration_sources

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode MuonCalib::CoolInserter::finalize ( )

finalize functions

Definition at line 131 of file CoolInserter.cxx.

131 {
132 ATH_MSG_INFO("finalizing ");
133 try {
134 for (auto & i : m_mdtt0_fld) i->flushStorageBuffer();
135 for (auto & i : m_mdtrt_fld) i->flushStorageBuffer();
136 } catch (std::exception &e) {
137 ATH_MSG_FATAL("Exception in finalize: " << e.what());
138 return StatusCode::FAILURE;
139 }
140 return StatusCode::SUCCESS;
141 }
std::vector< cool::IFolderPtr > m_mdtt0_fld
std::vector< cool::IFolderPtr > m_mdtrt_fld

◆ initialize()

StatusCode MuonCalib::CoolInserter::initialize ( )

Is called at the beginning of the analysis.

Definition at line 64 of file CoolInserter.cxx.

64 {
65 // check jo
66 if (m_tagt0.size() != m_t0_folder.size() || m_tagrt.size() != m_rt_folder.size()) {
67 ATH_MSG_FATAL("Configuration error: Number of folders and tags do not match!");
68 return StatusCode::FAILURE;
69 }
70
71 ATH_CHECK(m_idHelperSvc.retrieve());
72
73 ATH_CHECK(m_DetectorManagerKey.initialize());
74
75 // get region selection service
76 ATH_CHECK(m_reg_sel_svc.retrieve());
77
78 // connect to cool database
79 try {
80 m_db = m_app.databaseService().openDatabase(m_cool_connection_string, false);
81 } catch (cool::DatabaseDoesNotExist &e) {
82 ATH_MSG_INFO("Creating new database.");
83 try {
84 m_db = m_app.databaseService().createDatabase(m_cool_connection_string);
85 } catch (cool::Exception &e) {
86 ATH_MSG_FATAL("Cannot create database and datbasae does not exist!");
87 return StatusCode::FAILURE;
88 }
89 }
90 m_cool_connect = true;
91 if (m_t0_folder.size()) {
92 ATH_MSG_INFO("Replication into t0 folders: ");
93 for (unsigned int i = 0; i < m_t0_folder.size(); i++) { ATH_MSG_INFO(m_t0_folder[i] << "(" << m_tagt0[i] << ") "); }
94 }
95 if (m_rt_folder.size()) {
96 ATH_MSG_INFO("Replication into rt folders: ");
97 for (unsigned int i = 0; i < m_rt_folder.size(); i++) { ATH_MSG_INFO(m_rt_folder[i] << "(" << m_tagrt[i] << ") "); }
98 }
99 // retrieve calibration sources
101
102 // get iov
103 for (unsigned int i = 0; i < m_calibration_sources.size(); i++) {
104 int iov_start(-1), iov_end(-1);
105 m_calibration_sources[i]->SetIOV(iov_start, iov_end);
107 if (m_iov_end == -1 && iov_end != -1) m_iov_end = iov_end;
108 }
109 if (m_iov_start < 0 || m_iov_end == -1) {
110 ATH_MSG_FATAL("IOV has to be set, if no calibration source provides it!");
111 return StatusCode::FAILURE;
112 }
113 IOVTime start(m_iov_start, 0);
114 m_iovt_start = start.re_time();
115 if (m_iov_end < -1) {
116 IOVTime end(IOVTime::MAXTIMESTAMP);
117 m_iovt_end = end.timestamp();
118 } else {
119 IOVTime end(m_iov_end, 0);
120 m_iovt_end = end.re_time();
121 }
122 ATH_MSG_INFO("IOV is " << m_iov_start << " to " << m_iov_end);
123 // fill compressed flags
124 if (m_compressed_t0.size() < m_t0_folder.size())
125 for (unsigned int i = m_compressed_t0.size(); i < m_t0_folder.size(); i++) m_compressed_t0.push_back(false);
126 if (m_compressed_rt.size() < m_rt_folder.size())
127 for (unsigned int i = m_compressed_rt.size(); i < m_rt_folder.size(); i++) m_compressed_rt.push_back(false);
128 return StatusCode::SUCCESS;
129 }
#define ATH_CHECK
Evaluate an expression and check for errors.
static constexpr uint64_t MAXTIMESTAMP
Definition IOVTime.h:58
cool::Application m_app
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ StartT0Chamber()

bool MuonCalib::CoolInserter::StartT0Chamber ( const NtupleStationId & sid)

Definition at line 155 of file CoolInserter.cxx.

155 {
156 m_n_tubes_added = 0;
157 m_sid = sid;
158 m_sid.SetMultilayer(0);
159
160 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
161 const MuonGM::MuonDetectorManager *MuonDetMgr = DetectorManagerHandle.cptr();
162 if (MuonDetMgr == nullptr) {
163 ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
164 return false;
165 }
166
167 if (!m_sid.InitializeGeometry(m_idHelperSvc->mdtIdHelper(), MuonDetMgr)) return false;
168 // get number of tubes
169 int max_nly(-1);
170 int max_ntb(-1);
171 for (int ml = 0; ml < m_sid.NMultilayers(); ml++) {
172 if (max_nly < m_sid.NLayers(ml)) max_nly = m_sid.NLayers(ml);
173 if (max_ntb < m_sid.NTubes(ml)) max_ntb = m_sid.NTubes(ml);
174 }
175 m_n_tubes_chamber = max_nly * max_ntb * m_sid.NMultilayers();
176 m_data_string.str("");
177 m_data_string.clear();
178 m_data_string << "T0" << m_sid.regionId() << "," << m_version << ",1," << m_n_tubes_chamber << std::endl;
179 m_aver_t0 = 0;
180 m_aver_adc = 0;
181 return true;
182 }
#define ATH_MSG_ERROR(x)
NtupleStationId m_sid
const_pointer_type cptr()

◆ StoreRtChamber()

bool MuonCalib::CoolInserter::StoreRtChamber ( const NtupleStationId & id,
const std::map< int, SamplePoint > & points,
const std::string & file,
unsigned int creation_flags = 0 )

Definition at line 250 of file CoolInserter.cxx.

251 {
252 // generate fixed if for chamber
253 MuonFixedId fid(id.FixedId());
254 if (!m_reg_sel_svc->isInRegion(fid)) { return true; }
255 // check for duplicates
256 NtupleStationId id_cp(id);
257 bool found[3];
258 for (int i = 0; i < 3; i++) {
259 id_cp.SetMultilayer(i);
260 found[i] = (m_rt_filled.find(id_cp) != m_rt_filled.end());
261 }
262 if (id.GetMl() == 0) {
263 if (found[0] || (found[1] && found[2])) return true;
264 if (found[1]) { id_cp.SetMultilayer(2); }
265 if (found[2]) { id_cp.SetMultilayer(1); }
266 if (!found[1] && !found[2]) { id_cp.SetMultilayer(0); }
267 }
268 if (id.GetMl() != 0) {
269 if (found[0] || found[id.GetMl()]) return true;
270 }
271 m_rt_filled.insert(id_cp);
273 for (unsigned int i = 0; i < m_rt_folder.size(); i++) {
274 if (!m_db->existsFolder(m_rt_folder[i])) {
275 if (!create_folder(i, true)) {
276 ATH_MSG_FATAL("Cannot create folder '" << m_rt_folder[i] << "'!");
277 return false;
278 }
279 }
280 m_mdtrt_fld.push_back(m_db->getFolder(m_rt_folder[i]));
281 m_mdtrt_fld[i]->setupStorageBuffer();
282
283 cool::RecordSpecification mdtrt_rec = (m_mdtrt_fld[i]->payloadSpecification());
284 bool compressed(false);
285 if (m_compressed_rt.size() > i) compressed = m_compressed_rt[i];
286 m_mdtrt_cool_row[compressed] = cool::Record(mdtrt_rec).attributeList();
287 }
288 m_rt_created = true;
289 }
290 std::ostringstream data_column;
291 data_column << id_cp.FixedId() << "," << points.size() << std::endl;
292 for (const auto & point : points) {
293 data_column << point.second.x2() << "," << point.second.x1() << "," << point.second.error() << ",";
294 }
295 if (m_rt_created) {
296 for (auto & it : m_mdtrt_cool_row) {
297 it.second["tech"].data<int>() = creation_flags;
298 it.second["file"].data<cool::String4k>() = file;
299 if (it.first) {
300 uLongf dest_len = compressBound(data_column.str().size());
301 coral::Blob &blob(it.second["data"].data<coral::Blob>());
302 blob.resize(dest_len);
303 Bytef *p = static_cast<Bytef *>(blob.startingAddress());
304
305 compress(p, &dest_len, reinterpret_cast<const Bytef *>(data_column.str().c_str()), data_column.str().size());
306 blob.resize(dest_len);
307 } else {
308 it.second["data"].data<cool::String16M>() = data_column.str();
309 }
310 } // for(std::map<bool, coral::AttributeList> ...
311 for (unsigned int i = 0; i < m_mdtrt_fld.size(); i++) {
312 cool::ConstRecordAdapter record(m_mdtrt_fld[i]->payloadSpecification(), m_mdtrt_cool_row[m_compressed_rt[i]]);
313 m_mdtrt_fld[i]->storeObject(m_iovt_start, m_iovt_end, record, id_cp.FixedId(), m_tagrt[i]);
314 }
315 }
316 return true;
317 }
std::map< bool, coral::AttributeList > m_mdtrt_cool_row
std::set< NtupleStationId > m_rt_filled
bool create_folder(const unsigned int &fldr_nr, const bool &is_rt)
void compress(const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
TFile * file

◆ StoreT0Chamber()

bool MuonCalib::CoolInserter::StoreT0Chamber ( const NtupleStationId & id,
const std::string & file,
unsigned int creation_flags = 0 )

Definition at line 193 of file CoolInserter.cxx.

193 {
194 MuonFixedId fid(id.FixedId());
195 // generate fixed if for chamber
196 if (!m_reg_sel_svc->isInRegion(fid)) { return true; }
197 // do not fill double
198 if (m_t0_filled.find(id) != m_t0_filled.end()) { return true; }
199 m_t0_filled.insert(id);
200 // check number of added tubes
202 ATH_MSG_WARNING("Filling missing tubes with average for chamber" << m_sid.regionId());
205 for (int i = m_n_tubes_added; i < m_n_tubes_chamber; i++) { AppendT0(m_aver_t0, 5, m_aver_adc); }
206 }
207 // cool
209 for (unsigned int i = 0; i < m_t0_folder.size(); i++) {
210 if (!m_db->existsFolder(m_t0_folder[i])) {
211 if (!create_folder(i, false)) {
212 ATH_MSG_FATAL("Cannot create folder '" << m_t0_folder[i] << "'!");
213 return false;
214 }
215 }
216 m_mdtt0_fld.push_back(m_db->getFolder(m_t0_folder[i]));
217 m_mdtt0_fld[i]->setupStorageBuffer();
218
219 cool::RecordSpecification mdtt0_rec = (m_mdtt0_fld[i]->payloadSpecification());
220 bool compressed(false);
221 if (m_compressed_t0.size() > i) compressed = m_compressed_t0[i];
222 m_mdtt0_cool_row[compressed] = cool::Record(mdtt0_rec).attributeList();
223 }
224 m_t0_created = true;
225 }
226 if (m_t0_created) {
227 for (auto & it : m_mdtt0_cool_row) {
228 it.second["file"].data<cool::String4k>() = file;
229 it.second["tech"].data<int>() = creation_flags;
230 if (it.first) {
231 uLongf dest_len = compressBound(m_data_string.str().size());
232 coral::Blob &blob(it.second["data"].data<coral::Blob>());
233 blob.resize(dest_len);
234 Bytef *p = static_cast<Bytef *>(blob.startingAddress());
235
236 compress(p, &dest_len, reinterpret_cast<const Bytef *>(m_data_string.str().c_str()), m_data_string.str().size());
237 blob.resize(dest_len);
238 } else {
239 it.second["data"].data<cool::String16M>() = m_data_string.str();
240 }
241 for (unsigned int i = 0; i < m_mdtt0_fld.size(); i++) {
242 cool::ConstRecordAdapter record(m_mdtt0_fld[i]->payloadSpecification(), m_mdtt0_cool_row[m_compressed_t0[i]]);
243 m_mdtt0_fld[i]->storeObject(m_iovt_start, m_iovt_end, record, id.FixedId(), m_tagt0[i]);
244 }
245 }
246 }
247 return true;
248 }
#define ATH_MSG_WARNING(x)
bool AppendT0(float t0, int validflag, float adc0)
std::map< bool, coral::AttributeList > m_mdtt0_cool_row
std::set< NtupleStationId > m_t0_filled

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_app

cool::Application MuonCalib::CoolInserter::m_app
private

Definition at line 77 of file CoolInserter.h.

◆ m_aver_adc

float MuonCalib::CoolInserter::m_aver_adc
private

Definition at line 93 of file CoolInserter.h.

◆ m_aver_t0

float MuonCalib::CoolInserter::m_aver_t0
private

Definition at line 93 of file CoolInserter.h.

◆ m_calibration_sources

ToolHandleArray<IMuonCalibConditionsSource> MuonCalib::CoolInserter::m_calibration_sources {this, "CalibrationSources", {}}
private

Definition at line 70 of file CoolInserter.h.

70{this, "CalibrationSources", {}};

◆ m_compressed_rt

std::vector<bool> MuonCalib::CoolInserter::m_compressed_rt
private

Definition at line 68 of file CoolInserter.h.

◆ m_compressed_t0

std::vector<bool> MuonCalib::CoolInserter::m_compressed_t0
private

Definition at line 67 of file CoolInserter.h.

◆ m_cool_connect

bool MuonCalib::CoolInserter::m_cool_connect
private

Definition at line 81 of file CoolInserter.h.

◆ m_cool_connection_string

std::string MuonCalib::CoolInserter::m_cool_connection_string
private

Definition at line 62 of file CoolInserter.h.

◆ m_data_string

std::ostringstream MuonCalib::CoolInserter::m_data_string
private

Definition at line 90 of file CoolInserter.h.

◆ m_db

cool::IDatabasePtr MuonCalib::CoolInserter::m_db
private

Definition at line 74 of file CoolInserter.h.

◆ m_DetectorManagerKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> MuonCalib::CoolInserter::m_DetectorManagerKey
private
Initial value:
{this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}

Definition at line 87 of file CoolInserter.h.

87 {this, "DetectorManagerKey", "MuonDetectorManager",
88 "Key of input MuonDetectorManager condition data"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonCalib::CoolInserter::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 84 of file CoolInserter.h.

84{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_iov_end

int MuonCalib::CoolInserter::m_iov_end = 0
private

Definition at line 59 of file CoolInserter.h.

◆ m_iov_start

int MuonCalib::CoolInserter::m_iov_start = 0
private

Definition at line 59 of file CoolInserter.h.

◆ m_iovt_end

long long MuonCalib::CoolInserter::m_iovt_end
private

Definition at line 60 of file CoolInserter.h.

◆ m_iovt_start

long long MuonCalib::CoolInserter::m_iovt_start
private

Definition at line 60 of file CoolInserter.h.

◆ m_mdtrt_cool_row

std::map<bool, coral::AttributeList> MuonCalib::CoolInserter::m_mdtrt_cool_row
private

Definition at line 79 of file CoolInserter.h.

◆ m_mdtrt_fld

std::vector<cool::IFolderPtr> MuonCalib::CoolInserter::m_mdtrt_fld
private

Definition at line 76 of file CoolInserter.h.

◆ m_mdtt0_cool_row

std::map<bool, coral::AttributeList> MuonCalib::CoolInserter::m_mdtt0_cool_row
private

Definition at line 78 of file CoolInserter.h.

◆ m_mdtt0_fld

std::vector<cool::IFolderPtr> MuonCalib::CoolInserter::m_mdtt0_fld
private

Definition at line 75 of file CoolInserter.h.

◆ m_n_tubes_added

int MuonCalib::CoolInserter::m_n_tubes_added
private

Definition at line 91 of file CoolInserter.h.

◆ m_n_tubes_chamber

int MuonCalib::CoolInserter::m_n_tubes_chamber
private

Definition at line 92 of file CoolInserter.h.

◆ m_reg_sel_svc

ServiceHandle<RegionSelectionSvc> MuonCalib::CoolInserter::m_reg_sel_svc
private

Definition at line 72 of file CoolInserter.h.

◆ m_rt_created

bool MuonCalib::CoolInserter::m_rt_created
private

Definition at line 81 of file CoolInserter.h.

◆ m_rt_filled

std::set<NtupleStationId> MuonCalib::CoolInserter::m_rt_filled
private

Definition at line 83 of file CoolInserter.h.

◆ m_rt_folder

std::vector<std::string> MuonCalib::CoolInserter::m_rt_folder
private

Definition at line 65 of file CoolInserter.h.

◆ m_sid

NtupleStationId MuonCalib::CoolInserter::m_sid
private

Definition at line 94 of file CoolInserter.h.

◆ m_t0_created

bool MuonCalib::CoolInserter::m_t0_created
private

Definition at line 81 of file CoolInserter.h.

◆ m_t0_filled

std::set<NtupleStationId> MuonCalib::CoolInserter::m_t0_filled
private

Definition at line 83 of file CoolInserter.h.

◆ m_t0_folder

std::vector<std::string> MuonCalib::CoolInserter::m_t0_folder
private

Definition at line 64 of file CoolInserter.h.

◆ m_tagrt

std::vector<std::string> MuonCalib::CoolInserter::m_tagrt
private

Definition at line 57 of file CoolInserter.h.

◆ m_tagt0

std::vector<std::string> MuonCalib::CoolInserter::m_tagt0
private

Definition at line 56 of file CoolInserter.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_version

std::string MuonCalib::CoolInserter::m_version
private

Definition at line 54 of file CoolInserter.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: