ATLAS Offline Software
CalibT0DbOperations.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CalibT0DbOperations_h
6 #define CalibT0DbOperations_h
7 
10 #include <GaudiKernel/ServiceHandle.h>
11 #include <string>
12 #include <vector>
13 
14 namespace coral {
15  class IQuery;
16  class AttributeList;
17  class ITableDataEditor;
18 } // namespace coral
19 
20 namespace MuonCalib {
21 
22  class CalibDbConnection;
24  class NtupleStationId;
25  class MdtTubeFitContainer;
26  class MuonFixedId;
27  class IConditionsStorage;
28 
30  public:
31  //=====================constructor - destructor=================================
33  virtual ~CalibT0DbOperations() = default;
34  //=====================publlic member functions=================================
35  // load t0 for chamber
36  MdtStationT0Container *LoadT0Calibration(const NtupleStationId &id, int head_id, std::string &site_name);
37  // load data for validation
38  MdtTubeFitContainer *LoadT0Validation(const NtupleStationId &id, int head_id, std::string &site_name);
39  // write t0 for chamber/set validation flag
40  // validation_flag[tb_nr]!=3 write complete tube entry
41  // if validation_flag.size()==0: all tubes are new
42  bool WriteT0Chamber(const NtupleStationId &id, const MdtTubeFitContainer *t0, std::vector<int> &validation_flag, int head_id,
43  const std::string &site_name);
44  // read for storage in a conditinos database
45  bool ReadForConditions(const std::string& site_name, int head_id, IConditionsStorage &storage);
46 
47  private:
48  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{"Muon::MuonIdHelperSvc/MuonIdHelperSvc", "CalibT0DbOperations"};
49  //=====================private data members====================================
50  // db connection
52  coral::IQuery *m_query{nullptr};
53  //=====================private functions=======================================
54  inline void initRowBuffer(std::vector<coral::AttributeList> &rowBuffer, const NtupleStationId &id, const int head_id,
55  const std::string &site_name, const MdtTubeFitContainer *t0);
56  inline void fillRowBuffer(std::vector<coral::AttributeList> &rowBuffer, const MdtTubeFitContainer *t0, const int ml1,
57  const int ly, const int ml2, const MuonFixedId &fixId);
58  bool setValidFlag(const std::string &site_name, const int head_id, const int tube_id, const int new_validflag,
59  coral::ITableDataEditor &editor);
60  // insert all tubes of chamber
61  bool insertTubes(const std::string &site_name, int head_id, const NtupleStationId &id, const MdtTubeFitContainer *t0,
62  const std::vector<int> &validation_flag, coral::ITableDataEditor *editor[]);
63  bool setValidationFlag(const std::string &site_name, int head_id, const NtupleStationId &id, int from, int to,
64  coral::ITableDataEditor &editor);
65  // check if data already existsd in db
66  inline bool checkTubesPresent(const int head_id, const std::string &site_name, const NtupleStationId &id,
67  const std::vector<int> &validflag);
68  }; // class
69 
70 } // namespace MuonCalib
71 
72 #endif
MuonCalib::CalibT0DbOperations::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CalibT0DbOperations.h:48
MuonCalib::NtupleStationId
Definition: NtupleStationId.h:36
MuonCalib::MdtStationT0Container
Definition: MdtStationT0Container.h:24
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
MuonCalib::CalibT0DbOperations::insertTubes
bool insertTubes(const std::string &site_name, int head_id, const NtupleStationId &id, const MdtTubeFitContainer *t0, const std::vector< int > &validation_flag, coral::ITableDataEditor *editor[])
Definition: CalibT0DbOperations.cxx:478
MuonCalib::CalibT0DbOperations::m_db_conn
CalibDbConnection & m_db_conn
Definition: CalibT0DbOperations.h:51
coral
Definition: ISecondaryEventSelector.h:19
MuonCalib::CalibT0DbOperations::LoadT0Validation
MdtTubeFitContainer * LoadT0Validation(const NtupleStationId &id, int head_id, std::string &site_name)
Definition: CalibT0DbOperations.cxx:80
calibdata.tube_id
tube_id
Definition: calibdata.py:30
MuonCalib::CalibT0DbOperations
Definition: CalibT0DbOperations.h:29
MuonCalib::CalibT0DbOperations::checkTubesPresent
bool checkTubesPresent(const int head_id, const std::string &site_name, const NtupleStationId &id, const std::vector< int > &validflag)
Definition: CalibT0DbOperations.cxx:560
MuonCalib::IConditionsStorage
Definition: IConditionsStorage.h:21
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
MuonCalib::CalibT0DbOperations::ReadForConditions
bool ReadForConditions(const std::string &site_name, int head_id, IConditionsStorage &storage)
Definition: CalibT0DbOperations.cxx:301
MuonCalib::CalibT0DbOperations::setValidFlag
bool setValidFlag(const std::string &site_name, const int head_id, const int tube_id, const int new_validflag, coral::ITableDataEditor &editor)
Definition: CalibT0DbOperations.cxx:461
calibdata.head_id
head_id
Definition: calibdata.py:29
MuonCalib::MuonFixedId
Definition: MuonFixedId.h:50
MuonCalib::CalibT0DbOperations::initRowBuffer
void initRowBuffer(std::vector< coral::AttributeList > &rowBuffer, const NtupleStationId &id, const int head_id, const std::string &site_name, const MdtTubeFitContainer *t0)
Definition: CalibT0DbOperations.cxx:367
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
MuonCalib::MdtTubeFitContainer
Holds single-tube full calibration information of one chamber.
Definition: MdtTubeFitContainer.h:16
AthMessaging.h
MuonCalib::CalibT0DbOperations::WriteT0Chamber
bool WriteT0Chamber(const NtupleStationId &id, const MdtTubeFitContainer *t0, std::vector< int > &validation_flag, int head_id, const std::string &site_name)
Definition: CalibT0DbOperations.cxx:189
MuonCalib::CalibT0DbOperations::setValidationFlag
bool setValidationFlag(const std::string &site_name, int head_id, const NtupleStationId &id, int from, int to, coral::ITableDataEditor &editor)
Definition: CalibT0DbOperations.cxx:541
MuonCalib::CalibT0DbOperations::m_query
coral::IQuery * m_query
Definition: CalibT0DbOperations.h:52
MuonCalib::CalibT0DbOperations::~CalibT0DbOperations
virtual ~CalibT0DbOperations()=default
MdtStationT0Container
MuonCalib::CalibT0DbOperations::CalibT0DbOperations
CalibT0DbOperations(CalibDbConnection &db_conn)
Definition: CalibT0DbOperations.cxx:34
MuonCalib::CalibDbConnection
Definition: CalibDbConnection.h:22
IMuonIdHelperSvc.h
MuonCalib::CalibT0DbOperations::fillRowBuffer
void fillRowBuffer(std::vector< coral::AttributeList > &rowBuffer, const MdtTubeFitContainer *t0, const int ml1, const int ly, const int ml2, const MuonFixedId &fixId)
Definition: CalibT0DbOperations.cxx:417
ServiceHandle< Muon::IMuonIdHelperSvc >
MuonCalib::CalibT0DbOperations::LoadT0Calibration
MdtStationT0Container * LoadT0Calibration(const NtupleStationId &id, int head_id, std::string &site_name)
Definition: CalibT0DbOperations.cxx:39