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