1 |
/** |
2 |
* \file TrkLevel1.cpp |
3 |
* \author Elena Vannuccini |
4 |
*/ |
5 |
#include <TrkLevel1.h> |
6 |
#include <iostream> |
7 |
using namespace std; |
8 |
//-------------------------------------- |
9 |
// |
10 |
// |
11 |
//-------------------------------------- |
12 |
TrkCluster::TrkCluster(){ |
13 |
|
14 |
view = 0; |
15 |
ladder = 0; |
16 |
maxs = 0; |
17 |
mult = 0; |
18 |
sgnl = 0; |
19 |
whichtrk = -1; |
20 |
CLlength = 0; |
21 |
clsignal = 0; |
22 |
clsigma = 0; |
23 |
cladc = 0; |
24 |
clbad = 0; |
25 |
|
26 |
}; |
27 |
//-------------------------------------- |
28 |
// |
29 |
// |
30 |
//-------------------------------------- |
31 |
TrkCluster::~TrkCluster(){ |
32 |
|
33 |
delete [] clsignal; |
34 |
delete [] clsigma; |
35 |
delete [] cladc; |
36 |
delete [] clbad; |
37 |
}; |
38 |
//-------------------------------------- |
39 |
// |
40 |
// |
41 |
//-------------------------------------- |
42 |
TrkCluster::TrkCluster(const TrkCluster& t){ |
43 |
|
44 |
view = t.view; |
45 |
ladder = t.ladder; |
46 |
maxs = t.maxs; |
47 |
mult = t.mult; |
48 |
sgnl = t.sgnl; |
49 |
whichtrk = t.whichtrk; |
50 |
|
51 |
CLlength = t.CLlength; |
52 |
clsignal = new Float_t[CLlength]; |
53 |
clsigma = new Float_t[CLlength]; |
54 |
cladc = new Int_t[CLlength]; |
55 |
clbad = new Bool_t[CLlength]; |
56 |
for(Int_t i=0; i<CLlength;i++){ |
57 |
clsignal[i] = t.clsignal[i]; |
58 |
clsigma[i] = t.clsigma[i]; |
59 |
cladc[i] = t.cladc[i]; |
60 |
clbad[i] = t.clbad[i]; |
61 |
}; |
62 |
|
63 |
}; |
64 |
//-------------------------------------- |
65 |
// |
66 |
// |
67 |
//-------------------------------------- |
68 |
void TrkCluster::Dump(){ |
69 |
|
70 |
cout << "----- Cluster" << endl; |
71 |
cout << "View "<<view << " - Ladder "<<ladder<<endl; |
72 |
cout << "(Track ID "<<whichtrk<<")"<<endl; |
73 |
cout << "Position of maximun "<<maxs<<endl; |
74 |
cout << "Multiplicity "<<mult<<endl; |
75 |
cout << "Tot signal "<<sgnl<< " (ADC channels)"; |
76 |
cout <<endl<< "Strip signals "; |
77 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
78 |
cout <<endl<< "Strip sigmas "; |
79 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
80 |
cout <<endl<< "Strip ADC "; |
81 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
82 |
cout <<endl<< "Strip BAD "; |
83 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clbad[i]; |
84 |
cout << endl; |
85 |
|
86 |
} |
87 |
//-------------------------------------- |
88 |
// |
89 |
// |
90 |
//-------------------------------------- |
91 |
TrkLevel1::TrkLevel1(){ |
92 |
|
93 |
good1 = -1; |
94 |
|
95 |
Cluster = new TClonesArray("TrkCluster"); |
96 |
|
97 |
for(Int_t i=0; i<12 ; i++){ |
98 |
// crc[i] = -1; |
99 |
for(Int_t j=0; j<24 ; j++){ |
100 |
cnev[j][i]=0; |
101 |
cnnev[j][i]=0; |
102 |
}; |
103 |
fshower[i]=0; |
104 |
}; |
105 |
} |
106 |
//-------------------------------------- |
107 |
// |
108 |
// |
109 |
//-------------------------------------- |
110 |
void TrkLevel1::Dump(){ |
111 |
|
112 |
TClonesArray &t = *Cluster; |
113 |
|
114 |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
115 |
|
116 |
} |
117 |
//-------------------------------------- |
118 |
// |
119 |
// |
120 |
//-------------------------------------- |
121 |
/** |
122 |
* Fills a TrkLevel1 object with values from a struct cTrkLevel1 (to get data from F77 common). |
123 |
*/ |
124 |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1){ |
125 |
|
126 |
// *** CLUSTER *** |
127 |
TrkCluster* t_cl = new TrkCluster(); |
128 |
TClonesArray &t = *Cluster; |
129 |
for(int i=0; i<l1->nclstr1; i++){ |
130 |
|
131 |
t_cl->view = l1->view[i]; |
132 |
t_cl->ladder = l1->ladder[i]; |
133 |
t_cl->maxs = l1->maxs[i]; |
134 |
t_cl->mult = l1->mult[i]; |
135 |
t_cl->sgnl = l1->dedx[i]; |
136 |
t_cl->whichtrk = l1->whichtrack[i]-1; |
137 |
|
138 |
Int_t from = l1->indstart[i] -1; |
139 |
Int_t to = l1->totCLlength ; |
140 |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
141 |
t_cl->CLlength = to - from ; |
142 |
|
143 |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
144 |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
145 |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
146 |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
147 |
Int_t index = 0; |
148 |
for(Int_t is = from; is < to; is++ ){ |
149 |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
150 |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
151 |
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
152 |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
153 |
index++; |
154 |
}; |
155 |
|
156 |
new(t[i]) TrkCluster(*t_cl); |
157 |
}; |
158 |
|
159 |
delete t_cl; |
160 |
|
161 |
// general variables |
162 |
|
163 |
good1 = l1->good1; |
164 |
for(Int_t i=0; i<12 ; i++){ |
165 |
// crc[i] = l1->crc[i]; |
166 |
for(Int_t j=0; j<24 ; j++){ |
167 |
cnev[j][i] = l1->cnev[j][i]; |
168 |
cnnev[j][i] = l1->cnnev[j][i]; |
169 |
}; |
170 |
fshower[i] = l1->fshower[i]; |
171 |
}; |
172 |
|
173 |
} |
174 |
/** |
175 |
* Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common). |
176 |
*/ |
177 |
|
178 |
void TrkLevel1::GetLevel1Struct(cTrkLevel1 *l1) const { |
179 |
|
180 |
// ********* completare ********* // |
181 |
// ********* completare ********* // |
182 |
// ********* completare ********* // |
183 |
// ********* completare ********* // |
184 |
// ********* completare ********* // |
185 |
// ********* completare ********* // |
186 |
// general variables |
187 |
l1->good1 = good1; |
188 |
for(Int_t i=0; i<12 ; i++){ |
189 |
// l1->crc[i] = crc[i]; |
190 |
for(Int_t j=0; j<24 ; j++){ |
191 |
l1->cnev[j][i] = cnev[j][i]; |
192 |
l1->cnnev[j][i] = cnnev[j][i]; |
193 |
}; |
194 |
l1->fshower[i] = fshower[i]; |
195 |
}; |
196 |
|
197 |
// *** CLUSTERS *** |
198 |
l1->nclstr1 = Cluster->GetEntries(); |
199 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
200 |
|
201 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
202 |
l1->ladder[i] = ((TrkCluster *)Cluster->At(i))->ladder; |
203 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
204 |
l1->mult[i] = ((TrkCluster *)Cluster->At(i))->mult; |
205 |
l1->dedx[i] = ((TrkCluster *)Cluster->At(i))->sgnl; |
206 |
|
207 |
} |
208 |
|
209 |
// ********* completare ********* // |
210 |
|
211 |
} |
212 |
//-------------------------------------- |
213 |
// |
214 |
// |
215 |
//-------------------------------------- |
216 |
void TrkLevel1::Clear(){ |
217 |
|
218 |
good1 = -1; |
219 |
for(Int_t i=0; i<12 ; i++){ |
220 |
// crc[i] = -1; |
221 |
for(Int_t j=0; j<24 ; j++){ |
222 |
cnev[j][i] = 0; |
223 |
cnnev[j][i] = 0; |
224 |
}; |
225 |
fshower[i] = 0; |
226 |
}; |
227 |
// totCLlength = 0; |
228 |
Cluster->Clear(); |
229 |
|
230 |
} |
231 |
//-------------------------------------- |
232 |
// |
233 |
// |
234 |
//-------------------------------------- |
235 |
TrkCluster *TrkLevel1::GetCluster(int is){ |
236 |
|
237 |
if(is >= this->nclstr()){ |
238 |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
239 |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
240 |
return 0; |
241 |
} |
242 |
TClonesArray &t = *(Cluster); |
243 |
TrkCluster *cluster = (TrkCluster*)t[is]; |
244 |
return cluster; |
245 |
} |
246 |
|
247 |
// //-------------------------------------- |
248 |
// // |
249 |
// // |
250 |
// //-------------------------------------- |
251 |
// TrkTrackRef::TrkTrackRef(){ |
252 |
// for(int ip=0;ip<6;ip++){ |
253 |
// clx[ip] = 0; |
254 |
// cly[ip] = 0; |
255 |
// }; |
256 |
// }; |
257 |
// //-------------------------------------- |
258 |
// // |
259 |
// // |
260 |
// //-------------------------------------- |
261 |
// TrkTrackRef::TrkTrackRef(const TrkTrackRef& t){ |
262 |
// for(int ip=0;ip<6;ip++){ |
263 |
// clx[ip] = t.clx[ip]; |
264 |
// cly[ip] = t.cly[ip]; |
265 |
// }; |
266 |
// }; |
267 |
// //-------------------------------------- |
268 |
// // |
269 |
// // |
270 |
// //-------------------------------------- |
271 |
// void TrkTrackRef::Clear(){ |
272 |
// for(int ip=0;ip<6;ip++){ |
273 |
// clx[ip] = 0; |
274 |
// cly[ip] = 0; |
275 |
// }; |
276 |
// }; |
277 |
// //-------------------------------------- |
278 |
// // |
279 |
// // |
280 |
// //-------------------------------------- |
281 |
// TrkLevel2Ref::TrkLevel2Ref(){ |
282 |
// Track = new TClonesArray("TrkTrackRef"); |
283 |
// SingletX = new TClonesArray("TRef"); |
284 |
// SingletY = new TClonesArray("TRef"); |
285 |
// }; |
286 |
// //-------------------------------------- |
287 |
// // |
288 |
// // |
289 |
// //-------------------------------------- |
290 |
// void TrkLevel2Ref::SetFromLevel2Struct(cTrkLevel2 *l2){ |
291 |
// |
292 |
// TrkTrackRef* t_track = new TrkTrackRef(); |
293 |
// TRef t_singlet = 0; |
294 |
// |
295 |
// TClonesArray &t = *Track; |
296 |
// for(int i=0; i<l2->ntrk; i++){ |
297 |
// for(int ip=0;ip<6;ip++){ |
298 |
// t_track->clx[ip] = 0;//<<<puntatore al cluster |
299 |
// t_track->cly[ip] = 0;//<<<puntatore al cluster |
300 |
// }; |
301 |
// new(t[i]) TrkTrackRef(*t_track); |
302 |
// t_track->Clear(); |
303 |
// }; |
304 |
// // *** SINGLETS *** |
305 |
// TClonesArray &sx = *SingletX; |
306 |
// for(int i=0; i<l2->nclsx; i++){ |
307 |
// t_singlet = 0;//<<<puntatore al cluster |
308 |
// new(sx[i]) TRef(t_singlet); |
309 |
// } |
310 |
// TClonesArray &sy = *SingletY; |
311 |
// for(int i=0; i<l2->nclsy; i++){ |
312 |
// t_singlet = 0;//<<<puntatore al cluster |
313 |
// new(sy[i]) TRef(t_singlet); |
314 |
// }; |
315 |
// |
316 |
// delete t_track; |
317 |
// } |
318 |
// //-------------------------------------- |
319 |
// // |
320 |
// // |
321 |
// //-------------------------------------- |
322 |
// void TrkLevel2Ref::Clear(){ |
323 |
// Track->Clear(); |
324 |
// SingletX->Clear(); |
325 |
// SingletY->Clear(); |
326 |
// } |
327 |
|
328 |
ClassImp(TrkLevel1); |
329 |
ClassImp(TrkCluster); |
330 |
// ClassImp(TrkTrackRef); |
331 |
// ClassImp(TrkLevel2Ref); |