]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/ITSrecpoints.C
New drawing routine from Nico and Daniela.
[u/mrichter/AliRoot.git] / ITS / ITSrecpoints.C
CommitLineData
077403c2 1#include "iostream.h"
2
3void ITSrecpoints (Int_t evNumber1=0,Int_t evNumber2=0)
4{
5/////////////////////////////////////////////////////////////////////////
6// This macro is a small example of a ROOT macro
7// illustrating how to read the output of GALICE
8// and do some analysis.
9//
10/////////////////////////////////////////////////////////////////////////
11
12// Dynamically link some shared libs
13
14 if (gClassTable->GetID("AliRun") < 0) {
15 gROOT->LoadMacro("loadlibs.C");
16 loadlibs();
17 }
18
19
20// Connect the Root Galice file containing Geometry, Kine and Hits
21
22 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
23 printf("file %p\n",file);
24 if (file) file->Close();
25 file = new TFile("galice.root","UPDATE");
26 file->ls();
27
28 printf ("I'm after Map \n");
29
30// Get AliRun object from file or create it if not on file
31
32 if (!gAlice) {
33 gAlice = (AliRun*)file->Get("gAlice");
34 if (gAlice) printf("AliRun object found on file\n");
35 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
36 }
37 printf ("I'm after gAlice \n");
38
39 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
40 if (!ITS) return;
41
42//
43// Event Loop
44//
45
46
47 AliITSgeom *geom = ITS->GetITSgeom();
48
49 // SPD
50
51 AliITSDetType *iDetType=ITS->DetType(0);
52 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
53 TClonesArray *dig0 = ITS->DigitsAddress(0);
54 TClonesArray *recp0 = ITS->ClustersAddress(0);
55 AliITSClusterFinderSPD *rec0=new AliITSClusterFinderSPD(seg0,dig0,recp0);
56 ITS->SetReconstructionModel(0,rec0);
57 // test
58 printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
59 printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
60
61
62 // SDD
63
64 AliITSDetType *iDetType=ITS->DetType(1);
65 AliITSgeom *geom = ITS->GetITSgeom();
66
67 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
68 if (!seg1) seg1 = new AliITSsegmentationSDD(geom);
69 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
70 if (!res1) res1=new AliITSresponseSDD();
71 TClonesArray *dig1 = ITS->DigitsAddress(1);
72 TClonesArray *recp1 = ITS->ClustersAddress(1);
73 AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
74 ITS->SetReconstructionModel(1,rec1);
75
76
77
78 // SSD
79
80 AliITSDetType *iDetType=ITS->DetType(2);
81 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
82 TClonesArray *dig2 = ITS->DigitsAddress(2);
83 TClonesArray *recp2 = ITS->ClustersAddress(2);
84 AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2,recp2);
85 ITS->SetReconstructionModel(2,rec2);
86 // test
87 printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dy());
88 printf("SSD nstrips %d \n",seg2->Npz(),seg2->Npx());
89
90
91 for (int nev=evNumber1; nev<= evNumber2; nev++) {
92 Int_t nparticles = gAlice->GetEvent(nev);
93 cout << "nev " <<nev<<endl;
94 cout << "nparticles " <<nparticles<<endl;
95 if (nev < evNumber1) continue;
96 if (nparticles <= 0) return;
97
98 TTree *TD = gAlice->TreeD();
99 Int_t nent=TD->GetEntries();
100 printf("Found %d entries in the tree (must be one per module per event!)\n",nent);
101 Int_t nmodules=geom->GetLastSSD();
102 //printf("nmodules %d\n",nmodules);
103 //Int_t last_entry=nent-(nmodules+1);
104 Int_t last_entry=1;
105 ITS->DigitsToRecPoints(nev,last_entry,"All");
106 } // event loop
107
108 file->Close();
109}
110
111
112
113
114
115
116
117
118
119
120
121
122
123