]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODTracklets.cxx
Warnings suppressed
[u/mrichter/AliRoot.git] / STEER / AliAODTracklets.cxx
CommitLineData
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
26ClassImp(AliAODTracklets)
27
28AliAODTracklets::AliAODTracklets() : TNamed(), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0)
29{
30 // default constructor
31}
32
33AliAODTracklets::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
5c1dc41f 38AliAODTracklets::AliAODTracklets(const AliAODTracklets& tracklet) :
39 TNamed(tracklet),
40 fNTracks(tracklet.fNTracks),
41 fTheta(0),
42 fPhi(0),
43 fDeltaPhi(0),
44 fLabels(0)
45{
46// Copy constructor
47 fTheta = new Double32_t[fNTracks];
48 fPhi = new Double32_t[fNTracks];
49 fDeltaPhi = new Double32_t[fNTracks];
50 fLabels = new Int_t[fNTracks];
51 for (Int_t i = 0; i < fNTracks; i++) {
52 fTheta[i] = tracklet.fTheta[i];
53 fPhi[i] = tracklet.fPhi[i];
54 fDeltaPhi[i] = tracklet.fDeltaPhi[i];
55 fLabels[i] = tracklet.fLabels[i];
56 }
57}
58
59AliAODTracklets& AliAODTracklets::operator=(const AliAODTracklets& tracklet)
60{
61// Assignment operator
62 if(&tracklet == this) return *this;
63 TNamed::operator=(tracklet);
64 fNTracks = tracklet.fNTracks;
65 for (Int_t i = 0; i < fNTracks; i++) {
66 fTheta[i] = tracklet.fTheta[i];
67 fPhi[i] = tracklet.fPhi[i];
68 fDeltaPhi[i] = tracklet.fDeltaPhi[i];
69 fLabels[i] = tracklet.fLabels[i];
70 }
71}
72
21b22f32 73void AliAODTracklets::CreateContainer(Int_t nTracks)
74{
75 // function that creates container to store tracklets
76
77 DeleteContainer();
78
79 fNTracks = nTracks;
80
f51b5257 81 if (fNTracks <= 0) {
82 fNTracks = 0;
21b22f32 83 return;
f51b5257 84 }
21b22f32 85
d59deed5 86 fTheta = new Double32_t[fNTracks];
87 fPhi = new Double32_t[fNTracks];
88 fDeltaPhi = new Double32_t[fNTracks];
21b22f32 89 fLabels = new Int_t[fNTracks];
90}
91
5c1dc41f 92
21b22f32 93AliAODTracklets::~AliAODTracklets()
94{
95 // destructor
96
97 DeleteContainer();
98}
99
100void AliAODTracklets::DeleteContainer()
101{
102 // deletes allocated memory
103
104 if (fTheta)
105 {
106 delete[] fTheta;
107 fTheta = 0;
108 }
109
110 if (fPhi)
111 {
112 delete[] fPhi;
113 fPhi = 0;
114 }
115
116 if (fDeltaPhi)
117 {
118 delete[] fDeltaPhi;
119 fDeltaPhi = 0;
120 }
121
122 if (fLabels)
123 {
124 delete[] fLabels;
125 fLabels = 0;
126 }
127
128 fNTracks = 0;
129}
130
d59deed5 131Bool_t AliAODTracklets::SetTracklet(Int_t pos, Double32_t theta, Double32_t phi, Double32_t deltaPhi, Int_t label)
21b22f32 132{
133 // Sets a tracklet at the given position
134
135 if (pos < 0 || pos >= fNTracks)
136 return kFALSE;
137
138 fTheta[pos] = theta;
139 fPhi[pos] = phi;
140 fDeltaPhi[pos] = deltaPhi;
141 fLabels[pos] = label;
142
143 return kTRUE;
144}