#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 "TSystem.h"
#include "TRT_StrawMap.h"
Go to the source code of this file.
◆ initializeDeadStrawsList()
| void initializeDeadStrawsList |
( |
| ) |
|
Definition at line 121 of file TRTCalib_StrawStatusReport.cxx.
127 for (
int i = 0;
i < 2;
i++)
128 for (
int j = 0; j < 32; j++)
129 for (
int k = 0;
k < 5482;
k++)
135 std::string
filename =
"/afs/cern.ch/user/i/idcalib/w0/TRT_Calibration/tmp/Tier0/StrawStatusCode/TRT_StrawStatus_ExcludedStraws_2023.txt";
140 std::cout <<
"TRT_StrawStatusReport::initializePermanentlyDead() ERROR: failed to open the input file " <<
filename << std::endl;
141 std::cout <<
"TRT_StrawStatusReport::initializePermanentlyDead() ERROR: you need to fix the file name / link, WILL CRASH THE CODE NOW" << std::endl;
144 while (fscanf(
f,
"%d %d %d %d %d %d\n",
tmp,
tmp + 1,
tmp + 2,
tmp + 3,
tmp + 4,
tmp + 5) == 6)
155 std::cout <<
"read " <<
count <<
" permanently excluded straws from file " <<
filename << std::endl;
◆ main()
| int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 41 of file TRTCalib_StrawStatusReport.cxx.
51 std::cout <<
"Created output/ folder.\n";
52 gSystem->mkdir(
"output/",1);
57 if (std::string(
argv[
i]) ==
"checkNoisy_HT")
59 else if (std::string(
argv[
i]) ==
"checkLoEff_HT")
61 else if (std::string(
argv[
i]) ==
"checkNoisy_LT")
63 else if (std::string(
argv[
i]) ==
"checkLoEff_LT")
65 else if (std::string(
argv[
i]) ==
"checkDead_LT")
68 else if (std::string(
argv[
i]) ==
"ignoreNoisy_HT")
70 else if (std::string(
argv[
i]) ==
"ignoreLoEff_HT")
72 else if (std::string(
argv[
i]) ==
"ignoreNoisy_LT")
74 else if (std::string(
argv[
i]) ==
"ignoreLoEff_LT")
76 else if (std::string(
argv[
i]) ==
"ignoreDead_LT")
79 else if (std::string(
argv[
i]) ==
"StatusPermanent")
84 std::cerr <<
"\n Please use one or several of the following options: \n"
85 <<
"\n\t - StatusPermanent: to only mask entire dead boards -- for use if updating StatusPermanent "
86 <<
"\n\t\t - if this option is used, all others will be ignored. \n"
87 <<
"\n\t - checkNoisy_HT: to mask straws with HT fraction > 0.5 "
88 <<
"\n\t - checkNoisy_LT: to mask straws with LT fraction > 0.99 "
89 <<
"\n\t - checkLoEff_HT: to mask straws with HT fraction < 0.0001 "
90 <<
"\n\t - checkLoEff_LT: to mask straws with LT fraction < 0.7 "
91 <<
"\n\t - checkDead_LT : to mask straws with LT fraction = 0.0 "
92 <<
"\n\t Replace \"check\" with \"ignore\" to ignore this category. \n "
98 std::cout <<
"\nOption selection:"
◆ printAthena()
| void printAthena |
( |
int |
run | ) |
|
Definition at line 227 of file TRTCalib_StrawStatusReport.cxx.
235 int countDeadStraws[] = {0, 0};
236 int breakDownOfDeadStraws[100][2];
237 for (
int i = 0;
i < 100;
i++)
238 for (
int j = 0; j < 2; j++)
239 breakDownOfDeadStraws[
i][j] = 0;
246 for (
int i = 0;
i < 2;
i++)
248 for (
int j = 0; j < 32; j++)
250 for (
int k = 0;
k < 5482;
k++)
255 int side = (
i != 0 ? -1 : 1);
267 fprintf(
fout,
"%2d %2d %2d %2d %2d %2d\n",
side, j, map.strawWithinLayer(), map.strawLayer(), map.layer(), 1);
274 fprintf(
fout,
"%2d %2d %2d %2d %2d %2d\n",
side, j, map.strawWithinLayer(), map.strawLayer(), map.layer(), 1);
280 breakDownOfDeadStraws[
deadStraws[
i][j][
k]][(
k < 1642) ? 0 : 1]++;
282 countDeadStraws[(fabs(
side) == 1) ? 0 : 1]++;
289 printf(
"found %d newly dead straws compared to %s \n",
count,
filename.c_str());
290 printf(
"N dead straws in TRT barrel: %4d or %4.1lf%%\n", countDeadStraws[0], (100. * countDeadStraws[0]) / (64. * 1642));
291 printf(
"N dead straws in TRT end-caps: %4d or %4.1lf%%\n", countDeadStraws[1], (100. * countDeadStraws[1]) / (64. * 20 * 192));
292 printf(
"overall: %4.2lf%%\n", 100. *
count / 350848.);
296 std::cout <<
"criteria barrel end-cap" << std::endl;
297 for (
int i = 2;
i < 100;
i++)
298 if (breakDownOfDeadStraws[
i][0] + breakDownOfDeadStraws[
i][1])
299 printf(
"%2d %4d %4d\n",
i, breakDownOfDeadStraws[
i][0], breakDownOfDeadStraws[
i][1]);
◆ printAthenaBoardsOnly()
| void printAthenaBoardsOnly |
( |
int |
run | ) |
|
Definition at line 304 of file TRTCalib_StrawStatusReport.cxx.
317 for (
int i = 0;
i < 2;
i++)
319 for (
int j = 0; j < 32; j++)
321 std::vector<int> allStrawsOnBoard[29];
322 std::vector<int> deadStrawsOnBoard[29];
323 std::vector<int> newDeadStrawsOnBoard[29];
325 for (
int k = 0;
k < 5482;
k++)
327 int side = (
i != 0 ? -1 : 1);
332 int board = map.TTCgroup();
338 if (board <0)
continue;
339 allStrawsOnBoard[board].push_back(
k);
341 deadStrawsOnBoard[board].push_back(
k);
343 newDeadStrawsOnBoard[board].push_back(
k);
346 for (
int board = 0; board < 29; ++board)
348 if (allStrawsOnBoard[board].
size() == deadStrawsOnBoard[board].
size())
352 for (
unsigned int it = 0;
it < deadStrawsOnBoard[board].size();
it++)
354 int k = deadStrawsOnBoard[board].at(
it);
355 int side = (
i != 0 ? -1 : 1);
359 fprintf(
fout,
"%2d %2d %2d %2d %2d %2d\n",
side, j, map.strawWithinLayer(), map.strawLayer(), map.layer(), 1);
363 if (allStrawsOnBoard[board].
size() == newDeadStrawsOnBoard[board].
size())
366 int side = (
i != 0 ? -1 : 1);
367 std::cout <<
"found a new dead board!!! " << std::endl;
368 std::cout <<
"See TRT_StrawMap.h for board ID info " << std::endl;
369 std::cout <<
"side: " <<
side <<
", phi: " << j <<
", board ID: " << board << std::endl
◆ reportResults()
| void reportResults |
( |
const std::string & |
filename, |
|
|
int |
run |
|
) |
| |
Definition at line 379 of file TRTCalib_StrawStatusReport.cxx.
387 FILE *
fout = fopen(
"TRT_StrawStatusReport.txt",
"w");
389 printf (
"Cannot open output file");
392 fprintf(
fout,
"%d %d %d %d %d %lf %lf %lf %2d\n", 0, 0, 0, 0,
run, 0., 0., 0., 0);
394 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)
397 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)
414 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());
417 std::cout <<
"reportResults: read " <<
count <<
" lines from file " <<
filename <<
", wrote to TRT_StrawStatusReport.txt" << std::endl;
◆ simpleAnalysis()
| void simpleAnalysis |
( |
const std::string & |
filename | ) |
|
Definition at line 161 of file TRTCalib_StrawStatusReport.cxx.
165 std::cout <<
"simpleAnalysis: reading file " <<
filename << std::endl;
170 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)
173 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)
192 if (HToccupancy > 0.5 )
skip = 51;
193 if (HToccupancy < 0.0001)
skip = 52;
195 if (occupancy > 0.99 )
skip = 11;
214 std::cout <<
"read ONE straw permanently masked is ALIVE!!! " <<
tmp[0] <<
", " <<
tmp[1] <<
", " <<
tmp[2] <<
", hits: " <<
tmp[3] <<
", occ: " << occupancy <<
", eff: " <<
efficiency << std::endl;
221 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="")