#include "CxxUtils/checker_macros.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "TRT_StrawMap.h"
Go to the source code of this file.
◆ initializeDeadStrawsList()
void initializeDeadStrawsList |
( |
| ) |
|
Definition at line 117 of file TRTCalib_StrawStatusReport.cxx.
123 for (
int i = 0;
i < 2;
i++)
124 for (
int j = 0; j < 32; j++)
125 for (
int k = 0;
k < 5482;
k++)
131 std::string
filename =
"/afs/cern.ch/user/i/idcalib/w0/TRT_Calibration/tmp/Tier0/StrawStatusCode/TRT_StrawStatus_ExcludedStraws_2023.txt";
136 std::cout <<
"TRT_StrawStatusReport::initializePermanentlyDead() ERROR: failed to open the input file " <<
filename << std::endl;
137 std::cout <<
"TRT_StrawStatusReport::initializePermanentlyDead() ERROR: you need to fix the file name / link, WILL CRASH THE CODE NOW" << std::endl;
140 while (fscanf(
f,
"%d %d %d %d %d %d\n",
tmp,
tmp + 1,
tmp + 2,
tmp + 3,
tmp + 4,
tmp + 5) == 6)
150 std::cout <<
"read " <<
count <<
" permanently excluded straws from file " <<
filename << std::endl;
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 40 of file TRTCalib_StrawStatusReport.cxx.
54 if (std::string(
argv[
i]) ==
"checkNoisy_HT")
56 else if (std::string(
argv[
i]) ==
"checkLoEff_HT")
58 else if (std::string(
argv[
i]) ==
"checkNoisy_LT")
60 else if (std::string(
argv[
i]) ==
"checkLoEff_LT")
62 else if (std::string(
argv[
i]) ==
"checkDead_LT")
65 else if (std::string(
argv[
i]) ==
"ignoreNoisy_HT")
67 else if (std::string(
argv[
i]) ==
"ignoreLoEff_HT")
69 else if (std::string(
argv[
i]) ==
"ignoreNoisy_LT")
71 else if (std::string(
argv[
i]) ==
"ignoreLoEff_LT")
73 else if (std::string(
argv[
i]) ==
"ignoreDead_LT")
76 else if (std::string(
argv[
i]) ==
"StatusPermanent")
81 std::cerr <<
"\n Please use one or several of the following options: \n"
82 <<
"\n\t - StatusPermanent: to only mask entire dead boards -- for use if updating StatusPermanent "
83 <<
"\n\t\t - if this option is used, all others will be ignored. \n"
84 <<
"\n\t - checkNoisy_HT: to mask straws with HT fraction > 0.5 "
85 <<
"\n\t - checkNoisy_LT: to mask straws with LT fraction > 0.99 "
86 <<
"\n\t - checkLoEff_HT: to mask straws with HT fraction < 0.0001 "
87 <<
"\n\t - checkLoEff_LT: to mask straws with LT fraction < 0.7 "
88 <<
"\n\t - checkDead_LT : to mask straws with LT fraction = 0.0 "
89 <<
"\n\t Replace \"check\" with \"ignore\" to ignore this category. \n "
◆ printAthena()
void printAthena |
( |
int |
run | ) |
|
Definition at line 222 of file TRTCalib_StrawStatusReport.cxx.
230 int countDeadStraws[] = {0, 0};
231 int breakDownOfDeadStraws[100][2];
232 for (
int i = 0;
i < 100;
i++)
233 for (
int j = 0; j < 2; j++)
234 breakDownOfDeadStraws[
i][j] = 0;
241 for (
int i = 0;
i < 2;
i++)
243 for (
int j = 0; j < 32; j++)
245 for (
int k = 0;
k < 5482;
k++)
250 int side = (
i != 0 ? -1 : 1);
262 fprintf(
fout,
"%2d %2d %2d %2d %2d %2d\n",
side, j, map.strawWithinLayer(), map.strawLayer(), map.layer(), 1);
269 fprintf(
fout,
"%2d %2d %2d %2d %2d %2d\n",
side, j, map.strawWithinLayer(), map.strawLayer(), map.layer(), 1);
275 breakDownOfDeadStraws[
deadStraws[
i][j][
k]][(
k < 1642) ? 0 : 1]++;
277 countDeadStraws[(fabs(
side) == 1) ? 0 : 1]++;
284 printf(
"found %d newly dead straws compared to %s \n",
count,
filename.c_str());
285 printf(
"N dead straws in TRT barrel: %4d or %4.1lf%%\n", countDeadStraws[0], (100. * countDeadStraws[0]) / (64. * 1642));
286 printf(
"N dead straws in TRT end-caps: %4d or %4.1lf%%\n", countDeadStraws[1], (100. * countDeadStraws[1]) / (64. * 20 * 192));
287 printf(
"overall: %4.2lf%%\n", 100. *
count / 350848.);
291 std::cout <<
"criteria barrel end-cap" << std::endl;
292 for (
int i = 2;
i < 100;
i++)
293 if (breakDownOfDeadStraws[
i][0] + breakDownOfDeadStraws[
i][1])
294 printf(
"%2d %4d %4d\n",
i, breakDownOfDeadStraws[
i][0], breakDownOfDeadStraws[
i][1]);
◆ printAthenaBoardsOnly()
void printAthenaBoardsOnly |
( |
int |
run | ) |
|
Definition at line 299 of file TRTCalib_StrawStatusReport.cxx.
312 for (
int i = 0;
i < 2;
i++)
314 for (
int j = 0; j < 32; j++)
316 std::vector<int> allStrawsOnBoard[29];
317 std::vector<int> deadStrawsOnBoard[29];
318 std::vector<int> newDeadStrawsOnBoard[29];
320 for (
int k = 0;
k < 5482;
k++)
322 int side = (
i != 0 ? -1 : 1);
327 int board = map.TTCgroup();
333 if (board <0)
continue;
334 allStrawsOnBoard[board].push_back(
k);
336 deadStrawsOnBoard[board].push_back(
k);
338 newDeadStrawsOnBoard[board].push_back(
k);
341 for (
int board = 0; board < 29; ++board)
343 if (allStrawsOnBoard[board].
size() == deadStrawsOnBoard[board].
size())
347 for (
unsigned int it = 0;
it < deadStrawsOnBoard[board].size();
it++)
349 int k = deadStrawsOnBoard[board].at(
it);
350 int side = (
i != 0 ? -1 : 1);
354 fprintf(
fout,
"%2d %2d %2d %2d %2d %2d\n",
side, j, map.strawWithinLayer(), map.strawLayer(), map.layer(), 1);
358 if (allStrawsOnBoard[board].
size() == newDeadStrawsOnBoard[board].
size())
361 int side = (
i != 0 ? -1 : 1);
362 std::cout <<
"found a new dead board!!! " << std::endl;
363 std::cout <<
"See TRT_StrawMap.h for board ID info " << std::endl;
364 std::cout <<
"side: " <<
side <<
", phi: " << j <<
", board ID: " << board << std::endl
◆ reportResults()
void reportResults |
( |
const std::string & |
filename, |
|
|
int |
run |
|
) |
| |
Definition at line 374 of file TRTCalib_StrawStatusReport.cxx.
382 FILE *
fout = fopen(
"TRT_StrawStatusReport.txt",
"w");
383 fprintf(
fout,
"%d %d %d %d %d %lf %lf %lf %2d\n", 0, 0, 0, 0,
run, 0., 0., 0., 0);
385 while (fscanf(
f,
"%d %d %d %d %d %d %d %d %d\n",
tmp,
tmp + 1,
tmp + 2,
tmp + 3,
tmp + 4,
tmp + 5,
tmp + 6,
tmp + 7,
tmp + 8) == 9)
388 if (
tmp[0] == 0 &&
tmp[1] == 0 &&
tmp[2] == 0 &&
tmp[3] == 0 &&
tmp[4] == 0 &&
tmp[5] == 0 &&
tmp[6] == 0 &&
tmp[7] == 0)
404 fprintf(
fout,
"%d %d %d %d %d %lf %lf %lf %2d\n",
tmp[0],
tmp[1],
tmp[2],
deadStraws[(
tmp[0] > 0) ? 0 : 1][
tmp[1]][
tmp[2]],
tmp[4], occupancy, HToccupancy,
efficiency, map.layer());
407 std::cout <<
"reportResults: read " <<
count <<
" lines from file " <<
filename <<
", wrote to TRT_StrawStatusReport.txt" << std::endl;
◆ simpleAnalysis()
void simpleAnalysis |
( |
std::string |
filename | ) |
|
Definition at line 156 of file TRTCalib_StrawStatusReport.cxx.
160 std::cout <<
"simpleAnalysis: reading file " <<
filename << std::endl;
165 while (fscanf(
f,
"%d %d %d %d %d %d %d %d %d\n",
tmp,
tmp + 1,
tmp + 2,
tmp + 3,
tmp + 4,
tmp + 5,
tmp + 6,
tmp + 7,
tmp + 8) == 9)
168 if (
tmp[0] == 0 &&
tmp[1] == 0 &&
tmp[2] == 0 &&
tmp[3] == 0 &&
tmp[4] == 0 &&
tmp[5] == 0 &&
tmp[6] == 0 &&
tmp[7] == 0)
187 if (HToccupancy > 0.5 )
skip = 51;
188 if (HToccupancy < 0.0001)
skip = 52;
190 if (occupancy > 0.99 )
skip = 11;
209 std::cout <<
"read ONE straw permanently masked is ALIVE!!! " <<
tmp[0] <<
", " <<
tmp[1] <<
", " <<
tmp[2] <<
", hits: " <<
tmp[3] <<
", occ: " << occupancy <<
", eff: " <<
efficiency << std::endl;
216 std::cout <<
"read " << countlines <<
" lines from file " <<
filename <<
", N events: " <<
nevents << std::endl;
◆ ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY |
◆ checkDead_LT
◆ checkLoEff_HT
bool checkLoEff_HT = false |
◆ checkLoEff_LT
bool checkLoEff_LT = true |
◆ checkNoisy_HT
bool checkNoisy_HT = false |
◆ checkNoisy_LT
bool checkNoisy_LT = false |
◆ deadStraws
int deadStraws[2][32][5482] |
◆ onlyMaskBoards
bool onlyMaskBoards = false |
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")