]>
Commit | Line | Data |
---|---|---|
21b22f32 | 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 | //------------------------------------------------------------------------- | |
19 | // AOD class to store tracklets | |
20 | // Author: Jan Fiete Grosse-Oetringhaus, CERN | |
21 | // Class created from AliMultiplicity | |
22 | //------------------------------------------------------------------------- | |
23 | ||
24 | #include "AliAODTracklets.h" | |
25 | ||
26 | ClassImp(AliAODTracklets) | |
27 | ||
28 | AliAODTracklets::AliAODTracklets() : TNamed(), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0) | |
29 | { | |
30 | // default constructor | |
31 | } | |
32 | ||
33 | AliAODTracklets::AliAODTracklets(const char* name, const char* title) : TNamed(name, title), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0) | |
34 | { | |
35 | // TNamed constructor | |
36 | } | |
37 | ||
38 | void AliAODTracklets::CreateContainer(Int_t nTracks) | |
39 | { | |
40 | // function that creates container to store tracklets | |
41 | ||
42 | DeleteContainer(); | |
43 | ||
44 | fNTracks = nTracks; | |
45 | ||
f51b5257 | 46 | if (fNTracks <= 0) { |
47 | fNTracks = 0; | |
21b22f32 | 48 | return; |
f51b5257 | 49 | } |
21b22f32 | 50 | |
d59deed5 | 51 | fTheta = new Double32_t[fNTracks]; |
52 | fPhi = new Double32_t[fNTracks]; | |
53 | fDeltaPhi = new Double32_t[fNTracks]; | |
21b22f32 | 54 | fLabels = new Int_t[fNTracks]; |
55 | } | |
56 | ||
57 | AliAODTracklets::~AliAODTracklets() | |
58 | { | |
59 | // destructor | |
60 | ||
61 | DeleteContainer(); | |
62 | } | |
63 | ||
64 | void AliAODTracklets::DeleteContainer() | |
65 | { | |
66 | // deletes allocated memory | |
67 | ||
68 | if (fTheta) | |
69 | { | |
70 | delete[] fTheta; | |
71 | fTheta = 0; | |
72 | } | |
73 | ||
74 | if (fPhi) | |
75 | { | |
76 | delete[] fPhi; | |
77 | fPhi = 0; | |
78 | } | |
79 | ||
80 | if (fDeltaPhi) | |
81 | { | |
82 | delete[] fDeltaPhi; | |
83 | fDeltaPhi = 0; | |
84 | } | |
85 | ||
86 | if (fLabels) | |
87 | { | |
88 | delete[] fLabels; | |
89 | fLabels = 0; | |
90 | } | |
91 | ||
92 | fNTracks = 0; | |
93 | } | |
94 | ||
d59deed5 | 95 | Bool_t AliAODTracklets::SetTracklet(Int_t pos, Double32_t theta, Double32_t phi, Double32_t deltaPhi, Int_t label) |
21b22f32 | 96 | { |
97 | // Sets a tracklet at the given position | |
98 | ||
99 | if (pos < 0 || pos >= fNTracks) | |
100 | return kFALSE; | |
101 | ||
102 | fTheta[pos] = theta; | |
103 | fPhi[pos] = phi; | |
104 | fDeltaPhi[pos] = deltaPhi; | |
105 | fLabels[pos] = label; | |
106 | ||
107 | return kTRUE; | |
108 | } |