]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/AliHLTTRDClusterizer.cxx
bugfix: corrected stimated size for emulated tracks (Theodor)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDClusterizer.cxx
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 //                                                                           //
18 // HLT TRD cluster finder                                                    //
19 //                                                                           //
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #include "AliHLTTRDClusterizer.h"
23 #include "AliTRDgeometry.h"
24 #include "AliTRDcluster.h"
25 #include "AliTRDReconstructor.h"
26 #include <TClonesArray.h>
27
28 ClassImp(AliHLTTRDClusterizer)
29
30 //_____________________________________________________________________________
31 AliHLTTRDClusterizer::AliHLTTRDClusterizer(const AliTRDReconstructor *const rec)
32   :AliTRDclusterizer(rec)
33   ,fClMemBlock(NULL)
34   ,fTrMemBlock(NULL)
35   ,fTrMemCurrPtr(NULL)
36 {
37   //
38   // AliHLTTRDClusterizer default constructor
39   //
40 }
41
42 //_____________________________________________________________________________
43 AliHLTTRDClusterizer::AliHLTTRDClusterizer(const Text_t *const name, const Text_t *const title, const AliTRDReconstructor *const rec)
44   : AliTRDclusterizer(name,title,rec)
45   ,fClMemBlock(NULL)
46   ,fTrMemBlock(NULL)
47   ,fTrMemCurrPtr(NULL)
48 {
49   //
50   // AliHLTTRDClusterizer constructor
51   //
52 }
53
54 //_____________________________________________________________________________
55 AliHLTTRDClusterizer::AliHLTTRDClusterizer(const AliHLTTRDClusterizer& c)
56   : AliTRDclusterizer(c)
57   ,fClMemBlock(NULL)
58   ,fTrMemBlock(NULL)
59   ,fTrMemCurrPtr(NULL)
60 {
61   //
62   // AliHLTTRDClusterizer copy constructor
63   //
64 }
65
66 //_____________________________________________________________________________
67 AliHLTTRDClusterizer& AliHLTTRDClusterizer::operator=(const AliHLTTRDClusterizer& c)
68 {
69   //
70   // Assignment operator
71   //
72   
73   if(this!=&c) 
74     c.Copy(*this);
75   return *this;
76 }
77
78 //_____________________________________________________________________________
79 void AliHLTTRDClusterizer::Copy(TObject& c) const
80 {
81   //
82   // Copy function
83   //
84
85   ((AliHLTTRDClusterizer&)c).fClMemBlock = NULL;
86   ((AliHLTTRDClusterizer&)c).fTrMemBlock = NULL;
87   ((AliHLTTRDClusterizer&)c).fTrMemCurrPtr = NULL;
88 }
89
90 //_____________________________________________________________________________
91 void AliHLTTRDClusterizer::AddClusterToArray(AliTRDcluster *cluster)
92 {
93   //
94   // Add a cluster to the array
95   //
96
97   AliHLTTRDCluster *ptr = &(((AliHLTTRDCluster*)GetClMemBlock())[fNoOfClusters]);
98   new(ptr) AliHLTTRDCluster(cluster);
99 }
100
101 //_____________________________________________________________________________
102 void AliHLTTRDClusterizer::AddTrackletsToArray()
103 {
104   //
105   // Add the online tracklets of this chamber to the array
106   //
107
108   // memcpy(&(((UInt_t*)GetTrMemBlock())[fNoOfTracklets]),fTrackletContainer[0],256*sizeof(UInt_t));
109   // memcpy(&(((UInt_t*)GetTrMemBlock())[fNoOfTracklets+256]),fTrackletContainer[1],256*sizeof(UInt_t));
110
111   // fNoOfTracklets += 512;
112
113   UInt_t* trackletword;
114   AliHLTTRDTrackletWordArray* trklArr = new(fTrMemCurrPtr) AliHLTTRDTrackletWordArray(fDet);
115   fTrMemCurrPtr += sizeof(AliHLTTRDTrackletWordArray);
116   for(Int_t side=0; side<2; side++)
117     {
118       Int_t trkl=0;
119       trackletword=fTrackletContainer[side];
120       while(trackletword[trkl]>0){
121         trkl++;
122       }
123       memcpy(fTrMemCurrPtr,fTrackletContainer[side],trkl*sizeof(UInt_t));
124       fTrMemCurrPtr += trkl*sizeof(UInt_t);
125       trklArr->fCount += trkl;
126     }
127
128   // fTrackletContainer[0]+=256;
129   // fTrackletContainer[1]+=256;
130   // fNoOfTracklets += 512;
131
132 }