Splitting raw data libs
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerZTest.C
CommitLineData
1621ded2 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TFile.h>
3#include <TH1F.h>
4#include <TH2F.h>
5#include <TTree.h>
6#include <Riostream.h>
7#include <AliRun.h>
8#include <AliHeader.h>
9#include <AliGenEventHeader.h>
10#include <AliITSVertexerPPZ.h>
88cb7938 11#include <AliRunLoader.h>
12#include <AliITSLoader.h>
1621ded2 13
14#endif
15
88cb7938 16void AliITSVertexerZTest(Float_t delphi=0.05,Float_t window=3.,Float_t initx=0., Float_t inity=0.,TString FileIn="galice.root"){
1621ded2 17 // delphi ---> azimuthal range to accept tracklets
18 // window ---> window in Z around the peak of tracklets proj. in mm
88cb7938 19 Int_t kDebug = 50;
1621ded2 20 TH2F *diff2 = new TH2F("diff2","Zfound vs Ztrue",100,-6,6,100,-6,6);
21 TH1F *diff1 = new TH1F("diff1","Zfound - Ztrue(#mu m)",100,-500,500);
22 delete gAlice;
23 gAlice = 0;
88cb7938 24 AliRunLoader *rl = AliRunLoader::Open(FileIn.Data());
25 Int_t retval = rl->LoadgAlice();
26 if(retval){
27 cerr<<"AliITSVertexerZTest.C: AliRun object not found"<<endl;
28 return;
29 }
30 retval = rl->LoadHeader();
31 if (retval){
32 cerr<<"AliITSVertexerZTest.C : LoadHeader returned error"<<endl;
33 return;
34 }
35 retval = rl->LoadKinematics();
36 if (retval){
37 cerr<<"AliITSVertexerZTest.C : LoadKinematics returned error"<<endl;
38 return;
39 }
40 AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
41
42 if(!ITSloader){
43 cerr<<"AliITSVertexerZTest.C : ITS loader not found"<<endl;
44 return;
45 }
46 // ITSloader->LoadRecPoints("read");
47 // TFile *fo = new TFile("vertici.root","recreate");
48 AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ("default",initx,inity);
1621ded2 49 dovert->SetDebug(0);
50 dovert->SetDiffPhiMax(delphi);
51 dovert->SetWindow(window);
52 dovert->PrintStatus();
53 Int_t meno100=0;
54 Int_t meno200=0;
55 Int_t meno110=0;
56 Int_t sigmazero=0;
2e7b4767 57 AliESDVertex *vert = 0;
88cb7938 58 for(Int_t i=0; i<rl->TreeE()->GetEntries(); i++){
59 rl->GetEvent(i);
1621ded2 60 // The true Z coord. is fetched for comparison
88cb7938 61 AliHeader *header = rl->GetHeader();
1621ded2 62 AliGenEventHeader* genEventHeader = header->GenEventHeader();
63 TArrayF primaryVertex(3);
64 genEventHeader->PrimaryVertex(primaryVertex);
65 vert = dovert->FindVertexForCurrentEvent(i);
66 if(kDebug>0){
67 // Prints the results
68 cout <<"========================================================\n";
69 cout << "Event number: "<<i<<") Z Vertex:"<<endl;
70 if(vert){
71 cout<<"FOUND: "<<vert->GetZv()<<"; ";
72 cout<<vert->GetZRes()<<"; "<<vert->GetNContributors()<<endl;
73 }
74 else {
75 cout<<"NOT FOUND - fZFound= "<<dovert->GetZFound();
76 cout<<" fZsig= "<<dovert->GetZsig()<<endl;
77 if(dovert->GetZFound() == -100) meno100++;
78 if(dovert->GetZFound() == -200) meno200++;
79 if(dovert->GetZFound() == -110) meno110++;
80 }
81 cout <<" True Z position "<<primaryVertex[2]<<", diff= ";
82 cout<<(primaryVertex[2]-dovert->GetZFound())*10000.<<endl;
83 }
84 if(vert){
85 Double_t pos[3];
86 for(Int_t kk=0;kk<3;kk++)pos[kk]=(Double_t)primaryVertex[kk];
87 vert->SetTruePos(pos);
88 Float_t found = vert->GetZv();
89 diff2->Fill(primaryVertex[2],found);
90 found = 10000.*(found-primaryVertex[2]);
91 if(vert->GetZRes()!=0){
92 diff1->Fill(found);
93 }
94 else {
95 sigmazero++;
96 }
97 dovert->WriteCurrentVertex();
98 }
99 }
1621ded2 100 if(kDebug>0){
101 cout<<"Number of bad vertices with code -100: "<<meno100<<endl;
102 cout<<"Number of bad vertices with code -110: "<<meno110<<endl;
103 cout<<"Number of bad vertices with code -200: "<<meno200<<endl;
104 cout<<"Only one tracklet (sigma = 0) "<<sigmazero<<endl;
105 }
106
107}