ROOT logo
//------------------------------------------------------------------------------
// Implementation of AliPerformanceMC class. It keeps information from 
// comparison of reconstructed and MC particle tracks. In addtion, 
// it keeps selection cuts used during comparison. The comparison 
// information is stored in the ROOT histograms. Analysis of these 
// histograms can be done by using Analyse() class function. The result of 
// the analysis (histograms/graphs) are stored in the folder which is
// a data member of AliPerformanceMC.
//
// Author: J.Otwinowski 04/02/2008 
//------------------------------------------------------------------------------

/*
 
  // after running comparison task, read the file, and get component
  gROOT->LoadMacro("$ALICE_ROOT/PWGPP/Macros/LoadMyLibs.C");
  LoadMyLibs();

  TFile f("Output.root");
  AliPerformanceMC * compObj = (AliPerformanceMC*)coutput->FindObject("AliPerformanceMC");
 
  // analyse comparison data
  compObj->Analyse();

  // the output histograms/graphs will be stored in the folder "folderRes" 
  compObj->GetAnalysisFolder()->ls("*");

  // user can save whole comparison object (or only folder with anlysed histograms) 
  // in the seperate output file (e.g.)
  TFile fout("Analysed_MC.root","recreate");
  compObj->Write(); // compObj->GetAnalysisFolder()->Write();
  fout.Close();

*/

#include "TCanvas.h"
#include "TH1.h"
#include "TH2.h"
#include "TAxis.h"
#include "TF1.h"

#include "AliPerformanceMC.h" 
#include "AliESDEvent.h" 
#include "AliESDVertex.h"
#include "AliESDtrack.h"
#include "AliESDfriendTrack.h"
#include "AliESDfriend.h"
#include "AliLog.h" 
#include "AliMCEvent.h" 
#include "AliMCParticle.h" 
#include "AliHeader.h" 
#include "AliGenEventHeader.h" 
#include "AliStack.h" 
#include "AliMCInfoCuts.h" 
#include "AliRecInfoCuts.h" 
#include "AliTracker.h" 
#include "AliTreeDraw.h" 
#include "AliTPCseed.h" 

using namespace std;

ClassImp(AliPerformanceMC)

//_____________________________________________________________________________
AliPerformanceMC::AliPerformanceMC(const Char_t* name, const Char_t* title, Int_t analysisMode, Bool_t hptGenerator):
  AliPerformanceObject(name,title),
  fResolHisto(0),
  fPullHisto(0),

  // Cuts 
  fCutsRC(0),  
  fCutsMC(0),  

  // histogram folder 
  fAnalysisFolder(0)
{
  // named constructor	
  // 
  SetAnalysisMode(analysisMode);
  SetHptGenerator(hptGenerator);

  Init();
}

//_____________________________________________________________________________
AliPerformanceMC::~AliPerformanceMC()
{
  // destructor
   
  if(fResolHisto) delete fResolHisto; fResolHisto=0;     
  if(fPullHisto)  delete fPullHisto;  fPullHisto=0;     
  
  if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
}

//_____________________________________________________________________________
void AliPerformanceMC::Init(){

  //
  // histogram bining
  //

  // set pt bins
  Int_t nPtBins = 50;
  Double_t ptMin = 1.e-2, ptMax = 20.;

  Double_t *binsPt = 0;

  if (IsHptGenerator())  { 
        ptMax = 100.;
  } 
   binsPt = CreateLogAxis(nPtBins,ptMin,ptMax);


  Double_t yMin = -0.02, yMax = 0.02;
  Double_t zMin = -12.0, zMax = 12.0;
  if(GetAnalysisMode() == 3) { // TrackRef coordinate system
    yMin = -100.; yMax = 100.; 
    zMin = -100.; zMax = 100.; 
  }

  // res_y:res_z:res_phi,res_lambda:res_pt:y:z:eta:phi:pt
  Int_t binsResolHisto[10]={100,100,100,100,100,25,50,90,30,nPtBins};
  Double_t minResolHisto[10]={-0.2,-0.2,-0.002,-0.002,-0.002, yMin, zMin, 0., -1.5, ptMin};
  Double_t maxResolHisto[10]={ 0.2, 0.2, 0.002, 0.002, 0.002, yMax, zMax, 2.*TMath::Pi(), 1.5, ptMax};

  fResolHisto = new THnSparseF("fResolHisto","res_y:res_z:res_phi:res_lambda:res_pt:y:z:phi:eta:pt",10,binsResolHisto,minResolHisto,maxResolHisto);
  fResolHisto->SetBinEdges(9,binsPt);

  fResolHisto->GetAxis(0)->SetTitle("y-y_{mc} (cm)");
  fResolHisto->GetAxis(1)->SetTitle("z-z_{mc} (cm)");
  fResolHisto->GetAxis(2)->SetTitle("#phi-#phi_{mc} (rad)");
  fResolHisto->GetAxis(3)->SetTitle("#lambda-#lambda_{mc} (rad)");
  fResolHisto->GetAxis(4)->SetTitle("(p_{T}/p_{Tmc}-1)");
  fResolHisto->GetAxis(5)->SetTitle("y_{mc} (cm)");
  fResolHisto->GetAxis(6)->SetTitle("z_{mc} (cm)");
  fResolHisto->GetAxis(7)->SetTitle("#phi_{mc} (rad)");
  fResolHisto->GetAxis(8)->SetTitle("#eta_{mc}");
  fResolHisto->GetAxis(9)->SetTitle("p_{Tmc} (GeV/c)");
  fResolHisto->Sumw2();

  //pull_y:pull_z:pull_snp:pull_tgl:pull_1pt:y:z:snp:tgl:1pt
  Int_t binsPullHisto[10]={100,100,100,100,100,50,50,50,50,nPtBins};
  Double_t minPullHisto[10]={-5.,-5.,-5.,-5.,-5., yMin, zMin,-1., -2.0, ptMin};
  Double_t maxPullHisto[10]={ 5., 5., 5., 5., 5., yMax, zMax, 1., 2.0, ptMax};
  fPullHisto = new THnSparseF("fPullHisto","pull_y:pull_z:pull_y:pull_z:pull_snp:pull_tgl:pull_1pt:y:z:snp:tgl:1pt",10,binsPullHisto,minPullHisto,maxPullHisto);

  fPullHisto->GetAxis(0)->SetTitle("(y-y_{mc})/#sigma");
  fPullHisto->GetAxis(1)->SetTitle("(z-z_{mc})/#sigma");
  fPullHisto->GetAxis(2)->SetTitle("(sin#phi-sin#phi_{mc})/#sigma");
  fPullHisto->GetAxis(3)->SetTitle("(tan#lambda-tan#lambda_{mc})/#sigma");
  fPullHisto->GetAxis(4)->SetTitle("(p_{Tmc}/p_{T}-1)/#sigma");
  fPullHisto->GetAxis(5)->SetTitle("y_{mc} (cm)");
  fPullHisto->GetAxis(6)->SetTitle("z_{mc} (cm)");
  fPullHisto->GetAxis(7)->SetTitle("sin#phi_{mc}");
  fPullHisto->GetAxis(8)->SetTitle("tan#lambda_{mc}");
  fPullHisto->GetAxis(9)->SetTitle("1/p_{Tmc} (GeV/c)^{-1}");
  fPullHisto->Sumw2();

  // Init cuts 
  if(!fCutsMC) 
    AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
  if(!fCutsRC) 
    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");

  // init folder
  fAnalysisFolder = CreateFolder("folderMC","Analysis MC Folder");
}

//_____________________________________________________________________________
void AliPerformanceMC::Exec(AliMCEvent* const mcEvent, AliESDEvent *const /*esdEvent*/, AliESDfriend *const /*esdFriend*/, const Bool_t bUseMC, const Bool_t /*bUseESDfriend*/)
{
  // Process pure MC information 
  //
  AliHeader* header = 0;
  AliGenEventHeader* genHeader = 0;
  AliStack* stack = 0;
  TArrayF vtxMC(3);
  
  if(bUseMC)
  {
    if(!mcEvent) {
      Error("Exec","mcEvent not available");
      return;
    }
    // get MC event header
    header = mcEvent->Header();
    if (!header) {
      Error("Exec","Header not available");
      return;
    }
    // MC particle stack
    stack = mcEvent->Stack();
    if (!stack) {
      Error("Exec","Stack not available");
      return;
    }
    // get MC vertex
    genHeader = header->GenEventHeader();
    if (!genHeader) {
      Error("Exec","Could not retrieve genHeader from Header");
      return;
    }
    genHeader->PrimaryVertex(vtxMC);
  } 
  else {
    Error("Exec","MC information required!");
    return;
  }
  
  Int_t nPart = mcEvent->GetNumberOfTracks();
  if (nPart==0) return;

  //TParticle * part = new TParticle;
  //TClonesArray * trefs = new TClonesArray("AliTrackReference");
  TParticle *part=0;
  TClonesArray *trefs=0;

  //  Process events
  for (Int_t iPart = 0; iPart < nPart; iPart++) 
  { 
    Int_t status = mcEvent->GetParticleAndTR(iPart, part, trefs);
    if (status<0) continue;
    if(!part) continue;
    if(!trefs) continue;

    AliMCParticle *mcParticle = (AliMCParticle*) mcEvent->GetTrack(iPart);
    if(!mcParticle) continue;

    TParticle *particle = mcParticle->Particle();
    if(!particle) continue;

    Bool_t prim = stack->IsPhysicalPrimary(iPart);

    // Only 5 charged particle species (e,mu,pi,K,p)
    if (fCutsMC->IsPdgParticle(TMath::Abs(particle->GetPdgCode())) == kFALSE) break;

    // exclude electrons
    if (fCutsMC->GetEP()==TMath::Abs(particle->GetPdgCode())) return;

    AliTrackReference *refTPCIn = 0;
    AliTrackReference *refTPCOut = 0;
    AliTrackReference *refITSIn = 0;
    AliTrackReference *refITSOut = 0;
    AliTrackReference *refTRDIn = 0;
    AliTrackReference *refTRDOut = 0;

    Float_t rmax = 0.;
    Int_t nTrackRef = mcParticle->GetNumberOfTrackReferences();
    if(nTrackRef < 5) continue;

    for (Int_t iref = 0; iref < nTrackRef; iref++) 
    {
      AliTrackReference *ref = mcParticle->GetTrackReference(iref);
      if(!ref) continue;

      Float_t dir = ref->X()*ref->Px()+ref->Y()*ref->Py();
      if(dir < 0.) break; // looping tracks (return back)
      if (ref->R()<rmax) break;

      // pt threshold
      if(ref->Pt() < fCutsRC->GetPtMin()) break;

      // TPC
      if(ref->DetectorId()==AliTrackReference::kTPC)
      {
	if(!refTPCIn) {
	  refTPCIn = ref;
	}
	else {
          if(ref->R() > refTPCIn->R())
	  refTPCOut = ref;
	}
      }
      // ITS
      if(ref->DetectorId()==AliTrackReference::kITS)
      {
	if(!refITSIn) {
	  refITSIn = ref;
	}
	else {
          if(ref->R() > refITSIn->R())
	  refITSOut = ref;
	}
      }
      // TRD
      if(ref->DetectorId()==AliTrackReference::kTRD)
      {
	if(!refTRDIn) {
	  refTRDIn = ref;
	}
	else {
          if(ref->R() > refTRDIn->R())
	  refTRDOut = ref;
	}
      }
      if (ref->R()>rmax) rmax=ref->R();
    }

    if(GetAnalysisMode() == 0) {
      // Propagate refTPCIn to DCA to prim. vertex and make comparison
      // only primary particles
      if(refTPCIn) { 
        if(prim) ProcessTPC(refTPCIn,particle); 
      }
    }

    if(GetAnalysisMode() == 3) {
      // Propagate refTPCOut to refTPCIn using AliTrack::PropagateTrackToBxByBz()
      //
      if(refTPCIn && refTPCOut) 
        ProcessInnerTPC(refTPCIn,refTPCOut,particle); 
    }

    if(GetAnalysisMode() == 4) { 
      // propagate refTPCIn to refTPCOut using AliExternalTrackParam::PropagateToBxByBz()
      ProcessOuterTPCExt(part,trefs); 
    }
  }

  //if(part) delete part;
  //if(trefs) delete trefs;
}

//_____________________________________________________________________________
void AliPerformanceMC::ProcessTPC(AliTrackReference* const refIn, TParticle *const particle) {
  //
  // Test propagation from refIn to DCA
  //
  if(!refIn) return;
  if(!particle) return;

  AliExternalTrackParam *track = 0;
  Double_t radius = 2.8; // cm
  Double_t mass = particle->GetMass();
  Double_t step=1;
  //
  track=MakeTrack(refIn,particle);
  if (!track) return;
  //
  //AliTracker::PropagateTrackTo(track, radius+step, mass, step, kTRUE,0.99);
  //AliTracker::PropagateTrackTo(track, radius+0.5, mass, step*0.1, kTRUE,0.99);
  AliTracker::PropagateTrackToBxByBz(track, radius+step, mass, step, kTRUE,0.99);
  AliTracker::PropagateTrackToBxByBz(track, radius+0.5, mass, step*0.1, kTRUE,0.99);
  Double_t xyz[3] = {particle->Vx(),particle->Vy(),particle->Vz()};
  Double_t sxyz[3]={0.0,0.0,0.0};
  AliESDVertex vertex(xyz,sxyz);
  Double_t dca[2], cov[3];
  //Bool_t isOK = track->PropagateToDCA(&vertex,AliTracker::GetBz(),10,dca,cov);
  Double_t field[3];  track->GetBxByBz(field); 
  Bool_t isOK = track->PropagateToDCABxByBz(&vertex,field,10,dca,cov);
  if(!isOK) return;

  // Fill histogram
  Float_t deltaPtTPC, deltaYTPC, deltaZTPC, deltaPhiTPC, deltaLambdaTPC; 
  Float_t pull1PtTPC, pullYTPC, pullZTPC, pullPhiTPC, pullLambdaTPC; 

  Float_t mceta =  particle->Eta();
  Float_t mcphi =  particle->Phi();
  if(mcphi<0) mcphi += 2.*TMath::Pi();
  Float_t mcpt = particle->Pt();
  Float_t mcsnp = TMath::Sin(TMath::ATan2(particle->Py(),particle->Px()));
  Float_t mctgl = TMath::Tan(TMath::ATan2(particle->Pz(),particle->Pt()));

  //if(TMath::Abs(dca[0])<fCutsRC->GetMaxDCAToVertexXY() && TMath::Abs(dca[1])<fCutsRC->GetMaxDCAToVertexZ()) 
  //{ 
    if(mcpt == 0) return;
    
    //deltaYTPC= track->GetY()-particle->Vy();
    deltaYTPC= track->GetY(); // it is already rotated
    deltaZTPC = track->GetZ()-particle->Vz();
    deltaLambdaTPC = TMath::ATan2(track->Pz(),track->Pt())-TMath::ATan2(particle->Pz(),particle->Pt());
    deltaPhiTPC = TMath::ATan2(track->Py(),track->Px())-TMath::ATan2(particle->Py(),particle->Px());
    deltaPtTPC = (track->Pt()-mcpt) / mcpt;

    /*
    printf("------------------------------ \n");
    printf("trY %f, trZ %f, trTheta %f ,trPhi %f, trPt %f \n", track->GetY(), track->GetZ(), TMath::ATan2(track->Pz(),track->Pt()), TMath::ATan2(track->Py(),track->Px()), track->Pt() ); 
    printf("partY %f, partZ %f, partTheta %f ,partPhi %f, partPt %f \n", particle->Vy(), particle->Vz(), TMath::ATan2(particle->Pz(),particle->Pt()), TMath::ATan2(particle->Py(),particle->Px()), mcpt ); 
    */


    pullYTPC= (track->GetY()-particle->Vy()) / TMath::Sqrt(track->GetSigmaY2());
    pullZTPC = (track->GetZ()-particle->Vz()) / TMath::Sqrt(track->GetSigmaZ2());
 
    pullPhiTPC = (track->GetSnp() - mcsnp) / TMath::Sqrt(track->GetSigmaSnp2());
    pullLambdaTPC = (track->GetTgl() - mctgl) / TMath::Sqrt(track->GetSigmaTgl2());

    if (mcpt) pull1PtTPC = (track->OneOverPt()-1./mcpt) / TMath::Sqrt(track->GetSigma1Pt2());
    else pull1PtTPC = 0.;

    Double_t vResolHisto[10] = {deltaYTPC,deltaZTPC,deltaPhiTPC,deltaLambdaTPC,deltaPtTPC,particle->Vy(),particle->Vz(),mcphi,mceta,mcpt};
    fResolHisto->Fill(vResolHisto);

    Double_t vPullHisto[10] = {pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,particle->Vy(),particle->Vz(),mcsnp,mctgl,1./mcpt};
    fPullHisto->Fill(vPullHisto);
  //}
  if(track) delete track;
}

//_____________________________________________________________________________
void AliPerformanceMC::ProcessInnerTPC(AliTrackReference* const refIn,  AliTrackReference *const  refOut, TParticle *const particle) {
  //
  // Test propagation from Out to In
  //
  if(!refIn) return;
  if(!refOut) return;
  if(!particle) return;

  AliExternalTrackParam *track=MakeTrack(refOut,particle);
  if (!track) return;

  Double_t mass = particle->GetMass();
  Double_t step=1;

  Float_t alphaIn= TMath::ATan2(refIn->Y(),refIn->X());
  //Float_t alphaOut= TMath::ATan2(refOut->Y(),refOut->X());
  //track->Rotate(alphaIn-alphaOut);
  track->Rotate(alphaIn);
  //printf("alphaIn %f, alphaOut %f \n",alphaIn,alphaOut);

  //
  //Bool_t isOK = AliTracker::PropagateTrackTo(track, refIn->R(), mass, step, kTRUE,0.99);
  //Bool_t isOK = AliTracker::PropagateTrackTo(track, refIn->R(), mass, step, kFALSE,0.99);
  Bool_t isOK = AliTracker::PropagateTrackToBxByBz(track, refIn->R(), mass, step, kFALSE,0.99);
  if(!isOK) return;

  // calculate alpha angle
  //Double_t xyz[3] = {refIn->X(),refIn->Y(),refIn0->Z()};
  //Double_t alpha = TMath::ATan2(xyz[1],xyz[0]);
  //if (alpha<0) alpha += TMath::TwoPi();

  // rotate outer track to inner 
  // and propagate to the radius of the first track referenco of TPC
  //Double_t trRadius = TMath::Sqrt(xyz[1] * xyz[1] + xyz[0] * xyz[0]);
  //Bool_t isOK = track->Propagate(alpha,trRadius,AliTracker::GetBz());
  //if(!isOK) return;
  
  Float_t mceta =  -TMath::Log(TMath::Tan(0.5 * refIn->Theta()));
  Float_t mcphi =  refIn->Phi();
  if(mcphi<0) mcphi += 2.*TMath::Pi();
  Float_t mcpt = refIn->Pt();
  Float_t mcsnp = TMath::Sin(TMath::ATan2(refIn->Py(),refIn->Px()));
  Float_t mctgl = TMath::Tan(TMath::ATan2(refIn->Pz(),refIn->Pt()));

  Float_t deltaPtTPC, deltaYTPC, deltaZTPC, deltaPhiTPC, deltaLambdaTPC; 
  Float_t pull1PtTPC=0., pullYTPC=0., pullZTPC=0., pullPhiTPC=0., pullLambdaTPC=0.; 

  if(mcpt == 0) return;

  //deltaYTPC = track->GetY()-refIn->Y();
  deltaYTPC = track->GetY();
  deltaZTPC = track->GetZ()-refIn->Z();
  deltaLambdaTPC = TMath::ATan2(track->Pz(),track->Pt())-TMath::ATan2(refIn->Pz(),refIn->Pt());
  deltaPhiTPC = TMath::ATan2(track->Py(),track->Px())-TMath::ATan2(refIn->Py(),refIn->Px());
  deltaPtTPC = (track->Pt()-mcpt) / mcpt;

  /*
  printf("------------------------------ \n");
  printf("trX %f, trY %f, trZ %f, trTheta %f ,trPhi %f, trPt %f \n", track->GetX(), track->GetY(), track->GetZ(), TMath::ATan2(track->Pz(),track->Pt()), TMath::ATan2(track->Py(),track->Px()), track->Pt() ); 
  printf("partX %f, partY %f, partZ %f, partTheta %f ,partPhi %f, partPt %f \n",refIn->X(),  refIn->Y(), refIn->Z(), TMath::ATan2(refIn->Pz(),refIn->Pt()), TMath::ATan2(refIn->Py(),refIn->Px()), mcpt ); 
  */

  if(TMath::Sqrt(track->GetSigmaY2())) pullYTPC = track->GetY() / TMath::Sqrt(track->GetSigmaY2());
  if(TMath::Sqrt(track->GetSigmaZ2())) pullZTPC = (track->GetZ()-refIn->Z()) / TMath::Sqrt(track->GetSigmaZ2());
  if(TMath::Sqrt(track->GetSigmaSnp2())) pullPhiTPC = (track->GetSnp() - mcsnp) / TMath::Sqrt(track->GetSigmaSnp2());
  if(TMath::Sqrt(track->GetSigmaTgl2())) pullLambdaTPC = (track->GetTgl() - mctgl) / TMath::Sqrt(track->GetSigmaTgl2());
  if(TMath::Sqrt(track->GetSigma1Pt2())) pull1PtTPC = (track->OneOverPt()-1./mcpt) / TMath::Sqrt(track->GetSigma1Pt2());

  //printf("pullYTPC %f,pullZTPC %f,pullPhiTPC %f,pullLambdaTPC %f,pull1PtTPC %f,refIn->Y() %f,refIn->Z() %f,mcsnp %f,mctgl %f,1./mcpt %f \n",pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,refIn->Y(),refIn->Z(),mcsnp,mctgl,1./mcpt);

  Double_t vResolHisto[10] = {deltaYTPC,deltaZTPC,deltaPhiTPC,deltaLambdaTPC,deltaPtTPC,refIn->Y(),refIn->Z(),mcphi,mceta,mcpt};
  fResolHisto->Fill(vResolHisto);

  Double_t vPullHisto[10] = {pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,refIn->Y(),refIn->Z(),mcsnp,mctgl,1./mcpt};
  fPullHisto->Fill(vPullHisto);

  if(track) delete track;
}

//_____________________________________________________________________________
void AliPerformanceMC::ProcessOuterTPCExt(TParticle *const part, TClonesArray * const trefs)
{
  const Int_t kMinRefs=5;
  Int_t nrefs = trefs->GetEntries();
  if (nrefs<kMinRefs) return; // we should have enough references
  Int_t iref0 =-1;
  Int_t iref1 =-1;
  
  for (Int_t iref=0; iref<nrefs; iref++){
    AliTrackReference * ref = (AliTrackReference*)trefs->At(iref);
    if (!ref) continue;    
    Float_t dir = ref->X()*ref->Px()+ref->Y()*ref->Py();
    if (dir<0) break;
    if (ref->DetectorId()!=AliTrackReference::kTPC) continue;
    if (iref0<0) iref0 = iref;
    iref1 = iref;    
  }
  if (iref1-iref0<kMinRefs) return;
  Double_t covar[15];
  for (Int_t icov=0; icov<15; icov++) covar[icov]=0;
  covar[0]=1; 
  covar[2]=1; 
  covar[5]=1;
  covar[9]=1;
  covar[14]=1;

  AliTrackReference * refIn = (AliTrackReference*)trefs->At(iref0);
  AliTrackReference * refOut = (AliTrackReference*)trefs->At(iref1);
  AliExternalTrackParam *paramPropagate= MakeTrack(refIn,part);
  AliExternalTrackParam *paramUpdate   = MakeTrack(refIn,part);
  paramUpdate->AddCovariance(covar);

  Bool_t isOKP=kTRUE;
  Bool_t isOKU=kTRUE;
  AliMagF * field = (AliMagF*) TGeoGlobalMagField::Instance()->GetField();
  if(!field) return;
  for (Int_t iref = iref0; iref<=iref1; iref++){
    AliTrackReference * ref = (AliTrackReference*)trefs->At(iref);
    if(!ref) continue;
    Float_t alphaC= TMath::ATan2(ref->Y(),ref->X());
    Double_t pos[3] = {ref->X(), ref->Y(), ref->Z()};
    Double_t mag[3];
    field->Field(pos,mag);
    isOKP&=paramPropagate->Rotate(alphaC);
    isOKU&=paramUpdate->Rotate(alphaC);
    for (Float_t xref= paramPropagate->GetX(); xref<ref->R(); xref++){
      //isOKP&=paramPropagate->PropagateTo(xref, mag[2]);
      //isOKU&=paramUpdate->PropagateTo(xref, mag[2]);
      isOKP&=paramPropagate->PropagateToBxByBz(xref, mag);
      isOKU&=paramUpdate->PropagateToBxByBz(xref, mag);
    }
    //isOKP&=paramPropagate->PropagateTo(ref->R(), mag[2]);
    //isOKU&=paramUpdate->PropagateTo(ref->R(), mag[2]);
    isOKP&=paramPropagate->PropagateToBxByBz(ref->R(), mag);
    isOKU&=paramUpdate->PropagateToBxByBz(ref->R(), mag);
    Double_t clpos[2] = {0, ref->Z()};
    Double_t clcov[3] = { 0.005,0,0.005};
    isOKU&= paramUpdate->Update(clpos, clcov);  
  }

  Float_t mceta =  -TMath::Log(TMath::Tan(0.5 * refOut->Theta()));
  Float_t mcphi =  refOut->Phi();
  if(mcphi<0) mcphi += 2.*TMath::Pi();
  Float_t mcpt = refOut->Pt();
  Float_t mcsnp = TMath::Sin(TMath::ATan2(refOut->Py(),refOut->Px()));
  Float_t mctgl = TMath::Tan(TMath::ATan2(refOut->Pz(),refOut->Pt()));

  Float_t deltaPtTPC, deltaYTPC, deltaZTPC, deltaPhiTPC, deltaLambdaTPC; 
  Float_t pull1PtTPC=0., pullYTPC=0., pullZTPC=0., pullPhiTPC=0., pullLambdaTPC=0.; 

  if(mcpt == 0) return;

  //deltaYTPC = track->GetY()-refIn->Y();
  deltaYTPC = paramPropagate->GetY();
  deltaZTPC = paramPropagate->GetZ()-refOut->Z();
  deltaLambdaTPC = TMath::ATan2(paramPropagate->Pz(),paramPropagate->Pt())-TMath::ATan2(refOut->Pz(),refOut->Pt());
  deltaPhiTPC = TMath::ATan2(paramPropagate->Py(),paramPropagate->Px())-TMath::ATan2(refOut->Py(),refOut->Px());
  deltaPtTPC = (paramPropagate->Pt()-mcpt) / mcpt;

  if(TMath::Sqrt(paramPropagate->GetSigmaY2())) pullYTPC = paramPropagate->GetY() / TMath::Sqrt(paramPropagate->GetSigmaY2());
  if(TMath::Sqrt(paramPropagate->GetSigmaZ2())) pullZTPC = (paramPropagate->GetZ()-refOut->Z()) / TMath::Sqrt(paramPropagate->GetSigmaZ2());
  if(TMath::Sqrt(paramPropagate->GetSigmaSnp2())) pullPhiTPC = (paramPropagate->GetSnp() - mcsnp) / TMath::Sqrt(paramPropagate->GetSigmaSnp2());
  if(TMath::Sqrt(paramPropagate->GetSigmaTgl2())) pullLambdaTPC = (paramPropagate->GetTgl() - mctgl) / TMath::Sqrt(paramPropagate->GetSigmaTgl2());
  if(TMath::Sqrt(paramPropagate->GetSigma1Pt2())) pull1PtTPC = (paramPropagate->OneOverPt()-1./mcpt) / TMath::Sqrt(paramPropagate->GetSigma1Pt2());

  //printf("pullYTPC %f,pullZTPC %f,pullPhiTPC %f,pullLambdaTPC %f,pull1PtTPC %f,refIn->Y() %f,refIn->Z() %f,mcsnp %f,mctgl %f,1./mcpt %f \n",pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,refIn->Y(),refIn->Z(),mcsnp,mctgl,1./mcpt);

  Double_t vResolHisto[10] = {deltaYTPC,deltaZTPC,deltaPhiTPC,deltaLambdaTPC,deltaPtTPC,refIn->Y(),refIn->Z(),mcphi,mceta,mcpt};
  fResolHisto->Fill(vResolHisto);

  Double_t vPullHisto[10] = {pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,refIn->Y(),refIn->Z(),mcsnp,mctgl,1./mcpt};
  fPullHisto->Fill(vPullHisto);
}
 
//_____________________________________________________________________________
AliExternalTrackParam * AliPerformanceMC::MakeTrack(const AliTrackReference* const ref, TParticle* const part)
{
  //
  // Make track out of the track ref
  // part - TParticle used to determine chargr
  // the covariance matrix - equal 0 - starting from ideal MC position
  Double_t xyz[3]={ref->X(),ref->Y(),ref->Z()};
  Double_t pxyz[3]={ref->Px(),ref->Py(),ref->Pz()};
  Double_t cv[21];
  for (Int_t i=0; i<21;i++) cv[i]=0;
  if (!part->GetPDG()) return 0;
  AliExternalTrackParam * param = new AliExternalTrackParam(xyz,pxyz,cv,TMath::Nint(part->GetPDG()->Charge()/3.));
  return param;
}

//_____________________________________________________________________________
TH1F* AliPerformanceMC::MakeResol(TH2F * his, Int_t integ, Bool_t type, Int_t cut){
  // Create resolution histograms
 
  TH1F *hisr, *hism;
  if (!gPad) new TCanvas;
  hisr = AliTreeDraw::CreateResHistoII(his,&hism,integ,kTRUE,cut);
  if (type) return hism;
  else 
    return hisr;
}

//_____________________________________________________________________________
void AliPerformanceMC::Analyse() {
  // Analyse comparison information and store output histograms
  // in the folder "folderRes"
  //
  TH1::AddDirectory(kFALSE);
  TH1F *h=0;
  TH2F *h2D=0;
  TObjArray *aFolderObj = new TObjArray;
  if(!aFolderObj) return;

  // write results in the folder 
  TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
  c->cd();

  char name[256];
  char title[256];

  for(Int_t i=0; i<5; i++) 
  {
    for(Int_t j=5; j<10; j++) 
    {
      //if(j!=8) fResolHisto->GetAxis(8)->SetRangeUser(-0.9,0.89); // eta window
      fResolHisto->GetAxis(9)->SetRangeUser(0.16,10.); // pt threshold
      if(j!=8) fResolHisto->GetAxis(8)->SetRangeUser(0.,0.9); // eta window
      //fResolHisto->GetAxis(9)->SetRangeUser(0.16,3.); // pt window
      if(GetAnalysisMode() == 3) fResolHisto->GetAxis(5)->SetRangeUser(-80.,80.); // y range

      h2D = (TH2F*)fResolHisto->Projection(i,j);

      h = AliPerformanceMC::MakeResol(h2D,1,0,20);
      snprintf(name,256,"h_res_%d_vs_%d",i,j);
      h->SetName(name);

      h->GetXaxis()->SetTitle(fResolHisto->GetAxis(j)->GetTitle());
      snprintf(title,256,"%s %s",fResolHisto->GetAxis(i)->GetTitle(),"(resolution)");
      h->GetYaxis()->SetTitle(title);
      snprintf(title,256,"%s vs %s",title,fResolHisto->GetAxis(j)->GetTitle());
      h->SetTitle(title);

      if(j==9) h->SetBit(TH1::kLogX);    
      aFolderObj->Add(h);

      h = AliPerformanceMC::MakeResol(h2D,1,1,20);
      //h = (TH1F*)arr->At(1);
      snprintf(name,256,"h_mean_res_%d_vs_%d",i,j);
      h->SetName(name);

      h->GetXaxis()->SetTitle(fResolHisto->GetAxis(j)->GetTitle());
      snprintf(title,256,"%s %s",fResolHisto->GetAxis(i)->GetTitle(),"(mean)");
      h->GetYaxis()->SetTitle(title);

      snprintf(title,256,"%s vs %s",title,fResolHisto->GetAxis(j)->GetTitle());
      h->SetTitle(title);

      if(j==9) h->SetBit(TH1::kLogX);    
      aFolderObj->Add(h);

      fResolHisto->GetAxis(8)->SetRangeUser(-1.5,1.5);
      fResolHisto->GetAxis(9)->SetRangeUser(0.0,10.);

      //
      if(j!=8) fPullHisto->GetAxis(8)->SetRangeUser(-1.0,0.99); // theta window
      else  fPullHisto->GetAxis(8)->SetRangeUser(-1.5,1.5); // theta window
      fPullHisto->GetAxis(9)->SetRangeUser(0.0,10.);  // pt threshold
      if(GetAnalysisMode() == 3) fPullHisto->GetAxis(5)->SetRangeUser(-80.,80.); // y range

      h2D = (TH2F*)fPullHisto->Projection(i,j);

      h = AliPerformanceMC::MakeResol(h2D,1,0,20);
      snprintf(name,256,"h_pull_%d_vs_%d",i,j);
      h->SetName(name);

      h->GetXaxis()->SetTitle(fPullHisto->GetAxis(j)->GetTitle());
      snprintf(title,256,"%s %s",fPullHisto->GetAxis(i)->GetTitle(),"(resolution)");
      h->GetYaxis()->SetTitle(title);
      snprintf(title,256,"%s vs %s",title,fPullHisto->GetAxis(j)->GetTitle());
      h->SetTitle(title);

      //if(j==9) h->SetBit(TH1::kLogX);    
      aFolderObj->Add(h);

      h = AliPerformanceMC::MakeResol(h2D,1,1,20);
      snprintf(name,256,"h_mean_pull_%d_vs_%d",i,j);
      h->SetName(name);

      h->GetXaxis()->SetTitle(fPullHisto->GetAxis(j)->GetTitle());
      snprintf(title,256,"%s %s",fPullHisto->GetAxis(i)->GetTitle(),"(mean)");
      h->GetYaxis()->SetTitle(title);
      snprintf(title,256,"%s vs %s",title,fPullHisto->GetAxis(j)->GetTitle());
      h->SetTitle(title);

      //if(j==9) h->SetBit(TH1::kLogX);    
      aFolderObj->Add(h);
    }
  }

  // export objects to analysis folder
  fAnalysisFolder = ExportToFolder(aFolderObj);

  // delete only TObjArray
  if(aFolderObj) delete aFolderObj;
}

//_____________________________________________________________________________
TFolder* AliPerformanceMC::ExportToFolder(TObjArray * array) 
{
  // recreate folder avery time and export objects to new one
  //
  AliPerformanceMC * comp=this;
  TFolder *folder = comp->GetAnalysisFolder();

  TString name, title;
  TFolder *newFolder = 0;
  Int_t i = 0;
  Int_t size = array->GetSize();

  if(folder) { 
     // get name and title from old folder
     name = folder->GetName();  
     title = folder->GetTitle();  

	 // delete old one
     delete folder;

	 // create new one
     newFolder = CreateFolder(name.Data(),title.Data());
     newFolder->SetOwner();

	 // add objects to folder
     while(i < size) {
	   newFolder->Add(array->At(i));
	   i++;
	 }
  }

return newFolder;
}

//_____________________________________________________________________________
Long64_t AliPerformanceMC::Merge(TCollection* const list) 
{
  // Merge list of objects (needed by PROOF)

  if (!list)
  return 0;

  if (list->IsEmpty())
  return 1;

  TIterator* iter = list->MakeIterator();
  TObject* obj = 0;

  // collection of generated histograms
  Int_t count=0;
  while((obj = iter->Next()) != 0) 
  {
  AliPerformanceMC* entry = dynamic_cast<AliPerformanceMC*>(obj);
  if (entry == 0) continue; 

  fResolHisto->Add(entry->fResolHisto);
  fPullHisto->Add(entry->fPullHisto);

  count++;
  }

return count;
}

//_____________________________________________________________________________
TFolder* AliPerformanceMC::CreateFolder(TString name,TString title) { 
// create folder for analysed histograms
//
TFolder *folder = 0;
  folder = new TFolder(name.Data(),title.Data());

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