ATLAS Offline Software
ITkPixelOfflineCalibData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ITkPixelOfflineCalibData.cxx, (c) ATLAS Detector software
8 
10 #include "Identifier/Identifier.h"
11 
12 #include <sstream>
13 
14 namespace ITk
15 {
16 
17  std::vector<float> PixelOfflineCalibData::getConstants() const {
18 
19  std::map< const Identifier, std::vector<double> > constMap = m_clusterErrorData->getConstMap();
20 
21  int entry_size = 9; // pixel Id + period_phi + period_sinheta + delta_x_slope + delta_x_offset + delta_err_x + delta_y_slope + delta_y_offset + delta_err_y
22  int data_size = entry_size*constMap.size();
23 
24  std::vector<float> constants;
25  constants.reserve(data_size);
26 
27  for(auto& x : constMap){
28 
29  long long pixelId(x.first.get_compact());
30  std::vector<double> value = x.second;
31 
32  constants.push_back(pixelId);
33  for(auto& y : value) constants.push_back(y);
34 
35  }
36 
37  return constants;
38 
39  }
40 
42  m_clusterErrorData->print("ITkPixelClusterDump.txt");
43  }
44 
45 
46  void PixelOfflineCalibData::setConstants(const std::vector<float> &constants) {
47 
48  int entry_size = 9;
49  int map_size = constants.size()/entry_size;
50 
51  for(int i=0;i<map_size;i++){
52 
53  long long pixelId_long = constants[i*entry_size];
54  std::ostringstream ss;
55  ss << "0x" << std::hex << pixelId_long;
56  std::string pixelId_str(ss.str());
57  Identifier pixelId;
58  pixelId.set(pixelId_str);
59 
60  double period_phi = constants[i*entry_size + 1];
61  double period_sinheta = constants[i*entry_size + 2];
62  double delta_x_slope = constants[i*entry_size + 3];
63  double delta_x_offset = constants[i*entry_size + 4];
64  double delta_err_x = constants[i*entry_size + 5];
65  double delta_y_slope = constants[i*entry_size + 6];
66  double delta_y_offset = constants[i*entry_size + 7];
67  double delta_err_y = constants[i*entry_size + 8];
68 
69  m_clusterErrorData->setDeltaError(&pixelId, period_phi, period_sinheta,
70  delta_x_slope, delta_x_offset, delta_err_x,
71  delta_y_slope, delta_y_offset, delta_err_y);
72 
73  }
74  }
75 
76 } // end of namespace ITk
ITk::PixelOfflineCalibData::dump
void dump()
Definition: ITkPixelOfflineCalibData.cxx:41
ITkPixelOfflineCalibData.h
Identifier::set
void set(const std::string &id)
build from a string form - hexadecimal
Definition: Identifier.cxx:12
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
athena.value
value
Definition: athena.py:124
ITk::PixelOfflineCalibData::getConstants
std::vector< float > getConstants() const
Definition: ITkPixelOfflineCalibData.cxx:17
x
#define x
ITk::PixelOfflineCalibData::setConstants
void setConstants(const std::vector< float > &constants)
Definition: ITkPixelOfflineCalibData.cxx:46
ITk::PixelOfflineCalibData::m_clusterErrorData
std::unique_ptr< PixelClusterErrorData > m_clusterErrorData
Definition: ITkPixelOfflineCalibData.h:51
lumiFormat.i
int i
Definition: lumiFormat.py:85
ITk
Definition: ITkPixelOfflineCalibCondAlg.cxx:14
y
#define y
constants
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:1
Identifier
Definition: IdentifierFieldParser.cxx:14