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

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 }

◆ ~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 306 of file PixelChargeInterpolationParameters.cxx.

308 {
309 // look for the phi bin
310 int iphi = 0;
311 int icsx=0;
312 if(m_version<-1 && ilayer ==0){
313 int nphi = m_iblphibins.size();
314 // check wether we are inside the parametrized range
315 if(ang < m_iblphibins[0]) return -1;
316 if(ang > m_iblphibins[nphi-1]) return -1;
317 if (nrows>=2 && nrows<=m_csxbinsibl+1) icsx=nrows-2;
318 else{
319 return -1;
320 }
321 for(int i=0; i<nphi; i++){
322 if(ang > m_iblphibins[i]) iphi=i; // 8
323 }
324 }
325 else{
326 int nphi = m_phibins.size();
327 // check wether we are inside the parametrized range
328 if(ang < m_phibins[0]) return -1;
329 if(ang > m_phibins[nphi-1]) return -1;
330 for(int i=0; i<nphi; i++){
331 if(ang > m_phibins[i]) iphi=i; // 8
332 }
333 int ncsx = m_csx.size(); // 4?
334 if(nrows>m_csx[ncsx-1]) return -1;
335 if(nrows<m_csx[0]) return -1;
336 for(int i=0; i<ncsx; i++){
337 if(nrows>(m_csx[i])) icsx=i; //0
338 }
339 }
340 return getBarrelBinX(icsx, iphi, ilayer);
341 // int ibin = iphi*m_nlayerbins*(ncsx-1)+ilayer*(ncsx-1)+icsx; // 8*6*3
342 // return ibin;
343
344 }
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.

◆ 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 387 of file PixelChargeInterpolationParameters.cxx.

389 {
390
391 // check wether we are inside parametrized range
392 int dl = (ilayer>0) ? 1 : 0;
393 if(nrows > int(m_csx.size()-1) || nrows < 0 ||
394 iangle > int(m_phibins.size()-1) || iangle < 0 ||
395 ilayer <0 || ilayer > (m_nlayerbins+dl)) return -1;
396 int ncsx = m_csx.size();
397 int ibin = (m_version<-1&&ilayer==0) ? iangle*m_csxbinsibl+nrows:
398 m_csxbinsibl*m_alphaibl+iangle*m_nlayerbins*(ncsx-1)+(ilayer-dl)*(ncsx-1)+nrows;
399 return ibin;
400 }

◆ getBarrelBinY() [1/2]

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

Definition at line 346 of file PixelChargeInterpolationParameters.cxx.

348 {
349 // int nxbin=nphibins*m_nlayerbins*ncs;
350 // int nybin=netabins*m_nlayerbins*ncs;
351 int ieta=0;
352 int icsy=0;
353 if(m_version<-1 && ilayer==0){ // IBL
354 int neta = m_ibletabins.size();
355 if(eta < m_ibletabins[0]) return -1;
356 if(eta > m_ibletabins[neta-1]) return -1;
357 for(int i=0; i<neta; i++){
358 if(eta > m_ibletabins[i]) ieta=i; // 10
359 }
360 if (ncol>=2 && ncol<=m_csybinsibl+1) icsy=ncol-2;
361 else{
362 return -1;
363 }
364 }
365 else{
366 int neta = m_etabins.size();
367 if(eta < m_etabins[0]) return -1;
368 if(eta > m_etabins[neta-1]) return -1;
369 for(int i=0; i<neta; i++){
370 if(eta > m_etabins[i]) ieta=i; // 10
371 }
372 int ncsy = m_csy.size();
373 if(ncol < m_csy[0]) return -1;
374 if(ncol > m_csy[ncsy-1]) return -1;
375 for(int i=0; i<ncsy; i++){
376 if(ncol>m_csy[i]) icsy=i;
377 }
378 }
379 return getBarrelBinY(icsy, ieta,ilayer);
380 // int ibin = ieta*m_nlayerbins*(ncsy-1)+ilayer*(ncsy-1)+icsy;
381 // return ibin;
382
383 }
Scalar eta() const
pseudorapidity method
int getBarrelBinY(int iclustersize, float eta, int ilayer) const

◆ 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 404 of file PixelChargeInterpolationParameters.cxx.

406 {
407
408 // check wether we are inside parametrized range
409 int dl = (ilayer>0) ? 1 : 0;
410 if(ncol > int(m_csy.size()-1) || ncol < 0 ||
411 ieta > int(m_etabins.size()-1) || ieta < 0 ||
412 ilayer <0 || ilayer > (m_nlayerbins+dl)) return -1;
413 int ncsy = m_csy.size();
414 int ibin = (m_version<-1&&ilayer==0) ? ieta*m_csybinsibl+ncol:
415 m_csybinsibl*m_etaibl+ieta*m_nlayerbins*(ncsy-1)+(ilayer-dl)*(ncsy-1)+ncol;
416 return ibin;
417 }

◆ 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 148 of file PixelChargeInterpolationParameters.cxx.

148 {
149 if(i<0) return 0;
150 if(static_cast<unsigned int>(i) > m_deltax.size()-1) return 0;
151 return m_deltax[i];
152 }

◆ 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 235 of file PixelChargeInterpolationParameters.cxx.

236 {
237 int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
238 if(ibin < 0) return 0;
239 return getDeltaX(ibin);
240 }
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...

◆ 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 209 of file PixelChargeInterpolationParameters.cxx.

212 {
213 int ibin = getBarrelBinX(nrows, ang, ilayer);
214 float delta2 = getDeltaX(ibin);
215 return delta2;
216 }

◆ getDeltaXendcap()

float PixelChargeInterpolationParameters::getDeltaXendcap ( )
static

Definition at line 298 of file PixelChargeInterpolationParameters.cxx.

298 {
299 return 10*CLHEP::micrometer;
300 }

◆ getDeltaXIBL()

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

◆ getDeltaY() [1/2]

float PixelChargeInterpolationParameters::getDeltaY ( int i) const

Definition at line 155 of file PixelChargeInterpolationParameters.cxx.

155 {
156 if(i<0) return 0;
157 if(static_cast<unsigned int>(i) > m_deltay.size()-1) return 0;
158 return m_deltay[i];
159 }

◆ getDeltaY() [2/2]

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

Definition at line 242 of file PixelChargeInterpolationParameters.cxx.

243 {
244 int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
245 if(ibin < 0) return 0;
246 return getDeltaY(ibin);
247 }
float getDeltaY(int ieta, int iclustersize, int ilayer) const

◆ getDeltaYbarrel()

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

Definition at line 219 of file PixelChargeInterpolationParameters.cxx.

221 {
222 // double delta = 0;
223 // if(ncol == 2 && eta<2) delta = 0.25*CLHEP::mm+0.13*CLHEP::mm*eta;
224 // if(ncol == 2 && eta>2) delta = 0.5*CLHEP::mm;
225 // if(ncol == 3 && eta>0.8) delta = 0.25*CLHEP::mm;
226
227 int ibin = getBarrelBinY(ncol, eta, ilayer);
228 float delta2 = getDeltaY(ibin);
229 return delta2;
230 }

◆ getDeltaYendcap()

float PixelChargeInterpolationParameters::getDeltaYendcap ( )
static

Definition at line 302 of file PixelChargeInterpolationParameters.cxx.

302 {
303 return 10*CLHEP::micrometer;
304 }

◆ 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 179 of file PixelChargeInterpolationParameters.cxx.

179 {
180 if(i<0) return 0;
181 if(static_cast<unsigned int>(i) > m_errdeltax.size()-1) return 0;
182 return m_errdeltax[i];
183 }

◆ 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 268 of file PixelChargeInterpolationParameters.cxx.

269 {
270 int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
271 if(ibin < 0) return 0;
272 return getErrDeltaX(ibin);
273 }
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...

◆ getErrDeltaY() [1/2]

float PixelChargeInterpolationParameters::getErrDeltaY ( int i) const

Definition at line 186 of file PixelChargeInterpolationParameters.cxx.

186 {
187 if(i<0) return 0;
188 if(static_cast<unsigned int>(i) > m_errdeltay.size()-1) return 0;
189 return m_errdeltay[i];
190 }

◆ getErrDeltaY() [2/2]

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

Definition at line 275 of file PixelChargeInterpolationParameters.cxx.

276 {
277 int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
278 if(ibin < 0) return 0;
279 return getErrDeltaY(ibin);
280 }
float getErrDeltaY(int ieta, int iclustersize, int ilayer) const

◆ 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 139 of file PixelChargeInterpolationParameters.cxx.

139 {
140 return m_deltax.size();
141 }

◆ getNumberOfYbins()

int PixelChargeInterpolationParameters::getNumberOfYbins ( ) const

Definition at line 143 of file PixelChargeInterpolationParameters.cxx.

143 {
144 return m_deltay.size();
145 }

◆ getVersion()

int PixelChargeInterpolationParameters::getVersion ( ) const

Definition at line 68 of file PixelChargeInterpolationParameters.cxx.

68{ return m_version; }

◆ Load()

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

Definition at line 493 of file PixelChargeInterpolationParameters.cxx.

493 {
494 std::ifstream infile(file.c_str());
495 int version = 0;
496 int nxbins = 0;
497 int nybins = 0;
498 int ncsx;
499 int ncsy;
500 int neta;
501 int nalpha;
502 m_csxbinsibl = 0;
503 m_csybinsibl = 0;
504 m_etaibl = 0;
505 m_alphaibl = 0;
506 int nxbinsibl(0);
507 int nybinsibl(0);
508
509 float value, error;
510 infile >> version;
511 if (version>0) { // old format (without version number)
512
513 m_version = 0;
514 nxbins = version;
515 infile >> nybins;
516 nxbins = std::min(nxbins, nmax);
517 if(nybins<0)nybins = 0;
518 nybins = std::min(nybins, nmax);
519 m_deltax.clear();
520 m_deltay.clear();
521 m_deltax.reserve(nxbins);
522 m_deltay.reserve(nybins);
523
524 for(int ib=0; ib<nxbins && !infile.eof(); ib++){
525 infile >> value;
526 m_deltax.push_back(value);
527 }
528 for(int ib=0; ib<nybins && !infile.eof(); ib++){
529 infile >> value;
530 m_deltay.push_back(value);
531 }
532 }
533 else {
535 if(version<-1){ // IBL version
536 // read the number of bins
537 infile >> ncsx >> ncsy >> neta >> nalpha>>m_csxbinsibl>>m_csybinsibl>>m_etaibl>>m_alphaibl;
538 nxbinsibl = m_csxbinsibl*m_alphaibl;
539 nybinsibl = m_csybinsibl*m_etaibl;
540 }
541 else{ // current pixel detector
542 infile >> ncsx >> ncsy >> neta >> nalpha;
543 }
544
545 // read bins of parametrization
546 // Note: n bins = n+1 bin extremes
547
548 float value;
549 m_csx.clear();
550 if(ncsx<0)ncsx = 0;
551 ncsx = std::min(ncsx,nmax);
552 m_csx.reserve(ncsx+1);
553 for(int i=0; i<ncsx+1 && !infile.eof(); i++){
554 infile >> value;
555 m_csx.push_back(value);
556 }
557 m_csy.clear();
558 if(ncsy<0)ncsy = 0;
559 ncsy = std::min(ncsy, nmax);
560 m_csy.reserve(ncsy+1);
561 for(int i=0; i<ncsy+1 && !infile.eof(); i++){
562 infile >> value;
563 m_csy.push_back(value);
564 }
565 if(m_etaibl>0 && m_alphaibl >0 ){ // IBL
566 m_ibletabins.clear();
567 m_etaibl = std::min(m_etaibl, nmax);
568 m_ibletabins.reserve(m_etaibl+1);
569 for(int i=0; i<m_etaibl+1; i++){
570 infile >> value;
571 m_ibletabins.push_back(value);
572 }
573 m_iblphibins.clear();
574 m_alphaibl = std::min(m_alphaibl, nmax);
575 m_iblphibins.reserve(m_alphaibl+1);
576 for(int i=0; i<m_alphaibl+1; i++){
577 infile >> value;
578 m_iblphibins.push_back(value);
579 }
580 }
581 //
582 m_etabins.clear();
583 if(neta<0)neta = 0;
584 neta = std::min(neta, nmax);
585 m_etabins.reserve(neta+1);
586 for(int i=0; i<neta+1 && !infile.eof(); i++){
587 infile >> value;
588 m_etabins.push_back(value);
589 }
590 m_phibins.clear();
591 if(nalpha<0)nalpha = 0;
592 nalpha = std::min(nalpha, nmax);
593 m_phibins.reserve(nalpha+1);
594 for(int i=0; i<nalpha+1 && !infile.eof(); i++){
595 infile >> value;
596 m_phibins.push_back(value);
597 }
598
599 // Read contents of parametrization
600
601 int nxbins = 6*ncsx*nalpha + nxbinsibl;
602 int nybins = 6*ncsy*neta + nybinsibl;
603 m_deltax.clear();
604 m_deltay.clear();
605 m_errdeltax.clear();
606 m_errdeltay.clear();
607 if(nxbins<0)nxbins = 0;
608 nxbins = std::min(nxbins, nmax);
609 if(nybins<0)nybins = 0;
610 nybins =std::min(nybins, nmax);
611 m_deltax.reserve(nxbins);
612 m_deltay.reserve(nybins);
613 m_errdeltax.reserve(nxbins);
614 m_errdeltay.reserve(nybins);
615 for(int ib=0; ib<nxbins && !infile.eof(); ib++){
616 infile >> value >> error;
617 m_deltax.push_back(value);
618 m_errdeltax.push_back(error);
619 }
620 for(int ib=0; ib<nybins && !infile.eof(); ib++){
621 infile >> value >> error;
622 m_deltay.push_back(value);
623 m_errdeltay.push_back(error);
624 }
625 } // and of check if version number is the first thing on file
626 } // end of Load method
const int nmax(200)
str infile
Definition run.py:13
TFile * file

◆ Print()

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

Definition at line 421 of file PixelChargeInterpolationParameters.cxx.

421 {
422
423 std::ofstream* outfile = new std::ofstream(file.c_str());
424
425 // std::cout << "TOMTOM printing constants" << std::endl;
426
427 if(m_version < 0) *outfile << m_version << std::endl;
428 // The number of bins is the number of bin extremes minus 1.
429 int ncsx = m_csx.size()-1;
430 int ncsy = m_csy.size()-1;
431 int neta = m_etabins.size()-1;
432 int nalpha = m_phibins.size()-1;
433
434 // if new format, write number o bins and bin extremes
435 if(m_version <0){ // IBL
436
437 // std::cout << "TOMTOM new format" << std::endl;
438 if(m_version<-1){
439 *outfile <<ncsx<<" "<<ncsy<<" "<<neta<<" "<<nalpha<<" "<<m_csxbinsibl<<
440 " "<<m_csybinsibl<<" "<<m_etaibl<<" "<<m_alphaibl<<std::endl;
441 }
442 else{
443 *outfile <<ncsx<<" "<<ncsy<<" "<<neta<<" "<<nalpha<<std::endl;
444 }
445 // Then write bin extremes
446
447 for(float i : m_csx){
448 *outfile << i << " ";
449 }
450 *outfile << std::endl;
451 for(float i : m_csy){
452 *outfile << i << " ";
453 }
454 *outfile << std::endl;
455 if(m_etaibl>0 && m_alphaibl >0 ){ // IBL
456 for(float ibletabin : m_ibletabins){
457 *outfile << ibletabin << " ";
458 }
459 *outfile << std::endl;
460 for(float iblphibin : m_iblphibins){
461 *outfile << iblphibin << " ";
462 }
463 *outfile << std::endl;
464 }
465 for(float etabin : m_etabins){
466 *outfile << etabin << " ";
467 }
468 *outfile << std::endl;
469 for(float phibin : m_phibins){
470 *outfile << phibin << " ";
471 }
472 *outfile << std::endl;
473 }
474 else{
475
476 // std::cout << "TOMTOM old format" << std::endl;
477 *outfile << m_deltax.size() << " " << m_deltay.size() << std::endl;
478 }
479
480 // Then bin content
481 for(unsigned int ib=0; ib<m_deltax.size(); ib++){
482 *outfile << m_deltax[ib] << " " << m_errdeltax[ib] << std::endl;
483 }
484 for(unsigned int ie=0; ie<m_deltay.size(); ie++){
485 *outfile << m_deltay[ie] << " " << m_errdeltay[ie] << std::endl;
486 }
487 outfile->close();
488
489 delete outfile;
490 }

◆ setDeltaX() [1/2]

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

Definition at line 162 of file PixelChargeInterpolationParameters.cxx.

162 {
163 if(i<0) return 0;
164 if(static_cast<unsigned int>(i) > m_deltax.size()-1) return 0;
165 m_deltax[i] = value;
166 return 1;
167 }

◆ setDeltaX() [2/2]

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

Definition at line 249 of file PixelChargeInterpolationParameters.cxx.

251 {
252 int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
253 if(ibin < 0) return 0; // error code
254 return setDeltaX(ibin, value);
255 }
int setDeltaX(int iangle, int iclustersize, int ilayer, float value)

◆ setDeltaY() [1/2]

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

Definition at line 170 of file PixelChargeInterpolationParameters.cxx.

170 {
171 if(i<0) return 0;
172 if(static_cast<unsigned int>(i) > m_deltay.size()-1) return 0;
173 m_deltay[i] = value;
174 return 1;
175 }

◆ setDeltaY() [2/2]

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

Definition at line 257 of file PixelChargeInterpolationParameters.cxx.

259 {
260 int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
261 if(ibin < 0) return 0; // error code
262 return setDeltaY(ibin, value);
263 }
int setDeltaY(int ieta, int iclustersize, int ilayer, float value)

◆ setErrDeltaX() [1/2]

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

Definition at line 193 of file PixelChargeInterpolationParameters.cxx.

193 {
194 if(i<0) return 0;
195 if(static_cast<unsigned int>(i) > m_errdeltax.size()-1) return 0;
197 return 1;
198 }

◆ setErrDeltaX() [2/2]

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

Definition at line 282 of file PixelChargeInterpolationParameters.cxx.

284 {
285 int ibin = getBarrelBinX(iclustersize, iangle, ilayer);
286 if(ibin < 0) return 0; // error code
287 return setErrDeltaX(ibin, value);
288 }
int setErrDeltaX(int iangle, int iclustersize, int ilayer, float value)

◆ setErrDeltaY() [1/2]

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

Definition at line 201 of file PixelChargeInterpolationParameters.cxx.

201 {
202 if(i<0) return 0;
203 if(static_cast<unsigned int>(i) > m_errdeltay.size()-1) return 0;
205 return 1;
206 }

◆ setErrDeltaY() [2/2]

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

Definition at line 290 of file PixelChargeInterpolationParameters.cxx.

292 {
293 int ibin = getBarrelBinY(iclustersize, ieta, ilayer);
294 if(ibin < 0) return 0; // error code
295 return setErrDeltaY(ibin, value);
296 }
int setErrDeltaY(int ieta, int iclustersize, int ilayer, float value)

◆ 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,
const std::vector< float > & constants )

Definition at line 70 of file PixelChargeInterpolationParameters.cxx.

75 { // vector with bin values
76 m_csx.clear();
77 m_csy.clear();
78 m_etabins.clear();
79 m_phibins.clear();
80 // n bins means we need n+1 bin extreme values
81 m_csx.reserve(n1+1);
82 m_csy.reserve(n2+1);
83 m_etabins.reserve(n3+1);
84 m_phibins.reserve(n4+1);
85 for(int i=0; i<n1+1; i++){
86 m_csx.push_back(c.at(i+offset));
87 }
88 offset += n1+1;
89 for(int i=0; i<n2+1; i++){
90 m_csy.push_back(c.at(i+offset));
91 }
92 offset += n2+1;
93 if(m_etaibl>0){ // IBL eta
94 m_ibletabins.reserve(m_etaibl+1);
95 for(int i = 0; i<m_etaibl+1; i++){
96 m_ibletabins.push_back(c.at(i+offset));
97 }
98 offset +=m_etaibl+1;
99 }
100 if(m_alphaibl>0){ // IBL phi
101 m_iblphibins.reserve(m_alphaibl+1);
102 for(int i = 0; i<m_alphaibl+1; i++){
103 m_iblphibins.push_back(c.at(i+offset));
104 }
105 offset +=m_alphaibl+1;
106 }
107 for(int i=0; i<n3+1; i++){
108 m_etabins.push_back(c.at(i+offset));
109 }
110 offset += n3+1;
111 for(int i=0; i<n4+1; i++){
112 m_phibins.push_back(c.at(i+offset));
113 }
114
115 offset +=n4+1;
116
117 m_deltax.clear();
118 m_deltay.clear();
119 m_errdeltax.clear();
120 m_errdeltay.clear();
121 int nxbin=m_csxbinsibl*m_alphaibl + n4*m_nlayerbins*n1;
122 int nybin=m_csybinsibl*m_etaibl + n3*m_nlayerbins*n2;
123
124 m_deltax.reserve(nxbin);
125 m_deltay.reserve(nybin);
126 m_errdeltax.reserve(nxbin);
127 m_errdeltay.reserve(nybin);
128 for(int i=0; i<nxbin; i++){
129 m_deltax.push_back(0.);
130 m_errdeltax.push_back(0.);
131 }
132 for(int i=0; i<nybin; i++){
133 m_deltay.push_back(0.);
134 m_errdeltay.push_back(0.);
135 }
136
137 }

◆ setVersion()

void PixelChargeInterpolationParameters::setVersion ( int version)

Definition at line 66 of file PixelChargeInterpolationParameters.cxx.

66{ 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: