ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ITk::PixelClusterErrorData Class Reference

#include <ITkPixelClusterErrorData.h>

Collaboration diagram for ITk::PixelClusterErrorData:

Public Member Functions

 PixelClusterErrorData ()
 
 ~PixelClusterErrorData ()
 
std::pair< double, double > getDelta (const Identifier *pixelId, int sizePhi, double angle, int sizeZ, double eta) const
 Methods to access the calibration data. More...
 
std::pair< double, double > getDeltaError (const Identifier *pixelId) const
 
const std::map< const Identifier, std::vector< double > > & getConstMap () const
 
void setDeltaError (const Identifier *pixelId, double period_phi, double period_sinheta, double delta_x_slope, double delta_x_offset, double error_x, double delta_y_slope, double delta_y_offset, double error_y)
 
void print (const std::string &file) const
 
void load (const std::string &file)
 

Private Member Functions

void Initialize ()
 

Private Attributes

std::map< const Identifier, std::vector< double > > m_constmap
 
const PixelIDm_pixelID {nullptr}
 

Detailed Description

Definition at line 19 of file ITkPixelClusterErrorData.h.

Constructor & Destructor Documentation

◆ PixelClusterErrorData()

ITk::PixelClusterErrorData::PixelClusterErrorData ( )
inline

Definition at line 23 of file ITkPixelClusterErrorData.h.

23 { Initialize(); }

◆ ~PixelClusterErrorData()

ITk::PixelClusterErrorData::~PixelClusterErrorData ( )
inline

Definition at line 24 of file ITkPixelClusterErrorData.h.

24 {};

Member Function Documentation

◆ getConstMap()

const std::map< const Identifier, std::vector<double> >& ITk::PixelClusterErrorData::getConstMap ( ) const
inline

Definition at line 32 of file ITkPixelClusterErrorData.h.

32 {return m_constmap;}

◆ getDelta()

std::pair< double, double > ITk::PixelClusterErrorData::getDelta ( const Identifier pixelId,
int  sizePhi,
double  angle,
int  sizeZ,
double  eta 
) const

Methods to access the calibration data.

Definition at line 34 of file ITkPixelClusterErrorData.cxx.

37 {
38 
39  std::vector<double> value = m_constmap.at(*pixelId);
40  double period_phi = value[0];
41  double period_sinheta = value[1];
42  double delta_x_slope = value[2];
43  double delta_x_offset = value[3];
44  double delta_y_slope = value[5];
45  double delta_y_offset = value[6];
46 
47  double delta_x = delta_x_slope * fabs(angle - period_phi*(sizePhi-2)) + delta_x_offset;
48  double delta_y = delta_y_slope * fabs(sinh(fabs(eta)) - period_sinheta*(sizeZ-2)) + delta_y_offset;
49 
50  return std::make_pair(delta_x,delta_y);
51 
52 }

◆ getDeltaError()

std::pair< double, double > ITk::PixelClusterErrorData::getDeltaError ( const Identifier pixelId) const

Definition at line 55 of file ITkPixelClusterErrorData.cxx.

56 {
57 
58  std::vector<double> value = m_constmap.at(*pixelId);
59 
60  double delta_x_error = value[4];
61  double delta_y_error = value[7];
62 
63  return std::make_pair(delta_x_error,delta_y_error);
64 
65 }

◆ Initialize()

void ITk::PixelClusterErrorData::Initialize ( )
private

Definition at line 20 of file ITkPixelClusterErrorData.cxx.

21 {
22  SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
23  if(!detStore){
24  throw std::runtime_error("Could not retrieve DetectorStore");
25  }
26  StatusCode sc = detStore->retrieve(m_pixelID, "PixelID");
27  if(sc.isFailure()){
28  throw std::runtime_error("Could not retrieve PixelID");
29  }
30 
31 }

◆ load()

void ITk::PixelClusterErrorData::load ( const std::string &  file)

Definition at line 104 of file ITkPixelClusterErrorData.cxx.

104  {
105 
106  std::ifstream infile( file.c_str() );
107 
108  if(infile.is_open()){
109 
110  //
111  // Data in the file is stored in the following columns:
112  // waferID_hash : period_phi : period_sinheta : delta_x_slope : delta_x_offset : delta_error_x : delta_y_slope : delta_y_offset : delta_error_y
113  //
114 
115  int waferID_hash_int;
116  double period_phi;
117  double period_sinheta;
118  double delta_x_slope;
119  double delta_x_offset;
120  double delta_error_x;
121  double delta_y_slope;
122  double delta_y_offset;
123  double delta_error_y;
124 
125  while(!infile.eof()){
126 
127  infile >> waferID_hash_int >> period_phi >> period_sinheta >> delta_x_slope >> delta_x_offset >> delta_error_x >> delta_y_slope >> delta_y_offset >> delta_error_y;
128 
129  IdentifierHash waferID_hash(waferID_hash_int);
130  Identifier pixelId = m_pixelID->wafer_id(waferID_hash);
131  setDeltaError(&pixelId,
132  period_phi, period_sinheta,
133  delta_x_slope, delta_x_offset, delta_error_x,
134  delta_y_slope, delta_y_offset, delta_error_y);
135 
136  }
137 
138  infile.close();
139 
140  } else {
141  throw std::runtime_error("ITkAnalogueClusteringConstantsFile \"" + file + "\" can not be read. Unable to proceed.");
142  }
143 
144 }

◆ print()

void ITk::PixelClusterErrorData::print ( const std::string &  file) const

Definition at line 86 of file ITkPixelClusterErrorData.cxx.

87 {
88 
89  std::ofstream outfile(file.c_str());
90 
91  for(const auto & x : m_constmap){
92 
93  std::vector<double> value = x.second;
94  outfile << m_pixelID->wafer_hash(x.first) << " " << value[0] << " " << value[1] << " " << value[2] << " " << value[3] << " " << value[4] << " " << value[5] << " " << value[6] << " " << value[7] << std::endl;
95 
96  }
97 
98  outfile.close();
99 }

◆ setDeltaError()

void ITk::PixelClusterErrorData::setDeltaError ( const Identifier pixelId,
double  period_phi,
double  period_sinheta,
double  delta_x_slope,
double  delta_x_offset,
double  error_x,
double  delta_y_slope,
double  delta_y_offset,
double  error_y 
)

Definition at line 70 of file ITkPixelClusterErrorData.cxx.

74 {
75 
76  std::vector<double> linevalues = {period_phi, period_sinheta,
77  delta_x_slope, delta_x_offset, error_x,
78  delta_y_slope, delta_y_offset, error_y};
79 
80  m_constmap[*pixelId] = linevalues;
81 
82 }

Member Data Documentation

◆ m_constmap

std::map< const Identifier, std::vector<double> > ITk::PixelClusterErrorData::m_constmap
private

Definition at line 47 of file ITkPixelClusterErrorData.h.

◆ m_pixelID

const PixelID* ITk::PixelClusterErrorData::m_pixelID {nullptr}
private

Definition at line 49 of file ITkPixelClusterErrorData.h.


The documentation for this class was generated from the following files:
run.infile
string infile
Definition: run.py:13
ITk::PixelClusterErrorData::setDeltaError
void setDeltaError(const Identifier *pixelId, double period_phi, double period_sinheta, double delta_x_slope, double delta_x_offset, double error_x, double delta_y_slope, double delta_y_offset, double error_y)
Definition: ITkPixelClusterErrorData.cxx:70
athena.value
value
Definition: athena.py:124
x
#define x
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
file
TFile * file
Definition: tile_monitor.h:29
ITk::PixelClusterErrorData::Initialize
void Initialize()
Definition: ITkPixelClusterErrorData.cxx:20
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
ITk::PixelClusterErrorData::m_pixelID
const PixelID * m_pixelID
Definition: ITkPixelClusterErrorData.h:49
ITk::PixelClusterErrorData::m_constmap
std::map< const Identifier, std::vector< double > > m_constmap
Definition: ITkPixelClusterErrorData.h:47
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
Identifier
Definition: IdentifierFieldParser.cxx:14