StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vertEff.C
1 void vertEff(char *file){
2 
3  gSystem->Load("$HOME/MyEvent/MyEvent");
4 
5  TFile *f=new TFile(file,"OPEN");
6  TTree *myEventTree=(TTree*)f->Get("mEventTree");
7  MyEvent *ev=new MyEvent();
8  myEventTree->SetBranchAddress("branch",&ev);
9 
10 
11  TH1F *h_vert_all=new TH1F("h_vert_all","vertex hijing",160,-80.,80.);
12  TH1F *h_vert_no=new TH1F("h_vert_no","vertex hijing, no prim.",160,-80.,80.);
13  TH1F *h_pion_all=new TH1F("h_pion_all","hijing pions",12,0.,6.);
14  TH1F *h_pion_no=new TH1F("h_pion_no","hijing pions, no prim",12,0.,6.);
15  TH1F *h_pion_reco=new TH1F("h_pion_reco","hijing pions, prim",12,0.,6.);
16  TH1F *h_vert_res=new TH1F("h_vert_res","vertex resolution",200,-50.,50.);
17 
18  TH1F *h_gg_all=new TH1F("h_gg_all","good globals",100,0.,100.);
19  TH1F *h_gg_reco=new TH1F("h_gg_reco","good globals (vtx reco.)",100,0.,100.);
20 
21  h_vert_all->Sumw2();
22  h_vert_no->Sumw2();
23  h_pion_all->Sumw2();
24  h_pion_no->Sumw2();
25  h_pion_reco->Sumw2();
26  h_vert_res->Sumw2();
27 
28  Int_t i=0;
29 
30  int n_ev=0;
31  int n_ev_no=0;
32 
33  while(myEventTree->GetEntry(i)){
34 
35  n_ev++;
36 
37 
38  TVector3 vert=ev->vertex();
39 
40  h_gg_all->Fill(ev->goodGlobals());
41  if(fabs(vert.Z())>0.0000001){
42  h_gg_reco->Fill(ev->goodGlobals());
43  }
44 
45 
46  TClonesArray *clP=ev->getMcPionArray();
47  if(fabs(vert.Z())>0.0000001){
48  h_vert_res->Fill(vert.Z()-ev->zdcVertexZ());
49  }
50 
51  h_vert_all->Fill(ev->zdcVertexZ());
52  for(int i_p=0;i_p<ev->numberOfMcPions();i_p++){
53  MyMcTrack *pion=(MyMcTrack*)clP->At(i_p);
54  if(pion->momentum().PseudoRapidity()>0.&&pion->momentum().PseudoRapidity()<1.){
55  h_pion_all->Fill(pion->momentum().Pt());
56  if(fabs(vert.Z())<0.0000001){
57  h_pion_no->Fill(pion->momentum().Pt());
58  }
59  else h_pion_reco->Fill(pion->momentum().Pt());
60  }
61  }
62 
63 
64 
65  if(fabs(vert.Z())<0.0000001){
66  n_ev_no++;
67  h_vert_no->Fill(ev->zdcVertexZ());
68  }
69 
70  i++;
71  }
72 
73  TCanvas *c=new TCanvas("c","c",600,900);
74  c->Divide(2,3);
75  c->cd(1);
76  gPad->SetLogy();
77  h_vert_all->Draw();
78  h_vert_all->SetMinimum(1.);
79  h_vert_no->SetLineColor(4);
80  h_vert_no->DrawCopy("same");
81  c->cd(2);
82  h_vert_no->Divide(h_vert_all);
83  h_vert_no->Draw();
84  c->cd(3);
85  gPad->SetLogy();
86  h_pion_all->Scale(1./n_ev);
87  h_pion_all->Draw();
88  h_pion_no->Scale(1./n_ev_no);
89  h_pion_no->SetLineColor(4);
90  h_pion_no->DrawCopy("same");
91  c->cd(4);
92  h_pion_reco->Scale(1./n_ev);
93  h_pion_reco->Divide(h_pion_all);
94  h_pion_reco->Draw();
95  c->cd(5);
96  gPad->SetLogy();
97  h_vert_res->Draw();
98  c->SaveAs("hijing_vert.root");
99 }