]>
Commit | Line | Data |
---|---|---|
2f4cac02 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 notifce * | |
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 | //////////////////////////////////////////////////// | |
17 | // | |
18 | // \file AliPhJTrackList.cxx | |
19 | // \brief | |
20 | // \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla) | |
21 | // \email: djkim@jyu.fi | |
22 | // \version $Revision: 1.4 $ | |
23 | // \date $Date: 2008/05/08 13:44:46 $ | |
24 | // | |
25 | // Class contains a list (TClonesArray) of tracks | |
26 | ///////////////////////////////////////////////////// | |
27 | ||
28 | // $Id: AliPhJTrackList.cxx,v 1.4 2008/05/08 13:44:46 djkim Exp $ | |
29 | ||
30 | #include "AliJTrack.h" | |
31 | #include "AliPhJTrackList.h" | |
32 | ||
33 | using namespace std; | |
34 | ||
35 | ClassImp(AliPhJTrackList) | |
36 | ||
37 | #define kNumTracks 1500 | |
38 | ||
39 | //______________________________________________________________________________ | |
40 | ||
41 | AliPhJTrackList::AliPhJTrackList(expName exp):fTrackList(0x0),fTracks(0){ | |
42 | //constructor | |
43 | switch (exp){ | |
44 | case kPHENIX: | |
45 | break; | |
46 | case kALICE: | |
47 | fTrackList = new TClonesArray("AliJTrack",kNumTracks); | |
48 | break; | |
49 | } | |
50 | } | |
51 | ||
52 | //______________________________________________________________________________ | |
53 | ||
54 | AliPhJTrackList::AliPhJTrackList():fTrackList(0x0),fTracks(0){ | |
55 | //constructor | |
56 | fTrackList = new TClonesArray("AliJTrack",kNumTracks); | |
57 | } | |
58 | ||
59 | //______________________________________________________________________________ | |
60 | ||
61 | AliPhJTrackList::AliPhJTrackList(const AliPhJTrackList& a): | |
62 | TObject(a), | |
63 | fTrackList(new TClonesArray(*a.fTrackList)), | |
64 | fTracks(a.fTracks) | |
65 | { | |
66 | //copy constructor | |
67 | } | |
68 | ||
69 | //______________________________________________________________________________ | |
70 | ||
71 | ||
72 | AliPhJTrackList::~AliPhJTrackList(){ | |
73 | //destructor | |
74 | fTrackList->Clear(); | |
75 | delete fTrackList; | |
76 | } | |
77 | ||
78 | //______________________________________________________________________________ | |
79 | ||
80 | void AliPhJTrackList::Reset(){ | |
81 | //reset list | |
82 | fTrackList->Clear(); | |
83 | if(fTracks>kNumTracks){ | |
84 | fTrackList->Expand(kNumTracks); | |
85 | } | |
86 | fTracks = 0; | |
87 | } | |
88 | ||
89 | //______________________________________________________________________________ | |
90 | ||
91 | int AliPhJTrackList::SetTClonesArraySize(const unsigned int ntrk){ | |
92 | //set list size | |
93 | if(ntrk>kNumTracks){ | |
94 | fTrackList->Expand(kNumTracks); | |
95 | } | |
96 | return ntrk; | |
97 | } | |
98 | ||
99 | //______________________________________________________________________________ | |
100 | ||
101 | void AliPhJTrackList::AddAliJTrack(const unsigned int itrk){ | |
102 | //add a new track to the list | |
103 | new((*fTrackList)[itrk]) AliJTrack(); | |
104 | } | |
105 | ||
106 | //______________________________________________________________________________ | |
107 | ||
108 | AliPhJBaseTrack* AliPhJTrackList::GetTrack(const unsigned int itrk){ | |
109 | //retrieve a track from the list | |
110 | return (AliPhJBaseTrack*)fTrackList->UncheckedAt(itrk); | |
111 | } | |
112 | ||
113 | //______________________________________________________________________________ | |
114 | ||
115 | AliJTrack* AliPhJTrackList::GetAliJTrack(const unsigned int itrk){ | |
116 | // ALICE getter | |
117 | return (AliJTrack*)fTrackList->UncheckedAt(itrk); | |
118 | } | |
119 | ||
120 | ||
121 | //______________________________________________________________________________ | |
122 | ||
123 | AliPhJTrackList& AliPhJTrackList::operator=(const AliPhJTrackList& list){ | |
124 | //operator= | |
125 | if(this != &list){ | |
126 | TObject::operator=(list); | |
127 | fTrackList = list.fTrackList; | |
128 | fTracks = list.fTracks; | |
129 | } | |
130 | ||
131 | return *this; | |
132 | } | |
133 |