]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/ITSDigitsToClusters.C
Automatic treatment of the magnetic field value
[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
90dea86a 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
21b825a4 53 // finder as it's done in this macro (ugly and impractical, no? )
90dea86a 54
55
56
e8189707 57 // Set the models for cluster finding
58
59 // SPD
60
a939f834 61 ITS->MakeTreeC();
62 Int_t nparticles=gAlice->GetEvent(0);
63
21b825a4 64
e8189707 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);
21b825a4 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
e8189707 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();
1ef94a0c 85
86 Float_t baseline,noise;
87 res1->GetNoiseParam(noise,baseline);
88 Float_t noise_after_el = res1->GetNoiseAfterElectronics();
89 Float_t thres = baseline;
90 thres += (4.*noise_after_el); // TB // (4.*noise_after_el);
91 printf("thres %f\n",thres);
92 res1->Print();
93
a63b75ed 94 TClonesArray *dig1 = ITS->DigitsAddress(1);
e8189707 95 TClonesArray *recp1 = ITS->ClustersAddress(1);
96 AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
90dea86a 97 rec1->SetCutAmplitude((int)thres);
a63b75ed 98 ITS->SetReconstructionModel(1,rec1);
1ef94a0c 99 rec1->Print();
e8189707 100
e8189707 101 // SSD
102
103 AliITSDetType *iDetType=ITS->DetType(2);
104 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
105 TClonesArray *dig2 = ITS->DigitsAddress(2);
a939f834 106 AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2);
e8189707 107 ITS->SetReconstructionModel(2,rec2);
108 // test
9c712bc6 109 //printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
110 //printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx());
e8189707 111
112
113
114//
115// Event Loop
116//
117
e53d0fac 118 cout << "Looking for clusters...\n";
119
120 TStopwatch timer;
121
7b97c7b3 122 if(!gAlice->TreeR()) gAlice->MakeTree("R");
123 //make branch
124 ITS->MakeBranch("R");
125
e8189707 126 for (int nev=evNumber1; nev<= evNumber2; nev++) {
a939f834 127 if(nev>0) {
21b825a4 128 nparticles = gAlice->GetEvent(nev);
129 gAlice->SetEvent(nev);
130 if(!gAlice->TreeR()) gAlice-> MakeTree("R");
131 ITS->MakeBranch("R");
a939f834 132 }
e8189707 133 cout << "nev " <<nev<<endl;
134 cout << "nparticles " <<nparticles<<endl;
135 if (nev < evNumber1) continue;
136 if (nparticles <= 0) return;
137
a939f834 138 Int_t last_entry=0;
1ef94a0c 139 timer.Start();
e8189707 140 ITS->DigitsToRecPoints(nev,last_entry,"All");
21b825a4 141 //ITS->DigitsToRecPoints(nev,last_entry,"SPD");
1ef94a0c 142 timer.Stop(); timer.Print();
e8189707 143 } // event loop
144
9c712bc6 145 delete rec0;
146 delete rec1;
147 delete rec2;
148
e8189707 149 file->Close();
150}