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