AliRoot Core  3dc7879 (3dc7879)
AliAODTracklets.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
18 #include <TString.h>
19 #include "AliAODTracklets.h"
20 
21 ClassImp(AliAODTracklets)
22 
24 : AliVMultiplicity(), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0), fLabelsL2(0)
25  ,fFastOrFiredChips(),fClusterFiredChips()
26 {
27  fFiredChips[0] = fFiredChips[1] = 0;
28  for (int i=6;i--;) fITSClusters[i] = 0;
29  // default constructor
30 }
31 
32 AliAODTracklets::AliAODTracklets(const char* name, const char* title)
33 : AliVMultiplicity(name, title), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0), fLabelsL2(0)
34 , fFastOrFiredChips(),fClusterFiredChips()
35 {
37 
38  fFiredChips[0] = fFiredChips[1] = 0;
39  for (int i=6;i--;) fITSClusters[i] = 0;
40 }
41 
43  AliVMultiplicity(tracklet),
44  fNTracks(tracklet.fNTracks),
45  fTheta(0),
46  fPhi(0),
47  fDeltaPhi(0),
48  fLabels(0),
49  fLabelsL2(0),
51 {
53 
54  fTheta = new Double32_t[fNTracks];
55  fPhi = new Double32_t[fNTracks];
56  fDeltaPhi = new Double32_t[fNTracks];
57  fLabels = new Int_t[fNTracks];
58  fLabelsL2 = new Int_t[fNTracks];
59  for (Int_t i = 0; i < fNTracks; i++) {
60  fTheta[i] = tracklet.fTheta[i];
61  fPhi[i] = tracklet.fPhi[i];
62  fDeltaPhi[i] = tracklet.fDeltaPhi[i];
63  fLabels[i] = tracklet.fLabels[i];
64  fLabelsL2[i] = tracklet.fLabelsL2[i];
65  }
66  fFiredChips[0] = tracklet.fFiredChips[0];
67  fFiredChips[1] = tracklet.fFiredChips[1];
68  for (int i=6;i--;) fITSClusters[i] = tracklet.fITSClusters[i];
69 }
70 
72 {
74 
75  if(&tracklet == this) return *this;
77  if(fNTracks!=tracklet.fNTracks){
78  fNTracks = tracklet.fNTracks;
80  }
81  for (Int_t i = 0; i < fNTracks; i++) {
82  fTheta[i] = tracklet.fTheta[i];
83  fPhi[i] = tracklet.fPhi[i];
84  fDeltaPhi[i] = tracklet.fDeltaPhi[i];
85  fLabels[i] = tracklet.fLabels[i];
86  fLabelsL2[i] = tracklet.fLabelsL2[i];
87  }
88  fFiredChips[0] = tracklet.fFiredChips[0];
89  fFiredChips[1] = tracklet.fFiredChips[1];
92  for (int i=6;i--;) fITSClusters[i] = tracklet.fITSClusters[i];
93  return *this;
94 }
95 
97 {
99 
100  DeleteContainer();
101 
102  fNTracks = nTracks;
103 
104  if (fNTracks <= 0) {
105  fNTracks = 0;
106  return;
107  }
108 
109  fTheta = new Double32_t[fNTracks];
110  fPhi = new Double32_t[fNTracks];
111  fDeltaPhi = new Double32_t[fNTracks];
112  fLabels = new Int_t[fNTracks];
113  fLabelsL2 = new Int_t[fNTracks];
114 }
115 
116 
118 {
120 
121  DeleteContainer();
122 }
123 
125 {
127 
128  if (fTheta)
129  {
130  delete[] fTheta;
131  fTheta = 0;
132  }
133 
134  if (fPhi)
135  {
136  delete[] fPhi;
137  fPhi = 0;
138  }
139 
140  if (fDeltaPhi)
141  {
142  delete[] fDeltaPhi;
143  fDeltaPhi = 0;
144  }
145 
146  if (fLabels)
147  {
148  delete[] fLabels;
149  fLabels = 0;
150  }
151 
152  if (fLabelsL2)
153  {
154  delete[] fLabelsL2;
155  fLabelsL2 = 0;
156  }
157 
158  fNTracks = 0;
159 }
160 
161 Bool_t AliAODTracklets::SetTracklet(Int_t pos, Double32_t theta, Double32_t phi, Double32_t deltaPhi, Int_t labelL1, Int_t labelL2)
162 {
164 
165  if (pos < 0 || pos >= fNTracks)
166  return kFALSE;
167 
168  fTheta[pos] = theta;
169  fPhi[pos] = phi;
170  fDeltaPhi[pos] = deltaPhi;
171  fLabels[pos] = labelL1;
172  fLabelsL2[pos] = labelL2;
173 
174  return kTRUE;
175 }
176 
177 //______________________________________________________________________
178 void AliAODTracklets::Print(Option_t *opt) const
179 {
181 
182  printf("N.tracklets: %4d | ScaleDThtSin2T:%s\n",fNTracks,GetScaleDThetaBySin2T() ? "ON":"OFF");
183  TString opts = opt; opts.ToLower();
184  //
185  if (opts.Contains("t")) {
186  for (int i=0;i<fNTracks;i++) {
187  printf("T#%3d| Eta:%+5.2f Th:%+6.3f Phi:%+6.3f DPhi:%+6.3f L1:%5d L2:%5d\n",
188  i,GetEta(i),fTheta[i],fPhi[i],fDeltaPhi[i],fLabels[i],fLabelsL2[i]);
189  }
190  }
191  //
192 }
193 
194 //________________________________________________________________
195 void AliAODTracklets::SetLabel(Int_t i, Int_t layer,Int_t label)
196 {
198 
199  if (i>=0 && i<fNTracks)
200  {
201  if(layer == 0) fLabels[i] = label;
202  else fLabelsL2[i] = label;
203  }
204 }
205 
206 //________________________________________________________________
207 Int_t AliAODTracklets::GetLabel(Int_t i, Int_t layer) const
208 {
210 
211  if (i>=0 && i<fNTracks)
212  {
213  return (layer == 0) ? fLabels[i] : fLabelsL2[i];
214  }
215  else
216  Error("GetLabel","Invalid track number %d",i);
217  return -9999;
218 }
219 
220 //________________________________________________________________
221 Double_t AliAODTracklets::GetTheta(Int_t i) const
222 {
224 
225  if (i>=0 && i<fNTracks)
226  {
227  return fTheta[i];
228  }
229  else
230  Error("GetTheta","Invalid track number %d",i);
231  return -9999.;
232 }
233 
234 //________________________________________________________________
235 Double_t AliAODTracklets::GetPhi(Int_t i) const
236 {
238 
239  if (i>=0 && i<fNTracks)
240  {
241  return fPhi[i];
242  }
243  else
244  Error("GetPhi","Invalid track number %d",i);
245  return -9999.;
246 }
247 
248 //________________________________________________________________
249 Double_t AliAODTracklets::GetDeltaPhi(Int_t i) const
250 {
252 
253  if (i>=0 && i<fNTracks)
254  {
255  return fDeltaPhi[i];
256  }
257  else
258  Error("GetDeltaPhi","Invalid track number %d",i);
259  return -9999.;
260 }
Bool_t GetScaleDThetaBySin2T() const
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
AliVMultiplicity & operator=(const AliVMultiplicity &m)
Double_t GetEta(Int_t i) const
virtual void Print(Option_t *opt="") const
Double32_t * fTheta
array with theta values
Bool_t SetTracklet(Int_t pos, Double32_t theta, Double32_t phi, Double32_t deltaPhi, Int_t labelL1, Int_t labelL2)
AliAODTracklets & operator=(const AliAODTracklets &evt)
Double32_t * fDeltaPhi
array with delta phi values
UInt_t fITSClusters[6]
Number of ITS cluster per layer.
AOD class to store tracklets.
virtual Int_t GetLabel(Int_t i, Int_t layer) const
virtual void SetLabel(Int_t i, Int_t layer, Int_t label)
Double32_t * fPhi
array with phi values
Short_t fFiredChips[2]
Number of fired chips in the two SPD layers.
virtual Double_t * GetTheta() const
Int_t * fLabelsL2
array with labels of cluster in L2 used for the tracklet
virtual Double_t GetDeltaPhi(Int_t i) const
TBits fFastOrFiredChips
Map of FastOr fired chips.
void CreateContainer(Int_t nTracks)
Int_t * fLabels
array with labels of cluster in L1 used for the tracklet
virtual Double_t * GetPhi() const
virtual ~AliAODTracklets()
TBits fClusterFiredChips
Map of fired chips (= at least one cluster)