1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // AOD class to store tracklets
20 // Author: Jan Fiete Grosse-Oetringhaus, CERN
21 // Class created from AliMultiplicity
22 //-------------------------------------------------------------------------
24 #include "AliAODTracklets.h"
26 ClassImp(AliAODTracklets)
28 AliAODTracklets::AliAODTracklets() : TNamed(), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0), fLabelsL2(0)
30 // default constructor
33 AliAODTracklets::AliAODTracklets(const char* name, const char* title) : TNamed(name, title), fNTracks(0), fTheta(0), fPhi(0), fDeltaPhi(0), fLabels(0), fLabelsL2(0)
38 AliAODTracklets::AliAODTracklets(const AliAODTracklets& tracklet) :
40 fNTracks(tracklet.fNTracks),
48 fTheta = new Double32_t[fNTracks];
49 fPhi = new Double32_t[fNTracks];
50 fDeltaPhi = new Double32_t[fNTracks];
51 fLabels = new Int_t[fNTracks];
52 fLabelsL2 = new Int_t[fNTracks];
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];
58 fLabelsL2[i] = tracklet.fLabelsL2[i];
62 AliAODTracklets& AliAODTracklets::operator=(const AliAODTracklets& tracklet)
64 // Assignment operator
65 if(&tracklet == this) return *this;
66 TNamed::operator=(tracklet);
67 if(fNTracks!=tracklet.fNTracks){
68 fNTracks = tracklet.fNTracks;
69 CreateContainer(fNTracks);
71 for (Int_t i = 0; i < fNTracks; i++) {
72 fTheta[i] = tracklet.fTheta[i];
73 fPhi[i] = tracklet.fPhi[i];
74 fDeltaPhi[i] = tracklet.fDeltaPhi[i];
75 fLabels[i] = tracklet.fLabels[i];
76 fLabelsL2[i] = tracklet.fLabelsL2[i];
81 void AliAODTracklets::CreateContainer(Int_t nTracks)
83 // function that creates container to store tracklets
94 fTheta = new Double32_t[fNTracks];
95 fPhi = new Double32_t[fNTracks];
96 fDeltaPhi = new Double32_t[fNTracks];
97 fLabels = new Int_t[fNTracks];
98 fLabelsL2 = new Int_t[fNTracks];
102 AliAODTracklets::~AliAODTracklets()
109 void AliAODTracklets::DeleteContainer()
111 // deletes allocated memory
146 Bool_t AliAODTracklets::SetTracklet(Int_t pos, Double32_t theta, Double32_t phi, Double32_t deltaPhi, Int_t labelL1, Int_t labelL2)
148 // Sets a tracklet at the given position
150 if (pos < 0 || pos >= fNTracks)
155 fDeltaPhi[pos] = deltaPhi;
156 fLabels[pos] = labelL1;
157 fLabelsL2[pos] = labelL2;