ROOT logo
#include"TF1.h"
#include"TH1D.h"
#include"TH2F.h"
#include"TMath.h"
#include"TSystem.h"
#include"TCanvas.h"
#include"TFile.h"
#include"TGraphErrors.h"
#include"AliPIDperfContainer.h"
#include"TRandom.h"

Int_t LoadLib();
void doeffPi(Int_t pos=1,Float_t prob=0.1,Float_t etaminkp=-0.8,Float_t etamaxkp=0.8);
TH2F *GetHistoPip(Float_t pt=1,Float_t ptM=1.1,Float_t pMinkp=0,Float_t pMinkn=0.,Float_t etaminkp=-0.8,Float_t etamaxkp=0.8);
TH2F *GetHistoPin(Float_t pt=1,Float_t ptM=1.1,Float_t pMinkn=0,Float_t pMinkp=0.,Float_t etaminkp=-0.8,Float_t etamaxkp=0.8);
void fit(TH1D *h,Float_t *a=NULL,char *opt="",char *opt2="",Float_t pt=1.5);
void AddHisto(TH2F *h1,TH2F *h2,Float_t w);

TObject* fContPid1;
TObject* fContPid2;
const Int_t nBinPid = 14; // pt,eta, ptPip, ptPin, PPip, PPin, TOF3sigmaPip, TOF3sigmaPin, isPhiTrue, nsigmaPip, nsigmaPin
// 0.985 < mass < 1.045 (60) and 0 < centrality < 100 (10)
Int_t binPid[nBinPid] = {1/*ptPhi*/,1/*EtaPi*/,20/*pt+*/,20/*pt-*/,5/*P+*/,5/*P-*/,2/*TOFmatch+*/,2/*TOFmatch-*/,2/*istrue*/,4/*Nsigma+*/,4/*Nsigma-*/,1/*DeltaPhi+*/,1/*DeltaPhi-*/,1/*Psi*/};
Float_t xmin[nBinPid] = {1,-0.8,0.3,0.3,0,0,-0.5,-0.5,-0.5,0,0,-TMath::Pi(),-TMath::Pi(),-TMath::Pi()/2};
Float_t xmax[nBinPid] = {5,0.8,4.3,4.3,1,1,1.5,1.5,1.5,7.5,7.5,TMath::Pi(),TMath::Pi(),TMath::Pi()/2};

TF1 *fsign;
TF1 *fall;
TF1 *fback;

Int_t ifunc=0;

Float_t fitmin = 0.3;
Float_t fitmax = 0.7;

Int_t cmin = 1; // min 1
Int_t cmax = 10;//max 10

Float_t weightS = -1.;

Int_t rebinsize = 1;

Int_t parplotted = 2;

Bool_t isMC = kFALSE; // don't change this (is set automatically)
Bool_t selectTrue = kTRUE; // put it to true to remove background (only for MC)
Bool_t keepTrue = kTRUE; // put it to false to fit only background (only for MC)

Bool_t kGoodMatch = kFALSE; // to check good matching

Bool_t kSigma2vs3 = kFALSE; // to check good matching

Bool_t require5sigma = kFALSE; // don't touch this flag

Bool_t bayesVsigma = kFALSE; // only to do checks

Bool_t kTOFmatch = kFALSE; // for combined PID requires TOF matching

Bool_t kOverAll = kFALSE;
Bool_t kOverAllTOFmatch = kFALSE;
Bool_t kOverAll2Sigma = kFALSE;

Bool_t kPid2Sigma = kFALSE;
Bool_t kPid3Sigma = kFALSE;

TH2F *hmatched;
TH2F *htracked;

Bool_t kLoaded=kFALSE;

Int_t LoadLib(){
  weightS = -1.;

  require5sigma = kFALSE;

  if(! kLoaded){
    gSystem->Load("libVMC.so");
    gSystem->Load("libPhysics.so");
    gSystem->Load("libTree.so");
    gSystem->Load("libMinuit.so");
    gSystem->Load("libSTEERBase.so");
    gSystem->Load("libANALYSIS.so");
    gSystem->Load("libAOD.so");
    gSystem->Load("libESD.so");
    gSystem->Load("libANALYSIS.so");
    gSystem->Load("libANALYSISalice.so");
    gSystem->Load("libCORRFW.so");
    gSystem->Load("libNetx.so");
    gSystem->Load("libPWGPPpid.so");

    TFile *f = new TFile("AnalysisResults.root");
    TList *l = (TList *) f->Get("contK0sBayes1");
    TList *l2 = (TList *) f->Get("contK0sBayes2");

    if(! (l && l2)) return 0;

    fContPid1 = (AliPIDperfContainer *) l->FindObject("contPID");
    fContPid2 = (AliPIDperfContainer *) l->FindObject("contPID2");
    hmatched = (TH2F *) l2->FindObject("hMatchPi"); 
    htracked = (TH2F *) l2->FindObject("hTrackingPi"); 
  }
  kLoaded = kTRUE;

  // check if MC
  Float_t x[] = {xmin[0]+0.001,xmin[1]+0.001,xmin[2]+0.001,xmin[3]+0.001,xmin[4]+0.001,xmin[5]+0.001,xmin[6]+0.001,xmin[7]+0.001,1/*trueMC*/,xmin[9],xmin[10],xmin[11],xmin[12],xmin[13]};
  Float_t x2[] = {xmax[0],xmax[1],xmax[2],xmax[3],xmax[4],xmax[5],xmax[6],xmax[7],xmax[8],xmax[9],xmax[10],xmax[11],xmax[12],xmax[13]};

  AliPIDperfContainer *tmp = (AliPIDperfContainer *) fContPid1;
  TH1D *h = tmp->GetQA(0, x, x2)->ProjectionX("checkMC");

  if(h->GetEntries()) isMC = kTRUE;
  else isMC=kFALSE;

  if(!isMC){
    selectTrue = kFALSE;
    keepTrue = kTRUE;
  }
  else{
    printf("MC truth found!!!!!!\nIt is MC!!!!!!");
  }

  fsign = new TF1("fsign","gaus(0) +0.5*[0]*TMath::Exp(-[3]*TMath::Abs(x-[1]))",fitmin,fitmax);
  fback = new TF1("fback","pol2",fitmin,fitmax);
  fall = new TF1("fall","gaus(0) +0.5*[0]*TMath::Exp(-[3]*TMath::Abs(x-[1])) + pol2(4)",fitmin,fitmax);

  fsign->SetLineColor(2);
  fback->SetLineColor(4);

  if(kSigma2vs3){
    kGoodMatch=kFALSE;
    kOverAll = 0;
  }

  if(bayesVsigma){
    kOverAll = 0;
    kGoodMatch=kFALSE;
    kSigma2vs3=kFALSE;
    kTOFmatch=kTRUE;
    weightS = -0.7;
  }

  return 1;
}

void doeffPi(Int_t pos,Float_t prob,Float_t etaminkp,Float_t etamaxkp){
  LoadLib();
  TH1D *hm = hmatched->ProjectionX("matchingPiEff",cmin,cmax);
  TH1D *ht = htracked->ProjectionX("tracking",cmin,cmax);

  hm->GetYaxis()->SetTitle("TOF matching eff.");
  hm->SetTitle("Using probability as weights");

  hm->Sumw2();
  ht->Sumw2();

  hm->Divide(hm,ht,1,1,"B");

  Int_t nptbin = binPid[2];
  Float_t minptbin = xmin[2];
  Float_t maxptbin = xmax[2];

  if(pos == 0){
    nptbin = binPid[3];
    minptbin = xmin[3];
    maxptbin = xmax[3];
  }

  if(prob > 0.1999|| kPid3Sigma ||kPid2Sigma){
    kGoodMatch = kFALSE;
    kSigma2vs3 = kFALSE;
//    if(! kOverAll) require5sigma = kTRUE;
    if(!isMC) weightS = -0.95;
  }

  TCanvas *c1 = new TCanvas();
  c1->Divide((nptbin+1)/2,2);
  TH2F *hh,*hh2;
  TH1D *h;
  char name[100];
  Float_t b[50][3];

  Double_t xx[50],yy[50];
  Double_t exx[50],eyy[50];

  for(Int_t i=0;i < nptbin;i++){
    c1->cd(i+1);//->SetLogy();
    Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i);
    Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1);

    xx[i] = (ptmin+ptmax)/2;
    exx[i] = (-ptmin+ptmax)/2;

    Float_t pp=0.1;
    if(prob < 0.2) pp = 0.;
    if(pos) hh=GetHistoPip(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp);
    else hh=GetHistoPin(ptmin,ptmax,pp,0.0);
    sprintf(name,"TOF matched: %f < p_{T} < %f GeV/#it{c}",ptmin,ptmax);
    hh->SetTitle(name);
    sprintf(name,"hNoPid%i",i);
    
    pp=prob;
    if(prob < 0.2) pp = 0.1;
    if(pos) hh2=GetHistoPip(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp);
    else hh2=GetHistoPin(ptmin,ptmax,pp,0.0);
    AddHisto(hh,hh2,weightS);

    h = hh->ProjectionX(name,cmin,cmax);
    h->RebinX(rebinsize);
    h->Draw("ERR");
    h->SetMarkerStyle(24);
    b[i][0]=-1;
    Int_t ntrial = 0;
    Float_t chi2 = 10000;
    while(ntrial < 3 && (chi2 > 20 + 1000*selectTrue)){
      fit(h,b[i],"WW","",xx[i]);
      c1->Update();
//       getchar();
      fit(h,b[i],"","",xx[i]);
      ntrial++;
      chi2 = b[i][2];
      printf("chi2 = %f\n",chi2);
      c1->Update();
//       getchar();
      
    }

    yy[i] = fall->GetParameter(parplotted);
    eyy[i] = fall->GetParError(parplotted);
  }

  TGraphErrors *gpar = new TGraphErrors(nptbin,xx,yy,exx,eyy);
  c1->cd(8);
//   gpar->Draw("AP");
  gpar->SetMarkerStyle(20);

  TCanvas *c2 = new TCanvas();
  c2->Divide((nptbin+1)/2,2);
  Float_t b2[50][3];

  for(Int_t i=0;i < nptbin;i++){
    c2->cd(i+1);
    Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i);
    Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1);

    Float_t pp=prob;
    if(prob < 0.2) pp = 0.1;
    if(pos) hh=GetHistoPip(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp);
    else hh=GetHistoPin(ptmin,ptmax,pp,0.0);
    sprintf(name,"P_{TOF} > 0.8: %f < p_{T} < %f GeV/#it{c}",ptmin,ptmax);
    hh->SetTitle(name);
    sprintf(name,"hPid60_%i",i);
    h = hh->ProjectionX(name,cmin,cmax);
    h->RebinX(rebinsize);
    h->Draw("ERR");
    h->SetMarkerStyle(24);
    b2[i][0]=-1;
    Int_t ntrial = 0;
    Float_t chi2 = 10000;
    while(ntrial < 3 && (chi2 > 20 + 1000*selectTrue)){
      fit(h,b2[i],"WW","",xx[i]);
      fit(h,b2[i],"","",xx[i]);
      ntrial++;
      chi2 = b2[i][2];
      printf("chi2 = %f\n",chi2);
    }
    yy[i] = fall->GetParameter(parplotted);
    eyy[i] = fall->GetParError(parplotted);

  }

  TGraphErrors *gpar2 = new TGraphErrors(nptbin,xx,yy,exx,eyy);
  c2->cd(8);
//   gpar2->Draw("AP");
  gpar2->SetMarkerStyle(20);
  
  Double_t xpt[50],expt[50],eff[50],efferr[50];
  for(Int_t i=0;i<nptbin;i++){
    printf("%f +/- %f -  %f +/- %f\n",b[i][0],b[i][1],b2[i][0],b2[i][1]);

    Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i);
    Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1);

    xpt[i] = (ptmin+ptmax)/2;
    expt[i] = (-ptmin+ptmax)/2;
    eff[i] = b2[i][0]/(b[i][0]-b2[i][0]*weightS);

    //    b[i][0] = b[i][0]-b2[i][0]*weightS;

    //    efferr[i] = TMath::Sqrt(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1]));

    efferr[i] = 1./(b[i][0]-b2[i][0]*weightS)/(b[i][0]-b2[i][0]*weightS)*TMath::Sqrt(b[i][0]*b[i][0]*b2[i][1]*b2[i][1] + b2[i][0]*b2[i][0]*b[i][1]*b[i][1]);

    if(TMath::Abs(efferr[i]) > 1)efferr[i]=1;
  }
  new TCanvas();
  TGraphErrors *geff = new TGraphErrors(nptbin,xpt,eff,expt,efferr);
  geff->Draw("AP");

  char flag[100];
  flag[0] = '\0';

  if(isMC){
    if(selectTrue) sprintf(flag,"true");
    else if(!keepTrue) sprintf(flag,"back");
  }

  Bool_t kWriteME = kFALSE;

  char flag2[100];
  flag2[0] = '\0';

  char etarange[100];
  sprintf(etarange,"_%.1f-%.1f_",etaminkp,etamaxkp);

  if(kGoodMatch)
    sprintf(flag2,"GM");

  if(bayesVsigma)
    sprintf(flag2,"BayesVsSigma");

  if(kSigma2vs3)
    sprintf(flag2,"Sigma2vs3");

  if(kOverAll)
    sprintf(flag2,"OverAll");
  if(kOverAllTOFmatch)
    sprintf(flag2,"OverAllTOF");
  if(kOverAll2Sigma)
    sprintf(flag2,"OverAll2sigma");

  if(kPid3Sigma)
    sprintf(flag2,"pid3sigma");
  if(kPid2Sigma)
    sprintf(flag2,"pid2sigma");


  if(pos){
    if(prob >=0.2) sprintf(name,"pionPos%sP%iEff%i_%i%s%s.root",etarange,Int_t(prob*100),(cmin-1)*10,cmax*10,flag,flag2);
    else{
      sprintf(name,"pionPos%sMatchEff%i_%i%s%s.root",etarange,(cmin-1)*10,cmax*10,flag,flag2);
      if(!(kOverAll || bayesVsigma || kGoodMatch || kSigma2vs3)) kWriteME = kTRUE;
    }
  }
  else{
    if(prob >=0.2) sprintf(name,"pionNeg%sP%iEff%i_%i%s%s.root",etarange,Int_t(prob*100),(cmin-1)*10,cmax*10,flag,flag2);
    else sprintf(name,"pionNeg%sMatchEff%i_%i%s%s.root",etarange,(cmin-1)*10,cmax*10,flag,flag2);
  }

  geff->SetTitle("#pi efficiency (from K^{0}_{s});p_{T} (GeV/#it{c};efficiency");
  TFile *fout = new TFile(name,"RECREATE");
  geff->Write();
  if(kWriteME) hm->Write();
  fout->Close();

  if(kWriteME) hm->Draw("SAME");
}

TH2F *GetHistoPip(Float_t pt,Float_t ptM,Float_t pMinkp,Float_t pMinkn,Float_t etaminkp,Float_t etamaxkp){

  Float_t x[] = {xmin[0]+0.001,etaminkp+0.001,pt+0.001,xmin[3]+0.001,pMinkp+0.001,pMinkn+0.001,(pMinkp>0.09 || kPid3Sigma||kPid2Sigma)+0.001,kTOFmatch+0.001,selectTrue,xmin[9],xmin[10],xmin[11],xmin[12],xmin[13]};
  Float_t x2[] = {xmax[0],etamaxkp-0.001,ptM-0.001,xmax[3],xmax[4],xmax[5],xmax[6],xmax[7],keepTrue,xmax[9],xmax[10],xmax[11],xmax[12],xmax[13]};

  if(kOverAll){
    x[6] = 0.0001;
    x2[9] = 5.9;
    if(pMinkp > 0.19) x2[9] = 4.9;
  }

  if(kOverAllTOFmatch && pMinkp > 0.19){
    x[6] = 1.0001;
    x2[9] = 4.9;
  }
  
  if(kOverAll2Sigma && pMinkp > 0.09){
    x2[9] = 2.;
    x[6] = 1.0001;
  }

  if(kGoodMatch){
    x[6] = 1.0001;
    if(pMinkp > 0)
      x2[9] = 4.9;
      
  }

  if(kTOFmatch){
    x[6] = 1.0001;
  }

  if(kSigma2vs3){
    x[6] = 1.0001;
    x2[9] = 3;
    if(pMinkp > 0)
      x2[9] = 2;
  }

  if(bayesVsigma){
    if(pMinkp > 0){
      x[4] = 0.2001;
      x2[9] = 5;
    }
    else{
      x2[9] = 3;
    }

    
  }

  if(require5sigma) x2[9] = 4.9;
  if(kPid3Sigma && pMinkp>0.09) x2[9] = 2.9;
  if(kPid2Sigma && pMinkp>0.09) x2[9] = 1.9;

  printf("max sigma = %f\n",x2[9]);

  AliPIDperfContainer *tmp = (AliPIDperfContainer *) fContPid1;

  TH2F *h = tmp->GetQA(0, x, x2);

  h->GetXaxis()->SetTitle("M_{K^{0}_{s}} (GeV/#it{c}^{2})");
  h->GetYaxis()->SetTitle("centrality [%]");

  return h;
}

TH2F *GetHistoPin(Float_t pt,Float_t ptM,Float_t pMinkn,Float_t pMinkp,Float_t etaminkp,Float_t etamaxkp){

  Float_t x[] = {xmin[0]+0.001,etaminkp+0.001,xmin[2]+0.001,pt+0.001,pMinkp+0.001,pMinkn+0.001,kTOFmatch+0.001,(pMinkn>0.09 || kPid3Sigma|| kPid2Sigma)+0.001,selectTrue,xmin[9],xmin[10],xmin[11],xmin[12],xmin[13]};
  Float_t x2[] = {xmax[0],etamaxkp-0.001,xmax[2],ptM-0.001,xmax[4],xmax[5],xmax[6],xmax[7],keepTrue,xmax[9],xmax[10],xmax[11],xmax[12],xmax[13]};

  if(kOverAll){
    x[7] = 0.0001;
    x2[10] = 5.9;
    if(pMinkn > 0.19) x2[10] = 4.9;
  }

  if(kOverAllTOFmatch && pMinkn > 0.19){
    x[7] = 1.0001;
    x2[10] = 4.9;
  }

  if(kOverAll2Sigma && pMinkn > 0.09){
    x2[10] = 2;
    x[7] = 1.0001;
  }

  if(kGoodMatch){
    x[7] = 1.0001;
    if(pMinkn > 0)
      x2[10] = 4.9;
      
  }

  if(kTOFmatch){
    x[7] = 1.0001;
  }

  if(kSigma2vs3){
    x[7] = 1.0001;
    x2[10] = 3;
    if(pMinkn > 0)
      x2[10] = 2;
  }
 
 if(bayesVsigma){
    if(pMinkn > 0){
      x[5] = 0.2001;
      x2[10] = 5;
    }
    else{
      x2[10] = 3;
    }    
  }

  if(require5sigma) x2[10] = 4.9;

  if(kPid3Sigma && pMinkn>0.09) x2[10] = 2.9;
  if(kPid2Sigma && pMinkn>0.09) x2[10] = 1.9;

  printf("max sigma = %f\n",x2[10]);

  AliPIDperfContainer *tmp = (AliPIDperfContainer *) fContPid2;

  TH2F *h = tmp->GetQA(0, x, x2);

  h->GetXaxis()->SetTitle("M_{K^{0}_{s}} (GeV/#it{c}^{2})");
  h->GetYaxis()->SetTitle("centrality [%]");

  return h;
}

void fit(TH1D *h,Float_t *a,char *opt,char *opt2,Float_t pt){
  if(h->Integral(1,h->GetNbinsX()) < 1){
    if(a){
      a[0]=0.001;
      a[1]=1;
    }
    return;
  }
  

 fall->SetParameter(0,100);
 fall->SetParameter(1,0.4971);
 fall->SetParameter(2,2.89748e-03);
 fall->FixParameter(3,230+30/pt);

 fall->SetParLimits(0,0.00001,1000000);
 fall->SetParLimits(1,0.4965,0.4985);
 fall->SetParLimits(2,0.0025,0.005);
 //fall->SetParLimits(3,200,350);

 fall->ReleaseParameter(4);
 fall->ReleaseParameter(5);

 if(selectTrue){
   fall->FixParameter(4,0);
   fall->FixParameter(5,0);
   fall->FixParameter(6,0);
 }
   fall->FixParameter(6,0);


 char namenew[100];
 sprintf(namenew,"%s_%i",h->GetName(),Int_t(gRandom->Rndm()*10000));
 TH1D *h2 = new TH1D(*h);
 h2->SetName(namenew);

// Float_t entries = h2->GetBinContent(h2->FindBin(0.497));
//  printf("entries under the peak = %f, pt = %f\n",entries,pt);
//  getchar();

 if(pt > 2.5){
   if(pt < 2.8) h2->RebinX(2);
   else if(pt < 3) h2->RebinX(4);
   else h2->RebinX(4);
 }

 h=h2;

 char name[100];
 TF1 *ftmp=fall;

 TF1 *ftmp2=new TF1(*fsign);
 sprintf(name,"fsign%i",ifunc);
 ftmp2->SetName(name);

 TF1 *ftmp3=new TF1(*fback);
 sprintf(name,"ftmp3%i",ifunc);
 ftmp3->SetName(name);

 ifunc++;

 h->Fit(ftmp,opt,opt2,fitmin,fitmax);
 h->Draw("ERR");

 ftmp2->SetParameter(0,ftmp->GetParameter(0));
 ftmp2->SetParameter(1,ftmp->GetParameter(1));
 ftmp2->SetParameter(2,ftmp->GetParameter(2));
 ftmp2->SetParameter(3,ftmp->GetParameter(3));
 ftmp2->Draw("SAME");
 ftmp3->SetParameter(0,ftmp->GetParameter(4));
 ftmp3->SetParameter(1,ftmp->GetParameter(5));
 ftmp3->SetParameter(2,ftmp->GetParameter(6));
 ftmp3->Draw("SAME");

 Float_t mean = ftmp->GetParameter(1);
 Float_t sigma = TMath::Abs(ftmp->GetParameter(2));

 Float_t signI = ftmp2->Integral(mean-10*sigma,mean+10*sigma)/h->GetBinWidth(1);
 Float_t backI = ftmp3->Integral(mean-3*sigma,mean+3*sigma)/h->GetBinWidth(1);

 if(signI < 0) signI = 0;
 if(backI < 1) backI = 1;

 Float_t errI = TMath::Sqrt(ftmp->GetParError(0)*ftmp->GetParError(0)/(0.001+ftmp->GetParameter(0))/(0.001+ftmp->GetParameter(0)));

 printf("signal(5 sigma) = %f +/- %f(fit) +/- %f(stat)\n",signI,errI*signI,TMath::Sqrt(signI));
 printf("backgr(3sigma) = %f\n",backI);
 printf("significance(3 sigma) = %f\n",signI/sqrt(signI+backI));

 if(a){
   a[0]=signI;
   a[1]=signI*errI*signI*errI + signI;
   a[1] = TMath::Sqrt(a[1]);
   if(ftmp->GetNDF()) a[2] = ftmp->GetChisquare()/ftmp->GetNDF();


   if(selectTrue){
     a[0] = h->Integral(1,h->GetNbinsX());
     a[1] = TMath::Sqrt(a[0]);
   }
 }
}

void AddHisto(TH2F *h1,TH2F *h2,Float_t w){
  Int_t nbinx = h1->GetNbinsX();
  Int_t nbiny = h1->GetNbinsY();

  for(Int_t i=1;i<=nbinx;i++){
    for(Int_t j=1;j<=nbiny;j++){
      Double_t val = h1->GetBinContent(i,j) + h2->GetBinContent(i,j)*w;
      Float_t err = TMath::Min(TMath::Sqrt(val),val);
      h1->SetBinContent(i,j,val);
      h1->SetBinError(i,j,err);
    }
  }
}
 doeffPi.C:1
 doeffPi.C:2
 doeffPi.C:3
 doeffPi.C:4
 doeffPi.C:5
 doeffPi.C:6
 doeffPi.C:7
 doeffPi.C:8
 doeffPi.C:9
 doeffPi.C:10
 doeffPi.C:11
 doeffPi.C:12
 doeffPi.C:13
 doeffPi.C:14
 doeffPi.C:15
 doeffPi.C:16
 doeffPi.C:17
 doeffPi.C:18
 doeffPi.C:19
 doeffPi.C:20
 doeffPi.C:21
 doeffPi.C:22
 doeffPi.C:23
 doeffPi.C:24
 doeffPi.C:25
 doeffPi.C:26
 doeffPi.C:27
 doeffPi.C:28
 doeffPi.C:29
 doeffPi.C:30
 doeffPi.C:31
 doeffPi.C:32
 doeffPi.C:33
 doeffPi.C:34
 doeffPi.C:35
 doeffPi.C:36
 doeffPi.C:37
 doeffPi.C:38
 doeffPi.C:39
 doeffPi.C:40
 doeffPi.C:41
 doeffPi.C:42
 doeffPi.C:43
 doeffPi.C:44
 doeffPi.C:45
 doeffPi.C:46
 doeffPi.C:47
 doeffPi.C:48
 doeffPi.C:49
 doeffPi.C:50
 doeffPi.C:51
 doeffPi.C:52
 doeffPi.C:53
 doeffPi.C:54
 doeffPi.C:55
 doeffPi.C:56
 doeffPi.C:57
 doeffPi.C:58
 doeffPi.C:59
 doeffPi.C:60
 doeffPi.C:61
 doeffPi.C:62
 doeffPi.C:63
 doeffPi.C:64
 doeffPi.C:65
 doeffPi.C:66
 doeffPi.C:67
 doeffPi.C:68
 doeffPi.C:69
 doeffPi.C:70
 doeffPi.C:71
 doeffPi.C:72
 doeffPi.C:73
 doeffPi.C:74
 doeffPi.C:75
 doeffPi.C:76
 doeffPi.C:77
 doeffPi.C:78
 doeffPi.C:79
 doeffPi.C:80
 doeffPi.C:81
 doeffPi.C:82
 doeffPi.C:83
 doeffPi.C:84
 doeffPi.C:85
 doeffPi.C:86
 doeffPi.C:87
 doeffPi.C:88
 doeffPi.C:89
 doeffPi.C:90
 doeffPi.C:91
 doeffPi.C:92
 doeffPi.C:93
 doeffPi.C:94
 doeffPi.C:95
 doeffPi.C:96
 doeffPi.C:97
 doeffPi.C:98
 doeffPi.C:99
 doeffPi.C:100
 doeffPi.C:101
 doeffPi.C:102
 doeffPi.C:103
 doeffPi.C:104
 doeffPi.C:105
 doeffPi.C:106
 doeffPi.C:107
 doeffPi.C:108
 doeffPi.C:109
 doeffPi.C:110
 doeffPi.C:111
 doeffPi.C:112
 doeffPi.C:113
 doeffPi.C:114
 doeffPi.C:115
 doeffPi.C:116
 doeffPi.C:117
 doeffPi.C:118
 doeffPi.C:119
 doeffPi.C:120
 doeffPi.C:121
 doeffPi.C:122
 doeffPi.C:123
 doeffPi.C:124
 doeffPi.C:125
 doeffPi.C:126
 doeffPi.C:127
 doeffPi.C:128
 doeffPi.C:129
 doeffPi.C:130
 doeffPi.C:131
 doeffPi.C:132
 doeffPi.C:133
 doeffPi.C:134
 doeffPi.C:135
 doeffPi.C:136
 doeffPi.C:137
 doeffPi.C:138
 doeffPi.C:139
 doeffPi.C:140
 doeffPi.C:141
 doeffPi.C:142
 doeffPi.C:143
 doeffPi.C:144
 doeffPi.C:145
 doeffPi.C:146
 doeffPi.C:147
 doeffPi.C:148
 doeffPi.C:149
 doeffPi.C:150
 doeffPi.C:151
 doeffPi.C:152
 doeffPi.C:153
 doeffPi.C:154
 doeffPi.C:155
 doeffPi.C:156
 doeffPi.C:157
 doeffPi.C:158
 doeffPi.C:159
 doeffPi.C:160
 doeffPi.C:161
 doeffPi.C:162
 doeffPi.C:163
 doeffPi.C:164
 doeffPi.C:165
 doeffPi.C:166
 doeffPi.C:167
 doeffPi.C:168
 doeffPi.C:169
 doeffPi.C:170
 doeffPi.C:171
 doeffPi.C:172
 doeffPi.C:173
 doeffPi.C:174
 doeffPi.C:175
 doeffPi.C:176
 doeffPi.C:177
 doeffPi.C:178
 doeffPi.C:179
 doeffPi.C:180
 doeffPi.C:181
 doeffPi.C:182
 doeffPi.C:183
 doeffPi.C:184
 doeffPi.C:185
 doeffPi.C:186
 doeffPi.C:187
 doeffPi.C:188
 doeffPi.C:189
 doeffPi.C:190
 doeffPi.C:191
 doeffPi.C:192
 doeffPi.C:193
 doeffPi.C:194
 doeffPi.C:195
 doeffPi.C:196
 doeffPi.C:197
 doeffPi.C:198
 doeffPi.C:199
 doeffPi.C:200
 doeffPi.C:201
 doeffPi.C:202
 doeffPi.C:203
 doeffPi.C:204
 doeffPi.C:205
 doeffPi.C:206
 doeffPi.C:207
 doeffPi.C:208
 doeffPi.C:209
 doeffPi.C:210
 doeffPi.C:211
 doeffPi.C:212
 doeffPi.C:213
 doeffPi.C:214
 doeffPi.C:215
 doeffPi.C:216
 doeffPi.C:217
 doeffPi.C:218
 doeffPi.C:219
 doeffPi.C:220
 doeffPi.C:221
 doeffPi.C:222
 doeffPi.C:223
 doeffPi.C:224
 doeffPi.C:225
 doeffPi.C:226
 doeffPi.C:227
 doeffPi.C:228
 doeffPi.C:229
 doeffPi.C:230
 doeffPi.C:231
 doeffPi.C:232
 doeffPi.C:233
 doeffPi.C:234
 doeffPi.C:235
 doeffPi.C:236
 doeffPi.C:237
 doeffPi.C:238
 doeffPi.C:239
 doeffPi.C:240
 doeffPi.C:241
 doeffPi.C:242
 doeffPi.C:243
 doeffPi.C:244
 doeffPi.C:245
 doeffPi.C:246
 doeffPi.C:247
 doeffPi.C:248
 doeffPi.C:249
 doeffPi.C:250
 doeffPi.C:251
 doeffPi.C:252
 doeffPi.C:253
 doeffPi.C:254
 doeffPi.C:255
 doeffPi.C:256
 doeffPi.C:257
 doeffPi.C:258
 doeffPi.C:259
 doeffPi.C:260
 doeffPi.C:261
 doeffPi.C:262
 doeffPi.C:263
 doeffPi.C:264
 doeffPi.C:265
 doeffPi.C:266
 doeffPi.C:267
 doeffPi.C:268
 doeffPi.C:269
 doeffPi.C:270
 doeffPi.C:271
 doeffPi.C:272
 doeffPi.C:273
 doeffPi.C:274
 doeffPi.C:275
 doeffPi.C:276
 doeffPi.C:277
 doeffPi.C:278
 doeffPi.C:279
 doeffPi.C:280
 doeffPi.C:281
 doeffPi.C:282
 doeffPi.C:283
 doeffPi.C:284
 doeffPi.C:285
 doeffPi.C:286
 doeffPi.C:287
 doeffPi.C:288
 doeffPi.C:289
 doeffPi.C:290
 doeffPi.C:291
 doeffPi.C:292
 doeffPi.C:293
 doeffPi.C:294
 doeffPi.C:295
 doeffPi.C:296
 doeffPi.C:297
 doeffPi.C:298
 doeffPi.C:299
 doeffPi.C:300
 doeffPi.C:301
 doeffPi.C:302
 doeffPi.C:303
 doeffPi.C:304
 doeffPi.C:305
 doeffPi.C:306
 doeffPi.C:307
 doeffPi.C:308
 doeffPi.C:309
 doeffPi.C:310
 doeffPi.C:311
 doeffPi.C:312
 doeffPi.C:313
 doeffPi.C:314
 doeffPi.C:315
 doeffPi.C:316
 doeffPi.C:317
 doeffPi.C:318
 doeffPi.C:319
 doeffPi.C:320
 doeffPi.C:321
 doeffPi.C:322
 doeffPi.C:323
 doeffPi.C:324
 doeffPi.C:325
 doeffPi.C:326
 doeffPi.C:327
 doeffPi.C:328
 doeffPi.C:329
 doeffPi.C:330
 doeffPi.C:331
 doeffPi.C:332
 doeffPi.C:333
 doeffPi.C:334
 doeffPi.C:335
 doeffPi.C:336
 doeffPi.C:337
 doeffPi.C:338
 doeffPi.C:339
 doeffPi.C:340
 doeffPi.C:341
 doeffPi.C:342
 doeffPi.C:343
 doeffPi.C:344
 doeffPi.C:345
 doeffPi.C:346
 doeffPi.C:347
 doeffPi.C:348
 doeffPi.C:349
 doeffPi.C:350
 doeffPi.C:351
 doeffPi.C:352
 doeffPi.C:353
 doeffPi.C:354
 doeffPi.C:355
 doeffPi.C:356
 doeffPi.C:357
 doeffPi.C:358
 doeffPi.C:359
 doeffPi.C:360
 doeffPi.C:361
 doeffPi.C:362
 doeffPi.C:363
 doeffPi.C:364
 doeffPi.C:365
 doeffPi.C:366
 doeffPi.C:367
 doeffPi.C:368
 doeffPi.C:369
 doeffPi.C:370
 doeffPi.C:371
 doeffPi.C:372
 doeffPi.C:373
 doeffPi.C:374
 doeffPi.C:375
 doeffPi.C:376
 doeffPi.C:377
 doeffPi.C:378
 doeffPi.C:379
 doeffPi.C:380
 doeffPi.C:381
 doeffPi.C:382
 doeffPi.C:383
 doeffPi.C:384
 doeffPi.C:385
 doeffPi.C:386
 doeffPi.C:387
 doeffPi.C:388
 doeffPi.C:389
 doeffPi.C:390
 doeffPi.C:391
 doeffPi.C:392
 doeffPi.C:393
 doeffPi.C:394
 doeffPi.C:395
 doeffPi.C:396
 doeffPi.C:397
 doeffPi.C:398
 doeffPi.C:399
 doeffPi.C:400
 doeffPi.C:401
 doeffPi.C:402
 doeffPi.C:403
 doeffPi.C:404
 doeffPi.C:405
 doeffPi.C:406
 doeffPi.C:407
 doeffPi.C:408
 doeffPi.C:409
 doeffPi.C:410
 doeffPi.C:411
 doeffPi.C:412
 doeffPi.C:413
 doeffPi.C:414
 doeffPi.C:415
 doeffPi.C:416
 doeffPi.C:417
 doeffPi.C:418
 doeffPi.C:419
 doeffPi.C:420
 doeffPi.C:421
 doeffPi.C:422
 doeffPi.C:423
 doeffPi.C:424
 doeffPi.C:425
 doeffPi.C:426
 doeffPi.C:427
 doeffPi.C:428
 doeffPi.C:429
 doeffPi.C:430
 doeffPi.C:431
 doeffPi.C:432
 doeffPi.C:433
 doeffPi.C:434
 doeffPi.C:435
 doeffPi.C:436
 doeffPi.C:437
 doeffPi.C:438
 doeffPi.C:439
 doeffPi.C:440
 doeffPi.C:441
 doeffPi.C:442
 doeffPi.C:443
 doeffPi.C:444
 doeffPi.C:445
 doeffPi.C:446
 doeffPi.C:447
 doeffPi.C:448
 doeffPi.C:449
 doeffPi.C:450
 doeffPi.C:451
 doeffPi.C:452
 doeffPi.C:453
 doeffPi.C:454
 doeffPi.C:455
 doeffPi.C:456
 doeffPi.C:457
 doeffPi.C:458
 doeffPi.C:459
 doeffPi.C:460
 doeffPi.C:461
 doeffPi.C:462
 doeffPi.C:463
 doeffPi.C:464
 doeffPi.C:465
 doeffPi.C:466
 doeffPi.C:467
 doeffPi.C:468
 doeffPi.C:469
 doeffPi.C:470
 doeffPi.C:471
 doeffPi.C:472
 doeffPi.C:473
 doeffPi.C:474
 doeffPi.C:475
 doeffPi.C:476
 doeffPi.C:477
 doeffPi.C:478
 doeffPi.C:479
 doeffPi.C:480
 doeffPi.C:481
 doeffPi.C:482
 doeffPi.C:483
 doeffPi.C:484
 doeffPi.C:485
 doeffPi.C:486
 doeffPi.C:487
 doeffPi.C:488
 doeffPi.C:489
 doeffPi.C:490
 doeffPi.C:491
 doeffPi.C:492
 doeffPi.C:493
 doeffPi.C:494
 doeffPi.C:495
 doeffPi.C:496
 doeffPi.C:497
 doeffPi.C:498
 doeffPi.C:499
 doeffPi.C:500
 doeffPi.C:501
 doeffPi.C:502
 doeffPi.C:503
 doeffPi.C:504
 doeffPi.C:505
 doeffPi.C:506
 doeffPi.C:507
 doeffPi.C:508
 doeffPi.C:509
 doeffPi.C:510
 doeffPi.C:511
 doeffPi.C:512
 doeffPi.C:513
 doeffPi.C:514
 doeffPi.C:515
 doeffPi.C:516
 doeffPi.C:517
 doeffPi.C:518
 doeffPi.C:519
 doeffPi.C:520
 doeffPi.C:521
 doeffPi.C:522
 doeffPi.C:523
 doeffPi.C:524
 doeffPi.C:525
 doeffPi.C:526
 doeffPi.C:527
 doeffPi.C:528
 doeffPi.C:529
 doeffPi.C:530
 doeffPi.C:531
 doeffPi.C:532
 doeffPi.C:533
 doeffPi.C:534
 doeffPi.C:535
 doeffPi.C:536
 doeffPi.C:537
 doeffPi.C:538
 doeffPi.C:539
 doeffPi.C:540
 doeffPi.C:541
 doeffPi.C:542
 doeffPi.C:543
 doeffPi.C:544
 doeffPi.C:545
 doeffPi.C:546
 doeffPi.C:547
 doeffPi.C:548
 doeffPi.C:549
 doeffPi.C:550
 doeffPi.C:551
 doeffPi.C:552
 doeffPi.C:553
 doeffPi.C:554
 doeffPi.C:555
 doeffPi.C:556
 doeffPi.C:557
 doeffPi.C:558
 doeffPi.C:559
 doeffPi.C:560
 doeffPi.C:561
 doeffPi.C:562
 doeffPi.C:563
 doeffPi.C:564
 doeffPi.C:565
 doeffPi.C:566
 doeffPi.C:567
 doeffPi.C:568
 doeffPi.C:569
 doeffPi.C:570
 doeffPi.C:571
 doeffPi.C:572
 doeffPi.C:573
 doeffPi.C:574
 doeffPi.C:575
 doeffPi.C:576
 doeffPi.C:577
 doeffPi.C:578
 doeffPi.C:579
 doeffPi.C:580
 doeffPi.C:581
 doeffPi.C:582
 doeffPi.C:583
 doeffPi.C:584
 doeffPi.C:585
 doeffPi.C:586
 doeffPi.C:587
 doeffPi.C:588
 doeffPi.C:589
 doeffPi.C:590
 doeffPi.C:591
 doeffPi.C:592
 doeffPi.C:593
 doeffPi.C:594
 doeffPi.C:595
 doeffPi.C:596
 doeffPi.C:597
 doeffPi.C:598
 doeffPi.C:599
 doeffPi.C:600
 doeffPi.C:601
 doeffPi.C:602
 doeffPi.C:603
 doeffPi.C:604
 doeffPi.C:605
 doeffPi.C:606
 doeffPi.C:607