]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterInfo.cxx
updated timestamps following the timestamps of the new simulation in AMANDA, adding...
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterInfo.cxx
CommitLineData
faa8d921 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/// \class AliMUONClusterInfo
20///
21/// Class to summarize ESD data at cluster
22///
23/// \author Philippe Pillot, Subatech
24//-----------------------------------------------------------------------------
25
26#include "AliMUONClusterInfo.h"
27
28#include "AliLog.h"
29
30#include <Riostream.h>
31
32/// \cond CLASSIMP
33ClassImp(AliMUONClusterInfo)
34/// \endcond
35
36//_____________________________________________________________________________
37AliMUONClusterInfo::AliMUONClusterInfo()
38: TObject(),
41c52850 39 fRunId(0),
faa8d921 40 fEventId(0),
41 fZ(0.),
42 fClusterId(0),
43 fClusterX(0.),
44 fClusterY(0.),
45 fClusterXErr(0.),
46 fClusterYErr(0.),
47 fClusterChi2(0.),
48 fClusterCharge(0.),
49 fTrackId(0),
50 fTrackX(0.),
51 fTrackY(0.),
52 fTrackThetaX(0.),
53 fTrackThetaY(0.),
54 fTrackP(0.),
55 fTrackXErr(0.),
56 fTrackYErr(0.),
57 fTrackChi2(0.),
58 fTrackCharge(0),
41c52850 59 fTrackNHits(0),
60 fTrackChamberHitMap(0),
faa8d921 61 fNPads(0),
62 fPads(new TClonesArray("AliMUONPadInfo",10))
63{
64 /// default constructor
65}
66
d5028716 67//_____________________________________________________________________________
68AliMUONClusterInfo::AliMUONClusterInfo(TRootIOCtor* /*rio*/)
69: TObject(),
70fRunId(0),
71fEventId(0),
72fZ(0.),
73fClusterId(0),
74fClusterX(0.),
75fClusterY(0.),
76fClusterXErr(0.),
77fClusterYErr(0.),
78fClusterChi2(0.),
79fClusterCharge(0.),
80fTrackId(0),
81fTrackX(0.),
82fTrackY(0.),
83fTrackThetaX(0.),
84fTrackThetaY(0.),
85fTrackP(0.),
86fTrackXErr(0.),
87fTrackYErr(0.),
88fTrackChi2(0.),
89fTrackCharge(0),
90fTrackNHits(0),
91fTrackChamberHitMap(0),
92fNPads(0),
93fPads(0x0)
94{
95 /// I/O constructor
96}
97
faa8d921 98//_____________________________________________________________________________
99AliMUONClusterInfo::AliMUONClusterInfo (const AliMUONClusterInfo& clusterInfo)
100: TObject(clusterInfo),
41c52850 101 fRunId(clusterInfo.fRunId),
faa8d921 102 fEventId(clusterInfo.fEventId),
103 fZ(clusterInfo.fZ),
104 fClusterId(clusterInfo.fClusterId),
105 fClusterX(clusterInfo.fClusterX),
106 fClusterY(clusterInfo.fClusterY),
107 fClusterXErr(clusterInfo.fClusterXErr),
108 fClusterYErr(clusterInfo.fClusterYErr),
109 fClusterChi2(clusterInfo.fClusterChi2),
110 fClusterCharge(clusterInfo.fClusterCharge),
111 fTrackId(clusterInfo.fTrackId),
112 fTrackX(clusterInfo.fTrackX),
113 fTrackY(clusterInfo.fTrackY),
114 fTrackThetaX(clusterInfo.fTrackThetaX),
115 fTrackThetaY(clusterInfo.fTrackThetaY),
116 fTrackP(clusterInfo.fTrackP),
117 fTrackXErr(clusterInfo.fTrackXErr),
118 fTrackYErr(clusterInfo.fTrackYErr),
119 fTrackChi2(clusterInfo.fTrackChi2),
120 fTrackCharge(clusterInfo.fTrackCharge),
41c52850 121 fTrackNHits(clusterInfo.fTrackNHits),
122 fTrackChamberHitMap(clusterInfo.fTrackChamberHitMap),
faa8d921 123 fNPads(clusterInfo.fNPads),
124 fPads(new TClonesArray("AliMUONPadInfo",clusterInfo.fNPads))
125{
126 /// Copy constructor
127 AliMUONPadInfo *pad = (AliMUONPadInfo*) clusterInfo.fPads->First();
128 while (pad) {
129 new ((*fPads)[fPads->GetEntriesFast()]) AliMUONPadInfo(*pad);
130 pad = (AliMUONPadInfo*) clusterInfo.fPads->After(pad);
131 }
132}
133
134//_____________________________________________________________________________
135AliMUONClusterInfo& AliMUONClusterInfo::operator=(const AliMUONClusterInfo& clusterInfo)
136{
137 /// Equal operator
138 if (this == &clusterInfo) return *this;
139
140 TObject::operator=(clusterInfo); // don't forget to invoke the base class' assignment operator
141
41c52850 142 fRunId = clusterInfo.fRunId;
faa8d921 143 fEventId = clusterInfo.fEventId;
144 fZ = clusterInfo.fZ;
145 fClusterId = clusterInfo.fClusterId;
146 fClusterX = clusterInfo.fClusterX;
147 fClusterY = clusterInfo.fClusterY;
148 fClusterXErr = clusterInfo.fClusterXErr;
149 fClusterYErr = clusterInfo.fClusterYErr;
150 fClusterChi2 = clusterInfo.fClusterChi2;
151 fClusterCharge = clusterInfo.fClusterCharge;
152 fTrackId = clusterInfo.fTrackId;
153 fTrackX = clusterInfo.fTrackX;
154 fTrackY = clusterInfo.fTrackY;
155 fTrackThetaX = clusterInfo.fTrackThetaX;
156 fTrackThetaY = clusterInfo.fTrackThetaY;
157 fTrackP = clusterInfo.fTrackP;
158 fTrackXErr = clusterInfo.fTrackXErr;
159 fTrackYErr = clusterInfo.fTrackYErr;
160 fTrackChi2 = clusterInfo.fTrackChi2;
161 fTrackCharge = clusterInfo.fTrackCharge;
41c52850 162 fTrackNHits = clusterInfo.fTrackNHits;
163 fTrackChamberHitMap = clusterInfo.fTrackChamberHitMap;
faa8d921 164 fNPads = clusterInfo.fNPads;
165
166 fPads->Clear("C");
167 AliMUONPadInfo *pad = (AliMUONPadInfo*) clusterInfo.fPads->First();
168 while (pad) {
169 new ((*fPads)[fPads->GetEntriesFast()]) AliMUONPadInfo(*pad);
170 pad = (AliMUONPadInfo*) clusterInfo.fPads->After(pad);
171 }
172
173 return *this;
174}
175
176//__________________________________________________________________________
177AliMUONClusterInfo::~AliMUONClusterInfo()
178{
179 /// Destructor
180 delete fPads;
181}
182
183//__________________________________________________________________________
184void AliMUONClusterInfo::Clear(Option_t* opt)
185{
186 /// Clear arrays
187 fPads->Clear(opt);
188 fNPads = 0;
189}
190
191//_____________________________________________________________________________
192void AliMUONClusterInfo::Print(Option_t* option) const
193{
194 /// print cluster info content
195 /// print also pad info if option=FULL
196
197 // global info
198 cout<<Form("eventID=%d", GetEventId())<<endl;
199
200 // cluster info
201 cout<<Form("- clusterID=%u (ch=%d, det=%d, index=%d)",
202 GetClusterId(), GetChamberId(), GetDetElemId(), GetClusterIndex())<<endl;
203
204 cout<<Form(" position=(%5.2f, %5.2f, %5.2f), sigma=(%8.5f, %8.5f, 0.0)",
205 GetClusterX(), GetClusterY(), GetZ(), GetClusterXErr(), GetClusterYErr())<<endl;
206
207 cout<<Form(" charge=%5.2f, chi2=%5.2f", GetClusterCharge(), GetClusterChi2())<<endl;
208
209 // track info
210 cout<<Form("- trackID=%u", GetTrackId())<<endl;
211
212 cout<<Form(" position=(%5.2f, %5.2f, %5.2f), angles=(%5.2f, %5.2f), momentum=%5.2f",
213 GetTrackX(), GetTrackY(), GetZ(), GetTrackThetaX(), GetTrackThetaY(), GetTrackP())<<endl;
214
215 cout<<Form(" sigma_XY=(%8.5f, %8.5f), charge=%d, chi2=%5.2f",
216 GetTrackXErr(), GetTrackYErr(), GetTrackCharge(), GetTrackChi2())<<endl;
217
218 // pad info
219 if (strstr(option,"FULL")) {
220 AliMUONPadInfo *pad = (AliMUONPadInfo*) fPads->First();
221 while (pad) {
222 pad->Print("FULL");
223 pad = (AliMUONPadInfo*) fPads->After(pad);
224 }
225 }
226
227}
228
41c52850 229Double_t AliMUONClusterInfo::GetClusterCharge(Int_t iPlaneType) const
230{
231 Double_t lClusterChargeC = 0.;
232 if (!fPads) {
233 lClusterChargeC = GetClusterCharge()/2.;
234 }
235 else {
236 AliMUONPadInfo *pad = (AliMUONPadInfo*) fPads->First();
237 while (pad) {
238 if (pad->GetPadPlaneType()==iPlaneType) lClusterChargeC += pad->GetPadCharge();
239 pad = (AliMUONPadInfo*) fPads->After(pad);
240 }
241 }
242 return lClusterChargeC;
243}
244
245Int_t AliMUONClusterInfo::GetNPads(Int_t iPlaneType) const
246{
247 Int_t iNPads = 0;
248
249 if (!fPads) {
250 iNPads = GetNPads();
251 }
252 else {
253 AliMUONPadInfo *pad = (AliMUONPadInfo*) fPads->First();
254 while (pad) {
255 if (pad->GetPadPlaneType()==iPlaneType) {
256 iNPads++;
257 }
258 pad = (AliMUONPadInfo*) fPads->After(pad);
259 }
260 }
261 return iNPads;
262}
263
264Int_t AliMUONClusterInfo::GetNPadsX(Int_t iPlaneType) const
265{
266 Int_t iNPadsX = 0;
267 Double_t lPadXMin = 10000.;
268 Double_t lPadXMax = -10000.;
269 Int_t nChangedMin = 0;
270 Int_t nChangedMax = 0;
271
272 if (!fPads) {
273 iNPadsX = GetNPads();
274 }
275 else {
276 AliMUONPadInfo *pad = (AliMUONPadInfo*) fPads->First();
277 while (pad) {
278 if (pad->GetPadPlaneType()==iPlaneType) {
279 if (pad->GetPadX()<lPadXMin){
280 lPadXMin = pad->GetPadX();
281 nChangedMin++;
282 }
283 if (pad->GetPadX()>lPadXMax){
284 lPadXMax = pad->GetPadX();
285 nChangedMax++;
286 }
287 }
288 pad = (AliMUONPadInfo*) fPads->After(pad);
289 }
290 iNPadsX = TMath::Max(nChangedMin+nChangedMax-1,0);
291 }
292 return iNPadsX;
293}
294
295Int_t AliMUONClusterInfo::GetNPadsY(Int_t iPlaneType) const
296{
297 Int_t iNPadsY = 0;
298 Double_t lPadYMin = 10000.;
299 Double_t lPadYMax = -10000.;
300 Int_t nChangedMin = 0;
301 Int_t nChangedMax = 0;
302
303 if (!fPads) {
304 iNPadsY = GetNPads();
305 }
306 else {
307 AliMUONPadInfo *pad = (AliMUONPadInfo*) fPads->First();
308 while (pad) {
309 if (pad->GetPadPlaneType()==iPlaneType) {
310 if (pad->GetPadY()<lPadYMin){
311 lPadYMin = pad->GetPadY();
312 nChangedMin++;
313 }
314 if (pad->GetPadY()>lPadYMax){
315 lPadYMax = pad->GetPadY();
316 nChangedMax++;
317 }
318 }
319 pad = (AliMUONPadInfo*) fPads->After(pad);
320 }
321 iNPadsY = TMath::Max(nChangedMin+nChangedMax-1,0);
322 }
323 return iNPadsY;
324}
325