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