ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PixelCalib::PixelChargeInterpolationParameters Class Reference

#include <PixelChargeInterpolationParameters.h>

Collaboration diagram for PixelCalib::PixelChargeInterpolationParameters:

Public Member Functions

 PixelChargeInterpolationParameters ()
 
 ~PixelChargeInterpolationParameters ()=default
 
 PixelChargeInterpolationParameters (const PixelChargeInterpolationParameters &)=delete
 
int getVersion () const
 
void setVersion (int version)
 
float getDeltaXbarrel (int nRows, float angle, int ilayer=0) const
 Methods to access the calibration data as a function of the cluster size, angle/pseudorapidity, layer number. More...
 
float getDeltaYbarrel (int nCol, float eta, int ilayer=0) const
 
float getDeltaXIBL (int nRows, float angle) const
 
float getDeltaYIBL (int nCol, float eta) const
 
float getDeltaX (int iangle, int iclustersize, int ilayer) const
 methods to get/set the calibration data as a function of the bin index for the various variables separately More...
 
float getDeltaY (int ieta, int iclustersize, int ilayer) const
 
int setDeltaX (int iangle, int iclustersize, int ilayer, float value)
 
int setDeltaY (int ieta, int iclustersize, int ilayer, float value)
 
float getErrDeltaX (int iangle, int iclustersize, int ilayer) const
 methods to get/set the calibration data as a function of the bin index for the various variables separately More...
 
float getErrDeltaY (int ieta, int iclustersize, int ilayer) const
 
int setErrDeltaX (int iangle, int iclustersize, int ilayer, float value)
 
int setErrDeltaY (int ieta, int iclustersize, int ilayer, float value)
 
float getDeltaX (int i) const
 methods to get/set the calibration data as a function of the global bin index (the one used i the internal vector rapresentation as well as in the database, combining the various variables More...
 
float getDeltaY (int i) const
 
int setDeltaX (int i, float value)
 
int setDeltaY (int i, float value)
 
float getErrDeltaX (int i) const
 methods to get/set the calibration data errors as a function of the global bin index (the one used i the internal vector rapresentation as well as in the database, combining the various variables More...
 
float getErrDeltaY (int i) const
 
int setErrDeltaX (int i, float value)
 
int setErrDeltaY (int i, float value)
 
int getNumberOfXbins () const
 
int getNumberOfYbins () const
 
const std::vector< float > & getEtaBins () const
 
const std::vector< float > & getAngleBins () const
 
const std::vector< float > & getClusterSizeXBins () const
 
const std::vector< float > & getClusterSizeYBins () const
 
void setParameters (const int ncsx, const int ncsy, const int neta, const int nalpha, int offset, std::vector< float > constants)
 
void Print (const std::string &filename) const
 
void Load (const std::string &filename)
 
const std::vector< float > & getIBLEtaBins () const
 
const std::vector< float > & getIBLAngleBins () const
 
int getIBLcsxbins () const
 
int getIBLcsybins () const
 
int getIBLetabins () const
 
int getIBLphibins () const
 
void setIBLcsxbins (int icsx)
 
void setIBLcsybins (int icsy)
 
void setIBLetabins (int ieta)
 
void setIBLphibins (int ialpha)
 

Static Public Member Functions

static float getDeltaXendcap ()
 
static float getDeltaYendcap ()
 

Private Member Functions

int getBarrelBinX (int iclustersize, float angle, int ilayer) const
 Get the global bin index as a function of the value of the variables of the parametrization. More...
 
int getBarrelBinY (int iclustersize, float eta, int ilayer) const
 
int getBarrelBinX (int iclustersize, int iangle, int ilayer) const
 Get global bin index as a function of the separate bin index for each variable of the parametrization. More...
 
int getBarrelBinY (int iclustersize, int ieta, int ilayer) const
 Get global bin index as a function of the separate bin index for each variable of the parametrization. More...
 

Private Attributes

int m_version
 
int m_nlayerbins
 
std::vector< float > m_etabins
 
std::vector< float > m_phibins
 
std::vector< float > m_csx
 
std::vector< float > m_csy
 
std::vector< float > m_deltax
 
std::vector< float > m_deltay
 
std::vector< float > m_errdeltax
 
std::vector< float > m_errdeltay
 
int m_csxbinsibl
 
int m_csybinsibl
 
int m_etaibl
 
int m_alphaibl
 
std::vector< float > m_ibletabins
 
std::vector< float > m_iblphibins
 

Detailed Description

Definition at line 26 of file PixelChargeInterpolationParameters.h.

Constructor & Destructor Documentation

◆ PixelChargeInterpolationParameters() [1/2]

PixelChargeInterpolationParameters::PixelChargeInterpolationParameters ( )

Definition at line 20 of file PixelChargeInterpolationParameters.cxx.

20  {
21 
22  m_version = 0;
23 
24  // define bins of parametrization
25 
26  // eta bins: [-2.5, -2.0, .... 2.5]
27  int netabins = 10;
28  for(int i=0; i<netabins+1; i++){
29  m_etabins.push_back(-2.5+0.5*i);
30  }
31  // alfa (Rphi incidence angle) bins: [-6., -4., ... ,14]
32  int nphibins = 10;
33  for(int i=0; i<nphibins+1; i++){
34  m_phibins.push_back(-6+2*i);
35  }
36  // cluster size bins
37  int ncs=3;
38  for(int i=0; i<ncs+1; i++){
39  m_csx.push_back(1.5+i);
40  m_csy.push_back(1.5+i);
41  }
42  m_nlayerbins = 6;
43 
44  // Initialize default values for parametrization
45  // Should reading from database fail, these values would be used
46  int nxbin=nphibins*m_nlayerbins*ncs;
47  int nybin=netabins*m_nlayerbins*ncs;
48  // std::cout << "TOMTOM Setting defaults" << std::endl;
49  for(int i=0; i<nxbin; i++){
50  m_deltax.push_back(0.);
51  m_errdeltax.push_back(0.);
52  }
53  for(int i=0; i<nybin; i++){
54  m_deltay.push_back(0.);
55  m_errdeltay.push_back(0.);
56  }
57  // IBL
58  // eta bins: [0., 2.7]
59  m_etaibl = 0;
60  m_alphaibl = 0;
61  m_csxbinsibl = 0;
62  m_csybinsibl = 0;
63 
64  /* IBL initial from DB
65  int netaibl = 6;
66  m_ibletabins.reserve(netaibl+1);
67  m_ibletabins.push_back(0.00);
68  m_ibletabins.push_back(0.55);
69  m_ibletabins.push_back(1.275);
70  m_ibletabins.push_back(1.725);
71  m_ibletabins.push_back(2.025);
72  m_ibletabins.push_back(2.25);
73  m_ibletabins.push_back(2.70);
74 
75  // alfa (Rphi incidence angle) bins: [-15.47, 15.47]
76  float phimin = -15.47;
77  float phimax = 15.47;
78  int nalphaibl = 9;
79  m_ibletabins.reserve(nalphaibl+1);
80  for(int i=0; i<nalphaibl+1; i++){
81  m_iblphibins.push_back(phimin +i*(phimax-phimin)/(nalphaibl));
82  }
83  */
84  }

◆ ~PixelChargeInterpolationParameters()

PixelCalib::PixelChargeInterpolationParameters::~PixelChargeInterpolationParameters ( )
default

◆ PixelChargeInterpolationParameters() [2/2]

PixelCalib::PixelChargeInterpolationParameters::PixelChargeInterpolationParameters ( const PixelChargeInterpolationParameters )
delete

Member Function Documentation

◆ getAngleBins()

const std::vector<float>& PixelCalib::PixelChargeInterpolationParameters::getAngleBins ( ) const
inline

Definition at line 85 of file PixelChargeInterpolationParameters.h.

85 {return m_phibins;}

◆ getBarrelBinX() [1/2]

int PixelChargeInterpolationParameters::getBarrelBinX ( int  iclustersize,
float  angle,
int  ilayer 
) const
private

Get the global bin index as a function of the value of the variables of the parametrization.

Definition at line 326 of file PixelChargeInterpolationParameters.cxx.

328  {
329  // look for the phi bin
330  int iphi = 0;
331  int icsx=0;
332  if(m_version<-1 && ilayer ==0){
333  int nphi = m_iblphibins.size();
334  // check wether we are inside the parametrized range
335  if(ang < m_iblphibins[0]) return -1;
336  if(ang > m_iblphibins[nphi-1]) return -1;
337  if (nrows>=2 && nrows<=m_csxbinsibl+1) icsx=nrows-2;
338  else{
339  return -1;
340  }
341  for(int i=0; i<nphi; i++){
342  if(ang > m_iblphibins[i]) iphi=i; // 8
343  }
344  }
345  else{
346  int nphi = m_phibins.size();
347  // check wether we are inside the parametrized range
348  if(ang < m_phibins[0]) return -1;
349  if(ang > m_phibins[nphi-1]) return -1;
350  for(int i=0; i<nphi; i++){
351  if(ang > m_phibins[i]) iphi=i; // 8
352  }
353  int ncsx = m_csx.size(); // 4?
354  if(nrows>m_csx[ncsx-1]) return -1;
355  if(nrows<m_csx[0]) return -1;
356  for(int i=0; i<ncsx; i++){
357  if(nrows>(m_csx[i])) icsx=i; //0
358  }
359  }
360  return getBarrelBinX(icsx, iphi, ilayer);
361  // int ibin = iphi*m_nlayerbins*(ncsx-1)+ilayer*(ncsx-1)+icsx; // 8*6*3
362  // return ibin;
363 
364  }

◆ getBarrelBinX() [2/2]

int PixelChargeInterpolationParameters::getBarrelBinX ( int  iclustersize,
int  iangle,
int  ilayer 
) const
private

Get global bin index as a function of the separate bin index for each variable of the parametrization.

Definition at line 407 of file PixelChargeInterpolationParameters.cxx.

409  {
410 
411  // check wether we are inside parametrized range
412  int dl = (ilayer>0) ? 1 : 0;
413  if(nrows > int(m_csx.size()-1) || nrows < 0 ||
414  iangle > int(m_phibins.size()-1) || iangle < 0 ||
415  ilayer <0 || ilayer > (m_nlayerbins+dl)) return -1;
416  int ncsx = m_csx.size();
417  int ibin = (m_version<-1&&ilayer==0) ? iangle*m_csxbinsibl+nrows:
418  m_csxbinsibl*m_alphaibl+iangle*m_nlayerbins*(ncsx-1)+(ilayer-dl)*(ncsx-1)+nrows;
419  return ibin;
420  }

◆ getBarrelBinY() [1/2]

int PixelChargeInterpolationParameters::getBarrelBinY ( int  iclustersize,
float  eta,
int  ilayer 
) const
private

Definition at line 366 of file PixelChargeInterpolationParameters.cxx.

368  {
369  // int nxbin=nphibins*m_nlayerbins*ncs;
370  // int nybin=netabins*m_nlayerbins*ncs;
371  int ieta=0;
372  int icsy=0;
373  if(m_version<-1 && ilayer==0){ // IBL
374  int neta = m_ibletabins.size();
375  if(eta < m_ibletabins[0]) return -1;
376  if(eta > m_ibletabins[neta-1]) return -1;
377  for(int i=0; i<neta; i++){
378  if(eta > m_ibletabins[i]) ieta=i; // 10
379  }
380  if (ncol>=2 && ncol<=m_csybinsibl+1) icsy=ncol-2;
381  else{
382  return -1;
383  }
384  }
385  else{
386  int neta = m_etabins.size();
387  if(eta < m_etabins[0]) return -1;
388  if(eta > m_etabins[neta-1]) return -1;
389  for(int i=0; i<neta; i++){
390  if(eta > m_etabins[i]) ieta=i; // 10
391  }
392  int ncsy = m_csy.size();
393  if(ncol < m_csy[0]) return -1;
394  if(ncol > m_csy[ncsy-1]) return -1;
395  for(int i=0; i<ncsy; i++){
396  if(ncol>m_csy[i]) icsy=i;
397  }
398  }
399  return getBarrelBinY(icsy, ieta,ilayer);
400  // int ibin = ieta*m_nlayerbins*(ncsy-1)+ilayer*(ncsy-1)+icsy;
401  // return ibin;
402 
403  }

◆ getBarrelBinY() [2/2]

int PixelChargeInterpolationParameters::getBarrelBinY ( int  iclustersize,
int  ieta,
int  ilayer 
) const
private

Get global bin index as a function of the separate bin index for each variable of the parametrization.

Definition at line 424 of file PixelChargeInterpolationParameters.cxx.

426  {
427 
428  // check wether we are inside parametrized range
429  int dl = (ilayer>0) ? 1 : 0;
430  if(ncol > int(m_csy.size()-1) || ncol < 0 ||
431  ieta > int(m_etabins.size()-1) || ieta < 0 ||
432  ilayer <0 || ilayer > (m_nlayerbins+dl)) return -1;
433  int ncsy = m_csy.size();
434  int ibin = (m_version<-1&&ilayer==0) ? ieta*m_csybinsibl+ncol:
435  m_csybinsibl*m_etaibl+ieta*m_nlayerbins*(ncsy-1)+(ilayer-dl)*(ncsy-1)+ncol;
436  return ibin;
437  }

◆ getClusterSizeXBins()

const std::vector<float>& PixelCalib::PixelChargeInterpolationParameters::getClusterSizeXBins ( ) const
inline

Definition at line 86 of file PixelChargeInterpolationParameters.h.

86 {return m_csx;}

◆ getClusterSizeYBins()

const std::vector<float>& PixelCalib::PixelChargeInterpolationParameters::getClusterSizeYBins ( ) const
inline

Definition at line 87 of file PixelChargeInterpolationParameters.h.

87 {return m_csy;}

◆ getDeltaX() [1/2]

float PixelChargeInterpolationParameters::getDeltaX ( int  i) const

methods to get/set the calibration data as a function of the global bin index (the one used i the internal vector rapresentation as well as in the database, combining the various variables

Definition at line 168 of file PixelChargeInterpolationParameters.cxx.

168  {
169  if(i<0) return 0;
170  if(static_cast<unsigned int>(i) > m_deltax.size()-1) return 0;
171  return m_deltax[i];
172  }

◆ getDeltaX() [2/2]

float PixelChargeInterpolationParameters::getDeltaX ( int  iangle,
int  iclustersize,
int  ilayer 
) const

methods to get/set the calibration data as a function of the bin index for the various variables separately

Definition at line 255 of file PixelChargeInterpolationParameters.cxx.

256  {
257  int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
258  if(ibin < 0) return 0;
259  return getDeltaX(ibin);
260  }

◆ getDeltaXbarrel()

float PixelChargeInterpolationParameters::getDeltaXbarrel ( int  nRows,
float  angle,
int  ilayer = 0 
) const

Methods to access the calibration data as a function of the cluster size, angle/pseudorapidity, layer number.

Definition at line 229 of file PixelChargeInterpolationParameters.cxx.

232  {
233  int ibin = getBarrelBinX(nrows, ang, ilayer);
234  float delta2 = getDeltaX(ibin);
235  return delta2;
236  }

◆ getDeltaXendcap()

float PixelChargeInterpolationParameters::getDeltaXendcap ( )
static

Definition at line 318 of file PixelChargeInterpolationParameters.cxx.

318  {
319  return 10*CLHEP::micrometer;
320  }

◆ getDeltaXIBL()

float PixelCalib::PixelChargeInterpolationParameters::getDeltaXIBL ( int  nRows,
float  angle 
) const

◆ getDeltaY() [1/2]

float PixelChargeInterpolationParameters::getDeltaY ( int  i) const

Definition at line 175 of file PixelChargeInterpolationParameters.cxx.

175  {
176  if(i<0) return 0;
177  if(static_cast<unsigned int>(i) > m_deltay.size()-1) return 0;
178  return m_deltay[i];
179  }

◆ getDeltaY() [2/2]

float PixelChargeInterpolationParameters::getDeltaY ( int  ieta,
int  iclustersize,
int  ilayer 
) const

Definition at line 262 of file PixelChargeInterpolationParameters.cxx.

263  {
264  int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
265  if(ibin < 0) return 0;
266  return getDeltaY(ibin);
267  }

◆ getDeltaYbarrel()

float PixelChargeInterpolationParameters::getDeltaYbarrel ( int  nCol,
float  eta,
int  ilayer = 0 
) const

Definition at line 239 of file PixelChargeInterpolationParameters.cxx.

241  {
242  // double delta = 0;
243  // if(ncol == 2 && eta<2) delta = 0.25*CLHEP::mm+0.13*CLHEP::mm*eta;
244  // if(ncol == 2 && eta>2) delta = 0.5*CLHEP::mm;
245  // if(ncol == 3 && eta>0.8) delta = 0.25*CLHEP::mm;
246 
247  int ibin = getBarrelBinY(ncol, eta, ilayer);
248  float delta2 = getDeltaY(ibin);
249  return delta2;
250  }

◆ getDeltaYendcap()

float PixelChargeInterpolationParameters::getDeltaYendcap ( )
static

Definition at line 322 of file PixelChargeInterpolationParameters.cxx.

322  {
323  return 10*CLHEP::micrometer;
324  }

◆ getDeltaYIBL()

float PixelCalib::PixelChargeInterpolationParameters::getDeltaYIBL ( int  nCol,
float  eta 
) const

◆ getErrDeltaX() [1/2]

float PixelChargeInterpolationParameters::getErrDeltaX ( int  i) const

methods to get/set the calibration data errors as a function of the global bin index (the one used i the internal vector rapresentation as well as in the database, combining the various variables

Definition at line 199 of file PixelChargeInterpolationParameters.cxx.

199  {
200  if(i<0) return 0;
201  if(static_cast<unsigned int>(i) > m_errdeltax.size()-1) return 0;
202  return m_errdeltax[i];
203  }

◆ getErrDeltaX() [2/2]

float PixelChargeInterpolationParameters::getErrDeltaX ( int  iangle,
int  iclustersize,
int  ilayer 
) const

methods to get/set the calibration data as a function of the bin index for the various variables separately

methods to get/set the calibration data errors as a function of the bin index for the various variables separately

Definition at line 288 of file PixelChargeInterpolationParameters.cxx.

289  {
290  int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
291  if(ibin < 0) return 0;
292  return getErrDeltaX(ibin);
293  }

◆ getErrDeltaY() [1/2]

float PixelChargeInterpolationParameters::getErrDeltaY ( int  i) const

Definition at line 206 of file PixelChargeInterpolationParameters.cxx.

206  {
207  if(i<0) return 0;
208  if(static_cast<unsigned int>(i) > m_errdeltay.size()-1) return 0;
209  return m_errdeltay[i];
210  }

◆ getErrDeltaY() [2/2]

float PixelChargeInterpolationParameters::getErrDeltaY ( int  ieta,
int  iclustersize,
int  ilayer 
) const

Definition at line 295 of file PixelChargeInterpolationParameters.cxx.

296  {
297  int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
298  if(ibin < 0) return 0;
299  return getErrDeltaY(ibin);
300  }

◆ getEtaBins()

const std::vector<float>& PixelCalib::PixelChargeInterpolationParameters::getEtaBins ( ) const
inline

Definition at line 84 of file PixelChargeInterpolationParameters.h.

84 {return m_etabins;}

◆ getIBLAngleBins()

const std::vector<float>& PixelCalib::PixelChargeInterpolationParameters::getIBLAngleBins ( ) const
inline

Definition at line 97 of file PixelChargeInterpolationParameters.h.

97 {return m_iblphibins;}

◆ getIBLcsxbins()

int PixelCalib::PixelChargeInterpolationParameters::getIBLcsxbins ( ) const
inline

Definition at line 98 of file PixelChargeInterpolationParameters.h.

98 {return m_csxbinsibl;}

◆ getIBLcsybins()

int PixelCalib::PixelChargeInterpolationParameters::getIBLcsybins ( ) const
inline

Definition at line 99 of file PixelChargeInterpolationParameters.h.

99 {return m_csybinsibl;}

◆ getIBLEtaBins()

const std::vector<float>& PixelCalib::PixelChargeInterpolationParameters::getIBLEtaBins ( ) const
inline

Definition at line 96 of file PixelChargeInterpolationParameters.h.

96 {return m_ibletabins;}

◆ getIBLetabins()

int PixelCalib::PixelChargeInterpolationParameters::getIBLetabins ( ) const
inline

Definition at line 100 of file PixelChargeInterpolationParameters.h.

100 {return m_etaibl;}

◆ getIBLphibins()

int PixelCalib::PixelChargeInterpolationParameters::getIBLphibins ( ) const
inline

Definition at line 101 of file PixelChargeInterpolationParameters.h.

101 {return m_alphaibl;}

◆ getNumberOfXbins()

int PixelChargeInterpolationParameters::getNumberOfXbins ( ) const

Definition at line 159 of file PixelChargeInterpolationParameters.cxx.

159  {
160  return m_deltax.size();
161  }

◆ getNumberOfYbins()

int PixelChargeInterpolationParameters::getNumberOfYbins ( ) const

Definition at line 163 of file PixelChargeInterpolationParameters.cxx.

163  {
164  return m_deltay.size();
165  }

◆ getVersion()

int PixelChargeInterpolationParameters::getVersion ( ) const

Definition at line 88 of file PixelChargeInterpolationParameters.cxx.

88 { return m_version; }

◆ Load()

void PixelChargeInterpolationParameters::Load ( const std::string &  filename)

Definition at line 513 of file PixelChargeInterpolationParameters.cxx.

513  {
514  std::ifstream infile(file.c_str());
515  int version = 0;
516  int nxbins = 0;
517  int nybins = 0;
518  int ncsx;
519  int ncsy;
520  int neta;
521  int nalpha;
522  m_csxbinsibl = 0;
523  m_csybinsibl = 0;
524  m_etaibl = 0;
525  m_alphaibl = 0;
526  int nxbinsibl(0);
527  int nybinsibl(0);
528 
529  float value, error;
530  infile >> version;
531  if (version>0) { // old format (without version number)
532 
533  m_version = 0;
534  nxbins = version;
535  infile >> nybins;
536  nxbins = std::min(nxbins, nmax);
537  if(nybins<0)nybins = 0;
538  nybins = std::min(nybins, nmax);
539  m_deltax.clear();
540  m_deltay.clear();
541  m_deltax.reserve(nxbins);
542  m_deltay.reserve(nybins);
543 
544  for(int ib=0; ib<nxbins && !infile.eof(); ib++){
545  infile >> value;
546  m_deltax.push_back(value);
547  }
548  for(int ib=0; ib<nybins && !infile.eof(); ib++){
549  infile >> value;
550  m_deltay.push_back(value);
551  }
552  }
553  else {
554  m_version = version;
555  if(version<-1){ // IBL version
556  // read the number of bins
557  infile >> ncsx >> ncsy >> neta >> nalpha>>m_csxbinsibl>>m_csybinsibl>>m_etaibl>>m_alphaibl;
558  nxbinsibl = m_csxbinsibl*m_alphaibl;
559  nybinsibl = m_csybinsibl*m_etaibl;
560  }
561  else{ // current pixel detector
562  infile >> ncsx >> ncsy >> neta >> nalpha;
563  }
564 
565  // read bins of parametrization
566  // Note: n bins = n+1 bin extremes
567 
568  float value;
569  m_csx.clear();
570  if(ncsx<0)ncsx = 0;
571  ncsx = std::min(ncsx,nmax);
572  m_csx.reserve(ncsx+1);
573  for(int i=0; i<ncsx+1 && !infile.eof(); i++){
574  infile >> value;
575  m_csx.push_back(value);
576  }
577  m_csy.clear();
578  if(ncsy<0)ncsy = 0;
579  ncsy = std::min(ncsy, nmax);
580  m_csy.reserve(ncsy+1);
581  for(int i=0; i<ncsy+1 && !infile.eof(); i++){
582  infile >> value;
583  m_csy.push_back(value);
584  }
585  if(m_etaibl>0 && m_alphaibl >0 ){ // IBL
586  m_ibletabins.clear();
588  m_ibletabins.reserve(m_etaibl+1);
589  for(int i=0; i<m_etaibl+1; i++){
590  infile >> value;
591  m_ibletabins.push_back(value);
592  }
593  m_iblphibins.clear();
595  m_iblphibins.reserve(m_alphaibl+1);
596  for(int i=0; i<m_alphaibl+1; i++){
597  infile >> value;
598  m_iblphibins.push_back(value);
599  }
600  }
601  //
602  m_etabins.clear();
603  if(neta<0)neta = 0;
604  neta = std::min(neta, nmax);
605  m_etabins.reserve(neta+1);
606  for(int i=0; i<neta+1 && !infile.eof(); i++){
607  infile >> value;
608  m_etabins.push_back(value);
609  }
610  m_phibins.clear();
611  if(nalpha<0)nalpha = 0;
612  nalpha = std::min(nalpha, nmax);
613  m_phibins.reserve(nalpha+1);
614  for(int i=0; i<nalpha+1 && !infile.eof(); i++){
615  infile >> value;
616  m_phibins.push_back(value);
617  }
618 
619  // Read contents of parametrization
620 
621  int nxbins = 6*ncsx*nalpha + nxbinsibl;
622  int nybins = 6*ncsy*neta + nybinsibl;
623  m_deltax.clear();
624  m_deltay.clear();
625  m_errdeltax.clear();
626  m_errdeltay.clear();
627  if(nxbins<0)nxbins = 0;
628  nxbins = std::min(nxbins, nmax);
629  if(nybins<0)nybins = 0;
630  nybins =std::min(nybins, nmax);
631  m_deltax.reserve(nxbins);
632  m_deltay.reserve(nybins);
633  m_errdeltax.reserve(nxbins);
634  m_errdeltay.reserve(nybins);
635  for(int ib=0; ib<nxbins && !infile.eof(); ib++){
636  infile >> value >> error;
637  m_deltax.push_back(value);
638  m_errdeltax.push_back(error);
639  }
640  for(int ib=0; ib<nybins && !infile.eof(); ib++){
641  infile >> value >> error;
642  m_deltay.push_back(value);
643  m_errdeltay.push_back(error);
644  }
645  } // and of check if version number is the first thing on file
646  } // end of Load method

◆ Print()

void PixelChargeInterpolationParameters::Print ( const std::string &  filename) const

Definition at line 441 of file PixelChargeInterpolationParameters.cxx.

441  {
442 
443  std::ofstream* outfile = new std::ofstream(file.c_str());
444 
445  // std::cout << "TOMTOM printing constants" << std::endl;
446 
447  if(m_version < 0) *outfile << m_version << std::endl;
448  // The number of bins is the number of bin extremes minus 1.
449  int ncsx = m_csx.size()-1;
450  int ncsy = m_csy.size()-1;
451  int neta = m_etabins.size()-1;
452  int nalpha = m_phibins.size()-1;
453 
454  // if new format, write number o bins and bin extremes
455  if(m_version <0){ // IBL
456 
457  // std::cout << "TOMTOM new format" << std::endl;
458  if(m_version<-1){
459  *outfile <<ncsx<<" "<<ncsy<<" "<<neta<<" "<<nalpha<<" "<<m_csxbinsibl<<
460  " "<<m_csybinsibl<<" "<<m_etaibl<<" "<<m_alphaibl<<std::endl;
461  }
462  else{
463  *outfile <<ncsx<<" "<<ncsy<<" "<<neta<<" "<<nalpha<<std::endl;
464  }
465  // Then write bin extremes
466 
467  for(float i : m_csx){
468  *outfile << i << " ";
469  }
470  *outfile << std::endl;
471  for(float i : m_csy){
472  *outfile << i << " ";
473  }
474  *outfile << std::endl;
475  if(m_etaibl>0 && m_alphaibl >0 ){ // IBL
476  for(float ibletabin : m_ibletabins){
477  *outfile << ibletabin << " ";
478  }
479  *outfile << std::endl;
480  for(float iblphibin : m_iblphibins){
481  *outfile << iblphibin << " ";
482  }
483  *outfile << std::endl;
484  }
485  for(float etabin : m_etabins){
486  *outfile << etabin << " ";
487  }
488  *outfile << std::endl;
489  for(float phibin : m_phibins){
490  *outfile << phibin << " ";
491  }
492  *outfile << std::endl;
493  }
494  else{
495 
496  // std::cout << "TOMTOM old format" << std::endl;
497  *outfile << m_deltax.size() << " " << m_deltay.size() << std::endl;
498  }
499 
500  // Then bin content
501  for(unsigned int ib=0; ib<m_deltax.size(); ib++){
502  *outfile << m_deltax[ib] << " " << m_errdeltax[ib] << std::endl;
503  }
504  for(unsigned int ie=0; ie<m_deltay.size(); ie++){
505  *outfile << m_deltay[ie] << " " << m_errdeltay[ie] << std::endl;
506  }
507  outfile->close();
508 
509  delete outfile;
510  }

◆ setDeltaX() [1/2]

int PixelChargeInterpolationParameters::setDeltaX ( int  i,
float  value 
)

Definition at line 182 of file PixelChargeInterpolationParameters.cxx.

182  {
183  if(i<0) return 0;
184  if(static_cast<unsigned int>(i) > m_deltax.size()-1) return 0;
185  m_deltax[i] = value;
186  return 1;
187  }

◆ setDeltaX() [2/2]

int PixelChargeInterpolationParameters::setDeltaX ( int  iangle,
int  iclustersize,
int  ilayer,
float  value 
)

Definition at line 269 of file PixelChargeInterpolationParameters.cxx.

271  {
272  int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
273  if(ibin < 0) return 0; // error code
274  return setDeltaX(ibin, value);
275  }

◆ setDeltaY() [1/2]

int PixelChargeInterpolationParameters::setDeltaY ( int  i,
float  value 
)

Definition at line 190 of file PixelChargeInterpolationParameters.cxx.

190  {
191  if(i<0) return 0;
192  if(static_cast<unsigned int>(i) > m_deltay.size()-1) return 0;
193  m_deltay[i] = value;
194  return 1;
195  }

◆ setDeltaY() [2/2]

int PixelChargeInterpolationParameters::setDeltaY ( int  ieta,
int  iclustersize,
int  ilayer,
float  value 
)

Definition at line 277 of file PixelChargeInterpolationParameters.cxx.

279  {
280  int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
281  if(ibin < 0) return 0; // error code
282  return setDeltaY(ibin, value);
283  }

◆ setErrDeltaX() [1/2]

int PixelChargeInterpolationParameters::setErrDeltaX ( int  i,
float  value 
)

Definition at line 213 of file PixelChargeInterpolationParameters.cxx.

213  {
214  if(i<0) return 0;
215  if(static_cast<unsigned int>(i) > m_errdeltax.size()-1) return 0;
216  m_errdeltax[i] = value;
217  return 1;
218  }

◆ setErrDeltaX() [2/2]

int PixelChargeInterpolationParameters::setErrDeltaX ( int  iangle,
int  iclustersize,
int  ilayer,
float  value 
)

Definition at line 302 of file PixelChargeInterpolationParameters.cxx.

304  {
305  int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
306  if(ibin < 0) return 0; // error code
307  return setErrDeltaX(ibin, value);
308  }

◆ setErrDeltaY() [1/2]

int PixelChargeInterpolationParameters::setErrDeltaY ( int  i,
float  value 
)

Definition at line 221 of file PixelChargeInterpolationParameters.cxx.

221  {
222  if(i<0) return 0;
223  if(static_cast<unsigned int>(i) > m_errdeltay.size()-1) return 0;
224  m_errdeltay[i] = value;
225  return 1;
226  }

◆ setErrDeltaY() [2/2]

int PixelChargeInterpolationParameters::setErrDeltaY ( int  ieta,
int  iclustersize,
int  ilayer,
float  value 
)

Definition at line 310 of file PixelChargeInterpolationParameters.cxx.

312  {
313  int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
314  if(ibin < 0) return 0; // error code
315  return setErrDeltaY(ibin, value);
316  }

◆ setIBLcsxbins()

void PixelCalib::PixelChargeInterpolationParameters::setIBLcsxbins ( int  icsx)
inline

Definition at line 102 of file PixelChargeInterpolationParameters.h.

102 {m_csxbinsibl = icsx;}

◆ setIBLcsybins()

void PixelCalib::PixelChargeInterpolationParameters::setIBLcsybins ( int  icsy)
inline

Definition at line 103 of file PixelChargeInterpolationParameters.h.

103 {m_csybinsibl = icsy;}

◆ setIBLetabins()

void PixelCalib::PixelChargeInterpolationParameters::setIBLetabins ( int  ieta)
inline

Definition at line 104 of file PixelChargeInterpolationParameters.h.

104 {m_etaibl = ieta;}

◆ setIBLphibins()

void PixelCalib::PixelChargeInterpolationParameters::setIBLphibins ( int  ialpha)
inline

Definition at line 105 of file PixelChargeInterpolationParameters.h.

105 {m_alphaibl = ialpha;}

◆ setParameters()

void PixelChargeInterpolationParameters::setParameters ( const int  ncsx,
const int  ncsy,
const int  neta,
const int  nalpha,
int  offset,
std::vector< float >  constants 
)

Definition at line 90 of file PixelChargeInterpolationParameters.cxx.

95  { // vector with bin values
96  m_csx.clear();
97  m_csy.clear();
98  m_etabins.clear();
99  m_phibins.clear();
100  // n bins means we need n+1 bin extreme values
101  m_csx.reserve(n1+1);
102  m_csy.reserve(n2+1);
103  m_etabins.reserve(n3+1);
104  m_phibins.reserve(n4+1);
105  for(int i=0; i<n1+1; i++){
106  m_csx.push_back(c.at(i+offset));
107  }
108  offset += n1+1;
109  for(int i=0; i<n2+1; i++){
110  m_csy.push_back(c.at(i+offset));
111  }
112  offset += n2+1;
113  if(m_etaibl>0){ // IBL eta
114  m_ibletabins.reserve(m_etaibl+1);
115  for(int i = 0; i<m_etaibl+1; i++){
116  m_ibletabins.push_back(c.at(i+offset));
117  }
118  offset +=m_etaibl+1;
119  }
120  if(m_alphaibl>0){ // IBL phi
121  m_iblphibins.reserve(m_alphaibl+1);
122  for(int i = 0; i<m_alphaibl+1; i++){
123  m_iblphibins.push_back(c.at(i+offset));
124  }
125  offset +=m_alphaibl+1;
126  }
127  for(int i=0; i<n3+1; i++){
128  m_etabins.push_back(c.at(i+offset));
129  }
130  offset += n3+1;
131  for(int i=0; i<n4+1; i++){
132  m_phibins.push_back(c.at(i+offset));
133  }
134 
135  offset +=n4+1;
136 
137  m_deltax.clear();
138  m_deltay.clear();
139  m_errdeltax.clear();
140  m_errdeltay.clear();
141  int nxbin=m_csxbinsibl*m_alphaibl + n4*m_nlayerbins*n1;
142  int nybin=m_csybinsibl*m_etaibl + n3*m_nlayerbins*n2;
143 
144  m_deltax.reserve(nxbin);
145  m_deltay.reserve(nybin);
146  m_errdeltax.reserve(nxbin);
147  m_errdeltay.reserve(nybin);
148  for(int i=0; i<nxbin; i++){
149  m_deltax.push_back(0.);
150  m_errdeltax.push_back(0.);
151  }
152  for(int i=0; i<nybin; i++){
153  m_deltay.push_back(0.);
154  m_errdeltay.push_back(0.);
155  }
156 
157  }

◆ setVersion()

void PixelChargeInterpolationParameters::setVersion ( int  version)

Definition at line 86 of file PixelChargeInterpolationParameters.cxx.

86 { m_version = version; }

Member Data Documentation

◆ m_alphaibl

int PixelCalib::PixelChargeInterpolationParameters::m_alphaibl
private

Definition at line 139 of file PixelChargeInterpolationParameters.h.

◆ m_csx

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_csx
private

Definition at line 127 of file PixelChargeInterpolationParameters.h.

◆ m_csxbinsibl

int PixelCalib::PixelChargeInterpolationParameters::m_csxbinsibl
private

Definition at line 136 of file PixelChargeInterpolationParameters.h.

◆ m_csy

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_csy
private

Definition at line 128 of file PixelChargeInterpolationParameters.h.

◆ m_csybinsibl

int PixelCalib::PixelChargeInterpolationParameters::m_csybinsibl
private

Definition at line 137 of file PixelChargeInterpolationParameters.h.

◆ m_deltax

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_deltax
private

Definition at line 130 of file PixelChargeInterpolationParameters.h.

◆ m_deltay

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_deltay
private

Definition at line 131 of file PixelChargeInterpolationParameters.h.

◆ m_errdeltax

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_errdeltax
private

Definition at line 133 of file PixelChargeInterpolationParameters.h.

◆ m_errdeltay

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_errdeltay
private

Definition at line 134 of file PixelChargeInterpolationParameters.h.

◆ m_etabins

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_etabins
private

Definition at line 125 of file PixelChargeInterpolationParameters.h.

◆ m_etaibl

int PixelCalib::PixelChargeInterpolationParameters::m_etaibl
private

Definition at line 138 of file PixelChargeInterpolationParameters.h.

◆ m_ibletabins

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_ibletabins
private

Definition at line 140 of file PixelChargeInterpolationParameters.h.

◆ m_iblphibins

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_iblphibins
private

Definition at line 141 of file PixelChargeInterpolationParameters.h.

◆ m_nlayerbins

int PixelCalib::PixelChargeInterpolationParameters::m_nlayerbins
private

Definition at line 124 of file PixelChargeInterpolationParameters.h.

◆ m_phibins

std::vector<float> PixelCalib::PixelChargeInterpolationParameters::m_phibins
private

Definition at line 126 of file PixelChargeInterpolationParameters.h.

◆ m_version

int PixelCalib::PixelChargeInterpolationParameters::m_version
private

Definition at line 123 of file PixelChargeInterpolationParameters.h.


The documentation for this class was generated from the following files:
PixelCalib::PixelChargeInterpolationParameters::getBarrelBinX
int getBarrelBinX(int iclustersize, float angle, int ilayer) const
Get the global bin index as a function of the value of the variables of the parametrization.
Definition: PixelChargeInterpolationParameters.cxx:326
TestSUSYToolsAlg.dl
dl
Definition: TestSUSYToolsAlg.py:81
PixelCalib::PixelChargeInterpolationParameters::m_csy
std::vector< float > m_csy
Definition: PixelChargeInterpolationParameters.h:128
PixelCalib::PixelChargeInterpolationParameters::setDeltaY
int setDeltaY(int ieta, int iclustersize, int ilayer, float value)
Definition: PixelChargeInterpolationParameters.cxx:277
run.infile
string infile
Definition: run.py:13
PixelCalib::PixelChargeInterpolationParameters::m_iblphibins
std::vector< float > m_iblphibins
Definition: PixelChargeInterpolationParameters.h:141
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
PixelCalib::PixelChargeInterpolationParameters::getDeltaY
float getDeltaY(int ieta, int iclustersize, int ilayer) const
Definition: PixelChargeInterpolationParameters.cxx:262
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
PixelCalib::PixelChargeInterpolationParameters::m_deltay
std::vector< float > m_deltay
Definition: PixelChargeInterpolationParameters.h:131
PixelCalib::PixelChargeInterpolationParameters::m_ibletabins
std::vector< float > m_ibletabins
Definition: PixelChargeInterpolationParameters.h:140
athena.value
value
Definition: athena.py:124
PixelCalib::PixelChargeInterpolationParameters::m_version
int m_version
Definition: PixelChargeInterpolationParameters.h:123
PixelCalib::PixelChargeInterpolationParameters::getDeltaX
float getDeltaX(int iangle, int iclustersize, int ilayer) const
methods to get/set the calibration data as a function of the bin index for the various variables sepa...
Definition: PixelChargeInterpolationParameters.cxx:255
PixelCalib::PixelChargeInterpolationParameters::m_nlayerbins
int m_nlayerbins
Definition: PixelChargeInterpolationParameters.h:124
PixelCalib::PixelChargeInterpolationParameters::m_etaibl
int m_etaibl
Definition: PixelChargeInterpolationParameters.h:138
PlotCalibFromCool.ie
ie
Definition: PlotCalibFromCool.py:420
lumiFormat.i
int i
Definition: lumiFormat.py:85
file
TFile * file
Definition: tile_monitor.h:29
python.SystemOfUnits.micrometer
int micrometer
Definition: SystemOfUnits.py:71
PixelCalib::PixelChargeInterpolationParameters::getBarrelBinY
int getBarrelBinY(int iclustersize, float eta, int ilayer) const
Definition: PixelChargeInterpolationParameters.cxx:366
min
#define min(a, b)
Definition: cfImp.cxx:40
PixelCalib::PixelChargeInterpolationParameters::m_csybinsibl
int m_csybinsibl
Definition: PixelChargeInterpolationParameters.h:137
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
PixelCalib::PixelChargeInterpolationParameters::getErrDeltaY
float getErrDeltaY(int ieta, int iclustersize, int ilayer) const
Definition: PixelChargeInterpolationParameters.cxx:295
get_generator_info.version
version
Definition: get_generator_info.py:33
PixelCalib::PixelChargeInterpolationParameters::setErrDeltaY
int setErrDeltaY(int ieta, int iclustersize, int ilayer, float value)
Definition: PixelChargeInterpolationParameters.cxx:310
PixelCalib::PixelChargeInterpolationParameters::m_alphaibl
int m_alphaibl
Definition: PixelChargeInterpolationParameters.h:139
PixelCalib::PixelChargeInterpolationParameters::m_csx
std::vector< float > m_csx
Definition: PixelChargeInterpolationParameters.h:127
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
PixelCalib::PixelChargeInterpolationParameters::getErrDeltaX
float getErrDeltaX(int iangle, int iclustersize, int ilayer) const
methods to get/set the calibration data as a function of the bin index for the various variables sepa...
Definition: PixelChargeInterpolationParameters.cxx:288
PixelCalib::PixelChargeInterpolationParameters::setDeltaX
int setDeltaX(int iangle, int iclustersize, int ilayer, float value)
Definition: PixelChargeInterpolationParameters.cxx:269
PixelCalib::PixelChargeInterpolationParameters::m_csxbinsibl
int m_csxbinsibl
Definition: PixelChargeInterpolationParameters.h:136
PixelCalib::PixelChargeInterpolationParameters::m_etabins
std::vector< float > m_etabins
Definition: PixelChargeInterpolationParameters.h:125
PixelCalib::PixelChargeInterpolationParameters::m_phibins
std::vector< float > m_phibins
Definition: PixelChargeInterpolationParameters.h:126
get_generator_info.error
error
Definition: get_generator_info.py:40
PixelCalib::PixelChargeInterpolationParameters::m_deltax
std::vector< float > m_deltax
Definition: PixelChargeInterpolationParameters.h:130
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
error
Definition: IImpactPoint3dEstimator.h:70
PixelCalib::PixelChargeInterpolationParameters::m_errdeltay
std::vector< float > m_errdeltay
Definition: PixelChargeInterpolationParameters.h:134
python.compressB64.c
def c
Definition: compressB64.py:93
nmax
const int nmax(200)
PixelCalib::PixelChargeInterpolationParameters::setErrDeltaX
int setErrDeltaX(int iangle, int iclustersize, int ilayer, float value)
Definition: PixelChargeInterpolationParameters.cxx:302
PixelCalib::PixelChargeInterpolationParameters::m_errdeltax
std::vector< float > m_errdeltax
Definition: PixelChargeInterpolationParameters.h:133