CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes
TPNCor Class Reference

#include <TPNCor.h>

Inheritance diagram for TPNCor:

Public Types

enum  VarGain { iGain0, iGain1, iSizeGain }
 
enum  VarParPN { iPar0, iPar1, iPar2, iSizePar }
 

Public Member Functions

double getPNCorrectionFactor (double val0, int gain)
 
 TPNCor (std::string filename)
 
 ~TPNCor () override
 

Public Attributes

double corParams [iSizeGain][iSizePar]
 
int isFileOK
 

Detailed Description

Definition at line 7 of file TPNCor.h.

Member Enumeration Documentation

◆ VarGain

Enumerator
iGain0 
iGain1 
iSizeGain 

Definition at line 16 of file TPNCor.h.

16 { iGain0, iGain1, iSizeGain };

◆ VarParPN

Enumerator
iPar0 
iPar1 
iPar2 
iSizePar 

Definition at line 17 of file TPNCor.h.

17 { iPar0, iPar1, iPar2, iSizePar };

Constructor & Destructor Documentation

◆ TPNCor()

TPNCor::TPNCor ( std::string  filename)

Definition at line 22 of file TPNCor.cc.

22  {
23  // Initialize
24 
25  isFileOK = 0;
26 
27  for (int i = 0; i < iSizePar; i++) {
28  for (int j = 0; j < iSizeGain; j++) {
29  corParams[j][i] = 0.0;
30  }
31  }
32 
33  // Get values from file
34 
35  FILE *test;
36  test = fopen(filename.c_str(), "r");
37  char c;
38  int gain;
39  double aa, bb, cc;
40  std::ifstream fin;
41 
42  if (test) {
43  fclose(test);
44  fin.open(filename.c_str());
45  while ((c = fin.peek()) != EOF) {
46  fin >> gain >> aa >> bb >> cc;
47 
48  if (gain < iSizeGain) {
49  corParams[gain][0] = aa;
50  corParams[gain][1] = bb;
51  corParams[gain][2] = cc;
52  }
53  }
54  isFileOK = 1;
55  fin.close();
56  } else {
57  cout << " No PN linearity corrections file found, no correction will be applied " << endl;
58  }
59 }

References c, gather_cfg::cout, corrVsCorr::filename, groupFilesInBlocks::fin, PedestalClient_cfi::gain, mps_fire::i, dqmiolumiharvest::j, and ctpps_dqm_sourceclient-live_cfg::test.

◆ ~TPNCor()

TPNCor::~TPNCor ( )
override

Definition at line 62 of file TPNCor.cc.

62 {}

Member Function Documentation

◆ getPNCorrectionFactor()

double TPNCor::getPNCorrectionFactor ( double  val0,
int  gain 
)

Definition at line 64 of file TPNCor.cc.

64  {
65  double cor = 0;
66  double corr = 1.0;
67  double pn = val0;
68  double xpn = val0 / 1000.0;
69 
70  if (isFileOK == 0)
71  return 1.0;
72 
73  if (gain > iSizeGain)
74  cout << "Unknown gain, gain has to be lower than " << iSizeGain << endl;
75 
76  if (gain < iSizeGain) {
77  cor = xpn * (corParams[gain][0] + xpn * (corParams[gain][1] + xpn * corParams[gain][2]));
78 
79  if (pn != 0)
80  corr = 1.0 - cor / pn;
81  else
82  corr = 1.0;
83  }
84 
85  return corr;
86 }

References alignCSCRings::corr, gather_cfg::cout, and PedestalClient_cfi::gain.

Referenced by EcalLaserAnalyzer2::analyze(), and EcalLaserAnalyzer::analyze().

Member Data Documentation

◆ corParams

double TPNCor::corParams[iSizeGain][iSizePar]

Definition at line 22 of file TPNCor.h.

◆ isFileOK

int TPNCor::isFileOK

Definition at line 23 of file TPNCor.h.

mps_fire.i
i
Definition: mps_fire.py:428
TPNCor::iSizePar
Definition: TPNCor.h:17
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cc
TPNCor::iGain1
Definition: TPNCor.h:16
TPNCor::iPar0
Definition: TPNCor.h:17
TPNCor::isFileOK
int isFileOK
Definition: TPNCor.h:23
test
Definition: SmallWORMDict.h:13
ctpps_dqm_sourceclient-live_cfg.test
test
Definition: ctpps_dqm_sourceclient-live_cfg.py:7
groupFilesInBlocks.fin
fin
Definition: groupFilesInBlocks.py:94
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
TPNCor::iPar2
Definition: TPNCor.h:17
TPNCor::iPar1
Definition: TPNCor.h:17
TPNCor::iGain0
Definition: TPNCor.h:16
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
TPNCor::corParams
double corParams[iSizeGain][iSizePar]
Definition: TPNCor.h:22
TPNCor::iSizeGain
Definition: TPNCor.h:16
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66