#include <TPNCor.h>
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 |
enum TPNCor::VarGain |
enum TPNCor::VarParPN |
TPNCor::TPNCor | ( | std::string | filename | ) |
Definition at line 23 of file TPNCor.cc.
References trackerHits::c, gather_cfg::cout, groupFilesInBlocks::fin, i, and j.
{ // Initialize isFileOK=0; for(int i=0;i<iSizePar;i++){ for(int j=0;j<iSizeGain;j++){ corParams[j][i] = 0.0 ; } } // Get values from file FILE *test; test = fopen(filename.c_str(),"r"); char c; int gain; double aa, bb, cc; ifstream fin; if( test ) { fclose( test ); fin.open(filename.c_str()); while( (c=fin.peek()) != EOF ) { fin >> gain>> aa >> bb >> cc; if(gain<iSizeGain){ corParams[gain][0]=aa; corParams[gain][1]=bb; corParams[gain][2]=cc; } } isFileOK=1; fin.close(); }else { cout <<" No PN linearity corrections file found, no correction will be applied "<< endl; } }
double TPNCor::getPNCorrectionFactor | ( | double | val0, |
int | gain | ||
) |
Definition at line 73 of file TPNCor.cc.
References corr, and gather_cfg::cout.
Referenced by EcalLaserAnalyzer::analyze(), and EcalLaserAnalyzer2::analyze().
{ double cor=0; double corr=1.0; double pn=val0; double xpn=val0/1000.0; if( isFileOK==0) return 1.0; if( gain> iSizeGain ) cout << "Unknown gain, gain has to be lower than "<<iSizeGain << endl; if( gain< iSizeGain ) { cor=xpn*(corParams[gain][0] +xpn*(corParams[gain][1]+xpn*corParams[gain][2])); if(pn!=0) corr = 1.0 - cor/pn; else corr=1.0; } return corr; }
double TPNCor::corParams[iSizeGain][iSizePar] |
int TPNCor::isFileOK |