New probability distributions
[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),
10 fTh(0),
11 fPhi(0),
968e8539 12 fDeltPhi(0),
59ea252e 13 fLabels(0),
968e8539 14 fNsingle(0),
15 fThsingle(0),
16 fPhisingle(0)
fe12e09c 17
18{
32e449be 19 // Default Constructor
32e449be 20}
21
22//______________________________________________________________________
59ea252e 23AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *t, Float_t *ph, Float_t *df, Int_t *labels, Int_t ns, Float_t *ts, Float_t *ps):
fe12e09c 24 TObject(),
25 fNtracks(ntr),
26 fTh(0),
27 fPhi(0),
968e8539 28 fDeltPhi(0),
59ea252e 29 fLabels(0),
968e8539 30 fNsingle(ns),
31 fThsingle(0),
32 fPhisingle(0)
fe12e09c 33{
32e449be 34// Standard constructor
32e449be 35 if(ntr>0){
36 fTh = new Float_t [ntr];
37 fPhi = new Float_t [ntr];
38 fDeltPhi = new Float_t [ntr];
59ea252e 39 fLabels = new Int_t[ntr];
32e449be 40 for(Int_t i=0;i<fNtracks;i++){
41 fTh[i]=t[i];
42 fPhi[i]=ph[i];
43 fDeltPhi[i]=df[i];
59ea252e 44 fLabels[i] = labels[i];
32e449be 45 }
46 }
968e8539 47 if(ns>0){
48 fThsingle = new Float_t [ns];
49 fPhisingle = new Float_t [ns];
50 for(Int_t i=0;i<fNsingle;i++){
51 fThsingle[i]=ts[i];
52 fPhisingle[i]=ps[i];
53 }
54 }
32e449be 55}
56
57//______________________________________________________________________
fe12e09c 58AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
59 TObject(m),
60 fNtracks(m.fNtracks),
61 fTh(0),
62 fPhi(0),
968e8539 63 fDeltPhi(0),
59ea252e 64 fLabels(0),
968e8539 65 fNsingle(m.fNsingle),
66 fThsingle(0),
67 fPhisingle(0)
fe12e09c 68{
32e449be 69 // copy constructor
70
71 Duplicate(m);
72
73}
74
75//______________________________________________________________________
76AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){
77 // assignment operator
78 if(this == &m)return *this;
79 ((TObject *)this)->operator=(m);
80
81 if (fTh)delete [] fTh;
82 if(fPhi)delete [] fPhi;
83 if(fDeltPhi)delete [] fDeltPhi;
59ea252e 84 if(fLabels)delete [] fLabels;
968e8539 85 if(fThsingle)delete [] fThsingle;
86 if(fPhisingle)delete [] fPhisingle;
32e449be 87 Duplicate(m);
88
89 return *this;
90}
91
92//______________________________________________________________________
93void AliMultiplicity::Duplicate(const AliMultiplicity& m){
94 // used by copy constructor and assignment operator
95 fNtracks = m.fNtracks;
96 if(fNtracks>0){
97 fTh = new Float_t [fNtracks];
98 fPhi = new Float_t [fNtracks];
99 fDeltPhi = new Float_t [fNtracks];
59ea252e 100 fLabels = new Int_t[fNtracks];
32e449be 101 }
102 else {
103 fTh = 0;
104 fPhi = 0;
105 fDeltPhi = 0;
59ea252e 106 fLabels = 0;
32e449be 107 }
968e8539 108 fNsingle = m.fNsingle;
109 if(fNsingle>0){
110 fThsingle = new Float_t [fNsingle];
111 fPhisingle = new Float_t [fNsingle];
112 }
113 else {
114 fThsingle = 0;
115 fPhisingle = 0;
116 }
32e449be 117 memcpy(fTh,m.fTh,fNtracks*sizeof(Float_t));
118 memcpy(fPhi,m.fPhi,fNtracks*sizeof(Float_t));
119 memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Float_t));
59ea252e 120 memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t));
968e8539 121 memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Float_t));
122 memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Float_t));
32e449be 123}
124
125//______________________________________________________________________
126AliMultiplicity::~AliMultiplicity(){
127 // Destructor
128 if (fTh)delete [] fTh;
129 if(fPhi)delete [] fPhi;
130 if(fDeltPhi)delete [] fDeltPhi;
59ea252e 131 if(fLabels)delete [] fLabels;
968e8539 132 if(fThsingle)delete [] fThsingle;
133 if(fPhisingle)delete [] fPhisingle;
32e449be 134}
135
136