ATLAS Offline Software
Loading...
Searching...
No Matches
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.
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
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

Constructor & Destructor Documentation

◆ PixelClusterErrorData()

ITk::PixelClusterErrorData::PixelClusterErrorData ( )
inline

◆ ~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; }
std::vector< std::array< float, kNParam > > 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 * std::fabs(angle - period_phi*(sizePhi-2)) + delta_x_offset;
46 double delta_y = delta_y_slope * std::fabs(std::sinh(std::fabs(eta)) - period_sinheta*(sizeZ-2)) + delta_y_offset;
47 return std::make_pair(delta_x,delta_y);
48
49}
Scalar eta() const
pseudorapidity method
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)

◆ 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 {
72 return m_pixelID->wafer_hash(identifier);
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}
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ 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}
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)
str infile
Definition run.py:13
TFile * file

◆ 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.

85{nullptr};

The documentation for this class was generated from the following files: