ATLAS Offline Software
CoolInserter.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_CoolInserter_h
6 #define MuonCalib_CoolInserter_h
7 
9 #include "CoolApplication/Application.h"
10 #include "CoolApplication/DatabaseSvcFactory.h"
11 #include "CoolKernel/Exception.h"
12 #include "CoolKernel/IDatabase.h"
13 #include "CoolKernel/IDatabaseSvc.h"
14 #include "CoolKernel/IFolder.h"
15 #include "CoolKernel/IObject.h"
16 #include "CoolKernel/IObjectIterator.h"
17 #include "CoolKernel/Record.h"
18 #include "CoolKernel/StorageType.h"
19 #include "CoolKernel/types.h"
20 #include "GaudiKernel/ServiceHandle.h"
21 #include "GaudiKernel/ToolHandle.h"
27 
28 class RegionSelectionSvc;
29 
30 namespace MuonCalib {
31 
32  class CoolInserter : public AthAlgorithm {
33  public:
34  //====================destructor - constructor=================================
35  CoolInserter(const std::string &name, ISvcLocator *pSvcLocator);
36  inline ~CoolInserter() = default;
43  bool CoolConnect(const std::string &connection_string, const std::string &tag_t0);
44 
45  bool StartT0Chamber(const NtupleStationId &sid);
46  bool AppendT0(float t0, int validflag, float adc0);
47  bool StoreT0Chamber(const NtupleStationId &id, const std::string &file, unsigned int creation_flags = 0);
48  bool StoreRtChamber(const NtupleStationId &id, const std::map<int, SamplePoint> &points, const std::string &file,
49  unsigned int creation_flags = 0);
50  //====================interface functions======================================
51  private:
52  //====================private data=============================================
53  // version string - job option
54  std::string m_version;
55  // tags - job options
56  std::vector<std::string> m_tagt0; // tag of the folder
57  std::vector<std::string> m_tagrt; // tag of the folder
58  // overwirte iov - job-option
59  int m_iov_start = 0, m_iov_end = 0;
61  // cool connection string - job option job option
63  // cool folders - job options
64  std::vector<std::string> m_t0_folder;
65  std::vector<std::string> m_rt_folder;
66  // indicate if cool folders should be compressed if they are created
67  std::vector<bool> m_compressed_t0;
68  std::vector<bool> m_compressed_rt;
69  // calibration source tools - jo
70  ToolHandleArray<IMuonCalibConditionsSource> m_calibration_sources{this, "CalibrationSources", {}};
71  // region selection service - copy part of the calibration
73  // cool
74  cool::IDatabasePtr m_db;
75  std::vector<cool::IFolderPtr> m_mdtt0_fld;
76  std::vector<cool::IFolderPtr> m_mdtrt_fld;
77  cool::Application m_app;
78  std::map<bool, coral::AttributeList> m_mdtt0_cool_row;
79  std::map<bool, coral::AttributeList> m_mdtrt_cool_row;
80  // flags for cool status
82  // already filled chambers - do not double fill
83  std::set<NtupleStationId> m_t0_filled, m_rt_filled;
84  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
85 
86  // MuonDetectorManager from the conditions store
87  SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey{this, "DetectorManagerKey", "MuonDetectorManager",
88  "Key of input MuonDetectorManager condition data"};
89 
90  std::ostringstream m_data_string;
95  // create a new cool folder
96  inline bool create_folder(const unsigned int &fldr_nr, const bool &is_rt);
97  };
98 
99 } // namespace MuonCalib
100 
101 #endif
MuonCalib::CoolInserter::m_aver_t0
float m_aver_t0
Definition: CoolInserter.h:93
MuonCalib::CoolInserter::m_rt_filled
std::set< NtupleStationId > m_rt_filled
Definition: CoolInserter.h:83
MuonCalib::CoolInserter::m_db
cool::IDatabasePtr m_db
Definition: CoolInserter.h:74
IConditionsStorage.h
MuonCalib::CoolInserter
Definition: CoolInserter.h:32
MuonCalib::CoolInserter::m_mdtrt_cool_row
std::map< bool, coral::AttributeList > m_mdtrt_cool_row
Definition: CoolInserter.h:79
MuonCalib::CoolInserter::m_mdtt0_fld
std::vector< cool::IFolderPtr > m_mdtt0_fld
Definition: CoolInserter.h:75
MuonCalib::NtupleStationId
Definition: NtupleStationId.h:36
MuonCalib::CoolInserter::m_n_tubes_chamber
int m_n_tubes_chamber
Definition: CoolInserter.h:92
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
MuonCalib::CoolInserter::m_t0_created
bool m_t0_created
Definition: CoolInserter.h:81
RegionSelectionSvc
Definition: RegionSelectionSvc.h:35
MuonCalib::CoolInserter::m_sid
NtupleStationId m_sid
Definition: CoolInserter.h:94
MuonCalib::CoolInserter::finalize
StatusCode finalize()
finalize functions
Definition: CoolInserter.cxx:131
MuonCalib::CoolInserter::m_iovt_end
long long m_iovt_end
Definition: CoolInserter.h:60
MuonCalib::CoolInserter::m_DetectorManagerKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
Definition: CoolInserter.h:87
MuonCalib::CoolInserter::m_aver_adc
float m_aver_adc
Definition: CoolInserter.h:93
MuonCalib::CoolInserter::StoreT0Chamber
bool StoreT0Chamber(const NtupleStationId &id, const std::string &file, unsigned int creation_flags=0)
Definition: CoolInserter.cxx:193
NtupleStationId.h
MuonCalib::CoolInserter::m_t0_filled
std::set< NtupleStationId > m_t0_filled
Definition: CoolInserter.h:83
MuonCalib::CoolInserter::m_t0_folder
std::vector< std::string > m_t0_folder
Definition: CoolInserter.h:64
AthAlgorithm.h
MuonCalib::CoolInserter::m_compressed_t0
std::vector< bool > m_compressed_t0
Definition: CoolInserter.h:67
MuonCalib::CoolInserter::AppendT0
bool AppendT0(float t0, int validflag, float adc0)
Definition: CoolInserter.cxx:184
MuonCalib::CoolInserter::initialize
StatusCode initialize()
Is called at the beginning of the analysis.
Definition: CoolInserter.cxx:64
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonCalib::CoolInserter::m_mdtrt_fld
std::vector< cool::IFolderPtr > m_mdtrt_fld
Definition: CoolInserter.h:76
file
TFile * file
Definition: tile_monitor.h:29
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::CoolInserter::m_rt_created
bool m_rt_created
Definition: CoolInserter.h:81
MuonCalib::CoolInserter::m_app
cool::Application m_app
Definition: CoolInserter.h:77
MuonCalib::CoolInserter::create_folder
bool create_folder(const unsigned int &fldr_nr, const bool &is_rt)
Definition: CoolInserter.cxx:319
MuonCalib::CoolInserter::m_cool_connection_string
std::string m_cool_connection_string
Definition: CoolInserter.h:62
MuonCalib::CoolInserter::m_n_tubes_added
int m_n_tubes_added
Definition: CoolInserter.h:91
MuonCalib::CoolInserter::m_calibration_sources
ToolHandleArray< IMuonCalibConditionsSource > m_calibration_sources
Definition: CoolInserter.h:70
AthAlgorithm
Definition: AthAlgorithm.h:47
MuonCalib::CoolInserter::m_compressed_rt
std::vector< bool > m_compressed_rt
Definition: CoolInserter.h:68
MuonCalib::CoolInserter::m_iovt_start
long long m_iovt_start
Definition: CoolInserter.h:60
MuonCalib::CoolInserter::~CoolInserter
~CoolInserter()=default
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonCalib::CoolInserter::m_mdtt0_cool_row
std::map< bool, coral::AttributeList > m_mdtt0_cool_row
Definition: CoolInserter.h:78
MuonCalib::CoolInserter::m_tagrt
std::vector< std::string > m_tagrt
Definition: CoolInserter.h:57
MuonCalib::CoolInserter::m_rt_folder
std::vector< std::string > m_rt_folder
Definition: CoolInserter.h:65
MuonCalib::CoolInserter::p_reg_sel_svc
const RegionSelectionSvc * p_reg_sel_svc
Definition: CoolInserter.h:72
MuonDetectorManager.h
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager >
MuonCalib::CoolInserter::CoolConnect
bool CoolConnect(const std::string &connection_string, const std::string &tag_t0)
MuonCalib::CoolInserter::m_tagt0
std::vector< std::string > m_tagt0
Definition: CoolInserter.h:56
MuonCalib::CoolInserter::m_data_string
std::ostringstream m_data_string
Definition: CoolInserter.h:90
IMuonCalibConditionsSource.h
MuonCalib::CoolInserter::m_cool_connect
bool m_cool_connect
Definition: CoolInserter.h:81
MuonCalib::CoolInserter::m_iov_start
int m_iov_start
Definition: CoolInserter.h:59
MuonCalib::CoolInserter::m_version
std::string m_version
Definition: CoolInserter.h:54
MuonCalib::CoolInserter::execute
StatusCode execute()
execute function NOTE: This will read all events at once
Definition: CoolInserter.cxx:143
MuonCalib::CoolInserter::StoreRtChamber
bool StoreRtChamber(const NtupleStationId &id, const std::map< int, SamplePoint > &points, const std::string &file, unsigned int creation_flags=0)
Definition: CoolInserter.cxx:250
MuonCalib::CoolInserter::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CoolInserter.h:84
MuonCalib::CoolInserter::StartT0Chamber
bool StartT0Chamber(const NtupleStationId &sid)
Definition: CoolInserter.cxx:155
MuonCalib::CoolInserter::m_iov_end
int m_iov_end
Definition: CoolInserter.h:59
IMuonIdHelperSvc.h
ServiceHandle< Muon::IMuonIdHelperSvc >
MuonCalib::CoolInserter::CoolInserter
CoolInserter(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CoolInserter.cxx:39