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