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