]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
9 | // | |
10 | // AliEveTOFDigitsInfo | |
11 | // | |
12 | ||
13 | #include <TEveTreeTools.h> | |
14 | ||
15 | #include "AliEveTOFDigitsInfo.h" | |
16 | #include <AliTOFdigit.h> | |
17 | #include <AliTOFGeometry.h> | |
18 | //#include <AliTOFDigitMap.h> | |
19 | ||
20 | using namespace std; | |
21 | ||
22 | //_________________________________________________________ | |
23 | ||
24 | ClassImp(AliEveTOFDigitsInfo) | |
25 | ||
26 | AliEveTOFDigitsInfo::AliEveTOFDigitsInfo(): | |
27 | TObject(), | |
28 | TEveRefCnt(), | |
29 | fTree (0), | |
30 | fNewTree (0), | |
31 | fGeom (0), | |
32 | fTOFdigitMap(new AliTOFDigitMap()) | |
33 | {} | |
34 | /* ******************************************************* */ | |
35 | ||
36 | AliEveTOFDigitsInfo:: ~AliEveTOFDigitsInfo() | |
37 | { | |
38 | ||
39 | delete fGeom; | |
40 | delete fTree; | |
41 | delete fNewTree; | |
42 | delete fTOFdigitMap; | |
43 | ||
44 | } | |
45 | /* ******************************************************* */ | |
46 | ||
47 | void AliEveTOFDigitsInfo::SetTree(TTree* tree) | |
48 | { | |
49 | static const TEveException eH("AliEveTOFDigitsInfo::SetTree "); | |
50 | ||
51 | if(fGeom == 0) { | |
52 | fGeom = new AliTOFGeometry(); | |
53 | } | |
54 | ||
55 | fTree = tree; | |
56 | /* | |
57 | DecRefCount(); | |
58 | IncRefCount(); | |
59 | */ | |
60 | } | |
61 | /* ******************************************************* */ | |
62 | ||
63 | void AliEveTOFDigitsInfo::LoadDigits() | |
64 | { | |
65 | ||
66 | TClonesArray *digitsTOF = 0x0; | |
67 | AliTOFdigit *digs; | |
68 | ||
69 | fTree->SetBranchAddress("TOF",&digitsTOF); | |
70 | fTree->GetEntry(0); | |
71 | ||
72 | Int_t vol[5] = {-1,-1,-1,-1,-1}; | |
73 | ||
74 | for (Int_t digitNumber=0; digitNumber<digitsTOF->GetEntries(); digitNumber++) { | |
75 | ||
76 | //if (digitNumber==digitsTOF->GetEntries()-1) printf(" Hello 4 -> %3i digit of %i \n", digitNumber+1, digitsTOF->GetEntries()); | |
77 | ||
78 | digs = (AliTOFdigit*)digitsTOF->UncheckedAt(digitNumber); | |
79 | ||
80 | vol[0] = digs->GetSector(); // Sector Number (0-17) | |
81 | vol[1] = digs->GetPlate(); // Plate Number (0-4) | |
82 | vol[2] = digs->GetStrip(); // Strip Number (0-14/18) | |
83 | vol[3] = digs->GetPadx(); // TEvePad Number in x direction (0-47) | |
84 | vol[4] = digs->GetPadz(); // TEvePad Number in z direction (0-1) | |
85 | ||
86 | fTOFdigitMap->AddDigit(vol, digitNumber); | |
87 | //if (digitNumber==digitsTOF->GetEntries()-1) printf(" I am inside LoadDigits %3i \n", digitNumber); | |
88 | ||
89 | } | |
90 | ||
91 | } | |
92 | ||
93 | /* ******************************************************* */ | |
94 | ||
95 | void AliEveTOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate, | |
96 | Int_t nStrip, Int_t nPadZ, Int_t nPadX, | |
97 | Int_t indexDigit[3]) | |
98 | { | |
99 | ||
100 | Int_t vol[5] = {nSector,nPlate,nStrip,nPadX,nPadZ}; | |
101 | ||
102 | fTOFdigitMap->GetDigitIndex(vol, indexDigit); | |
103 | ||
104 | } | |
105 | /* ******************************************************* */ | |
106 | ||
107 | TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate, | |
108 | Int_t nStrip) | |
109 | { | |
110 | ||
111 | Int_t newCounter = 0; | |
112 | Int_t nDigitsInVolume[3] = {-1, -1, -1}; | |
113 | Int_t dummy[3] = {-1, -1, -1}; | |
114 | Int_t informations[4] = {-1, -1, -1, -1}; | |
115 | ||
116 | TClonesArray* digitsTOFnew = new TClonesArray("AliTOFdigit", 300); | |
117 | TClonesArray &ldigits = *digitsTOFnew; | |
118 | ||
119 | AliTOFdigit *digs; | |
120 | ||
121 | TClonesArray *digitsTOF = 0x0; | |
122 | fTree->SetBranchAddress("TOF",&digitsTOF); | |
123 | fTree->GetEntry(0); | |
124 | ||
125 | ||
126 | Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1}; | |
127 | ||
128 | for(Int_t iPadZ=0; iPadZ<fGeom->NpadZ(); iPadZ++){ | |
129 | vol[4] = iPadZ; | |
130 | for(Int_t iPadX=0; iPadX<fGeom->NpadX(); iPadX++) { | |
131 | vol[3] = iPadX; | |
132 | ||
133 | //GetDigits(vol[0], vol[1], vol[2], vol[3], vol[4], nDigitsInVolume) | |
134 | ||
135 | fTOFdigitMap->GetDigitIndex(vol, nDigitsInVolume); | |
136 | ||
137 | for (Int_t ii=0; ii<3; ii++) { | |
138 | ||
139 | if (nDigitsInVolume[ii]>=0 ) { | |
140 | //printf(" nDigitsInVolume[%2i] = %3i\n ", ii, nDigitsInVolume[ii]); | |
141 | digs = (AliTOFdigit*)digitsTOF->UncheckedAt(nDigitsInVolume[ii]); | |
142 | informations[0] = digs->GetTdc(); | |
143 | informations[1] = digs->GetAdc(); | |
144 | informations[2] = digs->GetToT(); | |
145 | informations[3] = digs->GetTdcND(); | |
146 | new (ldigits[newCounter++]) AliTOFdigit(dummy, vol, informations); | |
147 | } | |
148 | ||
149 | } | |
150 | ||
151 | for (Int_t ii=0; ii<4; ii++) informations[ii]=-1; | |
152 | for (Int_t ii=0; ii<3; ii++) dummy[ii]=-1; | |
153 | for (Int_t ii=0; ii<3; ii++) nDigitsInVolume[ii]=-1; | |
154 | ||
155 | } | |
156 | } | |
157 | ||
158 | /* | |
159 | if (digitsTOFnew) | |
160 | printf("Sector %2i Plate %1i Strip %2i -> number of digits %3i \n", | |
161 | nSector, nPlate, nStrip, digitsTOFnew->GetEntries()); | |
162 | */ | |
163 | return digitsTOFnew; | |
164 | ||
165 | } | |
166 | /* ******************************************************* */ | |
167 | ||
168 | TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector) | |
169 | { | |
170 | ||
171 | Int_t newCounter = 0; | |
172 | Int_t nDigitsInVolume[3] = {-1, -1, -1}; | |
173 | Int_t dummy[3] = {-1, -1, -1}; | |
174 | Int_t informations[4] = {-1, -1, -1, -1}; | |
175 | ||
176 | Int_t nStrips=19; | |
177 | ||
178 | TClonesArray* digitsTOFnew = new TClonesArray("AliTOFdigit", 300); | |
179 | TClonesArray &ldigits = *digitsTOFnew; | |
180 | ||
181 | AliTOFdigit *digs; | |
182 | ||
183 | TClonesArray *digitsTOF = 0x0; | |
184 | fTree->SetBranchAddress("TOF",&digitsTOF); | |
185 | fTree->GetEntry(0); | |
186 | ||
187 | //Int_t nSector = 1; | |
188 | Int_t vol[5] = {nSector,-1,-1,-1,-1}; | |
189 | ||
190 | for(Int_t iPlate=0; iPlate<fGeom->NPlates(); iPlate++){ | |
191 | vol[1] = iPlate; | |
192 | if(iPlate==2) nStrips=15; | |
193 | else nStrips=19; | |
194 | ||
195 | for(Int_t iStrip=0; iStrip<nStrips; iStrip++){ | |
196 | vol[2] = iStrip; | |
197 | ||
198 | for(Int_t iPadZ=0; iPadZ<fGeom->NpadZ(); iPadZ++){ | |
199 | vol[4] = iPadZ; | |
200 | ||
201 | for(Int_t iPadX=0; iPadX<fGeom->NpadX(); iPadX++) { | |
202 | vol[3] = iPadX; | |
203 | ||
204 | //GetDigits(vol[0], vol[1], vol[2], vol[3], vol[4], nDigitsInVolume) | |
205 | ||
206 | fTOFdigitMap->GetDigitIndex(vol, nDigitsInVolume); | |
207 | ||
208 | for (Int_t ii=0; ii<3; ii++) { | |
209 | ||
210 | if (nDigitsInVolume[ii]>=0 ) { | |
211 | //printf(" nDigitsInVolume[%2i] = %3i\n ", ii, nDigitsInVolume[ii]); | |
212 | digs = (AliTOFdigit*)digitsTOF->UncheckedAt(nDigitsInVolume[ii]); | |
213 | informations[0] = digs->GetTdc(); | |
214 | informations[1] = digs->GetAdc(); | |
215 | informations[2] = digs->GetToT(); | |
216 | informations[3] = digs->GetTdcND(); | |
217 | new (ldigits[newCounter++]) AliTOFdigit(dummy, vol, informations); | |
218 | } | |
219 | ||
220 | } | |
221 | ||
222 | for (Int_t ii=0; ii<4; ii++) informations[ii]=-1; | |
223 | for (Int_t ii=0; ii<3; ii++) dummy[ii]=-1; | |
224 | for (Int_t ii=0; ii<3; ii++) nDigitsInVolume[ii]=-1; | |
225 | ||
226 | } | |
227 | } | |
228 | } | |
229 | } | |
230 | ||
231 | /* | |
232 | if (digitsTOFnew) | |
233 | printf("Sector %2i Plate %1i Strip %2i -> number of digits %3i \n", | |
234 | nSector, nPlate, nStrip, digitsTOFnew->GetEntries()); | |
235 | */ | |
236 | return digitsTOFnew; | |
237 | ||
238 | } | |
239 | /* ******************************************************* */ | |
240 | ||
241 | void AliEveTOFDigitsInfo::GetDigits() | |
242 | { | |
243 | ||
244 | for (Int_t iSector=0; iSector<fGeom->NSectors(); iSector++) { | |
245 | ||
246 | fNewTree = new TTree(); | |
247 | ||
248 | ||
249 | ||
250 | ||
251 | } | |
252 | ||
253 | } |