ROOT logo
void PostProcessQAPhi(char* system="pp276",char* name_fin="AnalysisResults.root",char* name_fout="QAphi",char* name_list="RsnHistMini_Phi_PhiNsigma_KTPCnsig30",char* name_hist_base="RsnMini_phi.PhiNsigma_KTPCnsig30"){
  //This macro was written by Anders Knospe (anders.knospe@cern.ch).
  //5 November 2013

  //FOR DETAILED INSTRUCTIONS, SEE THE END OF THIS DOCUMENT.

  //Arguments:
  //system: string giving the collision system ("pp276","pp7", or "PbPb276"), used to figure out what the expected yield should be.  If the system you want is unavailable, you will need to calculate your own expected yield.
  //name_fin: name of input file
  //name_fout: base name of output files (without suffix)
  //name_list: name of the list in fin that contains histograms, may be different depending on the cuts applied to the kaon daughters
  //name_hist_base: base name of the THnSparse histograms, may be different depending on the cuts applied to the kaon daughters

  //This Macro does the following:
  //1.) plots the standard histograms showing the number of events that pass selection of criteria and the number of events in each multiplicity or centrality bin
  //2.) plots invariant-mass histograms (unlike-charge, like-charge, background-subtracted)
  //3.) fits the background-subtracted invariant-mass distribution.  In case there is a problem with the "default" fit, it does multiple fits using different residual backgrounds and fit regions.  All fits are plotted and all fit results are saved.
  //4.) prints out relevant information: pT range, phi yield per event, phi mass, and phi width (taken from the default fit)

  gStyle->SetOptStat(0);

  //----- get input histograms -----

  TFile* fin=TFile::Open(name_fin);//open input file
  if(!fin) return;

  TList* l=(TList*) fin->Get(name_list);
  if(!l){cerr<<"Error in QAphi(): missing input list "<<name_list<<" in file "<<name_fin<<".  Stopping."<<endl; return;}

  TH1D *hevent,*hmult,*hu,*hm,*hp,*hl,*hs,*hs_plot;
  THnSparse *su,*sm,*sp;

  hevent=(TH1D*) l->FindObject("hEventStat");//standard histogram in resonance package, shows number of events after various selections
  if(!hevent){cerr<<"Error in QAphi(): missing input histogram hEventStat in file "<<name_fin<<".  Stopping."<<endl; return;}

  hmult=(TH1D*) l->FindObject("hAEventsVsMulti");//standard histogram in resonance package, shows number of events in each multiplicity (for pp) or centrality (for Pb-Pb) bin
  if(!hmult){cerr<<"Error in QAphi(): missing input histogram hAEventsVsMulti in file "<<name_fin<<".  Stopping."<<endl; return;}
  double nevt=hmult->Integral();

  su=(THnSparse*) l->FindObject(Form("%s_Unlike",name_hist_base));//invariant-mass histogram, unlike-charge
  if(!su){cerr<<"Error in QAphi(): missing input histogram "<<name_hist_base<<"_Unlike in file "<<name_fin<<".  Stopping."<<endl; return;}

  sm=(THnSparse*) l->FindObject(Form("%s_LikeMM",name_hist_base));//invariant-mass histogram, like-charge (K-K-)
  if(!sm){cerr<<"Error in QAphi(): missing input histogram "<<name_hist_base<<"_LikeMM in file "<<name_fin<<".  Stopping."<<endl; return;}

  sp=(THnSparse*) l->FindObject(Form("%s_LikePP",name_hist_base));//invariant-mass histogram, like-charge (K+K+)
  if(!sp){cerr<<"Error in QAphi(): missing input histogram "<<name_hist_base<<"_LikePP in file "<<name_fin<<".  Stopping."<<endl; return;}

  TFile* fout=new TFile(Form("%s.root",name_fout),"RECREATE","HistoFile");//open output file

  bool ptOK=SetPtRange(su);//Was the requested pT range set correctly?
  SetPtRange(sm);
  SetPtRange(sp);

  double dy;
  bool yOK=SetRapidityRange(su,dy);//Is the expected rapidity range (|y|<0.5) being used?  Fill value of dy.
  SetRapidityRange(sm,dy);
  SetRapidityRange(sp,dy);

  //----- plot the event and multiplicity/centrality histograms -----

  TCanvas* c=new TCanvas("c","",10,10,1500,500);
  c->SetFillColor(0);

  TPad* p1=new TPad("p1_0","",0.,0.,1./3,1.);
  p1->SetFillColor(0);

  TPad* p2=new TPad("p2_0","",1./3,0.,2./3,1.);
  p2->SetFillColor(0);

  TPad* p3=new TPad("p3_0","",2./3,0.,1.,1.);
  p3->SetFillColor(0);
  p3->SetLogy();

  p1->cd();
  hevent->SetLineColor(1);
  hevent->Draw();

  p2->cd();
  hmult->SetLineColor(1);
  int j,k,xmax=0;
  for(j=1;j<=hmult->GetNbinsX();j++) if(hmult->GetBinContent(j)>0.) xmax=j;
  xmax=(int) (1.1*xmax);
  if(xmax>hmult->GetNbinsX()) xmax=hmult->GetNbinsX();
  hmult->GetXaxis()->SetRange(1,xmax);
  hmult->Draw();

  p3->cd();
  hmult->Draw();//same as p2, but log scale on y axis

  c->cd();
  p1->Draw();
  p2->Draw();
  p3->Draw();

  c->SaveAs(Form("%s.pdf(",name_fout));

  delete p1;
  delete p2;
  delete p3;
  delete c;

  fout->cd();
  hevent->Write();
  hmult->Write();

  //----- get invariant-mass histograms -----

  //Project the THnSparse histograms onto their x axes.
  hu=(TH1D*) su->Projection(0,"e");
  hu->SetName("mass_unlike");
  hm=(TH1D*) sm->Projection(0,"e");
  hm->SetName("mass_likeMM");
  hp=(TH1D*) sp->Projection(0,"e");
  hp->SetName("mass_likePP");

  double A,UA,B,UB;

  hl=(TH1D*) hm->Clone("mass_like");//total like-charge histogram
  for(j=1;j<=hl->GetNbinsX();j++){
    A=hm->GetBinContent(j);
    B=hp->GetBinContent(j);
    hl->SetBinContent(j,2*sqrt(A*B));//note: 2sqrt(n{K-K-}*n{K+K+})
    hl->SetBinError(j,sqrt(A+B));
  }
  hl->SetTitle("Like-Charge Combinatorial Background");

  hs=(TH1D*) hu->Clone("mass_signal");
  for(j=1;j<=hs->GetNbinsX();j++){
    A=hu->GetBinContent(j); UA=hu->GetBinError(j);
    B=hl->GetBinContent(j); UB=hl->GetBinError(j);
    hs->SetBinContent(j,A-B);//subtract the combinatorial background
    hs->SetBinError(j,sqrt(UA*UA+UB*UB));
  }

  double Imin=1.01,Imax=1.03,dx=hs->GetXaxis()->GetBinWidth(1);

  hb=(TH1D*) hs->Clone("mass_background");//temporary histogram with the peak removed; used to fit the residual background
  for(j=1;j<=hb->GetNbinsX();j++){
    A=hb->GetXaxis()->GetBinCenter(j);
    if(A>Imin && A<Imax){hb->SetBinContent(j,0); hb->SetBinError(j,0);}
  }

  hs_plot=(TH1D*) hs->Clone("mass_signal_plot");//temporary histogram for plotting

  //----- plot the invariant-mass histograms -----

  c=new TCanvas("c","",10,10,1000,500);
  c->SetFillColor(0);

  p1=new TPad("p1_1","",0.,0.,0.5,1.);
  p1->SetFillColor(0);
  p1->SetRightMargin(0.05);

  p2=new TPad("p2_1","",0.5,0.,1.,1.);
  p2->SetFillColor(0);
  p2->SetRightMargin(0.05);

  p1->cd();
  hu->SetLineColor(1); hu->SetMarkerColor(1);
  hl->SetLineColor(2); hl->SetMarkerColor(2);
  hu->SetTitle("Invariant Mass (KK)     ");
  hu->SetXTitle("Invariant Mass (KK) [GeV/#it{c}^{2}]");
  hu->Draw();
  hl->Draw("same");

  TLatex* t1=new TLatex(0.7,0.96,"Unlike-Charge");
  t1->SetTextSize(0.04);
  t1->SetNDC();
  t1->Draw();

  TLatex* t2=new TLatex(0.7,0.91,"Like-Charge");
  t2->SetTextSize(0.04);
  t2->SetNDC();
  t2->SetTextColor(2);
  t2->Draw();

  p2->cd();
  hs->SetLineColor(1); hs->SetMarkerColor(1);
  hs->SetTitle("Combinatorial Background Subtracted");
  hs->SetXTitle("Invariant Mass (KK) [GeV/#it{c}^{2}]");
  hs->Draw();

  c->cd();
  p1->Draw();
  p2->Draw();

  c->SaveAs(Form("%s.pdf",name_fout));

  delete p1;
  delete p2;
  delete c;

  fout->cd();
  hu->Write();
  hl->Write();
  hs->Write();

  //----- fit the signal histogram -----

  c=new TCanvas("c","",10,10,500,500);
  c->SetFillColor(0);

  //fit peak and extract yield, mass, and width
  //The peak is fit using a polynomial for the residual background, plus a Voigtian peak.  A Voigtian peak is the convolution of a (non-relativistic) Breit-Wigner peak and a Gaussian (to describe detector effects).  The resolution (Gaussian sigma) of the Voigtian peak will be fixed.
  //Ideally, we would only need to fit once.  However, the fits are not always stable so we try a variety of fits and record all results.  A similar procedure was followed in the analysis of phi mesons in Pb+Pb collisions (2010 data).

  int jBF;//index controlling the order of the residual background polynomial
  int nBF=3;//number of different orders used for the residual background polynomial; currently 3 (linear, quadratic, cubic)
  int jFR;//index controlling the fit region
  int nFR=4;//number of different fit regions
  double urb;

  //This TH2D is just an array of numbers to hold the different fit results and associated quantities.  The x-axis gives the name of the fit (order of residual background and number of the fit region), the y-axis gives the name of the quantity stored.
  TH2D* r=new TH2D("fit_results","",nBF*nFR,0,nBF*nFR, 16,0,16);
  r->GetYaxis()->SetBinLabel(1,"peak integral");
  r->GetYaxis()->SetBinLabel(2,"mass");
  r->GetYaxis()->SetBinLabel(3,"width");
  r->GetYaxis()->SetBinLabel(4,"resolution (fixed)");
  r->GetYaxis()->SetBinLabel(5,"p0");
  r->GetYaxis()->SetBinLabel(6,"p1");
  r->GetYaxis()->SetBinLabel(7,"p2");
  r->GetYaxis()->SetBinLabel(8,"p3");
  r->GetYaxis()->SetBinLabel(9,"chi2");
  r->GetYaxis()->SetBinLabel(10,"NDF");
  r->GetYaxis()->SetBinLabel(11,"yield (fit)");
  r->GetYaxis()->SetBinLabel(12,"yield/event (fit)");
  r->GetYaxis()->SetBinLabel(13,"peak correction factor");
  r->GetYaxis()->SetBinLabel(14,"yield (bin counting)");
  r->GetYaxis()->SetBinLabel(15,"yield/event (bin conunting)");
  r->GetYaxis()->SetBinLabel(16,"yield/event (bin conunting + tails)");

  TF1 *g[3][4],*gp[3][4],*gb[3][4];
  TFitResultPtr fr;
  int status;
  double pc;

  cerr<<"Please wait a moment while the peak fits are performed."<<endl;

  for(jBF=0;jBF<nBF;jBF++) for(jFR=0;jFR<nFR;jFR++){//loops: change the order of the residual background polynomial and the fit region
      if(!jFR){A=0.995; B=1.06;}//fr0
      else if(jFR==1){A=1.; B=1.06;}//fr1
      else if(jFR==2){A=0.995; B=1.07;}//fr2
      else if(jFR==3){A=1.; B=1.07;}//fr3

      if(!jBF){//pol1
	g[jBF][jFR]=new TF1(Form("fit_pol1_fr%i",jFR),"[0]*TMath::Voigt(x-[1],[3],[2])+[4]+[5]*x",A,B);
	gb[jBF][jFR]=new TF1(Form("fit_back_pol1_fr%i",jFR),"pol1",A,B);
	gp[jBF][jFR]=new TF1(Form("fit_peak_pol1_fr%i",jFR),"[0]*TMath::Voigt(x-[1],[3],[2])",A,B);
      }else if(jBF==1){//pol2
	g[jBF][jFR]=new TF1(Form("fit_pol2_fr%i",jFR),"[0]*TMath::Voigt(x-[1],[3],[2])+[4]+[5]*x+[6]*x*x",A,B);
	gb[jBF][jFR]=new TF1(Form("fit_back_pol2_fr%i",jFR),"pol2",A,B);
	gp[jBF][jFR]=new TF1(Form("fit_peak_pol2_fr%i",jFR),"[0]*TMath::Voigt(x-[1],[3],[2])",A,B);
      }else if(jBF==2){//pol3
	g[jBF][jFR]=new TF1(Form("fit_pol3_fr%i",jFR),"[0]*TMath::Voigt(x-[1],[3],[2])+[4]+[5]*x+[6]*x*x+[7]*x*x*x",A,B);
	gb[jBF][jFR]=new TF1(Form("fit_back_pol3_fr%i",jFR),"pol3",A,B);
	gp[jBF][jFR]=new TF1(Form("fit_peak_pol3_fr%i",jFR),"[0]*TMath::Voigt(x-[1],[3],[2])",A,B);
      }

      for(j=0;j<100;j++){//initial fit of residual background
	fr=hb->Fit(gb[jBF][jFR],"RSQ");
	status=fr->Status();
	if(!status) break;
      }
      urb=gb[jBF][jFR]->IntegralError(Imin,Imax)/dx;//estimated uncertainty of residual background integral

      j=hs->GetXaxis()->FindBin(Imin+1e-5); k=hs->GetXaxis()->FindBin(Imax-1e-5);
      g[jBF][jFR]->SetParameter(0,hs->Integral(j,k)*dx);//initial value of peak integral
      g[jBF][jFR]->SetParameter(1,1.019455); g[jBF][jFR]->FixParameter(1,1.019455);//fix mass to vacuum value
      g[jBF][jFR]->SetParameter(2,0.00426); g[jBF][jFR]->FixParameter(2,0.00426);//fix width to vacuum value
      g[jBF][jFR]->SetParameter(3,0.0011); g[jBF][jFR]->FixParameter(3,0.0011);//fix resolution to 1.1 MeV/c^2 (will not be changed)
      for(j=0;j<=jBF+1;j++){//fix residual background to the initial fit
	A=gb[jBF][jFR]->GetParameter(j);
	g[jBF][jFR]->SetParameter(j+4,A);
	g[jBF][jFR]->SetParError(j+4,gb[jBF][jFR]->GetParError(j));
	g[jBF][jFR]->FixParameter(j+4,A);
      }

      cerr<<"Fitting pol"<<jBF+1<<"_fr"<<jFR<<endl;

      for(j=0;j<100;j++){//fit with only the peak integral free
	fr=hs->Fit(g[jBF][jFR],"RSQ");
	status=fr->Status();
	if(!status) break;
      }

      g[jBF][jFR]->ReleaseParameter(2);//release width parameter
      for(j=0;j<100;j++){
	fr=hs->Fit(g[jBF][jFR],"RSQ");
	status=fr->Status();
	if(!status) break;
      }

      g[jBF][jFR]->ReleaseParameter(1);//release mass parameter
      for(j=0;j<100;j++){
	fr=hs->Fit(g[jBF][jFR],"RSQ");
	status=fr->Status();
	if(!status) break;
      }

      g[jBF][jFR]->ReleaseParameter(4);//release residual background constant parameter
      for(j=0;j<100;j++){
	fr=hs->Fit(g[jBF][jFR],"RSQ");
	status=fr->Status();
	if(!status) break;
      }

      for(j=1;j<=gb[jBF][jFR]->GetNpar();j++) g[jBF][jFR]->ReleaseParameter(4+j);//release other residual background parameters
      for(j=0;j<100;j++){
	fr=hs->Fit(g[jBF][jFR],"RSQ");
	status=fr->Status();
	if(!status) break;
      }

      for(j=0;j<100;j++){//redo fit using "I" option, typically does not affect the result very much, but best to do it anyway.  Comment this out if you are debugging and want to save time.
	fr=hs->Fit(g[jBF][jFR],"RSQI");
	status=fr->Status();
	if(!status) break;
      }

      fout->cd();
      g[jBF][jFR]->Write();//save the combined fit

      for(j=0;j<gb[jBF][jFR]->GetNpar();j++) gb[jBF][jFR]->SetParameter(j,g[jBF][jFR]->GetParameter(j+4));//put the background parameters into the function gb
      for(j=0;j<4;j++) gp[jBF][jFR]->SetParameter(j,g[jBF][jFR]->GetParameter(j));//put the peak parameters into the funciton gp

      j=nFR*jBF+jFR+1;//bin for the x-axis of results histogram
      r->GetXaxis()->SetBinLabel(j,Form("pol%i_fr%i",jBF+1,jFR));
      for(k=0;k<g[jBF][jFR]->GetNpar();k++){//store the values of the peak parameters
	r->SetBinContent(j,k+1,g[jBF][jFR]->GetParameter(k));
	r->SetBinError(j,k+1,g[jBF][jFR]->GetParError(k));
      }
      r->SetBinContent(j,9,g[jBF][jFR]->GetChisquare());//store chi^2
      r->SetBinContent(j,10,g[jBF][jFR]->GetNDF());//store number of degrees of freedom

      A=r->GetBinContent(j,1)-gp[jBF][jFR]->Integral(0.,2*0.493667);//subtract integral of peak below kinematic cutoff
      UA=A*r->GetBinError(j,1)/r->GetBinContent(j,1);
      r->SetBinContent(j,11,A/dx); r->SetBinError(j,11,UA/dx);//peak yield extracted from the fit
      r->SetBinContent(j,12,A/dx/nevt/dy); r->SetBinError(j,12,UA/dx/nevt/dy);//peak yield per event extracted from the fit, corrected for dy

      B=gp[jBF][jFR]->Integral(Imin,Imax);
      pc=B/A;//peak correction factor: the yield in the interval (Imin,Imax) divided by the total integral above the kinematic cutoff, used to correct the yield from bin counting to account for the yield in the tails
      r->SetBinContent(j,13,pc);//store peak correction factor

      A=UA=0;
      for(k=hs->GetXaxis()->FindBin(Imin+1e-5);k<=hs->GetXaxis()->FindBin(Imax-1e-5);k++){//yield from bin counting
	A+=hs->GetBinContent(k);
	UA+=pow(hs->GetBinError(k),2);
      }
      A-=gb[jBF][jFR]->Integral(Imin,Imax)/dx;//subtract residual background integral
      UA+=urb*urb;

      r->SetBinContent(j,14,A); r->SetBinError(j,14,sqrt(UA));//yield from bin counting
      r->SetBinContent(j,15,A/nevt/dy); r->SetBinError(j,15,sqrt(UA)/nevt/dy);//yield per event from bin counting, corrected for dy
      r->SetBinContent(j,16,A/nevt/pc/dy); r->SetBinError(j,16,sqrt(UA)/nevt/pc/dy);//yield per event from bin counting, corrected for dy, corrected to account for yield in tails
    }

  fout->cd();
  r->Write();//save the results histogram in case it is needed later

  delete c;

  //----- plot the fits -----

  c=new TCanvas("c","",10,10,1000,750);
  c->SetFillColor(0);

  p1=new TPad("p1_2","",0,0.5,0.5,1);
  p1->SetFillColor(0);
  p1->SetRightMargin(0.05);

  p2=new TPad("p2_2","",0.5,0.5,1,1);
  p2->SetFillColor(0);
  p2->SetRightMargin(0.05);

  p3=new TPad("p3_2","",0,0,0.5,0.5);
  p3->SetFillColor(0);
  p3->SetRightMargin(0.05);

  TPad* p4=new TPad("p4_2","",0.5,0,1,0.5);
  p4->SetFillColor(0);

  hs_plot->GetXaxis()->SetRangeUser(0.995,1.07-1e-5);
  hs_plot->SetLineColor(1); hs_plot->SetMarkerColor(1);
  hs_plot->SetTitle(hs->GetTitle());
  hs_plot->SetXTitle(hs->GetXaxis()->GetTitle());

  for(jBF=0;jBF<nBF;jBF++) for(jFR=0;jFR<nFR;jFR++){
      //assign styles and colors to the functions
      g[jBF][jFR]->SetNpx(300);
      if(!jFR) g[jBF][jFR]->SetLineColor(2);
      else if(jFR==1) g[jBF][jFR]->SetLineColor(TColor::GetColor("#ffaa00"));
      else if(jFR==2) g[jBF][jFR]->SetLineColor(TColor::GetColor("#238e23"));
      else if(jFR==3) g[jBF][jFR]->SetLineColor(4);
      gb[jBF][jFR]->SetLineColor(g[jBF][jFR]->GetLineColor());
      gb[jBF][jFR]->SetLineStyle(2);
    }

  p1->cd();
  hs_plot->Draw();
  for(jFR=0;jFR<nFR;jFR++) gb[0][jFR]->Draw("same");
  for(jFR=0;jFR<nFR;jFR++) g[0][jFR]->Draw("same");
  t1=new TLatex(0.94,0.87,"linear RB (pol1)"); t1->SetTextAlign(32);
  t1->SetNDC();
  t1->Draw();

  p2->cd();
  hs_plot->Draw();
  for(jFR=0;jFR<nFR;jFR++) gb[1][jFR]->Draw("same");
  for(jFR=0;jFR<nFR;jFR++) g[1][jFR]->Draw("same");
  t2=new TLatex(0.94,0.87,"quadratic RB (pol2)"); t2->SetTextAlign(32);
  t2->SetNDC();
  t2->Draw();

  p3->cd();
  hs_plot->Draw();
  for(jFR=0;jFR<nFR;jFR++) gb[2][jFR]->Draw("same");
  for(jFR=0;jFR<nFR;jFR++) g[2][jFR]->Draw("same");
  TLatex* t3=new TLatex(0.94,0.87,"cubic RB (pol3)"); t3->SetTextAlign(32);
  t3->SetNDC();
  t3->Draw();

  //additional information in pad p4

  p4->cd();
  TLine* dummy1=new TLine(0,0,1,0);
  dummy1->SetLineColor(1); dummy1->SetLineWidth(2);
  TLine* dummy2=new TLine(0,0,1,0);
  dummy2->SetLineColor(1); dummy2->SetLineWidth(2); dummy2->SetLineStyle(gb[0][0]->GetLineStyle());
  TLegend* L=new TLegend(0.3,0.69,0.7,0.99);
  L->SetFillColor(0);
  L->AddEntry(g[0][0],"Fit Region 0 (0.995,1.06)","l");
  L->AddEntry(g[0][1],"Fit Region 1 (1,1.06)","l");
  L->AddEntry(g[0][2],"Fit Region 2 (0.995,1.07)","l");
  L->AddEntry(g[0][3],"Fit Region 3 (1,1.07)","l");
  L->AddEntry(dummy1,"Combined Fit","l");
  L->AddEntry(dummy2,"Residual Background Fit","l");
  L->Draw();

  //----- check results -----

  double ex_yield=0;
  if(!strcmp(system,"pp276")) ex_yield=1.416e-3;
  else if(!strcmp(system,"pp7")) ex_yield=1.706e-3;
  else if(!strcmp(system,"PbPb276")) ex_yield=0.245;
  else{
    cerr<<"Warning in QAphi(): Unknown collision system "<<system<<".  Expected yield not known."<<endl;
    ex_yield=1e10;
  }
  double yield=r->GetBinContent(8,16);
  int status_yield;
  if(yield/ex_yield<1.5 && yield/ex_yield>0.5) status_yield=0;//OK
  else if(yield/ex_yield<5 && yield/ex_yield>0.2) status_yield=1;//problem
  else status_yield=2;//big problem

  double ex_mass=1.019455;
  double mass=r->GetBinContent(8,2);
  int status_mass;
  if(fabs(mass-ex_mass)<1) status_mass=0;//OK
  else if(fabs(mass-ex_mass)<3) status_mass=1;//problem
  else status_mass=2;//big problem

  double ex_width=0.00426;
  double width=r->GetBinContent(8,3);
  int status_width;
  if(fabs(width-ex_width)<1) status_width=0;//OK
  else if(fabs(width-ex_width)<2) status_width=1;//problem
  else status_width=2;//big problem;

  double tx=0.005,ty=0.64,dty=0.06;

  TString s;

  j=su->GetAxis(1)->GetFirst(); k=su->GetAxis(1)->GetLast();
  s.Form("%1.2f < #it{p}_{T} < %1.2f GeV/#it{c}, ",su->GetAxis(1)->GetBinLowEdge(j),su->GetAxis(1)->GetBinLowEdge(k+1));
  j=su->GetAxis(2)->GetFirst(); k=su->GetAxis(2)->GetLast();
  s.Append(Form("%1.2f < #it{y} < %1.2f",su->GetAxis(2)->GetBinLowEdge(j),su->GetAxis(2)->GetBinLowEdge(k+1)));
  if(!ptOK || !yOK) s.Append(" [PROBLEM]");
  TLatex* a1=new TLatex(tx,ty,s.Data());
  SetText(a1,ptOK);
  a1->Draw();

  TLatex* a2=new TLatex(tx,ty-1*dty,Form("#phi Yield/event = %1.5e #pm %1.5e (%s)",r->GetBinContent(8,16),r->GetBinError(8,16),r->GetXaxis()->GetBinLabel(8)));
  SetText(a2,status_yield);
  a2->Draw();

  s.Form("Expected Yield = %1.5e",ex_yield);
  if(status_yield) s.Append(" [PROBLEM]");
  TLatex* a3=new TLatex(tx+0.1,ty-2*dty,s.Data());
  SetText(a3,status_yield);
  a3->Draw();

  TLatex* a4=new TLatex(tx,ty-3*dty,Form("#phi Mass = %1.5f #pm %1.5f GeV/#it{c}^{2}",r->GetBinContent(8,2),r->GetBinError(8,2)));
  SetText(a4,status_mass);
  a4->Draw();

  s.Form("PDG Mass = 1.019455");
  if(status_mass) s.Append(" [PROBLEM]");
  TLatex* a5=new TLatex(tx+0.1,ty-4*dty,s.Data());
  SetText(a5,status_mass);
  a5->Draw();

  TLatex* a6=new TLatex(tx,ty-5*dty,Form("#phi Width = %1.5f #pm %1.5f MeV/#it{c}^{2}",r->GetBinContent(8,3)*1000.,r->GetBinError(8,3)*1000.));
  SetText(a6,status_width);
  a6->Draw();

  s.Form("PDG Width = 4.26");
  if(status_width) s.Append(" [PROBLEM]");
  TLatex* a7=new TLatex(tx+0.1,ty-6*dty,s.Data());
  SetText(a7,status_width);
  a7->Draw();

  if(!ptOK || !yOK || status_yield || status_mass || status_width){
    status=2;
    s.Form("THERE ARE PROBLEMS!!!");
  }else{
    status=0;
    s.Form("Things look OK.");
  }

  TLatex* a8=new TLatex(tx,ty-7*dty,s.Data());
  SetText(a8,status); a8->SetTextSize(0.05);
  a8->Draw();

  if(status) s.Form("PLEASE CHECK THE ERROR MESSAGES.");
  else s.Form("");

  TLatex* a9=new TLatex(tx,ty-8*dty,s.Data());
  SetText(a9,status); a9->SetTextSize(0.05);
  a9->Draw();

  c->cd();
  p1->Draw();
  p2->Draw();
  p3->Draw();
  p4->Draw();

  c->SaveAs(Form("%s.pdf)",name_fout));

  //----- print out results -----

  j=su->GetAxis(1)->GetFirst(); k=su->GetAxis(1)->GetLast();
  printf("%1.2f < pT < %1.2f GeV/c, ",su->GetAxis(1)->GetBinLowEdge(j),su->GetAxis(1)->GetBinLowEdge(k+1));
  j=su->GetAxis(2)->GetFirst(); k=su->GetAxis(2)->GetLast();
  printf("%1.2f < y < %1.2f\n",su->GetAxis(2)->GetBinLowEdge(j),su->GetAxis(2)->GetBinLowEdge(k+1));
  printf("phi Yield/event = %1.5e +/- %1.5e (%s)\n",r->GetBinContent(8,16),r->GetBinError(8,16),r->GetXaxis()->GetBinLabel(8));
  if(status_yield) printf("*** PROBLEM: phi yield too far from expected value (%1.5e).\n",ex_yield);
  printf("phi Mass = %1.5f +/- %1.5f GeV/c^2 (PDG Value = 1.019455)\n",r->GetBinContent(8,2),r->GetBinError(8,2));
  if(status_mass) printf("*** PROBLEM: phi mass too far from expected value.\n");
  printf("phi Width = %1.5f +/- %1.5f MeV/c^2 (PDG Value = 4.26)\n",r->GetBinContent(8,3)*1000.,r->GetBinError(8,3)*1000.);
  if(status_width) printf("*** PROBLEM: phi width too far from expected value.\n");
  if(status) printf("\n*** One or more parameters does not have the expected value.  Please check the error messages and read the instructions at the bottom of the macro file.\n");

  //----- finish -----

  cerr<<"\nMacro has finished successfully."<<endl;

  fin->Close();
  fout->Close();

  return;
}


bool SetPtRange(THnSparse* h){
  TAxis* a=h->GetAxis(1);
  double min=0.5,max=1.5;

  int b1=a->FindBin(1.00001*min);
  int b2=a->FindBin(0.99999*max);
  a->SetRange(b1,b2);
  b1=a->GetFirst();
  b2=a->GetLast();

  //min and/or max are not bin boundaries
  if(fabs(a->GetBinLowEdge(b1)-min)>1e-5*min || fabs(a->GetBinLowEdge(b2+1)-max)>1e-5*max){
    cerr<<"Error in QAphi(): pT range cannot be set to ("<<min<<","<<max<<").  The yield may therefore be different from the expected value."<<endl;
    return false;
  }

  return true;
}

bool SetRapidityRange(THnSparse* h,double& dy){
  TAxis* a=h->GetAxis(2);
  double min=-0.5,max=0.5;

  int b1=a->FindBin(min+1e-5);
  int b2=a->FindBin(max-1e-5);
  a->SetRange(b1,b2);
  b1=a->GetFirst();
  b2=a->GetLast();
  dy=a->GetBinLowEdge(b2+1)-a->GetBinLowEdge(b1);

  //min and/or max are not bin boundaries
  if(fabs(a->GetBinLowEdge(b1)-min)>1e-5 || fabs(a->GetBinLowEdge(b2+1)-max)>1e-5){
    cerr<<"Error in QAphi(): rapidity range cannot be set to |y|<0.5.  Although this macro does correct for the rapidity range dy, using a different rapidity range may cause the yield to be different from the expected value."<<endl;
    return false;
  }

  return true;
}


void SetText(TLatex* t,int flag){
  t->SetTextSize(0.04);
  if(!flag) t->SetTextColor(TColor::GetColor("#238e23"));
  else if(flag==1) t->SetTextColor(TColor::GetColor("#cc5500"));
  else t->SetTextColor(2);
  return;
}


void SetText(TLatex* t,bool flag){
  if(flag) SetText(t,0);
  else SetText(t,2);
  return;
}


/*-----------------------------------------------

INSTRUCTIONS:

*Introduction:

This macro is designed to read the output of the analysis task to check that the yield per event, mass, and width of the phi meson in the production are within acceptable ranges.  The analysis task constructs invariant-mass distributions of charged-kaon pairs in the vicinity of the mass of the phi meson (1.019455 GeV/c^2).  The branching ratio of the phi->K-K+ decay is 0.489.  In this macro, a combinatorial background is constructed using the like-charge distributions (K-K- and K+K+) and subtracted from the unlike-charge (K-K+) distribution.  This leaves a phi peak sitting on top of a residual background.  The background-subtracted distribution is fit with a Voigtian peak (a convolution of a non-relativistic Breit-Wigner peak with a Gaussian to account for detector effects) plus a polynomial to describe the residual background.  Because these fits sometimes fail, a total of 12 fits are performed.  There are 3 choices of residual background polynomial (linear, quadratic, or cubic) and 4 different fit regions (defined in the macro).  For more information on the fitting procedure, see refs. [2] and [3].  The yield, mass, and width of the phi meson extracted from the default fit (quadratic residual background, fit region 3) are compared to the expected values.

*Output:

This macro produces an output PDF file and an output ROOT file.

**Output PDF:

The output PDF consists of three canvases, organized into panels as follows:

Canvas 1: [[1a][1b][1c]]
Canvas 2: [[2a][2b]]
Canvas 3: [[3a][3b]]
          [[3c][3d]]

The contents of the panels is:
1a.) histogram hEventStat (see description below)
1b.) histogram hAEventsVsMulti (see description below)
1c.) histogram hAEventsVsMulti, logarithmic y-axis
2a.) unlike-charge invariant-mass distribution and like-charge combinatorial background
2b.) background-subtracted invariant-mass distribution
3a.) background-subtracted invariant-mass distribution with fits.  The fits shown here assume a linear residual background.  A fit is shown for each of the four different fit regions.  Fit region 3 (blue) is plotted on top.  The dashed lines are the residual background.
3b.) same as 3a, but with a quadratic residual background.  Note that the blue fit in this panel is the default fit, from which the yield, mass, and width are extracted.
3c.) same as 3a, but with a cubic residual background
3d.) a legend describing the fit functions and a printout of information.  The printed information should be green.  If it is not, there is a problem.

**Output ROOT file:

The output ROOT file contains the following:
1.) histogram hEventStat (see description below)
2.) histogram hAEventsVsMulti (see description below)
3.) histogram mass_unlike: the unlike-charge invariant-mass distribution
4.) histogram mass_like: the like-charge combinatorial background
5.) histogram mass_signal: background-subtracted invariant-mass distribution (mass_unlike - mass_like)
6.) functions fit_pol*_fr*: the fit functions for mass_signal.  pol1: linear residual background, pol2: quadratic residual background, pol3: cubic residual background.  fr* indicates the fit region.
7.) histogram fit_results:  contains the results of the different fits (see below)

***Histogram fit_results:

This is an array of numbers (with uncertainties) stored in a TH2D.  The x-axis is the name of the fit (e.g., "pol2_fr3") and the y-axis gives the name of the quantity stored.  The quantities stored (numbered along the y-axis) are:

1.) peak integral: integral of the phi peak in the fit function (parameter [0])
2.) peak mass: parameter [1]
3.) peak width: parameter [2]
4.) peak resolution: parameter [3]: currently fixed to 1.1 MeV/c^2, but stored anyway
5-8.) coefficients of the residual background polynomial (parameters [4] through [7])
9.) fit chi^2
10.) fit number of degrees of freedom
11.) yield extracted from the fit: parameter [0] minus the yield below the kinematic cutoff and corrected for the width of the invariant-mass bins
12.) yield/event (fit): the value above divided by the number of events and the width of the rapidity range (dy)
13.) peak correction factor: the fraction of the peak that lies inside the range (1.01,1.03) GeV/c^2
14.) yield (bin counting): the integral of the mass_signal histogram for (1.01,1.03) minus the integral of the residual background over the same interval
15.) yield/event (bin counting) the value above divided by the number of events and the width of the rapidity range (dy)
16.) yield/event (bin counting + tails) the value above further corrected by dividing by the peak correction factor (now accounting for the yield in the tails)

The default fit is "pol2_fr3".  Quantity 2 is reported as the mass, quantity 3 is reported as the width, and quantity 16 is reported as the yield.  So, to find the default mass (which is printed out) do fit_results->GetBinContent(8,2).  The default width is fit_results->GetBinContent(8,3) and the default yield is fit_results->GetBinContent(8,16).

*More Information:

In the analysis task, the kaons should be selected using track selection cuts and a 3-sigma cut (about the kaon mean) on TPC dE/dx.  See the analysis task for the exact cuts.

The output of the analysis task is expected to contain:
1.) the histogram hEventStat, which gives the number of events that pass different selection criteria
2.) the histogram hAEventsVsMulti, which gives the number of events in each multiplicity (for pp) or centrality (for Pb-Pb) bin
3.) three THnSparse histograms with three dimensions and the suffixes "Unlike", "LikePP", and "LikeMM"

For each THnSparse, axis 0 is the KK invariant mass, axis 1 is the transverse momentum, and axis 2 is the rapidity.  This macro attempts to select the range 0.5<pT<1.5 GeV/c; if this is not possible an error message will be generated, as the expected yields were calculated assuming that pT range.  This macro uses the full rapidity range on axis 2.  The expected yields were calculated assuming a rapidity range of |y|<0.5.  The macro corrects for the width of the rapidity range (dy), but using a different rapidity range may cause the yield to deviate from the expected value.

*Expected Values

**Expected Yields

If the yield is less than 50% or more than 150% of the expected value, it is flagged as an orange problem.  If the yield deviates from the expected value by more than a factor of 5, it is flagged as a red problem.

The expected yields differ depending on the collision system.

pp Collisions at 7 TeV (system="pp7"): The expected yield of 1.706e-3 is computed based on the published (ref. [1]) phi spectrum.  The yield per event for 0.5<pT<1.5 GeV/c is multiplied by the efficiency and the branching ratio.

pp Collisions at 2.76 TeV (system="pp276"): The expected yield of 1.416e-3 is computed by extrapolating from the pp 7 TeV yield, assuming that the phi yield scales as s^0.1 (energy dependence taken from ref. [2]).

Pb-Pb Collisions at 2.76 TeV (system="PbPb276"): The expected yield of 0.245 is computed based on the nearly published (ref. [2]) phi spectrum.

**Expected Mass

The expected phi mass is the PDG value: 1.019455 GeV/c^2.  A deviation from this value of more than 1 MeV/c^2 is flagged as an orange problem.  A deviation from this value of more than 3 MeV/c^2 is flagged as a red problem.

**Expected Width

The expected phi width is the PDG value: 4.26 MeV/c^2.  A deviation from this value of more than 1 MeV/c^2 is flagged as an orange problem.  A deviation from this value of more than 3 MeV/c^2 is flagged as a red problem.

*Troubleshooting

If a parameter does not have the expected value, it will be flagged.  In the output PDF file, a problematic parameter will be colored orange or red, with red indicating a larger deviation from the expected value.

If the yield, mass, or width deviates from the expected value, you should check to see if the default fit is bad.  Look at the blue fit in the upper right plot of the third canvas in the PDF file (panel 3b).  This is the default fit.  Does it describe the data?  Does the residual background (dashed line) appear to be reasonable.  If the default fit looks bad, look through the other fits and see if you can find a fit that looks OK.  You can read out the yield, mass, and width from the fit_results histogram.  Compare these values to the expected values.  It might also make sense to compare the results of all fits to the expected value.  Are the fit parameters always outside the acceptable range?

If the phi yield deviates from the expected value, the following should be noted.  The yield depends on
1.) collision system and energy
2.) the triggers used
3.) multiplicity or centrality range
4.) cuts used to select the decay daughters
5.) pT and rapidity range for phi mesons

The expected yields were calculated for
1.) pp and Pb-Pb collisions at 2.76 TeV, pp collisions at 7 TeV
2.) minimum-bias triggers
3.) all multiplicities for pp, centrality 0-90% for Pb-Pb
4.) the track selection cuts used in the original version of the analysis task
5.) 0.5<pT<1.5 GeV/c and |y|<0.5 for phi mesons

Changes to any of these criteria can cause the yield to change.  If the criteria you are using do not exactly match the criteria for the expected yield, you will need to correct for those differences.  The macro corrects for the rapidity range, so SMALL changes to the rapidity window will be accounted for to some extent.

If the width deviates from the expected value, it is possible that the resolution is not 1.1 MeV/c^2 (the value to which it is currently fixed).  Studying this issue is beyond the scope of these instructions, but you should be aware of the possibility.

*References

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