AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMFTCALadder.cxx
Go to the documentation of this file.
1 
2 #include "TClonesArray.h"
3 #include "AliMFTCALadder.h"
4 
5 
7 
8 
9 //___________________________________________________________________________
11 TObject(),
12 fID(-1),
13 fNhits(0),
14 fNcells(0)
15 {
16 
17  fCells = new TClonesArray("AliMFTCACell", 1000);
18  fHits = new TClonesArray("AliMFTCAHit", 1000);
19 
20 }
21 
22 //___________________________________________________________________________
24 TObject(ladder),
25 fID(ladder.fID),
26 fNhits(ladder.fNhits),
27 fNcells(ladder.fNcells)
28 {
29 
30  // copy constructor
31 
32  fCells = new TClonesArray("AliMFTCACell", ladder.fNcells);
33  fHits = new TClonesArray("AliMFTCAHit", ladder.fNhits);
34 
35  AliMFTCACell *caCell;
36  for (Int_t i = 0; i < ladder.fNcells; i++) {
37  caCell = (AliMFTCACell*)(ladder.fCells->At(i));
38  new ((*fCells)[i]) AliMFTCACell(*caCell);
39  }
40  AliMFTCAHit *caHit;
41  for (Int_t i = 0; i < ladder.fNhits; i++) {
42  caHit = (AliMFTCAHit*)(ladder.fHits->At(i));
43  new ((*fHits)[i]) AliMFTCAHit(*caHit);
44  }
45 
46 }
47 
48 //___________________________________________________________________________
50 {
51 
52  // assignment operator
53 
54  // check assignement to self
55  if (this == &ladder) return *this;
56 
57  TObject::operator=(ladder);
58 
59  fID = ladder.fID;
60  fNhits = ladder.fNhits;
61  fNcells = ladder.fNcells;
62 
63  fCells = new TClonesArray("AliMFTCACell", ladder.fNcells);
64  fHits = new TClonesArray("AliMFTCAHit", ladder.fNhits);
65 
66  AliMFTCACell *caCell;
67  for (Int_t i = 0; i < ladder.fNcells; i++) {
68  caCell = (AliMFTCACell*)(ladder.fCells->At(i));
69  new ((*fCells)[i]) AliMFTCACell(*caCell);
70  }
71  AliMFTCAHit *caHit;
72  for (Int_t i = 0; i < ladder.fNhits; i++) {
73  caHit = (AliMFTCAHit*)(ladder.fHits->At(i));
74  new ((*fHits)[i]) AliMFTCAHit(*caHit);
75  }
76 
77 }
78 
79 //___________________________________________________________________________
80 void AliMFTCALadder::Clear(const Option_t *)
81 {
82 
83  if (fCells) fCells->Clear("C");
84  if (fHits) fHits->Clear("C");
85 
86  fNhits = 0;
87  fNcells = 0;
88 
89 }
90 
91 //___________________________________________________________________________
93 {
94 
95  if (fCells) fCells->Clear("C");
96 
97  fNcells = 0;
98 
99 }
100 
101 //___________________________________________________________________________
103 {
104 
105  new ((*fCells)[fNcells++]) AliMFTCACell();
106  AliMFTCACell *cell = (AliMFTCACell*)fCells->At(fCells->GetLast());
107 
108  return cell;
109 
110 }
111 
112 //___________________________________________________________________________
114 {
115 
116  new ((*fHits)[fNhits++]) AliMFTCAHit();
117  AliMFTCAHit *hit = (AliMFTCAHit*)fHits->At(fHits->GetLast());
118 
119  return hit;
120 
121 }
TClonesArray * fHits
Array of cells.
virtual void Clear(const Option_t *)
AliMFTCACell * AddCell()
ClassImp(AliMFTCALadder) AliMFTCALadder
AliMFTCALadder & operator=(const AliMFTCALadder &)
AliMFTCAHit * AddHit()
TClonesArray * fCells