Latest Fixes from M.Bondila
[u/mrichter/AliRoot.git] / ITS / ITSDigitsToClusters.C
CommitLineData
e8189707 1#include "iostream.h"
2
3void ITSDigitsToClusters (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 } else {
18 delete gAlice;
19 gAlice=0;
20 }
21
22
23// Connect the Root Galice file containing Geometry, Kine and Hits
24
25 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
26 printf("file %p\n",file);
27 if (file) file->Close();
28 file = new TFile("galice.root","UPDATE");
29 file->ls();
30
31 printf ("I'm after Map \n");
32
33// Get AliRun object from file or create it if not on file
34
35 if (!gAlice) {
36 gAlice = (AliRun*)file->Get("gAlice");
37 if (gAlice) printf("AliRun object found on file\n");
38 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
39 }
40 printf ("I'm after gAlice \n");
41
42 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
43 if (!ITS) return;
44
45 AliITSgeom *geom = ITS->GetITSgeom();
46
47
48 // Set the models for cluster finding
49
50 // SPD
51
52 AliITSDetType *iDetType=ITS->DetType(0);
53 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
54 TClonesArray *dig0 = ITS->DigitsAddress(0);
55 TClonesArray *recp0 = ITS->ClustersAddress(0);
56 AliITSClusterFinderSPD *rec0=new AliITSClusterFinderSPD(seg0,dig0,recp0);
57 ITS->SetReconstructionModel(0,rec0);
58 // test
59 printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
60 printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
61
62
63 // SDD
64
65 AliITSDetType *iDetType=ITS->DetType(1);
66 AliITSgeom *geom = ITS->GetITSgeom();
67
68 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
69 if (!seg1) seg1 = new AliITSsegmentationSDD(geom);
70 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
71 if (!res1) res1=new AliITSresponseSDD();
2745fd4d 72 res1->SetNoiseParam(0.,0.);
e8189707 73 TClonesArray *dig1 = ITS->DigitsAddress(1);
74 TClonesArray *recp1 = ITS->ClustersAddress(1);
75 AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
76 ITS->SetReconstructionModel(1,rec1);
77
78
79
80 // SSD
81
82 AliITSDetType *iDetType=ITS->DetType(2);
83 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
84 TClonesArray *dig2 = ITS->DigitsAddress(2);
85 TClonesArray *recp2 = ITS->ClustersAddress(2);
86 AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2,recp2);
87 ITS->SetReconstructionModel(2,rec2);
88 // test
89 printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
90 printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx());
91
92
93
94//
95// Event Loop
96//
97
98 for (int nev=evNumber1; nev<= evNumber2; nev++) {
99 Int_t nparticles = gAlice->GetEvent(nev);
100 cout << "nev " <<nev<<endl;
101 cout << "nparticles " <<nparticles<<endl;
102 if (nev < evNumber1) continue;
103 if (nparticles <= 0) return;
104
105 TTree *TD = gAlice->TreeD();
106 Int_t nent=TD->GetEntries();
107 printf("Found %d entries in the tree (must be one per module per event!)\n",nent);
108 //Int_t nmodules=geom->GetLastSSD();
109 //Int_t last_entry=nent-(nmodules+1);
110 Int_t last_entry=1;
111 ITS->DigitsToRecPoints(nev,last_entry,"All");
112 } // event loop
113
114 file->Close();
115}
116
117
118
119
120
121
122
123
124
125
126
127
128
129