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