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