]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrigger.cxx
changed error evaluation (better pulls at high multiplicity)
[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
9e79a757 438 if (row < 0 || row >= nRowMax) {
0ee00e25 439 Error("MakeTracklets","MCM row number out of range.");
9e79a757 440 continue;
0ee00e25 441 }
442
443 fMCM->GetColRange(col1,col2);
444
445 for (time = 0; time < nTimeTotal; time++) {
446 for (col = col1; col < col2; col++) {
447 if (col >= 0 && col < nColMax) {
448 amp = TMath::Abs(fDigits->GetDataUnchecked(row,col,time));
449 } else {
450 amp = 0.0;
451 }
452 fMCM->SetADC(col-col1,time,amp);
453
454 }
455 }
456
457 if (fTrigParam->GetTailCancelation()) {
458 fMCM->Filter(fTrigParam->GetNexponential(),fTrigParam->GetFilterType());
459 }
460
461 if (fMCM->Run()) {
462
463 for (Int_t iSeed = 0; iSeed < kMaxTrackletsPerMCM; iSeed++) {
464
465 if (fMCM->GetSeedCol()[iSeed] < 0) continue;
466
467 if ( fTrigParam->GetDebugLevel() > 1 )
468 printf("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed]);
469
470 if ( fTrigParam->GetDebugLevel() == -1 ) {
471 printf("Add tracklet %d in col %02d \n",fNtracklets,fMCM->GetSeedCol()[iSeed]);
472 for (time = 0; time < nTimeTotal; time++) {
473 for (col = 0; col < kMcmCol; col++) {
474 printf("%03.0f ",fMCM->GetADC(col,time));
475 }
476 printf("\n");
477 }
478 }
479
3fcb9908 480 if (TestTracklet(idet,row,iSeed,0)) {
481 AddTracklet(idet,row,iSeed,fNtracklets++);
482 }
0ee00e25 483
484 }
485
486 }
487
488 }
489
490
491 }
492
493 // Compress the arrays
494 fDigits->Compress(1,0);
495 fTrack0->Compress(1,0);
496 fTrack1->Compress(1,0);
497 fTrack2->Compress(1,0);
498
499 WriteTracklets(idet);
500
501 }
502 }
503 }
e3b2b5e5 504
505 if (makeTracks) {
506 idet++;
507 MakeTracks(idet-AliTRDgeometry::Nplan());
508 ResetTracklets();
509 }
510
0ee00e25 511 return kTRUE;
512
513}
514
515//_____________________________________________________________________________
516void AliTRDtrigger::SetMCMcoordinates(Int_t imcm)
517{
3fcb9908 518 //
519 // Configure MCM position in the pad plane
520 //
0ee00e25 521
522 Int_t robid = fMCM->GetRobId();
523
524 // setting the Row and Col range
525
526 const Int_t kNcolRob = 2; // number of ROBs per chamber in column direction
527 const Int_t kNmcmRob = 4; // number of MCMs per ROB in column/row direction
528
529 Int_t mcmid = imcm%(kNmcmRob*kNmcmRob);
530
531 if (robid%kNcolRob == 0) {
532
533 if ( mcmid%kNmcmRob == 0 ) {
534 fMCM->SetColRange(18*0-1,18*1-1+2+1);
535 }
536 if ( mcmid%kNmcmRob == 1 ) {
537 fMCM->SetColRange(18*1-1,18*2-1+2+1);
538 }
539 if ( mcmid%kNmcmRob == 2 ) {
540 fMCM->SetColRange(18*2-1,18*3-1+2+1);
541 }
542 if ( mcmid%kNmcmRob == 3 ) {
543 fMCM->SetColRange(18*3-1,18*4-1+2+1);
544 }
545
546 } else {
547
548 if ( mcmid%kNmcmRob == 0 ) {
549 fMCM->SetColRange(18*4-1,18*5-1+2+1);
550 }
551 if ( mcmid%kNmcmRob == 1 ) {
552 fMCM->SetColRange(18*5-1,18*6-1+2+1);
553 }
554 if ( mcmid%kNmcmRob == 2 ) {
555 fMCM->SetColRange(18*6-1,18*7-1+2+1);
556 }
557 if ( mcmid%kNmcmRob == 3 ) {
558 fMCM->SetColRange(18*7-1,18*8-1+2+1);
559 }
560
561 }
562
563 fMCM->SetRow(kNmcmRob*(robid/kNcolRob)+mcmid/kNmcmRob);
564
565}
566
567//_____________________________________________________________________________
3fcb9908 568Bool_t AliTRDtrigger::TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n)
0ee00e25 569{
3fcb9908 570 //
571 // Check first the tracklet pt
572 //
0ee00e25 573
3fcb9908 574 Int_t nTimeTotal = fCalib->GetNumberOfTimeBins();
575
576 fTrkTest->Reset();
577
578 fTrkTest->SetDetector(det);
579 fTrkTest->SetRow(row);
580 fTrkTest->SetN(n);
581
582 Int_t iCol, iCol1, iCol2, track[3];
583 iCol = fMCM->GetSeedCol()[seed]; // 0....20 (MCM)
584 fMCM->GetColRange(iCol1,iCol2); // range in the pad plane
585
586 Float_t amp[3];
587 for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
588
589 amp[0] = fMCM->GetADC(iCol-1,iTime);
590 amp[1] = fMCM->GetADC(iCol ,iTime);
591 amp[2] = fMCM->GetADC(iCol+1,iTime);
592
593 // extract track contribution only from the central pad
594 track[0] = fTrack0->GetDataUnchecked(row,iCol+iCol1,iTime);
595 track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime);
596 track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime);
597
598 if (fMCM->IsCluster(iCol,iTime)) {
599
600 fTrkTest->AddCluster(iCol+iCol1,iTime,amp,track);
601
602 } else if ((iCol+1+1) < kMcmCol) {
603
604 amp[0] = fMCM->GetADC(iCol-1+1,iTime);
605 amp[1] = fMCM->GetADC(iCol +1,iTime);
606 amp[2] = fMCM->GetADC(iCol+1+1,iTime);
607
608 if (fMCM->IsCluster(iCol+1,iTime)) {
609
610 // extract track contribution only from the central pad
611 track[0] = fTrack0->GetDataUnchecked(row,iCol+1+iCol1,iTime);
612 track[1] = fTrack1->GetDataUnchecked(row,iCol+1+iCol1,iTime);
613 track[2] = fTrack2->GetDataUnchecked(row,iCol+1+iCol1,iTime);
614
615 fTrkTest->AddCluster(iCol+1+iCol1,iTime,amp,track);
616
617 }
618
619 } else {
620 }
0ee00e25 621
3fcb9908 622 }
623
624 fTrkTest->CookLabel(0.8);
625 /*
626 if (fTrkTest->GetLabel() >= fNPrimary) {
627 Info("AddTracklet","Only primaries are stored!");
628 return;
629 }
630 */
631 // LTU Pt cut
632
633 fTrkTest->MakeTrackletGraph(fGeo,fField);
634 fTrkTest->MakeClusAmpGraph();
635 if (TMath::Abs(fTrkTest->GetPt()) < fTrigParam->GetLtuPtCut()) {
636 return kFALSE;
0ee00e25 637 }
638
3fcb9908 639 return kTRUE;
640
641}
642
643//_____________________________________________________________________________
644void AliTRDtrigger::AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n)
645{
646 //
647 // Add a found tracklet
648 //
649
650 Int_t nTimeTotal = fCalib->GetNumberOfTimeBins();
0ee00e25 651
652 fTrk = new AliTRDmcmTracklet(det,row,n);
653
654 Int_t iCol, iCol1, iCol2, track[3];
655 iCol = fMCM->GetSeedCol()[seed]; // 0....20 (MCM)
656 fMCM->GetColRange(iCol1,iCol2); // range in the pad plane
657
e3b2b5e5 658 Float_t amp[3];
0ee00e25 659 for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
660
e3b2b5e5 661 amp[0] = fMCM->GetADC(iCol-1,iTime);
662 amp[1] = fMCM->GetADC(iCol ,iTime);
663 amp[2] = fMCM->GetADC(iCol+1,iTime);
0ee00e25 664
665 // extract track contribution only from the central pad
666 track[0] = fTrack0->GetDataUnchecked(row,iCol+iCol1,iTime);
667 track[1] = fTrack1->GetDataUnchecked(row,iCol+iCol1,iTime);
668 track[2] = fTrack2->GetDataUnchecked(row,iCol+iCol1,iTime);
669
670 if (fMCM->IsCluster(iCol,iTime)) {
671
e3b2b5e5 672 fTrk->AddCluster(iCol+iCol1,iTime,amp,track);
0ee00e25 673
674 } else if ((iCol+1+1) < kMcmCol) {
675
e3b2b5e5 676 amp[0] = fMCM->GetADC(iCol-1+1,iTime);
677 amp[1] = fMCM->GetADC(iCol +1,iTime);
678 amp[2] = fMCM->GetADC(iCol+1+1,iTime);
0ee00e25 679
680 if (fMCM->IsCluster(iCol+1,iTime)) {
681
682 // extract track contribution only from the central pad
683 track[0] = fTrack0->GetDataUnchecked(row,iCol+1+iCol1,iTime);
684 track[1] = fTrack1->GetDataUnchecked(row,iCol+1+iCol1,iTime);
685 track[2] = fTrack2->GetDataUnchecked(row,iCol+1+iCol1,iTime);
686
e3b2b5e5 687 fTrk->AddCluster(iCol+1+iCol1,iTime,amp,track);
0ee00e25 688
689 }
690
691 } else {
692 }
693
694 }
695
696 fTrk->CookLabel(0.8);
697 /*
698 if (fTrk->GetLabel() >= fNPrimary) {
699 Info("AddTracklet","Only primaries are stored!");
700 return;
701 }
702 */
703 // LTU Pt cut
3fcb9908 704 fTrk->MakeTrackletGraph(fGeo,fField);
0ee00e25 705 fTrk->MakeClusAmpGraph();
e3b2b5e5 706 if (TMath::Abs(fTrk->GetPt()) < fTrigParam->GetLtuPtCut()) {
707 return;
708 }
0ee00e25 709
710 Tracklets()->Add(fTrk);
711
712}
713
714//_____________________________________________________________________________
715Bool_t AliTRDtrigger::WriteTracklets(Int_t det)
716{
717 //
718 // Fills TRDmcmTracklet branch in the tree with the Tracklets
719 // found in detector = det. For det=-1 writes the tree.
720 //
721
722 if ((det < -1) || (det >= AliTRDgeometry::Ndet())) {
723 Error("WriteTracklets","Unexpected detector index %d.",det);
724 return kFALSE;
725 }
726
727 TBranch *branch = fTrackletTree->GetBranch("TRDmcmTracklet");
728 if (!branch) {
729 TObjArray *ioArray = 0;
730 branch = fTrackletTree->Branch("TRDmcmTracklet","TObjArray",&ioArray,32000,0);
731 }
732
733 if ((det >= 0) && (det < AliTRDgeometry::Ndet())) {
734
735 Int_t nTracklets = Tracklets()->GetEntriesFast();
736 TObjArray *detTracklets = new TObjArray(400);
737
738 for (Int_t i = 0; i < nTracklets; i++) {
739 AliTRDmcmTracklet *trk = (AliTRDmcmTracklet *) Tracklets()->UncheckedAt(i);
740
741 if (det == trk->GetDetector()) {
742 detTracklets->AddLast(trk);
743 }
744 else {
745 }
746 }
747
748 branch->SetAddress(&detTracklets);
749 fTrackletTree->Fill();
750
751 delete detTracklets;
752
753 return kTRUE;
754
755 }
756
757 if (det == -1) {
758
759 Info("WriteTracklets","Writing the Tracklet tree %s for event %d."
760 ,fTrackletTree->GetName(),fRunLoader->GetEventNumber());
761
762 AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
763 loader->WriteTracks("OVERWRITE");
764
765 return kTRUE;
766
767 }
768
769 return kFALSE;
770
771}
772
773//_____________________________________________________________________________
774void AliTRDtrigger::MakeTracks(Int_t det)
775{
776 //
777 // Create GTU tracks per module (stack of 6 chambers)
778 //
779
780 fModule->Reset();
781
0ee00e25 782 Int_t nRowMax, iplan, icham, isect, row;
783
0ee00e25 784 if ((det < 0) || (det >= AliTRDgeometry::Ndet())) {
785 Error("MakeTracks","Unexpected detector index %d.",det);
786 return;
787 }
788
789 Int_t nTracklets = Tracklets()->GetEntriesFast();
790
791 AliTRDmcmTracklet *trk;
792 for (Int_t i = 0; i < nTracklets; i++) {
793
794 trk = (AliTRDmcmTracklet *) Tracklets()->UncheckedAt(i);
795
3fcb9908 796 iplan = fGeo->GetPlane(trk->GetDetector());
797 icham = fGeo->GetChamber(trk->GetDetector());
798 isect = fGeo->GetSector(trk->GetDetector());
0ee00e25 799
3fcb9908 800 nRowMax = fCParam->GetRowMax(iplan,icham,isect);
0ee00e25 801 row = trk->GetRow();
802
803 fModule->AddTracklet(trk->GetDetector(),
804 row,
805 trk->GetRowz(),
806 trk->GetSlope(),
807 trk->GetOffset(),
808 trk->GetTime0(),
809 trk->GetNclusters(),
810 trk->GetLabel(),
811 trk->GetdQdl());
812
813 }
814
815 fModule->SortTracklets();
816 fModule->RemoveMultipleTracklets();
3fcb9908 817 fModule->SortZ((Int_t)fGeo->GetChamber(det));
0ee00e25 818 fModule->FindTracks();
819 fModule->SortTracks();
820 fModule->RemoveMultipleTracks();
821
822 Int_t nModTracks = fModule->GetNtracks();
823 AliTRDgtuTrack *gtutrk;
824 for (Int_t i = 0; i < nModTracks; i++) {
825 gtutrk = (AliTRDgtuTrack*)fModule->GetTrack(i);
826 if (TMath::Abs(gtutrk->GetPt()) < fTrigParam->GetGtuPtCut()) continue;
827 gtutrk->CookLabel();
828 gtutrk->MakePID();
829 AddTrack(gtutrk,det);
830 }
831
832}
833
834