Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | 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 Types

enum  EParam {
  kPeriod_phi, kPeriod_sinheta, kDelta_x_slope, kDelta_x_offset,
  kError_x, kDelta_y_slope, kDelta_y_offset, kError_y,
  kNParam
}
 

Public Member Functions

 PixelClusterErrorData ()
 
 ~PixelClusterErrorData ()
 
std::pair< double, double > getDelta (IdentifierHash idHash, int sizePhi, double angle, int sizeZ, double eta) const
 Methods to access the calibration data. More...
 
std::pair< double, double > getDeltaError (IdentifierHash idHash) const
 
void setDeltaError (IdentifierHash idHash, float period_phi, float period_sinheta, float delta_x_slope, float delta_x_offset, float error_x, float delta_y_slope, float delta_y_offset, float error_y)
 
void setDeltaError (IdentifierHash idHash, const std::array< float, kNParam > &param)
 
void setDeltaError (IdentifierHash idHash, std::span< double > param)
 
void print (const std::string &file) const
 
unsigned int load (const std::string &file)
 load cluster error data from ascii file More...
 
IdentifierHash getIdentifierHash (Identifier identifier) const
 
Identifier getIdentifier (IdentifierHash idHash) const
 
const std::vector< std::array< float, kNParam > > & getConstMap () const
 

Private Member Functions

void initialize ()
 

Private Attributes

std::vector< std::array< float, kNParam > > m_constmap
 
const PixelIDm_pixelID {nullptr}
 

Detailed Description

Definition at line 24 of file ITkPixelClusterErrorData.h.

Member Enumeration Documentation

◆ EParam

Enumerator
kPeriod_phi 
kPeriod_sinheta 
kDelta_x_slope 
kDelta_x_offset 
kError_x 
kDelta_y_slope 
kDelta_y_offset 
kError_y 
kNParam 

Definition at line 28 of file ITkPixelClusterErrorData.h.

28  {
33  kError_x,
36  kError_y,
37  kNParam
38  };

Constructor & Destructor Documentation

◆ PixelClusterErrorData()

ITk::PixelClusterErrorData::PixelClusterErrorData ( )
inline

Definition at line 40 of file ITkPixelClusterErrorData.h.

40 { initialize(); }

◆ ~PixelClusterErrorData()

ITk::PixelClusterErrorData::~PixelClusterErrorData ( )
inline

Definition at line 41 of file ITkPixelClusterErrorData.h.

41 {};

Member Function Documentation

◆ getConstMap()

const std::vector< std::array<float, kNParam> >& ITk::PixelClusterErrorData::getConstMap ( ) const
inline

Definition at line 78 of file ITkPixelClusterErrorData.h.

78 { return m_constmap; }

◆ getDelta()

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

Methods to access the calibration data.

Definition at line 32 of file ITkPixelClusterErrorData.cxx.

35 {
36 
37  const std::array<float,kNParam> &value = m_constmap.at(idHash);
38  double period_phi = value[kPeriod_phi];
39  double period_sinheta = value[kPeriod_sinheta];
40  double delta_x_slope = value[kDelta_x_slope];
41  double delta_x_offset = value[kDelta_x_offset];
42  double delta_y_slope = value[kDelta_y_slope];
43  double delta_y_offset = value[kDelta_y_offset];
44 
45  double delta_x = delta_x_slope * fabs(angle - period_phi*(sizePhi-2)) + delta_x_offset;
46  double delta_y = delta_y_slope * fabs(sinh(fabs(eta)) - period_sinheta*(sizeZ-2)) + delta_y_offset;
47  return std::make_pair(delta_x,delta_y);
48 
49 }

◆ getDeltaError()

std::pair<double,double> ITk::PixelClusterErrorData::getDeltaError ( IdentifierHash  idHash) const
inline

Definition at line 48 of file ITkPixelClusterErrorData.h.

48  {
49  const std::array<float,kNParam> &values = m_constmap.at(idHash);
50  return std::make_pair(values[kError_x],values[kError_y]);
51  }

◆ getIdentifier()

Identifier ITk::PixelClusterErrorData::getIdentifier ( IdentifierHash  idHash) const
inline

Definition at line 74 of file ITkPixelClusterErrorData.h.

74  {
75  return m_pixelID->wafer_id(idHash);
76  }

◆ getIdentifierHash()

IdentifierHash ITk::PixelClusterErrorData::getIdentifierHash ( Identifier  identifier) const
inline

Definition at line 71 of file ITkPixelClusterErrorData.h.

71  {
73  }

◆ initialize()

void ITk::PixelClusterErrorData::initialize ( )
private

Definition at line 18 of file ITkPixelClusterErrorData.cxx.

19 {
20  SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
21  if(!detStore){
22  throw std::runtime_error("Could not retrieve DetectorStore");
23  }
24  StatusCode sc = detStore->retrieve(m_pixelID, "PixelID");
25  if(sc.isFailure() or (m_pixelID == nullptr)){
26  throw std::runtime_error("Could not retrieve PixelID");
27  }
28  m_constmap.resize(m_pixelID->wafer_hash_max(),std::array<float,kNParam>{});
29 }

◆ load()

unsigned int ITk::PixelClusterErrorData::load ( const std::string &  file)

load cluster error data from ascii file

Parameters
filename of the ascii file
Returns
number of entries read from the file.

Definition at line 83 of file ITkPixelClusterErrorData.cxx.

83  {
84 
85  std::ifstream infile( file.c_str() );
86  unsigned int n_entries=0;
87  if(infile.is_open()){
88 
89  //
90  // Data in the file is stored in the following columns:
91  // waferID_hash : period_phi : period_sinheta : delta_x_slope : delta_x_offset : delta_error_x : delta_y_slope : delta_y_offset : delta_error_y
92  //
93 
94  int waferID_hash_int;
95  double period_phi;
96  double period_sinheta;
97  double delta_x_slope;
98  double delta_x_offset;
99  double delta_error_x;
100  double delta_y_slope;
101  double delta_y_offset;
102  double delta_error_y;
103 
104  while(!infile.eof()){
105 
106  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;
107 
108  IdentifierHash waferID_hash(waferID_hash_int);
109  setDeltaError(waferID_hash,
110  period_phi, period_sinheta,
111  delta_x_slope, delta_x_offset, delta_error_x,
112  delta_y_slope, delta_y_offset, delta_error_y);
113  ++n_entries;
114 
115  }
116 
117  infile.close();
118 
119  } else {
120  throw std::runtime_error("ITkAnalogueClusteringConstantsFile \"" + file + "\" can not be read. Unable to proceed.");
121  }
122  return n_entries;
123 }

◆ print()

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

Definition at line 68 of file ITkPixelClusterErrorData.cxx.

69 {
70  std::ofstream outfile(file.c_str());
71  for(unsigned int id_hash=0; const std::array<float, kNParam> &values : m_constmap){
72  outfile << id_hash++;
73  for (double a_val : values ) {
74  outfile << " " << a_val;
75  }
76  }
77  outfile.close();
78 }

◆ setDeltaError() [1/3]

void ITk::PixelClusterErrorData::setDeltaError ( IdentifierHash  idHash,
const std::array< float, kNParam > &  param 
)
inline

Definition at line 56 of file ITkPixelClusterErrorData.h.

56  {
57  m_constmap.at(idHash)=param;
58  }

◆ setDeltaError() [2/3]

void ITk::PixelClusterErrorData::setDeltaError ( IdentifierHash  idHash,
float  period_phi,
float  period_sinheta,
float  delta_x_slope,
float  delta_x_offset,
float  error_x,
float  delta_y_slope,
float  delta_y_offset,
float  error_y 
)

Definition at line 56 of file ITkPixelClusterErrorData.cxx.

60 {
61  setDeltaError(idHash, std::array<float, kNParam>{period_phi, period_sinheta,
62  delta_x_slope, delta_x_offset, error_x,
63  delta_y_slope, delta_y_offset, error_y});
64 }

◆ setDeltaError() [3/3]

void ITk::PixelClusterErrorData::setDeltaError ( IdentifierHash  idHash,
std::span< double >  param 
)
inline

Definition at line 59 of file ITkPixelClusterErrorData.h.

59  {
60  std::array<float,kNParam> &dest=m_constmap.at(idHash);
61  if (param.size() != dest.size()) throw std::range_error("Parameter sizes do not match");
62  std::copy(param.begin(),param.end(), dest.begin());
63  }

Member Data Documentation

◆ m_constmap

std::vector< std::array<float, kNParam> > ITk::PixelClusterErrorData::m_constmap
private

Definition at line 83 of file ITkPixelClusterErrorData.h.

◆ m_pixelID

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

Definition at line 85 of file ITkPixelClusterErrorData.h.


The documentation for this class was generated from the following files:
ITk::PixelClusterErrorData::kDelta_y_slope
@ kDelta_y_slope
Definition: ITkPixelClusterErrorData.h:34
run.infile
string infile
Definition: run.py:13
ITk::PixelClusterErrorData::kPeriod_phi
@ kPeriod_phi
Definition: ITkPixelClusterErrorData.h:29
athena.value
value
Definition: athena.py:124
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
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
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
ITk::PixelClusterErrorData::kDelta_x_offset
@ kDelta_x_offset
Definition: ITkPixelClusterErrorData.h:32
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
ITk::PixelClusterErrorData::kError_y
@ kError_y
Definition: ITkPixelClusterErrorData.h:36
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
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
ITk::PixelClusterErrorData::kDelta_y_offset
@ kDelta_y_offset
Definition: ITkPixelClusterErrorData.h:35
PixelID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: PixelID.cxx:831
ITk::PixelClusterErrorData::m_pixelID
const PixelID * m_pixelID
Definition: ITkPixelClusterErrorData.h:85
ITk::PixelClusterErrorData::kError_x
@ kError_x
Definition: ITkPixelClusterErrorData.h:33
ITk::PixelClusterErrorData::kPeriod_sinheta
@ kPeriod_sinheta
Definition: ITkPixelClusterErrorData.h:30
ITk::PixelClusterErrorData::kNParam
@ kNParam
Definition: ITkPixelClusterErrorData.h:37
ITk::PixelClusterErrorData::initialize
void initialize()
Definition: ITkPixelClusterErrorData.cxx:18
ITk::PixelClusterErrorData::kDelta_x_slope
@ kDelta_x_slope
Definition: ITkPixelClusterErrorData.h:31
calibdata.copy
bool copy
Definition: calibdata.py:27
ITk::PixelClusterErrorData::m_constmap
std::vector< std::array< float, kNParam > > m_constmap
Definition: ITkPixelClusterErrorData.h:83
ITk::PixelClusterErrorData::setDeltaError
void setDeltaError(IdentifierHash idHash, float period_phi, float period_sinheta, float delta_x_slope, float delta_x_offset, float error_x, float delta_y_slope, float delta_y_offset, float error_y)
Definition: ITkPixelClusterErrorData.cxx:56
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