8   gROOT->LoadMacro(
"$VMCWORKDIR/gconfig/rootlogon.C");
 
   10   Text_t  tOutputFile[50];
 
   16   TTree *
tree=(TTree *) inFile->Get(
"pndsim") ;
 
   17   tree->AddFriend(
"pndsim",inPidFile);
 
   19   TClonesArray* cand_array=
new TClonesArray(
"PndPidCandidate");
 
   20   tree->SetBranchAddress(
"PidChargedCand", &cand_array);
 
   22   TClonesArray* 
mc_array=
new TClonesArray(
"PndMCTrack");
 
   23   tree->SetBranchAddress(
"MCTrack", &mc_array);
 
   25   TFile *
out = TFile::Open(
"output.root",
"RECREATE");
 
   26   TNtuple *nt = 
new TNtuple(
"nt",
"nt",
"evt:id:mc_p:mc_theta:mc_phi:mc_pid:mc_stt:mc_tpc:mc_mvd:mc_gem:p:theta:phi:mult:stt:tpc:mvd");
 
   27   TNtuple *ntEvt = 
new TNtuple(
"ntEvt",
"ntEvt",
"evt:acc_stt:acc_tpc:eff:effct:cand:mc_D1:mc_D2:reco_D1:reco_D2:mc_all:reco_all");
 
   28   Float_t mass_k = 0.493677;
 
   29   Float_t mass_pi =0.13957018;
 
   31   if (nEntries==0) nEntries =  tree->GetEntriesFast();
 
   32   for (Int_t j=0; j< nEntries; j++){
 
   35     if ((j%100)==0)    cout << 
"processing event " << j << 
"\n";
 
   37     Float_t mc_mom = 0, mc_theta = 0, mc_phi = 0;
 
   38     Float_t rec_mom = -1, rec_theta = -1, rec_phi = 0;
 
   39     Int_t stt_mccount = 0, tpc_mccount = 0,  reco_stt = 0, reco_tpc = 0,
reco_mvd = 0, reco_gem = 0, reco_count = 0, reco_ctcount = 0;
 
   40     TLorentzVector mc_k[6], reco_k[6], mc_D1, reco_D1, mc_D2, reco_D2, mc_all, reco_all;
 
   41     for (Int_t mc = 0; mc < mc_array->GetEntriesFast(); mc++)
 
   49         mc_theta = mctrack->
GetMomentum().Theta()*TMath::RadToDeg();
 
   50         mc_phi = mctrack->
GetMomentum().Phi()*TMath::RadToDeg();
 
   53         for (Int_t pp=0; pp<cand_array->GetEntriesFast(); pp++)
 
   57             if ( (cand_mult==0) || ((cand_mult>0) && (
fabs(rec_mom-mc_mom)> 
fabs(pidCand->
GetMomentum().Mag()-mc_mom))) )
 
   67                 reco_tpc = pidCand->GetTpcHits();
 
   74         if (cand_mult>0) reco_count++;
 
   75         if ((cand_mult>0) && ((reco_stt>0) || (reco_tpc>0)))  reco_ctcount++;
 
   76         Float_t ntuple_nt[] = {
 
   77           j,mc, mc_mom,mc_theta,mc_phi, mc_pid,
 
   79           rec_mom, rec_theta*TMath::RadToDeg(), rec_phi*TMath::RadToDeg(), cand_mult, reco_stt, reco_tpc, 
reco_mvd 
   84     mc_D1 = mc_k[0] + mc_k[1] + mc_k[2];
 
   85     mc_D2 = mc_k[3] + mc_k[4] + mc_k[5];
 
   86     reco_D1 = reco_k[0] + reco_k[1] + reco_k[2];
 
   87     reco_D2 = reco_k[3] + reco_k[4] + reco_k[5];
 
   88     mc_all = mc_D1 + mc_D2;
 
   89     reco_all = reco_D1 + reco_D2;
 
   91     Float_t ntuple_evt[] = {
 
   92       j, stt_mccount, tpc_mccount, reco_count,  reco_ctcount,cand_array->GetEntriesFast(),
 
   93       mc_D1.M(), mc_D2.M(), reco_D1.M(), reco_D2.M(), mc_all.M(), reco_all.M()
 
   95     ntEvt->Fill(ntuple_evt);
 
  100   nt->Draw(
"mc_theta>>hMcTheta(75,0,150)");
 
  101   nt->Draw(
"mc_theta>>hMcSttTheta(75,0,150)",
"mc_stt>0");
 
  102   nt->Draw(
"mc_theta>>hMcSttMvdTheta(75,0,150)",
"(mc_stt>0)||(mc_mvd>0)");
 
  103   nt->Draw(
"mc_theta>>hMcTpcTheta(75,0,150)",
"mc_tpc>0");
 
  104   nt->Draw(
"mc_theta>>hMcTpcMvdTheta(75,0,150)",
"(mc_tpc>0)||(mc_tpc>0)");
 
  105   nt->Draw(
"mc_theta>>hMcMvdTheta(75,0,150)",
"mc_mvd>0");
 
  106   nt->Draw(
"mc_theta>>hMcGemTheta(75,0,150)",
"mc_gem>0");
 
  107   nt->Draw(
"mc_theta>>hRecoTheta(75,0,150)",
"mult>0");
 
  108   nt->Draw(
"mc_theta>>hRecoCtTheta(75,0,150)",
"mult>0&&(stt>0||tpc>0)");
 
  109   nt->Draw(
"mc_theta>>hRecoEffTheta(75,0,150)",
"mult>0");
 
  110   nt->Draw(
"mc_theta>>hRecoEffCtTheta(75,0,150)",
"mult>0&&(stt>0||tpc>0)");
 
  111   hRecoEffTheta->Divide(hMcTheta);
 
  112   hRecoEffCtTheta->Divide(hMcTheta);
 
  113   nt->Draw(
"mc_theta>>hMcAccSttTheta(75,0,150)",
"mc_stt>0");
 
  114   hMcAccSttTheta->Divide(hMcTheta);
 
  115   nt->Draw(
"mc_theta>>hMcAccTpcTheta(75,0,150)",
"mc_tpc>0");
 
  116   hMcAccTpcTheta->Divide(hMcTheta);
 
  119   nt->Draw(
"mc_phi>>hMcPhi(50,-200,200)");
 
  120   nt->Draw(
"mc_phi>>hMcSttPhi(50,-200,200)",
"mc_stt>0");
 
  121   nt->Draw(
"mc_phi>>hMcSttMvdPhi(50,-200,200)",
"(mc_stt>0)||(mc_mvd>0)");
 
  122   nt->Draw(
"mc_phi>>hMcTpcPhi(50,-200,200)",
"mc_tpc>0");
 
  123   nt->Draw(
"mc_phi>>hMcTpcMvdPhi(50,-200,200)",
"(mc_tpc>0)||(mc_mvd>0)");
 
  124   nt->Draw(
"mc_phi>>hMcMvdPhi(50,-200,200)",
"mc_mvd>0");
 
  125   nt->Draw(
"mc_phi>>hMcGemPhi(50,-200,200)",
"mc_gem>0");
 
  126   nt->Draw(
"mc_phi>>hRecoPhi(50,-200,200)",
"mult>0");
 
  127   nt->Draw(
"mc_phi>>hRecoCtPhi(50,-200,200)",
"mult>0&&(stt>0||tpc>0)");
 
  128   nt->Draw(
"mc_phi>>hRecoEffPhi(50,-200,200)",
"mult>0");
 
  129   nt->Draw(
"mc_phi>>hRecoEffCtPhi(50,-200,200)",
"mult>0&&(stt>0||tpc>0)");
 
  130   hRecoEffPhi->Divide(hMcPhi);
 
  131   hRecoEffCtPhi->Divide(hMcPhi);
 
  132   nt->Draw(
"mc_phi>>hMcAccSttPhi(50,-200,200)",
"mc_stt>0");
 
  133   hMcAccSttPhi->Divide(hMcPhi);
 
  134   nt->Draw(
"mc_phi>>hMcAccTpcPhi(50,-200,200)",
"mc_tpc>0");
 
  135   hMcAccTpcPhi->Divide(hMcPhi);
 
  137   nt->Draw(
"mc_p>>hMcP(100,0,5)");
 
  138   nt->Draw(
"mc_p>>hMcSttP(100,0,5)",
"mc_stt>0");
 
  139   nt->Draw(
"mc_p>>hMcSttMvdP(100,0,5)",
"(mc_stt>0)||(mc_mvd>0)");
 
  140   nt->Draw(
"mc_p>>hMcTpcP(100,0,5)",
"mc_tpc>0");
 
  141   nt->Draw(
"mc_p>>hMcTpcMvdP(100,0,5)",
"(mc_tpc>0)||(mc_mvd>0)");
 
  142   nt->Draw(
"mc_p>>hMcMvdP(100,0,5)",
"mc_mvd>0");
 
  143   nt->Draw(
"mc_p>>hMcGemP(100,0,5)",
"mc_gem>0");
 
  144   nt->Draw(
"mc_p>>hRecoP(100,0,5)",
"mult>0");
 
  145   nt->Draw(
"mc_p>>hRecoCtP(100,0,5)",
"mult>0&&(stt>0||tpc>0)");
 
  146   nt->Draw(
"mc_p>>hRecoEffP(100,0,5)",
"mult>0");
 
  147   nt->Draw(
"mc_p>>hRecoEffCtP(100,0,5)",
"mult>0&&(stt>0||tpc>0)");
 
  148   hRecoEffP->Divide(hMcP);
 
  149   hRecoEffCtP->Divide(hMcP);
 
  150   nt->Draw(
"mc_p>>hMcAccSttP(100,0,5)",
"mc_stt>0");
 
  151   hMcAccSttP->Divide(hMcP);
 
  152   nt->Draw(
"mc_p>>hMcAccTpcP(100,0,5)",
"mc_tpc>0");
 
  153   hMcAccTpcP->Divide(hMcP);
 
  155   nt->Draw(
"(mc_p-p):mc_p>>hresp_p(100,0,5,100,-0.5,0.5)",
"mult>0");
 
  156   nt->Draw(
"(mc_p-p):mc_theta>>hresp_theta(100,0,100,100,-0.5,0.5)",
"mult>0",
"colz");
 
  157   nt->Draw(
"(mc_theta-theta):mc_theta>>hrestheta_theta(100,0,100,100,-2,2)",
"mult>0");
 
  158   nt->Draw(
"(mc_theta-theta):mc_p>>hrestheta_p(100,0,5,100,-2,2)",
"mult>0");
 
  159   nt->Draw(
"(mc_phi-phi):mc_phi>>hresphi_phi(100,-200,200,100,-2,2)",
"mult>0");
 
  161   ntEvt->Draw(
"reco_D1>>hD(100,1.5,2.2)",
"eff==6");
 
  162   ntEvt->Draw(
"reco_D2>>hD2(100,1.5,2.2)",
"eff==6");
 
  164   ntEvt->Draw(
"reco_all>>hAll(100,3.2,4.4)",
"eff==6");
 
  170   hMcTheta->Write(); hMcSttTheta->Write(); hMcSttMvdTheta->Write(); hMcMvdTheta->Write(); hMcGemTheta->Write(); hRecoTheta->Write();
 
  171   hMcTpcTheta->Write(); hMcTpcMvdTheta->Write(); hRecoEffTheta->Write(); hMcAccSttTheta->Write(); hMcAccTpcTheta->Write();
 
  172   hMcPhi->Write();   hMcSttPhi->Write();   hMcSttMvdPhi->Write();   hMcMvdPhi->Write();   hMcGemPhi->Write();   hRecoPhi->Write();
 
  173   hMcTpcPhi->Write();   hMcTpcMvdPhi->Write();  hRecoEffPhi->Write(); hMcAccSttPhi->Write(); hMcAccTpcPhi->Write();
 
  174   hMcP->Write();     hMcSttP->Write();     hMcSttMvdP->Write();     hMcMvdP->Write();     hMcGemP->Write();     hRecoP->Write();
 
  175   hMcTpcP->Write();     hMcTpcMvdP->Write(); hRecoEffP->Write();hMcAccSttP->Write(); hMcAccTpcP->Write();
 
  176   hRecoCtTheta->Write();
 
  179   hRecoEffCtTheta->Write();
 
  180   hRecoEffCtPhi->Write();
 
  181   hRecoEffCtP->Write();
 
  186   hresp_theta->Write();
 
  187   hrestheta_theta->Write();
 
  188   hrestheta_p->Write();
 
  189   hresphi_phi->Write();
 
Int_t GetNPoints(DetectorId detId) const 
TVector3 GetMomentum() const 
TLorentzVector Get4Momentum() const 
friend F32vec4 fabs(const F32vec4 &a)
Int_t GetMotherID() const 
TVector3 GetMomentum() const