Tool providing vertex parameters of ToF detectors from the conditions database.
More...
#include <ToFVtxParamDBTool.h>
|
| | ToFVtxParamDBTool (const std::string &type, const std::string &name, const IInterface *parent) |
| virtual | ~ToFVtxParamDBTool () override |
| | Does nothing.
|
| virtual StatusCode | initialize () override |
| | Does nothing.
|
| virtual StatusCode | finalize () override |
| | Does nothing.
|
| nlohmann::json | parametersData (const EventContext &ctx) const override |
| | Provide ToF parameters for a given station. Returns zeros if no data available.
|
| const ToFVtxParamData | parameters (const nlohmann::json &jsondata, const int stationID) const override |
Tool providing vertex parameters of ToF detectors from the conditions database.
Definition at line 33 of file ToFVtxParamDBTool.h.
◆ ToFVtxParamDBTool()
| AFP::ToFVtxParamDBTool::ToFVtxParamDBTool |
( |
const std::string & | type, |
|
|
const std::string & | name, |
|
|
const IInterface * | parent ) |
◆ ~ToFVtxParamDBTool()
| virtual AFP::ToFVtxParamDBTool::~ToFVtxParamDBTool |
( |
| ) |
|
|
inlineoverridevirtual |
◆ finalize()
| StatusCode AFP::ToFVtxParamDBTool::finalize |
( |
| ) |
|
|
overridevirtual |
◆ initialize()
| StatusCode AFP::ToFVtxParamDBTool::initialize |
( |
| ) |
|
|
overridevirtual |
Does nothing.
Definition at line 16 of file ToFVtxParamDBTool.cxx.
17 {
20 return StatusCode::SUCCESS;
21 }
#define ATH_CHECK
Evaluate an expression and check for errors.
◆ parameters()
| const ToFVtxParamData AFP::ToFVtxParamDBTool::parameters |
( |
const nlohmann::json & | jsondata, |
|
|
const int | stationID ) const |
|
override |
Definition at line 52 of file ToFVtxParamDBTool.cxx.
53 {
54 ATH_MSG_DEBUG(
"will get vertex ToF parameters for station "<<stationID);
55 nlohmann::json channeldata=jsondata["data"];
56
57
59
60 nlohmann::json paramdata=channeldata.at(std::to_string(guess_ch));
61 int st=paramdata[
"stationID"];
62 if(stationID==st)
63 {
64 ATH_MSG_DEBUG(
"channel guessed correctly, stationID "<<st<<
", channel guess "<<guess_ch);
65 return ToFVtxParamData(st, paramdata["timeGlobalOffset"], paramdata["timeOffset"], paramdata["timeSlope"], paramdata["trainEdge"]);
66 }
67 else
68 {
69 ATH_MSG_DEBUG(
"channel was not guessed correctly, stationID "<<st<<
", channel guess "<<guess_ch);
70 }
71
72
73 for(auto& chan : channeldata.items())
74 {
75
76 nlohmann::json paramdata=
chan.value();
77
78 int st=paramdata[
"stationID"];
79 if(stationID==st)
80 {
82 return ToFVtxParamData(st, paramdata["timeGlobalOffset"], paramdata["timeOffset"], paramdata["timeSlope"], paramdata["trainEdge"]);
83 }
84 }
85
86 ATH_MSG_WARNING(
"vertex ToF parameters data stationID "<<stationID<<
" not found in any channels, returning zeros");
87 return ToFVtxParamData(stationID);
88 }
#define ATH_MSG_WARNING(x)
constexpr uint8_t stationID
Large or Small wedge.
◆ parametersData()
| nlohmann::json AFP::ToFVtxParamDBTool::parametersData |
( |
const EventContext & | ctx | ) |
const |
|
override |
Provide ToF parameters for a given station. Returns zeros if no data available.
Definition at line 30 of file ToFVtxParamDBTool.cxx.
31 {
32 ATH_MSG_DEBUG(
"will get vertex ToF parameters for run "<<ctx.eventID().run_number()<<
", lb "<<ctx.eventID().lumi_block()<<
", event "<<ctx.eventID().event_number());
33
34 SG::ReadCondHandle<CondAttrListCollection> ch_loc(
m_rch_vtx, ctx );
35 const CondAttrListCollection* attrLocList { *ch_loc};
36 if ( attrLocList == nullptr )
37 {
38 ATH_MSG_WARNING(
"vertex ToF parameters data for key " <<
m_rch_vtx.fullKey() <<
" not found, returning empty string");
39 return nlohmann::json::parse("");
40 }
41
42 if(attrLocList->
size()>1)
ATH_MSG_INFO(
"there should be only one real channel in "<<
m_rch_vtx.fullKey() <<
", there are "<<attrLocList->
size()<<
" real channels, only the first one will be used ");
43
45 const coral::AttributeList &atr = itr->second;
46 std::string
data = *(
static_cast<const std::string *
>((atr[
"data"]).addressOfData()));
47
48 return nlohmann::json::parse(
data);
49 }
char data[hepevt_bytes_allocation_ATLAS]
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
size_type size() const
number of Chan/AttributeList pairs
ChanAttrListMap::const_iterator const_iterator
◆ m_rch_vtx
Definition at line 52 of file ToFVtxParamDBTool.h.
52{this, "vtx_param_key", "/FWD/Onl/AFP/ToFParameters/Vertex", "read condition handle for vertex ToF parameters"};
The documentation for this class was generated from the following files: