]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEERBase/AliTOFHeader.cxx
Introduced tree caching and async reading for data (ESD and AOD) and MC. An read...
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTOFHeader.cxx
CommitLineData
f858b00e 1/**************************************************************************
2 * Copyright(c) 1998-2003, 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//-----------------------------------------------------------------
17// Implementation of the Event Time class
18// for the Event Data Summary class
19// This class contains the Event Time
20// as estimated by the TOF combinatorial algorithm
cb2442a7 21// Origin: A.De Caro, decaro@sa.infn.it
f858b00e 22//-----------------------------------------------------------------
23
24//---- standard headers ----
25#include "Riostream.h"
26//---- Root headers --------
27#include "TArrayF.h"
28#include "TArrayI.h"
29//---- AliRoot headers -----
30#include "AliTOFHeader.h"
31
32
33ClassImp(AliTOFHeader)
34
35//--------------------------------------------------------------------------
36AliTOFHeader::AliTOFHeader() :
37 TObject(),
38 fDefaultEventTimeValue(0.),
39 fDefaultEventTimeRes(0.),
40 fNbins(0),
5f9d3ebb 41 fEventTimeValues(0),
42 fEventTimeRes(0),
43 fNvalues(0),
f858b00e 44 fTOFtimeResolution(0.),
45 fT0spread(0.)
46{
47 //
48 // Default Constructor
49 //
50
51}
52
53//--------------------------------------------------------------------------
54AliTOFHeader::AliTOFHeader(Float_t defEvTime, Float_t defResEvTime,
55 Int_t nDifPbins, Float_t *times, Float_t *res,
56 Int_t *nPbin, Float_t tofTimeRes, Float_t t0spread) :
57 TObject(),
58 fDefaultEventTimeValue(defEvTime),
59 fDefaultEventTimeRes(defResEvTime),
60 fNbins(nDifPbins),
cb2442a7 61 fEventTimeValues(0),
62 fEventTimeRes(0),
63 fNvalues(0),
f858b00e 64 fTOFtimeResolution(tofTimeRes),
65 fT0spread(t0spread)
66{
67 //
cb2442a7 68 // Constructor for TOF header
f858b00e 69 //
70
cb2442a7 71 if (fNbins>0) {
72 fEventTimeValues = new TArrayF(fNbins);
73 fEventTimeRes = new TArrayF(fNbins);
74 fNvalues = new TArrayI(fNbins);
75 for (Int_t ii=0; ii<fNbins; ii++) {
76 fEventTimeValues->SetAt(times[ii],ii);
77 fEventTimeRes->SetAt(res[ii],ii);
78 fNvalues->SetAt(nPbin[ii],ii);
79 }
f858b00e 80 }
81
82}
83
84//--------------------------------------------------------------------------
85AliTOFHeader::AliTOFHeader(const AliTOFHeader &source):
86 TObject(source),
87 fDefaultEventTimeValue(source.fDefaultEventTimeValue),
88 fDefaultEventTimeRes(source.fDefaultEventTimeRes),
89 fNbins(source.fNbins),
cb2442a7 90 fEventTimeValues(0),
91 fEventTimeRes(0),
92 fNvalues(0),
f858b00e 93 fTOFtimeResolution(source.fTOFtimeResolution),
94 fT0spread(source.fT0spread)
95{
96 //
97 // Copy constructor
98 //
99
cb2442a7 100 if (fNbins>0) {
101 fEventTimeValues = new TArrayF(fNbins);
102 fEventTimeRes = new TArrayF(fNbins);
103 fNvalues = new TArrayI(fNbins);
104 for(Int_t i=0;i<fNbins;i++) {
105 (*fEventTimeValues)[i]=source.fEventTimeValues->At(i);
106 (*fEventTimeRes)[i]=source.fEventTimeRes->At(i);
107 (*fNvalues)[i]=source.fNvalues->At(i);
108 }
f858b00e 109 }
110
cb2442a7 111
f858b00e 112}
113//--------------------------------------------------------------------------
114AliTOFHeader &AliTOFHeader::operator=(const AliTOFHeader &source){
115 //
116 // assignment operator
117 //
118 if(&source != this){
119 TObject::operator=(source);
120
121 fDefaultEventTimeValue=source.fDefaultEventTimeValue;
122 fDefaultEventTimeRes=source.fDefaultEventTimeRes;
123 fNbins=source.fNbins;
f858b00e 124 fTOFtimeResolution=source.fTOFtimeResolution;
125 fT0spread=source.fT0spread;
cb2442a7 126
127 if (fNbins>0) {
128 fEventTimeValues = new TArrayF(fNbins);
129 fEventTimeRes = new TArrayF(fNbins);
130 fNvalues = new TArrayI(fNbins);
131 for(Int_t i=0;i<fNbins;i++) {
132 (*fEventTimeValues)[i]=source.fEventTimeValues->At(i);
133 (*fEventTimeRes)[i]=source.fEventTimeRes->At(i);
134 (*fNvalues)[i]=source.fNvalues->At(i);
135 }
136 } else {
137 fEventTimeValues = 0;
138 fEventTimeRes = 0;
139 fNvalues = 0;
f858b00e 140 }
cb2442a7 141
f858b00e 142 }
143 return *this;
144}
145//--------------------------------------------------------------------------
146void AliTOFHeader::Copy(TObject &obj) const {
147
148 // this overwrites the virtual TOBject::Copy()
149 // to allow run time copying without casting
150 // in AliESDEvent
151
cb2442a7 152 if (this==&obj) return;
f858b00e 153 AliTOFHeader *robj = dynamic_cast<AliTOFHeader*>(&obj);
cb2442a7 154 if (!robj) return; // not an AliTOFHeader
f858b00e 155 *robj = *this;
156
157}
158
159//--------------------------------------------------------------------------
160AliTOFHeader::~AliTOFHeader()
161{
162
cb2442a7 163 fNbins = 0;
164 if (fEventTimeValues) {
165 delete fEventTimeValues;
166 fEventTimeValues=0;
167 }
168 if (fEventTimeRes) {
169 delete fEventTimeRes;
170 fEventTimeRes=0;
171 }
172 if (fNvalues) {
173 delete fNvalues;
174 fNvalues=0;
175 }
f858b00e 176
177}
178
179//--------------------------------------------------------------------------
180void AliTOFHeader::SetNbins(Int_t nbins)
181{
182 //
183 //
184 //
185
186 fNbins=nbins;
cb2442a7 187 if (!fEventTimeValues)
188 fEventTimeValues = new TArrayF(nbins);
189 else
190 fEventTimeValues->Set(nbins);
191
192 if (!fEventTimeRes)
193 fEventTimeRes = new TArrayF(nbins);
194 else
195 fEventTimeRes->Set(nbins);
196
197 if (!fNvalues)
198 fNvalues = new TArrayI(nbins);
199 else
200 fNvalues->Set(nbins);
f858b00e 201
202}
203//--------------------------------------------------------------------------
204void AliTOFHeader::SetEventTimeValues(TArrayF *arr)
205{
206 //
207 //
208 //
209
210 fNbins=arr->GetSize();
cb2442a7 211
212 if (!fEventTimeValues)
213 fEventTimeValues = new TArrayF(fNbins);
214 else
215 fEventTimeValues->Set(fNbins);
216
217 for (Int_t ii=0; ii<fNbins; ii++)
f858b00e 218 fEventTimeValues->SetAt(arr->GetAt(ii),ii);
219
220}
221//--------------------------------------------------------------------------
222void AliTOFHeader::SetEventTimeRes(TArrayF *arr)
223{
224 //
225 //
226 //
227
228 fNbins=arr->GetSize();
cb2442a7 229
230 if (!fEventTimeRes)
231 fEventTimeRes = new TArrayF(fNbins);
232 else
233 fEventTimeRes->Set(fNbins);
234
235 for (Int_t ii=0; ii<fNbins; ii++)
f858b00e 236 fEventTimeRes->SetAt(arr->GetAt(ii),ii);
237
238}
239//--------------------------------------------------------------------------
240void AliTOFHeader::SetNvalues(TArrayI *arr)
241{
242 //
243 //
244 //
245
246 fNbins=arr->GetSize();
cb2442a7 247
248 if (!fNvalues)
249 fNvalues = new TArrayI(fNbins);
250 else
251 fNvalues->Set(fNbins);
252
253 for (Int_t ii=0; ii<fNbins; ii++)
f858b00e 254 fNvalues->SetAt(arr->GetAt(ii),ii);
255
256}