]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMultiplicity.cxx
mag. field and geometry initialised from GRP
[u/mrichter/AliRoot.git] / STEER / AliMultiplicity.cxx
CommitLineData
9e44b53d 1#include <string.h>
32e449be 2#include "AliMultiplicity.h"
3
4ClassImp(AliMultiplicity)
5
6//______________________________________________________________________
fe12e09c 7AliMultiplicity::AliMultiplicity():
8 TObject(),
9 fNtracks(0),
cd888a89 10 fNsingle(0),
11 fLabels(0),
0939e22a 12 fLabelsL2(0),
fe12e09c 13 fTh(0),
14 fPhi(0),
fa9ed8e9 15 fDeltTh(0),
968e8539 16 fDeltPhi(0),
968e8539 17 fThsingle(0),
ff44c37c 18 fPhisingle(0),
19 fFastOrFiredChips(1200)
fe12e09c 20{
32e449be 21 // Default Constructor
cd888a89 22 fFiredChips[0] = 0;
23 fFiredChips[1] = 0;
32e449be 24}
25
26//______________________________________________________________________
fa9ed8e9 27AliMultiplicity::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):
fe12e09c 28 TObject(),
29 fNtracks(ntr),
cd888a89 30 fNsingle(ns),
31 fLabels(0),
0939e22a 32 fLabelsL2(0),
fe12e09c 33 fTh(0),
34 fPhi(0),
fa9ed8e9 35 fDeltTh(0),
968e8539 36 fDeltPhi(0),
968e8539 37 fThsingle(0),
ff44c37c 38 fPhisingle(0),
39 fFastOrFiredChips(1200)
fe12e09c 40{
32e449be 41// Standard constructor
32e449be 42 if(ntr>0){
59ea252e 43 fLabels = new Int_t[ntr];
0939e22a 44 fLabelsL2 = new Int_t[ntr];
cd888a89 45 fTh = new Double_t [ntr];
46 fPhi = new Double_t [ntr];
fa9ed8e9 47 fDeltTh = new Double_t [ntr];
cd888a89 48 fDeltPhi = new Double_t [ntr];
32e449be 49 for(Int_t i=0;i<fNtracks;i++){
fa9ed8e9 50 fTh[i]=th[i];
32e449be 51 fPhi[i]=ph[i];
fa9ed8e9 52 fDeltTh[i]=dth[i];
53 fDeltPhi[i]=dph[i];
59ea252e 54 fLabels[i] = labels[i];
0939e22a 55 fLabelsL2[i] = labelsL2[i];
32e449be 56 }
57 }
968e8539 58 if(ns>0){
cd888a89 59 fThsingle = new Double_t [ns];
60 fPhisingle = new Double_t [ns];
968e8539 61 for(Int_t i=0;i<fNsingle;i++){
62 fThsingle[i]=ts[i];
63 fPhisingle[i]=ps[i];
64 }
65 }
9b373e9a 66 fFiredChips[0] = nfcL1;
67 fFiredChips[1] = nfcL2;
ff44c37c 68 fFastOrFiredChips = fFastOr;
32e449be 69}
70
71//______________________________________________________________________
fe12e09c 72AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
73 TObject(m),
74 fNtracks(m.fNtracks),
cd888a89 75 fNsingle(m.fNsingle),
76 fLabels(0),
0939e22a 77 fLabelsL2(0),
fe12e09c 78 fTh(0),
79 fPhi(0),
fa9ed8e9 80 fDeltTh(0),
968e8539 81 fDeltPhi(0),
968e8539 82 fThsingle(0),
ff44c37c 83 fPhisingle(0),
84 fFastOrFiredChips(1200)
fe12e09c 85{
32e449be 86 // copy constructor
32e449be 87 Duplicate(m);
32e449be 88}
89
90//______________________________________________________________________
91AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){
92 // assignment operator
93 if(this == &m)return *this;
94 ((TObject *)this)->operator=(m);
95
316c6cd9 96 if(fTh)delete [] fTh;fTh = 0;
97 if(fPhi)delete [] fPhi;fPhi = 0;
fa9ed8e9 98 if(fDeltTh)delete [] fDeltTh;fDeltTh= 0;
316c6cd9 99 if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0;
100 if(fLabels)delete [] fLabels;fLabels = 0;
0939e22a 101 if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0;
316c6cd9 102 if(fThsingle)delete [] fThsingle;fThsingle = 0;
103 if(fPhisingle)delete [] fPhisingle;fPhisingle = 0;
32e449be 104 Duplicate(m);
105
106 return *this;
107}
108
732a24fe 109void 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
32e449be 123//______________________________________________________________________
124void AliMultiplicity::Duplicate(const AliMultiplicity& m){
125 // used by copy constructor and assignment operator
126 fNtracks = m.fNtracks;
127 if(fNtracks>0){
cd888a89 128 fTh = new Double_t[fNtracks];
129 fPhi = new Double_t[fNtracks];
fa9ed8e9 130 fDeltTh = new Double_t[fNtracks];
cd888a89 131 fDeltPhi = new Double_t[fNtracks];
59ea252e 132 fLabels = new Int_t[fNtracks];
0939e22a 133 fLabelsL2 = new Int_t[fNtracks];
32e449be 134 }
135 else {
136 fTh = 0;
137 fPhi = 0;
fa9ed8e9 138 fDeltTh = 0;
32e449be 139 fDeltPhi = 0;
59ea252e 140 fLabels = 0;
0939e22a 141 fLabelsL2 = 0;
32e449be 142 }
968e8539 143 fNsingle = m.fNsingle;
144 if(fNsingle>0){
cd888a89 145 fThsingle = new Double_t[fNsingle];
146 fPhisingle = new Double_t[fNsingle];
968e8539 147 }
148 else {
149 fThsingle = 0;
150 fPhisingle = 0;
151 }
cd888a89 152 if(m.fTh)memcpy(fTh,m.fTh,fNtracks*sizeof(Double_t));
153 if(m.fPhi)memcpy(fPhi,m.fPhi,fNtracks*sizeof(Double_t));
fa9ed8e9 154 if(m.fDeltTh)memcpy(fDeltTh,m.fDeltTh,fNtracks*sizeof(Double_t));
cd888a89 155 if(m.fDeltPhi)memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Double_t));
156 if(m.fLabels)memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t));
0939e22a 157 if(m.fLabelsL2)memcpy(fLabelsL2,m.fLabelsL2,fNtracks*sizeof(Int_t));
cd888a89 158 if(m.fThsingle)memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Double_t));
159 if(m.fPhisingle)memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Double_t));
466ffa28 160
161 fFiredChips[0] = m.fFiredChips[0];
162 fFiredChips[1] = m.fFiredChips[1];
ff44c37c 163
164 fFastOrFiredChips = m.fFastOrFiredChips;
32e449be 165}
166
167//______________________________________________________________________
168AliMultiplicity::~AliMultiplicity(){
169 // Destructor
316c6cd9 170 if(fTh)delete [] fTh;fTh = 0;
171 if(fPhi)delete [] fPhi;fPhi = 0;
fa9ed8e9 172 if(fDeltTh)delete [] fDeltTh;fDeltTh = 0;
316c6cd9 173 if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0;
174 if(fLabels)delete [] fLabels;fLabels = 0;
0939e22a 175 if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0;
316c6cd9 176 if(fThsingle)delete [] fThsingle;fThsingle = 0;
177 if(fPhisingle)delete [] fPhisingle;fPhisingle = 0;
178
32e449be 179}
56258350 180
181//______________________________________________________________________
182void AliMultiplicity::SetLabel(Int_t i, Int_t layer, Int_t label)
183{
184 if(i>=0 && i<fNtracks) {
185 if (layer == 0) {
186 fLabels[i] = label;
187 return;
188 } else if (layer == 1) {
189 if (fLabelsL2) {
190 fLabelsL2[i] = label;
191 return;
192 }
193 }
194 }
195 Error("SetLabel","Invalid track number %d or layer %d",i,layer);
196}