19 base_class(
type, name, parent)
27 return StatusCode::SUCCESS;
32 ATH_MSG_DEBUG(
"in the finalize of SiGlobAlignDBTool, bye bye");
33 return StatusCode::SUCCESS;
39 ATH_MSG_DEBUG(
"will get global alignment for run "<<ctx.eventID().run_number()<<
", lb "<<ctx.eventID().lumi_block()<<
", event "<<ctx.eventID().event_number());
43 if ( attrGlobList ==
nullptr )
46 return nlohmann::json::parse(
"");
49 if(attrGlobList->
size()>1)
ATH_MSG_INFO(
"there should be only one real channel in "<<
m_rch_glob.fullKey() <<
", there are "<<attrGlobList->
size()<<
" real channels, only the first one will be used ");
52 const coral::AttributeList &atr = itr->second;
53 std::string
data = *(
static_cast<const std::string *
>((atr[
"data"]).addressOfData()));
55 return nlohmann::json::parse(
data);
61 ATH_MSG_DEBUG(
"will get global alignment for station "<<stationID);
62 nlohmann::json channeldata=jsondata[
"data"];
66 std::vector<int> guess_ch_vec{stationID*4, stationID*4+1, stationID*4+2, stationID*4+3};
67 int guess_ch_correct=0;
68 for(
auto guess_ch : guess_ch_vec)
70 nlohmann::json aligndata=channeldata.at(std::to_string(guess_ch));
71 int st=aligndata[
"stationID"];
72 std::string alignType=aligndata[
"alignType"];
75 if(alignType==
"tracker" && !(guess_ch_correct&1))
77 ATH_MSG_DEBUG(
"channel guessed correctly, stationID "<<st<<
", alignType "<<alignType<<
", channel guess "<<guess_ch);
78 GA_guess.
setTracker(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
81 else if(alignType==
"beam" && !(guess_ch_correct&2))
83 ATH_MSG_DEBUG(
"channel guessed correctly, stationID "<<st<<
", alignType "<<alignType<<
", channel guess "<<guess_ch);
84 GA_guess.
setBeam(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
87 else if(alignType==
"RP" && !(guess_ch_correct&4))
89 ATH_MSG_DEBUG(
"channel guessed correctly, stationID "<<st<<
", alignType "<<alignType<<
", channel guess "<<guess_ch);
90 GA_guess.
setRP(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
93 else if(alignType==
"correction" && !(guess_ch_correct&8))
95 ATH_MSG_DEBUG(
"channel guessed correctly, stationID "<<st<<
", alignType "<<alignType<<
", channel guess "<<guess_ch);
96 GA_guess.
setCorr(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
99 else ATH_MSG_DEBUG(
"alignType or channel is probably incorrect, stationID "<<stationID<<
", alignType "<<alignType<<
", channel guess "<<guess_ch<<
", guess_ch_correct "<<guess_ch_correct);
103 if(guess_ch_correct==15)
105 ATH_MSG_DEBUG(
"channels guessed correctly, stationID "<<stationID);
110 ATH_MSG_DEBUG(
"channels were not guessed correctly, stationID "<<stationID);
115 int loop_ch_correct=0;
116 for(
auto& chan : channeldata.items())
119 nlohmann::json aligndata=chan.value();
121 int st=aligndata[
"stationID"];
122 std::string alignType=aligndata[
"alignType"];
126 if(alignType==
"tracker" && !(loop_ch_correct&1))
128 ATH_MSG_DEBUG(
"channel found for stationID "<<st<<
", alignType "<<alignType<<
", channel nr. "<<chan.key());
129 GA_loop.
setTracker(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
132 else if(alignType==
"beam" && !(loop_ch_correct&2))
134 ATH_MSG_DEBUG(
"channel found for stationID "<<st<<
", alignType "<<alignType<<
", channel nr. "<<chan.key());
135 GA_loop.
setBeam(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
138 else if(alignType==
"RP" && !(loop_ch_correct&4))
140 ATH_MSG_DEBUG(
"channel found for stationID "<<st<<
", alignType "<<alignType<<
", channel nr. "<<chan.key());
141 GA_loop.
setRP(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
144 else if(alignType==
"correction" && !(loop_ch_correct&8))
146 ATH_MSG_DEBUG(
"channel found for stationID "<<st<<
", alignType "<<alignType<<
", channel nr. "<<chan.key());
147 GA_loop.
setCorr(aligndata[
"shiftX"], aligndata[
"shiftY"], aligndata[
"shiftZ"], aligndata[
"alpha"], aligndata[
"beta"], aligndata[
"gamma"]);
150 else ATH_MSG_DEBUG(
"alignType is probably incorrect, stationID "<<stationID<<
", alignType "<<alignType<<
", channel nr. "<<chan.key()<<
", loop_ch_correct "<<loop_ch_correct);
153 if(loop_ch_correct==15)
155 ATH_MSG_DEBUG(
"channels found correctly, stationID "<<stationID);
160 ATH_MSG_DEBUG(
"channels were not found correctly, stationID "<<stationID);
164 ATH_MSG_WARNING(
"global alignment data stationID "<<stationID<<
" not found in any channels, returning zeros");
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
char data[hepevt_bytes_allocation_ATLAS]
void setCorr(double x, double y, double z, double a, double b, double g)
void setRP(double x, double y, double z, double a, double b, double g)
void setTracker(double x, double y, double z, double a, double b, double g)
void setBeam(double x, double y, double z, double a, double b, double g)
This class is a collection of AttributeLists where each one is associated with a channel number.
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
Header file for interface of SiGlobAlignDBTool used to read global alignment for database.