]>
Commit | Line | Data |
---|---|---|
1 | #include <string.h> | |
2 | #include "AliMultiplicity.h" | |
3 | ||
4 | ClassImp(AliMultiplicity) | |
5 | ||
6 | //______________________________________________________________________ | |
7 | AliMultiplicity::AliMultiplicity(): | |
8 | TObject(), | |
9 | fNtracks(0), | |
10 | fNsingle(0), | |
11 | fLabels(0), | |
12 | fLabelsL2(0), | |
13 | fTh(0), | |
14 | fPhi(0), | |
15 | fDeltTh(0), | |
16 | fDeltPhi(0), | |
17 | fThsingle(0), | |
18 | fPhisingle(0), | |
19 | fFastOrFiredChips(1200) | |
20 | { | |
21 | // Default Constructor | |
22 | fFiredChips[0] = 0; | |
23 | fFiredChips[1] = 0; | |
24 | } | |
25 | ||
26 | //______________________________________________________________________ | |
27 | AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *th, Float_t *ph, Float_t *dth, Float_t *dph, Int_t *labels, Int_t* labelsL2, Int_t ns, Float_t *ts, Float_t *ps, Short_t nfcL1, Short_t nfcL2, TBits fFastOr): | |
28 | TObject(), | |
29 | fNtracks(ntr), | |
30 | fNsingle(ns), | |
31 | fLabels(0), | |
32 | fLabelsL2(0), | |
33 | fTh(0), | |
34 | fPhi(0), | |
35 | fDeltTh(0), | |
36 | fDeltPhi(0), | |
37 | fThsingle(0), | |
38 | fPhisingle(0), | |
39 | fFastOrFiredChips(1200) | |
40 | { | |
41 | // Standard constructor | |
42 | if(ntr>0){ | |
43 | fLabels = new Int_t[ntr]; | |
44 | fLabelsL2 = new Int_t[ntr]; | |
45 | fTh = new Double_t [ntr]; | |
46 | fPhi = new Double_t [ntr]; | |
47 | fDeltTh = new Double_t [ntr]; | |
48 | fDeltPhi = new Double_t [ntr]; | |
49 | for(Int_t i=0;i<fNtracks;i++){ | |
50 | fTh[i]=th[i]; | |
51 | fPhi[i]=ph[i]; | |
52 | fDeltTh[i]=dth[i]; | |
53 | fDeltPhi[i]=dph[i]; | |
54 | fLabels[i] = labels[i]; | |
55 | fLabelsL2[i] = labelsL2[i]; | |
56 | } | |
57 | } | |
58 | if(ns>0){ | |
59 | fThsingle = new Double_t [ns]; | |
60 | fPhisingle = new Double_t [ns]; | |
61 | for(Int_t i=0;i<fNsingle;i++){ | |
62 | fThsingle[i]=ts[i]; | |
63 | fPhisingle[i]=ps[i]; | |
64 | } | |
65 | } | |
66 | fFiredChips[0] = nfcL1; | |
67 | fFiredChips[1] = nfcL2; | |
68 | fFastOrFiredChips = fFastOr; | |
69 | } | |
70 | ||
71 | //______________________________________________________________________ | |
72 | AliMultiplicity::AliMultiplicity(const AliMultiplicity& m): | |
73 | TObject(m), | |
74 | fNtracks(m.fNtracks), | |
75 | fNsingle(m.fNsingle), | |
76 | fLabels(0), | |
77 | fLabelsL2(0), | |
78 | fTh(0), | |
79 | fPhi(0), | |
80 | fDeltTh(0), | |
81 | fDeltPhi(0), | |
82 | fThsingle(0), | |
83 | fPhisingle(0), | |
84 | fFastOrFiredChips(1200) | |
85 | { | |
86 | // copy constructor | |
87 | Duplicate(m); | |
88 | } | |
89 | ||
90 | //______________________________________________________________________ | |
91 | AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){ | |
92 | // assignment operator | |
93 | if(this == &m)return *this; | |
94 | ((TObject *)this)->operator=(m); | |
95 | ||
96 | if(fTh)delete [] fTh;fTh = 0; | |
97 | if(fPhi)delete [] fPhi;fPhi = 0; | |
98 | if(fDeltTh)delete [] fDeltTh;fDeltTh= 0; | |
99 | if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; | |
100 | if(fLabels)delete [] fLabels;fLabels = 0; | |
101 | if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0; | |
102 | if(fThsingle)delete [] fThsingle;fThsingle = 0; | |
103 | if(fPhisingle)delete [] fPhisingle;fPhisingle = 0; | |
104 | Duplicate(m); | |
105 | ||
106 | return *this; | |
107 | } | |
108 | ||
109 | void AliMultiplicity::Copy(TObject &obj) const { | |
110 | ||
111 | // this overwrites the virtual TOBject::Copy() | |
112 | // to allow run time copying without casting | |
113 | // in AliESDEvent | |
114 | ||
115 | if(this==&obj)return; | |
116 | AliMultiplicity *robj = dynamic_cast<AliMultiplicity*>(&obj); | |
117 | if(!robj)return; // not an AliMultiplicity | |
118 | *robj = *this; | |
119 | ||
120 | } | |
121 | ||
122 | ||
123 | //______________________________________________________________________ | |
124 | void AliMultiplicity::Duplicate(const AliMultiplicity& m){ | |
125 | // used by copy constructor and assignment operator | |
126 | fNtracks = m.fNtracks; | |
127 | if(fNtracks>0){ | |
128 | fTh = new Double_t[fNtracks]; | |
129 | fPhi = new Double_t[fNtracks]; | |
130 | fDeltTh = new Double_t[fNtracks]; | |
131 | fDeltPhi = new Double_t[fNtracks]; | |
132 | fLabels = new Int_t[fNtracks]; | |
133 | fLabelsL2 = new Int_t[fNtracks]; | |
134 | } | |
135 | else { | |
136 | fTh = 0; | |
137 | fPhi = 0; | |
138 | fDeltTh = 0; | |
139 | fDeltPhi = 0; | |
140 | fLabels = 0; | |
141 | fLabelsL2 = 0; | |
142 | } | |
143 | fNsingle = m.fNsingle; | |
144 | if(fNsingle>0){ | |
145 | fThsingle = new Double_t[fNsingle]; | |
146 | fPhisingle = new Double_t[fNsingle]; | |
147 | } | |
148 | else { | |
149 | fThsingle = 0; | |
150 | fPhisingle = 0; | |
151 | } | |
152 | if(m.fTh)memcpy(fTh,m.fTh,fNtracks*sizeof(Double_t)); | |
153 | if(m.fPhi)memcpy(fPhi,m.fPhi,fNtracks*sizeof(Double_t)); | |
154 | if(m.fDeltTh)memcpy(fDeltTh,m.fDeltTh,fNtracks*sizeof(Double_t)); | |
155 | if(m.fDeltPhi)memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Double_t)); | |
156 | if(m.fLabels)memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t)); | |
157 | if(m.fLabelsL2)memcpy(fLabelsL2,m.fLabelsL2,fNtracks*sizeof(Int_t)); | |
158 | if(m.fThsingle)memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Double_t)); | |
159 | if(m.fPhisingle)memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Double_t)); | |
160 | ||
161 | fFiredChips[0] = m.fFiredChips[0]; | |
162 | fFiredChips[1] = m.fFiredChips[1]; | |
163 | ||
164 | fFastOrFiredChips = m.fFastOrFiredChips; | |
165 | } | |
166 | ||
167 | //______________________________________________________________________ | |
168 | AliMultiplicity::~AliMultiplicity(){ | |
169 | // Destructor | |
170 | if(fTh)delete [] fTh;fTh = 0; | |
171 | if(fPhi)delete [] fPhi;fPhi = 0; | |
172 | if(fDeltTh)delete [] fDeltTh;fDeltTh = 0; | |
173 | if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; | |
174 | if(fLabels)delete [] fLabels;fLabels = 0; | |
175 | if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0; | |
176 | if(fThsingle)delete [] fThsingle;fThsingle = 0; | |
177 | if(fPhisingle)delete [] fPhisingle;fPhisingle = 0; | |
178 | ||
179 | } |