]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONClusterInfo.cxx
New classes for residual studies (Philippe P.
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterInfo.cxx
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
33 ClassImp(AliMUONClusterInfo)
34 /// \endcond
35
36 //_____________________________________________________________________________
37 AliMUONClusterInfo::AliMUONClusterInfo()
38 : TObject(),
39   fEventId(0),
40   fZ(0.),
41   fClusterId(0),
42   fClusterX(0.),
43   fClusterY(0.),
44   fClusterXErr(0.),
45   fClusterYErr(0.),
46   fClusterChi2(0.),
47   fClusterCharge(0.),
48   fTrackId(0),
49   fTrackX(0.),
50   fTrackY(0.),
51   fTrackThetaX(0.),
52   fTrackThetaY(0.),
53   fTrackP(0.),
54   fTrackXErr(0.),
55   fTrackYErr(0.),
56   fTrackChi2(0.),
57   fTrackCharge(0),
58   fNPads(0),
59   fPads(new TClonesArray("AliMUONPadInfo",10))
60 {
61   /// default constructor
62 }
63
64 //_____________________________________________________________________________
65 AliMUONClusterInfo::AliMUONClusterInfo (const AliMUONClusterInfo& clusterInfo)
66 : TObject(clusterInfo),
67   fEventId(clusterInfo.fEventId),
68   fZ(clusterInfo.fZ),
69   fClusterId(clusterInfo.fClusterId),
70   fClusterX(clusterInfo.fClusterX),
71   fClusterY(clusterInfo.fClusterY),
72   fClusterXErr(clusterInfo.fClusterXErr),
73   fClusterYErr(clusterInfo.fClusterYErr),
74   fClusterChi2(clusterInfo.fClusterChi2),
75   fClusterCharge(clusterInfo.fClusterCharge),
76   fTrackId(clusterInfo.fTrackId),
77   fTrackX(clusterInfo.fTrackX),
78   fTrackY(clusterInfo.fTrackY),
79   fTrackThetaX(clusterInfo.fTrackThetaX),
80   fTrackThetaY(clusterInfo.fTrackThetaY),
81   fTrackP(clusterInfo.fTrackP),
82   fTrackXErr(clusterInfo.fTrackXErr),
83   fTrackYErr(clusterInfo.fTrackYErr),
84   fTrackChi2(clusterInfo.fTrackChi2),
85   fTrackCharge(clusterInfo.fTrackCharge),
86   fNPads(clusterInfo.fNPads),
87   fPads(new TClonesArray("AliMUONPadInfo",clusterInfo.fNPads))
88 {
89   /// Copy constructor
90   AliMUONPadInfo *pad = (AliMUONPadInfo*) clusterInfo.fPads->First();
91   while (pad) {
92     new ((*fPads)[fPads->GetEntriesFast()]) AliMUONPadInfo(*pad);
93     pad = (AliMUONPadInfo*) clusterInfo.fPads->After(pad);
94   }
95 }
96
97 //_____________________________________________________________________________
98 AliMUONClusterInfo& AliMUONClusterInfo::operator=(const AliMUONClusterInfo& clusterInfo)
99 {
100   /// Equal operator
101   if (this == &clusterInfo) return *this;
102   
103   TObject::operator=(clusterInfo); // don't forget to invoke the base class' assignment operator
104   
105   fEventId = clusterInfo.fEventId;
106   fZ = clusterInfo.fZ;
107   fClusterId = clusterInfo.fClusterId;
108   fClusterX = clusterInfo.fClusterX;
109   fClusterY = clusterInfo.fClusterY;
110   fClusterXErr = clusterInfo.fClusterXErr;
111   fClusterYErr = clusterInfo.fClusterYErr;
112   fClusterChi2 = clusterInfo.fClusterChi2;
113   fClusterCharge = clusterInfo.fClusterCharge;
114   fTrackId = clusterInfo.fTrackId;
115   fTrackX = clusterInfo.fTrackX;
116   fTrackY = clusterInfo.fTrackY;
117   fTrackThetaX = clusterInfo.fTrackThetaX;
118   fTrackThetaY = clusterInfo.fTrackThetaY;
119   fTrackP = clusterInfo.fTrackP;
120   fTrackXErr = clusterInfo.fTrackXErr;
121   fTrackYErr = clusterInfo.fTrackYErr;
122   fTrackChi2 = clusterInfo.fTrackChi2;
123   fTrackCharge = clusterInfo.fTrackCharge;
124   fNPads = clusterInfo.fNPads;
125   
126   fPads->Clear("C");
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   return *this;
134 }
135
136 //__________________________________________________________________________
137 AliMUONClusterInfo::~AliMUONClusterInfo()
138 {
139   /// Destructor
140   delete fPads;
141 }
142
143 //__________________________________________________________________________
144 void AliMUONClusterInfo::Clear(Option_t* opt)
145 {
146   /// Clear arrays
147   fPads->Clear(opt);
148   fNPads = 0;
149 }
150
151 //_____________________________________________________________________________
152 void AliMUONClusterInfo::Print(Option_t* option) const
153 {
154   /// print cluster info content
155   /// print also pad info if option=FULL
156   
157   // global info
158   cout<<Form("eventID=%d", GetEventId())<<endl;
159   
160   // cluster info
161   cout<<Form("- clusterID=%u (ch=%d, det=%d, index=%d)",
162              GetClusterId(), GetChamberId(), GetDetElemId(), GetClusterIndex())<<endl;
163   
164   cout<<Form("    position=(%5.2f, %5.2f, %5.2f), sigma=(%8.5f, %8.5f, 0.0)",
165              GetClusterX(), GetClusterY(), GetZ(), GetClusterXErr(), GetClusterYErr())<<endl;
166   
167   cout<<Form("    charge=%5.2f, chi2=%5.2f", GetClusterCharge(), GetClusterChi2())<<endl;
168   
169   // track info
170   cout<<Form("- trackID=%u", GetTrackId())<<endl;
171   
172   cout<<Form("    position=(%5.2f, %5.2f, %5.2f), angles=(%5.2f, %5.2f), momentum=%5.2f",
173              GetTrackX(), GetTrackY(), GetZ(), GetTrackThetaX(), GetTrackThetaY(), GetTrackP())<<endl;
174   
175   cout<<Form("    sigma_XY=(%8.5f, %8.5f), charge=%d, chi2=%5.2f",
176              GetTrackXErr(), GetTrackYErr(), GetTrackCharge(), GetTrackChi2())<<endl;
177   
178   // pad info
179   if (strstr(option,"FULL")) {
180     AliMUONPadInfo *pad = (AliMUONPadInfo*) fPads->First();
181     while (pad) {
182       pad->Print("FULL");
183       pad = (AliMUONPadInfo*) fPads->After(pad);
184     }
185   }
186   
187 }
188