ROOT logo
/*
.x $ALICE_ROOT/TPC/Upgrade/macros/NimStyle.C

.x $HOME/rootlogon.C

.L $ALICE_ROOT/TPC/Upgrade/macros/makeCurrentCorrection.C+

*/

#include "TMath.h"
#include "TRandom.h"
#include "TTreeStream.h"
#include "TVectorD.h"
#include "TCanvas.h"
#include "TStopwatch.h"
#include "AliTPCParam.h"
#include "AliTPCcalibDB.h"
#include "AliTPCAltroMapping.h"
#include "AliAltroRawStream.h"
#include "AliSysInfo.h"
#include "AliTPCRawStreamV3.h"
#include "AliCDBManager.h"
#include "TGeoGlobalMagField.h"
#include "AliMagF.h"
#include "AliRawReaderRoot.h"
#include "AliRawReader.h"
#include "TH3.h"
#include "TH2.h"
#include "AliTPCCalPad.h"
#include "AliTPCCalROC.h"
#include "TChain.h"
#include "AliXRDPROOFtoolkit.h"
#include "TLegend.h"
#include "TCut.h"
#include "TGraphErrors.h"
#include "TStatToolkit.h"
#include "TF2.h"

#include "AliDCSSensor.h"
#include "AliCDBEntry.h"
#include "AliDCSSensorArray.h"
#include "TStyle.h"
#include "AliTPCSpaceCharge3D.h"
#include "AliExternalTrackParam.h"
#include "AliTrackerBase.h"
#include "TDatabasePDG.h"
#include "TROOT.h"
#include "AliMathBase.h"
#include "TLatex.h"
#include "AliTPCCorrectionLookupTable.h"
//

const Int_t kColors[6]={1,2,3,4,6,7};
const Int_t kMarkers[6]={20,21,24,25,24,25};
TObjArray garrayFit(3);


void MakeLocalDistortionCurrentTree(Int_t npointsZ=20000, Int_t id=0);
void MakeSmoothKernelStudy(Int_t npoints, Int_t nkernels, Int_t mapID);

void makeCurrentCorrection(Int_t action=0, Int_t arg0=5000, Int_t arg1=0, Int_t arg2=0){
  //
  //
  //
  if (action==0) MakeLocalDistortionCurrentTree(arg0,arg1);
  if (action==1) MakeSmoothKernelStudy(arg0,arg1,arg2);
 
}

void SetGraphTDRStyle(TGraph * graph){
  graph->GetXaxis()->SetLabelSize(0.08);
  graph->GetXaxis()->SetTitleSize(0.08);
  graph->GetYaxis()->SetLabelSize(0.08);
  graph->GetYaxis()->SetTitleSize(0.08);
  graph->GetXaxis()->SetNdivisions(510);
  graph->GetYaxis()->SetNdivisions(505);
}

void MakeLocalDistortionCurrentTree(Int_t npointsZ, Int_t id){
  //
  // Macro to make trees with local distortions 
  // Results are later visualized in the function DrawLocalDistortionPlots()
  //
  /*
    Int_t npointsZ=1000;
    Int_t id=0;
  */
  Int_t nitteration=300;
  TTreeSRedirector *pcstream = new TTreeSRedirector("localCurrent.root","update");
  //
  TFile *fCurrent = TFile::Open("SpaceChargeFluc10_1.root");
  TFile *fRef = TFile::Open("SpaceChargeFluc0_1.root");
  //
  AliTPCSpaceCharge3D* distortion = ( AliTPCSpaceCharge3D*)fCurrent->Get("DistRef"); 
  AliTPCSpaceCharge3D* distortionRef = ( AliTPCSpaceCharge3D*)fRef->Get("DistRef"); 
  //
  Int_t nz= distortion->GetInputSpaceCharge3D()->GetZaxis()->GetNbins();
  TH3 *hisOrig = (TH3*)distortionRef->GetInputSpaceCharge3D();
  printf("Make mean histo\n");
  TStopwatch timer;
  //
  for (Int_t iside=0; iside<2; iside++){
    for (Int_t iphi=1; iphi<distortion->GetInputSpaceCharge3D()->GetXaxis()->GetNbins(); iphi+=3){
      for (Int_t ir=1; ir<distortion->GetInputSpaceCharge3D()->GetYaxis()->GetNbins(); ir+=3){
	Double_t sum=0, sumW=0;
	if (iside==0) for (Int_t iz2=1; iz2<nz/2; iz2++)   {sum+= hisOrig->GetBinContent(iphi,ir,iz2); sumW++;}
	if (iside==1) for (Int_t iz2=nz/2; iz2<nz;  iz2++) {sum+= hisOrig->GetBinContent(iphi,ir,iz2); sumW++;}
	//
	if (iside==0) for (Int_t iz=1; iz<nz/2; iz++) hisOrig->SetBinContent(iphi,ir,iz,sum/sumW);
	if (iside==1) for (Int_t iz=nz/2; iz<=nz; iz++) hisOrig->SetBinContent(iphi,ir,iz,sum/sumW);
      }
    }
  }
  timer.Print();
  printf("Make mean histo\n");
  //
  distortion->InitSpaceCharge3DPoisson(129, 129, 144,nitteration);
  distortionRef->InitSpaceCharge3DPoisson(129, 129, 144,nitteration);
  //
  distortion->AddVisualCorrection(distortion,1);
  distortionRef->AddVisualCorrection(distortionRef,2);
  //
  TVectorD normZR(125), normZRPhi(125), normZZ(125), normZPos(125);
  TVectorD normDZR(125), normDZRPhi(125), normDZZ(125);
  TVectorD normZRChi2(125), normZRPhiChi2(125), normZZChi2(125);
  TVectorD qCurrent(125), qRef(125);
  TVectorD qCurrentInt(125), qRefInt(125);
  
  //
  for (Int_t iz =0; iz<125; iz++){
    for (Int_t iphi=1; iphi<distortion->GetInputSpaceCharge3D()->GetXaxis()->GetNbins(); iphi+=3)
      for (Int_t ir=1; ir<distortion->GetInputSpaceCharge3D()->GetYaxis()->GetNbins(); ir+=3){
	qCurrent[iz]+=	distortion->GetInputSpaceCharge3D()->GetBinContent(iphi,ir,iz+1);
	qRef[iz]+=	distortionRef->GetInputSpaceCharge3D()->GetBinContent(iphi,ir,iz+1);		
      }   
  } 
  //
  for (Int_t iz =0; iz<125; iz++){
    for (Int_t jz =0; jz<125; jz++){
      if (iz<125/2 && jz<=iz){
	qCurrentInt[iz]+=qCurrent[jz];
	qRefInt[iz]+=qRef[jz];
      }
      if (iz>125/2 && jz>=iz){
	qCurrentInt[iz]+=qCurrent[jz];
	qRefInt[iz]+=qRef[jz];
      }
    }
  }
  //    
  //
  for (Int_t iz =0; iz<125; iz++){
    Double_t z0 = -250+iz*4;
    TLinearFitter fitterR(2,"pol1");
    TLinearFitter fitterRPhi(2,"pol1");
    TLinearFitter fitterZ(2,"pol1");
    Double_t xvalue[10]={0};
    for (Int_t ipoint =0; ipoint<npointsZ; ipoint++){      
      Double_t r0   = 95+gRandom->Rndm()*(245-95.);
      Double_t phi0 = gRandom->Rndm()*TMath::TwoPi();      
      if (TMath::Abs(distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,1,1))>20) continue;
      if (TMath::Abs(distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,1,2))>20) continue;
      xvalue[0]=distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,0,2);
      fitterR.AddPoint(xvalue,distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,0,1));
      xvalue[0]=distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,1,2);
      fitterRPhi.AddPoint(xvalue,distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,1,1));
      xvalue[0]=distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,2,2);
      fitterZ.AddPoint(xvalue,distortion->GetCorrXYZ(r0*TMath::Cos(phi0), r0*TMath::Sin(phi0), z0,2,1));
    }    
    fitterR.Eval();
    fitterRPhi.Eval();
    fitterZ.Eval();    
    normZR[iz]=fitterR.GetParameter(1);
    normZRPhi[iz]=fitterRPhi.GetParameter(1);
    normZZ[iz]=fitterZ.GetParameter(1);
    normZRChi2[iz]=TMath::Sqrt(fitterR.GetChisquare()/fitterR.GetNpoints());    
    normZRPhiChi2[iz]=TMath::Sqrt(fitterRPhi.GetChisquare()/fitterRPhi.GetNpoints());    
    normZZChi2[iz]=TMath::Sqrt(fitterZ.GetChisquare()/fitterZ.GetNpoints());    
    //
    if (iz>0){
      normDZR[iz]=(normZR[iz]-normZR[iz-1]);
      normDZRPhi[iz]=(normZRPhi[iz]-normZRPhi[iz-1]);
    }
    normZPos[iz]=z0;    
  }
  {    
    (*pcstream)<<"meanCurrent"<<
      "id="<<id<<                       // lookup ID
      "normZPos.="<<&normZPos<<         // zposition
      //
      "qCurrent.="<<&qCurrent<<         // current measuremn 
      "qRef.="<<&qRef<<                 // current in refenece sample
      "qCurrentInt.="<<&qCurrentInt<<   // integral of current
      "qRefInt.="<<&qRefInt<<           // integral of current 
      //
      //
      //
      "normZR.="<<&normZR<<             // mult. scaling to minimize R distortions
      "normDZR.="<<&normDZR<<           // mult. scaling to minimize R distortions
      "normZRPhi.="<<&normZRPhi<<       // mult. scaling 
      "normDZRPhi.="<<&normDZRPhi<<     // mult. scaling 
      "normZZ.="<<&normZZ<<
      //
      "normZRChi2.="<<&normZRChi2<<            // mult. scaling to minimize R distortions
      "normZRPhiChi2.="<<&normZRPhiChi2<<      // mult. scaling 
      "normZZChi2.="<<&normZZChi2<<
      "\n";
  }
  delete pcstream;
  
  pcstream = new TTreeSRedirector("localCurrent.root","update");
  TTree * treeNormZ= (TTree*)pcstream->GetFile()->Get("meanCurrent");
  TGraphErrors * grZRfit= TStatToolkit::MakeGraphErrors( treeNormZ, "normZR.fElements:normZPos.fElements","",25,2,0.5);
  TGraphErrors * grZRPhifit= TStatToolkit::MakeGraphErrors( treeNormZ, "normZRPhi.fElements:normZPos.fElements","",25,4,0.5);
  grZRfit->Draw("alp");
  grZRPhifit->Draw("lp");
}


void Fit(){
  //
  // Not good  rsponse should be more complicated
  //
  TTreeSRedirector *pcstream = new TTreeSRedirector("localCurrent.root","update");
  TTree * treeCurrent= (TTree*)pcstream->GetFile()->Get("meanCurrent");
  //
  TVectorD* pnormZR=0, *pnormZRPhi=0, *pnormZZ=0, *pnormZPos=0;
  TVectorD* pqCurrent=0, *pqRef=0;
  TVectorD* pqCurrentInt=0, *pqRefInt=0;
  //
  treeCurrent->SetBranchAddress("normZR.",&pnormZR);
  treeCurrent->SetBranchAddress("normZPos.",&pnormZPos);
  treeCurrent->SetBranchAddress("normZRPhi.",&pnormZRPhi);
  treeCurrent->SetBranchAddress("qCurrent.",&pqCurrent);
  treeCurrent->SetBranchAddress("qRef.",&pqRef);
  treeCurrent->SetBranchAddress("qCurrentInt.",&pqCurrentInt);
  treeCurrent->SetBranchAddress("qRefInt.",&pqRefInt);
  Int_t entries = treeCurrent->GetEntries();
  //
  //
  for (Double_t sigma=1; sigma<40; sigma++){    
    for (Int_t entry=0; entry<entries; entry++){
      treeCurrent->GetEntry(entry);
      //
      TVectorD vecCurrentRefInt(125);
      for (Int_t i=0; i<125; i++){
	Double_t sumW=0;
	for (Int_t j=0; j<125; j++){
	  if (((*pnormZPos)[i]*(*pnormZPos)[j])<0) continue;
	  Double_t weight = 0;
	  if ((*pnormZPos)[i]<0) weight=0.5*(TMath::Erf(Double_t(i-j)/Double_t(sigma))+1);
	  if ((*pnormZPos)[i]>0) weight=0.5*(TMath::Erf(Double_t(j-i)/Double_t(sigma))+1);
	  vecCurrentRefInt[i]+=weight*(*pqCurrent)[j]/(*pqRef)[j];	  
	  sumW+=weight;
	}
	vecCurrentRefInt[i]/=sumW;
      }
      (*pcstream)<<"sigmaScan"<<
	"entry="<<entry<<
	"sigma="<<sigma<<
	"normZPos.="<<pnormZPos<<
	"normZR.="<<pnormZR<<
	"normZRPhi.="<<pnormZRPhi<<
	"vecCurrent.="<<&vecCurrentRefInt<<
	"\n";
    }
  }
  delete pcstream; 
  pcstream = new TTreeSRedirector("localCurrent.root","update");
  TTree * treeScan= (TTree*)pcstream->GetFile()->Get("sigmaScan"); 
  treeCurrent= (TTree*)pcstream->GetFile()->Get("meanCurrent");
  treeScan->SetMarkerStyle(25);
  treeScan->SetMarkerSize(0.4); 
  treeScan->Draw("vecCurrent.fElements:normZR.fElements:sigma","abs(normZPos.fElements-100)<20&&sigma>10","colz");

}

void FitLinear(){
  //
  // deltaX_i = A_ij*deltaI_j
  // 
  TTreeSRedirector *pcstream = new TTreeSRedirector("localCurrent.root","update");
  TTree * treeCurrent= (TTree*)pcstream->GetFile()->Get("meanCurrent");
  //
  TVectorD* pnormZR=0, *pnormZRPhi=0, *pnormZZ=0, *pnormZPos=0;
  TVectorD* pqCurrent=0, *pqRef=0;
  TVectorD* pqCurrentInt=0, *pqRefInt=0;
  //
  treeCurrent->SetBranchAddress("normZR.",&pnormZR);
  treeCurrent->SetBranchAddress("normZPos.",&pnormZPos);
  treeCurrent->SetBranchAddress("normZRPhi.",&pnormZRPhi);
  treeCurrent->SetBranchAddress("qCurrent.",&pqCurrent);
  treeCurrent->SetBranchAddress("qRef.",&pqRef);
  treeCurrent->SetBranchAddress("qCurrentInt.",&pqCurrentInt);
  treeCurrent->SetBranchAddress("qRefInt.",&pqRefInt);
  Int_t entries = treeCurrent->GetEntries();
  //
  //
  //
  Int_t nParamSide=62;               // number of z bins on 1 side
  Int_t group=3;                     // grouping of bins
  Int_t nParams=nParamSide/group;    // parameters
  Int_t nParamsFit=nParams*nParams;  //
  TLinearFitter fitter(nParamsFit+1,TString::Format("hyp%d",nParamsFit));
  TVectorD xVector(nParamsFit+1);
  TVectorD pVector(nParamsFit+1);
  //
  for (Int_t ievent=0; ievent<entries; ievent++){
    treeCurrent->GetEntry(ievent);
    for (Int_t iz=0; iz<nParamSide; iz++){      
      Int_t dPar=iz/group;
      if (dPar>nParams-1) dPar=nParams-1;
      // 1.) clear X vectors
      for (Int_t ipar=0; ipar<nParamsFit; ipar++) xVector[ipar]=0;
      // 2.) set   X vector of interest
      for (Int_t cPar=0; cPar<nParams; cPar++){
	xVector[dPar*nParams+cPar] += (*pqCurrent)[cPar*group]/(*pqRef)[cPar*group];
 	xVector[dPar*nParams+cPar] += (*pqCurrent)[TMath::Min(cPar*group+1,nParamSide)]/(*pqRef)[TMath::Min(cPar*group+1,nParamSide)];
 	xVector[dPar*nParams+cPar] += (*pqCurrent)[TMath::Max(cPar*group-1,0)]/(*pqRef)[TMath::Max(cPar*group-1,0)];
      }
      Double_t val = 0;
      val+=(*pnormZR)[dPar*group];
      val+=(*pnormZR)[TMath::Max(dPar*group-1,0)];
      val+=(*pnormZR)[TMath::Min(dPar*group,nParamSide)];
      val/=3.;
      fitter.AddPoint(xVector.GetMatrixArray(),val,0.0035);
    }
  }
  for (Int_t cPar=1; cPar<nParams-1; cPar++){
    //
    for (Int_t ipar=0; ipar<nParamsFit; ipar++) xVector[ipar]=0;
    xVector[(cPar-1)*nParams+cPar-1]=0.5;
    xVector[(cPar)*nParams+cPar]    =-1;
    xVector[(cPar+1)*nParams+cPar+1]=0.5;
    fitter.AddPoint(xVector.GetMatrixArray(),0,0.05);
  }
  fitter.Eval();
  //
  //
  TVectorD fitVector(nParamsFit);
  TVectorD czVector(nParamsFit);
  TVectorD fitVectorErr(nParamsFit);
  fitter.GetParameters(fitVector);
  for (Int_t iPar=0; iPar<nParamsFit; iPar++)  {
    pVector[iPar]=iPar;
    czVector[iPar]=250.*((iPar-1)%nParams)/nParams;
    fitVectorErr[iPar]=fitter.GetParError(iPar);
  }
  Double_t chi2= TMath::Sqrt(fitter.GetChisquare()/fitter.GetNpoints());
  printf("Chi2=%f\n",chi2);
  TGraphErrors * gr  = new TGraphErrors(nParamsFit,  pVector.GetMatrixArray(), fitVector.GetMatrixArray(), 0,fitVectorErr.GetMatrixArray());
  gr->SetMarkerStyle(25); gr->SetMarkerSize(0.3);
  gr->Draw("alp");
  
  TGraphErrors * vgraphs[20]={0};
  for (Int_t ipar=0; ipar<20; ipar++){
    vgraphs[ipar]=new TGraphErrors(nParams, &(czVector.GetMatrixArray()[ipar*nParams+1]), &(fitVector.GetMatrixArray()[ipar*nParams+1]), 0,  &(fitVectorErr.GetMatrixArray()[ipar*nParams+1])); 
    vgraphs[ipar]->GetXaxis()->SetTitle("z_{I} (cm)");
    vgraphs[ipar]->GetYaxis()->SetTitle("#it{A}_{i_{I},j_{#DeltaR}}");
    vgraphs[ipar]->SetMinimum(0);
    vgraphs[ipar]->SetMaximum(0.1);
    SetGraphTDRStyle(vgraphs[ipar]);
  }
  
  TCanvas * canvasFit = new TCanvas("canvasFit","canvasFit",700,700); 
  canvasFit->SetRightMargin(0.05);
  canvasFit->SetLeftMargin(0.15);
  canvasFit->SetBottomMargin(0.18);
  canvasFit->Divide(1,2,0,0);
  TLegend * legend0 = new TLegend(0.4,0.4,0.95,0.95,"Current fluctuation correction matrix. #DeltaR_{zi}=A_{ij}I_{zj}");
  legend0->SetBorderSize(0);
  TLegend * legend1 = new TLegend(0.4,0.5,0.95,0.95,"Current fluctuation correction matrix. #DeltaR_{zi}=A_{ij}I_{zj}");
  legend1->SetBorderSize(0);

  for (Int_t ipar=0; ipar<10; ipar++){
    canvasFit->cd(ipar/5+1)->SetTicks(3,3);
    vgraphs[ipar*2]->SetMarkerStyle(kMarkers[ipar%5]);
    vgraphs[ipar*2]->SetMarkerColor(kColors[ipar%5]);
    vgraphs[ipar*2]->SetLineColor(kColors[ipar%5]);
    if (ipar%5==0) vgraphs[ipar*2]->Draw("alp");
    vgraphs[ipar*2]->Draw("lp");
    if (ipar<5) legend0->AddEntry(vgraphs[ipar*2],TString::Format("z_{#DeltaR}=%1.0f (cm)",250.*ipar/10.),"p");
    if (ipar>=5) legend1->AddEntry(vgraphs[ipar*2],TString::Format("z_{#DeltaR}=%1.0f (cm)",250.*ipar/10.),"p");
  }	
  legend0->SetTextSize(0.05);
  legend1->SetTextSize(0.05);
  //
  canvasFit->cd(1);
  legend0->Draw();
  canvasFit->cd(2);
  legend1->Draw();
  canvasFit->SaveAs("canvasAIJ_CurrenToDR.pdf");
  canvasFit->SaveAs("canvasAIJ_CurrenToDR.png");
}

void MakeSmoothKernelStudy(Int_t npoints, Int_t nkernels, Int_t mapID){
  //
  // Compare the input and reconstructed distortion maps
  // Input files are expected to have predefined names
  // 
  // Values and smoothed vaules using differnt smoothing algorithms are used
  // Results of given studies will be used to define "optimal" smoothing algorithm
  // and optimal Kernel parameters
  // 
  //
  gRandom->SetSeed(mapID);
  const Double_t cutMaxDist=3;
  const Double_t cutMinDist=0.00001;
  const Int_t kMinPoints=10;
  TFile *foutput = TFile::Open("MeasureResidual.root");
  TFile *finput = TFile::Open("RealResidualScaled.root");
  AliTPCCorrectionLookupTable *mapIn = (AliTPCCorrectionLookupTable *)finput->Get("map");
  AliTPCCorrectionLookupTable *mapOut = (AliTPCCorrectionLookupTable *)foutput->Get("map");
  AliTPCCorrection::AddVisualCorrection(mapIn,1);    // input==1
  AliTPCCorrection::AddVisualCorrection(mapOut,2);   // output (reconstructed==2)
  TF1 * fin = new TF1("fin","AliTPCCorrection::GetCorrXYZ(x,5,10,1,1)",85,245);
  TF1 * fout = new TF1("fout","AliTPCCorrection::GetCorrXYZ(x,5,10,1,2)",85,245);  
  TTreeSRedirector * pcstream = new TTreeSRedirector("smoothLookupStudy.root","recreate");
  //
  //
  // 1. Generate random point of interest
  //
  TVectorD  sigmaKernelR(nkernels);
  TVectorD  sigmaKernelRPhi(nkernels);
  TVectorD  sigmaKernelZ(nkernels);
  //
  TVectorD  fitValuesOut(nkernels);
  TVectorD  fitValuesOutR(nkernels);
  TVectorD  fitValuesIn(nkernels);
  TVectorD  fitValuesInR(nkernels);
  //
  TVectorD  fitValuesOutErr(nkernels);
  TVectorD  fitValuesOutChi2(nkernels);
  TVectorD  fitSumW(nkernels);
  TVectorD  fitValuesOutN(nkernels);
  //
  TLinearFitter *fittersOut[nkernels];
  TLinearFitter *fittersOutR[nkernels];
  TLinearFitter *fittersIn[nkernels];
  TLinearFitter *fittersInR[nkernels];
  for (Int_t ipoint=0; ipoint<npoints; ipoint++){ 
    if (ipoint%10==0) printf("%d\n",ipoint);
    for (Int_t i=0; i<nkernels; i++) {
      fittersOut[i]=new TLinearFitter(7,"hyp6");
      fittersOutR[i]=new TLinearFitter(7,"hyp6");
      fittersIn[i]=new TLinearFitter(7,"hyp6");
      fittersInR[i]=new TLinearFitter(7,"hyp6");
    }
    Double_t phi = gRandom->Rndm()*TMath::TwoPi();
    Double_t r   = 85+gRandom->Rndm()*(245-85);
    Double_t theta   = -0.9+gRandom->Rndm()*1.8;
    Double_t z=r*theta;     
    //
    Double_t x = r*TMath::Cos(phi);
    Double_t y = r*TMath::Sin(phi);
    Double_t drphiInput = AliTPCCorrection::GetCorrXYZ(x,y,z,1,1);   // 
    Double_t drphiOutput = AliTPCCorrection::GetCorrXYZ(x,y,z,1,2);  //
    Double_t drInput = AliTPCCorrection::GetCorrXYZ(x,y,z,0,1);
    Double_t drOutput = AliTPCCorrection::GetCorrXYZ(x,y,z,0,2);
    if (TMath::Abs(drphiOutput)<cutMinDist) continue; // beter condition needed
    if (TMath::Abs(drphiInput)<cutMinDist) continue; // beter condition needed
    if (TMath::Abs(drphiOutput)>cutMaxDist) continue; // beter condition needed
    if (TMath::Abs(drphiInput)>cutMaxDist) continue; // beter condition needed
    //
    for (Int_t i=0; i<nkernels; i++) {
      sigmaKernelR[i]    = 0.5+30.*TMath::Power(gRandom->Rndm(),2); 
      sigmaKernelRPhi[i] = 0.5+30.*TMath::Power(gRandom->Rndm(),2);
      sigmaKernelZ[i]    = 0.5+30.*TMath::Power(gRandom->Rndm(),2);
      fitSumW[i]=0;
    }
    for (Int_t idphi=-12; idphi<=12; idphi++){
      Double_t dphi=idphi*TMath::Pi()/90.;            // we need to know actual segentation of the histograms - lookup should by multiple
      for (Double_t dR=-50; dR<=50.; dR+=5){
	for (Double_t dZ=-50; dZ<=50.; dZ+=5){
	  if (r+dR<85) continue;
	  if (r+dR>245) continue;
	  if (z+dZ<-240) continue;
	  if (z+dZ>240) continue;
	  if (z*(z+dZ)<0) continue;
	  //
	  Double_t x2=(r+dR)*TMath::Cos(phi+dphi);
	  Double_t y2=(r+dR)*TMath::Sin(phi+dphi);
	  Double_t z2=z+dZ;
	  Double_t drphiInput2=AliTPCCorrection::GetCorrXYZ(x2,y2,z2,1,1);
	  Double_t drInput2=AliTPCCorrection::GetCorrXYZ(x2,y2,z2,0,1);
	  Double_t drphiOutput2=AliTPCCorrection::GetCorrXYZ(x2,y2,z2,1,2);
	  Double_t drOutput2=AliTPCCorrection::GetCorrXYZ(x2,y2,z2,0,2);
	  if (TMath::Abs(drphiOutput2)<cutMinDist) continue; // hard cut beter condition needed
	  if (TMath::Abs(drphiOutput2)>cutMaxDist) continue; // beter condition needed
	  if (TMath::Abs(drphiInput2)<cutMinDist) continue; // hard cut beter condition needed
	  if (TMath::Abs(drphiInput2)>cutMaxDist) continue; // beter condition needed

	  Double_t xfit[7]={dphi,dphi*dphi,dR,dR*dR,dZ,dZ*dZ};
	  for (Int_t i=0; i<nkernels; i++) {
	    Double_t weight=1;
	    weight*=TMath::Gaus(dphi*r,0,sigmaKernelRPhi[i]);
	    weight*=TMath::Gaus(dR,0,sigmaKernelR[i]);
	    weight*=TMath::Gaus(dZ,0,sigmaKernelZ[i]);
	    weight+=0.00000001;
	    fitSumW[i]+=weight;
	    fittersOut[i]->AddPoint(xfit,drphiOutput2,0.1/weight);
	    fittersOutR[i]->AddPoint(xfit,drOutput2,0.1/weight);
	    //
	    fittersIn[i]->AddPoint(xfit,drphiInput2,0.1/weight);
	    fittersInR[i]->AddPoint(xfit,drInput2,0.1/weight);
	  }
	}
      }
    }   
    
    for (Int_t ifix=0; ifix<=1; ifix++){
      Bool_t isOK=kTRUE;
      for (Int_t i=0; i<nkernels; i++) {
	if( fittersOut[i]->GetNpoints() < kMinPoints) {
	  isOK=kFALSE;
	  break;
	}
	if (fitSumW[i]<0.01/*kMinWeight*/){
	  isOK=kFALSE;
	  break;
	}
	if (ifix==1){
	  fittersOut[i]->FixParameter(4,0);
	  fittersOut[i]->FixParameter(5,0);
	  fittersOut[i]->FixParameter(6,0);
	  fittersOutR[i]->FixParameter(4,0);
	  fittersOutR[i]->FixParameter(5,0);
	  fittersOutR[i]->FixParameter(6,0);
	  fittersIn[i]->FixParameter(4,0);
	  fittersIn[i]->FixParameter(5,0);
	  fittersIn[i]->FixParameter(6,0);
	  fittersInR[i]->FixParameter(4,0);
	  fittersInR[i]->FixParameter(5,0);
	  fittersInR[i]->FixParameter(6,0);
	}
	fittersOut[i]->Eval();
	fittersOutR[i]->Eval();
	fittersIn[i]->Eval();
	fittersInR[i]->Eval();
	//
	fitValuesOut[i]=fittersOut[i]->GetParameter(0);
	fitValuesOutR[i]=fittersOutR[i]->GetParameter(0);
	fitValuesIn[i]=fittersIn[i]->GetParameter(0);
	fitValuesInR[i]=fittersInR[i]->GetParameter(0);
	//
	fitValuesOutErr[i]=fittersOut[i]->GetParError(0);
	fitValuesOutChi2[i]=TMath::Sqrt(fittersOut[i]->GetChisquare()/fitSumW[i]);
	fitValuesOutN[i]=fittersOut[i]->GetNpoints();
      }
      if (isOK){
      (*pcstream)<<"smoothLookup"<<
	"ipoint"<<ipoint<<
	"mapID="<<mapID<<
	"ifix="<<ifix<<
	// coordinates
	"x="<<x<<
	"y="<<y<<
	"z="<<z<<
	"phi="<<phi<<
	"r="<<r<<
	"z="<<z<<
	// Input output values
	"drphiInput="<<drphiInput<<       // input lookup tables disotrions
	"drphiOutput="<<drphiOutput<<     // reconstructed lookup tables distortion
	"drInput="<<drInput<<       // input lookup tables disotrions
	"drOutput="<<drOutput<<     // reconstructed lookup tables distortion
	// Smoothed values
	"fitValuesIn.="<<&fitValuesIn<<            // smoothed input values - rphi direction
	"fitValuesInR.="<<&fitValuesInR<<          // smoothed input values - r direction
	"fitValuesOut.="<<&fitValuesOut<<          // smoothed measuured values - rphi
	"fitValuesOutR.="<<&fitValuesOutR<<        // smoothed measuured values -r 
	"fitValuesOutErr.="<<&fitValuesOutErr<<
	"fitValuesOutChi2.="<<&fitValuesOutChi2<<
	"fitValuesOutN.="<<&fitValuesOutN<<
	"fitSumW.="<<&fitSumW<<
	// Kernel sigma
	"sigmaKernelR.="<<&sigmaKernelR<<
	"sigmaKernelRPhi.="<<&sigmaKernelRPhi<<
	"sigmaKernelZ.="<<&sigmaKernelZ<<
	"\n";
      }
    }
    for (Int_t i=0; i<nkernels; i++) {
      delete fittersOut[i];
      delete fittersOutR[i];
      delete fittersIn[i];
      delete fittersInR[i];
    }
  }
  delete pcstream;
  //
  //
  /* 
     TFile *ff = TFile::Open("smoothLookupStudy.root")
     TChain * chain = AliXRDPROOFtoolkit::MakeChain("smooth.list", "smoothLookup", 0,100)

   */
}
void MakeSmoothKernelStudyDraw(Int_t npoints){
  //
  // make figure for kernel smoothing Draw
  //
  // npoints=20000
  TFile *finput = TFile::Open("smoothLookupStudy.root");
  TTree * chain = (TTree*)finput->Get("smoothLookup");  
  chain->SetCacheSize(100000000);
  TH2* hisInputsS[10]={0};
  TH3* hisInputs3D[10]={0};
  TH1* hisSigmaS[10]={0};
  //
  // 1.) Resolution not smoothed make nice plots
  //
  TH2 * his2DBase[10]={0};
  TH1 * hisSigmas[10]={0};
  chain->Draw("10*drphiInput:r>>hisIn(30,85,245,100,-2,2)","","colz");
  his2DBase[0]=(TH2*)chain->GetHistogram()->Clone();
  chain->Draw("10*(drphiOutput-drphiInput):r>>hisOutIn(30,85,245,100,-2,2)","","colz");
  his2DBase[1]=(TH2*)chain->GetHistogram()->Clone();
  his2DBase[0]->FitSlicesY(0,0,-1,0,"QNR",&garrayFit);
  hisSigmas[0] = (TH1*)garrayFit.At(2)->Clone();
  his2DBase[1]->FitSlicesY(0,0,-1,0,"QNR",&garrayFit);
  hisSigmas[1] = (TH1*)garrayFit.At(2)->Clone();
  //
  TCanvas *canvasInOut = new TCanvas("deltaInOut","deltaInOut",600,500);
  for (Int_t i=0; i<2; i++) {
    hisSigmas[i]->SetMinimum(0); 
    hisSigmas[i]->SetMaximum(1.5); 
    hisSigmas[i]->SetMarkerStyle(kMarkers[i]);
    hisSigmas[i]->SetMarkerColor(kColors[i]);
    hisSigmas[i]->GetXaxis()->SetTitle("R (cm)");
    hisSigmas[i]->GetYaxis()->SetTitle("#Delta_{R#phi} (mm)");
    if (i==0) hisSigmas[i]->Draw("");
    hisSigmas[i]->Draw("same");
  }
  TLegend * legend = new TLegend(0.4,0.5,0.89,0.89,"Residual #Delta_{r#phi}");
  legend->SetBorderSize(0);
  legend->AddEntry(hisSigmas[0],"#Delta_{current}-k#Delta_{mean}");
  legend->AddEntry(hisSigmas[1],"(#Delta_{current}-k#Delta_{mean})_{align}-(#Delta_{current}-k#Delta_{mean})");
  legend->Draw();
  canvasInOut->SaveAs("canvasDistortionAlignmentInOut.pdf");
  canvasInOut->SaveAs("canvasDistortionAlignmentInOut.png");
  //
  // 1.b) phi modulation plots
  //
  TCanvas * canvasPhi= new TCanvas("canvasPhi","canvasPhi",800,600);
  canvasPhi->Divide(1,3,0,0);
  gStyle->SetOptTitle(1);
  chain->SetAlias("sector","9*phi/pi");
  {
    chain->SetMarkerStyle(25);
    chain->SetMarkerSize(0.3);
    canvasPhi->cd(1);
    chain->Draw("(drphiOutput-drphiInput):sector","abs((drphiOutput-drphiInput))<0.2&&abs(r-100)<20","",npoints);
    canvasPhi->cd(2);
    chain->Draw("(drphiOutput-drphiInput):sector","abs((drphiOutput-drphiInput))<0.2&&abs(r-160)<25","",npoints);
    canvasPhi->cd(3);
    chain->Draw("(drphiOutput-drphiInput):sector","abs((drphiOutput-drphiInput))<0.2&&abs(r-220)<30","",npoints);
  }
  canvasPhi->SaveAs("canvasDistortionPhiSlice.pdf");

  TCanvas * canvasDistortionSliceHisto= new TCanvas("canvasDistortionSliceHisto","canvasDistortionSliceHisto",800,600);
  canvasDistortionSliceHisto->Divide(1,3,0,0);
  gStyle->SetOptTitle(1);
  chain->SetAlias("sector","9*phi/pi");
  {
    chain->SetMarkerStyle(25);
    chain->SetMarkerSize(0.3);
    canvasDistortionSliceHisto->cd(1);
    chain->Draw("(drphiOutput-drphiInput):sector-int(sector)>>hisSec100(40,0,1,50,-0.2,0.2)","abs((drphiOutput-drphiInput))<0.2&&abs(r-110)<30","colz");
    canvasDistortionSliceHisto->cd(2);
    chain->Draw("(drphiOutput-drphiInput):sector-int(sector)>>hisSec160(40,0,1,50,-0.2,0.2)","abs((drphiOutput-drphiInput))<0.2&&abs(r-160)<25","colz");
    canvasDistortionSliceHisto->cd(3);
    chain->Draw("(drphiOutput-drphiInput):sector-int(sector)>>hisSec2200(40,0,1,50,-0.2,0.2)","abs((drphiOutput-drphiInput))<0.2&&abs(r-220)<30","colz");
  }
  canvasDistortionSliceHisto->SaveAs("canvasDistortionSectorSliceHisto.pdf");


  //
  //
  // 2.) Draw plot resolution as fucntion of the kernel smooth sigma
  //      a.) Smoothed input- input
  //      b.) Smoothed
  TObjArray fitResols(1000);
  const char* varSmooth[4]={"Smoothed(Input,Pol1)-Input","Smoothed(Output,Pol1)-Smoothed(Input,Pol1)","Smoothed(Output,Pol2)-Input","Smoothed(Output,Pol1)-Input"};
  //
  chain->Draw("10*(fitValuesIn.fElements-drphiInput):sqrt(sigmaKernelR.fElements**2+sigmaKernelRPhi.fElements**2+sigmaKernelZ.fElements**2):r>>hisSmoothDiff0(5,83,245, 15,5,40,100,-2.2,2.2)","ifix==1&&fitValuesOutErr.fElements<0.2","goff",npoints);
  hisInputs3D[0]= (TH3*)chain->GetHistogram()->Clone();
  chain->Draw("10*(fitValuesOut.fElements-fitValuesIn.fElements):sqrt(sigmaKernelR.fElements**2+sigmaKernelRPhi.fElements**2+sigmaKernelZ.fElements**2):r>>hisSmoothDiff1(5,83,245, 15,5,40,100,-2.2,2.2)","ifix==1&&fitValuesOutErr.fElements<0.2","goff",npoints);
  hisInputs3D[1]= (TH3*)chain->GetHistogram()->Clone();
  chain->Draw("10*(fitValuesOut.fElements-drphiInput):sqrt(sigmaKernelR.fElements**2+sigmaKernelRPhi.fElements**2+sigmaKernelZ.fElements**2):r>>hisSmoothDiff2(5,83,245, 15,5,40,100,-2.2,2.2)","ifix==0&&fitValuesOutErr.fElements<0.2","goff",npoints);
  hisInputs3D[2]= (TH3*)chain->GetHistogram()->Clone();
  chain->Draw("10*(fitValuesOut.fElements-drphiInput):sqrt(sigmaKernelR.fElements**2+sigmaKernelRPhi.fElements**2+sigmaKernelZ.fElements**2):r>>hisSmoothDiff3(5,83,245, 15,5,40,100,-2.2,2.2)","ifix==1&&fitValuesOutErr.fElements<0.2","goff",npoints);
  hisInputs3D[3]= (TH3*)chain->GetHistogram()->Clone();
  //
  //
  //
  TCanvas *canvasSmooth = new TCanvas("DistortionAlignmentSmooth3D","DistortionAlignmentSmooth3D",800,800);
  canvasSmooth->Divide(2,2,0,0);
  gStyle->SetOptStat(0);  
  for (Int_t itype=0; itype<4; itype++){
    canvasSmooth->cd(itype+1);
    TLegend * legend = new TLegend(0.2,0.7,0.9,0.99,varSmooth[itype]);
    legend->SetBorderSize(0);
    for (Int_t ibin=0; ibin<5; ibin++){
      hisInputs3D[itype]->GetXaxis()->SetRange(ibin+1,ibin+1);
      Double_t radius=hisInputs3D[itype]->GetXaxis()->GetBinCenter(ibin+1);
      TH2 * his2D= (TH2*)hisInputs3D[itype]->Project3D("zy");
      his2D->FitSlicesY(0,0,-1,0,"QNR",&garrayFit);
      delete his2D;
      TH1* his1D = (TH1*)garrayFit.At(2)->Clone();
      fitResols.AddLast(his1D);
      his1D->SetMarkerColor(kColors[ibin%6]);
      his1D->SetMarkerStyle(kMarkers[ibin%6]);
      his1D->SetMinimum(0);
      his1D->SetMaximum(0.75);
      his1D->GetXaxis()->SetTitle("#sigma_{kernel} (cm) in 3D (r,r#phi,z)");
      his1D->GetYaxis()->SetTitle("#sigma_{r#phi} (mm)");
      if (ibin==0) his1D->Draw();
      his1D->Draw("same");
      legend->AddEntry(his1D,TString::Format("R=%2.0f (cm)",radius));
    }
    legend->Draw();
  }
  canvasSmooth->SaveAs("DistortionAlignmentSmooth3D.pdf");
  canvasSmooth->SaveAs("DistortionAlignmentSmooth3D.pdf");



}

void FFTexample(){
  //
  TTreeSRedirector *pcstream = new TTreeSRedirector("localCurrent.root","update");
  //
  TFile *fCurrent = TFile::Open("SpaceChargeFluc10_1.root");
  TFile *fRef = TFile::Open("SpaceChargeFluc0_1.root");
  //  
  AliTPCSpaceCharge3D* distortion = ( AliTPCSpaceCharge3D*)fCurrent->Get("DistRef"); 
  AliTPCSpaceCharge3D* distortionRef = ( AliTPCSpaceCharge3D*)fRef->Get("DistRef"); 

  distortion->AddVisualCorrection(distortion,1);
  distortionRef->AddVisualCorrection(distortionRef,2);
  //
  TF2 f2("f2","AliTPCCorrection::GetCorrXYZ(x,0,y,0,1)-1.07*AliTPCCorrection::GetCorrXYZ(x,0,y,0,2)",85,245,0,250);
  TF2 f2c("f2c","AliTPCCorrection::GetCorrXYZ(x,0,y,0,1)-1.07*AliTPCCorrection::GetCorrXYZ(x,0,y,0,2)+sqrt(12.)*(rndm-0.5)*0.04",85,245,0,250);
  f2.SetNpx(32); f2.SetNpy(32);
  f2c.SetNpx(32); f2c.SetNpy(32);
  f2.Draw("colz");
  f2c.Draw("colz");
  
  TH2D * his2D = (TH2D*)f2.GetHistogram();
  TH2D * his2Dc = (TH2D*)f2c.GetHistogram();
  TH2D * his2DSmooth=new TH2D(*his2Dc);
  Double_t sigma = 3;
  Int_t nx=his2D->GetXaxis()->GetNbins();
  Int_t ny=his2D->GetYaxis()->GetNbins();
  //
  for (Int_t ibin=2; ibin<=nx-1;ibin++){
    for (Int_t jbin=2; jbin<ny-1;jbin++){
      TLinearFitter fitter(4,"hyp3");
      for (Int_t di=-3; di<=3; di++)
	for (Int_t dj=-3; dj<=3; dj++){
	  if (ibin+di<=1) continue;
	  if (jbin+dj<=1) continue;
	  if (ibin+di>=nx) continue;
	  if (jbin+dj>=ny) continue;
	  Double_t x[3]={di,dj,dj*dj};
	  Double_t w = 1./(TMath::Gaus(di/sigma)*TMath::Gaus(dj/sigma));	  
	  Double_t y = his2Dc->GetBinContent(ibin+di,jbin+dj);
	  fitter.AddPoint(x,y,w);
	}
      fitter.Eval();
      printf("%d\t%d\t%3.3f\n",ibin,jbin,10*(fitter.GetParameter(0)-his2Dc->GetBinContent(ibin,jbin)));
      his2DSmooth->SetBinContent(ibin,jbin,fitter.GetParameter(0));
    } 
  }
  TH2D hisDiff=*his2DSmooth;
  hisDiff.Add(his2D,-1);
  

  TH1 * hisMag = his2D->FFT(0,"MAG");
  TH1 * hisMagc = his2Dc->FFT(0,"MAG");
  TH1 * hisPhi = his2D->FFT(0,"PH");
  TH1 * hisPhic = his2Dc->FFT(0,"PH");
  hisMag->Draw("surf2");
  hisMagc->Draw("surf2");

    
}

/*
void MakeFFT(){
  //
  //
  //
  Int_t nSize = 125;
  TVirtualFFT *fft_own = TVirtualFFT::FFT(1, &nSize, "R2C ES K");
  fft_own->SetPoints(normZR->GetMatrixArray());
  fft_own->Transform();

  TH1 *hre = 0, *hco=0;  
  hre = TH1::TransformHisto(fft_own, hre, "RE");
  hco = TH1::TransformHisto(fft_own, hco, "C");


  hr->SetTitle("Real part of the 3rd (array) tranfsorm");
  hr->Draw();
  hr->SetStats(kFALSE);
  hr->GetXaxis()->SetLabelSize(0.05);
  hr->GetYaxis()->SetLabelSize(0.05);
  c1_6->cd();
  TH1 *him = 0;
  him = TH1::TransformHisto(fft_own, him, "IM");
  him->SetTitle("Im. part of the 3rd (array) transform");
  him->Draw();
  him->SetStats(kFALSE);
  him->GetXaxis()->SetLabelSize(0.05);
  him->GetYaxis()->SetLabelSize(0.05);
  //
}
*/
 makeCurrentCorrection.C:1
 makeCurrentCorrection.C:2
 makeCurrentCorrection.C:3
 makeCurrentCorrection.C:4
 makeCurrentCorrection.C:5
 makeCurrentCorrection.C:6
 makeCurrentCorrection.C:7
 makeCurrentCorrection.C:8
 makeCurrentCorrection.C:9
 makeCurrentCorrection.C:10
 makeCurrentCorrection.C:11
 makeCurrentCorrection.C:12
 makeCurrentCorrection.C:13
 makeCurrentCorrection.C:14
 makeCurrentCorrection.C:15
 makeCurrentCorrection.C:16
 makeCurrentCorrection.C:17
 makeCurrentCorrection.C:18
 makeCurrentCorrection.C:19
 makeCurrentCorrection.C:20
 makeCurrentCorrection.C:21
 makeCurrentCorrection.C:22
 makeCurrentCorrection.C:23
 makeCurrentCorrection.C:24
 makeCurrentCorrection.C:25
 makeCurrentCorrection.C:26
 makeCurrentCorrection.C:27
 makeCurrentCorrection.C:28
 makeCurrentCorrection.C:29
 makeCurrentCorrection.C:30
 makeCurrentCorrection.C:31
 makeCurrentCorrection.C:32
 makeCurrentCorrection.C:33
 makeCurrentCorrection.C:34
 makeCurrentCorrection.C:35
 makeCurrentCorrection.C:36
 makeCurrentCorrection.C:37
 makeCurrentCorrection.C:38
 makeCurrentCorrection.C:39
 makeCurrentCorrection.C:40
 makeCurrentCorrection.C:41
 makeCurrentCorrection.C:42
 makeCurrentCorrection.C:43
 makeCurrentCorrection.C:44
 makeCurrentCorrection.C:45
 makeCurrentCorrection.C:46
 makeCurrentCorrection.C:47
 makeCurrentCorrection.C:48
 makeCurrentCorrection.C:49
 makeCurrentCorrection.C:50
 makeCurrentCorrection.C:51
 makeCurrentCorrection.C:52
 makeCurrentCorrection.C:53
 makeCurrentCorrection.C:54
 makeCurrentCorrection.C:55
 makeCurrentCorrection.C:56
 makeCurrentCorrection.C:57
 makeCurrentCorrection.C:58
 makeCurrentCorrection.C:59
 makeCurrentCorrection.C:60
 makeCurrentCorrection.C:61
 makeCurrentCorrection.C:62
 makeCurrentCorrection.C:63
 makeCurrentCorrection.C:64
 makeCurrentCorrection.C:65
 makeCurrentCorrection.C:66
 makeCurrentCorrection.C:67
 makeCurrentCorrection.C:68
 makeCurrentCorrection.C:69
 makeCurrentCorrection.C:70
 makeCurrentCorrection.C:71
 makeCurrentCorrection.C:72
 makeCurrentCorrection.C:73
 makeCurrentCorrection.C:74
 makeCurrentCorrection.C:75
 makeCurrentCorrection.C:76
 makeCurrentCorrection.C:77
 makeCurrentCorrection.C:78
 makeCurrentCorrection.C:79
 makeCurrentCorrection.C:80
 makeCurrentCorrection.C:81
 makeCurrentCorrection.C:82
 makeCurrentCorrection.C:83
 makeCurrentCorrection.C:84
 makeCurrentCorrection.C:85
 makeCurrentCorrection.C:86
 makeCurrentCorrection.C:87
 makeCurrentCorrection.C:88
 makeCurrentCorrection.C:89
 makeCurrentCorrection.C:90
 makeCurrentCorrection.C:91
 makeCurrentCorrection.C:92
 makeCurrentCorrection.C:93
 makeCurrentCorrection.C:94
 makeCurrentCorrection.C:95
 makeCurrentCorrection.C:96
 makeCurrentCorrection.C:97
 makeCurrentCorrection.C:98
 makeCurrentCorrection.C:99
 makeCurrentCorrection.C:100
 makeCurrentCorrection.C:101
 makeCurrentCorrection.C:102
 makeCurrentCorrection.C:103
 makeCurrentCorrection.C:104
 makeCurrentCorrection.C:105
 makeCurrentCorrection.C:106
 makeCurrentCorrection.C:107
 makeCurrentCorrection.C:108
 makeCurrentCorrection.C:109
 makeCurrentCorrection.C:110
 makeCurrentCorrection.C:111
 makeCurrentCorrection.C:112
 makeCurrentCorrection.C:113
 makeCurrentCorrection.C:114
 makeCurrentCorrection.C:115
 makeCurrentCorrection.C:116
 makeCurrentCorrection.C:117
 makeCurrentCorrection.C:118
 makeCurrentCorrection.C:119
 makeCurrentCorrection.C:120
 makeCurrentCorrection.C:121
 makeCurrentCorrection.C:122
 makeCurrentCorrection.C:123
 makeCurrentCorrection.C:124
 makeCurrentCorrection.C:125
 makeCurrentCorrection.C:126
 makeCurrentCorrection.C:127
 makeCurrentCorrection.C:128
 makeCurrentCorrection.C:129
 makeCurrentCorrection.C:130
 makeCurrentCorrection.C:131
 makeCurrentCorrection.C:132
 makeCurrentCorrection.C:133
 makeCurrentCorrection.C:134
 makeCurrentCorrection.C:135
 makeCurrentCorrection.C:136
 makeCurrentCorrection.C:137
 makeCurrentCorrection.C:138
 makeCurrentCorrection.C:139
 makeCurrentCorrection.C:140
 makeCurrentCorrection.C:141
 makeCurrentCorrection.C:142
 makeCurrentCorrection.C:143
 makeCurrentCorrection.C:144
 makeCurrentCorrection.C:145
 makeCurrentCorrection.C:146
 makeCurrentCorrection.C:147
 makeCurrentCorrection.C:148
 makeCurrentCorrection.C:149
 makeCurrentCorrection.C:150
 makeCurrentCorrection.C:151
 makeCurrentCorrection.C:152
 makeCurrentCorrection.C:153
 makeCurrentCorrection.C:154
 makeCurrentCorrection.C:155
 makeCurrentCorrection.C:156
 makeCurrentCorrection.C:157
 makeCurrentCorrection.C:158
 makeCurrentCorrection.C:159
 makeCurrentCorrection.C:160
 makeCurrentCorrection.C:161
 makeCurrentCorrection.C:162
 makeCurrentCorrection.C:163
 makeCurrentCorrection.C:164
 makeCurrentCorrection.C:165
 makeCurrentCorrection.C:166
 makeCurrentCorrection.C:167
 makeCurrentCorrection.C:168
 makeCurrentCorrection.C:169
 makeCurrentCorrection.C:170
 makeCurrentCorrection.C:171
 makeCurrentCorrection.C:172
 makeCurrentCorrection.C:173
 makeCurrentCorrection.C:174
 makeCurrentCorrection.C:175
 makeCurrentCorrection.C:176
 makeCurrentCorrection.C:177
 makeCurrentCorrection.C:178
 makeCurrentCorrection.C:179
 makeCurrentCorrection.C:180
 makeCurrentCorrection.C:181
 makeCurrentCorrection.C:182
 makeCurrentCorrection.C:183
 makeCurrentCorrection.C:184
 makeCurrentCorrection.C:185
 makeCurrentCorrection.C:186
 makeCurrentCorrection.C:187
 makeCurrentCorrection.C:188
 makeCurrentCorrection.C:189
 makeCurrentCorrection.C:190
 makeCurrentCorrection.C:191
 makeCurrentCorrection.C:192
 makeCurrentCorrection.C:193
 makeCurrentCorrection.C:194
 makeCurrentCorrection.C:195
 makeCurrentCorrection.C:196
 makeCurrentCorrection.C:197
 makeCurrentCorrection.C:198
 makeCurrentCorrection.C:199
 makeCurrentCorrection.C:200
 makeCurrentCorrection.C:201
 makeCurrentCorrection.C:202
 makeCurrentCorrection.C:203
 makeCurrentCorrection.C:204
 makeCurrentCorrection.C:205
 makeCurrentCorrection.C:206
 makeCurrentCorrection.C:207
 makeCurrentCorrection.C:208
 makeCurrentCorrection.C:209
 makeCurrentCorrection.C:210
 makeCurrentCorrection.C:211
 makeCurrentCorrection.C:212
 makeCurrentCorrection.C:213
 makeCurrentCorrection.C:214
 makeCurrentCorrection.C:215
 makeCurrentCorrection.C:216
 makeCurrentCorrection.C:217
 makeCurrentCorrection.C:218
 makeCurrentCorrection.C:219
 makeCurrentCorrection.C:220
 makeCurrentCorrection.C:221
 makeCurrentCorrection.C:222
 makeCurrentCorrection.C:223
 makeCurrentCorrection.C:224
 makeCurrentCorrection.C:225
 makeCurrentCorrection.C:226
 makeCurrentCorrection.C:227
 makeCurrentCorrection.C:228
 makeCurrentCorrection.C:229
 makeCurrentCorrection.C:230
 makeCurrentCorrection.C:231
 makeCurrentCorrection.C:232
 makeCurrentCorrection.C:233
 makeCurrentCorrection.C:234
 makeCurrentCorrection.C:235
 makeCurrentCorrection.C:236
 makeCurrentCorrection.C:237
 makeCurrentCorrection.C:238
 makeCurrentCorrection.C:239
 makeCurrentCorrection.C:240
 makeCurrentCorrection.C:241
 makeCurrentCorrection.C:242
 makeCurrentCorrection.C:243
 makeCurrentCorrection.C:244
 makeCurrentCorrection.C:245
 makeCurrentCorrection.C:246
 makeCurrentCorrection.C:247
 makeCurrentCorrection.C:248
 makeCurrentCorrection.C:249
 makeCurrentCorrection.C:250
 makeCurrentCorrection.C:251
 makeCurrentCorrection.C:252
 makeCurrentCorrection.C:253
 makeCurrentCorrection.C:254
 makeCurrentCorrection.C:255
 makeCurrentCorrection.C:256
 makeCurrentCorrection.C:257
 makeCurrentCorrection.C:258
 makeCurrentCorrection.C:259
 makeCurrentCorrection.C:260
 makeCurrentCorrection.C:261
 makeCurrentCorrection.C:262
 makeCurrentCorrection.C:263
 makeCurrentCorrection.C:264
 makeCurrentCorrection.C:265
 makeCurrentCorrection.C:266
 makeCurrentCorrection.C:267
 makeCurrentCorrection.C:268
 makeCurrentCorrection.C:269
 makeCurrentCorrection.C:270
 makeCurrentCorrection.C:271
 makeCurrentCorrection.C:272
 makeCurrentCorrection.C:273
 makeCurrentCorrection.C:274
 makeCurrentCorrection.C:275
 makeCurrentCorrection.C:276
 makeCurrentCorrection.C:277
 makeCurrentCorrection.C:278
 makeCurrentCorrection.C:279
 makeCurrentCorrection.C:280
 makeCurrentCorrection.C:281
 makeCurrentCorrection.C:282
 makeCurrentCorrection.C:283
 makeCurrentCorrection.C:284
 makeCurrentCorrection.C:285
 makeCurrentCorrection.C:286
 makeCurrentCorrection.C:287
 makeCurrentCorrection.C:288
 makeCurrentCorrection.C:289
 makeCurrentCorrection.C:290
 makeCurrentCorrection.C:291
 makeCurrentCorrection.C:292
 makeCurrentCorrection.C:293
 makeCurrentCorrection.C:294
 makeCurrentCorrection.C:295
 makeCurrentCorrection.C:296
 makeCurrentCorrection.C:297
 makeCurrentCorrection.C:298
 makeCurrentCorrection.C:299
 makeCurrentCorrection.C:300
 makeCurrentCorrection.C:301
 makeCurrentCorrection.C:302
 makeCurrentCorrection.C:303
 makeCurrentCorrection.C:304
 makeCurrentCorrection.C:305
 makeCurrentCorrection.C:306
 makeCurrentCorrection.C:307
 makeCurrentCorrection.C:308
 makeCurrentCorrection.C:309
 makeCurrentCorrection.C:310
 makeCurrentCorrection.C:311
 makeCurrentCorrection.C:312
 makeCurrentCorrection.C:313
 makeCurrentCorrection.C:314
 makeCurrentCorrection.C:315
 makeCurrentCorrection.C:316
 makeCurrentCorrection.C:317
 makeCurrentCorrection.C:318
 makeCurrentCorrection.C:319
 makeCurrentCorrection.C:320
 makeCurrentCorrection.C:321
 makeCurrentCorrection.C:322
 makeCurrentCorrection.C:323
 makeCurrentCorrection.C:324
 makeCurrentCorrection.C:325
 makeCurrentCorrection.C:326
 makeCurrentCorrection.C:327
 makeCurrentCorrection.C:328
 makeCurrentCorrection.C:329
 makeCurrentCorrection.C:330
 makeCurrentCorrection.C:331
 makeCurrentCorrection.C:332
 makeCurrentCorrection.C:333
 makeCurrentCorrection.C:334
 makeCurrentCorrection.C:335
 makeCurrentCorrection.C:336
 makeCurrentCorrection.C:337
 makeCurrentCorrection.C:338
 makeCurrentCorrection.C:339
 makeCurrentCorrection.C:340
 makeCurrentCorrection.C:341
 makeCurrentCorrection.C:342
 makeCurrentCorrection.C:343
 makeCurrentCorrection.C:344
 makeCurrentCorrection.C:345
 makeCurrentCorrection.C:346
 makeCurrentCorrection.C:347
 makeCurrentCorrection.C:348
 makeCurrentCorrection.C:349
 makeCurrentCorrection.C:350
 makeCurrentCorrection.C:351
 makeCurrentCorrection.C:352
 makeCurrentCorrection.C:353
 makeCurrentCorrection.C:354
 makeCurrentCorrection.C:355
 makeCurrentCorrection.C:356
 makeCurrentCorrection.C:357
 makeCurrentCorrection.C:358
 makeCurrentCorrection.C:359
 makeCurrentCorrection.C:360
 makeCurrentCorrection.C:361
 makeCurrentCorrection.C:362
 makeCurrentCorrection.C:363
 makeCurrentCorrection.C:364
 makeCurrentCorrection.C:365
 makeCurrentCorrection.C:366
 makeCurrentCorrection.C:367
 makeCurrentCorrection.C:368
 makeCurrentCorrection.C:369
 makeCurrentCorrection.C:370
 makeCurrentCorrection.C:371
 makeCurrentCorrection.C:372
 makeCurrentCorrection.C:373
 makeCurrentCorrection.C:374
 makeCurrentCorrection.C:375
 makeCurrentCorrection.C:376
 makeCurrentCorrection.C:377
 makeCurrentCorrection.C:378
 makeCurrentCorrection.C:379
 makeCurrentCorrection.C:380
 makeCurrentCorrection.C:381
 makeCurrentCorrection.C:382
 makeCurrentCorrection.C:383
 makeCurrentCorrection.C:384
 makeCurrentCorrection.C:385
 makeCurrentCorrection.C:386
 makeCurrentCorrection.C:387
 makeCurrentCorrection.C:388
 makeCurrentCorrection.C:389
 makeCurrentCorrection.C:390
 makeCurrentCorrection.C:391
 makeCurrentCorrection.C:392
 makeCurrentCorrection.C:393
 makeCurrentCorrection.C:394
 makeCurrentCorrection.C:395
 makeCurrentCorrection.C:396
 makeCurrentCorrection.C:397
 makeCurrentCorrection.C:398
 makeCurrentCorrection.C:399
 makeCurrentCorrection.C:400
 makeCurrentCorrection.C:401
 makeCurrentCorrection.C:402
 makeCurrentCorrection.C:403
 makeCurrentCorrection.C:404
 makeCurrentCorrection.C:405
 makeCurrentCorrection.C:406
 makeCurrentCorrection.C:407
 makeCurrentCorrection.C:408
 makeCurrentCorrection.C:409
 makeCurrentCorrection.C:410
 makeCurrentCorrection.C:411
 makeCurrentCorrection.C:412
 makeCurrentCorrection.C:413
 makeCurrentCorrection.C:414
 makeCurrentCorrection.C:415
 makeCurrentCorrection.C:416
 makeCurrentCorrection.C:417
 makeCurrentCorrection.C:418
 makeCurrentCorrection.C:419
 makeCurrentCorrection.C:420
 makeCurrentCorrection.C:421
 makeCurrentCorrection.C:422
 makeCurrentCorrection.C:423
 makeCurrentCorrection.C:424
 makeCurrentCorrection.C:425
 makeCurrentCorrection.C:426
 makeCurrentCorrection.C:427
 makeCurrentCorrection.C:428
 makeCurrentCorrection.C:429
 makeCurrentCorrection.C:430
 makeCurrentCorrection.C:431
 makeCurrentCorrection.C:432
 makeCurrentCorrection.C:433
 makeCurrentCorrection.C:434
 makeCurrentCorrection.C:435
 makeCurrentCorrection.C:436
 makeCurrentCorrection.C:437
 makeCurrentCorrection.C:438
 makeCurrentCorrection.C:439
 makeCurrentCorrection.C:440
 makeCurrentCorrection.C:441
 makeCurrentCorrection.C:442
 makeCurrentCorrection.C:443
 makeCurrentCorrection.C:444
 makeCurrentCorrection.C:445
 makeCurrentCorrection.C:446
 makeCurrentCorrection.C:447
 makeCurrentCorrection.C:448
 makeCurrentCorrection.C:449
 makeCurrentCorrection.C:450
 makeCurrentCorrection.C:451
 makeCurrentCorrection.C:452
 makeCurrentCorrection.C:453
 makeCurrentCorrection.C:454
 makeCurrentCorrection.C:455
 makeCurrentCorrection.C:456
 makeCurrentCorrection.C:457
 makeCurrentCorrection.C:458
 makeCurrentCorrection.C:459
 makeCurrentCorrection.C:460
 makeCurrentCorrection.C:461
 makeCurrentCorrection.C:462
 makeCurrentCorrection.C:463
 makeCurrentCorrection.C:464
 makeCurrentCorrection.C:465
 makeCurrentCorrection.C:466
 makeCurrentCorrection.C:467
 makeCurrentCorrection.C:468
 makeCurrentCorrection.C:469
 makeCurrentCorrection.C:470
 makeCurrentCorrection.C:471
 makeCurrentCorrection.C:472
 makeCurrentCorrection.C:473
 makeCurrentCorrection.C:474
 makeCurrentCorrection.C:475
 makeCurrentCorrection.C:476
 makeCurrentCorrection.C:477
 makeCurrentCorrection.C:478
 makeCurrentCorrection.C:479
 makeCurrentCorrection.C:480
 makeCurrentCorrection.C:481
 makeCurrentCorrection.C:482
 makeCurrentCorrection.C:483
 makeCurrentCorrection.C:484
 makeCurrentCorrection.C:485
 makeCurrentCorrection.C:486
 makeCurrentCorrection.C:487
 makeCurrentCorrection.C:488
 makeCurrentCorrection.C:489
 makeCurrentCorrection.C:490
 makeCurrentCorrection.C:491
 makeCurrentCorrection.C:492
 makeCurrentCorrection.C:493
 makeCurrentCorrection.C:494
 makeCurrentCorrection.C:495
 makeCurrentCorrection.C:496
 makeCurrentCorrection.C:497
 makeCurrentCorrection.C:498
 makeCurrentCorrection.C:499
 makeCurrentCorrection.C:500
 makeCurrentCorrection.C:501
 makeCurrentCorrection.C:502
 makeCurrentCorrection.C:503
 makeCurrentCorrection.C:504
 makeCurrentCorrection.C:505
 makeCurrentCorrection.C:506
 makeCurrentCorrection.C:507
 makeCurrentCorrection.C:508
 makeCurrentCorrection.C:509
 makeCurrentCorrection.C:510
 makeCurrentCorrection.C:511
 makeCurrentCorrection.C:512
 makeCurrentCorrection.C:513
 makeCurrentCorrection.C:514
 makeCurrentCorrection.C:515
 makeCurrentCorrection.C:516
 makeCurrentCorrection.C:517
 makeCurrentCorrection.C:518
 makeCurrentCorrection.C:519
 makeCurrentCorrection.C:520
 makeCurrentCorrection.C:521
 makeCurrentCorrection.C:522
 makeCurrentCorrection.C:523
 makeCurrentCorrection.C:524
 makeCurrentCorrection.C:525
 makeCurrentCorrection.C:526
 makeCurrentCorrection.C:527
 makeCurrentCorrection.C:528
 makeCurrentCorrection.C:529
 makeCurrentCorrection.C:530
 makeCurrentCorrection.C:531
 makeCurrentCorrection.C:532
 makeCurrentCorrection.C:533
 makeCurrentCorrection.C:534
 makeCurrentCorrection.C:535
 makeCurrentCorrection.C:536
 makeCurrentCorrection.C:537
 makeCurrentCorrection.C:538
 makeCurrentCorrection.C:539
 makeCurrentCorrection.C:540
 makeCurrentCorrection.C:541
 makeCurrentCorrection.C:542
 makeCurrentCorrection.C:543
 makeCurrentCorrection.C:544
 makeCurrentCorrection.C:545
 makeCurrentCorrection.C:546
 makeCurrentCorrection.C:547
 makeCurrentCorrection.C:548
 makeCurrentCorrection.C:549
 makeCurrentCorrection.C:550
 makeCurrentCorrection.C:551
 makeCurrentCorrection.C:552
 makeCurrentCorrection.C:553
 makeCurrentCorrection.C:554
 makeCurrentCorrection.C:555
 makeCurrentCorrection.C:556
 makeCurrentCorrection.C:557
 makeCurrentCorrection.C:558
 makeCurrentCorrection.C:559
 makeCurrentCorrection.C:560
 makeCurrentCorrection.C:561
 makeCurrentCorrection.C:562
 makeCurrentCorrection.C:563
 makeCurrentCorrection.C:564
 makeCurrentCorrection.C:565
 makeCurrentCorrection.C:566
 makeCurrentCorrection.C:567
 makeCurrentCorrection.C:568
 makeCurrentCorrection.C:569
 makeCurrentCorrection.C:570
 makeCurrentCorrection.C:571
 makeCurrentCorrection.C:572
 makeCurrentCorrection.C:573
 makeCurrentCorrection.C:574
 makeCurrentCorrection.C:575
 makeCurrentCorrection.C:576
 makeCurrentCorrection.C:577
 makeCurrentCorrection.C:578
 makeCurrentCorrection.C:579
 makeCurrentCorrection.C:580
 makeCurrentCorrection.C:581
 makeCurrentCorrection.C:582
 makeCurrentCorrection.C:583
 makeCurrentCorrection.C:584
 makeCurrentCorrection.C:585
 makeCurrentCorrection.C:586
 makeCurrentCorrection.C:587
 makeCurrentCorrection.C:588
 makeCurrentCorrection.C:589
 makeCurrentCorrection.C:590
 makeCurrentCorrection.C:591
 makeCurrentCorrection.C:592
 makeCurrentCorrection.C:593
 makeCurrentCorrection.C:594
 makeCurrentCorrection.C:595
 makeCurrentCorrection.C:596
 makeCurrentCorrection.C:597
 makeCurrentCorrection.C:598
 makeCurrentCorrection.C:599
 makeCurrentCorrection.C:600
 makeCurrentCorrection.C:601
 makeCurrentCorrection.C:602
 makeCurrentCorrection.C:603
 makeCurrentCorrection.C:604
 makeCurrentCorrection.C:605
 makeCurrentCorrection.C:606
 makeCurrentCorrection.C:607
 makeCurrentCorrection.C:608
 makeCurrentCorrection.C:609
 makeCurrentCorrection.C:610
 makeCurrentCorrection.C:611
 makeCurrentCorrection.C:612
 makeCurrentCorrection.C:613
 makeCurrentCorrection.C:614
 makeCurrentCorrection.C:615
 makeCurrentCorrection.C:616
 makeCurrentCorrection.C:617
 makeCurrentCorrection.C:618
 makeCurrentCorrection.C:619
 makeCurrentCorrection.C:620
 makeCurrentCorrection.C:621
 makeCurrentCorrection.C:622
 makeCurrentCorrection.C:623
 makeCurrentCorrection.C:624
 makeCurrentCorrection.C:625
 makeCurrentCorrection.C:626
 makeCurrentCorrection.C:627
 makeCurrentCorrection.C:628
 makeCurrentCorrection.C:629
 makeCurrentCorrection.C:630
 makeCurrentCorrection.C:631
 makeCurrentCorrection.C:632
 makeCurrentCorrection.C:633
 makeCurrentCorrection.C:634
 makeCurrentCorrection.C:635
 makeCurrentCorrection.C:636
 makeCurrentCorrection.C:637
 makeCurrentCorrection.C:638
 makeCurrentCorrection.C:639
 makeCurrentCorrection.C:640
 makeCurrentCorrection.C:641
 makeCurrentCorrection.C:642
 makeCurrentCorrection.C:643
 makeCurrentCorrection.C:644
 makeCurrentCorrection.C:645
 makeCurrentCorrection.C:646
 makeCurrentCorrection.C:647
 makeCurrentCorrection.C:648
 makeCurrentCorrection.C:649
 makeCurrentCorrection.C:650
 makeCurrentCorrection.C:651
 makeCurrentCorrection.C:652
 makeCurrentCorrection.C:653
 makeCurrentCorrection.C:654
 makeCurrentCorrection.C:655
 makeCurrentCorrection.C:656
 makeCurrentCorrection.C:657
 makeCurrentCorrection.C:658
 makeCurrentCorrection.C:659
 makeCurrentCorrection.C:660
 makeCurrentCorrection.C:661
 makeCurrentCorrection.C:662
 makeCurrentCorrection.C:663
 makeCurrentCorrection.C:664
 makeCurrentCorrection.C:665
 makeCurrentCorrection.C:666
 makeCurrentCorrection.C:667
 makeCurrentCorrection.C:668
 makeCurrentCorrection.C:669
 makeCurrentCorrection.C:670
 makeCurrentCorrection.C:671
 makeCurrentCorrection.C:672
 makeCurrentCorrection.C:673
 makeCurrentCorrection.C:674
 makeCurrentCorrection.C:675
 makeCurrentCorrection.C:676
 makeCurrentCorrection.C:677
 makeCurrentCorrection.C:678
 makeCurrentCorrection.C:679
 makeCurrentCorrection.C:680
 makeCurrentCorrection.C:681
 makeCurrentCorrection.C:682
 makeCurrentCorrection.C:683
 makeCurrentCorrection.C:684
 makeCurrentCorrection.C:685
 makeCurrentCorrection.C:686
 makeCurrentCorrection.C:687
 makeCurrentCorrection.C:688
 makeCurrentCorrection.C:689
 makeCurrentCorrection.C:690
 makeCurrentCorrection.C:691
 makeCurrentCorrection.C:692
 makeCurrentCorrection.C:693
 makeCurrentCorrection.C:694
 makeCurrentCorrection.C:695
 makeCurrentCorrection.C:696
 makeCurrentCorrection.C:697
 makeCurrentCorrection.C:698
 makeCurrentCorrection.C:699
 makeCurrentCorrection.C:700
 makeCurrentCorrection.C:701
 makeCurrentCorrection.C:702
 makeCurrentCorrection.C:703
 makeCurrentCorrection.C:704
 makeCurrentCorrection.C:705
 makeCurrentCorrection.C:706
 makeCurrentCorrection.C:707
 makeCurrentCorrection.C:708
 makeCurrentCorrection.C:709
 makeCurrentCorrection.C:710
 makeCurrentCorrection.C:711
 makeCurrentCorrection.C:712
 makeCurrentCorrection.C:713
 makeCurrentCorrection.C:714
 makeCurrentCorrection.C:715
 makeCurrentCorrection.C:716
 makeCurrentCorrection.C:717
 makeCurrentCorrection.C:718
 makeCurrentCorrection.C:719
 makeCurrentCorrection.C:720
 makeCurrentCorrection.C:721
 makeCurrentCorrection.C:722
 makeCurrentCorrection.C:723
 makeCurrentCorrection.C:724
 makeCurrentCorrection.C:725
 makeCurrentCorrection.C:726
 makeCurrentCorrection.C:727
 makeCurrentCorrection.C:728
 makeCurrentCorrection.C:729
 makeCurrentCorrection.C:730
 makeCurrentCorrection.C:731
 makeCurrentCorrection.C:732
 makeCurrentCorrection.C:733
 makeCurrentCorrection.C:734
 makeCurrentCorrection.C:735
 makeCurrentCorrection.C:736
 makeCurrentCorrection.C:737
 makeCurrentCorrection.C:738
 makeCurrentCorrection.C:739
 makeCurrentCorrection.C:740
 makeCurrentCorrection.C:741
 makeCurrentCorrection.C:742
 makeCurrentCorrection.C:743
 makeCurrentCorrection.C:744
 makeCurrentCorrection.C:745
 makeCurrentCorrection.C:746
 makeCurrentCorrection.C:747
 makeCurrentCorrection.C:748
 makeCurrentCorrection.C:749
 makeCurrentCorrection.C:750
 makeCurrentCorrection.C:751
 makeCurrentCorrection.C:752
 makeCurrentCorrection.C:753
 makeCurrentCorrection.C:754
 makeCurrentCorrection.C:755
 makeCurrentCorrection.C:756
 makeCurrentCorrection.C:757
 makeCurrentCorrection.C:758
 makeCurrentCorrection.C:759
 makeCurrentCorrection.C:760
 makeCurrentCorrection.C:761
 makeCurrentCorrection.C:762
 makeCurrentCorrection.C:763
 makeCurrentCorrection.C:764
 makeCurrentCorrection.C:765
 makeCurrentCorrection.C:766
 makeCurrentCorrection.C:767
 makeCurrentCorrection.C:768
 makeCurrentCorrection.C:769
 makeCurrentCorrection.C:770
 makeCurrentCorrection.C:771
 makeCurrentCorrection.C:772
 makeCurrentCorrection.C:773
 makeCurrentCorrection.C:774
 makeCurrentCorrection.C:775
 makeCurrentCorrection.C:776
 makeCurrentCorrection.C:777
 makeCurrentCorrection.C:778
 makeCurrentCorrection.C:779
 makeCurrentCorrection.C:780
 makeCurrentCorrection.C:781
 makeCurrentCorrection.C:782
 makeCurrentCorrection.C:783
 makeCurrentCorrection.C:784
 makeCurrentCorrection.C:785
 makeCurrentCorrection.C:786
 makeCurrentCorrection.C:787
 makeCurrentCorrection.C:788
 makeCurrentCorrection.C:789
 makeCurrentCorrection.C:790
 makeCurrentCorrection.C:791
 makeCurrentCorrection.C:792
 makeCurrentCorrection.C:793
 makeCurrentCorrection.C:794
 makeCurrentCorrection.C:795
 makeCurrentCorrection.C:796
 makeCurrentCorrection.C:797
 makeCurrentCorrection.C:798
 makeCurrentCorrection.C:799
 makeCurrentCorrection.C:800
 makeCurrentCorrection.C:801
 makeCurrentCorrection.C:802
 makeCurrentCorrection.C:803
 makeCurrentCorrection.C:804
 makeCurrentCorrection.C:805
 makeCurrentCorrection.C:806
 makeCurrentCorrection.C:807
 makeCurrentCorrection.C:808
 makeCurrentCorrection.C:809
 makeCurrentCorrection.C:810
 makeCurrentCorrection.C:811
 makeCurrentCorrection.C:812
 makeCurrentCorrection.C:813
 makeCurrentCorrection.C:814
 makeCurrentCorrection.C:815
 makeCurrentCorrection.C:816
 makeCurrentCorrection.C:817
 makeCurrentCorrection.C:818
 makeCurrentCorrection.C:819
 makeCurrentCorrection.C:820
 makeCurrentCorrection.C:821
 makeCurrentCorrection.C:822