1 |
/** |
2 |
* \file CaloPreSampler.cpp |
3 |
* \author Emiliano Mocchiutti (2007/07/18) |
4 |
*/ |
5 |
// |
6 |
// headers |
7 |
// |
8 |
#include <CaloPreSampler.h> |
9 |
//-------------------------------------- |
10 |
/** |
11 |
* Default constructor |
12 |
*/ |
13 |
CaloPreSampler::CaloPreSampler(){ |
14 |
Clear(); |
15 |
} |
16 |
|
17 |
void CaloPreSampler::SetCaloLevel2Pointer(CaloLevel2 *cl2p){ |
18 |
if ( pcalo ) delete pcalo; |
19 |
pcalo = cl2p; |
20 |
} |
21 |
|
22 |
CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){ |
23 |
// |
24 |
L2 = l2p; |
25 |
// |
26 |
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
27 |
// |
28 |
OBT = 0; |
29 |
PKT = 0; |
30 |
atime = 0; |
31 |
// |
32 |
// Default variables |
33 |
// |
34 |
event = new CaloLevel0(); |
35 |
cstrip = new CaloStrip(false); |
36 |
// c1 = new CaloLevel1(); |
37 |
pcalo = new CaloLevel2(); |
38 |
N = 4; |
39 |
NC = 22-N; |
40 |
debug = false; |
41 |
sel = true; |
42 |
cont = false; |
43 |
emulate18 = true; |
44 |
usepl18x = false; |
45 |
simulation = false; |
46 |
withtrk = true; |
47 |
rigdefault = 50.; |
48 |
nox = false; |
49 |
noy = false; |
50 |
forcecalo = false; |
51 |
forcefitmode = -1; |
52 |
memset(mask,0,2*22*sizeof(Int_t)); |
53 |
// |
54 |
Clear(); |
55 |
// |
56 |
// loading magnetic field... |
57 |
// |
58 |
TrkLevel2 *trk = new TrkLevel2(); |
59 |
GL_PARAM *q4 = new GL_PARAM(); |
60 |
TSQLServer *dbc = 0; |
61 |
TString host = "mysql://localhost/pamelaprod"; |
62 |
TString user = "anonymous"; |
63 |
TString psw = ""; |
64 |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
65 |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
66 |
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
67 |
if ( !pamdbhost ) pamdbhost = ""; |
68 |
if ( !pamdbuser ) pamdbuser = ""; |
69 |
if ( !pamdbpsw ) pamdbpsw = ""; |
70 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
71 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
72 |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
73 |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
74 |
// |
75 |
q4->Query_GL_PARAM(1,1,dbc); |
76 |
printf(" Reading magnetic field maps at %s\n",(q4->PATH+q4->NAME).Data()); |
77 |
trk->LoadField(q4->PATH+q4->NAME); |
78 |
// |
79 |
} |
80 |
|
81 |
CaloTrkVar* CaloPreSampler::GetCaloTrack(Int_t t){ |
82 |
this->Process(); |
83 |
if ( t < 0 ) return pcalo->GetCaloStoredTrack(t); |
84 |
if ( L2->GetTrack(t) ){ |
85 |
return pcalo->GetCaloStoredTrack(L2->GetTrack(t)->GetTrkTrack()->GetSeqNo()); |
86 |
}; |
87 |
return NULL; |
88 |
} |
89 |
|
90 |
void CaloPreSampler::SetNoWpreSampler(Int_t n){ |
91 |
if ( NC+n < 23 ){ |
92 |
N = n; |
93 |
} else { |
94 |
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
95 |
printf(" you are giving N presampler = %i and N calo = %i \n",n,NC); |
96 |
printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n"); |
97 |
NC = 18; |
98 |
N = 4; |
99 |
}; |
100 |
} |
101 |
|
102 |
void CaloPreSampler::SetNoWcalo(Int_t n){ |
103 |
if ( N+n < 23 ){ |
104 |
NC = n; |
105 |
} else { |
106 |
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
107 |
printf(" you are giving N W presampler = %i and N W calo = %i \n",N,n); |
108 |
printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n"); |
109 |
NC = 18; |
110 |
N = 4; |
111 |
}; |
112 |
} |
113 |
|
114 |
void CaloPreSampler::SplitInto(Int_t NoWpreSampler, Int_t NoWcalo){ |
115 |
this->SetNoWcalo(0); |
116 |
this->SetNoWpreSampler(0); |
117 |
if ( NoWpreSampler < NoWcalo ){ |
118 |
this->SetNoWpreSampler(NoWpreSampler); |
119 |
this->SetNoWcalo(NoWcalo); |
120 |
} else { |
121 |
this->SetNoWcalo(NoWcalo); |
122 |
this->SetNoWpreSampler(NoWpreSampler); |
123 |
}; |
124 |
} |
125 |
|
126 |
void CaloPreSampler::Clear(){ |
127 |
// |
128 |
pcalo->Clear(); |
129 |
// |
130 |
} |
131 |
|
132 |
void CaloPreSampler::Print(){ |
133 |
// |
134 |
Process(); |
135 |
// |
136 |
printf("========================================================================\n"); |
137 |
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
138 |
printf(" debug [debug flag]:.. %i\n",debug); |
139 |
printf(" simulation [simulation flag]:.. %i\n",simulation); |
140 |
printf(" emulate18 [emulate dead plane 18]:.. %i\n",emulate18); |
141 |
printf(" selection mode :.. %i\n",sel); |
142 |
printf(" contamination mode :.. %i\n",cont); |
143 |
printf(" pre-sampler planes :.. %i\n",N); |
144 |
printf(" pcalo->qtot :.. %f\n",pcalo->qtot); |
145 |
printf(" pcalo->nstrip :.. %i\n",pcalo->nstrip); |
146 |
if ( pcalo->ntrk() > 0 ){ |
147 |
printf(" pcalo->track0->qtrack :.. %f\n",pcalo->GetCaloTrkVar(0)->qtrack); |
148 |
printf(" pcalo->track0->dX0l :.. %f\n",pcalo->GetCaloTrkVar(0)->dX0l); |
149 |
}; |
150 |
printf("========================================================================\n"); |
151 |
// |
152 |
} |
153 |
|
154 |
void CaloPreSampler::Delete(){ |
155 |
Clear(); |
156 |
delete pcalo; |
157 |
//delete this; |
158 |
} |
159 |
|
160 |
|
161 |
void CaloPreSampler::Process(){ |
162 |
// |
163 |
if ( !L2 ){ |
164 |
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
165 |
printf(" ERROR: CaloPreSampler variables _NOT_ filled \n"); |
166 |
return; |
167 |
}; |
168 |
// |
169 |
// Clear structures used to communicate with fortran |
170 |
// |
171 |
event->ClearStructs();//ELENA |
172 |
if ( forcefitmode > 0 ){ |
173 |
if ( forcefitmode != 1000 && forcefitmode != 1001 && forcefitmode != 1002 ){ |
174 |
printf(" ERROR! forcefitmode=%i \n Use forcefitmode = 1000 for fit mode 0, 1001 fit mode 1, 1002 fit mode 3\n",forcefitmode); |
175 |
forcefitmode = -1; |
176 |
} else { |
177 |
event->clevel2->fmode[0] = forcefitmode; |
178 |
event->clevel2->fmode[1] = forcefitmode; |
179 |
}; |
180 |
}; |
181 |
// |
182 |
Bool_t newentry = false; |
183 |
// |
184 |
if ( L2->IsORB() ){ |
185 |
if ( debug ) printf(" I am here, we have orbital infos \n"); |
186 |
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime || sel != ssel ){ |
187 |
newentry = true; |
188 |
OBT = L2->GetOrbitalInfo()->OBT; |
189 |
PKT = L2->GetOrbitalInfo()->pkt_num; |
190 |
atime = L2->GetOrbitalInfo()->absTime; |
191 |
ssel = sel; |
192 |
}; |
193 |
} else { |
194 |
newentry = true; |
195 |
}; |
196 |
// |
197 |
if ( !newentry ) return; |
198 |
// |
199 |
// Some variables |
200 |
// |
201 |
Int_t S3 = 0; |
202 |
Int_t S2 = 0; |
203 |
Int_t S12 = 0; |
204 |
Int_t S11 = 0; |
205 |
Float_t tmptrigty = -1.; |
206 |
Bool_t trackanyway = true; |
207 |
// Float_t rigdefault = 50.; |
208 |
Bool_t hZn = true; |
209 |
// Bool_t withtrk = true; |
210 |
Bool_t st = true; |
211 |
Int_t ntrkentry = 0; |
212 |
TrkLevel2 *trk = L2->GetTrkLevel2(); |
213 |
Bool_t filled = false; |
214 |
// |
215 |
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
216 |
// |
217 |
this->Clear(); |
218 |
// |
219 |
// find out if we have trkseqno = -1, -2 or -3 |
220 |
// |
221 |
Bool_t m1 = false; |
222 |
Bool_t m2 = false; |
223 |
Bool_t m3 = false; |
224 |
for (Int_t mm=0; mm < L2->GetCaloLevel2()->ntrk(); mm++ ){ |
225 |
if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -1 ) m1 = true; |
226 |
if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -2 ) m2 = true; |
227 |
if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -3 ) m3 = true; |
228 |
}; |
229 |
if ( !withtrk ) m3 = true; |
230 |
// |
231 |
if ( debug ) printf(" Fill estrip matrix needed to calculate variables \n"); |
232 |
// |
233 |
// Fill the estrip matrix |
234 |
// |
235 |
memset(event->clevel1->estrip, 0, 2*22*96*sizeof(Float_t)); |
236 |
Int_t view = 0; |
237 |
Int_t plane = 0; |
238 |
Int_t strip = 0; |
239 |
Float_t mip = 0.; |
240 |
for ( Int_t i=0; i<L2->GetCaloLevel1()->istrip; i++ ){ |
241 |
// |
242 |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
243 |
// |
244 |
if ( !usepl18x && view==0 && plane==18 ) mip = 0.; |
245 |
// |
246 |
// Mask x or y view if nox and/or noy are true (default false) |
247 |
// |
248 |
if ( mask[view][plane] ) mip = 0.; |
249 |
if ( nox && view == 0 ) mip = 0.; |
250 |
if ( noy && view == 1 ) mip = 0.; |
251 |
// |
252 |
if ( emulate18 && view == 0 && plane == 18 ) mip = 0.; |
253 |
// |
254 |
// Selection mode: fill the matrix only for plane < (22 - N) REMEMBER N = number of W planes to be used as presampler, ie if N = 2 then we want to use planes from 0 to 19 |
255 |
// included so plane < (22 - 2) |
256 |
// |
257 |
if ( sel ){ |
258 |
if ( plane < (22 - N) ){ |
259 |
// |
260 |
if ( emulate18 && plane == (18 - N) && view == 0 ) mip = 0.; |
261 |
if ( plane >= NC ) mip = 0.; |
262 |
event->clevel1->estrip[strip][plane][view] = mip; |
263 |
// |
264 |
}; |
265 |
}; |
266 |
// |
267 |
// Contamination mode: fill the matrix only for planes from N to 22 but shift all planes up to the first one |
268 |
// |
269 |
if ( cont ){ |
270 |
if ( plane >= N ){ |
271 |
// |
272 |
if ( emulate18 && plane == (18 + N) && view == 0 ) mip = 0.; |
273 |
if ( (plane-N) >= NC ) mip = 0.; |
274 |
event->clevel1->estrip[strip][(plane-N)][view] = mip; |
275 |
// |
276 |
}; |
277 |
}; |
278 |
// |
279 |
}; |
280 |
// |
281 |
// if data comes from the simulation we must use mechanical alignment parameters (default is flight parameters) |
282 |
// |
283 |
if ( simulation ){ |
284 |
cstrip->UseMechanicalAlig(); |
285 |
}; |
286 |
// |
287 |
// Set alignment parameter |
288 |
// |
289 |
event->clevel1->xalig = cstrip->GetXalig(); |
290 |
event->clevel1->yalig = cstrip->GetYalig(); |
291 |
event->clevel1->zalig = cstrip->GetZalig(); |
292 |
// |
293 |
event->clevel1->emin = 0.7; |
294 |
// |
295 |
// in case of the contamination mode we must play with the Z alignment in order to have the correct track in the calo since we have moved the planes up... |
296 |
// |
297 |
if ( cont ){ |
298 |
if ( !(N%2) ){ |
299 |
event->clevel1->reverse = 0; // if the number of planes is even we have taken away a full module no need to do anything strange... |
300 |
event->clevel1->zalig -= (N/2) * (8.09 + 10.09); |
301 |
} else { |
302 |
event->clevel1->reverse = 1; // if the number of planes is odd we have taken away half a module, we need to reverse silicon planes shifting |
303 |
event->clevel1->zalig -= ((N+1)/2) * 8.09 + ((N-1)/2) * 10.09; |
304 |
}; |
305 |
}; |
306 |
if ( debug ) printf(" xalig = %f \n",event->clevel1->xalig); |
307 |
if ( debug ) printf(" yalig = %f \n",event->clevel1->yalig); |
308 |
if ( debug ) printf(" zalig = %f \n",event->clevel1->zalig); |
309 |
// |
310 |
if ( debug ) printf(" Calculate variables as done in CaloCore, N = %i \n",N); |
311 |
// |
312 |
// Calculate variables |
313 |
// |
314 |
// |
315 |
// use only N W planes |
316 |
// |
317 |
// event->clevel1->npla = 22-N; |
318 |
event->clevel1->npla = NC; |
319 |
// |
320 |
S3 = 0; |
321 |
S2 = 0; |
322 |
S12 = 0; |
323 |
S11 = 0; |
324 |
S3 = L2->GetTrigLevel2()->patterntrig[2]; |
325 |
S2 = L2->GetTrigLevel2()->patterntrig[3]; |
326 |
S12 = L2->GetTrigLevel2()->patterntrig[4]; |
327 |
S11 = L2->GetTrigLevel2()->patterntrig[5]; |
328 |
if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) tmptrigty = 1.; |
329 |
if ( L2->GetTrigLevel2()->patterntrig[0] ) tmptrigty = 2.; |
330 |
if ( S3 || S2 || S12 || S11 ) tmptrigty = 0.; |
331 |
if ( !(L2->GetTrigLevel2()->patterntrig[1] & (1<<0)) && !L2->GetTrigLevel2()->patterntrig[0] && !S3 && !S2 && !S12 && !S11 ) tmptrigty = 1.; |
332 |
event->clevel2->trigty = tmptrigty; |
333 |
// |
334 |
// do we have at least one track from the tracker? this check has been disabled |
335 |
// |
336 |
event->clevel1->good2 = 1; |
337 |
// |
338 |
// copy variables calculated during calibration process which is skipped here... |
339 |
// |
340 |
event->clevel2->good = L2->GetCaloLevel2()->good; |
341 |
memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr)); |
342 |
memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr)); |
343 |
memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc)); |
344 |
event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger; |
345 |
// |
346 |
// Calculate variables common to all tracks (qtot, nstrip, etc.) |
347 |
// |
348 |
if ( debug ) printf("1 Call GetCommonVar() \n"); |
349 |
event->GetCommonVar(); |
350 |
// |
351 |
// Fill common variables |
352 |
// |
353 |
if ( debug ) printf("1 Call FillCommonVar() \n"); |
354 |
event->FillCommonVar(NULL,pcalo); |
355 |
// |
356 |
// Calculate variables related to tracks only if we have at least one track (from selftrigger and/or tracker) |
357 |
// |
358 |
ntrkentry = 0; |
359 |
// |
360 |
filled = false; |
361 |
// |
362 |
// Run over tracks (tracker or calorimeter ) |
363 |
// |
364 |
if ( withtrk ){ |
365 |
// |
366 |
for (Int_t nt=0; nt < trk->ntrk(); nt++){ |
367 |
// |
368 |
event->clevel1->good2 = 1; |
369 |
// |
370 |
TrkTrack *ptt = trk->GetStoredTrack(nt); |
371 |
// |
372 |
event->clevel1->trkchi2 = 0; |
373 |
// |
374 |
// Copy the alpha vector in the input structure |
375 |
// |
376 |
for (Int_t e = 0; e < 5 ; e++){ |
377 |
event->clevel1->al_p[e][0] = ptt->al[e]; |
378 |
}; |
379 |
// |
380 |
// Get tracker related variables for this track |
381 |
// |
382 |
if ( debug ) printf("track %i Call GetTrkVar() \n",nt); |
383 |
event->GetTrkVar(); |
384 |
if ( debug ) printf(" event->clevel2->dX0l %f \n",event->clevel2->dX0l); |
385 |
// |
386 |
// Save tracker track sequence number |
387 |
// |
388 |
event->trkseqno = nt; |
389 |
// |
390 |
// Copy values in the class ca from the structure clevel2 |
391 |
// |
392 |
if ( debug ) printf("track %i Call FillTrkVar() \n",nt); |
393 |
event->FillTrkVar(pcalo,ntrkentry); |
394 |
|
395 |
|
396 |
ntrkentry++; |
397 |
filled = true; |
398 |
// |
399 |
}; // loop on all the tracks |
400 |
}; |
401 |
// |
402 |
// if no tracks found but there is the possibility to have a good track we should try to calculate anyway the track related variables using the calorimeter |
403 |
// fit of the track (to be used for example when TRK is off due to any reason like IPM3/5 off). |
404 |
// here we make an event selection so it must be done very carefully... |
405 |
// |
406 |
// conditions are: 0) no track from the tracker 1) we have a track fit both in x and y 2) no problems with calo for this event 3) no selftrigger event |
407 |
// |
408 |
// if ( trackanyway && !filled && event->clevel2->npcfit[0] >= 2 && event->clevel2->npcfit[1] >= 2 && event->clevel2->good != 0 && event->clevel2->trigty < 2. ){ |
409 |
if ( (trackanyway && m3) || forcecalo ){ |
410 |
if ( debug ) printf(" Event with a track not fitted by the tracker \n"); |
411 |
// |
412 |
// Disable "track mode" in the fortran routine |
413 |
// |
414 |
event->clevel1->good2 = 0; |
415 |
event->clevel1->riginput = rigdefault; |
416 |
if ( debug ) printf(" Using as default rigidity: %f \n",event->clevel1->riginput); |
417 |
// |
418 |
// We have a selftrigger event to analyze. |
419 |
// |
420 |
for (Int_t e = 0; e < 5 ; e++){ |
421 |
event->clevel1->al_p[e][0] = 0.; |
422 |
event->clevel1->al_p[e][1] = 0.; |
423 |
}; |
424 |
event->clevel1->trkchi2 = 0; |
425 |
// |
426 |
if ( debug ) printf("-3 a Call GetTrkVar() \n"); |
427 |
event->GetTrkVar(); |
428 |
// |
429 |
// if we had no problem (clevel1->good2 = 0, NOTICE zero, not one in this mode!), fill and go on |
430 |
// |
431 |
if ( event->clevel1->good2 == 0 ) { |
432 |
// |
433 |
// In selftrigger mode the trkentry variable is set to -1 |
434 |
// |
435 |
event->trkseqno = -3; |
436 |
// |
437 |
// Copy values in the class ca from the structure clevel2 |
438 |
// |
439 |
if ( debug ) printf("-3 a Call FillTrkVar() \n"); |
440 |
event->FillTrkVar(pcalo,ntrkentry); |
441 |
ntrkentry++; |
442 |
filled = true; |
443 |
// |
444 |
} else { |
445 |
if ( debug ) printf(" Selftrigger: problems with event \n"); |
446 |
}; |
447 |
// |
448 |
}; |
449 |
// |
450 |
// Call high energy nuclei routine |
451 |
// |
452 |
// if ( hZn && event->clevel2->trigty >= 2. ){ |
453 |
if ( hZn && m2 ){ |
454 |
if ( debug ) printf(" Calling selftrigger high energy nuclei routine \n"); |
455 |
// |
456 |
// Disable "track mode" in the fortran routine |
457 |
// |
458 |
event->clevel1->good2 = 0; |
459 |
// |
460 |
// Set high energy nuclei flag to one |
461 |
// |
462 |
event->clevel1->hzn = 1; |
463 |
event->clevel1->riginput = rigdefault; |
464 |
// |
465 |
// We have a selftrigger event to analyze. |
466 |
// |
467 |
for (Int_t e = 0; e < 5 ; e++){ |
468 |
event->clevel1->al_p[e][0] = 0.; |
469 |
event->clevel1->al_p[e][1] = 0.; |
470 |
}; |
471 |
event->clevel1->trkchi2 = 0; |
472 |
// |
473 |
if ( debug ) printf("-2 a Call GetTrkVar() \n"); |
474 |
event->GetTrkVar(); |
475 |
// |
476 |
// if we had no problem (clevel1->good2 = 0, NOTICE zero, not one in this mode!), fill and go on |
477 |
// |
478 |
if ( event->clevel1->good2 == 0 ) { |
479 |
// |
480 |
// In selftrigger mode the trkentry variable is set to -1 |
481 |
// |
482 |
event->trkseqno = -2; |
483 |
// |
484 |
// Copy values in the class ca from the structure clevel2 |
485 |
// |
486 |
if ( debug ) printf("-2 a Call FillTrkVar() \n"); |
487 |
event->FillTrkVar(pcalo,ntrkentry); |
488 |
ntrkentry++; |
489 |
filled = true; |
490 |
// |
491 |
} else { |
492 |
if ( debug ) printf(" Selftrigger: problems with event \n"); |
493 |
}; |
494 |
// |
495 |
}; |
496 |
// |
497 |
// self trigger event |
498 |
// |
499 |
// if ( st && event->clevel2->trigty >= 2. ){ |
500 |
if ( st && m1 ){ |
501 |
if ( debug ) printf(" Selftrigger event \n"); |
502 |
// |
503 |
// Disable "track mode" in the fortran routine |
504 |
// |
505 |
event->clevel1->good2 = 0; |
506 |
// |
507 |
// disable high enery nuclei flag; |
508 |
// |
509 |
event->clevel1->hzn = 0; |
510 |
// |
511 |
// We have a selftrigger event to analyze. |
512 |
// |
513 |
for (Int_t e = 0; e < 5 ; e++){ |
514 |
event->clevel1->al_p[e][0] = 0.; |
515 |
event->clevel1->al_p[e][1] = 0.; |
516 |
}; |
517 |
event->clevel1->trkchi2 = 0; |
518 |
// |
519 |
if ( debug ) printf("-1 a Call GetTrkVar() \n"); |
520 |
event->GetTrkVar(); |
521 |
// |
522 |
// if we had no problem (clevel2->good = 0, NOTICE zero, not one in selftrigger mode!), fill and go on |
523 |
// |
524 |
if ( event->clevel1->good2 == 0 ) { |
525 |
// |
526 |
// In selftrigger mode the trkentry variable is set to -1 |
527 |
// |
528 |
event->trkseqno = -1; |
529 |
// |
530 |
// Copy values in the class ca from the structure clevel2 |
531 |
// |
532 |
if ( debug ) printf("-1 a Call FillTrkVar() \n"); |
533 |
event->FillTrkVar(pcalo,ntrkentry); |
534 |
ntrkentry++; |
535 |
filled = true; |
536 |
// |
537 |
} else { |
538 |
if ( debug ) printf(" Selftrigger: problems with event \n"); |
539 |
}; |
540 |
}; |
541 |
// // |
542 |
// // Clear structures used to communicate with fortran |
543 |
// // |
544 |
// event->ClearStructs(); |
545 |
// ELENA: moved @ beginning |
546 |
// |
547 |
// |
548 |
// |
549 |
if ( debug ) this->Print(); |
550 |
if ( debug ) printf(" exit \n"); |
551 |
// |
552 |
} |
553 |
|
554 |
// |
555 |
// Method to add a calorimeter track, evaluated around a tracker track defined by a status vector. |
556 |
// (can be used to evaluate the calorimeter track around an arbitrary axis, by setting the status vector with zero deflection ) |
557 |
// |
558 |
// |
559 |
CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag){ |
560 |
|
561 |
int ntrkentry = pcalo->ntrk(); |
562 |
// |
563 |
for (Int_t nt=0; nt < ntrkentry; nt++){ |
564 |
if( pcalo->GetCaloTrkVar(nt)->trkseqno == trktag){ |
565 |
cout << " CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag)"<<endl; |
566 |
cout << " --> trktag = "<<trktag<<" already defined "<<endl; |
567 |
return NULL; |
568 |
} |
569 |
} |
570 |
// |
571 |
event->clevel1->good2 = 1; //is a trk track |
572 |
event->clevel1->trkchi2 = 0; |
573 |
event->clevel1->hzn = 0; |
574 |
// |
575 |
// Copy the alpha vector in the input structure |
576 |
// |
577 |
for (Int_t e = 0; e < 5 ; e++){ |
578 |
event->clevel1->al_p[e][0] = al[e]; |
579 |
}; |
580 |
// |
581 |
// Get tracker related variables for this track |
582 |
// |
583 |
if ( debug ) printf("track %i Call GetTrkVar() \n",trktag); |
584 |
event->GetTrkVar(); |
585 |
if ( debug ) printf(" event->clevel2->dX0l %f \n",event->clevel2->dX0l); |
586 |
// |
587 |
// Save tracker track sequence number |
588 |
// |
589 |
event->trkseqno = trktag; |
590 |
// |
591 |
// Copy values in the class ca from the structure clevel2 |
592 |
// |
593 |
if ( debug ) printf("track %i Call FillTrkVar() \n",trktag); |
594 |
event->FillTrkVar(pcalo,ntrkentry); |
595 |
|
596 |
return pcalo->GetCaloTrkVar(ntrkentry); |
597 |
|
598 |
|
599 |
};//ELENA |