]>
Commit | Line | Data |
---|---|---|
9e44b53d | 1 | #include <string.h> |
32e449be | 2 | #include "AliMultiplicity.h" |
d325d83f | 3 | #include "AliLog.h" |
32e449be | 4 | |
5 | ClassImp(AliMultiplicity) | |
6 | ||
7 | //______________________________________________________________________ | |
fe12e09c | 8 | AliMultiplicity::AliMultiplicity(): |
9 | TObject(), | |
10 | fNtracks(0), | |
cd888a89 | 11 | fNsingle(0), |
12 | fLabels(0), | |
0939e22a | 13 | fLabelsL2(0), |
fe12e09c | 14 | fTh(0), |
15 | fPhi(0), | |
fa9ed8e9 | 16 | fDeltTh(0), |
968e8539 | 17 | fDeltPhi(0), |
968e8539 | 18 | fThsingle(0), |
ff44c37c | 19 | fPhisingle(0), |
adc4b00f | 20 | fFastOrFiredChips(1200), |
ab37e14c | 21 | fClusterFiredChips(1200) |
fe12e09c | 22 | { |
32e449be | 23 | // Default Constructor |
ab37e14c | 24 | fFiredChips[0] = 0; |
25 | fFiredChips[1] = 0; | |
d325d83f | 26 | for(Int_t ilayer = 0; ilayer < 6; ilayer++)fITSClusters[ilayer] = 0; |
32e449be | 27 | } |
28 | ||
29 | //______________________________________________________________________ | |
adc4b00f | 30 | 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, const TBits & fFastOr): |
fe12e09c | 31 | TObject(), |
32 | fNtracks(ntr), | |
cd888a89 | 33 | fNsingle(ns), |
34 | fLabels(0), | |
0939e22a | 35 | fLabelsL2(0), |
fe12e09c | 36 | fTh(0), |
37 | fPhi(0), | |
fa9ed8e9 | 38 | fDeltTh(0), |
968e8539 | 39 | fDeltPhi(0), |
968e8539 | 40 | fThsingle(0), |
ff44c37c | 41 | fPhisingle(0), |
adc4b00f | 42 | fFastOrFiredChips(1200), |
ab37e14c | 43 | fClusterFiredChips(1200) |
fe12e09c | 44 | { |
32e449be | 45 | // Standard constructor |
32e449be | 46 | if(ntr>0){ |
59ea252e | 47 | fLabels = new Int_t[ntr]; |
0939e22a | 48 | fLabelsL2 = new Int_t[ntr]; |
cd888a89 | 49 | fTh = new Double_t [ntr]; |
50 | fPhi = new Double_t [ntr]; | |
fa9ed8e9 | 51 | fDeltTh = new Double_t [ntr]; |
cd888a89 | 52 | fDeltPhi = new Double_t [ntr]; |
32e449be | 53 | for(Int_t i=0;i<fNtracks;i++){ |
fa9ed8e9 | 54 | fTh[i]=th[i]; |
32e449be | 55 | fPhi[i]=ph[i]; |
fa9ed8e9 | 56 | fDeltTh[i]=dth[i]; |
57 | fDeltPhi[i]=dph[i]; | |
59ea252e | 58 | fLabels[i] = labels[i]; |
0939e22a | 59 | fLabelsL2[i] = labelsL2[i]; |
32e449be | 60 | } |
61 | } | |
968e8539 | 62 | if(ns>0){ |
cd888a89 | 63 | fThsingle = new Double_t [ns]; |
64 | fPhisingle = new Double_t [ns]; | |
968e8539 | 65 | for(Int_t i=0;i<fNsingle;i++){ |
66 | fThsingle[i]=ts[i]; | |
67 | fPhisingle[i]=ps[i]; | |
68 | } | |
69 | } | |
ab37e14c | 70 | fFiredChips[0] = nfcL1; |
71 | fFiredChips[1] = nfcL2; | |
ff44c37c | 72 | fFastOrFiredChips = fFastOr; |
d325d83f | 73 | for(Int_t ilayer = 0; ilayer < 6; ilayer++)fITSClusters[ilayer] = 0; |
32e449be | 74 | } |
75 | ||
76 | //______________________________________________________________________ | |
fe12e09c | 77 | AliMultiplicity::AliMultiplicity(const AliMultiplicity& m): |
78 | TObject(m), | |
79 | fNtracks(m.fNtracks), | |
cd888a89 | 80 | fNsingle(m.fNsingle), |
81 | fLabels(0), | |
0939e22a | 82 | fLabelsL2(0), |
fe12e09c | 83 | fTh(0), |
84 | fPhi(0), | |
fa9ed8e9 | 85 | fDeltTh(0), |
968e8539 | 86 | fDeltPhi(0), |
968e8539 | 87 | fThsingle(0), |
ff44c37c | 88 | fPhisingle(0), |
adc4b00f | 89 | fFastOrFiredChips(1200), |
ab37e14c | 90 | fClusterFiredChips(1200) |
fe12e09c | 91 | { |
32e449be | 92 | // copy constructor |
32e449be | 93 | Duplicate(m); |
32e449be | 94 | } |
95 | ||
96 | //______________________________________________________________________ | |
97 | AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){ | |
98 | // assignment operator | |
99 | if(this == &m)return *this; | |
100 | ((TObject *)this)->operator=(m); | |
101 | ||
316c6cd9 | 102 | if(fTh)delete [] fTh;fTh = 0; |
103 | if(fPhi)delete [] fPhi;fPhi = 0; | |
fa9ed8e9 | 104 | if(fDeltTh)delete [] fDeltTh;fDeltTh= 0; |
316c6cd9 | 105 | if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; |
106 | if(fLabels)delete [] fLabels;fLabels = 0; | |
0939e22a | 107 | if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0; |
316c6cd9 | 108 | if(fThsingle)delete [] fThsingle;fThsingle = 0; |
109 | if(fPhisingle)delete [] fPhisingle;fPhisingle = 0; | |
32e449be | 110 | Duplicate(m); |
111 | ||
112 | return *this; | |
113 | } | |
114 | ||
732a24fe | 115 | void AliMultiplicity::Copy(TObject &obj) const { |
116 | ||
117 | // this overwrites the virtual TOBject::Copy() | |
118 | // to allow run time copying without casting | |
119 | // in AliESDEvent | |
120 | ||
121 | if(this==&obj)return; | |
122 | AliMultiplicity *robj = dynamic_cast<AliMultiplicity*>(&obj); | |
123 | if(!robj)return; // not an AliMultiplicity | |
124 | *robj = *this; | |
125 | ||
126 | } | |
127 | ||
128 | ||
32e449be | 129 | //______________________________________________________________________ |
130 | void AliMultiplicity::Duplicate(const AliMultiplicity& m){ | |
131 | // used by copy constructor and assignment operator | |
132 | fNtracks = m.fNtracks; | |
133 | if(fNtracks>0){ | |
cd888a89 | 134 | fTh = new Double_t[fNtracks]; |
135 | fPhi = new Double_t[fNtracks]; | |
fa9ed8e9 | 136 | fDeltTh = new Double_t[fNtracks]; |
cd888a89 | 137 | fDeltPhi = new Double_t[fNtracks]; |
59ea252e | 138 | fLabels = new Int_t[fNtracks]; |
0939e22a | 139 | fLabelsL2 = new Int_t[fNtracks]; |
32e449be | 140 | } |
141 | else { | |
142 | fTh = 0; | |
143 | fPhi = 0; | |
fa9ed8e9 | 144 | fDeltTh = 0; |
32e449be | 145 | fDeltPhi = 0; |
59ea252e | 146 | fLabels = 0; |
0939e22a | 147 | fLabelsL2 = 0; |
32e449be | 148 | } |
968e8539 | 149 | fNsingle = m.fNsingle; |
150 | if(fNsingle>0){ | |
cd888a89 | 151 | fThsingle = new Double_t[fNsingle]; |
152 | fPhisingle = new Double_t[fNsingle]; | |
968e8539 | 153 | } |
154 | else { | |
155 | fThsingle = 0; | |
156 | fPhisingle = 0; | |
157 | } | |
cd888a89 | 158 | if(m.fTh)memcpy(fTh,m.fTh,fNtracks*sizeof(Double_t)); |
159 | if(m.fPhi)memcpy(fPhi,m.fPhi,fNtracks*sizeof(Double_t)); | |
fa9ed8e9 | 160 | if(m.fDeltTh)memcpy(fDeltTh,m.fDeltTh,fNtracks*sizeof(Double_t)); |
cd888a89 | 161 | if(m.fDeltPhi)memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Double_t)); |
162 | if(m.fLabels)memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t)); | |
0939e22a | 163 | if(m.fLabelsL2)memcpy(fLabelsL2,m.fLabelsL2,fNtracks*sizeof(Int_t)); |
cd888a89 | 164 | if(m.fThsingle)memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Double_t)); |
165 | if(m.fPhisingle)memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Double_t)); | |
466ffa28 | 166 | |
ab37e14c | 167 | fFiredChips[0] = m.fFiredChips[0]; |
168 | fFiredChips[1] = m.fFiredChips[1]; | |
d325d83f | 169 | for(Int_t ilayer = 0; ilayer < 6; ilayer++){ |
170 | fITSClusters[ilayer] = m.fITSClusters[ilayer]; | |
171 | } | |
172 | ||
173 | ||
ff44c37c | 174 | |
175 | fFastOrFiredChips = m.fFastOrFiredChips; | |
ab37e14c | 176 | fClusterFiredChips = m.fClusterFiredChips; |
32e449be | 177 | } |
178 | ||
179 | //______________________________________________________________________ | |
180 | AliMultiplicity::~AliMultiplicity(){ | |
181 | // Destructor | |
316c6cd9 | 182 | if(fTh)delete [] fTh;fTh = 0; |
183 | if(fPhi)delete [] fPhi;fPhi = 0; | |
fa9ed8e9 | 184 | if(fDeltTh)delete [] fDeltTh;fDeltTh = 0; |
316c6cd9 | 185 | if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; |
186 | if(fLabels)delete [] fLabels;fLabels = 0; | |
0939e22a | 187 | if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0; |
316c6cd9 | 188 | if(fThsingle)delete [] fThsingle;fThsingle = 0; |
189 | if(fPhisingle)delete [] fPhisingle;fPhisingle = 0; | |
190 | ||
32e449be | 191 | } |
56258350 | 192 | |
193 | //______________________________________________________________________ | |
194 | void AliMultiplicity::SetLabel(Int_t i, Int_t layer, Int_t label) | |
195 | { | |
196 | if(i>=0 && i<fNtracks) { | |
197 | if (layer == 0) { | |
198 | fLabels[i] = label; | |
199 | return; | |
200 | } else if (layer == 1) { | |
201 | if (fLabelsL2) { | |
202 | fLabelsL2[i] = label; | |
203 | return; | |
204 | } | |
205 | } | |
206 | } | |
207 | Error("SetLabel","Invalid track number %d or layer %d",i,layer); | |
208 | } | |
d325d83f | 209 | |
210 | //______________________________________________________________________ | |
211 | UInt_t AliMultiplicity::GetNumberOfITSClusters(Int_t layMin, Int_t layMax) const { | |
212 | ||
213 | if(layMax < layMin) { | |
214 | AliError("layer min > layer max"); | |
215 | return 0; | |
216 | } | |
217 | if(layMin < 0) { | |
218 | AliError("layer min < 0"); | |
219 | return 0; | |
220 | } | |
221 | if(layMax < 0) { | |
222 | AliError("layer max > 0"); | |
223 | return 0; | |
224 | } | |
225 | ||
226 | Int_t sum=0; | |
227 | for (Int_t i=layMin; i<=layMax; i++) sum+=fITSClusters[i]; | |
228 | return sum; | |
229 | ||
230 | } |