25 #include "eformat/SourceIdentifier.h"
29 using eformat::helper::SourceIdentifier;
33 bool inRange(
const int var,
const int lo,
const int hi) {
34 return not ((lo >
var) or (hi <
var));
37 const int invalidInput{-1};
38 const int maxPossiblePhiModule{9};
39 const int maxPossibleModule{3};
40 const int maxPossibleBufferLocation{2000};
43 static const InterfaceID IID_ITRT_FillCablingData_TB04
44 (
"TRT_FillCablingData_TB04", 1, 0);
51 declareInterface< TRT_FillCablingData_TB04 >(
this );
61 {
return IID_ITRT_FillCablingData_TB04; }
74 return StatusCode::FAILURE;
84 ATH_MSG_INFO(
"TRT_FillCablingData_TB04::initializiation finished" );
86 return StatusCode::SUCCESS;
121 int numberOfStrawsInLayersA[] = {15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18,
122 18, 18, 18, 18, 19, 19, 19, 18};
124 int numberOfStrawsInLayersB[] = {19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21,
125 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 23};
127 int numberOfStrawsInLayersC[] = {23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26,
128 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 28};
130 std::vector<int> ncol0 (
std::begin(numberOfStrawsInLayersA),
132 std::vector<int> ncol1 (
std::begin(numberOfStrawsInLayersB),
134 std::vector<int> ncol2 (
std::begin(numberOfStrawsInLayersC),
137 m_ncol.push_back(std::move(ncol0));
138 m_ncol.push_back(std::move(ncol1));
139 m_ncol.push_back(std::move(ncol2));
155 int phiModuleId, moduleId, strawLayerId, strawInLayerId,
156 strawNumberInModule,BufferLocation;
163 std::vector<Identifier> tempbuff;
164 std::vector<IdentifierHash> tempbuff2;
165 for (
int i = 0;
i < 8*13*16;
i++){
167 tempbuff.push_back(
id);
168 tempbuff2.emplace_back(0);
173 std::ostringstream ssFile;
175 std::string
dataFile =
"TRT_TB04_IdMapping_ROD" + ssFile.str() +
".dat";
200 inputFile >> phiModuleId >> moduleId >> strawNumberInModule
204 const bool validPhi =
inRange(phiModuleId, invalidInput, maxPossiblePhiModule);
205 const bool validModule =
inRange(moduleId, invalidInput, maxPossibleModule);
208 const bool validBuffer =
inRange(BufferLocation, invalidInput, maxPossibleBufferLocation);
209 if (not (validPhi and validModule and validStrawNumber and validBuffer)) {
210 ATH_MSG_WARNING(
"One of the following is out of range: " << phiModuleId <<
", " << moduleId
211 <<
", " << strawNumberInModule <<
", " << BufferLocation);
217 if (phiModuleId == 0)
241 strawNumberInModule--;
242 if (strawNumberInModule < 0) {
243 ATH_MSG_WARNING(
"Straw number in module became negative: " << strawNumberInModule);
249 strawInLayerId=strawNumberInModule;
251 while(strawInLayerId>=0){
253 strawInLayerId -=
m_ncol[moduleId][strawLayerId];
258 strawInLayerId +=
m_ncol[moduleId][strawLayerId];
266 strawLayerId, strawInLayerId);
273 BufferLocation, hashId);
275 ATH_MSG_DEBUG(
"defineTables: unable to get hash for IdLayer " << IdLayer );
296 std::vector<IdentifierHash> * vectID =
new std::vector<IdentifierHash>();
311 std::vector<IdentifierHash> &
ids)
319 eformat::helper::SourceIdentifier
id (rob_id);
347 ids.push_back(idHash);
367 ids.push_back(idHash);
379 ids.push_back(idHash);
391 ids.push_back(idHash);
409 std::vector<uint32_t>
v;
424 if (id_barrel_ec == -1)
433 v.push_back( 0x310001 );
437 " TRT_FillCablingData_TB04 --> Couldn't get RobID for given Identifier " \