FairRoot/PandaRoot
Fit.C
Go to the documentation of this file.
1 // macro to fit hits with a straight line
2 // Simone Bianco 15/07/2010
3 
4 int Fit()
5 {
6 
7  // Load basic libraries
8  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
9  rootlogon();
10 
11  Int_t iVerbose = 0;
12  Int_t nEvents = 5100;
13 
14  // ----- Timer --------------------------------------------------------
15  TStopwatch timer;
16  timer.Start();
17  // --------------
18 
19  TString trackFile = "DESY/data23NewAli.hit.hits.root";
20 
21  TString trkfitFile = "DESY/TEST/data23NewAliYWell.hit.fit.root";
22 
23 
24  //Run Reconstruction
25  // ------------
26  FairRunAna *fRun = new FairRunAna();
27  fRun->SetInputFile(trackFile);
28 
29  fRun->SetOutputFile(trkfitFile);
30 
31  TtLinFitTask* linfit = new TtLinFitTask();
32 
33  fRun->AddTask(linfit);
34 
35  // Initialize and run
36  fRun->Init();
37  fRun->Run(0, nEvents);
38 
39 
40  timer.Stop();
41  Double_t rtime = timer.RealTime();
42  Double_t ctime = timer.CpuTime();
43  cout << endl << endl;
44  cout << "Macro finished succesfully." << endl;
45  cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
46  cout << endl;
47  //exit();
48  return 0;
49 }
cout<<"the track theta is "<< trackthe<< endl;mc_x[j]=vecmc.X();mc_y[j]=vecmc.Y();mc_z[j]=vecmc.Z()-1110;r_mc[j]=TMath::Sqrt(mc_x[j]*mc_x[j]+mc_y[j]*mc_y[j]);std::cout<<"the r_mc[j] is "<< r_mc[j]<< std::endl;std::cout<<"the mc_z[j] is "<< mc_z[j]<< std::endl;r_mc_err[j]=0;z_mc_err[j]=0;rc_x[j]=vecrc.X();rc_y[j]=vecrc.Y();rc_z[j]=vecrc.Z()-1110;r_rc[j]=TMath::Sqrt(rc_x[j]*rc_x[j]+rc_y[j]*rc_y[j]);std::cout<<"the r_rc[j] is "<< r_rc[j]<< std::endl;std::cout<<"the rc_z[j] is "<< rc_z[j]<< std::endl;r_rc_err[j]=0;z_rc_err[j]=0;double tempmc=TMath::Sqrt(mc_x[0]*mc_x[0]+mc_y[0]*mc_y[0]);mcfirstthe=TMath::ATan(tempmc/(mc_z[0]+1110));cout<<"the first hit theta is "<< mcfirstthe<< endl;}TGraphErrors *mctrack=new TGraphErrors(4, mc_z, r_mc, z_mc_err, r_mc_err);mctrack-> Fit("trackFit","ONF")
TString trackFile
FairRunAna * fRun
Definition: hit_dirc.C:58
Double_t
Int_t nEvents
Definition: hit_dirc.C:11
TStopwatch timer
Definition: hit_dirc.C:51
Double_t ctime
Definition: hit_dirc.C:114
Int_t iVerbose
Double_t rtime
Definition: hit_dirc.C:113