FairRoot/PandaRoot
runPULL1.C
Go to the documentation of this file.
1 {
2  gROOT->Reset();
3  gStyle->SetOptFit(1);
4 
5 
6  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
7  basiclibs();
8 
9  // Load this example libraries
10  gSystem->Load("libGeoBase");
11  gSystem->Load("libParBase");
12  gSystem->Load("libBase");
13  gSystem->Load("libField");
14  gSystem->Load("libPndData");
15  gSystem->Load("libGeane");
16  gSystem->Load("libPlane");
17  gSystem->Load("libGeaneEx");
18  gSystem->Load("libTrkBase");
19 
20  TFile *f=new TFile("ex1g.root");
21  TTree *simtree=f->Get("pndsim") ;
22 
23  fTrackParGeane = new TClonesArray("FairTrackParH");
24  fTrackParIni = new TClonesArray("FairTrackParH");
25  fTrackParFinal = new TClonesArray("FairTrackParH");
26 
27  TH1F *h1=new TH1F("h1","Phi ",100,-10.,10.);
28  TH1F *h2=new TH1F("h2","Lambda",100,-10,10);
29  TH1F *h3=new TH1F("h3","Qp",100,-10.,10.);
30  TH1F *h4=new TH1F("h4","Y",100,-10,10);
31  TH1F *h5=new TH1F("h5","Z",100,-10,10);
32  TH1F *h6=new TH1F("h6","Px",100, -10,10);
33  TH1F *h7=new TH1F("h7","Py",100,-10,10);
34  TH1F *h8=new TH1F("h8","Pz",100,-10,10);
35  TH1F *h9=new TH1F("h9","Ysc",100,-10,10);
36  TH1F *h10=new TH1F("h10","Zsc",100,-10,10);
37 
38  simtree->SetBranchAddress("GeaneTrackFinal",&fTrackParFinal);
39  simtree->SetBranchAddress("GeaneTrackPar",&fTrackParGeane);
40  FairTrackParH *fTrkF ;
41  FairTrackParH *fTrkG;
42  Int_t Nevents= simtree->GetEntriesFast();
43  cout<<Nevents<<endl;
44  for(Int_t i=0; i<Nevents; i++){
45  fTrackParGeane->Delete();
46  fTrackParFinal->Delete();
47  simtree->GetEntry(i);
48  for (Int_t k=0; k<fTrackParGeane->GetEntriesFast(); k++) {
49  fTrkF = (FairTrackParH *)fTrackParFinal->At(k);
50  fTrkG = (FairTrackParH *)fTrackParGeane->At(k);
51  if(fTrkF &&fTrkG ){
52  if(fTrkG->GetDPhi())h1->Fill((fTrkF->GetPhi()-fTrkG->GetPhi())/fTrkG->GetDPhi());
53  if(fTrkG->GetDLambda())h2->Fill((fTrkF->GetLambda()-fTrkG->GetLambda())/fTrkG->GetDLambda());
54  if(fTrkG->GetDQp())h3->Fill((fTrkF->GetQp()-fTrkG->GetQp())/fTrkG->GetDQp());
55  if(fTrkG->GetDY())h4->Fill((fTrkF->GetY() -fTrkG->GetY()) /fTrkG->GetDY());
56  if(fTrkG->GetDZ())h5->Fill((fTrkF->GetZ() -fTrkG->GetZ()) /fTrkG->GetDZ());
57  if(fTrkG->GetDPx())h6->Fill((fTrkF->GetPx()-fTrkG->GetPx())/fTrkG->GetDPx());
58  if(fTrkG->GetDPy())h7->Fill((fTrkF->GetPy()-fTrkG->GetPy())/fTrkG->GetDPy());
59  if(fTrkG->GetDPz())h8->Fill((fTrkF->GetPz()-fTrkG->GetPz())/fTrkG->GetDPz());
60  if(fTrkG->GetDY_sc())h9->Fill((fTrkF->GetY_sc()-fTrkG->GetY_sc())/fTrkG->GetDY_sc());
61  if(fTrkG->GetDZ_sc())h10->Fill((fTrkF->GetZ_sc()-fTrkG->GetZ_sc())/fTrkG->GetDZ_sc());
62  }
63  }
64  }
65  TCanvas *c=new TCanvas("c","c",900,600);
66  c->Divide(5,2);
67  c->cd(1);
68  h1->Draw();
69  h1-> Fit("gaus");
70  c->cd(2);
71  h2->Draw();
72  h2-> Fit("gaus");
73  c->cd(3);
74  h3->Draw();
75  h3-> Fit("gaus");
76  c->cd(4);
77  h4->Draw();
78  h4-> Fit("gaus");
79  c->cd(5);
80  h5->Draw();
81  h5-> Fit("gaus");
82  c->cd(6);
83  h6->Draw();
84  h6-> Fit("gaus");
85  c->cd(7);
86  h7->Draw();
87  h7-> Fit("gaus");
88  c->cd(8);
89  h8->Draw();
90  h8-> Fit("gaus");
91  c->cd(9);
92  h9->Draw();
93  h9-> Fit("gaus");
94  c->cd(10);
95  h10->Draw();
96  h10-> Fit("gaus");
97 
98  c->cd();
99 }
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")
TH1F * h9
Definition: runPULL1.C:35
basiclibs()
TTree * simtree
Definition: runPULL1.C:21
Int_t i
Definition: run_full.C:25
FairTrackParH * fTrkF
Definition: runPULL1.C:40
TH1F * h4
TH1F * h8
Definition: runPULL1.C:34
fTrackParFinal
Definition: runPULL1.C:25
TH2F * h5
Definition: draw_bands.C:19
FairTrackParH * fTrkG
Definition: runPULL1.C:41
TFile * f
Definition: bump_analys.C:12
TH1F * h3
fTrackParGeane
Definition: runPULL1.C:23
TH1F * h7
Definition: runPULL1.C:33
TH1F * h6
Definition: runPULL1.C:32
Int_t Nevents
Definition: runPULL1.C:42
fTrackParIni
Definition: runPULL1.C:24