]>
Commit | Line | Data |
---|---|---|
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> | |
11 | ||
12 | #endif | |
13 | ||
14 | void AliITSVertexerZTest(Float_t delphi=0.05,Float_t window=3.,Float_t initx=0., Float_t inity=0.,TString FileWithKine="galice.root", TString FileWithRecP="galice.root"){ | |
15 | // delphi ---> azimuthal range to accept tracklets | |
16 | // window ---> window in Z around the peak of tracklets proj. in mm | |
17 | Int_t kDebug = 0; | |
18 | TH2F *diff2 = new TH2F("diff2","Zfound vs Ztrue",100,-6,6,100,-6,6); | |
19 | TH1F *diff1 = new TH1F("diff1","Zfound - Ztrue(#mu m)",100,-500,500); | |
20 | delete gAlice; | |
21 | gAlice = 0; | |
22 | TFile *in = new TFile("galice.root"); | |
23 | gAlice = (AliRun*)in->Get("gAlice"); | |
24 | if(FileWithKine != FileWithRecP)gAlice->SetTreeRFileName(FileWithRecP); | |
25 | TFile *fo = new TFile("vertici.root","recreate"); | |
26 | AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ(in,fo,initx,inity); | |
27 | dovert->SetDebug(0); | |
28 | dovert->SetDiffPhiMax(delphi); | |
29 | dovert->SetWindow(window); | |
30 | dovert->PrintStatus(); | |
31 | Int_t meno100=0; | |
32 | Int_t meno200=0; | |
33 | Int_t meno110=0; | |
34 | Int_t sigmazero=0; | |
35 | AliITSVertex *vert = 0; | |
36 | for(Int_t i=0; i<gAlice->TreeE()->GetEntries(); i++){ | |
37 | gAlice->GetEvent(i); | |
38 | // The true Z coord. is fetched for comparison | |
39 | AliHeader *header = gAlice->GetHeader(); | |
40 | AliGenEventHeader* genEventHeader = header->GenEventHeader(); | |
41 | TArrayF primaryVertex(3); | |
42 | genEventHeader->PrimaryVertex(primaryVertex); | |
43 | vert = dovert->FindVertexForCurrentEvent(i); | |
44 | if(kDebug>0){ | |
45 | // Prints the results | |
46 | cout <<"========================================================\n"; | |
47 | cout << "Event number: "<<i<<") Z Vertex:"<<endl; | |
48 | if(vert){ | |
49 | cout<<"FOUND: "<<vert->GetZv()<<"; "; | |
50 | cout<<vert->GetZRes()<<"; "<<vert->GetNContributors()<<endl; | |
51 | } | |
52 | else { | |
53 | cout<<"NOT FOUND - fZFound= "<<dovert->GetZFound(); | |
54 | cout<<" fZsig= "<<dovert->GetZsig()<<endl; | |
55 | if(dovert->GetZFound() == -100) meno100++; | |
56 | if(dovert->GetZFound() == -200) meno200++; | |
57 | if(dovert->GetZFound() == -110) meno110++; | |
58 | } | |
59 | cout <<" True Z position "<<primaryVertex[2]<<", diff= "; | |
60 | cout<<(primaryVertex[2]-dovert->GetZFound())*10000.<<endl; | |
61 | } | |
62 | if(vert){ | |
63 | Double_t pos[3]; | |
64 | for(Int_t kk=0;kk<3;kk++)pos[kk]=(Double_t)primaryVertex[kk]; | |
65 | vert->SetTruePos(pos); | |
66 | Float_t found = vert->GetZv(); | |
67 | diff2->Fill(primaryVertex[2],found); | |
68 | found = 10000.*(found-primaryVertex[2]); | |
69 | if(vert->GetZRes()!=0){ | |
70 | diff1->Fill(found); | |
71 | } | |
72 | else { | |
73 | sigmazero++; | |
74 | } | |
75 | dovert->WriteCurrentVertex(); | |
76 | } | |
77 | } | |
78 | in->Close(); | |
79 | fo->Close(); | |
80 | delete in; | |
81 | delete fo; | |
82 | if(kDebug>0){ | |
83 | cout<<"Number of bad vertices with code -100: "<<meno100<<endl; | |
84 | cout<<"Number of bad vertices with code -110: "<<meno110<<endl; | |
85 | cout<<"Number of bad vertices with code -200: "<<meno200<<endl; | |
86 | cout<<"Only one tracklet (sigma = 0) "<<sigmazero<<endl; | |
87 | } | |
88 | ||
89 | } |