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