]>
Commit | Line | Data |
---|---|---|
c4bd737c | 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 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 | // // | |
20 | // Data structure for the TPC monitor tree branch // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | ||
25 | #include "AliMonitorDataTPC.h" | |
26 | ||
27 | ||
28 | ClassImp(AliMonitorDataTPC) | |
29 | ||
30 | ||
31 | //_____________________________________________________________________________ | |
32 | AliMonitorDataTPC::AliMonitorDataTPC() | |
33 | { | |
34 | // default constructor | |
35 | ||
36 | fPt = fEta = fPhi = NULL; | |
37 | fSize = 0; | |
38 | } | |
39 | ||
40 | //_____________________________________________________________________________ | |
41 | AliMonitorDataTPC::AliMonitorDataTPC(const AliMonitorDataTPC& data) : | |
42 | TObject(data) | |
43 | { | |
44 | Fatal("AliMonitorDataTPC", "copy constructor not implemented"); | |
45 | } | |
46 | ||
47 | //_____________________________________________________________________________ | |
48 | AliMonitorDataTPC& AliMonitorDataTPC::operator = (const AliMonitorDataTPC& | |
49 | /*data*/) | |
50 | { | |
51 | Fatal("operator =", "assignment operator not implemented"); | |
52 | return *this; | |
53 | } | |
54 | ||
55 | //_____________________________________________________________________________ | |
56 | AliMonitorDataTPC::AliMonitorDataTPC(Int_t size) | |
57 | { | |
58 | // constructor with given size | |
59 | ||
60 | fPt = new Float_t[size]; | |
61 | fEta = new Float_t[size]; | |
62 | fPhi = new Float_t[size]; | |
63 | fSize = size; | |
64 | } | |
65 | ||
66 | //_____________________________________________________________________________ | |
67 | AliMonitorDataTPC::~AliMonitorDataTPC() | |
68 | { | |
69 | // destructor: free allocated memory | |
70 | ||
71 | delete[] fPt; | |
72 | delete[] fEta; | |
73 | delete[] fPhi; | |
74 | } | |
75 | ||
76 | //_____________________________________________________________________________ | |
77 | void AliMonitorDataTPC::SetSize(Int_t size) | |
78 | { | |
79 | // set a new array size and allocate memory if necessary | |
80 | ||
81 | if (size > fSize) { | |
82 | delete[] fPt; | |
83 | delete[] fEta; | |
84 | delete[] fPhi; | |
85 | fPt = new Float_t[size]; | |
86 | fEta = new Float_t[size]; | |
87 | fPhi = new Float_t[size]; | |
88 | fSize = size; | |
89 | } | |
90 | } | |
91 | ||
92 | //_____________________________________________________________________________ | |
93 | void AliMonitorDataTPC::SetNTracks(Int_t nTracks) | |
94 | { | |
95 | // set the number of tracks | |
96 | ||
97 | SetSize(nTracks); | |
98 | fNTracks = nTracks; | |
99 | } | |
100 | ||
101 | //_____________________________________________________________________________ | |
102 | void AliMonitorDataTPC::SetData(Int_t i, Float_t pt, Float_t eta, Float_t phi) | |
103 | { | |
104 | // set the data of the i-th track | |
105 | ||
106 | if ((i < 0) || (i >= fSize)) { | |
107 | Error("SetData", "index %d out of range (0-%d)", i, fSize); | |
108 | return; | |
109 | } | |
110 | fPt[i] = pt; | |
111 | fEta[i] = eta; | |
112 | fPhi[i] = phi; | |
113 | } |