AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMFTCARoad.cxx
Go to the documentation of this file.
1 
2 #include "TClonesArray.h"
3 
4 #include "AliMFTCARoad.h"
5 
7 
8 //___________________________________________________________________________
10 TObject(),
11 fID(-1),
12 fNhits(0),
13 fNHitSta(0),
14 fLength(0),
15 fIsGood(kFALSE),
16 fNhitsInLayer(),
17 fLayer1(-1),
18 fLayer2(-1),
19 fNcellsInLayer()
20 {
21 
22  for (Int_t i = 0; i < fNDetMax; i++) {
23  fHitsInLayer[i] = new TClonesArray("AliMFTCAHit",100);
24  fNhitsInLayer[i] = 0;
25  fCellsInLayer[i] = new TClonesArray("AliMFTCACell",10);
26  fNcellsInLayer[i] = 0;
27  }
28 
29 }
30 
31 //___________________________________________________________________________
33 TObject(road),
34 fNhits(road.fNhits),
35 fNHitSta(road.fNHitSta),
36 fLength(road.fLength),
37 fIsGood(road.fIsGood),
38 fLayer1(road.fLayer1),
39 fLayer2(road.fLayer2)
40 {
41 
42  // copy constructor
43 
44  for (Int_t i = 0; i < fNDetMax; i++) {
45  fHitsInLayer[i] = new TClonesArray("AliMFTCAHit",100);
46  fNhitsInLayer[i] = 0;
47  fCellsInLayer[i] = new TClonesArray("AliMFTCACell",10);
48  fNcellsInLayer[i] = 0;
49  }
50 
51 }
52 
53 //___________________________________________________________________________
55 {
56 
57  // assignment operator
58 
59  // check assignement to self
60  if (this == &road) return *this;
61 
62  TObject::operator=(road);
63 
64  fNhits = road.fNhits;
65  fNHitSta = road.fNHitSta;
66  fLength = road.fLength;
67  fIsGood = road.fIsGood;
68  fLayer1 = road.fLayer1;
69  fLayer2 = road.fLayer2;
70 
71  for (Int_t i = 0; i < fNDetMax; i++) {
72  fHitsInLayer[i] = new TClonesArray("AliMFTCAHit",100);
73  fNhitsInLayer[i] = 0;
74  fCellsInLayer[i] = new TClonesArray("AliMFTCACell",10);
75  fNcellsInLayer[i] = 0;
76  }
77 
78 }
79 
80 //___________________________________________________________________________
81 void AliMFTCARoad::Clear(const Option_t *)
82 {
83 
84  for (Int_t i = 0; i < fNDetMax; i++) {
85  if (fHitsInLayer[i]) fHitsInLayer[i]->Clear("C");
86  if (fCellsInLayer[i]) fCellsInLayer[i]->Clear("C");
87  fNhitsInLayer[i] = 0;
88  fNcellsInLayer[i] = 0;
89  }
90 
91  fNhits = 0;
92  fNHitSta = 0;
93  fLength = 0;
94  fIsGood = kFALSE;
95  fLayer1 = -1;
96  fLayer2 = -1;
97 
98 }
99 
100 //___________________________________________________________________________
102 {
103 
104  fNhits++;
105  Int_t layer = hit->GetLayer();
106  new ((*fHitsInLayer[layer])[fNhitsInLayer[layer]++]) AliMFTCAHit(*hit);
107 
108 }
109 
110 //___________________________________________________________________________
112 
113  Int_t layer = cell->GetLayers()[0];
114  new ((*fCellsInLayer[layer])[fNcellsInLayer[layer]++]) AliMFTCACell(*cell);
115 
116 }
117 //___________________________________________________________________________
119 
120  AliMFTCACell *cell;
121 
122  for (Int_t iL = 0; iL < (fNDetMax-1); iL++) {
123  for (Int_t iC = 0; iC < GetNcellsInLayer(iL); iC++) {
124  cell = GetCellInLayer(iL,iC);
125  if (gid == cell->GetGID()) return cell;
126  }
127  }
128 
129  return 0;
130 
131 }
Bool_t fIsGood
Definition: AliMFTCARoad.h:53
Int_t fNhitsInLayer[fNDetMax]
Definition: AliMFTCARoad.h:54
static const Int_t fNDetMax
Definition: AliMFTCARoad.h:47
void AddCell(AliMFTCACell *cell)
Int_t * GetLayers()
Definition: AliMFTCACell.h:29
const Int_t GetNcellsInLayer(Int_t nl)
Definition: AliMFTCARoad.h:40
const Int_t GetLayer()
Definition: AliMFTCAHit.h:28
ClassImp(AliMFTCARoad) AliMFTCARoad
Definition: AliMFTCARoad.cxx:6
AliMFTCACell * GetCellInLayer(Int_t nl, Int_t nc)
Definition: AliMFTCARoad.h:41
TClonesArray * fHitsInLayer[fNDetMax]
Definition: AliMFTCARoad.h:59
Int_t fNHitSta
Definition: AliMFTCARoad.h:51
void AddHit(AliMFTCAHit *hit)
AliMFTCARoad & operator=(const AliMFTCARoad &)
virtual void Clear(const Option_t *)
const Int_t GetGID()
Definition: AliMFTCACell.h:38
TClonesArray * fCellsInLayer[fNDetMax]
Array of hits per layer.
Definition: AliMFTCARoad.h:60
Int_t fNcellsInLayer[fNDetMax]
Definition: AliMFTCARoad.h:57
AliMFTCACell * GetCellByGID(Int_t gid)