ATLAS Offline Software
RtDataFromFile.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONCALIB_RTDATAFROMFILE_H
6 #define MUONCALIB_RTDATAFROMFILE_H
7 
8 #include <iostream>
9 #include <vector>
10 
12 #include "GaudiKernel/MsgStream.h"
15 
16 namespace MuonCalib {
17 
22  public:
24  typedef std::vector<RtRelation*> RtRelations;
25 
26  public:
28  ~RtDataFromFile() = default;
29 
31  unsigned int nRts() const { return m_rts; }
32 
34  RtRelation* getRt(unsigned int regionId) const {
35  if (regionId >= (unsigned int)m_rts) {
36  MsgStream log(Athena::getMessageSvc(), "RtDataFromFile");
37  log << MSG::WARNING << "getRt() <regionId out of range> " << regionId << " size " << m_rts << endmsg;
38  return 0;
39  }
40  return m_rtRelations[regionId];
41  }
42 
44  void setNRts(unsigned int nrts) {
45  m_rts = nrts;
46  m_rtRelations.resize(nrts);
47  m_fullInfo.resize(nrts);
48  }
49 
51  bool addRt(int regionId, RtRelation* rt) {
52  if (regionId < 0 || regionId >= (int)m_rts) {
53  MsgStream log(Athena::getMessageSvc(), "RtDataFromFile");
54  log << MSG::WARNING << "addRt() <regionId out of range> " << regionId << " size " << m_rts << endmsg;
55  return false;
56  }
57  if (m_rtRelations[regionId] != 0) {
58  MsgStream log(Athena::getMessageSvc(), "RtDataFromFile");
59  log << MSG::WARNING << "addRt() <rt already set>" << endmsg;
60  return false;
61  }
62 
63  m_rtRelations[regionId] = rt;
64 
65  return true;
66  }
67  bool addRt(int regionId, RtRelation* rt, const RtFullInfo* info) {
68  bool result = addRt(regionId, rt);
69  if (result) { m_fullInfo[regionId] = info; }
70  return result;
71  }
72  std::istream& read(std::istream& is);
73  std::ostream& write(std::ostream& os, int region) const;
74  std::ostream& write(std::ostream& os) const;
75  void write_forDB(FILE* frt, FILE* frtt, FILE* frtr, FILE* frts, int region) const;
76  void write_forDB(FILE* frt, FILE* frtt, FILE* frtr, FILE* frts) const;
77  inline void setVersion(int major, int minor) {
78  m_major_version = major;
79  m_minor_version = minor;
80  }
81 
82  private:
84  unsigned int m_rts;
85 
88  std::vector<const RtFullInfo*> m_fullInfo;
91  };
92 
93 } // namespace MuonCalib
94 
95 std::istream& operator>>(std::istream& is, MuonCalib::RtDataFromFile& data);
96 
97 std::ostream& operator<<(std::ostream& os, const MuonCalib::RtDataFromFile& data);
98 
99 #endif
grepfile.info
info
Definition: grepfile.py:38
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
get_generator_info.result
result
Definition: get_generator_info.py:21
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
MuonCalib::RtDataFromFile::RtRelation
RtData_t_r_reso RtRelation
Definition: RtDataFromFile.h:23
MuonCalib::RtDataFromFile::write
std::ostream & write(std::ostream &os, int region) const
Definition: RtDataFromFile.cxx:55
MuonCalib::RtDataFromFile
Manages the I/O of the Rt realtions from/to file.
Definition: RtDataFromFile.h:21
MuonCalib::RtDataFromFile::m_major_version
int m_major_version
format version
Definition: RtDataFromFile.h:90
MuonCalib::RtDataFromFile::nRts
unsigned int nRts() const
return number of rt relations
Definition: RtDataFromFile.h:31
MuonCalib::RtDataFromFile::getRt
RtRelation * getRt(unsigned int regionId) const
retrieve rt-relation for a give regionId
Definition: RtDataFromFile.h:34
MuonCalib::RtDataFromFile::RtDataFromFile
RtDataFromFile()
Definition: RtDataFromFile.h:27
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::RtDataFromFile::RtRelations
std::vector< RtRelation * > RtRelations
Definition: RtDataFromFile.h:24
RtFullInfo.h
operator>>
std::istream & operator>>(std::istream &is, MuonCalib::RtDataFromFile &data)
Definition: RtDataFromFile.cxx:115
operator<<
std::ostream & operator<<(std::ostream &os, const MuonCalib::RtDataFromFile &data)
Definition: RtDataFromFile.cxx:117
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonCalib::RtDataFromFile::addRt
bool addRt(int regionId, RtRelation *rt, const RtFullInfo *info)
Definition: RtDataFromFile.h:67
MuonCalib::RtDataFromFile::m_rtRelations
RtRelations m_rtRelations
rt relations
Definition: RtDataFromFile.h:87
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MuonCalib::RtDataFromFile::addRt
bool addRt(int regionId, RtRelation *rt)
RtDataFromFile takes ownership of rt.
Definition: RtDataFromFile.h:51
MuonCalib::RtFullInfo
addiitonal information used in validation of a rt-relation
Definition: RtFullInfo.h:15
MuonCalib::RtDataFromFile::m_rts
unsigned int m_rts
total number of regions
Definition: RtDataFromFile.h:84
MuonCalib::RtDataFromFile::setNRts
void setNRts(unsigned int nrts)
set total number of regions
Definition: RtDataFromFile.h:44
MuonCalib::RtDataFromFile::~RtDataFromFile
~RtDataFromFile()=default
MuonCalib::RtDataFromFile::m_minor_version
int m_minor_version
Definition: RtDataFromFile.h:90
MuonCalib::RtDataFromFile::write_forDB
void write_forDB(FILE *frt, FILE *frtt, FILE *frtr, FILE *frts, int region) const
Definition: RtDataFromFile.cxx:86
MuonCalib::RtDataFromFile::setVersion
void setVersion(int major, int minor)
Definition: RtDataFromFile.h:77
MuonCalib::RtDataFromFile::read
std::istream & read(std::istream &is)
Definition: RtDataFromFile.cxx:18
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::RtDataFromFile::m_fullInfo
std::vector< const RtFullInfo * > m_fullInfo
Definition: RtDataFromFile.h:88
MuonCalib::RtData_t_r_reso
Represents an Rt relation in the form of a set of (time,radius,resolution) points.
Definition: RtData_t_r_reso.h:16
RtData_t_r_reso.h