]>
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 | ||
46 | if (fNTracks <= 0) | |
47 | return; | |
48 | ||
49 | fTheta = new Float_t[fNTracks]; | |
50 | fPhi = new Float_t[fNTracks]; | |
51 | fDeltaPhi = new Float_t[fNTracks]; | |
52 | fLabels = new Int_t[fNTracks]; | |
53 | } | |
54 | ||
55 | AliAODTracklets::~AliAODTracklets() | |
56 | { | |
57 | // destructor | |
58 | ||
59 | DeleteContainer(); | |
60 | } | |
61 | ||
62 | void AliAODTracklets::DeleteContainer() | |
63 | { | |
64 | // deletes allocated memory | |
65 | ||
66 | if (fTheta) | |
67 | { | |
68 | delete[] fTheta; | |
69 | fTheta = 0; | |
70 | } | |
71 | ||
72 | if (fPhi) | |
73 | { | |
74 | delete[] fPhi; | |
75 | fPhi = 0; | |
76 | } | |
77 | ||
78 | if (fDeltaPhi) | |
79 | { | |
80 | delete[] fDeltaPhi; | |
81 | fDeltaPhi = 0; | |
82 | } | |
83 | ||
84 | if (fLabels) | |
85 | { | |
86 | delete[] fLabels; | |
87 | fLabels = 0; | |
88 | } | |
89 | ||
90 | fNTracks = 0; | |
91 | } | |
92 | ||
93 | Bool_t AliAODTracklets::SetTracklet(Int_t pos, Float_t theta, Float_t phi, Float_t deltaPhi, Int_t label) | |
94 | { | |
95 | // Sets a tracklet at the given position | |
96 | ||
97 | if (pos < 0 || pos >= fNTracks) | |
98 | return kFALSE; | |
99 | ||
100 | fTheta[pos] = theta; | |
101 | fPhi[pos] = phi; | |
102 | fDeltaPhi[pos] = deltaPhi; | |
103 | fLabels[pos] = label; | |
104 | ||
105 | return kTRUE; | |
106 | } |