]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMultiplicity.cxx
HLT reconstruction is now embedded correctly into the simulation chain (Matthias)
[u/mrichter/AliRoot.git] / STEER / AliMultiplicity.cxx
1 #include <string.h>
2 #include "AliMultiplicity.h"
3
4 ClassImp(AliMultiplicity)
5
6 //______________________________________________________________________
7 AliMultiplicity::AliMultiplicity():
8   TObject(),
9   fNtracks(0),
10   fNsingle(0),
11   fLabels(0),
12   fLabelsL2(0),
13   fTh(0),
14   fPhi(0),
15   fDeltPhi(0),
16   fThsingle(0),
17   fPhisingle(0)
18 {
19   // Default Constructor
20   fFiredChips[0] = 0;
21   fFiredChips[1] = 0;
22 }
23
24 //______________________________________________________________________
25 AliMultiplicity::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, Short_t nfcL1, Short_t nfcL2):
26   TObject(),
27   fNtracks(ntr),
28   fNsingle(ns),
29   fLabels(0),
30   fLabelsL2(0),
31   fTh(0),
32   fPhi(0),
33   fDeltPhi(0),
34   fThsingle(0),
35   fPhisingle(0)
36 {
37 // Standard constructor
38   if(ntr>0){
39     fLabels = new Int_t[ntr];
40     fLabelsL2 = new Int_t[ntr];
41     fTh = new Double_t [ntr];
42     fPhi = new Double_t [ntr];
43     fDeltPhi = new Double_t [ntr];
44     for(Int_t i=0;i<fNtracks;i++){
45       fTh[i]=t[i];
46       fPhi[i]=ph[i];
47       fDeltPhi[i]=df[i];
48       fLabels[i] = labels[i];
49       fLabelsL2[i] = labelsL2[i];
50     }
51   }
52   if(ns>0){
53     fThsingle = new Double_t [ns];
54     fPhisingle = new Double_t [ns];
55     for(Int_t i=0;i<fNsingle;i++){
56       fThsingle[i]=ts[i];
57       fPhisingle[i]=ps[i];
58     }
59   }
60   fFiredChips[0] = nfcL1;
61   fFiredChips[1] = nfcL2;
62 }
63
64 //______________________________________________________________________
65 AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
66   TObject(m),
67   fNtracks(m.fNtracks),
68   fNsingle(m.fNsingle),
69   fLabels(0),
70   fLabelsL2(0),
71   fTh(0),
72   fPhi(0),
73   fDeltPhi(0),
74   fThsingle(0),
75   fPhisingle(0)
76 {
77   // copy constructor
78   Duplicate(m);
79 }
80
81 //______________________________________________________________________
82 AliMultiplicity &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;fTh = 0;
88   if(fPhi)delete [] fPhi;fPhi = 0; 
89   if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; 
90   if(fLabels)delete [] fLabels;fLabels = 0;
91   if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0;
92   if(fThsingle)delete [] fThsingle;fThsingle = 0;
93   if(fPhisingle)delete [] fPhisingle;fPhisingle = 0;
94   Duplicate(m);
95
96   return *this;
97 }
98
99 void AliMultiplicity::Copy(TObject &obj) const {
100   
101   // this overwrites the virtual TOBject::Copy()
102   // to allow run time copying without casting
103   // in AliESDEvent
104
105   if(this==&obj)return;
106   AliMultiplicity *robj = dynamic_cast<AliMultiplicity*>(&obj);
107   if(!robj)return; // not an AliMultiplicity
108   *robj = *this;
109
110 }
111
112
113 //______________________________________________________________________
114 void AliMultiplicity::Duplicate(const AliMultiplicity& m){
115   // used by copy constructor and assignment operator
116   fNtracks = m.fNtracks;
117   if(fNtracks>0){
118     fTh = new Double_t[fNtracks];
119     fPhi = new Double_t[fNtracks];
120     fDeltPhi = new Double_t[fNtracks];
121     fLabels = new Int_t[fNtracks];
122     fLabelsL2 = new Int_t[fNtracks];
123   }
124   else {
125     fTh = 0;
126     fPhi = 0;
127     fDeltPhi = 0;
128     fLabels = 0;
129     fLabelsL2 = 0;
130   }
131   fNsingle = m.fNsingle;
132   if(fNsingle>0){
133     fThsingle = new Double_t[fNsingle];
134     fPhisingle = new Double_t[fNsingle];
135   }
136   else {
137     fThsingle = 0;
138     fPhisingle = 0;
139   }
140   if(m.fTh)memcpy(fTh,m.fTh,fNtracks*sizeof(Double_t));
141   if(m.fPhi)memcpy(fPhi,m.fPhi,fNtracks*sizeof(Double_t));
142   if(m.fDeltPhi)memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Double_t));
143   if(m.fLabels)memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t));
144   if(m.fLabelsL2)memcpy(fLabelsL2,m.fLabelsL2,fNtracks*sizeof(Int_t));
145   if(m.fThsingle)memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Double_t));
146   if(m.fPhisingle)memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Double_t));
147
148   fFiredChips[0] = m.fFiredChips[0];
149   fFiredChips[1] = m.fFiredChips[1];
150 }
151
152 //______________________________________________________________________
153 AliMultiplicity::~AliMultiplicity(){
154   // Destructor
155   if(fTh)delete [] fTh;fTh = 0;
156   if(fPhi)delete [] fPhi;fPhi = 0; 
157   if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; 
158   if(fLabels)delete [] fLabels;fLabels = 0;
159   if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0;
160   if(fThsingle)delete [] fThsingle;fThsingle = 0;
161   if(fPhisingle)delete [] fPhisingle;fPhisingle = 0;
162
163 }