Prepare for the new TPC layout
[u/mrichter/AliRoot.git] / EVE / macros / make_scan_results.C
CommitLineData
c12be4d4 1// Label is used to store scanning result for tracks and trackelts.
2//
3// BIT(1) stores the original selection.
4// BIT(0) stores the user selection (set to same value as b1 at init).
5//
6// This allows to check all possible combinations.
7
4267948f 8struct XXX
9{
10 const char *bname;
11 const char *oname;
12 TBranch *branch;
13 AliESDVertex *vert;
14};
15
16XXX vvv[3] = {
17 { "VT", "PrimVertTracks" },
18 { "VTPC", "PrimVertTPC" },
19 { "VSPD", "PrimVertSPD" }
20};
c12be4d4 21
22void make_scan_results()
23{
24 TFile *f = TFile::Open("scan_results.root", "UPDATE");
25
26 f->Delete("SR;*");
27
28 T = new TTree("SR", "Scanning results");
29
4267948f 30 TClonesArray* ts = new TClonesArray("AliESDtrack", 32);
31 TBranch * tb = T->Branch("T", &ts);
32 delete ts;
c12be4d4 33
4267948f 34 AliMultiplicity *ms = 0;
35 TBranch *mb = T->Branch("M", &ms);
c12be4d4 36
4267948f 37 for (Int_t v = 0; v < 3; ++v)
38 {
39 vvv[v].vert = 0;
40 vvv[v].branch = T->Branch(vvv[v].bname, &vvv[v].vert);
41 }
c12be4d4 42
43 for (Int_t i=0; i<=9999; ++i)
44 {
45 TString name;
46
47 name.Form("Tracks_%04d", i);
4267948f 48 ts = (TClonesArray*) f->Get(name);
49 if (ts == 0)
50 continue;
c12be4d4 51
52 name.Form("Tracklets_%04d", i);
4267948f 53 ms = (AliMultiplicity*) f->Get(name);
54 if (ms == 0)
55 Error("make_scan_results", "'%s' not found.", name.Data());
c12be4d4 56
4267948f 57 tb->SetAddress(&ts);
58 mb->SetAddress(&ms);
59
60 for (Int_t v = 0; v < 3; ++v)
c12be4d4 61 {
4267948f 62 name.Form("%s_%04d", vvv[v].oname, i);
63 vvv[v].vert = (AliESDVertex*) f->Get(name);
64 if (vvv[v].vert == 0)
65 Error("make_scan_results", "'%s' not found.", name.Data());
66 vvv[v].branch->SetAddress(&vvv[v].vert);
c12be4d4 67 }
68
4267948f 69 T->Fill();
70
71 delete ts;
72 delete ms;
73 for (Int_t v = 0; v < 3; ++v) delete vvv[v].vert;
c12be4d4 74 }
75
76 T->Write();
77
78 f->Close();
79 delete f;
80}