]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AOD/AliAODTracklets.cxx
Adding closest IR1, i.e. VZERO-AND. For sake of reducing the false positive, in case...
[u/mrichter/AliRoot.git] / STEER / AOD / 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
0939e22a 28AliAODTracklets::AliAODTracklets() : TNamed(), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0), fLabelsL2(0)
21b22f32 29{
30 // default constructor
31}
32
0939e22a 33AliAODTracklets::AliAODTracklets(const char* name, const char* title) : TNamed(name, title), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0), fLabelsL2(0)
21b22f32 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),
0939e22a 44 fLabels(0),
45 fLabelsL2(0)
5c1dc41f 46{
47// Copy constructor
48 fTheta = new Double32_t[fNTracks];
49 fPhi = new Double32_t[fNTracks];
50 fDeltaPhi = new Double32_t[fNTracks];
51 fLabels = new Int_t[fNTracks];
0939e22a 52 fLabelsL2 = new Int_t[fNTracks];
5c1dc41f 53 for (Int_t i = 0; i < fNTracks; i++) {
54 fTheta[i] = tracklet.fTheta[i];
55 fPhi[i] = tracklet.fPhi[i];
56 fDeltaPhi[i] = tracklet.fDeltaPhi[i];
57 fLabels[i] = tracklet.fLabels[i];
0939e22a 58 fLabelsL2[i] = tracklet.fLabelsL2[i];
5c1dc41f 59 }
60}
61
62AliAODTracklets& AliAODTracklets::operator=(const AliAODTracklets& tracklet)
63{
64// Assignment operator
65 if(&tracklet == this) return *this;
66 TNamed::operator=(tracklet);
341952b8 67 if(fNTracks!=tracklet.fNTracks){
68 fNTracks = tracklet.fNTracks;
69 CreateContainer(fNTracks);
70 }
786172af 71 for (Int_t i = 0; i < fNTracks; i++) {
5c1dc41f 72 fTheta[i] = tracklet.fTheta[i];
73 fPhi[i] = tracklet.fPhi[i];
74 fDeltaPhi[i] = tracklet.fDeltaPhi[i];
75 fLabels[i] = tracklet.fLabels[i];
0939e22a 76 fLabelsL2[i] = tracklet.fLabelsL2[i];
5c1dc41f 77 }
786172af 78 return *this;
5c1dc41f 79}
80
21b22f32 81void AliAODTracklets::CreateContainer(Int_t nTracks)
82{
83 // function that creates container to store tracklets
84
85 DeleteContainer();
86
87 fNTracks = nTracks;
88
f51b5257 89 if (fNTracks <= 0) {
90 fNTracks = 0;
21b22f32 91 return;
f51b5257 92 }
21b22f32 93
d59deed5 94 fTheta = new Double32_t[fNTracks];
95 fPhi = new Double32_t[fNTracks];
96 fDeltaPhi = new Double32_t[fNTracks];
21b22f32 97 fLabels = new Int_t[fNTracks];
0939e22a 98 fLabelsL2 = new Int_t[fNTracks];
21b22f32 99}
100
5c1dc41f 101
21b22f32 102AliAODTracklets::~AliAODTracklets()
103{
104 // destructor
105
106 DeleteContainer();
107}
108
109void AliAODTracklets::DeleteContainer()
110{
111 // deletes allocated memory
112
113 if (fTheta)
114 {
115 delete[] fTheta;
116 fTheta = 0;
117 }
118
119 if (fPhi)
120 {
121 delete[] fPhi;
122 fPhi = 0;
123 }
124
125 if (fDeltaPhi)
126 {
127 delete[] fDeltaPhi;
128 fDeltaPhi = 0;
129 }
130
131 if (fLabels)
132 {
133 delete[] fLabels;
134 fLabels = 0;
135 }
136
0939e22a 137 if (fLabelsL2)
138 {
139 delete[] fLabelsL2;
140 fLabelsL2 = 0;
141 }
142
21b22f32 143 fNTracks = 0;
144}
145
0939e22a 146Bool_t AliAODTracklets::SetTracklet(Int_t pos, Double32_t theta, Double32_t phi, Double32_t deltaPhi, Int_t labelL1, Int_t labelL2)
21b22f32 147{
148 // Sets a tracklet at the given position
149
150 if (pos < 0 || pos >= fNTracks)
151 return kFALSE;
152
153 fTheta[pos] = theta;
154 fPhi[pos] = phi;
155 fDeltaPhi[pos] = deltaPhi;
0939e22a 156 fLabels[pos] = labelL1;
157 fLabelsL2[pos] = labelL2;
21b22f32 158
159 return kTRUE;
160}
0939e22a 161