]>
Commit | Line | Data |
---|---|---|
e8189707 | 1 | #include "iostream.h" |
2 | ||
3 | void 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 | |
53 | // finder as it's done in this macro (ugly and impractical, no? ) | |
54 | ||
55 | ||
56 | ||
e8189707 | 57 | // Set the models for cluster finding |
58 | ||
59 | // SPD | |
60 | ||
61 | AliITSDetType *iDetType=ITS->DetType(0); | |
62 | AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); | |
63 | TClonesArray *dig0 = ITS->DigitsAddress(0); | |
64 | TClonesArray *recp0 = ITS->ClustersAddress(0); | |
65 | AliITSClusterFinderSPD *rec0=new AliITSClusterFinderSPD(seg0,dig0,recp0); | |
66 | ITS->SetReconstructionModel(0,rec0); | |
67 | // test | |
9c712bc6 | 68 | //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); |
69 | //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); | |
e8189707 | 70 | |
71 | ||
72 | // SDD | |
73 | ||
9c712bc6 | 74 | Float_t baseline = 10.; |
75 | Float_t noise = 1.67; | |
90dea86a | 76 | Float_t thres = baseline+3*noise; |
9c712bc6 | 77 | printf("thresh %d\n",thres); |
78 | ||
e8189707 | 79 | AliITSDetType *iDetType=ITS->DetType(1); |
80 | AliITSgeom *geom = ITS->GetITSgeom(); | |
81 | ||
82 | AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); | |
83 | if (!seg1) seg1 = new AliITSsegmentationSDD(geom); | |
84 | AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); | |
85 | if (!res1) res1=new AliITSresponseSDD(); | |
90dea86a | 86 | res1->SetMagicValue(900.); |
6bfd27fa | 87 | Float_t magic = res1->MagicValue(); |
88 | Float_t top = res1->MaxAdc(); | |
89 | thres *= top/magic; | |
90dea86a | 90 | res1->SetNoiseParam(noise,baseline); |
9c712bc6 | 91 | Float_t n,b; |
92 | res1->GetNoiseParam(n,b); | |
93 | printf("SDD: noise baseline %f %f zs option %s data type %s\n",n,b,res1->ZeroSuppOption(),res1->DataType()); | |
94 | printf("SDD: DriftSpeed %f TopValue %f\n",res1->DriftSpeed(),res1->MagicValue()); | |
95 | Float_t dif0,dif1; | |
96 | res1->DiffCoeff(dif0,dif1); | |
97 | printf("SDD: dif0 %f dif1 %f\n",dif0,dif1); | |
e8189707 | 98 | TClonesArray *dig1 = ITS->DigitsAddress(1); |
99 | TClonesArray *recp1 = ITS->ClustersAddress(1); | |
100 | AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); | |
9c712bc6 | 101 | rec1->SetMinNCells(6); |
102 | rec1->SetTimeCorr(70.); | |
90dea86a | 103 | rec1->SetCutAmplitude((int)thres); |
e8189707 | 104 | ITS->SetReconstructionModel(1,rec1); |
105 | ||
e8189707 | 106 | // SSD |
107 | ||
108 | AliITSDetType *iDetType=ITS->DetType(2); | |
109 | AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); | |
110 | TClonesArray *dig2 = ITS->DigitsAddress(2); | |
111 | TClonesArray *recp2 = ITS->ClustersAddress(2); | |
112 | AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2,recp2); | |
113 | ITS->SetReconstructionModel(2,rec2); | |
114 | // test | |
9c712bc6 | 115 | //printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz()); |
116 | //printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx()); | |
e8189707 | 117 | |
118 | ||
119 | ||
120 | // | |
121 | // Event Loop | |
122 | // | |
123 | ||
124 | for (int nev=evNumber1; nev<= evNumber2; nev++) { | |
125 | Int_t nparticles = gAlice->GetEvent(nev); | |
126 | cout << "nev " <<nev<<endl; | |
127 | cout << "nparticles " <<nparticles<<endl; | |
128 | if (nev < evNumber1) continue; | |
129 | if (nparticles <= 0) return; | |
130 | ||
131 | TTree *TD = gAlice->TreeD(); | |
132 | Int_t nent=TD->GetEntries(); | |
133 | printf("Found %d entries in the tree (must be one per module per event!)\n",nent); | |
134 | //Int_t nmodules=geom->GetLastSSD(); | |
135 | //Int_t last_entry=nent-(nmodules+1); | |
136 | Int_t last_entry=1; | |
137 | ITS->DigitsToRecPoints(nev,last_entry,"All"); | |
138 | } // event loop | |
139 | ||
9c712bc6 | 140 | delete rec0; |
141 | delete rec1; | |
142 | delete rec2; | |
143 | ||
e8189707 | 144 | file->Close(); |
145 | } | |
146 | ||
147 | ||
148 | ||
149 | ||
150 | ||
151 | ||
152 | ||
153 | ||
154 | ||
155 | ||
156 | ||
157 | ||
158 | ||
159 |