]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/oldmacros/ITSDigitsToClusters.C
Removing obsolete macros
[u/mrichter/AliRoot.git] / ITS / oldmacros / ITSDigitsToClusters.C
CommitLineData
08cb00f2 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 // NOTE: if you foresee to have (in segmentation or response) parameter
49 // values other than the default ones, and these values are used not only in
50 // simulation but in cluster finder as well, please set them via your
51 // local Config.C - the streamer will take care of writing the correct
52 // info and you'll no longer be obliged to set them again for your cluster
53 // finder as it's done in this macro (ugly)
54
55
56
57 // Set the models for cluster finding
58
59 // SPD
60
61 ITS->MakeTreeC();
62 Int_t nparticles=gAlice->GetEvent(0);
63
64
65 AliITSDetType *iDetType=ITS->DetType(0);
66 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
67 TClonesArray *dig0 = ITS->DigitsAddress(0);
68 TClonesArray *recp0 = ITS->ClustersAddress(0);
69 AliITSClusterFinderSPD *rec0=new AliITSClusterFinderSPD(seg0,dig0,recp0);
70 ITS->SetReconstructionModel(0,rec0);
71 // test
72 //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
73 //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
74
75
76 // SDD
77
78 AliITSDetType *iDetType=ITS->DetType(1);
79 AliITSgeom *geom = ITS->GetITSgeom();
80
81 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
82 if (!seg1) seg1 = new AliITSsegmentationSDD(geom);
83 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
84 if (!res1) res1=new AliITSresponseSDD("simulated");
85// res1->Print();
86
87 //Float_t nsig_noise = 4.;
88
89 TClonesArray *dig1 = ITS->DigitsAddress(1);
90 TClonesArray *recp1 = ITS->ClustersAddress(1);
91 AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
92 //rec1->SetCutAmplitude(nsig_noise);
93 ITS->SetReconstructionModel(1,rec1);
94// rec1->Print();
95
96 // SSD
97
98 AliITSDetType *iDetType=ITS->DetType(2);
99 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
100 TClonesArray *dig2 = ITS->DigitsAddress(2);
101 AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2);
102 ITS->SetReconstructionModel(2,rec2);
103 // test
104 //printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
105 //printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx());
106
107
108
109//
110// Event Loop
111//
112
113 cout << "Looking for clusters...\n";
114
115 TStopwatch timer;
116
117 if(!gAlice->TreeR()) gAlice->MakeTree("R");
118 //make branch
119 ITS->MakeBranch("R");
120
121 for (int nev=evNumber1; nev<= evNumber2; nev++) {
122 if(nev>0) {
123 nparticles = gAlice->GetEvent(nev);
124 gAlice->SetEvent(nev);
125 if(!gAlice->TreeR()) gAlice-> MakeTree("R");
126 ITS->MakeBranch("R");
127 }
128 cout << "nev " <<nev<<endl;
129 cout << "nparticles " <<nparticles<<endl;
130 if (nev < evNumber1) continue;
131 if (nparticles <= 0) return;
132
133 Int_t last_entry=0;
134 timer.Start();
135 ITS->DigitsToRecPoints(nev,last_entry,"All");
136 //ITS->DigitsToRecPoints(nev,last_entry,"SPD");
137 timer.Stop(); timer.Print();
138 } // event loop
139
140 delete rec0;
141 delete rec1;
142 delete rec2;
143
144 file->Close();
145}