ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
AFP
AFP_Calibration
src
AFP_PixelIdentifier.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AFP_Calibration/AFP_PixelIdentifier.h
"
6
7
8
AFP_PixelIdentifier::AFP_PixelIdentifier
(
const
std::string& input_name,
const
std::string& output_name,
const
std::vector<std::string>& pixelTools) :
9
m_input_file
(
std
::make_unique<TFile>(input_name.c_str(),
"read"
)),
10
m_output_file
(
std
::make_unique<TFile>(output_name.c_str(),
"recreate"
)),
11
m_pixelTools_names
(pixelTools)
12
{
13
for
(
const
std::string& pixel_name:
m_pixelTools_names
)
14
{
15
if
(pixel_name==
"AFP_DeadPixel"
)
16
{
17
m_pixelTools
.push_back(std::make_unique<AFP_DeadPixelTool>());
18
}
19
else
if
(pixel_name==
"AFP_NoisyPixel"
)
20
{
21
m_pixelTools
.push_back(std::make_unique<AFP_NoisyPixelTool>());
22
}
23
}
24
25
AFP_CONSTANTS
afp_consts;
26
m_nPixelsX
=afp_consts.
SiT_Pixel_amount_x
;
27
m_nPixelsY
=afp_consts.
SiT_Pixel_amount_y
;
28
}
29
30
31
int
AFP_PixelIdentifier::execute
()
32
{
33
if
(
m_pixelTools
.empty())
34
{
35
return
0;
36
}
37
38
std::unique_ptr<TH1I> hist_lb(
static_cast<
TH1I*
>
(
m_input_file
->Get(
"LBRangeLength"
)));
39
int
LBRangeLength=hist_lb->GetBinContent(2)/hist_lb->GetBinContent(1);
40
41
for
(
int
st=0;st<
m_nStations
;++st)
42
{
43
for
(
int
la=0;la<
m_nLayers
;++la)
44
{
45
int
lbIdx=0;
46
while
(
true
)
// repeat until there are valid histograms
47
{
48
std::shared_ptr<const TH2F> pixelHits(
dynamic_cast<
TH2F*
>
(
m_input_file
->Get(
49
Form(
"pixel_hits_lb_%d_%d_station_%d_layer_%d"
, lbIdx*LBRangeLength, (lbIdx+1)*LBRangeLength-1, st,la)
50
)));
51
52
if
(!pixelHits.get())
break
;
53
54
for
(
auto
&pixelTool :
m_pixelTools
)
55
{
56
std::vector<TH2F> output{TH2F(Form(
"lb_%d_%d_station_%d_layer_%d"
,lbIdx*LBRangeLength,(lbIdx+1)*LBRangeLength-1,st,la),
57
Form(
"lb %d-%d, station %d, layer %d"
, lbIdx*LBRangeLength,(lbIdx+1)*LBRangeLength-1,st,la),
58
m_nPixelsX
,0.5,
m_nPixelsX
+0.5,
m_nPixelsY
,0.5,
m_nPixelsY
+1)};
59
60
pixelTool->Identify(pixelHits,output);
61
62
for
(TH2F& out : output)
63
{
64
out.Write();
65
}
66
}
67
68
++lbIdx;
69
}
70
}
71
}
72
73
m_output_file
->Close();
74
return
0;
75
}
76
77
AFP_PixelIdentifier.h
AFP_PixelIdentifier::execute
int execute()
Definition
AFP_PixelIdentifier.cxx:31
AFP_PixelIdentifier::m_output_file
std::unique_ptr< TFile > m_output_file
Definition
AFP_PixelIdentifier.h:33
AFP_PixelIdentifier::AFP_PixelIdentifier
AFP_PixelIdentifier(const std::string &input_name="AFP_PixelHistoFiller.root", const std::string &output_name="AFP_PixelIdentifier.root", const std::vector< std::string > &pixelTools={"AFP_DeadPixel", "AFP_NoisyPixel"})
Definition
AFP_PixelIdentifier.cxx:8
AFP_PixelIdentifier::m_nStations
static const int m_nStations
Definition
AFP_PixelIdentifier.h:35
AFP_PixelIdentifier::m_pixelTools_names
std::vector< std::string > m_pixelTools_names
Definition
AFP_PixelIdentifier.h:42
AFP_PixelIdentifier::m_input_file
std::unique_ptr< TFile > m_input_file
Definition
AFP_PixelIdentifier.h:32
AFP_PixelIdentifier::m_pixelTools
std::vector< std::unique_ptr< IAFP_GenericPixelTool > > m_pixelTools
Definition
AFP_PixelIdentifier.h:43
AFP_PixelIdentifier::m_nPixelsX
int m_nPixelsX
Definition
AFP_PixelIdentifier.h:37
AFP_PixelIdentifier::m_nPixelsY
int m_nPixelsY
Definition
AFP_PixelIdentifier.h:38
AFP_PixelIdentifier::m_nLayers
static const int m_nLayers
Definition
AFP_PixelIdentifier.h:36
std
STL namespace.
AFP_CONSTANTS
Definition
AFP_constants.h:13
AFP_CONSTANTS::SiT_Pixel_amount_y
static constexpr double SiT_Pixel_amount_y
Definition
AFP_constants.h:57
AFP_CONSTANTS::SiT_Pixel_amount_x
static constexpr double SiT_Pixel_amount_x
Definition
AFP_constants.h:56
Generated on
for ATLAS Offline Software by
1.17.0