ATLAS Offline Software
Loading...
Searching...
No Matches
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
16namespace 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
95std::istream& operator>>(std::istream& is, MuonCalib::RtDataFromFile& data);
96
97std::ostream& operator<<(std::ostream& os, const MuonCalib::RtDataFromFile& data);
98
99#endif
#define endmsg
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::ostream & operator<<(std::ostream &os, const MuonCalib::RtDataFromFile &data)
std::istream & operator>>(std::istream &is, MuonCalib::RtDataFromFile &data)
Manages the I/O of the Rt realtions from/to file.
void setNRts(unsigned int nrts)
set total number of regions
void write_forDB(FILE *frt, FILE *frtt, FILE *frtr, FILE *frts, int region) const
bool addRt(int regionId, RtRelation *rt)
RtDataFromFile takes ownership of rt.
std::ostream & write(std::ostream &os, int region) const
RtRelation * getRt(unsigned int regionId) const
retrieve rt-relation for a give regionId
unsigned int nRts() const
return number of rt relations
std::vector< const RtFullInfo * > m_fullInfo
void setVersion(int major, int minor)
bool addRt(int regionId, RtRelation *rt, const RtFullInfo *info)
std::vector< RtRelation * > RtRelations
int m_major_version
format version
std::istream & read(std::istream &is)
RtRelations m_rtRelations
rt relations
unsigned int m_rts
total number of regions
Represents an Rt relation in the form of a set of (time,radius,resolution) points.
addiitonal information used in validation of a rt-relation
Definition RtFullInfo.h:15
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.