ATLAS Offline Software
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 
16 namespace MuonCalib {
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 
85 std::ostream& operator<<(std::ostream& os, const MuonCalib::TubeDataFromFile& data);
86 
87 #endif
MuonCalib::TubeDataFromFile::m_regions
unsigned int m_regions
total number of regions
Definition: TubeDataFromFile.h:77
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
MuonCalib::TubeDataFromFile::TubeDataFromFile
TubeDataFromFile()=default
MuonCalib::TubeDataFromFile
Definition: TubeDataFromFile.h:24
MdtTubeFitContainer.h
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::TubeDataFromFile::setNRegions
void setNRegions(unsigned int n)
set total number of regions
Definition: TubeDataFromFile.h:47
MuonCalib::TubeDataFromFile::write
std::ostream & write(std::ostream &os) const
Definition: TubeDataFromFile.cxx:17
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
calibdata.uprun
uprun
Definition: calibdata.py:34
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::TubeDataFromFile::write_forDB
std::ostream & write_forDB(std::ostream &ftube, int mdt_head, int lowrun, int uprun) const
Definition: TubeDataFromFile.cxx:80
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MuonCalib::TubeDataFromFile::addTubes
bool addTubes(int regionId, const MdtTubeFitContainer *tubes)
TubeDataFromFile takes ownership of the MdtTubeFitContainer.
Definition: TubeDataFromFile.h:53
MuonCalib::TubeDataFromFile::m_tubeData
TubeData m_tubeData
data
Definition: TubeDataFromFile.h:80
calibdata.lowrun
lowrun
Definition: calibdata.py:33
MuonCalib::MdtTubeFitContainer
Holds single-tube full calibration information of one chamber.
Definition: MdtTubeFitContainer.h:16
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::TubeDataFromFile::~TubeDataFromFile
~TubeDataFromFile()=default
MuonCalib::TubeDataFromFile::nRegions
unsigned int nRegions() const
return number of regions
Definition: TubeDataFromFile.h:33
operator<<
std::ostream & operator<<(std::ostream &os, const MuonCalib::TubeDataFromFile &data)
Definition: TubeDataFromFile.cxx:187
MuonCalib::TubeDataFromFile::TubeData
std::vector< const MdtTubeFitContainer * > TubeData
Definition: TubeDataFromFile.h:26
MuonFixedId.h
MuonCalib::TubeDataFromFile::getTubes
const MdtTubeFitContainer * getTubes(unsigned int regionId) const
retrieve MdtTubeFitContainer for a give regionId
Definition: TubeDataFromFile.h:36