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
 
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
 
StoreGateSvcm_detStore {nullptr}
 
const PixelIDm_pixelID {nullptr}
 

Detailed Description

Definition at line 20 of file ITkPixelClusterErrorData.h.

Constructor & Destructor Documentation

◆ PixelClusterErrorData()

ITk::PixelClusterErrorData::PixelClusterErrorData ( )
inline

Definition at line 24 of file ITkPixelClusterErrorData.h.

24 { Initialize(); }

◆ ~PixelClusterErrorData()

ITk::PixelClusterErrorData::~PixelClusterErrorData ( )
inline

Definition at line 25 of file ITkPixelClusterErrorData.h.

25 {};

Member Function Documentation

◆ getConstMap()

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

Definition at line 33 of file ITkPixelClusterErrorData.h.

33 {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 35 of file ITkPixelClusterErrorData.cxx.

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

◆ getDeltaError()

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

Definition at line 56 of file ITkPixelClusterErrorData.cxx.

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

◆ Initialize()

void ITk::PixelClusterErrorData::Initialize ( )
private

Definition at line 19 of file ITkPixelClusterErrorData.cxx.

20 {
21 
22  ISvcLocator* svcLoc = Gaudi::svcLocator();
23  StatusCode sc = svcLoc->service("DetectorStore", m_detStore);
24  if(sc.isFailure()){
25  throw std::runtime_error("Could not retrieve DetectorStore");
26  }
27  sc = m_detStore->retrieve(m_pixelID, "PixelID");
28  if(sc.isFailure()){
29  throw std::runtime_error("Could not retrieve PixelID");
30  }
31 
32 }

◆ load()

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

Definition at line 105 of file ITkPixelClusterErrorData.cxx.

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

◆ print()

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

Definition at line 87 of file ITkPixelClusterErrorData.cxx.

88 {
89 
90  std::ofstream outfile(file.c_str());
91 
92  for(const auto & x : m_constmap){
93 
94  std::vector<double> value = x.second;
95  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;
96 
97  }
98 
99  outfile.close();
100 }

◆ 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 71 of file ITkPixelClusterErrorData.cxx.

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

Member Data Documentation

◆ m_constmap

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

Definition at line 48 of file ITkPixelClusterErrorData.h.

◆ m_detStore

StoreGateSvc* ITk::PixelClusterErrorData::m_detStore {nullptr}
private

Definition at line 50 of file ITkPixelClusterErrorData.h.

◆ m_pixelID

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

Definition at line 51 of file ITkPixelClusterErrorData.h.


The documentation for this class was generated from the following files:
run.infile
string infile
Definition: run.py:13
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:71
athena.value
value
Definition: athena.py:122
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
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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:19
ITk::PixelClusterErrorData::m_detStore
StoreGateSvc * m_detStore
Definition: ITkPixelClusterErrorData.h:50
ITk::PixelClusterErrorData::m_pixelID
const PixelID * m_pixelID
Definition: ITkPixelClusterErrorData.h:51
ITk::PixelClusterErrorData::m_constmap
std::map< const Identifier, std::vector< double > > m_constmap
Definition: ITkPixelClusterErrorData.h:48
IdentifierHash
Definition: IdentifierHash.h:38
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42