11 #include "nlohmann/json.hpp"
21 m_ConditionsSummary(
"TRT_StrawStatusSummaryTool", this),
22 m_TRTStrawNeighbourSvc(
"TRT_StrawNeighbourSvc",
name)
52 std::ifstream
fin(
file.c_str());
55 return StatusCode::FAILURE;
60 m_maskedChipsEc =
data[
"Endcap"].template get<std::array<std::array<std::vector<int>, 32>, 2>>();
63 for(
int j=0; j<75; j++) {
105 int idSide = idBarrelEndcap?1:-1;
108 if (element ==
nullptr)
continue;
110 for(
unsigned int istraw = 0; istraw < element->
nStraws(); istraw++) {
122 if (idLayerWheel == 1) i_chip+=21;
123 if (idLayerWheel == 2) i_chip+=54;
132 int idSide = idBarrelEndcap?2:-2;
139 if (element ==
nullptr)
continue;
141 for(
unsigned int istraw = 0; istraw < element->
nStraws(); istraw++) {
143 int tempStrawNumber =
EndcapStrawNumber(istraw, idStrawLayer, idLayerWheel, idPhiModule, idSide);
160 return StatusCode::SUCCESS;
170 int barrel_trigger_board[2][32][9] = {{{0}}};
171 int endcap_trigger_board[2][32][20] = {{{0}}};
174 int barrel_trigger_ttc[2][8] = {{0}};
175 int endcap_trigger_ttc[2][16] = {{0}};
182 for (
const auto trtRDO : *trtRDOs) {
185 if(!TRT_Collection) {
191 for (
const auto p_rdo : *TRT_Collection) {
195 Identifier TRT_Identifier = p_rdo->identify();
200 if(!p_lolum)
continue;
203 TRT_Identifier = p_lolum->
identify();
216 if (barrel_ec == 1 || barrel_ec == -1) {
217 int side = barrel_ec>0?1:0;
223 return StatusCode::FAILURE;
228 if(
std::find(maskedChips.begin(), maskedChips.end(), chip) != maskedChips.end())
232 barrel_trigger_board[
side][phi_module][board]++;
236 else if (barrel_ec == 2 || barrel_ec == -2) {
238 int side = barrel_ec>0?1:0;
245 if(
std::find(maskedChips.begin(), maskedChips.end(), chip) != maskedChips.end())
249 endcap_trigger_board[
side][phi_module][board]++;
258 for (
int i=0;
i<2;
i++) {
259 for (
int j=0; j<32; j++) {
260 for (
int k=0;
k<9;
k++) {
261 if (barrel_trigger_board[
i][j][
k]) {
262 barrel_trigger_ttc[
i][j%4]++;
265 for (
int k=0;
k<20;
k++) {
266 if (endcap_trigger_board[
i][j][
k]) {
267 endcap_trigger_ttc[
i][j%2]++;
273 unsigned int cableWord0 = 0;
276 for (
int i=0;
i<2;
i++) {
277 for (
int j=0; j<8; j++) {
282 for (
int j=0; j<16; j++) {
296 ATH_MSG_DEBUG(
"Stored TRT CTP object with bit " << std::dec << cableWord0);
298 return StatusCode::SUCCESS;
318 int list[] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
322 for (
int i=0;
i<9;
i++) {
324 if (chip <
count)
return i+1;
325 else if (chip == 104)
return 9;
328 throw std::runtime_error(
"Board not found!");
346 static const int TripletOrientation[2][32] = {
359 else if (
side==-2) phi1=31-phi_stack,
side=0;
361 if (TripletOrientation[
side][phi1]){
363 if (strawLayerNumber < 8)strawNumber = strawNumber + 24*strawLayerNumber;
364 if (strawLayerNumber > 7)strawNumber = strawNumber + 24*(strawLayerNumber -8);
365 strawNumber = (192-1)*TripletOrientation[
side][phi1]+strawNumber*(1-2*TripletOrientation[
side][phi1]);
368 if (strawLayerNumber<8) strawLayerNumber =
int(strawNumber/24);
369 if (strawLayerNumber>7) strawLayerNumber =
int(strawNumber/24) + 8;
370 strawNumber = strawNumber%24;
377 if (
side==0) strawNumber = 23 - strawNumber;
385 int strawNumberNew=0;
387 if(LayerNumber<6 && strawLayerNumber>7) {
388 strawNumberNew=strawNumberNew+(384*LayerNumber);
389 strawNumberNew=strawNumberNew+192+(strawLayerNumber%8)+(strawNumber*8);
391 else if(LayerNumber<6 && strawLayerNumber<8) {
392 strawNumberNew=strawNumberNew+(384*LayerNumber);
393 strawNumberNew=strawNumberNew + (strawLayerNumber%8) + (strawNumber*8);
395 else if(LayerNumber>5 && strawLayerNumber>7) {
396 strawNumberNew = strawNumberNew + 2304 + 192*(LayerNumber-6);
397 strawNumberNew = strawNumberNew + 192 + (strawLayerNumber%8) + (8*strawNumber);
399 else if(LayerNumber>5 && strawLayerNumber<8) {
400 strawNumberNew = strawNumberNew + 2304 + 192*(LayerNumber-6);
401 strawNumberNew = strawNumberNew + (strawLayerNumber%8) + (8*strawNumber);
404 strawNumber=strawNumberNew;
410 int addToStrawNumber=0;
411 int addToStrawNumberNext=0;
420 strawNumber = addToStrawNumberNext - strawNumber-1;
427 }
else if(LayerNumber==1) {
428 strawLayerNumber+=19;
429 }
else if(LayerNumber==2) {
430 strawLayerNumber+=43;
432 return strawLayerNumber;