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++) {
111 if(istraw>element->
nStraws())
continue;
123 if (idLayerWheel == 1) i_chip+=21;
124 if (idLayerWheel == 2) i_chip+=54;
133 int idSide = idBarrelEndcap?2:-2;
140 if (element ==
nullptr)
continue;
142 for(
unsigned int istraw = 0; istraw < element->
nStraws(); istraw++) {
143 if(istraw>element->
nStraws())
continue;
145 int tempStrawNumber =
EndcapStrawNumber(istraw, idStrawLayer, idLayerWheel, idPhiModule, idSide);
162 return StatusCode::SUCCESS;
172 int barrel_trigger_board[2][32][9] = {{{0}}};
173 int endcap_trigger_board[2][32][20] = {{{0}}};
176 int barrel_trigger_ttc[2][8] = {{0}};
177 int endcap_trigger_ttc[2][16] = {{0}};
184 for (
const auto trtRDO : *trtRDOs) {
187 if(!TRT_Collection) {
193 for (
const auto p_rdo : *TRT_Collection) {
197 Identifier TRT_Identifier = p_rdo->identify();
202 if(!p_lolum)
continue;
205 TRT_Identifier = p_lolum->
identify();
218 if (barrel_ec == 1 || barrel_ec == -1) {
219 int side = barrel_ec>0?1:0;
225 return StatusCode::FAILURE;
230 if(
std::find(maskedChips.begin(), maskedChips.end(), chip) != maskedChips.end())
234 barrel_trigger_board[
side][phi_module][board]++;
238 else if (barrel_ec == 2 || barrel_ec == -2) {
240 int side = barrel_ec>0?1:0;
247 if(
std::find(maskedChips.begin(), maskedChips.end(), chip) != maskedChips.end())
251 endcap_trigger_board[
side][phi_module][board]++;
260 for (
int i=0;
i<2;
i++) {
261 for (
int j=0; j<32; j++) {
262 for (
int k=0;
k<9;
k++) {
263 if (barrel_trigger_board[
i][j][
k]) {
264 barrel_trigger_ttc[
i][j%4]++;
267 for (
int k=0;
k<20;
k++) {
268 if (endcap_trigger_board[
i][j][
k]) {
269 endcap_trigger_ttc[
i][j%2]++;
275 unsigned int cableWord0 = 0;
278 for (
int i=0;
i<2;
i++) {
279 for (
int j=0; j<8; j++) {
284 for (
int j=0; j<16; j++) {
298 ATH_MSG_DEBUG(
"Stored TRT CTP object with bit " << std::dec << cableWord0);
300 return StatusCode::SUCCESS;
320 int list[] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
324 for (
int i=0;
i<9;
i++) {
326 if (chip <
count)
return i+1;
327 else if (chip == 104)
return 9;
330 throw std::runtime_error(
"Board not found!");
348 static const int TripletOrientation[2][32] = {
361 else if (
side==-2) phi1=31-phi_stack,
side=0;
363 if (TripletOrientation[
side][phi1]){
365 if (strawLayerNumber < 8)strawNumber = strawNumber + 24*strawLayerNumber;
366 if (strawLayerNumber > 7)strawNumber = strawNumber + 24*(strawLayerNumber -8);
367 strawNumber = (192-1)*TripletOrientation[
side][phi1]+strawNumber*(1-2*TripletOrientation[
side][phi1]);
370 if (strawLayerNumber<8) strawLayerNumber =
int(strawNumber/24);
371 if (strawLayerNumber>7) strawLayerNumber =
int(strawNumber/24) + 8;
372 strawNumber = strawNumber%24;
379 if (
side==0) strawNumber = 23 - strawNumber;
387 int strawNumberNew=0;
389 if(LayerNumber<6 && strawLayerNumber>7) {
390 strawNumberNew=strawNumberNew+(384*LayerNumber);
391 strawNumberNew=strawNumberNew+192+(strawLayerNumber%8)+(strawNumber*8);
393 else if(LayerNumber<6 && strawLayerNumber<8) {
394 strawNumberNew=strawNumberNew+(384*LayerNumber);
395 strawNumberNew=strawNumberNew + (strawLayerNumber%8) + (strawNumber*8);
397 else if(LayerNumber>5 && strawLayerNumber>7) {
398 strawNumberNew = strawNumberNew + 2304 + 192*(LayerNumber-6);
399 strawNumberNew = strawNumberNew + 192 + (strawLayerNumber%8) + (8*strawNumber);
401 else if(LayerNumber>5 && strawLayerNumber<8) {
402 strawNumberNew = strawNumberNew + 2304 + 192*(LayerNumber-6);
403 strawNumberNew = strawNumberNew + (strawLayerNumber%8) + (8*strawNumber);
406 strawNumber=strawNumberNew;
412 int addToStrawNumber=0;
413 int addToStrawNumberNext=0;
422 strawNumber = addToStrawNumberNext - strawNumber-1;
429 }
else if(LayerNumber==1) {
430 strawLayerNumber+=19;
431 }
else if(LayerNumber==2) {
432 strawLayerNumber+=43;
434 return strawLayerNumber;