changing binning
[u/mrichter/AliRoot.git] / STEER / AliMultiplicity.cxx
CommitLineData
32e449be 1#include "AliMultiplicity.h"
2
3ClassImp(AliMultiplicity)
4
5//______________________________________________________________________
fe12e09c 6AliMultiplicity::AliMultiplicity():
7 TObject(),
8 fNtracks(0),
9 fTh(0),
10 fPhi(0),
11 fDeltPhi(0)
12
13{
32e449be 14 // Default Constructor
32e449be 15}
16
17//______________________________________________________________________
fe12e09c 18AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *t, Float_t *ph, Float_t *df):
19 TObject(),
20 fNtracks(ntr),
21 fTh(0),
22 fPhi(0),
23 fDeltPhi(0)
24{
32e449be 25// Standard constructor
32e449be 26 if(ntr>0){
27 fTh = new Float_t [ntr];
28 fPhi = new Float_t [ntr];
29 fDeltPhi = new Float_t [ntr];
30 for(Int_t i=0;i<fNtracks;i++){
31 fTh[i]=t[i];
32 fPhi[i]=ph[i];
33 fDeltPhi[i]=df[i];
34 }
35 }
32e449be 36}
37
38//______________________________________________________________________
fe12e09c 39AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
40 TObject(m),
41 fNtracks(m.fNtracks),
42 fTh(0),
43 fPhi(0),
44 fDeltPhi(0)
45{
32e449be 46 // copy constructor
47
48 Duplicate(m);
49
50}
51
52//______________________________________________________________________
53AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){
54 // assignment operator
55 if(this == &m)return *this;
56 ((TObject *)this)->operator=(m);
57
58 if (fTh)delete [] fTh;
59 if(fPhi)delete [] fPhi;
60 if(fDeltPhi)delete [] fDeltPhi;
61
62 Duplicate(m);
63
64 return *this;
65}
66
67//______________________________________________________________________
68void AliMultiplicity::Duplicate(const AliMultiplicity& m){
69 // used by copy constructor and assignment operator
70 fNtracks = m.fNtracks;
71 if(fNtracks>0){
72 fTh = new Float_t [fNtracks];
73 fPhi = new Float_t [fNtracks];
74 fDeltPhi = new Float_t [fNtracks];
75 }
76 else {
77 fTh = 0;
78 fPhi = 0;
79 fDeltPhi = 0;
80 }
81 memcpy(fTh,m.fTh,fNtracks*sizeof(Float_t));
82 memcpy(fPhi,m.fPhi,fNtracks*sizeof(Float_t));
83 memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Float_t));
84}
85
86//______________________________________________________________________
87AliMultiplicity::~AliMultiplicity(){
88 // Destructor
89 if (fTh)delete [] fTh;
90 if(fPhi)delete [] fPhi;
91 if(fDeltPhi)delete [] fDeltPhi;
92}
93
94