ATLAS Offline Software
Loading...
Searching...
No Matches
TubeDataFromFile.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONCALIB_TUBEDATAFROMFILE_H
6#define MUONCALIB_TUBEDATAFROMFILE_H
7
8#include <iostream>
9#include <vector>
10
12#include "GaudiKernel/MsgStream.h"
15
16namespace MuonCalib {
23
25 public:
26 using TubeData = std::vector<const MdtTubeFitContainer*>;
27
28 public:
29 TubeDataFromFile() = default;
30 ~TubeDataFromFile() = default;
31
33 unsigned int nRegions() const { return m_regions; }
34
36 const MdtTubeFitContainer* getTubes(unsigned int regionId) const {
37 if (regionId >= (unsigned int)m_regions) {
38 MsgStream log(Athena::getMessageSvc(), "MdtTubeFitContainer");
39 log << MSG::WARNING << "TubeDataFromFile::getTubes: <regionId out of range> " << regionId << " size " << m_regions
40 << endmsg;
41 return nullptr;
42 }
43 return m_tubeData[regionId];
44 }
45
47 void setNRegions(unsigned int n) {
48 m_regions = n;
49 m_tubeData.resize(n);
50 }
51
53 bool addTubes(int regionId, const MdtTubeFitContainer* tubes) {
54 if (regionId < 0 || regionId >= (int)m_regions) {
55 MsgStream log(Athena::getMessageSvc(), "MdtTubeFitContainer");
56 log << MSG::WARNING << "TubeDataFromFile::addTubes: <regionId out of range> " << regionId << " size " << m_regions
57 << endmsg;
58 return false;
59 }
60 if (m_tubeData[regionId] != 0) {
61 MsgStream log(Athena::getMessageSvc(), "MdtTubeFitContainer");
62 log << MSG::WARNING << "TubeDataFromFile::addTubes: <tubes already set>" << endmsg;
63 return false;
64 }
65
66 m_tubeData[regionId] = tubes;
67
68 return true;
69 }
70
71 std::ostream& write(std::ostream& os) const;
72
73 std::ostream& write_forDB(std::ostream& ftube, int mdt_head, int lowrun, int uprun) const;
74
75 private:
77 unsigned int m_regions{0};
78
81 };
82
83} // namespace MuonCalib
84
85std::ostream& operator<<(std::ostream& os, const MuonCalib::TubeDataFromFile& data);
86
87#endif
#define endmsg
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::ostream & operator<<(std::ostream &os, const MuonCalib::TubeDataFromFile &data)
Holds single-tube full calibration information of one chamber.
Manage the I/O of MdtTubeFitContainer objects.
const MdtTubeFitContainer * getTubes(unsigned int regionId) const
retrieve MdtTubeFitContainer for a give regionId
void setNRegions(unsigned int n)
set total number of regions
bool addTubes(int regionId, const MdtTubeFitContainer *tubes)
TubeDataFromFile takes ownership of the MdtTubeFitContainer.
unsigned int nRegions() const
return number of regions
std::vector< const MdtTubeFitContainer * > TubeData
std::ostream & write(std::ostream &os) const
unsigned int m_regions
total number of regions
std::ostream & write_forDB(std::ostream &ftube, int mdt_head, int lowrun, int uprun) const
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.