Reduced memory consumption (Bogdan)
[u/mrichter/AliRoot.git] / TRD / AliTRDtrigger.cxx
CommitLineData
0ee00e25 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16///////////////////////////////////////////////////////////////////////////////
17// //
e3b2b5e5 18// //
0ee00e25 19// TRD trigger class //
20// //
e3b2b5e5 21// //
0ee00e25 22///////////////////////////////////////////////////////////////////////////////
23
24#include <TTree.h>
25#include <TBranch.h>
26#include <TMatrixD.h>
27
28#include "AliLog.h"
29#include "AliRun.h"
0ee00e25 30#include "AliLoader.h"
0ee00e25 31
32#include "AliTRDdigitsManager.h"
33#include "AliTRDgeometry.h"
34#include "AliTRDdataArrayI.h"
35#include "AliTRDcalibDB.h"
36#include "AliTRDCommonParam.h"
37#include "Cal/AliTRDCalPIDLQ.h"
38#include "AliTRDrawData.h"
39
40#include "AliTRDtrigger.h"
e3b2b5e5 41#include "AliTRDmodule.h"
0ee00e25 42#include "AliTRDmcmTracklet.h"
43#include "AliTRDtrigParam.h"
44#include "AliTRDmcm.h"
e3b2b5e5 45#include "AliTRDzmaps.h"
0ee00e25 46
e3b2b5e5 47//#include "AliHeader.h"
0ee00e25 48
e3b2b5e5 49ClassImp(AliTRDtrigger)
0ee00e25 50
51//_____________________________________________________________________________
52AliTRDtrigger::AliTRDtrigger():
53 TNamed(),
54 fTracks("AliTRDgtuTrack",0)
55{
56 //
57 // AliTRDtrigger default constructor
58 //
59
60 fDigitsManager = NULL;
61 fTrackletTree = NULL;
62 fTracklets = NULL;
63
64 fNROB = 0;
65 fTrigParam = NULL;
66 fMCM = NULL;
67 fTrk = NULL;
3fcb9908 68 fTrkTest = NULL;
0ee00e25 69 fGTUtrk = NULL;
70
71 fNtracklets = 0;
72
73 fDigits = NULL;
74 fTrack0 = NULL;
75 fTrack1 = NULL;
76 fTrack2 = NULL;
77
78 fModule = NULL;
79
80 fNPrimary = 0;
81
3fcb9908 82 fField = 0.0;
83 fGeo = NULL;
84 fCalib = NULL;
85 fCParam = NULL;
86
0ee00e25 87}
88
89//_____________________________________________________________________________
90AliTRDtrigger::AliTRDtrigger(const Text_t *name, const Text_t *title):
91 TNamed(name,title),
92 fTracks("AliTRDgtuTrack",1000)
93{
94 //
95 // AliTRDtrigger constructor
96 //
97
98 fDigitsManager = new AliTRDdigitsManager();
99 fTrackletTree = NULL;
100 fTracklets = new TObjArray(400);
101
102 fNROB = 0;
103 fTrigParam = NULL;
104 fMCM = NULL;
105 fTrk = NULL;
3fcb9908 106 fTrkTest = NULL;
0ee00e25 107 fGTUtrk = NULL;
108
109 fNtracklets = 0;
110
111 fDigits = NULL;
112 fTrack0 = NULL;
113 fTrack1 = NULL;
114 fTrack2 = NULL;
115
116 fModule = NULL;
117
118 fNPrimary = 0;
119
3fcb9908 120 fField = 0.0;
121 fGeo = NULL;
122 fCalib = NULL;
123 fCParam = NULL;
124
0ee00e25 125}
126
127//_____________________________________________________________________________
128AliTRDtrigger::AliTRDtrigger(const AliTRDtrigger &p):TNamed(p)
129{
130 //
131 // AliTRDtrigger copy constructor
132 //
133
134 ((AliTRDtrigger &) p).Copy(*this);
135
136}
137
138///_____________________________________________________________________________
139AliTRDtrigger::~AliTRDtrigger()
140{
141 //
142 // AliTRDtrigger destructor
143 //
144
145 if (fTracklets) {
146 fTracklets->Delete();
147 delete fTracklets;
148 }
149
150 fTracks.Delete();
151
152}
153
154//_____________________________________________________________________________
155AliTRDtrigger &AliTRDtrigger::operator=(const AliTRDtrigger &p)
156{
157 //
158 // Assignment operator
159 //
160
161 if (this != &p) ((AliTRDtrigger &) p).Copy(*this);
162 return *this;
163
164}
165
166//_____________________________________________________________________________
167void AliTRDtrigger::Copy(TObject &) const
168{
169 //
170 // Copy function
171 //
172
173 AliFatal("Not implemented");
174
175}
176
177//_____________________________________________________________________________
178void AliTRDtrigger::Init()
179{
180
181 fModule = new AliTRDmodule(fTrigParam);
182 /*
183 AliHeader *header = fRunLoader->GetHeader();
184 fNPrimary = header->GetNprimary();
185 */
186 fTracks.Clear();
187
3fcb9908 188 fField = fTrigParam->GetField();
189 fGeo = (AliTRDgeometry*)AliTRDgeometry::GetGeometry(fRunLoader);
190
191 fCalib = AliTRDcalibDB::Instance();
192 if (!fCalib)
193 {
194 Error("Init","No instance of AliTRDcalibDB.");
195 return;
196 }
197
198 fCParam = AliTRDCommonParam::Instance();
199 if (!fCParam)
200 {
201 Error("Init","No common params.");
202 return;
203 }
204
0ee00e25 205}
206
207//_____________________________________________________________________________
208Bool_t AliTRDtrigger::Open(const Char_t *name, Int_t nEvent)
209{
210 //
211 // Opens the AliROOT file.
212 //
213
214 TString evfoldname = AliConfig::GetDefaultEventFolderName();
215 fRunLoader = AliRunLoader::GetRunLoader(evfoldname);
216
217 if (!fRunLoader)
218 fRunLoader = AliRunLoader::Open(name);
219
220 if (!fRunLoader) {
221 Error("Open","Can not open session for file %s.",name);
222 return kFALSE;
223 }
224
225 // Open input
226
227 if (fRunLoader->GetAliRun() == 0x0) fRunLoader->LoadgAlice();
228 gAlice = fRunLoader->GetAliRun();
229
230 if (!(gAlice)) {
231 fRunLoader->LoadgAlice();
232 gAlice = fRunLoader->GetAliRun();
233 if (!(gAlice)) {
234 Error("Open","Could not find AliRun object.");
235 return kFALSE;
236 }
237 }
238
239 // Import the Trees for the event nEvent in the file
240 fRunLoader->GetEvent(nEvent);
241
242 // Open output
243
244 TObjArray *ioArray = 0;
245
246 AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
247 loader->MakeTree("T");
248 fTrackletTree = loader->TreeT();
249 fTrackletTree->Branch("TRDmcmTracklet","TObjArray",&ioArray,32000,0);
e3b2b5e5 250 /*
0ee00e25 251 fRunLoader->LoadHeader();
e3b2b5e5 252 */
0ee00e25 253 Init();
254
255 return kTRUE;
256
257}
258
259
260//_____________________________________________________________________________
261Bool_t AliTRDtrigger::ReadDigits()
262{
263 //
264 // Reads the digits arrays from the input aliroot file
265 //
266
267 if (!fRunLoader) {
268 Error("ReadDigits","Can not find the Run Loader");
269 return kFALSE;
270 }
271
272 AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
273 if (!loader->TreeD()) loader->LoadDigits();
274
275 return (fDigitsManager->ReadDigits(loader->TreeD()));
276
277}
278
279//_____________________________________________________________________________
280Bool_t AliTRDtrigger::ReadDigits(AliRawReader* rawReader)
281{
282 //
283 // Reads the digits arrays from the ddl file
284 //
285
286 AliTRDrawData *raw = new AliTRDrawData();
287 raw->SetDebug(1);
288
289 fDigitsManager = raw->Raw2Digits(rawReader);
290
291 return kTRUE;
292
293}
294
295//_____________________________________________________________________________
296Bool_t AliTRDtrigger::ReadTracklets(AliRunLoader *rl)
297{
298 //
299 // Reads the tracklets find the tracks
300 //
301
302 Int_t idet;
303
304 AliLoader *loader = rl->GetLoader("TRDLoader");
305 loader->LoadTracks();
306 fTrackletTree = loader->TreeT();
307
308 TBranch *branch = fTrackletTree->GetBranch("TRDmcmTracklet");
309 if (!branch) {
310 Error("ReadTracklets","Can't get the branch !");
311 return kFALSE;
312 }
313 TObjArray *tracklets = new TObjArray(400);
314 branch->SetAddress(&tracklets);
315
316 Int_t nEntries = (Int_t) fTrackletTree->GetEntries();
317 Int_t iEntry, itrk;
318 Int_t iStack, iStackPrev = -1;
319
320 for (iEntry = 0; iEntry < nEntries; iEntry++) {
321 fTrackletTree->GetEvent(iEntry);
322
323 for (itrk = 0; itrk < tracklets->GetEntriesFast(); itrk++){
324
325 fTrk = (AliTRDmcmTracklet*)tracklets->UncheckedAt(itrk);
326
327 idet = fTrk->GetDetector();
328
329 iStack = idet / (AliTRDgeometry::Nplan());
330 if (iStackPrev != iStack) {
331 if (iStackPrev == -1) {
332 iStackPrev = iStack;
333 } else {
334 MakeTracks(idet-AliTRDgeometry::Nplan());
335 ResetTracklets();
336 iStackPrev = iStack;
337 }
338 }
339
340 Tracklets()->Add(fTrk);
341
342 if (iEntry == (nEntries-1) && itrk == (tracklets->GetEntriesFast()-1)) {
343 idet++;
344 MakeTracks(idet-AliTRDgeometry::Nplan());
345 ResetTracklets();
346 }
347
348 }
349
350 }
351
352 loader->UnloadTracks();
353
354 return kTRUE;
355
356}
357
358//_____________________________________________________________________________
e3b2b5e5 359Bool_t AliTRDtrigger::MakeTracklets(Bool_t makeTracks)
0ee00e25 360{
3fcb9908 361 //
362 // Create tracklets from digits
363 //
0ee00e25 364
365 Int_t chamBeg = 0;
366 Int_t chamEnd = AliTRDgeometry::Ncham();
367 Int_t planBeg = 0;
368 Int_t planEnd = AliTRDgeometry::Nplan();
369 Int_t sectBeg = 0;
370 Int_t sectEnd = AliTRDgeometry::Nsect();
371
3fcb9908 372 fTrkTest = new AliTRDmcmTracklet(0,0,0);
373
0ee00e25 374 fMCM = new AliTRDmcm(fTrigParam,0);
375
376 Int_t time, col, row, col1, col2;
377 Float_t amp;
378 Int_t idet, iStack, iStackPrev;
3fcb9908 379 idet = -1;
0ee00e25 380 iStack = -1;
381 iStackPrev = -1;
382 for (Int_t isect = sectBeg; isect < sectEnd; isect++) {
383
384 for (Int_t icham = chamBeg; icham < chamEnd; icham++) {
385
386 // number of ROBs in the chamber
387 if( icham == 2 ) {
388 fNROB = 6;
389 } else {
390 fNROB = 8;
391 }
392
393 for (Int_t iplan = planBeg; iplan < planEnd; iplan++) {
394
3fcb9908 395 idet = fGeo->GetDetector(iplan,icham,isect);
0ee00e25 396 ResetTracklets();
e3b2b5e5 397
398 if (makeTracks) {
399 iStack = idet / (AliTRDgeometry::Nplan());
400 if (iStackPrev != iStack) {
401 if (iStackPrev == -1) {
402 iStackPrev = iStack;
403 } else {
404 MakeTracks(idet-AliTRDgeometry::Nplan());
405 ResetTracklets();
406 iStackPrev = iStack;
407 }
0ee00e25 408 }
409 }
e3b2b5e5 410
3fcb9908 411 Int_t nRowMax = fCParam->GetRowMax(iplan,icham,isect);
412 Int_t nColMax = fCParam->GetColMax(iplan);
413 Int_t nTimeTotal = fCalib->GetNumberOfTimeBins();
0ee00e25 414
415 // Get the digits
416 fDigits = fDigitsManager->GetDigits(idet);
417 fDigits->Expand();
418 fTrack0 = fDigitsManager->GetDictionary(idet,0);
419 fTrack0->Expand();
420 fTrack1 = fDigitsManager->GetDictionary(idet,1);
421 fTrack1->Expand();
422 fTrack2 = fDigitsManager->GetDictionary(idet,2);
423 fTrack2->Expand();
424
0ee00e25 425 for (Int_t iRob = 0; iRob < fNROB; iRob++) {
426
427 for (Int_t iMcm = 0; iMcm < kNMCM; iMcm++) {
428
429 fMCM->Reset();
430
431 fMCM->SetRobId(iRob);
432 fMCM->SetChaId(idet);
433
434 SetMCMcoordinates(iMcm);
435
436 row = fMCM->GetRow();
437
3fcb9908 438 if (row < 0 || row > nRowMax) {
0ee00e25 439 Error("MakeTracklets","MCM row number out of range.");
440 }
441
442 fMCM->GetColRange(col1,col2);
443
444 for (time = 0; time < nTimeTotal; time++) {
445 for (col = col1; col < col2; col++) {
446 if (col >= 0 && col < nColMax) {
447 amp = TMath::Abs(fDigits->GetDataUnchecked(row,col,time));
448 } else {
449 amp = 0.0;
450 }
451 fMCM->SetADC(col-col1,time,amp);
452
453 }
454 }
455
456 if (fTrigParam->GetTailCancelation()) {
457 fMCM->Filter(fTrigParam->GetNexponential(),fTrigParam->GetFilterType());
458 }
459
460 if (fMCM->Run()) {
461
462 for (Int_t iSeed = 0; iSeed < kMaxTrackletsPerMCM; iSeed++) {
463
464 if (fMCM->GetSeedCol()[iSeed] < 0) continue;
465
466 if ( fTrigParam->GetDebugLevel() > 1 )
467 printf("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed]);
468
469 if ( fTrigParam->GetDebugLevel() == -1 ) {
470 printf("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed]);
471 for (time = 0; time < nTimeTotal; time++) {
472 for (col = 0; col < kMcmCol; col++) {
473 printf("%03.0f ",fMCM->GetADC(col,time));
474 }
475 printf("\n");
476 }
477 }
478
3fcb9908 479 if (TestTracklet(idet,row,iSeed,0)) {
480 AddTracklet(idet,row,iSeed,fNtracklets++);
481 }
0ee00e25 482
483 }
484
485 }
486
487 }
488
489
490 }
491
492 // Compress the arrays
493 fDigits->Compress(1,0);
494 fTrack0->Compress(1,0);
495 fTrack1->Compress(1,0);
496 fTrack2->Compress(1,0);
497
498 WriteTracklets(idet);
499
500 }
501 }
502 }
e3b2b5e5 503
504 if (makeTracks) {
505 idet++;
506 MakeTracks(idet-AliTRDgeometry::Nplan());
507 ResetTracklets();
508 }
509
0ee00e25 510 return kTRUE;
511
512}
513
514//_____________________________________________________________________________
515void AliTRDtrigger::SetMCMcoordinates(Int_t imcm)
516{
3fcb9908 517 //
518 // Configure MCM position in the pad plane
519 //
0ee00e25 520
521 Int_t robid = fMCM->GetRobId();
522
523 // setting the Row and Col range
524
525 const Int_t kNcolRob = 2; // number of ROBs per chamber in column direction
526 const Int_t kNmcmRob = 4; // number of MCMs per ROB in column/row direction
527
528 Int_t mcmid = imcm%(kNmcmRob*kNmcmRob);
529
530 if (robid%kNcolRob == 0) {
531
532 if ( mcmid%kNmcmRob == 0 ) {
533 fMCM->SetColRange(18*0-1,18*1-1+2+1);
534 }
535 if ( mcmid%kNmcmRob == 1 ) {
536 fMCM->SetColRange(18*1-1,18*2-1+2+1);
537 }
538 if ( mcmid%kNmcmRob == 2 ) {
539 fMCM->SetColRange(18*2-1,18*3-1+2+1);
540 }
541 if ( mcmid%kNmcmRob == 3 ) {
542 fMCM->SetColRange(18*3-1,18*4-1+2+1);
543 }
544
545 } else {
546
547 if ( mcmid%kNmcmRob == 0 ) {
548 fMCM->SetColRange(18*4-1,18*5-1+2+1);
549 }
550 if ( mcmid%kNmcmRob == 1 ) {
551 fMCM->SetColRange(18*5-1,18*6-1+2+1);
552 }
553 if ( mcmid%kNmcmRob == 2 ) {
554 fMCM->SetColRange(18*6-1,18*7-1+2+1);
555 }
556 if ( mcmid%kNmcmRob == 3 ) {
557 fMCM->SetColRange(18*7-1,18*8-1+2+1);
558 }
559
560 }
561
562 fMCM->SetRow(kNmcmRob*(robid/kNcolRob)+mcmid/kNmcmRob);
563
564}
565
566//_____________________________________________________________________________
3fcb9908 567Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n)
0ee00e25 568{
3fcb9908 569 //
570 // Check first the tracklet pt
571 //
0ee00e25 572
3fcb9908 573 Int_t nTimeTotal = fCalib->GetNumberOfTimeBins();
574
575 fTrkTest->Reset();
576
577 fTrkTest->SetDetector(det);
578 fTrkTest->SetRow(row);
579 fTrkTest->SetN(n);
580
581 Int_t iCol, iCol1, iCol2, track[3];
582 iCol = fMCM->GetSeedCol()[seed]; // 0....20 (MCM)
583 fMCM->GetColRange(iCol1,iCol2); // range in the pad plane
584
585 Float_t amp[3];
586 for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
587
588 amp[0] = fMCM->GetADC(iCol-1,iTime);
589 amp[1] = fMCM->GetADC(iCol ,iTime);
590 amp[2] = fMCM->GetADC(iCol+1,iTime);
591
592 // extract track contribution only from the central pad
593 track[0] = fTrack0->GetDataUnchecked(row,iCol+iCol1,iTime);
594 track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime);
595 track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime);
596
597 if (fMCM->IsCluster(iCol,iTime)) {
598
599 fTrkTest->AddCluster(iCol+iCol1,iTime,amp,track);
600
601 } else if ((iCol+1+1) < kMcmCol) {
602
603 amp[0] = fMCM->GetADC(iCol-1+1,iTime);
604 amp[1] = fMCM->GetADC(iCol +1,iTime);
605 amp[2] = fMCM->GetADC(iCol+1+1,iTime);
606
607 if (fMCM->IsCluster(iCol+1,iTime)) {
608
609 // extract track contribution only from the central pad
610 track[0] = fTrack0->GetDataUnchecked(row,iCol+1+iCol1,iTime);
611 track[1] = fTrack1->GetDataUnchecked(row,iCol+1+iCol1,iTime);
612 track[2] = fTrack2->GetDataUnchecked(row,iCol+1+iCol1,iTime);
613
614 fTrkTest->AddCluster(iCol+1+iCol1,iTime,amp,track);
615
616 }
617
618 } else {
619 }
0ee00e25 620
3fcb9908 621 }
622
623 fTrkTest->CookLabel(0.8);
624 /*
625 if (fTrkTest->GetLabel() >= fNPrimary) {
626 Info("AddTracklet","Only primaries are stored!");
627 return;
628 }
629 */
630 // LTU Pt cut
631
632 fTrkTest->MakeTrackletGraph(fGeo,fField);
633 fTrkTest->MakeClusAmpGraph();
634 if (TMath::Abs(fTrkTest->GetPt()) < fTrigParam->GetLtuPtCut()) {
635 return kFALSE;
0ee00e25 636 }
637
3fcb9908 638 return kTRUE;
639
640}
641
642//_____________________________________________________________________________
643void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n)
644{
645 //
646 // Add a found tracklet
647 //
648
649 Int_t nTimeTotal = fCalib->GetNumberOfTimeBins();
0ee00e25 650
651 fTrk = new AliTRDmcmTracklet(det,row,n);
652
653 Int_t iCol, iCol1, iCol2, track[3];
654 iCol = fMCM->GetSeedCol()[seed]; // 0....20 (MCM)
655 fMCM->GetColRange(iCol1,iCol2); // range in the pad plane
656
e3b2b5e5 657 Float_t amp[3];
0ee00e25 658 for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
659
e3b2b5e5 660 amp[0] = fMCM->GetADC(iCol-1,iTime);
661 amp[1] = fMCM->GetADC(iCol ,iTime);
662 amp[2] = fMCM->GetADC(iCol+1,iTime);
0ee00e25 663
664 // extract track contribution only from the central pad
665 track[0] = fTrack0->GetDataUnchecked(row,iCol+iCol1,iTime);
666 track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime);
667 track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime);
668
669 if (fMCM->IsCluster(iCol,iTime)) {
670
e3b2b5e5 671 fTrk->AddCluster(iCol+iCol1,iTime,amp,track);
0ee00e25 672
673 } else if ((iCol+1+1) < kMcmCol) {
674
e3b2b5e5 675 amp[0] = fMCM->GetADC(iCol-1+1,iTime);
676 amp[1] = fMCM->GetADC(iCol +1,iTime);
677 amp[2] = fMCM->GetADC(iCol+1+1,iTime);
0ee00e25 678
679 if (fMCM->IsCluster(iCol+1,iTime)) {
680
681 // extract track contribution only from the central pad
682 track[0] = fTrack0->GetDataUnchecked(row,iCol+1+iCol1,iTime);
683 track[1] = fTrack1->GetDataUnchecked(row,iCol+1+iCol1,iTime);
684 track[2] = fTrack2->GetDataUnchecked(row,iCol+1+iCol1,iTime);
685
e3b2b5e5 686 fTrk->AddCluster(iCol+1+iCol1,iTime,amp,track);
0ee00e25 687
688 }
689
690 } else {
691 }
692
693 }
694
695 fTrk->CookLabel(0.8);
696 /*
697 if (fTrk->GetLabel() >= fNPrimary) {
698 Info("AddTracklet","Only primaries are stored!");
699 return;
700 }
701 */
702 // LTU Pt cut
3fcb9908 703 fTrk->MakeTrackletGraph(fGeo,fField);
0ee00e25 704 fTrk->MakeClusAmpGraph();
e3b2b5e5 705 if (TMath::Abs(fTrk->GetPt()) < fTrigParam->GetLtuPtCut()) {
706 return;
707 }
0ee00e25 708
709 Tracklets()->Add(fTrk);
710
711}
712
713//_____________________________________________________________________________
714Bool_t AliTRDtrigger::WriteTracklets(Int_t det)
715{
716 //
717 // Fills TRDmcmTracklet branch in the tree with the Tracklets
718 // found in detector = det. For det=-1 writes the tree.
719 //
720
721 if ((det < -1) || (det >= AliTRDgeometry::Ndet())) {
722 Error("WriteTracklets","Unexpected detector index %d.",det);
723 return kFALSE;
724 }
725
726 TBranch *branch = fTrackletTree->GetBranch("TRDmcmTracklet");
727 if (!branch) {
728 TObjArray *ioArray = 0;
729 branch = fTrackletTree->Branch("TRDmcmTracklet","TObjArray",&ioArray,32000,0);
730 }
731
732 if ((det >= 0) && (det < AliTRDgeometry::Ndet())) {
733
734 Int_t nTracklets = Tracklets()->GetEntriesFast();
735 TObjArray *detTracklets = new TObjArray(400);
736
737 for (Int_t i = 0; i < nTracklets; i++) {
738 AliTRDmcmTracklet *trk = (AliTRDmcmTracklet *) Tracklets()->UncheckedAt(i);
739
740 if (det == trk->GetDetector()) {
741 detTracklets->AddLast(trk);
742 }
743 else {
744 }
745 }
746
747 branch->SetAddress(&detTracklets);
748 fTrackletTree->Fill();
749
750 delete detTracklets;
751
752 return kTRUE;
753
754 }
755
756 if (det == -1) {
757
758 Info("WriteTracklets","Writing the Tracklet tree %s for event %d."
759 ,fTrackletTree->GetName(),fRunLoader->GetEventNumber());
760
761 AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
762 loader->WriteTracks("OVERWRITE");
763
764 return kTRUE;
765
766 }
767
768 return kFALSE;
769
770}
771
772//_____________________________________________________________________________
773void AliTRDtrigger::MakeTracks(Int_t det)
774{
775 //
776 // Create GTU tracks per module (stack of 6 chambers)
777 //
778
779 fModule->Reset();
780
0ee00e25 781 Int_t nRowMax, iplan, icham, isect, row;
782
0ee00e25 783 if ((det < 0) || (det >= AliTRDgeometry::Ndet())) {
784 Error("MakeTracks","Unexpected detector index %d.",det);
785 return;
786 }
787
788 Int_t nTracklets = Tracklets()->GetEntriesFast();
789
790 AliTRDmcmTracklet *trk;
791 for (Int_t i = 0; i < nTracklets; i++) {
792
793 trk = (AliTRDmcmTracklet *) Tracklets()->UncheckedAt(i);
794
3fcb9908 795 iplan = fGeo->GetPlane(trk->GetDetector());
796 icham = fGeo->GetChamber(trk->GetDetector());
797 isect = fGeo->GetSector(trk->GetDetector());
0ee00e25 798
3fcb9908 799 nRowMax = fCParam->GetRowMax(iplan,icham,isect);
0ee00e25 800 row = trk->GetRow();
801
802 fModule->AddTracklet(trk->GetDetector(),
803 row,
804 trk->GetRowz(),
805 trk->GetSlope(),
806 trk->GetOffset(),
807 trk->GetTime0(),
808 trk->GetNclusters(),
809 trk->GetLabel(),
810 trk->GetdQdl());
811
812 }
813
814 fModule->SortTracklets();
815 fModule->RemoveMultipleTracklets();
3fcb9908 816 fModule->SortZ((Int_t)fGeo->GetChamber(det));
0ee00e25 817 fModule->FindTracks();
818 fModule->SortTracks();
819 fModule->RemoveMultipleTracks();
820
821 Int_t nModTracks = fModule->GetNtracks();
822 AliTRDgtuTrack *gtutrk;
823 for (Int_t i = 0; i < nModTracks; i++) {
824 gtutrk = (AliTRDgtuTrack*)fModule->GetTrack(i);
825 if (TMath::Abs(gtutrk->GetPt()) < fTrigParam->GetGtuPtCut()) continue;
826 gtutrk->CookLabel();
827 gtutrk->MakePID();
828 AddTrack(gtutrk,det);
829 }
830
831}
832
833