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