12   TFile fileqa(
"data/recoqa.root");
 
   13   TTree *
simtree = (TTree*) fileqa.Get(
"pndsim");
 
   14   simtree->AddFriend(
"pndsim", 
"data/sim.root");
 
   31   TH1F *eff_mvdpix = 
new TH1F(
"eff_mvdpix", 
"MVD pixel efficiency", 100, effmin, effmax);
 
   32   TH1F *eff_mvdstr = 
new TH1F(
"eff_mvdstr", 
"MVD strip efficiency", 100, effmin, effmax);
 
   33   TH1F *eff_stt = 
new TH1F(
"eff_stt", 
"STT efficiency", 100, effmin, effmax);
 
   34   TH1F *eff_gem = 
new TH1F(
"eff_gem", 
"GEM efficiency", 100, effmin, effmax);
 
   36   simtree->Draw(
"RecoTrackInfo.GetMvdPixelEfficiency() >> eff_mvdpix", cut, 
"goff");
 
   37   simtree->Draw(
"RecoTrackInfo.GetMvdStripEfficiency() >> eff_mvdstr", cut, 
"goff");
 
   38   simtree->Draw(
"RecoTrackInfo.GetSttEfficiency() >> eff_stt", cut, 
"goff");
 
   39   simtree->Draw(
"RecoTrackInfo.GetGemEfficiency() >> eff_gem", cut, 
"goff");
 
   41   TH1F *eff_glo = 
new TH1F(
"eff_glo", 
"global efficiency", 100, effmin, effmax);
 
   42   simtree->Draw(
"RecoTrackInfo.GetEfficiency() >> eff_glo", cut, 
"goff");
 
   56   TH1F *pur_mvdpix = 
new TH1F(
"pur_mvdpix", 
"MVD pixel purity", 100, purmin, purmax);
 
   57   TH1F *pur_mvdstr = 
new TH1F(
"pur_mvdstr", 
"MVD strip purity", 100, purmin, purmax);
 
   58   TH1F *pur_stt = 
new TH1F(
"pur_stt", 
"STT purity", 100, purmin, purmax);
 
   59   TH1F *pur_gem = 
new TH1F(
"pur_gem", 
"GEM purity", 100, purmin, purmax);
 
   61   simtree->Draw(
"RecoTrackInfo.GetMvdPixelPurity() >> pur_mvdpix", cut, 
"goff");
 
   62   simtree->Draw(
"RecoTrackInfo.GetMvdStripPurity() >> pur_mvdstr", cut, 
"goff");
 
   63   simtree->Draw(
"RecoTrackInfo.GetSttPurity() >> pur_stt", cut, 
"goff");
 
   64   simtree->Draw(
"RecoTrackInfo.GetGemPurity() >> pur_gem", cut, 
"goff");
 
   67   TH1F *pur_glo = 
new TH1F(
"pur_glo", 
"global purity", 100, purmin, purmax);
 
   68   simtree->Draw(
"RecoTrackInfo.GetPurity() >> pur_glo", cut, 
"goff");
 
   75   TH1F *hnofrecotracks = 
new TH1F(
"hnofrecotracks", 
"# of reco tracks associated to the same MC track", 20, 0, 20);
 
   76   simtree->Draw(
"MCTrackInfo.GetNofRecoTracks() >> hnofrecotracks", cut, 
"goff");
 
   78   TH1F *hnofMCtracks = 
new TH1F(
"hnofMCtracks", 
"# of MC tracks associated to the same reco track", 20, 0, 20);
 
   79   simtree->Draw(
"RecoTrackInfo.GetNofMCTracks() >> hnofMCtracks", cut, 
"goff");
 
   92   TH1F *hdelta_p_first = 
new TH1F(
"hdelta_p_first", 
"#Delta p @ first hit", 100, pmin, pmax);
 
   93   TH1F *hdelta_pz_first = 
new TH1F(
"hdelta_pz_first", 
"#Delta pz @ first hit", 100, pmin, pmax);
 
   94   TH1F *hdelta_pt_first = 
new TH1F(
"hdelta_pt_first", 
"#Delta pt @ first hit", 100, pmin, pmax);
 
   96   simtree->Draw(
"RecoTrackInfo.GetMomentumFirst().Mag() - RecoTrackInfo.GetMCTrackInfo().GetMomentumFirst().Mag() >> hdelta_p_first", cut, 
"goff");
 
   97   simtree->Draw(
"RecoTrackInfo.GetMomentumFirst().Perp() - RecoTrackInfo.GetMCTrackInfo().GetMomentumFirst().Perp() >> hdelta_pt_first", cut, 
"goff");
 
   98   simtree->Draw(
"RecoTrackInfo.GetMomentumFirst().Z() - RecoTrackInfo.GetMCTrackInfo().GetMomentumFirst().Z() >> hdelta_pz_first", cut, 
"goff");
 
  100   double thetamin = -5;
 
  102   int ntheta = (thetamax - thetamin)*10;
 
  103   TH1F *hdelta_theta_first = 
new TH1F(
"hdelta_theta_first", 
"#Delta #theta @ first hit", ntheta, thetamin, thetamax);
 
  104   simtree->Draw(
"(RecoTrackInfo.GetMomentumFirst().Theta() - RecoTrackInfo.GetMCTrackInfo().GetMomentumFirst().Theta()) * TMath::RadToDeg() >> hdelta_theta_first", cut, 
"goff");
 
  108   int nphi = (phimax - phimin)*10;
 
  109   TH1F *hdelta_phi_first = 
new TH1F(
"hdelta_phi_first", 
"#Delta #phi @ first hit", nphi, phimin, phimax);
 
  110   simtree->Draw(
"(RecoTrackInfo.GetMomentumFirst().Phi() - RecoTrackInfo.GetMCTrackInfo().GetMomentumFirst().Phi()) * TMath::RadToDeg() >> hdelta_phi_first", cut, 
"goff");
 
  115   TH1F *hdelta_x_first = 
new TH1F(
"hdelta_x_first", 
"#Delta x @ first hit", 100, xmin, xmax);
 
  116   TH1F *hdelta_y_first = 
new TH1F(
"hdelta_y_first", 
"#Delta y @ first hit", 100, xmin, xmax);
 
  117   simtree->Draw(
"RecoTrackInfo.GetPositionFirst().X() - RecoTrackInfo.GetMCTrackInfo().GetPositionFirst().X() >> hdelta_x_first", cut, 
"goff");
 
  118   simtree->Draw(
"RecoTrackInfo.GetPositionFirst().Y() - RecoTrackInfo.GetMCTrackInfo().GetPositionFirst().Y() >> hdelta_y_first", cut, 
"goff");
 
  122   TH1F *hdelta_z_first = 
new TH1F(
"hdelta_z_first", 
"#Delta z @ first hit", 100, zmin, zmax);
 
  123   simtree->Draw(
"RecoTrackInfo.GetPositionFirst().Z() - RecoTrackInfo.GetMCTrackInfo().GetPositionFirst().Z() >> hdelta_z_first", cut, 
"goff");
 
  126   TH1F *hdelta_r_first = 
new TH1F(
"hdelta_r_first", 
"#Delta r @ first hit", 100, -rmax, rmax);
 
  127   simtree->Draw(
"RecoTrackInfo.GetPositionFirst().Perp() - RecoTrackInfo.GetMCTrackInfo().GetPositionFirst().Perp() >> hdelta_r_first", cut, 
"goff");
 
  138   TH1F *hdelta_p_last = 
new TH1F(
"hdelta_p_last", 
"#Delta p @ last hit", 100, pmin, pmax);
 
  139   TH1F *hdelta_pz_last = 
new TH1F(
"hdelta_pz_last", 
"#Delta pz @ last hit", 100, pmin, pmax);
 
  140   TH1F *hdelta_pt_last = 
new TH1F(
"hdelta_pt_last", 
"#Delta pt @ last hit", 100, pmin, pmax);
 
  142   simtree->Draw(
"RecoTrackInfo.GetMomentumLast().Mag() - RecoTrackInfo.GetMCTrackInfo().GetMomentumLast().Mag() >> hdelta_p_last", cut, 
"goff");
 
  143   simtree->Draw(
"RecoTrackInfo.GetMomentumLast().Perp() - RecoTrackInfo.GetMCTrackInfo().GetMomentumLast().Perp() >> hdelta_pt_last", cut, 
"goff");
 
  144   simtree->Draw(
"RecoTrackInfo.GetMomentumLast().Z() - RecoTrackInfo.GetMCTrackInfo().GetMomentumLast().Z() >> hdelta_pz_last", cut, 
"goff");
 
  146   TH1F *hdelta_theta_last = 
new TH1F(
"hdelta_theta_last", 
"#Delta #theta @ last hit", ntheta, thetamin, thetamax);
 
  147   simtree->Draw(
"(RecoTrackInfo.GetMomentumLast().Theta() - RecoTrackInfo.GetMCTrackInfo().GetMomentumLast().Theta()) * TMath::RadToDeg() >> hdelta_theta_last", cut, 
"goff");
 
  149   TH1F *hdelta_phi_last = 
new TH1F(
"hdelta_phi_last", 
"#Delta #phi @ last hit", nphi, phimin, phimax);
 
  150   simtree->Draw(
"(RecoTrackInfo.GetMomentumLast().Phi() - RecoTrackInfo.GetMCTrackInfo().GetMomentumLast().Phi()) * TMath::RadToDeg() >> hdelta_phi_last", cut, 
"goff");
 
  152   TH1F *hdelta_x_last = 
new TH1F(
"hdelta_x_last", 
"#Delta x @ last hit", 100, xmin, xmax);
 
  153   TH1F *hdelta_y_last = 
new TH1F(
"hdelta_y_last", 
"#Delta y @ last hit", 100, xmin, xmax);
 
  154   simtree->Draw(
"RecoTrackInfo.GetPositionLast().X() - RecoTrackInfo.GetMCTrackInfo().GetPositionLast().X() >> hdelta_x_last", cut, 
"goff");
 
  155   simtree->Draw(
"RecoTrackInfo.GetPositionLast().Y() - RecoTrackInfo.GetMCTrackInfo().GetPositionLast().Y() >> hdelta_y_last", cut, 
"goff");
 
  157   double zminlast = -0.6;
 
  158   double zmaxlast = 0.6;
 
  159   TH1F *hdelta_z_last = 
new TH1F(
"hdelta_z_last", 
"#Delta z @ last hit", 100, zminlast, zmaxlast);
 
  160   simtree->Draw(
"RecoTrackInfo.GetPositionLast().Z() - RecoTrackInfo.GetMCTrackInfo().GetPositionLast().Z() >> hdelta_z_last", cut, 
"goff");
 
  162   TH1F *hdelta_r_last = 
new TH1F(
"hdelta_r_last", 
"#Delta r @ last hit", 100, -rmax, rmax);
 
  163   simtree->Draw(
"RecoTrackInfo.GetPositionLast().Perp() - RecoTrackInfo.GetMCTrackInfo().GetPositionLast().Perp() >> hdelta_r_last", cut, 
"goff");
 
  168   double chargemin = -3;
 
  169   double chargemax = 3;
 
  170   int ncharge = chargemax - chargemin;
 
  171   TH1F *hdelta_charge = 
new TH1F(
"hdelta_charge", 
"#Delta #charge", ncharge, chargemin, chargemax);
 
  172   simtree->Draw(
"RecoTrackInfo.GetCharge() - RecoTrackInfo.GetMCTrackInfo().GetCharge() >> hdelta_charge", cut, 
"goff");
 
  177   TH1F *hthetagen = 
new TH1F(
"hthetagen", 
"mc theta dist", 180, 0, 180);
 
  178   TH1F *heffintheta = 
new TH1F(
"heffintheta", 
"efficiency vs #theta", 180, 0, 180);
 
  181   TCut cut_rec = cut_mc && 
"MCTrackInfo.GetRecoTrackID() != -1";
 
  182   cut_rec = cut_rec && 
"RecoTrackInfo[MCTrackInfo.GetRecoTrackID()].GetEfficiency() > 0.8";
 
  183   cut_rec = cut_rec && 
"RecoTrackInfo[MCTrackInfo.GetRecoTrackID()].IsClone() == 0";
 
  185   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Theta() * TMath::RadToDeg() >> hthetagen", cut_mc, 
"goff");
 
  186   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Theta() * TMath::RadToDeg() >> heffintheta", cut_rec, 
"goff");
 
  189   heffintheta->Sumw2();
 
  190   heffintheta->Divide(hthetagen);
 
  196   TH1F *hphigen = 
new TH1F(
"hphigen", 
"mc phi dist", 180, -180, 180);
 
  197   TH1F *heffinphi = 
new TH1F(
"heffinphi", 
"efficiency vs #phi", 180, -180, 180);
 
  198   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Phi() * TMath::RadToDeg() >> hphigen", cut_mc, 
"goff");
 
  199   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Phi() * TMath::RadToDeg() >> heffinphi", cut_rec, 
"goff");
 
  203   heffinphi->Divide(hphigen);
 
  208   TH1F *hmomgen = 
new TH1F(
"hmomgen", 
"mc mom dist", 100, 0, 3);
 
  209   TH1F *heffinmom = 
new TH1F(
"heffinmom", 
"efficiency vs mom", 100, 0, 3);
 
  210   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Mag() >> hmomgen", cut_mc, 
"goff");
 
  211   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Mag() >> heffinmom", cut_rec, 
"goff");
 
  215   heffinmom->Divide(hmomgen);
 
  220   TH1F *hptgen = 
new TH1F(
"hptgen", 
"mc pt dist", 100, 0, 3);
 
  221   TH1F *heffinpt = 
new TH1F(
"heffinpt", 
"efficiency vs pt", 100, 0, 3);
 
  222   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Perp() >> hptgen", cut_mc, 
"goff");
 
  223   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Perp() >> heffinpt", cut_rec, 
"goff");
 
  227   heffinpt->Divide(hptgen);
 
  232   TH1F *hplgen = 
new TH1F(
"hplgen", 
"mc pl dist", 100, 0, 3);
 
  233   TH1F *heffinpl = 
new TH1F(
"heffinpl", 
"efficiency vs pl", 100, 0, 3);
 
  234   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Z() >> hplgen", cut_mc, 
"goff");
 
  235   simtree->Draw(
"MCTrack[MCTrackInfo.GetMCTrackID()].GetMomentum().Z() >> heffinpl", cut_rec, 
"goff");
 
  239   heffinpl->Divide(hplgen);
 
  247   TFile 
outfile(
"QA_histograms.root", 
"RECREATE");
 
  260   hnofrecotracks->Write();
 
  261   hnofMCtracks->Write();
 
  263   hdelta_p_first->Write();
 
  264   hdelta_pz_first->Write();
 
  265   hdelta_pt_first->Write();
 
  266   hdelta_theta_first->Write();
 
  267   hdelta_phi_first->Write();
 
  268   hdelta_x_first->Write();
 
  269   hdelta_y_first->Write();
 
  270   hdelta_z_first->Write();
 
  271   hdelta_r_first->Write();
 
  274   hdelta_p_last->Write();
 
  275   hdelta_pz_last->Write();
 
  276   hdelta_pt_last->Write();
 
  277   hdelta_theta_last->Write();
 
  278   hdelta_phi_last->Write();
 
  279   hdelta_x_last->Write();
 
  280   hdelta_y_last->Write();
 
  281   hdelta_z_last->Write();
 
  282   hdelta_r_last->Write();
 
  284   hdelta_charge->Write();
 
  286   heffintheta->Write();
 
  294   FairSystemInfo sysInfo;
 
  295   Float_t maxMemory=sysInfo.GetMaxMemory();
 
  296   cout << 
"<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
 
  298   cout << 
"</DartMeasurement>" << endl;
 
  304   Float_t cpuUsage=ctime/
rtime;
 
  305   cout << 
"<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
 
  307   cout << 
"</DartMeasurement>" << endl;
 
  310   cout << 
"Real time " << rtime << 
" s, CPU time " << ctime
 
  312   cout << 
"CPU usage " << cpuUsage*100. << 
"%" << endl;
 
  313   cout << 
"Max Memory " << maxMemory << 
" MB" << endl;
 
  315   cout << 
"Macro finished successfully." << endl;