ROOT logo
#include "CommonDefs.C"
  
const Char_t *destdir = "plots";

enum EHisto_t {
  kAcceptedTracks,
  kMatchedTracks,
  kMismatchedTracks,
  kUncorrelatedTracks,
  kMatchedCorrelatedTracks,
  kMatchedGoodTracks,
  kNHistos
};
const Char_t *histoName[kNHistos] = {
  "hAcceptedTracks",
  "hMatchedTracks",
  "hMismatchedTracks",
  "hUncorrelatedTracks",
  "hMatchedCorrelatedTracks",
  "hMatchedGoodTracks"
};

enum EParam_t {
  kCentrality,
  kPt,
  kEta,
  kPhi,
  kNParams
};

TOFmatchMC(const Char_t *filename, Int_t rapidityPart = -1, Int_t evMax = kMaxInt)
{

  /* include path for ACLic */
  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
  gSystem->AddIncludePath("-I$ALICE_ROOT/TOF");
  /* load libraries */
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  /* build analysis task class */
  gROOT->LoadMacro("AliAnalysisParticle.cxx+g");
  gROOT->LoadMacro("AliAnalysisEvent.cxx+g");
  gROOT->LoadMacro("AliAnalysisTrack.cxx+g");
 
  /* open file, get tree and connect */
  TFile *filein = TFile::Open(filename);
  TTree *treein = (TTree *)filein->Get("aodTree");
  printf("got \"aodTree\": %d entries\n", treein->GetEntries());
  AliAnalysisEvent *analysisEvent = new AliAnalysisEvent();
  TClonesArray *analysisTrackArray = new TClonesArray("AliAnalysisTrack");
  AliAnalysisTrack *analysisTrack = NULL;
  treein->SetBranchAddress("AnalysisEvent", &analysisEvent);
  treein->SetBranchAddress("AnalysisTrack", &analysisTrackArray);

  /* open enabled flag map */
  TH1F *hEnabledFlag = NULL;
  if (enabledChannelsFileName) {
    TFile *enabledfile = TFile::Open(enabledChannelsFileName);
    hEnabledFlag = (TH1F *)enabledfile->Get("hEnabledFlag");
  }
  
  /* binning */
  for (Int_t ieta = 0; ieta < NetaBins + 1; ieta++)
    etaBin[ieta] = etaMin + ieta * etaStep;
  for (Int_t iphi = 0; iphi < NphiBins + 1; iphi++)
    phiBin[iphi] = phiMin + iphi * phiStep;
  /* THnSparse */
  Int_t NparamBins[kNParams] = {NcentralityBins, NptBins, NetaBins, NphiBins};
  Double_t *paramBin[kNParams] = {centralityBin, ptBin, etaBin, phiBin};
  THnSparseF *hHisto[kNHistos][AliPID::kSPECIES][kNCharges];
  for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++)
    for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
      for (Int_t icharge = 0; icharge < kNCharges; icharge++) {
	hHisto[ihisto][ipart][icharge] = new THnSparseF(Form("hHisto_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]), "", kNParams, NparamBins);
	for (Int_t iparam = 0; iparam < kNParams; iparam++)
	  hHisto[ihisto][ipart][icharge]->SetBinEdges(iparam, paramBin[iparam]);
      }
  /* histos */
  TH2F *hFEAMap = new TH2F("hFEAMap", "", 72, 0., 18., 91, 0., 91.);

  /* start stopwatch */
  TStopwatch timer;
  timer.Start();

  /* loop over events */
  Double_t param[kNParams];
  Int_t part, charge;
  Int_t index, sector, sectorStrip, padx, fea;
  Float_t hitmapx, hitmapy;
  AliTOFcalibHisto calib;
  calib.LoadCalibHisto();
  for (Int_t iev = 0; iev < treein->GetEntries() && iev < evMax; iev++) {
    /* get event */
    treein->GetEvent(iev);
    if (iev % 1000 == 0) printf("iev = %d\n", iev);
    /* check event */
    if (!analysisEvent->AcceptEvent(acceptEventType)) continue;

    /*** ACCEPTED EVENT ***/

    /* get centrality */
    param[kCentrality] = analysisEvent->GetCentralityPercentile(centralityEstimator);
    
    /* loop over tracks */
    for (Int_t itrk = 0; itrk < analysisTrackArray->GetEntries(); itrk++) {
      /* get track */
      analysisTrack = (AliAnalysisTrack *)analysisTrackArray->At(itrk);
      if (!analysisTrack) continue;
      /* check charged primary with defined PID */
      part = analysisTrack->GetMCPID();
      if (!analysisTrack->IsMCPrimary() || part < 0 || analysisTrack->GetSign() == 0.) continue;
      /* check accepted track */
      if (!analysisTrack->AcceptTrack()) continue;
      /* check rapidity */
      if (rapidityPart < 0) {
	if ((analysisTrack->GetY(AliPID::ParticleMass(part)) - rapidityShift) > rapidityMaxCut || 
	    (analysisTrack->GetY(AliPID::ParticleMass(part)) - rapidityShift) < rapidityMinCut) continue;
      }
      else {
	if ((analysisTrack->GetY(AliPID::ParticleMass(rapidityPart)) - rapidityShift) > rapidityMaxCut || 
	    (analysisTrack->GetY(AliPID::ParticleMass(rapidityPart)) - rapidityShift) < rapidityMinCut) continue;
      }

      /*** ACCEPTED TRACK ***/
      
      /* get track info */
      param[kPt] = analysisTrack->GetPt();
      param[kEta] = analysisTrack->GetEta();
      param[kPhi] = analysisTrack->GetPhi();
      charge = analysisTrack->GetSign() > 0. ? kPositive : kNegative;
      
      /* fill accepted tracks histos */
      hHisto[kAcceptedTracks][part][charge]->Fill(param);

      /* check TOF PID */
      if (!analysisTrack->HasTOFPID(hEnabledFlag)) continue;

      /*** ACCEPTED TRACK WITH TOF SIGNAL ***/

      /* fill FEA map */
      sector = calib.GetCalibMap(AliTOFcalibHisto::kSector, index);
      sectorStrip = calib.GetCalibMap(AliTOFcalibHisto::kSectorStrip, index);
      padx = calib.GetCalibMap(AliTOFcalibHisto::kPadX, index);
      fea = padx / 12;
      hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.;
      hitmapy = sectorStrip;
      hFEAMap->Fill(hitmapx, hitmapy);
      
      /* fill matched tracks histos */
      hHisto[kMatchedTracks][part][charge]->Fill(param);
      
      /* check mismatch */
      if (!analysisTrack->IsMismatchMC()) {
	hHisto[kMatchedGoodTracks][part][charge]->Fill(param);
	hHisto[kMatchedCorrelatedTracks][part][charge]->Fill(param);
	continue;
      }

      /*** MIS-MATCHED TRACK ***/

      /* fill mis-matched tracks histos */
      hHisto[kMismatchedTracks][part][charge]->Fill(param);

      /* check uncorrelated mismatch */
      if (!analysisTrack->IsUncorrelatedMismatchMC()) {
	hHisto[kMatchedCorrelatedTracks][part][charge]->Fill(param);
	continue;
      }
      
      /*** UNCORRELATED MIS-MATCHED TRACK ***/

      /* fill uncorrelated mis-matched tracks histos */
      hHisto[kUncorrelatedTracks][part][charge]->Fill(param);

    }
  }

  /* stop stopwatch */
  timer.Stop();
  timer.Print();
  
  /* output */
  if (rapidityPart < 0) 
    TFile *fileout = TFile::Open(Form("TOFmatchMC.%s", filename), "RECREATE");
  else
    TFile *fileout = TFile::Open(Form("TOFmatchMC.%s.%s", AliPID::ParticleName(rapidityPart), filename), "RECREATE");
  hFEAMap->Write();
  for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++)
    for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
      for (Int_t icharge = 0; icharge < kNCharges; icharge++)
	hHisto[ihisto][ipart][icharge]->Write();
  fileout->Close();

  if (rapidityPart < 0)
    TString str = Form("TOFmatchMC.%s", filename);
  else
    TString str = Form("TOFmatchMC.%s.%s", AliPID::ParticleName(rapidityPart), filename);
  TOFmatchMC_efficiencyPt(str.Data());
}

//_____________________________________________________________________________-

TOFmatchMC_efficiencyPt(const Char_t *filename)
{

  /* get data */
  TFile *filein = TFile::Open(filename);
  THnSparseF *hHisto[kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hHistoPt_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hHistoPt_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hHistoAllPt_MB[kNHistos], *hHistoAllPt_centrality[NcentralityBins][kNHistos];
  /* loop over histos */
  for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) {

    /* INCLUSIVE */

    hHistoAllPt_MB[ihisto] = new TH1D(Form("hHistoAllPt_MB_%s", histoName[ihisto]), "", NptBins, ptBin);
    for (Int_t icent = 0; icent < NcentralityBins; icent++)
      hHistoAllPt_centrality[icent][ihisto] = new TH1D(Form("hHistoAllPt_centrality%d_%s", icent, histoName[ihisto]), "", NptBins, ptBin);

    /* SINGLE PARTICLE */

    for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
      for (Int_t icharge = 0; icharge < kNCharges; icharge++) {

	/* get histo */
	hHisto[ihisto][ipart][icharge] = (THnSparseF *)filein->Get(Form("hHisto_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));

	/* MB projection */
	hHistoPt_MB[ihisto][ipart][icharge] = hHisto[ihisto][ipart][icharge]->Projection(kPt);
	hHistoPt_MB[ihisto][ipart][icharge]->SetName(Form("hHistoPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	hHistoPt_MB[ihisto][ipart][icharge]->Sumw2();
	hHistoAllPt_MB[ihisto]->Add(hHistoPt_MB[ihisto][ipart][icharge]);
	
	/* centrality projection */
	for (Int_t icent = 0; icent < NcentralityBins; icent++) {
	  hHisto[ihisto][ipart][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1);
	  hHistoPt_centrality[icent][ihisto][ipart][icharge] = hHisto[ihisto][ipart][icharge]->Projection(kPt);
	  hHistoPt_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hHistoPt_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hHistoPt_centrality[icent][ihisto][ipart][icharge]->Sumw2();
	  hHistoAllPt_centrality[icent][ihisto]->Add(hHistoPt_centrality[icent][ihisto][ipart][icharge]);
	}
      }
    }
  }    
  
  /* output */
  TString str = filename;
  str.Insert(str.Length() - TString(".root").Length(), ".efficiencyPt");
  TFile *fileout = TFile::Open(str.Data(), "RECREATE");
  
  /* efficiencies/fractions and write */
  TH1D *hEfficiencyPt_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyPt_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyPt_ratioMB_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hEfficiencyAllPt_MB[kNHistos], *hEfficiencyAllPt_centrality[NcentralityBins][kNHistos], *hEfficiencyAllPt_ratioMB_centrality[NcentralityBins][kNHistos];


  TH1D *hFractionPt_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hFractionPt_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges], *hFractionPt_ratioMB_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges];
  for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) {

    if (ihisto == kAcceptedTracks) continue;

    /* INCLUSIVE */

    /* MB efficiency */
    hEfficiencyAllPt_MB[ihisto] = new TH1D(*hHistoAllPt_MB[ihisto]);
    hEfficiencyAllPt_MB[ihisto]->SetName(Form("hEfficiencyAllPt_MB_%s", histoName[ihisto]));
    hEfficiencyAllPt_MB[ihisto]->SetLineWidth(2);
    hEfficiencyAllPt_MB[ihisto]->SetLineColor(1);
    hEfficiencyAllPt_MB[ihisto]->SetMarkerStyle(20);
    hEfficiencyAllPt_MB[ihisto]->SetMarkerColor(1);
    hEfficiencyAllPt_MB[ihisto]->Divide(hEfficiencyAllPt_MB[ihisto], hHistoAllPt_MB[kAcceptedTracks], 1, 1, "B");
    hEfficiencyAllPt_MB[ihisto]->Write();
    
    /* multiplicity/centrality efficiency */
    for (Int_t icent = 0; icent < NcentralityBins; icent++) {
      hEfficiencyAllPt_centrality[icent][ihisto] = new TH1D(*hHistoAllPt_centrality[icent][ihisto]);
      hEfficiencyAllPt_centrality[icent][ihisto]->SetName(Form("hEfficiencyAllPt_centrality%d_%s", icent, histoName[ihisto]));
      hEfficiencyAllPt_centrality[icent][ihisto]->SetLineWidth(2);
      hEfficiencyAllPt_centrality[icent][ihisto]->SetLineColor(multcentColor[icent]);
      hEfficiencyAllPt_centrality[icent][ihisto]->SetMarkerStyle(20);
      hEfficiencyAllPt_centrality[icent][ihisto]->SetMarkerColor(multcentColor[icent]);
      hEfficiencyAllPt_centrality[icent][ihisto]->Divide(hEfficiencyAllPt_centrality[icent][ihisto], hHistoAllPt_centrality[icent][kAcceptedTracks], 1, 1, "B");
      hEfficiencyAllPt_centrality[icent][ihisto]->Write();
      
      /* ratio wrt. MB */
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto] = new TH1D(*hEfficiencyAllPt_centrality[icent][ihisto]);
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetName(Form("hEfficiencyAllPt_ratioMB_centrality%d_%s", icent, histoName[ihisto]));
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetLineWidth(2);
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetLineColor(multcentColor[icent]);
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetMarkerStyle(20);
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->SetMarkerColor(multcentColor[icent]);
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->Divide(hEfficiencyAllPt_MB[ihisto]);
      hEfficiencyAllPt_ratioMB_centrality[icent][ihisto]->Write();
    }
    
    /* SINGLE PARTICLE */

    for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++) {
      for (Int_t icharge = 0; icharge < kNCharges; icharge++) {

 	/* MB efficiency */
	hEfficiencyPt_MB[ihisto][ipart][icharge] = new TH1D(*hHistoPt_MB[ihisto][ipart][icharge]);
	hEfficiencyPt_MB[ihisto][ipart][icharge]->SetName(Form("hEfficiencyPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	hEfficiencyPt_MB[ihisto][ipart][icharge]->SetLineWidth(2);
	hEfficiencyPt_MB[ihisto][ipart][icharge]->SetLineColor(1);
	hEfficiencyPt_MB[ihisto][ipart][icharge]->SetMarkerStyle(20);
	hEfficiencyPt_MB[ihisto][ipart][icharge]->SetMarkerColor(1);
	hEfficiencyPt_MB[ihisto][ipart][icharge]->Divide(hEfficiencyPt_MB[ihisto][ipart][icharge], hHistoPt_MB[kAcceptedTracks][ipart][icharge], 1, 1, "B");
	hEfficiencyPt_MB[ihisto][ipart][icharge]->Write();
	
	/* multiplicity/centrality efficiency */
	for (Int_t icent = 0; icent < NcentralityBins; icent++) {
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hHistoPt_centrality[icent][ihisto][ipart][icharge]);
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hEfficiencyPt_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2);
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]);
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20);
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]);
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]->Divide(hEfficiencyPt_centrality[icent][ihisto][ipart][icharge], hHistoPt_centrality[icent][kAcceptedTracks][ipart][icharge], 1, 1, "B");
	  hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]->Write();
	  
	  /* ratio wrt. MB */
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hEfficiencyPt_centrality[icent][ihisto][ipart][icharge]);
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hEfficiencyPt_ratioMB_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2);
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]);
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20);
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]);
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->Divide(hEfficiencyPt_MB[ihisto][ipart][icharge]);
	  hEfficiencyPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->Write();
	}
	
	/* fractions */
	
	if (ihisto == kAcceptedTracks || ihisto == kMatchedTracks) continue;

	/* MB fraction */
	hFractionPt_MB[ihisto][ipart][icharge] = new TH1D(*hHistoPt_MB[ihisto][ipart][icharge]);
	hFractionPt_MB[ihisto][ipart][icharge]->SetName(Form("hFractionPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	hFractionPt_MB[ihisto][ipart][icharge]->SetLineWidth(2);
	hFractionPt_MB[ihisto][ipart][icharge]->SetLineColor(1);
	hFractionPt_MB[ihisto][ipart][icharge]->SetMarkerStyle(20);
	hFractionPt_MB[ihisto][ipart][icharge]->SetMarkerColor(1);
	hFractionPt_MB[ihisto][ipart][icharge]->Divide(hFractionPt_MB[ihisto][ipart][icharge], hHistoPt_MB[kMatchedTracks][ipart][icharge], 1, 1, "B");
	hFractionPt_MB[ihisto][ipart][icharge]->Write();

	/* multiplicity/centrality fraction */
	for (Int_t icent = 0; icent < NcentralityBins; icent++) {
	  hFractionPt_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hHistoPt_centrality[icent][ihisto][ipart][icharge]);
	  hFractionPt_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hFractionPt_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hFractionPt_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2);
	  hFractionPt_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]);
	  hFractionPt_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20);
	  hFractionPt_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]);
	  hFractionPt_centrality[icent][ihisto][ipart][icharge]->Divide(hFractionPt_centrality[icent][ihisto][ipart][icharge], hHistoPt_centrality[icent][kMatchedTracks][ipart][icharge], 1, 1, "B");
	  hFractionPt_centrality[icent][ihisto][ipart][icharge]->Write();

	  /* ratio wrt. MB */
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hFractionPt_centrality[icent][ihisto][ipart][icharge]);
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hFractionPt_ratioMB_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2);
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]);
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20);
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]);
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->Divide(hFractionPt_MB[ihisto][ipart][icharge]);
	  hFractionPt_ratioMB_centrality[icent][ihisto][ipart][icharge]->Write();
	}
      }       
    }
  }
  
  fileout->Close();
	     
  TOFmatchMC_matchingEfficiency(str.Data());
  TOFmatchMC_matchingEfficiency_mismatchCorrected(str.Data());

}

//_____________________________________________________________________________-

TOFmatchMC_efficiencyEta(const Char_t *filename)
{

  /* get data */
  TFile *filein = TFile::Open(filename);
  THnSparseF *hHisto[kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hHistoEta_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hHistoEta_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hHistoEta_MB_pt[NptsubBins][kNHistos][AliPID::kSPECIES][kNCharges], *hHistoEta_centrality_pt[NcentralityBins][NptsubBins][kNHistos][AliPID::kSPECIES][kNCharges];
  /* loop over histos */
  for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++)
    for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
      for (Int_t icharge = 0; icharge < kNCharges; icharge++) {
	
	/* get histo */
	hHisto[ihisto][ipart][icharge] = (THnSparseF *)filein->Get(Form("hHisto_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	
	/* MB projection */
	hHisto[ihisto][ipart][icharge]->GetAxis(kPt)->SetRange(0, 0);
	hHisto[ihisto][ipart][icharge]->GetAxis(kCentrality)->SetRange(0, 0);
	hHistoEta_MB[ihisto][ipart][icharge] = hHisto[ihisto][ipart][icharge]->Projection(kEta);
	hHistoEta_MB[ihisto][ipart][icharge]->SetName(Form("hHistoEta_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	hHistoEta_MB[ihisto][ipart][icharge]->Sumw2();
	/* pt bins */
	for (Int_t ipt = 0; ipt < NptsubBins; ipt++) {
	  hHisto[ihisto][ipart][icharge]->GetAxis(kPt)->SetRange(ptsubBinMin[ipt] + 1, ptsubBinMax[ipt] + 1);
	  hHisto[ihisto][ipart][icharge]->GetAxis(kCentrality)->SetRange(0, 0);
	  hHistoEta_MB_pt[ipt][ihisto][ipart][icharge] = hHisto[ihisto][ipart][icharge]->Projection(kEta);
	  hHistoEta_MB_pt[ipt][ihisto][ipart][icharge]->SetName(Form("hHistoEta_MB_pt%d_%s_%s_%s", ipt, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hHistoEta_MB_pt[ipt][ihisto][ipart][icharge]->Sumw2();
	}
	
	/* centrality projection */
	for (Int_t icent = 0; icent < NcentralityBins; icent++) {
	  hHisto[ihisto][ipart][icharge]->GetAxis(kPt)->SetRange(0, 0);
	  hHisto[ihisto][ipart][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1);
	  hHistoEta_centrality[icent][ihisto][ipart][icharge] = hHisto[ihisto][ipart][icharge]->Projection(kEta);
	  hHistoEta_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hHistoEta_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hHistoEta_centrality[icent][ihisto][ipart][icharge]->Sumw2();
	  /* pt bins */
	  for (Int_t ipt = 0; ipt < NptsubBins; ipt++) {
	    hHisto[ihisto][ipart][icharge]->GetAxis(kPt)->SetRange(ptsubBinMin[ipt] + 1, ptsubBinMax[ipt] + 1);
	    hHisto[ihisto][ipart][icharge]->GetAxis(kCentrality)->SetRange(icent + 1, icent + 1);
	    hHistoEta_centrality_pt[icent][ipt][ihisto][ipart][icharge] = hHisto[ihisto][ipart][icharge]->Projection(kEta);
	    hHistoEta_centrality_pt[icent][ipt][ihisto][ipart][icharge]->SetName(Form("hHistoEta_centrality%d_pt%d_%s_%s_%s", icent, ipt, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	    hHistoEta_centrality_pt[icent][ipt][ihisto][ipart][icharge]->Sumw2();
	  }
	}
      }
  
  /* output */
  TString str = filename;
  str.Insert(str.Length() - TString(".root").Length(), ".efficiencyEta");
  TFile *fileout = TFile::Open(str.Data(), "RECREATE");
  
  /* efficiencies/fractions and write */
  TH1D *hEfficiencyEta_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyEta_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyEta_ratioMB_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hEfficiencyEta_MB_pt[NptsubBins][kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyEta_centrality_pt[NcentralityBins][NptsubBins][kNHistos][AliPID::kSPECIES][kNCharges], *hEfficiencyEta_ratioMB_centrality_pt[NcentralityBins][NptsubBins][kNHistos][AliPID::kSPECIES][kNCharges];
  
  
  TH1D *hFractionEta_MB[kNHistos][AliPID::kSPECIES][kNCharges], *hFractionEta_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges], *hFractionEta_ratioMB_centrality[NcentralityBins][kNHistos][AliPID::kSPECIES][kNCharges];
  for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) {
    for (Int_t ipart = 0; ipart < AliPID::kSPECIES; ipart++)
      for (Int_t icharge = 0; icharge < kNCharges; icharge++) {
	
	if (ihisto == kAcceptedTracks) continue;
	
	/* MB efficiency */
	hEfficiencyEta_MB[ihisto][ipart][icharge] = new TH1D(*hHistoEta_MB[ihisto][ipart][icharge]);
	hEfficiencyEta_MB[ihisto][ipart][icharge]->SetName(Form("hEfficiencyEta_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	hEfficiencyEta_MB[ihisto][ipart][icharge]->SetLineWidth(2);
	hEfficiencyEta_MB[ihisto][ipart][icharge]->SetLineColor(1);
	hEfficiencyEta_MB[ihisto][ipart][icharge]->SetMarkerStyle(20);
	hEfficiencyEta_MB[ihisto][ipart][icharge]->SetMarkerColor(1);
	hEfficiencyEta_MB[ihisto][ipart][icharge]->Divide(hHistoEta_MB[kAcceptedTracks][ipart][icharge]);
	hEfficiencyEta_MB[ihisto][ipart][icharge]->Write();
	/* pt bins */
	for (Int_t ipt = 0; ipt < NptsubBins; ipt++) {
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge] = new TH1D(*hHistoEta_MB_pt[ipt][ihisto][ipart][icharge]);
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge]->SetName(Form("hEfficiencyEta_MB_pt%d_%s_%s_%s", ipt, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge]->SetLineWidth(2);
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge]->SetLineColor(1);
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge]->SetMarkerStyle(20);
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge]->SetMarkerColor(1);
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge]->Divide(hHistoEta_MB_pt[ipt][kAcceptedTracks][ipart][icharge]);
	  hEfficiencyEta_MB_pt[ipt][ihisto][ipart][icharge]->Write();
	}
	
	/* multiplicity/centrality efficiency */
	for (Int_t icent = 0; icent < NcentralityBins; icent++) {
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hHistoEta_centrality[icent][ihisto][ipart][icharge]);
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hEfficiencyEta_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2);
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]);
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20);
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]);
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]->Divide(hHistoEta_centrality[icent][kAcceptedTracks][ipart][icharge]);
	  hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]->Write();
	  
	  /* ratio wrt. MB */
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge] = new TH1D(*hEfficiencyEta_centrality[icent][ihisto][ipart][icharge]);
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetName(Form("hEfficiencyEta_ratioMB_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineWidth(2);
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetLineColor(multcentColor[icent]);
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerStyle(20);
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge]->SetMarkerColor(multcentColor[icent]);
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge]->Divide(hEfficiencyEta_MB[ihisto][ipart][icharge]);
	  hEfficiencyEta_ratioMB_centrality[icent][ihisto][ipart][icharge]->Write();
	}
	
      }       
  }
  
  fileout->Close();
  
}

//_____________________________________________________________________________-

TOFmatchMC_centralityDependence(const Char_t *filename)
{

  Double_t fitMin[AliPID::kSPECIES] = {0.5, 0.5, 0.5, 0.5, 0.5};
  Double_t fitMax[AliPID::kSPECIES] = {3.0, 3.0, 3.0, 3.0, 5.0};

  TF1 *pol0 = (TF1 *)gROOT->GetFunction("pol0");
  TF1 *pol1 = (TF1 *)gROOT->GetFunction("pol1");
  pol0->SetRange(0., 5.0);
  TFile *filein = TFile::Open(filename);

  /* output */
  TString str = filename;
  str.Insert(str.Length() - TString(".root").Length(), ".centralityDependence");
  TFile *fileout = TFile::Open(str.Data(), "RECREATE");

  TH1D *hEfficiencyPt_ratioMB;
  TH1D *hEfficiencyCentrality[kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hChi2Centrality[kNHistos][AliPID::kSPECIES][kNCharges];
  TH1D *hEfficiencyAllCentrality[kNHistos];
  TH1F *hHistoEffRatio = new TH1F("hHistoEffRatio", "", 100, 0.5, 1.5);
  for (Int_t ihisto = 0; ihisto < kNHistos; ihisto++) {
    if (ihisto == kAcceptedTracks) continue;

    /* INCLUSIVE */

    hEfficiencyAllCentrality[ihisto] = new TH1D(Form("hEfficiencyAllCentrality_ratioMB_%s", histoName[ihisto]), "", NcentralityBins, centralityBin);
    hEfficiencyAllCentrality[ihisto]->SetLineWidth(2);
    hEfficiencyAllCentrality[ihisto]->SetLineColor(1);
    hEfficiencyAllCentrality[ihisto]->SetMarkerStyle(20);
    hEfficiencyAllCentrality[ihisto]->SetMarkerColor(1);
    
    for (Int_t icent = 0; icent < NcentralityBins; icent++) {
      
      hEfficiencyPt_ratioMB = (TH1D *)filein->Get(Form("hEfficiencyAllPt_ratioMB_centrality%d_%s", icent, histoName[ihisto]));
      hEfficiencyPt_ratioMB->Fit(pol0, "q0", "", 0., 5.0);
      hEfficiencyAllCentrality[ihisto]->SetBinContent(icent + 1, pol0->GetParameter(0));
      hEfficiencyAllCentrality[ihisto]->SetBinError(icent + 1, pol0->GetParError(0));
      hEfficiencyPt_ratioMB->Add(pol0, -1.);
      hEfficiencyPt_ratioMB->Write();
      
    }
    hEfficiencyAllCentrality[ihisto]->Write();
    
    
    /* SINGLE PARTICLE */
    
    for (Int_t ipart = 2; ipart < AliPID::kSPECIES; ipart++)
      for (Int_t icharge = 0; icharge < kNCharges; icharge++) {
	
	hEfficiencyCentrality[ihisto][ipart][icharge] = new TH1D(Form("hEfficiencyCentrality_ratioMB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]), "", NcentralityBins, centralityBin);
	hEfficiencyCentrality[ihisto][ipart][icharge]->SetLineWidth(2);
	hEfficiencyCentrality[ihisto][ipart][icharge]->SetLineColor(particleColor[ipart]);
	hEfficiencyCentrality[ihisto][ipart][icharge]->SetMarkerStyle(chargeMarker[icharge]);
	hEfficiencyCentrality[ihisto][ipart][icharge]->SetMarkerColor(particleColor[ipart]);
	
	for (Int_t icent = 0; icent < NcentralityBins; icent++) {
	 
	  hEfficiencyPt_ratioMB = (TH1D *)filein->Get(Form("hEfficiencyPt_ratioMB_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));

	  hEfficiencyPt_ratioMB->Fit(pol0, "q0", "", fitMin[ipart], fitMax[ipart]);
	  hEfficiencyCentrality[ihisto][ipart][icharge]->SetBinContent(icent + 1, pol0->GetParameter(0));
	  hEfficiencyCentrality[ihisto][ipart][icharge]->SetBinError(icent + 1, pol0->GetParError(0));
	  pol0->SetRange(fitMin[ipart], fitMax[ipart]);
	  hEfficiencyPt_ratioMB->Add(pol0, -1.);
	  hEfficiencyPt_ratioMB->Write();

	}

	hEfficiencyCentrality[ihisto][ipart][icharge]->Write();
      }
  }
  
  fileout->Close();
}

//_____________________________________________________________________________-

TOFmatchMC_centralityDependenceFit(const Char_t *filename, Int_t ihisto = kMatchedGoodTracks)
{

  const Char_t *particleLabel[5][2] = {"", "", "", "", "#pi^{+}", "#pi^{-}", "K^{+}", "K^{-}", "p", "#bar{p}"};

  TF1 *fCentralityDependence = new TF1("fCentralityDependence", "[0] + [1] * (1. - TMath::Exp(-x / [2]))", 0., 90.);
  fCentralityDependence->SetParameter(0, 0.98);
  fCentralityDependence->SetParameter(1, 0.05);
  fCentralityDependence->SetParameter(2, 50.);

  TFile *filein = TFile::Open(filename);
  TH1D *hEfficiencyAllCentrality;
  TH1D *hEfficiencyCentrality[AliPID::kSPECIES][kNCharges];
  hEfficiencyAllCentrality = (TH1D *)filein->Get(Form("hEfficiencyAllCentrality_ratioMB_%s", histoName[ihisto]));
  TCanvas *cFit = new TCanvas("cFit");
  hEfficiencyAllCentrality->Fit(fCentralityDependence);
  hEfficiencyAllCentrality->SetMaximum(1.05);
  hEfficiencyAllCentrality->SetMinimum(0.95);
  TCanvas *cRatios = new TCanvas("cRatios");
  cRatios->Divide(2, 3);
  for (Int_t ipart = 2; ipart < AliPID::kSPECIES; ipart++) {
    for (Int_t icharge = 0; icharge < 2; icharge++) {
      cRatios->cd(icharge + 1 + 2 * (ipart - 2));
      cRatios->cd(icharge + 1 + 2 * (ipart - 2))->SetGridx();
      cRatios->cd(icharge + 1 + 2 * (ipart - 2))->SetGridy();
      hEfficiencyCentrality[ipart][icharge] = (TH1D *)filein->Get(Form("hEfficiencyCentrality_ratioMB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
      hEfficiencyCentrality[ipart][icharge]->Divide(fCentralityDependence);
      hEfficiencyCentrality[ipart][icharge]->SetMaximum(1.05);
      hEfficiencyCentrality[ipart][icharge]->SetMinimum(0.95);
      hEfficiencyCentrality[ipart][icharge]->SetTitle(Form("%s;centrality percentile;efficiency ratio wrt. fitted centrality dependence", particleLabel[ipart][icharge]));
      hEfficiencyCentrality[ipart][icharge]->SetStats(kFALSE);
      hEfficiencyCentrality[ipart][icharge]->Draw();
    }
  }
  

}

//_____________________________________________________________________________-

TOFmatchMC_efficiencyPt_MB_plot(const Char_t *filename)
{
  TOFmatchMC_efficiencyPt_MB_plot(filename, kMatchedGoodTracks, 2, 0, 20, 4);
  TOFmatchMC_efficiencyPt_MB_plot(filename, kMatchedGoodTracks, 2, 1, 25, 4);
  TOFmatchMC_efficiencyPt_MB_plot(filename, kMatchedGoodTracks, 3, 0, 20, 8);
  TOFmatchMC_efficiencyPt_MB_plot(filename, kMatchedGoodTracks, 3, 1, 25, 8);
  TOFmatchMC_efficiencyPt_MB_plot(filename, kMatchedGoodTracks, 4, 0, 20, 2);
  TOFmatchMC_efficiencyPt_MB_plot(filename, kMatchedGoodTracks, 4, 1, 25, 2);
}

TH1D *
TOFmatchMC_efficiencyPt_MB_plot(const Char_t *filename, Int_t ihisto = kMatchedGoodTracks, Int_t ipart, Int_t icharge, Int_t marker = 20, Int_t color = 2, Option_t *opt = "")
{

  TCanvas *cCanvas1 = new TCanvas("cCanvas1");
  TCanvas *cCanvas2 = new TCanvas("cCanvas2");
  
  Double_t ptMin[AliPID::kSPECIES] = {0.5, 0.5, 0.5, 0.5, 0.5};
  Double_t ptMax[AliPID::kSPECIES] = {3.0, 3.0, 3.0, 3.0, 5.0};

  TF1 *fEff = new TF1("fEff", "[0] * TMath::Exp(-TMath::Power(x / [1], [2])) / (1. + TMath::Exp(([3] - x) / [4]))", 0., 5.0);
  fEff->SetParameter(0, 0.5);
  fEff->SetParameter(1, 0.5);
  fEff->SetParameter(2, 1.);
  fEff->SetParameter(3, 0.5);
  fEff->SetParameter(4, 0.5);
  fEff->SetParLimits(4, 0.3, 2.0);
  
  TFile *fileout = TFile::Open(Form("%s/efficiencyPt_MB_%s_%s.root", destdir, AliPID::ParticleName(ipart), chargeName[icharge]), "RECREATE");

  TFile *filein = TFile::Open(filename);
  TH1D *hEfficiencyPt = (TH1D *)filein->Get(Form("hEfficiencyPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));

  hEfficiencyPt->Fit(fEff, "0q", "IME", 0.5, 5.0);
  hEfficiencyPt->SetTitle(Form("%s;p_{T} (GeV/c);acceptance #times efficiency;", partChargeName[ipart][icharge]));
  hEfficiencyPt->SetMinimum(0.2);
  hEfficiencyPt->SetMaximum(0.7);
  hEfficiencyPt->SetMarkerStyle(marker);
  hEfficiencyPt->SetMarkerColor(color);
  hEfficiencyPt->SetMarkerSize(1.5);
  hEfficiencyPt->SetLineWidth(2);
  hEfficiencyPt->SetLineColor(color);
  hEfficiencyPt->GetXaxis()->SetRangeUser(ptMin[ipart] + 0.001, ptMax[ipart] - 0.001);
  hEfficiencyPt->SetStats(kFALSE);
  cCanvas1->cd();
  hEfficiencyPt->DrawCopy();
  fEff->DrawCopy("same");
  fileout->cd();
  hEfficiencyPt->Write("hEfficiencyPt");
  fEff->Write("fEff");

  cCanvas1->SetGridx();
  cCanvas1->SetGridy();
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_%s_%s.C", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_%s_%s.png", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_%s_%s.eps", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  
  TH1D *hRatioPt = new TH1D(*hEfficiencyPt);
  hRatioPt->Divide(fEff);
  hRatioPt->SetTitle(Form("%s;p_{T} (GeV/c);ratio wrt. fitted dependence;", partChargeName[ipart][icharge]));
  hRatioPt->SetMinimum(0.9);
  hRatioPt->SetMaximum(1.1);
  cCanvas2->cd();
  hRatioPt->DrawCopy();
  fileout->cd();
  hRatioPt->Write("hRatioPt");

  cCanvas2->SetGridx();
  cCanvas2->SetGridy();
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_%s_%s.C", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_%s_%s.png", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_%s_%s.eps", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  

  fileout->Close();

  //  hEfficiencyPt->Add(fEff, -1.);
  return hEfficiencyPt;
}


//_____________________________________________________________________________-

TOFmatchMC_efficiencyPt_centrality_plot(const Char_t *filename)
{
  TOFmatchMC_efficiencyPt_centrality_plot(filename, kMatchedGoodTracks, 2, 0, 20, 4);
  TOFmatchMC_efficiencyPt_centrality_plot(filename, kMatchedGoodTracks, 2, 1, 25, 4);
  TOFmatchMC_efficiencyPt_centrality_plot(filename, kMatchedGoodTracks, 3, 0, 20, 8);
  TOFmatchMC_efficiencyPt_centrality_plot(filename, kMatchedGoodTracks, 3, 1, 25, 8);
  TOFmatchMC_efficiencyPt_centrality_plot(filename, kMatchedGoodTracks, 4, 0, 20, 2);
  TOFmatchMC_efficiencyPt_centrality_plot(filename, kMatchedGoodTracks, 4, 1, 25, 2);
}

TOFmatchMC_efficiencyPt_fit(TH1 *h, TF1 *f, Int_t param)
{

  if (param >= 0) {
    for (Int_t ipar = 0; ipar < f->GetNpar(); ipar++)
      if (ipar != param)
	f->FixParameter(ipar, f->GetParameter(ipar));
      else
	f->ReleaseParameter(ipar);
  }
  else {
    for (Int_t ipar = 0; ipar < f->GetNpar(); ipar++)
      f->ReleaseParameter(ipar);
  }
  h->Fit(f);

}

TH1D *
TOFmatchMC_efficiencyPt_centrality_plot(const Char_t *filename, Int_t ihisto = kMatchedGoodTracks, Int_t ipart, Int_t icharge, Int_t marker = 20, Int_t color = 2, Option_t *opt = "")
{

  TVirtualFitter::SetMaxIterations(1000000);

  /* load HistoUtils */
  gROOT->LoadMacro("HistoUtils.C");
  
  TCanvas *cCanvas1 = new TCanvas("cCanvas1");
  TCanvas *cCanvas2 = new TCanvas("cCanvas2");
  TCanvas *cCanvas3 = new TCanvas("cCanvas3");

  Double_t ptMin[AliPID::kSPECIES] = {0.5, 0.5, 0.5, 0.5, 0.5};
  Double_t ptMax[AliPID::kSPECIES] = {3.0, 3.0, 3.0, 3.0, 5.0};

  /* fit minimum-bias efficiency pt */

  TF1 *fEff = new TF1("fEff", "[0] * TMath::Exp(-TMath::Power([1] / x, [2])) + [3] * x", ptMin[ipart], ptMax[ipart]);
  fEff->SetParameter(0, 0.5);
  fEff->SetParameter(1, 0.1);
  fEff->SetParameter(2, 2.);
  fEff->SetParameter(3, 0.);
  fEff->SetParameter(4, 0.);
  Int_t nPars = fEff->GetNpar();
  Int_t scalePar = 0.;
  TF1 *fEffCopy = new TF1(*fEff);
  
  TFile *fileout = TFile::Open(Form("%s/efficiencyPt_centrality_%s_%s.root", destdir, AliPID::ParticleName(ipart), chargeName[icharge]), "RECREATE");
  
  TFile *filein = TFile::Open(filename);
  TH1D *hEfficiencyPt = (TH1D *)filein->Get(Form("hEfficiencyPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
  hEfficiencyPt->Fit(fEff, "0", "", 0.5, 1.0);
  hEfficiencyPt->Fit(fEff, "0", "", 0.5, 1.5);
  hEfficiencyPt->Fit(fEff, "0", "", 0.5, 2.0);
  hEfficiencyPt->Fit(fEff, "0", "IMRE", ptMin[ipart], ptMax[ipart]);
  hEfficiencyPt->Fit(fEff, "0", "IMRE", ptMin[ipart], ptMax[ipart]);
  hEfficiencyPt->Fit(fEff, "0", "IMRE", ptMin[ipart], ptMax[ipart]);

  /* build efficiency profile */
  for (Int_t ipar = 0; ipar < nPars; ipar++) {
    fEffCopy->SetParameter(ipar, fEff->GetParameter(ipar));
    fEffCopy->SetParError(ipar, fEff->GetParError(ipar));
  }
  TProfile *pEfficiencyPt = new TProfile(Form("pEfficiencyPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]), Form("%s;p_{T} (GeV/c);acceptance #times efficiency;", partChargeName[ipart][icharge]), NptBins, ptBin, "s");
  HistoUtils_Function2Profile(fEffCopy, pEfficiencyPt);

  /* draw */
  cCanvas1->cd();
  pEfficiencyPt->SetMarkerStyle(marker);
  pEfficiencyPt->SetMarkerColor(color);
  pEfficiencyPt->SetMarkerSize(0);
  pEfficiencyPt->SetLineWidth(2);
  pEfficiencyPt->SetLineColor(color);
  pEfficiencyPt->SetFillStyle(3001);
  pEfficiencyPt->SetFillColor(color);
  pEfficiencyPt->GetXaxis()->SetRangeUser(ptMin[ipart] + 0.001, ptMax[ipart] - 0.001);
  pEfficiencyPt->SetStats(kFALSE);
  pEfficiencyPt->DrawCopy("E2");

  hEfficiencyPt->SetTitle(Form("%s;p_{T} (GeV/c);acceptance #times efficiency;", partChargeName[ipart][icharge]));
  hEfficiencyPt->SetMarkerStyle(marker);
  hEfficiencyPt->SetMarkerColor(color);
  hEfficiencyPt->SetMarkerSize(1.5);
  hEfficiencyPt->SetLineWidth(2);
  hEfficiencyPt->SetLineColor(color);
  hEfficiencyPt->GetXaxis()->SetRangeUser(ptMin[ipart] + 0.001, ptMax[ipart] - 0.001);
  hEfficiencyPt->SetStats(kFALSE);
  hEfficiencyPt->DrawCopy("same");
  fEff->DrawCopy("same");
  cCanvas1->Update();

  /* write */
  fileout->cd();
  pEfficiencyPt->Write("pEfficiencyPt");
  hEfficiencyPt->Write("hEfficiencyPt");
  fEff->Write("fEff");

  TH1D *hEfficiencyCent = new TH1D("hEfficiencyCent", Form("%s;centrality percentile;acceptance x efficiency scale factor;", partChargeName[ipart][icharge]), NcentralityBins, centralityBin);
  hEfficiencyCent->SetMinimum(0.9);
  hEfficiencyCent->SetMaximum(1.1);
  hEfficiencyCent->SetMarkerStyle(marker);
  hEfficiencyCent->SetMarkerColor(color);
  hEfficiencyCent->SetMarkerSize(1.5);
  hEfficiencyCent->SetLineWidth(2);
  hEfficiencyCent->SetLineColor(color);
  hEfficiencyCent->SetStats(kFALSE);
  
  TProfile *pEfficiencyPt_cent[NcentralityBins];
  TH1D *hEfficiencyPt_cent[NcentralityBins];
  TH1D *hRatioPt_cent[NcentralityBins];
  
  /* fix efficiency shape and release scale factor */
  for (Int_t ipar = 0; ipar < nPars; ipar++)
    fEff->FixParameter(ipar, fEff->GetParameter(ipar));
  fEff->ReleaseParameter(scalePar);
    
  gStyle->SetOptStat(1100);
  for (Int_t icent = 0; icent < NcentralityBins; icent++) {

    hEfficiencyPt_cent[icent] = (TH1D *)filein->Get(Form("hEfficiencyPt_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
    hEfficiencyPt_cent[icent]->Fit(fEff, "", "IME", ptMin[ipart], ptMax[ipart]);

    /* build efficiency profile */
    fEffCopy->SetParameter(scalePar, fEff->GetParameter(scalePar));
    fEffCopy->SetParError(scalePar, fEff->GetParError(scalePar));
    pEfficiencyPt_cent[icent] = new TProfile(Form("pEfficiencyPt_centrality%d_%s_%s_%s", icent, histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]), Form("%s;p_{T} (GeV/c);acceptance #times efficiency;", partChargeName[ipart][icharge]), NptBins, ptBin, "s");
    HistoUtils_Function2Profile(fEffCopy, pEfficiencyPt_cent[icent]);
    
    /* draw */
    cCanvas1->cd();
    pEfficiencyPt_cent[icent]->SetMarkerStyle(marker);
    pEfficiencyPt_cent[icent]->SetMarkerColor(color);
    pEfficiencyPt_cent[icent]->SetMarkerSize(0);
    pEfficiencyPt_cent[icent]->SetLineWidth(2);
    pEfficiencyPt_cent[icent]->SetLineColor(color);
    pEfficiencyPt_cent[icent]->SetFillStyle(3001);
    pEfficiencyPt_cent[icent]->SetFillColor(color);
    pEfficiencyPt_cent[icent]->GetXaxis()->SetRangeUser(ptMin[ipart] + 0.001, ptMax[ipart] - 0.001);
    pEfficiencyPt_cent[icent]->SetStats(kFALSE);
    pEfficiencyPt_cent[icent]->DrawCopy("E2");
    
    hEfficiencyPt_cent[icent]->SetTitle(Form("%s (%d-%d\%);p_{T} (GeV/c);acceptance #times efficiency;", partChargeName[ipart][icharge], (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]));
    hEfficiencyPt_cent[icent]->SetMarkerStyle(marker);
    hEfficiencyPt_cent[icent]->SetMarkerColor(color);
    hEfficiencyPt_cent[icent]->SetMarkerSize(1.5);
    hEfficiencyPt_cent[icent]->SetLineWidth(2);
    hEfficiencyPt_cent[icent]->SetLineColor(color);
    hEfficiencyPt_cent[icent]->GetXaxis()->SetRangeUser(ptMin[ipart] + 0.001, ptMax[ipart] - 0.001);
    hEfficiencyPt_cent[icent]->SetStats(kFALSE);
    hEfficiencyPt_cent[icent]->DrawCopy("same");
    fEff->DrawCopy("same");
    cCanvas1->Update();

    fileout->cd();
    pEfficiencyPt_cent[icent]->Write(Form("pEfficiencyPt_cent%d", icent));
    hEfficiencyPt_cent[icent]->Write(Form("hEfficiencyPt_cent%d", icent));
    fEff->Write(Form("fEff_cent%d", icent));

    hEfficiencyCent->SetBinContent(icent + 1, fEff->GetParameter(scalePar));
    hEfficiencyCent->SetBinError(icent + 1, fEff->GetParError(scalePar));

    cCanvas1->SetGridx();
    cCanvas1->SetGridy();
    cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_%s_%s.C", destdir, icent, AliPID::ParticleName(ipart), chargeName[icharge]));
    cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_%s_%s.png", destdir, icent, AliPID::ParticleName(ipart), chargeName[icharge]));
    cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_%s_%s.eps", destdir, icent, AliPID::ParticleName(ipart), chargeName[icharge]));

    hRatioPt_cent[icent] = new TH1D(*hEfficiencyPt_cent[icent]);
    hRatioPt_cent[icent]->Divide(fEff);
    hRatioPt_cent[icent]->SetTitle(Form("%s (%d-%d\%);p_{T} (GeV/c);ratio wrt. fitted dependence;", partChargeName[ipart][icharge], (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]));
    hRatioPt_cent[icent]->SetMinimum(0.75);
    hRatioPt_cent[icent]->SetMaximum(1.25);
    cCanvas2->cd();
    hRatioPt_cent[icent]->DrawCopy();
    fileout->cd();
    hRatioPt_cent[icent]->Write(Form("hRatioPt_cent%d", icent));
    

    cCanvas2->SetGridx();
    cCanvas2->SetGridy();
    cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_%s_%s.C", destdir, icent, AliPID::ParticleName(ipart), chargeName[icharge]));
    cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_%s_%s.png", destdir, icent, AliPID::ParticleName(ipart), chargeName[icharge]));
    cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_%s_%s.eps", destdir, icent, AliPID::ParticleName(ipart), chargeName[icharge]));
    
  }

  cCanvas3->cd();
  hEfficiencyCent->DrawCopy();
  fileout->cd();
  hEfficiencyCent->Write("hEfficiencyCent");
  
  cCanvas3->SetGridx();
  cCanvas3->SetGridy();
  cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_%s_%s.C", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_%s_%s.png", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_%s_%s.eps", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));

  //  hEfficiencyPt->Add(fEff, -1.);
  return hEfficiencyCent;
}


//_____________________________________________________________________________-

TH1D *
TOFmatchMC_efficiencyPt_centrality_all_plot(const Char_t *filename, Int_t ihisto = kMatchedGoodTracks, Int_t marker = 20, Int_t color = 1, Option_t *opt = "")
{

  /*
    this function measures the centrality-dependent scale factor
    of the matching efficiency, assuming that the scale factor
    is common to all particles species

    1.) first the inclusive pt-dependence is fitted for MB events with scale factor = 1.
    2.) the shape of the pt-dependence is the fixed and the scale factor released
    3.) using a fixed-shape the inclusive pt-dependence is fitted in centrality bins with only the scale factor as a free parameter    
    
  */
  
  TCanvas *cCanvas1 = new TCanvas("cCanvas1");
  TCanvas *cCanvas2 = new TCanvas("cCanvas2");

  /* pt-dependent matching efficiency function with scale factor */
  TF1 *fEff = new TF1("fEff", "[5] * [0] * TMath::Exp(-TMath::Power(x / [1], [2])) / (1. + TMath::Exp(([3] - x) / [4]))", 0., 5.0);
  fEff->SetParameter(0, 0.5);
  fEff->SetParameter(1, 0.5);
  fEff->SetParameter(2, 1.);
  fEff->SetParameter(3, 0.5);
  fEff->SetParameter(4, 0.5);
  fEff->SetParLimits(4, 0.3, 2.0);
  fEff->FixParameter(5, 1.);
  
  TFile *fileout = TFile::Open(Form("%s/efficiencyPt_MB_all.root", destdir), "RECREATE");
  
  /* fit inclusive pt-dependence in MB events */
  TFile *filein = TFile::Open(filename);
  TH1D *hEfficiencyPt = (TH1D *)filein->Get(Form("hEfficiencyAllPt_MB_%s", histoName[ihisto]));
  hEfficiencyPt->Fit(fEff, "0", "IME", 0.5, 5.0);
  hEfficiencyPt->SetTitle("all particles;p_{T} (GeV/c);acceptance #times efficiency;");
  hEfficiencyPt->SetMinimum(0.2);
  hEfficiencyPt->SetMaximum(0.7);
  hEfficiencyPt->SetMarkerStyle(marker);
  hEfficiencyPt->SetMarkerColor(color);
  hEfficiencyPt->SetMarkerSize(1.5);
  hEfficiencyPt->SetLineWidth(2);
  hEfficiencyPt->SetLineColor(color);
  hEfficiencyPt->GetXaxis()->SetRangeUser(0.5 + 0.001, 5.0 - 0.001);
  hEfficiencyPt->SetStats(kFALSE);
  cCanvas1->cd();
  hEfficiencyPt->DrawCopy();
  fEff->DrawCopy("same");
  fileout->cd();
  hEfficiencyPt->Write("hEfficiencyPt");
  fEff->Write("fEff");

  cCanvas1->SetGridx();
  cCanvas1->SetGridy();
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.C", destdir));
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.png", destdir));
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_all.eps", destdir));

  TH1D *hRatioPt = new TH1D(*hEfficiencyPt);
  hRatioPt->Divide(fEff);
  hRatioPt->SetTitle("all particles;p_{T} (GeV/c);ratio wrt. fitted dependence;");
  hRatioPt->SetMinimum(0.9);
  hRatioPt->SetMaximum(1.1);
  cCanvas2->cd();
  hRatioPt->DrawCopy();
  fileout->cd();
  hRatioPt->Write("hRatioPt");

  cCanvas2->SetGridx();
  cCanvas2->SetGridy();
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_all.C", destdir));
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_all.png", destdir));
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_all.eps", destdir));
  
  /* fix efficiency shape and release scale factor */
  fEff->FixParameter(0, fEff->GetParameter(0));
  fEff->FixParameter(1, fEff->GetParameter(1));
  fEff->FixParameter(2, fEff->GetParameter(2));
  fEff->FixParameter(3, fEff->GetParameter(3));
  fEff->FixParameter(4, fEff->GetParameter(4));
  fEff->ReleaseParameter(5);
  
  TH1D *hEfficiencyCent = new TH1D("hEfficiencyCent", "all particles;centrality percentile;acceptance x efficiency scale factor;", NcentralityBins, centralityBin);
  hEfficiencyCent->SetMinimum(0.95);
  hEfficiencyCent->SetMaximum(1.05);
  hEfficiencyCent->SetMarkerStyle(marker);
  hEfficiencyCent->SetMarkerColor(color);
  hEfficiencyCent->SetMarkerSize(1.5);
  hEfficiencyCent->SetLineWidth(2);
  hEfficiencyCent->SetLineColor(color);
  hEfficiencyCent->SetStats(kFALSE);
  
  
  /* fit inclusive pt-dependence in centrality bins
     with fixed pt-shape and free scale factor */
  TH1D *hEfficiencyPt_cent[NcentralityBins];
  TH1D *hRatioPt_cent[NcentralityBins];
  for (Int_t icent = 0; icent < NcentralityBins; icent++) {
    
    hEfficiencyPt_cent[icent] = (TH1D *)filein->Get(Form("hEfficiencyAllPt_centrality%d_%s", icent, histoName[ihisto]));
    hEfficiencyPt_cent[icent]->Fit(fEff, "", "IME", 0.5, 5.0);
    
    hEfficiencyPt_cent[icent]->SetTitle(Form("all particles (%d-%d\%);p_{T} (GeV/c);acceptance #times efficiency;", (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]));
    hEfficiencyPt_cent[icent]->SetMinimum(0.2);
    hEfficiencyPt_cent[icent]->SetMaximum(0.8);
    hEfficiencyPt_cent[icent]->SetMarkerStyle(marker);
    hEfficiencyPt_cent[icent]->SetMarkerColor(color);
    hEfficiencyPt_cent[icent]->SetMarkerSize(1.5);
    hEfficiencyPt_cent[icent]->SetLineWidth(2);
    hEfficiencyPt_cent[icent]->SetLineColor(color);
    hEfficiencyPt_cent[icent]->GetXaxis()->SetRangeUser(0.5 + 0.001, 5.0 - 0.001);
    hEfficiencyPt_cent[icent]->SetStats(kFALSE);
    cCanvas1->cd();
    hEfficiencyPt_cent[icent]->DrawCopy();
    fEff->DrawCopy("same");
    hEfficiencyPt_cent[icent]->Write(Form("hEfficiencyPt_cent%d", icent));
    fEff->Write(Form("fEff_cent%d", icent));
    
    hEfficiencyCent->SetBinContent(icent + 1, fEff->GetParameter(5));
    hEfficiencyCent->SetBinError(icent + 1, fEff->GetParError(5));
    
    cCanvas1->SetGridx();
    cCanvas1->SetGridy();
    cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.C", destdir, icent));
    cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.png", destdir, icent));
    cCanvas1->SaveAs(Form("%s/efficiencyPt_centrality%d_all.eps", destdir, icent));
    
    hRatioPt_cent[icent] = new TH1D(*hEfficiencyPt_cent[icent]);
    hRatioPt_cent[icent]->Divide(fEff);
    hRatioPt_cent[icent]->SetTitle(Form("all particles (%d-%d\%);p_{T} (GeV/c);ratio wrt. fitted dependence;", (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]));
    hRatioPt_cent[icent]->SetMinimum(0.9);
    hRatioPt_cent[icent]->SetMaximum(1.1);
    cCanvas2->cd();
    hRatioPt_cent[icent]->DrawCopy();
    fileout->cd();
    hRatioPt_cent[icent]->Write(Form("hRatioPt_cent%d", icent));

    cCanvas2->SetGridx();
    cCanvas2->SetGridy();
    cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.C", destdir, icent));
    cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.png", destdir, icent));
    cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_centrality%d_all.eps", destdir, icent));

    
  }

  TF1 *fEffCent = new TF1("fEffCent", "[0] - [1] * TMath::Exp(-[2] * TMath::Power(x, [3]))", 0., 90.);
  fEffCent->SetParameter(0, 1.02);
  fEffCent->SetParameter(1, 0.04);
  fEffCent->SetParameter(2, 0.001);
  fEffCent->SetParameter(3, 2.);
  hEfficiencyCent->Fit(fEffCent, "q0", "IME", 0., 90.);
  
  TCanvas *cCanvas3 = new TCanvas("cCanvas3");
  hEfficiencyCent->DrawCopy();
  fEffCent->DrawCopy("same");
  fileout->cd();
  hEfficiencyCent->Write("hEfficiencyCent");
  fEffCent->Write("fEffCent");
  
  cCanvas3->SetGridx();
  cCanvas3->SetGridy();
  cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.C", destdir));
  cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.png", destdir));
  cCanvas3->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_all.eps", destdir));

  TCanvas *cCanvas4 = new TCanvas("cCanvas4");

  TH1D *hRatioCent = new TH1D(*hEfficiencyCent);
  hRatioCent->Divide(fEffCent);
  hRatioCent->SetTitle(Form("all particles;centrality percentile;ratio wrt. fitted dependence;"));
  hRatioCent->SetMinimum(0.95);
  hRatioCent->SetMaximum(1.05);
  cCanvas4->cd();
  hRatioCent->DrawCopy();
  fileout->cd();
  hRatioCent->Write("hRatioCent");

  cCanvas4->SetGridx();
  cCanvas4->SetGridy();
  cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.C", destdir));
  cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.png", destdir));
  cCanvas4->SaveAs(Form("%s/efficiencyCentrality_scaleFactor_ratioFit_all.eps", destdir));
  


  //  hEfficiencyPt->Add(fEff, -1.);
  return hEfficiencyCent;
}


//_____________________________________________________________________________-

TOFmatchMC_efficiencyPt_MB_smooth_plot(const Char_t *filename)
{
  TOFmatchMC_efficiencyPt_MB_smooth_plot(filename, kMatchedGoodTracks, 2, 0, 20, 4);
  TOFmatchMC_efficiencyPt_MB_smooth_plot(filename, kMatchedGoodTracks, 2, 1, 25, 4);
  TOFmatchMC_efficiencyPt_MB_smooth_plot(filename, kMatchedGoodTracks, 3, 0, 20, 8);
  TOFmatchMC_efficiencyPt_MB_smooth_plot(filename, kMatchedGoodTracks, 3, 1, 25, 8);
  TOFmatchMC_efficiencyPt_MB_smooth_plot(filename, kMatchedGoodTracks, 4, 0, 20, 2);
  TOFmatchMC_efficiencyPt_MB_smooth_plot(filename, kMatchedGoodTracks, 4, 1, 25, 2);
}

TH1D *
TOFmatchMC_efficiencyPt_MB_smooth_plot(const Char_t *filename, Int_t ihisto = kMatchedGoodTracks, Int_t ipart, Int_t icharge, Int_t marker = 20, Int_t color = 2, Option_t *opt = "")
{
  
  TCanvas *cCanvas1 = new TCanvas("cCanvas1");
  TCanvas *cCanvas2 = new TCanvas("cCanvas2");
  
  Double_t ptMin[AliPID::kSPECIES] = {0.5, 0.5, 0.5, 0.5, 0.5};
  Double_t ptMax[AliPID::kSPECIES] = {3.0, 3.0, 3.0, 3.0, 5.0};

  TF1 *fEff = new TF1("fEff", "[0] + [1] * x - [2] * TMath::Exp(-[3] * TMath::Power(x, [4]))", 1.0, 5.0);
  fEff->SetParameter(0, 0.5);
  fEff->SetParameter(1, 0.);
  fEff->SetParameter(2, 0.5);
  fEff->SetParameter(3, 1.);
  fEff->SetParameter(4, 2.);


  TFile *filein = TFile::Open(filename);
  TH1D *hEfficiencyPt = (TH1D *)filein->Get(Form("hEfficiencyPt_MB_%s_%s_%s", histoName[ihisto], AliPID::ParticleName(ipart), chargeName[icharge]));
  hEfficiencyPt->Fit(fEff, "0", "IME", 1.0, 5.0);
  hEfficiencyPt->SetTitle(Form("%s;p_{T} (GeV/c);acceptance #times efficiency;", partChargeName[ipart][icharge]));
  hEfficiencyPt->SetMinimum(0.2);
  hEfficiencyPt->SetMaximum(0.7);
  hEfficiencyPt->SetMarkerStyle(marker);
  hEfficiencyPt->SetMarkerColor(color);
  hEfficiencyPt->SetMarkerSize(1.5);
  hEfficiencyPt->SetLineWidth(2);
  hEfficiencyPt->SetLineColor(color);
  hEfficiencyPt->GetXaxis()->SetRangeUser(ptMin[ipart] + 0.001, ptMax[ipart] - 0.001);
  hEfficiencyPt->SetStats(kFALSE);
  cCanvas1->cd();
  hEfficiencyPt->Draw(opt);
  fEff->Draw("same");

  cCanvas1->SetGridx();
  cCanvas1->SetGridy();
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_smooth_%s_%s.C", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_smooth_%s_%s.root", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_smooth_%s_%s.png", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas1->SaveAs(Form("%s/efficiencyPt_MB_smooth_%s_%s.eps", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  
  TH1D *hRatioPt = new TH1D(*hEfficiencyPt);
  hRatioPt->Divide(fEff);
  hRatioPt->SetTitle(Form("%s;p_{T} (GeV/c);ratio wrt. fitted dependence;", partChargeName[ipart][icharge]));
  hRatioPt->SetMinimum(0.9);
  hRatioPt->SetMaximum(1.1);
  cCanvas2->cd();
  hRatioPt->Draw();

  cCanvas2->SetGridx();
  cCanvas2->SetGridy();
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_smooth_%s_%s.C", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_smooth_%s_%s.root", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_smooth_%s_%s.png", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  cCanvas2->SaveAs(Form("%s/efficiencyPt_ratioFit_MB_smooth_%s_%s.eps", destdir, AliPID::ParticleName(ipart), chargeName[icharge]));
  

  /* smoothing step */
  TH1D *hEfficiencyPt_smooth = new TH1D(*hEfficiencyPt);
  Double_t ratio, value, error;
  for (Int_t ipt = 0; ipt < hRatioPt->GetNbinsX(); ipt++) {
    if (hRatioPt->GetBinCenter(ipt + 1) < 1.5) continue;
    ratio = hRatioPt->GetBinContent(ipt + 1);
    value = hEfficiencyPt->GetBinContent(ipt + 1);
    error = hEfficiencyPt->GetBinError(ipt + 1);
    value /= ratio;
    hEfficiencyPt_smooth->SetBinContent(ipt + 1, value);
  }
  new TCanvas();
  hEfficiencyPt_smooth->Draw();

  //  hEfficiencyPt->Add(fEff, -1.);
  return hEfficiencyPt;
}

TOFmatchMC_matchingEfficiency(const Char_t *filename, Bool_t useGFcorrection = kTRUE)
{

  Int_t marker[2] = {20, 21};
  Int_t color[AliPID::kSPECIES] = {1, 1, 4, 8, 2};
  Char_t *partLatex[AliPID::kSPECIES][2] = {
    "", "", "#pi^{+}", "K^{+}", "p",
    "", "", "#pi^{-}", "K^{-}", "#bar{p}"
  };

  TFile *filein = TFile::Open(filename);
  if (useGFcorrection)
    TFile *fileout = TFile::Open("TOF_matchingEfficiency.root", "RECREATE");
  else
    TFile *fileout = TFile::Open("TOF_matchingEfficiency_noGF.root", "RECREATE");
  TH1D *hEff;
  TF1 *fGF;
  Char_t title[1024];
  for (Int_t icent = -1; icent < NcentralityBins; icent++)
    for (Int_t icharge = 0; icharge < kNCharges; icharge++)
      for (Int_t ipart = 2; ipart < AliPID::kSPECIES; ipart++) {
	if (icent == -1)
	  hEff = (TH1D *)filein->Get(Form("hEfficiencyPt_MB_hMatchedCorrelatedTracks_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]));
	else
	  hEff = (TH1D *)filein->Get(Form("hEfficiencyPt_centrality%d_hMatchedCorrelatedTracks_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	/* geant-fluka correction */
	fGF = TOFmatchMC_geantflukaCorrection(ipart, icharge);
	if (useGFcorrection)
	  hEff->Divide(fGF);
	if (icent == -1)
	  sprintf(title, "%s (MB);p_{T} (GeV/c);matching efficiency;", partLatex[ipart][icharge]);
	else
	  sprintf(title, "%s (%d-%d%%);p_{T} (GeV/c);matching efficiency;", partLatex[ipart][icharge], (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]);
	hEff->SetMarkerStyle(marker[icharge]);
	hEff->SetMarkerColor(color[ipart]);
	hEff->SetLineColor(1);
	hEff->SetLineWidth(1);
	hEff->SetTitle(title);
	if (icent == -1)
	  hEff->SetName(Form("hMatchEff_MB_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]));
	else
	  hEff->SetName(Form("hMatchEff_cent%d_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	fileout->cd();
	hEff->Write();
      }
  
  fileout->Close();
}

TOFmatchMC_matchingEfficiency_mismatchCorrected(const Char_t *filename, Bool_t useGFcorrection = kTRUE)
{

  Int_t marker[2] = {20, 21};
  Int_t color[AliPID::kSPECIES] = {1, 1, 4, 8, 2};
  Char_t *partLatex[AliPID::kSPECIES][2] = {
    "", "", "#pi^{+}", "K^{+}", "p",
    "", "", "#pi^{-}", "K^{-}", "#bar{p}"
  };

  TFile *filein = TFile::Open(filename);
  if (useGFcorrection)
    TFile *fileout = TFile::Open("TOF_matchingEfficiency_mismatchCorrected.root", "RECREATE");
  else
    TFile *fileout = TFile::Open("TOF_matchingEfficiency_mismatchCorrected_noGF.root", "RECREATE");
  TH1D *hEff;
  TF1 *fGF;
  Char_t title[1024];
  for (Int_t icent = -1; icent < NcentralityBins; icent++)
    for (Int_t icharge = 0; icharge < kNCharges; icharge++)
      for (Int_t ipart = 2; ipart < AliPID::kSPECIES; ipart++) {
	if (icent == -1)
	  hEff = (TH1D *)filein->Get(Form("hEfficiencyPt_MB_hMatchedTracks_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]));
	else
	  hEff = (TH1D *)filein->Get(Form("hEfficiencyPt_centrality%d_hMatchedTracks_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	/* geant-fluka correction */
	fGF = TOFmatchMC_geantflukaCorrection(ipart, icharge);
	if (useGFcorrection)
	  hEff->Divide(fGF);
	if (icent == -1)
sprintf(title, "%s (MB);p_{T} (GeV/c);matching efficiency;", partLatex[ipart][icharge]);
	else
	  sprintf(title, "%s (%d-%d%%);p_{T} (GeV/c);matching efficiency;", partLatex[ipart][icharge], (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]);
	hEff->SetMarkerStyle(marker[icharge]);
	hEff->SetMarkerColor(color[ipart]);
	hEff->SetLineColor(1);
	hEff->SetLineWidth(1);
	hEff->SetTitle(title);
	if (icent == -1)
	  hEff->SetName(Form("hMatchEff_MB_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]));
	else
	  hEff->SetName(Form("hMatchEff_cent%d_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	fileout->cd();
	hEff->Write();
      }
  
  fileout->Close();
}

TOFmatchMC_matchingEfficiency_acceptTRDin(const Char_t *filename, Bool_t useGFcorrection = kTRUE)
{

  Int_t marker[2] = {20, 21};
  Int_t color[AliPID::kSPECIES] = {1, 1, 4, 8, 2};
  Char_t *partLatex[AliPID::kSPECIES][2] = {
    "", "", "#pi^{+}", "K^{+}", "p",
    "", "", "#pi^{-}", "K^{-}", "#bar{p}"
  };

  TFile *filein = TFile::Open(filename);
  if (useGFcorrection)
    TFile *fileout = TFile::Open("TOF_matchingEfficiency_acceptTRDin.root", "RECREATE");
  else
    TFile *fileout = TFile::Open("TOF_matchingEfficiency_acceptTRDin_noGF.root", "RECREATE");
  TH1D *hEff;
  TF1 *fGF;
  Char_t title[1024];
  for (Int_t icent = 0; icent < NcentralityBins; icent++)
    for (Int_t icharge = 0; icharge < kNCharges; icharge++)
      for (Int_t ipart = 2; ipart < AliPID::kSPECIES; ipart++) {
	hEff = (TH1D *)filein->Get(Form("hEfficiencyPt_centrality%d_hMatchedGoodTracks_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	/* geant-fluka correction */
	fGF = TOFmatchMC_geantflukaCorrection_acceptTRDin(ipart, icharge);
	if (useGFcorrection)
	  hEff->Divide(fGF);
	sprintf(title, "%s (%d-%d%%);p_{T} (GeV/c);matching efficiency;", partLatex[ipart][icharge], (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]);
	hEff->SetMarkerStyle(marker[icharge]);
	hEff->SetMarkerColor(color[ipart]);
	hEff->SetLineColor(1);
	hEff->SetLineWidth(1);
	hEff->SetTitle(title);
	hEff->SetName(Form("hMatchEff_cent%d_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	fileout->cd();
	hEff->Write();
      }
  
  fileout->Close();
}

TOFmatchMC_matchingEfficiency_rejectTRDin(const Char_t *filename, Bool_t useGFcorrection = kTRUE)
{

  Int_t marker[2] = {20, 21};
  Int_t color[AliPID::kSPECIES] = {1, 1, 4, 8, 2};
  Char_t *partLatex[AliPID::kSPECIES][2] = {
    "", "", "#pi^{+}", "K^{+}", "p",
    "", "", "#pi^{-}", "K^{-}", "#bar{p}"
  };

  TFile *filein = TFile::Open(filename);
  if (useGFcorrection)
    TFile *fileout = TFile::Open("TOF_matchingEfficiency_rejectTRDin.root", "RECREATE");
  else
    TFile *fileout = TFile::Open("TOF_matchingEfficiency_rejectTRDin_noGF.root", "RECREATE");
  TH1D *hEff;
  TF1 *fGF;
  Char_t title[1024];
  for (Int_t icent = 0; icent < NcentralityBins; icent++)
    for (Int_t icharge = 0; icharge < kNCharges; icharge++)
      for (Int_t ipart = 2; ipart < AliPID::kSPECIES; ipart++) {
	hEff = (TH1D *)filein->Get(Form("hEfficiencyPt_centrality%d_hMatchedGoodTracks_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	/* geant-fluka correction */
	fGF = TOFmatchMC_geantflukaCorrection_rejectTRDin(ipart, icharge);
	if (useGFcorrection)
	  hEff->Divide(fGF);
	sprintf(title, "%s (%d-%d%%);p_{T} (GeV/c);matching efficiency;", partLatex[ipart][icharge], (Int_t)centralityBin[icent], (Int_t)centralityBin[icent + 1]);
	hEff->SetMarkerStyle(marker[icharge]);
	hEff->SetMarkerColor(color[ipart]);
	hEff->SetLineColor(1);
	hEff->SetLineWidth(1);
	hEff->SetTitle(title);
	hEff->SetName(Form("hMatchEff_cent%d_%s_%s", icent, AliPID::ParticleName(ipart), chargeName[icharge]));
	fileout->cd();
	hEff->Write();
      }
  
  fileout->Close();
}

TF1 *
TOFmatchMC_geantflukaCorrection(Int_t ipart, Int_t icharge)
{

  if (ipart == 3 && icharge == kNegative) {
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionKaMinus(x)", 0., 5.);
    return f;
  }
  //  else if (ipart == 4 && icharge == kNegative) {
  //    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionPrMinus(x)", 0., 5.);
  //  }
  else
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionNull(x)", 0., 5.);

  return f;
}


TF1 *
TOFmatchMC_geantflukaCorrection_acceptTRDin(Int_t ipart, Int_t icharge)
{

  if (ipart == 3 && icharge == kNegative) {
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionKaMinus_acceptTRDin(x)", 0., 5.);
    return f;
  }
  else if (ipart == 4 && icharge == kNegative) {
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionPrMinus_acceptTRDin(x)", 0., 5.);
  }
  else
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionNull(x)", 0., 5.);

  return f;
}


TF1 *
TOFmatchMC_geantflukaCorrection_rejectTRDin(Int_t ipart, Int_t icharge)
{

  if (ipart == 3 && icharge == kNegative) {
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionKaMinus_rejectTRDin(x)", 0., 5.);
    return f;
  }
  else if (ipart == 4 && icharge == kNegative) {
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionPrMinus_rejectTRDin(x)", 0., 5.);
  }
  else
    TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), chargeName[icharge]), "MatchingPtGeantFlukaCorrectionNull(x)", 0., 5.);

  return f;
}


Double_t
MatchingPtGeantFlukaCorrectionNull(Double_t pTmc)
{
  return 1.;
}

Double_t 
MatchingPtGeantFlukaCorrectionPrMinus(Double_t pTmc, Int_t ntrd = 12)
{
  Float_t ptTPCoutP =pTmc*(1-6.81059e-01*TMath::Exp(-pTmc*4.20094));
  Float_t scale = (ntrd * 0.14638485 + (18 - ntrd) * 0.02406) / 18.;
  return (TMath::Power(1 - 0.129758*TMath::Exp(-ptTPCoutP*0.679612),scale/0.03471));
}

Double_t 
MatchingPtGeantFlukaCorrectionPrMinus_acceptTRDin(Double_t pTmc)
{
  Float_t ptTPCoutP =pTmc*(1-6.81059e-01*TMath::Exp(-pTmc*4.20094));
  return (TMath::Power(1 - 0.129758*TMath::Exp(-ptTPCoutP*0.679612),0.14638485/0.03471));
}

Double_t 
MatchingPtGeantFlukaCorrectionPrMinus_rejectTRDin(Double_t pTmc)
{
  Float_t ptTPCoutP =pTmc*(1-6.81059e-01*TMath::Exp(-pTmc*4.20094));
  return (TMath::Power(1 - 0.129758*TMath::Exp(-ptTPCoutP*0.679612),0.02406/0.03471));
}

Double_t
MatchingPtGeantFlukaCorrectionKaMinus(Double_t pTmc, Int_t ntrd = 12)
{
  Float_t ptTPCoutK=pTmc*(1- 3.37297e-03/pTmc/pTmc - 3.26544e-03/pTmc);
  Float_t scale = (ntrd * 0.14638485 + (18 - ntrd) * 0.02406) / 18.;
  return TMath::Min((TMath::Power(0.972865 + 0.0117093*ptTPCoutK,scale/0.03471)), 1.);
}

Double_t
MatchingPtGeantFlukaCorrectionKaMinus_acceptTRDin(Double_t pTmc)
{
  Float_t ptTPCoutK=pTmc*(1- 3.37297e-03/pTmc/pTmc - 3.26544e-03/pTmc);
  return TMath::Min((TMath::Power(0.972865 + 0.0117093*ptTPCoutK,0.14638485/0.03471)), 1.);
}

Double_t
MatchingPtGeantFlukaCorrectionKaMinus_rejectTRDin(Double_t pTmc)
{
  Float_t ptTPCoutK=pTmc*(1- 3.37297e-03/pTmc/pTmc - 3.26544e-03/pTmc);
  return TMath::Min((TMath::Power(0.972865 + 0.0117093*ptTPCoutK,0.02406/0.03471)), 1.);
}
 TOFmatchMC.C:1
 TOFmatchMC.C:2
 TOFmatchMC.C:3
 TOFmatchMC.C:4
 TOFmatchMC.C:5
 TOFmatchMC.C:6
 TOFmatchMC.C:7
 TOFmatchMC.C:8
 TOFmatchMC.C:9
 TOFmatchMC.C:10
 TOFmatchMC.C:11
 TOFmatchMC.C:12
 TOFmatchMC.C:13
 TOFmatchMC.C:14
 TOFmatchMC.C:15
 TOFmatchMC.C:16
 TOFmatchMC.C:17
 TOFmatchMC.C:18
 TOFmatchMC.C:19
 TOFmatchMC.C:20
 TOFmatchMC.C:21
 TOFmatchMC.C:22
 TOFmatchMC.C:23
 TOFmatchMC.C:24
 TOFmatchMC.C:25
 TOFmatchMC.C:26
 TOFmatchMC.C:27
 TOFmatchMC.C:28
 TOFmatchMC.C:29
 TOFmatchMC.C:30
 TOFmatchMC.C:31
 TOFmatchMC.C:32
 TOFmatchMC.C:33
 TOFmatchMC.C:34
 TOFmatchMC.C:35
 TOFmatchMC.C:36
 TOFmatchMC.C:37
 TOFmatchMC.C:38
 TOFmatchMC.C:39
 TOFmatchMC.C:40
 TOFmatchMC.C:41
 TOFmatchMC.C:42
 TOFmatchMC.C:43
 TOFmatchMC.C:44
 TOFmatchMC.C:45
 TOFmatchMC.C:46
 TOFmatchMC.C:47
 TOFmatchMC.C:48
 TOFmatchMC.C:49
 TOFmatchMC.C:50
 TOFmatchMC.C:51
 TOFmatchMC.C:52
 TOFmatchMC.C:53
 TOFmatchMC.C:54
 TOFmatchMC.C:55
 TOFmatchMC.C:56
 TOFmatchMC.C:57
 TOFmatchMC.C:58
 TOFmatchMC.C:59
 TOFmatchMC.C:60
 TOFmatchMC.C:61
 TOFmatchMC.C:62
 TOFmatchMC.C:63
 TOFmatchMC.C:64
 TOFmatchMC.C:65
 TOFmatchMC.C:66
 TOFmatchMC.C:67
 TOFmatchMC.C:68
 TOFmatchMC.C:69
 TOFmatchMC.C:70
 TOFmatchMC.C:71
 TOFmatchMC.C:72
 TOFmatchMC.C:73
 TOFmatchMC.C:74
 TOFmatchMC.C:75
 TOFmatchMC.C:76
 TOFmatchMC.C:77
 TOFmatchMC.C:78
 TOFmatchMC.C:79
 TOFmatchMC.C:80
 TOFmatchMC.C:81
 TOFmatchMC.C:82
 TOFmatchMC.C:83
 TOFmatchMC.C:84
 TOFmatchMC.C:85
 TOFmatchMC.C:86
 TOFmatchMC.C:87
 TOFmatchMC.C:88
 TOFmatchMC.C:89
 TOFmatchMC.C:90
 TOFmatchMC.C:91
 TOFmatchMC.C:92
 TOFmatchMC.C:93
 TOFmatchMC.C:94
 TOFmatchMC.C:95
 TOFmatchMC.C:96
 TOFmatchMC.C:97
 TOFmatchMC.C:98
 TOFmatchMC.C:99
 TOFmatchMC.C:100
 TOFmatchMC.C:101
 TOFmatchMC.C:102
 TOFmatchMC.C:103
 TOFmatchMC.C:104
 TOFmatchMC.C:105
 TOFmatchMC.C:106
 TOFmatchMC.C:107
 TOFmatchMC.C:108
 TOFmatchMC.C:109
 TOFmatchMC.C:110
 TOFmatchMC.C:111
 TOFmatchMC.C:112
 TOFmatchMC.C:113
 TOFmatchMC.C:114
 TOFmatchMC.C:115
 TOFmatchMC.C:116
 TOFmatchMC.C:117
 TOFmatchMC.C:118
 TOFmatchMC.C:119
 TOFmatchMC.C:120
 TOFmatchMC.C:121
 TOFmatchMC.C:122
 TOFmatchMC.C:123
 TOFmatchMC.C:124
 TOFmatchMC.C:125
 TOFmatchMC.C:126
 TOFmatchMC.C:127
 TOFmatchMC.C:128
 TOFmatchMC.C:129
 TOFmatchMC.C:130
 TOFmatchMC.C:131
 TOFmatchMC.C:132
 TOFmatchMC.C:133
 TOFmatchMC.C:134
 TOFmatchMC.C:135
 TOFmatchMC.C:136
 TOFmatchMC.C:137
 TOFmatchMC.C:138
 TOFmatchMC.C:139
 TOFmatchMC.C:140
 TOFmatchMC.C:141
 TOFmatchMC.C:142
 TOFmatchMC.C:143
 TOFmatchMC.C:144
 TOFmatchMC.C:145
 TOFmatchMC.C:146
 TOFmatchMC.C:147
 TOFmatchMC.C:148
 TOFmatchMC.C:149
 TOFmatchMC.C:150
 TOFmatchMC.C:151
 TOFmatchMC.C:152
 TOFmatchMC.C:153
 TOFmatchMC.C:154
 TOFmatchMC.C:155
 TOFmatchMC.C:156
 TOFmatchMC.C:157
 TOFmatchMC.C:158
 TOFmatchMC.C:159
 TOFmatchMC.C:160
 TOFmatchMC.C:161
 TOFmatchMC.C:162
 TOFmatchMC.C:163
 TOFmatchMC.C:164
 TOFmatchMC.C:165
 TOFmatchMC.C:166
 TOFmatchMC.C:167
 TOFmatchMC.C:168
 TOFmatchMC.C:169
 TOFmatchMC.C:170
 TOFmatchMC.C:171
 TOFmatchMC.C:172
 TOFmatchMC.C:173
 TOFmatchMC.C:174
 TOFmatchMC.C:175
 TOFmatchMC.C:176
 TOFmatchMC.C:177
 TOFmatchMC.C:178
 TOFmatchMC.C:179
 TOFmatchMC.C:180
 TOFmatchMC.C:181
 TOFmatchMC.C:182
 TOFmatchMC.C:183
 TOFmatchMC.C:184
 TOFmatchMC.C:185
 TOFmatchMC.C:186
 TOFmatchMC.C:187
 TOFmatchMC.C:188
 TOFmatchMC.C:189
 TOFmatchMC.C:190
 TOFmatchMC.C:191
 TOFmatchMC.C:192
 TOFmatchMC.C:193
 TOFmatchMC.C:194
 TOFmatchMC.C:195
 TOFmatchMC.C:196
 TOFmatchMC.C:197
 TOFmatchMC.C:198
 TOFmatchMC.C:199
 TOFmatchMC.C:200
 TOFmatchMC.C:201
 TOFmatchMC.C:202
 TOFmatchMC.C:203
 TOFmatchMC.C:204
 TOFmatchMC.C:205
 TOFmatchMC.C:206
 TOFmatchMC.C:207
 TOFmatchMC.C:208
 TOFmatchMC.C:209
 TOFmatchMC.C:210
 TOFmatchMC.C:211
 TOFmatchMC.C:212
 TOFmatchMC.C:213
 TOFmatchMC.C:214
 TOFmatchMC.C:215
 TOFmatchMC.C:216
 TOFmatchMC.C:217
 TOFmatchMC.C:218
 TOFmatchMC.C:219
 TOFmatchMC.C:220
 TOFmatchMC.C:221
 TOFmatchMC.C:222
 TOFmatchMC.C:223
 TOFmatchMC.C:224
 TOFmatchMC.C:225
 TOFmatchMC.C:226
 TOFmatchMC.C:227
 TOFmatchMC.C:228
 TOFmatchMC.C:229
 TOFmatchMC.C:230
 TOFmatchMC.C:231
 TOFmatchMC.C:232
 TOFmatchMC.C:233
 TOFmatchMC.C:234
 TOFmatchMC.C:235
 TOFmatchMC.C:236
 TOFmatchMC.C:237
 TOFmatchMC.C:238
 TOFmatchMC.C:239
 TOFmatchMC.C:240
 TOFmatchMC.C:241
 TOFmatchMC.C:242
 TOFmatchMC.C:243
 TOFmatchMC.C:244
 TOFmatchMC.C:245
 TOFmatchMC.C:246
 TOFmatchMC.C:247
 TOFmatchMC.C:248
 TOFmatchMC.C:249
 TOFmatchMC.C:250
 TOFmatchMC.C:251
 TOFmatchMC.C:252
 TOFmatchMC.C:253
 TOFmatchMC.C:254
 TOFmatchMC.C:255
 TOFmatchMC.C:256
 TOFmatchMC.C:257
 TOFmatchMC.C:258
 TOFmatchMC.C:259
 TOFmatchMC.C:260
 TOFmatchMC.C:261
 TOFmatchMC.C:262
 TOFmatchMC.C:263
 TOFmatchMC.C:264
 TOFmatchMC.C:265
 TOFmatchMC.C:266
 TOFmatchMC.C:267
 TOFmatchMC.C:268
 TOFmatchMC.C:269
 TOFmatchMC.C:270
 TOFmatchMC.C:271
 TOFmatchMC.C:272
 TOFmatchMC.C:273
 TOFmatchMC.C:274
 TOFmatchMC.C:275
 TOFmatchMC.C:276
 TOFmatchMC.C:277
 TOFmatchMC.C:278
 TOFmatchMC.C:279
 TOFmatchMC.C:280
 TOFmatchMC.C:281
 TOFmatchMC.C:282
 TOFmatchMC.C:283
 TOFmatchMC.C:284
 TOFmatchMC.C:285
 TOFmatchMC.C:286
 TOFmatchMC.C:287
 TOFmatchMC.C:288
 TOFmatchMC.C:289
 TOFmatchMC.C:290
 TOFmatchMC.C:291
 TOFmatchMC.C:292
 TOFmatchMC.C:293
 TOFmatchMC.C:294
 TOFmatchMC.C:295
 TOFmatchMC.C:296
 TOFmatchMC.C:297
 TOFmatchMC.C:298
 TOFmatchMC.C:299
 TOFmatchMC.C:300
 TOFmatchMC.C:301
 TOFmatchMC.C:302
 TOFmatchMC.C:303
 TOFmatchMC.C:304
 TOFmatchMC.C:305
 TOFmatchMC.C:306
 TOFmatchMC.C:307
 TOFmatchMC.C:308
 TOFmatchMC.C:309
 TOFmatchMC.C:310
 TOFmatchMC.C:311
 TOFmatchMC.C:312
 TOFmatchMC.C:313
 TOFmatchMC.C:314
 TOFmatchMC.C:315
 TOFmatchMC.C:316
 TOFmatchMC.C:317
 TOFmatchMC.C:318
 TOFmatchMC.C:319
 TOFmatchMC.C:320
 TOFmatchMC.C:321
 TOFmatchMC.C:322
 TOFmatchMC.C:323
 TOFmatchMC.C:324
 TOFmatchMC.C:325
 TOFmatchMC.C:326
 TOFmatchMC.C:327
 TOFmatchMC.C:328
 TOFmatchMC.C:329
 TOFmatchMC.C:330
 TOFmatchMC.C:331
 TOFmatchMC.C:332
 TOFmatchMC.C:333
 TOFmatchMC.C:334
 TOFmatchMC.C:335
 TOFmatchMC.C:336
 TOFmatchMC.C:337
 TOFmatchMC.C:338
 TOFmatchMC.C:339
 TOFmatchMC.C:340
 TOFmatchMC.C:341
 TOFmatchMC.C:342
 TOFmatchMC.C:343
 TOFmatchMC.C:344
 TOFmatchMC.C:345
 TOFmatchMC.C:346
 TOFmatchMC.C:347
 TOFmatchMC.C:348
 TOFmatchMC.C:349
 TOFmatchMC.C:350
 TOFmatchMC.C:351
 TOFmatchMC.C:352
 TOFmatchMC.C:353
 TOFmatchMC.C:354
 TOFmatchMC.C:355
 TOFmatchMC.C:356
 TOFmatchMC.C:357
 TOFmatchMC.C:358
 TOFmatchMC.C:359
 TOFmatchMC.C:360
 TOFmatchMC.C:361
 TOFmatchMC.C:362
 TOFmatchMC.C:363
 TOFmatchMC.C:364
 TOFmatchMC.C:365
 TOFmatchMC.C:366
 TOFmatchMC.C:367
 TOFmatchMC.C:368
 TOFmatchMC.C:369
 TOFmatchMC.C:370
 TOFmatchMC.C:371
 TOFmatchMC.C:372
 TOFmatchMC.C:373
 TOFmatchMC.C:374
 TOFmatchMC.C:375
 TOFmatchMC.C:376
 TOFmatchMC.C:377
 TOFmatchMC.C:378
 TOFmatchMC.C:379
 TOFmatchMC.C:380
 TOFmatchMC.C:381
 TOFmatchMC.C:382
 TOFmatchMC.C:383
 TOFmatchMC.C:384
 TOFmatchMC.C:385
 TOFmatchMC.C:386
 TOFmatchMC.C:387
 TOFmatchMC.C:388
 TOFmatchMC.C:389
 TOFmatchMC.C:390
 TOFmatchMC.C:391
 TOFmatchMC.C:392
 TOFmatchMC.C:393
 TOFmatchMC.C:394
 TOFmatchMC.C:395
 TOFmatchMC.C:396
 TOFmatchMC.C:397
 TOFmatchMC.C:398
 TOFmatchMC.C:399
 TOFmatchMC.C:400
 TOFmatchMC.C:401
 TOFmatchMC.C:402
 TOFmatchMC.C:403
 TOFmatchMC.C:404
 TOFmatchMC.C:405
 TOFmatchMC.C:406
 TOFmatchMC.C:407
 TOFmatchMC.C:408
 TOFmatchMC.C:409
 TOFmatchMC.C:410
 TOFmatchMC.C:411
 TOFmatchMC.C:412
 TOFmatchMC.C:413
 TOFmatchMC.C:414
 TOFmatchMC.C:415
 TOFmatchMC.C:416
 TOFmatchMC.C:417
 TOFmatchMC.C:418
 TOFmatchMC.C:419
 TOFmatchMC.C:420
 TOFmatchMC.C:421
 TOFmatchMC.C:422
 TOFmatchMC.C:423
 TOFmatchMC.C:424
 TOFmatchMC.C:425
 TOFmatchMC.C:426
 TOFmatchMC.C:427
 TOFmatchMC.C:428
 TOFmatchMC.C:429
 TOFmatchMC.C:430
 TOFmatchMC.C:431
 TOFmatchMC.C:432
 TOFmatchMC.C:433
 TOFmatchMC.C:434
 TOFmatchMC.C:435
 TOFmatchMC.C:436
 TOFmatchMC.C:437
 TOFmatchMC.C:438
 TOFmatchMC.C:439
 TOFmatchMC.C:440
 TOFmatchMC.C:441
 TOFmatchMC.C:442
 TOFmatchMC.C:443
 TOFmatchMC.C:444
 TOFmatchMC.C:445
 TOFmatchMC.C:446
 TOFmatchMC.C:447
 TOFmatchMC.C:448
 TOFmatchMC.C:449
 TOFmatchMC.C:450
 TOFmatchMC.C:451
 TOFmatchMC.C:452
 TOFmatchMC.C:453
 TOFmatchMC.C:454
 TOFmatchMC.C:455
 TOFmatchMC.C:456
 TOFmatchMC.C:457
 TOFmatchMC.C:458
 TOFmatchMC.C:459
 TOFmatchMC.C:460
 TOFmatchMC.C:461
 TOFmatchMC.C:462
 TOFmatchMC.C:463
 TOFmatchMC.C:464
 TOFmatchMC.C:465
 TOFmatchMC.C:466
 TOFmatchMC.C:467
 TOFmatchMC.C:468
 TOFmatchMC.C:469
 TOFmatchMC.C:470
 TOFmatchMC.C:471
 TOFmatchMC.C:472
 TOFmatchMC.C:473
 TOFmatchMC.C:474
 TOFmatchMC.C:475
 TOFmatchMC.C:476
 TOFmatchMC.C:477
 TOFmatchMC.C:478
 TOFmatchMC.C:479
 TOFmatchMC.C:480
 TOFmatchMC.C:481
 TOFmatchMC.C:482
 TOFmatchMC.C:483
 TOFmatchMC.C:484
 TOFmatchMC.C:485
 TOFmatchMC.C:486
 TOFmatchMC.C:487
 TOFmatchMC.C:488
 TOFmatchMC.C:489
 TOFmatchMC.C:490
 TOFmatchMC.C:491
 TOFmatchMC.C:492
 TOFmatchMC.C:493
 TOFmatchMC.C:494
 TOFmatchMC.C:495
 TOFmatchMC.C:496
 TOFmatchMC.C:497
 TOFmatchMC.C:498
 TOFmatchMC.C:499
 TOFmatchMC.C:500
 TOFmatchMC.C:501
 TOFmatchMC.C:502
 TOFmatchMC.C:503
 TOFmatchMC.C:504
 TOFmatchMC.C:505
 TOFmatchMC.C:506
 TOFmatchMC.C:507
 TOFmatchMC.C:508
 TOFmatchMC.C:509
 TOFmatchMC.C:510
 TOFmatchMC.C:511
 TOFmatchMC.C:512
 TOFmatchMC.C:513
 TOFmatchMC.C:514
 TOFmatchMC.C:515
 TOFmatchMC.C:516
 TOFmatchMC.C:517
 TOFmatchMC.C:518
 TOFmatchMC.C:519
 TOFmatchMC.C:520
 TOFmatchMC.C:521
 TOFmatchMC.C:522
 TOFmatchMC.C:523
 TOFmatchMC.C:524
 TOFmatchMC.C:525
 TOFmatchMC.C:526
 TOFmatchMC.C:527
 TOFmatchMC.C:528
 TOFmatchMC.C:529
 TOFmatchMC.C:530
 TOFmatchMC.C:531
 TOFmatchMC.C:532
 TOFmatchMC.C:533
 TOFmatchMC.C:534
 TOFmatchMC.C:535
 TOFmatchMC.C:536
 TOFmatchMC.C:537
 TOFmatchMC.C:538
 TOFmatchMC.C:539
 TOFmatchMC.C:540
 TOFmatchMC.C:541
 TOFmatchMC.C:542
 TOFmatchMC.C:543
 TOFmatchMC.C:544
 TOFmatchMC.C:545
 TOFmatchMC.C:546
 TOFmatchMC.C:547
 TOFmatchMC.C:548
 TOFmatchMC.C:549
 TOFmatchMC.C:550
 TOFmatchMC.C:551
 TOFmatchMC.C:552
 TOFmatchMC.C:553
 TOFmatchMC.C:554
 TOFmatchMC.C:555
 TOFmatchMC.C:556
 TOFmatchMC.C:557
 TOFmatchMC.C:558
 TOFmatchMC.C:559
 TOFmatchMC.C:560
 TOFmatchMC.C:561
 TOFmatchMC.C:562
 TOFmatchMC.C:563
 TOFmatchMC.C:564
 TOFmatchMC.C:565
 TOFmatchMC.C:566
 TOFmatchMC.C:567
 TOFmatchMC.C:568
 TOFmatchMC.C:569
 TOFmatchMC.C:570
 TOFmatchMC.C:571
 TOFmatchMC.C:572
 TOFmatchMC.C:573
 TOFmatchMC.C:574
 TOFmatchMC.C:575
 TOFmatchMC.C:576
 TOFmatchMC.C:577
 TOFmatchMC.C:578
 TOFmatchMC.C:579
 TOFmatchMC.C:580
 TOFmatchMC.C:581
 TOFmatchMC.C:582
 TOFmatchMC.C:583
 TOFmatchMC.C:584
 TOFmatchMC.C:585
 TOFmatchMC.C:586
 TOFmatchMC.C:587
 TOFmatchMC.C:588
 TOFmatchMC.C:589
 TOFmatchMC.C:590
 TOFmatchMC.C:591
 TOFmatchMC.C:592
 TOFmatchMC.C:593
 TOFmatchMC.C:594
 TOFmatchMC.C:595
 TOFmatchMC.C:596
 TOFmatchMC.C:597
 TOFmatchMC.C:598
 TOFmatchMC.C:599
 TOFmatchMC.C:600
 TOFmatchMC.C:601
 TOFmatchMC.C:602
 TOFmatchMC.C:603
 TOFmatchMC.C:604
 TOFmatchMC.C:605
 TOFmatchMC.C:606
 TOFmatchMC.C:607
 TOFmatchMC.C:608
 TOFmatchMC.C:609
 TOFmatchMC.C:610
 TOFmatchMC.C:611
 TOFmatchMC.C:612
 TOFmatchMC.C:613
 TOFmatchMC.C:614
 TOFmatchMC.C:615
 TOFmatchMC.C:616
 TOFmatchMC.C:617
 TOFmatchMC.C:618
 TOFmatchMC.C:619
 TOFmatchMC.C:620
 TOFmatchMC.C:621
 TOFmatchMC.C:622
 TOFmatchMC.C:623
 TOFmatchMC.C:624
 TOFmatchMC.C:625
 TOFmatchMC.C:626
 TOFmatchMC.C:627
 TOFmatchMC.C:628
 TOFmatchMC.C:629
 TOFmatchMC.C:630
 TOFmatchMC.C:631
 TOFmatchMC.C:632
 TOFmatchMC.C:633
 TOFmatchMC.C:634
 TOFmatchMC.C:635
 TOFmatchMC.C:636
 TOFmatchMC.C:637
 TOFmatchMC.C:638
 TOFmatchMC.C:639
 TOFmatchMC.C:640
 TOFmatchMC.C:641
 TOFmatchMC.C:642
 TOFmatchMC.C:643
 TOFmatchMC.C:644
 TOFmatchMC.C:645
 TOFmatchMC.C:646
 TOFmatchMC.C:647
 TOFmatchMC.C:648
 TOFmatchMC.C:649
 TOFmatchMC.C:650
 TOFmatchMC.C:651
 TOFmatchMC.C:652
 TOFmatchMC.C:653
 TOFmatchMC.C:654
 TOFmatchMC.C:655
 TOFmatchMC.C:656
 TOFmatchMC.C:657
 TOFmatchMC.C:658
 TOFmatchMC.C:659
 TOFmatchMC.C:660
 TOFmatchMC.C:661
 TOFmatchMC.C:662
 TOFmatchMC.C:663
 TOFmatchMC.C:664
 TOFmatchMC.C:665
 TOFmatchMC.C:666
 TOFmatchMC.C:667
 TOFmatchMC.C:668
 TOFmatchMC.C:669
 TOFmatchMC.C:670
 TOFmatchMC.C:671
 TOFmatchMC.C:672
 TOFmatchMC.C:673
 TOFmatchMC.C:674
 TOFmatchMC.C:675
 TOFmatchMC.C:676
 TOFmatchMC.C:677
 TOFmatchMC.C:678
 TOFmatchMC.C:679
 TOFmatchMC.C:680
 TOFmatchMC.C:681
 TOFmatchMC.C:682
 TOFmatchMC.C:683
 TOFmatchMC.C:684
 TOFmatchMC.C:685
 TOFmatchMC.C:686
 TOFmatchMC.C:687
 TOFmatchMC.C:688
 TOFmatchMC.C:689
 TOFmatchMC.C:690
 TOFmatchMC.C:691
 TOFmatchMC.C:692
 TOFmatchMC.C:693
 TOFmatchMC.C:694
 TOFmatchMC.C:695
 TOFmatchMC.C:696
 TOFmatchMC.C:697
 TOFmatchMC.C:698
 TOFmatchMC.C:699
 TOFmatchMC.C:700
 TOFmatchMC.C:701
 TOFmatchMC.C:702
 TOFmatchMC.C:703
 TOFmatchMC.C:704
 TOFmatchMC.C:705
 TOFmatchMC.C:706
 TOFmatchMC.C:707
 TOFmatchMC.C:708
 TOFmatchMC.C:709
 TOFmatchMC.C:710
 TOFmatchMC.C:711
 TOFmatchMC.C:712
 TOFmatchMC.C:713
 TOFmatchMC.C:714
 TOFmatchMC.C:715
 TOFmatchMC.C:716
 TOFmatchMC.C:717
 TOFmatchMC.C:718
 TOFmatchMC.C:719
 TOFmatchMC.C:720
 TOFmatchMC.C:721
 TOFmatchMC.C:722
 TOFmatchMC.C:723
 TOFmatchMC.C:724
 TOFmatchMC.C:725
 TOFmatchMC.C:726
 TOFmatchMC.C:727
 TOFmatchMC.C:728
 TOFmatchMC.C:729
 TOFmatchMC.C:730
 TOFmatchMC.C:731
 TOFmatchMC.C:732
 TOFmatchMC.C:733
 TOFmatchMC.C:734
 TOFmatchMC.C:735
 TOFmatchMC.C:736
 TOFmatchMC.C:737
 TOFmatchMC.C:738
 TOFmatchMC.C:739
 TOFmatchMC.C:740
 TOFmatchMC.C:741
 TOFmatchMC.C:742
 TOFmatchMC.C:743
 TOFmatchMC.C:744
 TOFmatchMC.C:745
 TOFmatchMC.C:746
 TOFmatchMC.C:747
 TOFmatchMC.C:748
 TOFmatchMC.C:749
 TOFmatchMC.C:750
 TOFmatchMC.C:751
 TOFmatchMC.C:752
 TOFmatchMC.C:753
 TOFmatchMC.C:754
 TOFmatchMC.C:755
 TOFmatchMC.C:756
 TOFmatchMC.C:757
 TOFmatchMC.C:758
 TOFmatchMC.C:759
 TOFmatchMC.C:760
 TOFmatchMC.C:761
 TOFmatchMC.C:762
 TOFmatchMC.C:763
 TOFmatchMC.C:764
 TOFmatchMC.C:765
 TOFmatchMC.C:766
 TOFmatchMC.C:767
 TOFmatchMC.C:768
 TOFmatchMC.C:769
 TOFmatchMC.C:770
 TOFmatchMC.C:771
 TOFmatchMC.C:772
 TOFmatchMC.C:773
 TOFmatchMC.C:774
 TOFmatchMC.C:775
 TOFmatchMC.C:776
 TOFmatchMC.C:777
 TOFmatchMC.C:778
 TOFmatchMC.C:779
 TOFmatchMC.C:780
 TOFmatchMC.C:781
 TOFmatchMC.C:782
 TOFmatchMC.C:783
 TOFmatchMC.C:784
 TOFmatchMC.C:785
 TOFmatchMC.C:786
 TOFmatchMC.C:787
 TOFmatchMC.C:788
 TOFmatchMC.C:789
 TOFmatchMC.C:790
 TOFmatchMC.C:791
 TOFmatchMC.C:792
 TOFmatchMC.C:793
 TOFmatchMC.C:794
 TOFmatchMC.C:795
 TOFmatchMC.C:796
 TOFmatchMC.C:797
 TOFmatchMC.C:798
 TOFmatchMC.C:799
 TOFmatchMC.C:800
 TOFmatchMC.C:801
 TOFmatchMC.C:802
 TOFmatchMC.C:803
 TOFmatchMC.C:804
 TOFmatchMC.C:805
 TOFmatchMC.C:806
 TOFmatchMC.C:807
 TOFmatchMC.C:808
 TOFmatchMC.C:809
 TOFmatchMC.C:810
 TOFmatchMC.C:811
 TOFmatchMC.C:812
 TOFmatchMC.C:813
 TOFmatchMC.C:814
 TOFmatchMC.C:815
 TOFmatchMC.C:816
 TOFmatchMC.C:817
 TOFmatchMC.C:818
 TOFmatchMC.C:819
 TOFmatchMC.C:820
 TOFmatchMC.C:821
 TOFmatchMC.C:822
 TOFmatchMC.C:823
 TOFmatchMC.C:824
 TOFmatchMC.C:825
 TOFmatchMC.C:826
 TOFmatchMC.C:827
 TOFmatchMC.C:828
 TOFmatchMC.C:829
 TOFmatchMC.C:830
 TOFmatchMC.C:831
 TOFmatchMC.C:832
 TOFmatchMC.C:833
 TOFmatchMC.C:834
 TOFmatchMC.C:835
 TOFmatchMC.C:836
 TOFmatchMC.C:837
 TOFmatchMC.C:838
 TOFmatchMC.C:839
 TOFmatchMC.C:840
 TOFmatchMC.C:841
 TOFmatchMC.C:842
 TOFmatchMC.C:843
 TOFmatchMC.C:844
 TOFmatchMC.C:845
 TOFmatchMC.C:846
 TOFmatchMC.C:847
 TOFmatchMC.C:848
 TOFmatchMC.C:849
 TOFmatchMC.C:850
 TOFmatchMC.C:851
 TOFmatchMC.C:852
 TOFmatchMC.C:853
 TOFmatchMC.C:854
 TOFmatchMC.C:855
 TOFmatchMC.C:856
 TOFmatchMC.C:857
 TOFmatchMC.C:858
 TOFmatchMC.C:859
 TOFmatchMC.C:860
 TOFmatchMC.C:861
 TOFmatchMC.C:862
 TOFmatchMC.C:863
 TOFmatchMC.C:864
 TOFmatchMC.C:865
 TOFmatchMC.C:866
 TOFmatchMC.C:867
 TOFmatchMC.C:868
 TOFmatchMC.C:869
 TOFmatchMC.C:870
 TOFmatchMC.C:871
 TOFmatchMC.C:872
 TOFmatchMC.C:873
 TOFmatchMC.C:874
 TOFmatchMC.C:875
 TOFmatchMC.C:876
 TOFmatchMC.C:877
 TOFmatchMC.C:878
 TOFmatchMC.C:879
 TOFmatchMC.C:880
 TOFmatchMC.C:881
 TOFmatchMC.C:882
 TOFmatchMC.C:883
 TOFmatchMC.C:884
 TOFmatchMC.C:885
 TOFmatchMC.C:886
 TOFmatchMC.C:887
 TOFmatchMC.C:888
 TOFmatchMC.C:889
 TOFmatchMC.C:890
 TOFmatchMC.C:891
 TOFmatchMC.C:892
 TOFmatchMC.C:893
 TOFmatchMC.C:894
 TOFmatchMC.C:895
 TOFmatchMC.C:896
 TOFmatchMC.C:897
 TOFmatchMC.C:898
 TOFmatchMC.C:899
 TOFmatchMC.C:900
 TOFmatchMC.C:901
 TOFmatchMC.C:902
 TOFmatchMC.C:903
 TOFmatchMC.C:904
 TOFmatchMC.C:905
 TOFmatchMC.C:906
 TOFmatchMC.C:907
 TOFmatchMC.C:908
 TOFmatchMC.C:909
 TOFmatchMC.C:910
 TOFmatchMC.C:911
 TOFmatchMC.C:912
 TOFmatchMC.C:913
 TOFmatchMC.C:914
 TOFmatchMC.C:915
 TOFmatchMC.C:916
 TOFmatchMC.C:917
 TOFmatchMC.C:918
 TOFmatchMC.C:919
 TOFmatchMC.C:920
 TOFmatchMC.C:921
 TOFmatchMC.C:922
 TOFmatchMC.C:923
 TOFmatchMC.C:924
 TOFmatchMC.C:925
 TOFmatchMC.C:926
 TOFmatchMC.C:927
 TOFmatchMC.C:928
 TOFmatchMC.C:929
 TOFmatchMC.C:930
 TOFmatchMC.C:931
 TOFmatchMC.C:932
 TOFmatchMC.C:933
 TOFmatchMC.C:934
 TOFmatchMC.C:935
 TOFmatchMC.C:936
 TOFmatchMC.C:937
 TOFmatchMC.C:938
 TOFmatchMC.C:939
 TOFmatchMC.C:940
 TOFmatchMC.C:941
 TOFmatchMC.C:942
 TOFmatchMC.C:943
 TOFmatchMC.C:944
 TOFmatchMC.C:945
 TOFmatchMC.C:946
 TOFmatchMC.C:947
 TOFmatchMC.C:948
 TOFmatchMC.C:949
 TOFmatchMC.C:950
 TOFmatchMC.C:951
 TOFmatchMC.C:952
 TOFmatchMC.C:953
 TOFmatchMC.C:954
 TOFmatchMC.C:955
 TOFmatchMC.C:956
 TOFmatchMC.C:957
 TOFmatchMC.C:958
 TOFmatchMC.C:959
 TOFmatchMC.C:960
 TOFmatchMC.C:961
 TOFmatchMC.C:962
 TOFmatchMC.C:963
 TOFmatchMC.C:964
 TOFmatchMC.C:965
 TOFmatchMC.C:966
 TOFmatchMC.C:967
 TOFmatchMC.C:968
 TOFmatchMC.C:969
 TOFmatchMC.C:970
 TOFmatchMC.C:971
 TOFmatchMC.C:972
 TOFmatchMC.C:973
 TOFmatchMC.C:974
 TOFmatchMC.C:975
 TOFmatchMC.C:976
 TOFmatchMC.C:977
 TOFmatchMC.C:978
 TOFmatchMC.C:979
 TOFmatchMC.C:980
 TOFmatchMC.C:981
 TOFmatchMC.C:982
 TOFmatchMC.C:983
 TOFmatchMC.C:984
 TOFmatchMC.C:985
 TOFmatchMC.C:986
 TOFmatchMC.C:987
 TOFmatchMC.C:988
 TOFmatchMC.C:989
 TOFmatchMC.C:990
 TOFmatchMC.C:991
 TOFmatchMC.C:992
 TOFmatchMC.C:993
 TOFmatchMC.C:994
 TOFmatchMC.C:995
 TOFmatchMC.C:996
 TOFmatchMC.C:997
 TOFmatchMC.C:998
 TOFmatchMC.C:999
 TOFmatchMC.C:1000
 TOFmatchMC.C:1001
 TOFmatchMC.C:1002
 TOFmatchMC.C:1003
 TOFmatchMC.C:1004
 TOFmatchMC.C:1005
 TOFmatchMC.C:1006
 TOFmatchMC.C:1007
 TOFmatchMC.C:1008
 TOFmatchMC.C:1009
 TOFmatchMC.C:1010
 TOFmatchMC.C:1011
 TOFmatchMC.C:1012
 TOFmatchMC.C:1013
 TOFmatchMC.C:1014
 TOFmatchMC.C:1015
 TOFmatchMC.C:1016
 TOFmatchMC.C:1017
 TOFmatchMC.C:1018
 TOFmatchMC.C:1019
 TOFmatchMC.C:1020
 TOFmatchMC.C:1021
 TOFmatchMC.C:1022
 TOFmatchMC.C:1023
 TOFmatchMC.C:1024
 TOFmatchMC.C:1025
 TOFmatchMC.C:1026
 TOFmatchMC.C:1027
 TOFmatchMC.C:1028
 TOFmatchMC.C:1029
 TOFmatchMC.C:1030
 TOFmatchMC.C:1031
 TOFmatchMC.C:1032
 TOFmatchMC.C:1033
 TOFmatchMC.C:1034
 TOFmatchMC.C:1035
 TOFmatchMC.C:1036
 TOFmatchMC.C:1037
 TOFmatchMC.C:1038
 TOFmatchMC.C:1039
 TOFmatchMC.C:1040
 TOFmatchMC.C:1041
 TOFmatchMC.C:1042
 TOFmatchMC.C:1043
 TOFmatchMC.C:1044
 TOFmatchMC.C:1045
 TOFmatchMC.C:1046
 TOFmatchMC.C:1047
 TOFmatchMC.C:1048
 TOFmatchMC.C:1049
 TOFmatchMC.C:1050
 TOFmatchMC.C:1051
 TOFmatchMC.C:1052
 TOFmatchMC.C:1053
 TOFmatchMC.C:1054
 TOFmatchMC.C:1055
 TOFmatchMC.C:1056
 TOFmatchMC.C:1057
 TOFmatchMC.C:1058
 TOFmatchMC.C:1059
 TOFmatchMC.C:1060
 TOFmatchMC.C:1061
 TOFmatchMC.C:1062
 TOFmatchMC.C:1063
 TOFmatchMC.C:1064
 TOFmatchMC.C:1065
 TOFmatchMC.C:1066
 TOFmatchMC.C:1067
 TOFmatchMC.C:1068
 TOFmatchMC.C:1069
 TOFmatchMC.C:1070
 TOFmatchMC.C:1071
 TOFmatchMC.C:1072
 TOFmatchMC.C:1073
 TOFmatchMC.C:1074
 TOFmatchMC.C:1075
 TOFmatchMC.C:1076
 TOFmatchMC.C:1077
 TOFmatchMC.C:1078
 TOFmatchMC.C:1079
 TOFmatchMC.C:1080
 TOFmatchMC.C:1081
 TOFmatchMC.C:1082
 TOFmatchMC.C:1083
 TOFmatchMC.C:1084
 TOFmatchMC.C:1085
 TOFmatchMC.C:1086
 TOFmatchMC.C:1087
 TOFmatchMC.C:1088
 TOFmatchMC.C:1089
 TOFmatchMC.C:1090
 TOFmatchMC.C:1091
 TOFmatchMC.C:1092
 TOFmatchMC.C:1093
 TOFmatchMC.C:1094
 TOFmatchMC.C:1095
 TOFmatchMC.C:1096
 TOFmatchMC.C:1097
 TOFmatchMC.C:1098
 TOFmatchMC.C:1099
 TOFmatchMC.C:1100
 TOFmatchMC.C:1101
 TOFmatchMC.C:1102
 TOFmatchMC.C:1103
 TOFmatchMC.C:1104
 TOFmatchMC.C:1105
 TOFmatchMC.C:1106
 TOFmatchMC.C:1107
 TOFmatchMC.C:1108
 TOFmatchMC.C:1109
 TOFmatchMC.C:1110
 TOFmatchMC.C:1111
 TOFmatchMC.C:1112
 TOFmatchMC.C:1113
 TOFmatchMC.C:1114
 TOFmatchMC.C:1115
 TOFmatchMC.C:1116
 TOFmatchMC.C:1117
 TOFmatchMC.C:1118
 TOFmatchMC.C:1119
 TOFmatchMC.C:1120
 TOFmatchMC.C:1121
 TOFmatchMC.C:1122
 TOFmatchMC.C:1123
 TOFmatchMC.C:1124
 TOFmatchMC.C:1125
 TOFmatchMC.C:1126
 TOFmatchMC.C:1127
 TOFmatchMC.C:1128
 TOFmatchMC.C:1129
 TOFmatchMC.C:1130
 TOFmatchMC.C:1131
 TOFmatchMC.C:1132
 TOFmatchMC.C:1133
 TOFmatchMC.C:1134
 TOFmatchMC.C:1135
 TOFmatchMC.C:1136
 TOFmatchMC.C:1137
 TOFmatchMC.C:1138
 TOFmatchMC.C:1139
 TOFmatchMC.C:1140
 TOFmatchMC.C:1141
 TOFmatchMC.C:1142
 TOFmatchMC.C:1143
 TOFmatchMC.C:1144
 TOFmatchMC.C:1145
 TOFmatchMC.C:1146
 TOFmatchMC.C:1147
 TOFmatchMC.C:1148
 TOFmatchMC.C:1149
 TOFmatchMC.C:1150
 TOFmatchMC.C:1151
 TOFmatchMC.C:1152
 TOFmatchMC.C:1153
 TOFmatchMC.C:1154
 TOFmatchMC.C:1155
 TOFmatchMC.C:1156
 TOFmatchMC.C:1157
 TOFmatchMC.C:1158
 TOFmatchMC.C:1159
 TOFmatchMC.C:1160
 TOFmatchMC.C:1161
 TOFmatchMC.C:1162
 TOFmatchMC.C:1163
 TOFmatchMC.C:1164
 TOFmatchMC.C:1165
 TOFmatchMC.C:1166
 TOFmatchMC.C:1167
 TOFmatchMC.C:1168
 TOFmatchMC.C:1169
 TOFmatchMC.C:1170
 TOFmatchMC.C:1171
 TOFmatchMC.C:1172
 TOFmatchMC.C:1173
 TOFmatchMC.C:1174
 TOFmatchMC.C:1175
 TOFmatchMC.C:1176
 TOFmatchMC.C:1177
 TOFmatchMC.C:1178
 TOFmatchMC.C:1179
 TOFmatchMC.C:1180
 TOFmatchMC.C:1181
 TOFmatchMC.C:1182
 TOFmatchMC.C:1183
 TOFmatchMC.C:1184
 TOFmatchMC.C:1185
 TOFmatchMC.C:1186
 TOFmatchMC.C:1187
 TOFmatchMC.C:1188
 TOFmatchMC.C:1189
 TOFmatchMC.C:1190
 TOFmatchMC.C:1191
 TOFmatchMC.C:1192
 TOFmatchMC.C:1193
 TOFmatchMC.C:1194
 TOFmatchMC.C:1195
 TOFmatchMC.C:1196
 TOFmatchMC.C:1197
 TOFmatchMC.C:1198
 TOFmatchMC.C:1199
 TOFmatchMC.C:1200
 TOFmatchMC.C:1201
 TOFmatchMC.C:1202
 TOFmatchMC.C:1203
 TOFmatchMC.C:1204
 TOFmatchMC.C:1205
 TOFmatchMC.C:1206
 TOFmatchMC.C:1207
 TOFmatchMC.C:1208
 TOFmatchMC.C:1209
 TOFmatchMC.C:1210
 TOFmatchMC.C:1211
 TOFmatchMC.C:1212
 TOFmatchMC.C:1213
 TOFmatchMC.C:1214
 TOFmatchMC.C:1215
 TOFmatchMC.C:1216
 TOFmatchMC.C:1217
 TOFmatchMC.C:1218
 TOFmatchMC.C:1219
 TOFmatchMC.C:1220
 TOFmatchMC.C:1221
 TOFmatchMC.C:1222
 TOFmatchMC.C:1223
 TOFmatchMC.C:1224
 TOFmatchMC.C:1225
 TOFmatchMC.C:1226
 TOFmatchMC.C:1227
 TOFmatchMC.C:1228
 TOFmatchMC.C:1229
 TOFmatchMC.C:1230
 TOFmatchMC.C:1231
 TOFmatchMC.C:1232
 TOFmatchMC.C:1233
 TOFmatchMC.C:1234
 TOFmatchMC.C:1235
 TOFmatchMC.C:1236
 TOFmatchMC.C:1237
 TOFmatchMC.C:1238
 TOFmatchMC.C:1239
 TOFmatchMC.C:1240
 TOFmatchMC.C:1241
 TOFmatchMC.C:1242
 TOFmatchMC.C:1243
 TOFmatchMC.C:1244
 TOFmatchMC.C:1245
 TOFmatchMC.C:1246
 TOFmatchMC.C:1247
 TOFmatchMC.C:1248
 TOFmatchMC.C:1249
 TOFmatchMC.C:1250
 TOFmatchMC.C:1251
 TOFmatchMC.C:1252
 TOFmatchMC.C:1253
 TOFmatchMC.C:1254
 TOFmatchMC.C:1255
 TOFmatchMC.C:1256
 TOFmatchMC.C:1257
 TOFmatchMC.C:1258
 TOFmatchMC.C:1259
 TOFmatchMC.C:1260
 TOFmatchMC.C:1261
 TOFmatchMC.C:1262
 TOFmatchMC.C:1263
 TOFmatchMC.C:1264
 TOFmatchMC.C:1265
 TOFmatchMC.C:1266
 TOFmatchMC.C:1267
 TOFmatchMC.C:1268
 TOFmatchMC.C:1269
 TOFmatchMC.C:1270
 TOFmatchMC.C:1271
 TOFmatchMC.C:1272
 TOFmatchMC.C:1273
 TOFmatchMC.C:1274
 TOFmatchMC.C:1275
 TOFmatchMC.C:1276
 TOFmatchMC.C:1277
 TOFmatchMC.C:1278
 TOFmatchMC.C:1279
 TOFmatchMC.C:1280
 TOFmatchMC.C:1281
 TOFmatchMC.C:1282
 TOFmatchMC.C:1283
 TOFmatchMC.C:1284
 TOFmatchMC.C:1285
 TOFmatchMC.C:1286
 TOFmatchMC.C:1287
 TOFmatchMC.C:1288
 TOFmatchMC.C:1289
 TOFmatchMC.C:1290
 TOFmatchMC.C:1291
 TOFmatchMC.C:1292
 TOFmatchMC.C:1293
 TOFmatchMC.C:1294
 TOFmatchMC.C:1295
 TOFmatchMC.C:1296
 TOFmatchMC.C:1297
 TOFmatchMC.C:1298
 TOFmatchMC.C:1299
 TOFmatchMC.C:1300
 TOFmatchMC.C:1301
 TOFmatchMC.C:1302
 TOFmatchMC.C:1303
 TOFmatchMC.C:1304
 TOFmatchMC.C:1305
 TOFmatchMC.C:1306
 TOFmatchMC.C:1307
 TOFmatchMC.C:1308
 TOFmatchMC.C:1309
 TOFmatchMC.C:1310
 TOFmatchMC.C:1311
 TOFmatchMC.C:1312
 TOFmatchMC.C:1313
 TOFmatchMC.C:1314
 TOFmatchMC.C:1315
 TOFmatchMC.C:1316
 TOFmatchMC.C:1317
 TOFmatchMC.C:1318
 TOFmatchMC.C:1319
 TOFmatchMC.C:1320
 TOFmatchMC.C:1321
 TOFmatchMC.C:1322
 TOFmatchMC.C:1323
 TOFmatchMC.C:1324
 TOFmatchMC.C:1325
 TOFmatchMC.C:1326
 TOFmatchMC.C:1327
 TOFmatchMC.C:1328
 TOFmatchMC.C:1329
 TOFmatchMC.C:1330
 TOFmatchMC.C:1331
 TOFmatchMC.C:1332
 TOFmatchMC.C:1333
 TOFmatchMC.C:1334
 TOFmatchMC.C:1335
 TOFmatchMC.C:1336
 TOFmatchMC.C:1337
 TOFmatchMC.C:1338
 TOFmatchMC.C:1339
 TOFmatchMC.C:1340
 TOFmatchMC.C:1341
 TOFmatchMC.C:1342
 TOFmatchMC.C:1343
 TOFmatchMC.C:1344
 TOFmatchMC.C:1345
 TOFmatchMC.C:1346
 TOFmatchMC.C:1347
 TOFmatchMC.C:1348
 TOFmatchMC.C:1349
 TOFmatchMC.C:1350
 TOFmatchMC.C:1351
 TOFmatchMC.C:1352
 TOFmatchMC.C:1353
 TOFmatchMC.C:1354
 TOFmatchMC.C:1355
 TOFmatchMC.C:1356
 TOFmatchMC.C:1357
 TOFmatchMC.C:1358
 TOFmatchMC.C:1359
 TOFmatchMC.C:1360
 TOFmatchMC.C:1361
 TOFmatchMC.C:1362
 TOFmatchMC.C:1363
 TOFmatchMC.C:1364
 TOFmatchMC.C:1365
 TOFmatchMC.C:1366
 TOFmatchMC.C:1367
 TOFmatchMC.C:1368
 TOFmatchMC.C:1369
 TOFmatchMC.C:1370
 TOFmatchMC.C:1371
 TOFmatchMC.C:1372
 TOFmatchMC.C:1373
 TOFmatchMC.C:1374
 TOFmatchMC.C:1375
 TOFmatchMC.C:1376
 TOFmatchMC.C:1377
 TOFmatchMC.C:1378
 TOFmatchMC.C:1379
 TOFmatchMC.C:1380
 TOFmatchMC.C:1381
 TOFmatchMC.C:1382
 TOFmatchMC.C:1383
 TOFmatchMC.C:1384
 TOFmatchMC.C:1385
 TOFmatchMC.C:1386
 TOFmatchMC.C:1387
 TOFmatchMC.C:1388
 TOFmatchMC.C:1389
 TOFmatchMC.C:1390
 TOFmatchMC.C:1391
 TOFmatchMC.C:1392
 TOFmatchMC.C:1393
 TOFmatchMC.C:1394
 TOFmatchMC.C:1395
 TOFmatchMC.C:1396
 TOFmatchMC.C:1397
 TOFmatchMC.C:1398
 TOFmatchMC.C:1399
 TOFmatchMC.C:1400
 TOFmatchMC.C:1401
 TOFmatchMC.C:1402
 TOFmatchMC.C:1403
 TOFmatchMC.C:1404
 TOFmatchMC.C:1405
 TOFmatchMC.C:1406
 TOFmatchMC.C:1407
 TOFmatchMC.C:1408
 TOFmatchMC.C:1409
 TOFmatchMC.C:1410
 TOFmatchMC.C:1411
 TOFmatchMC.C:1412
 TOFmatchMC.C:1413
 TOFmatchMC.C:1414
 TOFmatchMC.C:1415
 TOFmatchMC.C:1416
 TOFmatchMC.C:1417
 TOFmatchMC.C:1418
 TOFmatchMC.C:1419
 TOFmatchMC.C:1420
 TOFmatchMC.C:1421
 TOFmatchMC.C:1422
 TOFmatchMC.C:1423
 TOFmatchMC.C:1424
 TOFmatchMC.C:1425
 TOFmatchMC.C:1426
 TOFmatchMC.C:1427
 TOFmatchMC.C:1428
 TOFmatchMC.C:1429
 TOFmatchMC.C:1430
 TOFmatchMC.C:1431
 TOFmatchMC.C:1432
 TOFmatchMC.C:1433
 TOFmatchMC.C:1434
 TOFmatchMC.C:1435
 TOFmatchMC.C:1436
 TOFmatchMC.C:1437
 TOFmatchMC.C:1438
 TOFmatchMC.C:1439
 TOFmatchMC.C:1440
 TOFmatchMC.C:1441
 TOFmatchMC.C:1442
 TOFmatchMC.C:1443
 TOFmatchMC.C:1444
 TOFmatchMC.C:1445
 TOFmatchMC.C:1446
 TOFmatchMC.C:1447
 TOFmatchMC.C:1448
 TOFmatchMC.C:1449
 TOFmatchMC.C:1450
 TOFmatchMC.C:1451
 TOFmatchMC.C:1452
 TOFmatchMC.C:1453
 TOFmatchMC.C:1454
 TOFmatchMC.C:1455
 TOFmatchMC.C:1456
 TOFmatchMC.C:1457
 TOFmatchMC.C:1458
 TOFmatchMC.C:1459
 TOFmatchMC.C:1460
 TOFmatchMC.C:1461
 TOFmatchMC.C:1462
 TOFmatchMC.C:1463
 TOFmatchMC.C:1464
 TOFmatchMC.C:1465
 TOFmatchMC.C:1466
 TOFmatchMC.C:1467
 TOFmatchMC.C:1468
 TOFmatchMC.C:1469
 TOFmatchMC.C:1470
 TOFmatchMC.C:1471