ATLAS Offline Software
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
AFP_PixelIdentifier Class Reference

#include <AFP_PixelIdentifier.h>

Collaboration diagram for AFP_PixelIdentifier:

Public Member Functions

 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"})
 
 ~AFP_PixelIdentifier ()=default
 
int execute ()
 

Private Attributes

std::unique_ptr< TFile > m_input_file
 
std::unique_ptr< TFile > m_output_file
 
int m_nPixelsX
 
int m_nPixelsY
 
std::vector< TH2F > m_pixelHits [m_nStations][m_nLayers]
 
std::vector< std::string > m_pixelTools_names
 
std::vector< std::unique_ptr< IAFP_GenericPixelTool > > m_pixelTools
 

Static Private Attributes

static const int m_nStations =4
 
static const int m_nLayers =4
 

Detailed Description

Definition at line 22 of file AFP_PixelIdentifier.h.

Constructor & Destructor Documentation

◆ 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 at line 8 of file AFP_PixelIdentifier.cxx.

8  :
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 }

◆ ~AFP_PixelIdentifier()

AFP_PixelIdentifier::~AFP_PixelIdentifier ( )
default

Member Function Documentation

◆ execute()

int AFP_PixelIdentifier::execute ( )

Definition at line 31 of file AFP_PixelIdentifier.cxx.

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 }

Member Data Documentation

◆ m_input_file

std::unique_ptr<TFile> AFP_PixelIdentifier::m_input_file
private

Definition at line 32 of file AFP_PixelIdentifier.h.

◆ m_nLayers

const int AFP_PixelIdentifier::m_nLayers =4
staticprivate

Definition at line 36 of file AFP_PixelIdentifier.h.

◆ m_nPixelsX

int AFP_PixelIdentifier::m_nPixelsX
private

Definition at line 37 of file AFP_PixelIdentifier.h.

◆ m_nPixelsY

int AFP_PixelIdentifier::m_nPixelsY
private

Definition at line 38 of file AFP_PixelIdentifier.h.

◆ m_nStations

const int AFP_PixelIdentifier::m_nStations =4
staticprivate

Definition at line 35 of file AFP_PixelIdentifier.h.

◆ m_output_file

std::unique_ptr<TFile> AFP_PixelIdentifier::m_output_file
private

Definition at line 33 of file AFP_PixelIdentifier.h.

◆ m_pixelHits

std::vector<TH2F> AFP_PixelIdentifier::m_pixelHits[m_nStations][m_nLayers]
private

Definition at line 40 of file AFP_PixelIdentifier.h.

◆ m_pixelTools

std::vector<std::unique_ptr<IAFP_GenericPixelTool> > AFP_PixelIdentifier::m_pixelTools
private

Definition at line 43 of file AFP_PixelIdentifier.h.

◆ m_pixelTools_names

std::vector<std::string> AFP_PixelIdentifier::m_pixelTools_names
private

Definition at line 42 of file AFP_PixelIdentifier.h.


The documentation for this class was generated from the following files:
AFP_PixelIdentifier::m_nPixelsY
int m_nPixelsY
Definition: AFP_PixelIdentifier.h:38
AFP_PixelIdentifier::m_pixelTools
std::vector< std::unique_ptr< IAFP_GenericPixelTool > > m_pixelTools
Definition: AFP_PixelIdentifier.h:43
AFP_CONSTANTS
Definition: AFP_constants.h:13
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
AFP_PixelIdentifier::m_output_file
std::unique_ptr< TFile > m_output_file
Definition: AFP_PixelIdentifier.h:33
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
AFP_PixelIdentifier::m_nStations
static const int m_nStations
Definition: AFP_PixelIdentifier.h:35
AFP_PixelIdentifier::m_input_file
std::unique_ptr< TFile > m_input_file
Definition: AFP_PixelIdentifier.h:32
merge.output
output
Definition: merge.py:17
AFP_PixelIdentifier::m_nPixelsX
int m_nPixelsX
Definition: AFP_PixelIdentifier.h:37
AFP_CONSTANTS::SiT_Pixel_amount_x
static constexpr double SiT_Pixel_amount_x
Definition: AFP_constants.h:56
AFP_CONSTANTS::SiT_Pixel_amount_y
static constexpr double SiT_Pixel_amount_y
Definition: AFP_constants.h:57
AFP_PixelIdentifier::m_nLayers
static const int m_nLayers
Definition: AFP_PixelIdentifier.h:36
AFP_PixelIdentifier::m_pixelTools_names
std::vector< std::string > m_pixelTools_names
Definition: AFP_PixelIdentifier.h:42