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