/* * ScanCorrection.cpp * * Created on: Apr 12, 2016 * Author: Hovanes Egiyan */ #include "ScanCorrection.hh" ClassImp( ScanCorrection ) using namespace std; map > ScanCorrection::scCorrectionMap; volatile int dummyInt = ScanCorrection::initCorrectionMap(); ScanCorrection::ScanCorrection( ScanDetector* det, const TF1* func ) : TF1( *func ), scDetector( det ) { } ScanCorrection::~ScanCorrection() { return; } double ScanCorrection::getCorrection( int iPoint ) { // cout << "Correction will be calculated for point " << iPoint << endl; double xCorr = getDetector()->getData()[iPoint]; // cout << "Value for point " << iPoint << " for detector " << getDetector()->getName() << " is " << xCorr << endl; // cout << "Function range is [" << this->GetXmin() << " , " << this->GetXmax() << "]" << endl; if( this->GetXmin() < xCorr && xCorr < this->GetXmax() ) { // cout << "Value is " << this->Eval( xCorr ) << endl; return this->Eval( xCorr ); } else { // cout << "Returning 1.0" << endl; return 1.0; } } int ScanCorrection::initCorrectionMap() { // { //// string func = "(95.43*x-2279)/(-653.484+345.957*pow(x,1)-71.5453*pow(x,2)+7.53501*pow(x,3)-0.442723*pow(x,4)+0.0152754*pow(x,5)-0.000313361*pow(x,6)+3.7397e-06*pow(x,7)-2.38932e-08*pow(x,8)+6.30527e-11*pow(x,9))" ; //// string func = "(20+0.0129503*x)/(12.9161+0.0308255*pow(x,1)+3.08107e-06*pow(x,2)+-2.86571e-09*pow(x,3)+4.18487e-13*pow(x,4)+-1.81804e-17*pow(x,5))"; // // string func = "18.0011+0.0317766*x+-7.3213e-06*pow(x,2)+9.65255e-10*pow(x,3)+-5.80662e-14*pow(x,4)+1.59523e-18*pow(x,5)+-1.6518e-23*pow(x,6)"; // // // pair newPair( " HALO:T:electron:tag:left:scaler_r1", new TF1( " HALO:T:electron:tag:left:scaler_r1", func.c_str(), 0, 20000 ) ); // scCorrectionMap[" HALO:T:electron:tag:left:scaler_r1"] = newPair; // } return 0; }