CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual ~TPNCor ()
 

Public Attributes

double corParams [iSizeGain][iSizePar]
 
int isFileOK
 

Detailed Description

Definition at line 7 of file TPNCor.h.

Member Enumeration Documentation

Enumerator
iGain0 
iGain1 
iSizeGain 

Definition at line 22 of file TPNCor.h.

Enumerator
iPar0 
iPar1 
iPar2 
iSizePar 

Definition at line 23 of file TPNCor.h.

Constructor & Destructor Documentation

TPNCor::TPNCor ( std::string  filename)

Definition at line 23 of file TPNCor.cc.

References trackerHits::c, gather_cfg::cout, groupFilesInBlocks::fin, i, j, and run_regression::test.

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

Definition at line 67 of file TPNCor.cc.

68 {
69 
70 
71 }

Member Function Documentation

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

Definition at line 73 of file TPNCor.cc.

References corr, and gather_cfg::cout.

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

74 {
75 
76  double cor=0;
77  double corr=1.0;
78  double pn=val0;
79  double xpn=val0/1000.0;
80 
81  if( isFileOK==0) return 1.0;
82 
83  if( gain> iSizeGain ) cout << "Unknown gain, gain has to be lower than "<<iSizeGain << endl;
84 
85  if( gain< iSizeGain ) {
86 
87  cor=xpn*(corParams[gain][0] +xpn*(corParams[gain][1]+xpn*corParams[gain][2]));
88 
89  if(pn!=0) corr = 1.0 - cor/pn;
90  else corr=1.0;
91  }
92 
93  return corr;
94 }
double corParams[iSizeGain][iSizePar]
Definition: TPNCor.h:28
JetCorrectorParameters corr
Definition: classes.h:9
int isFileOK
Definition: TPNCor.h:29
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

double TPNCor::corParams[iSizeGain][iSizePar]

Definition at line 28 of file TPNCor.h.

int TPNCor::isFileOK

Definition at line 29 of file TPNCor.h.