1 #include "AliCalcluster.h"
3 ClassImp(AliCalcluster) // Class implementation to enable ROOT I/O
5 AliCalcluster::AliCalcluster()
7 // Default constructer, all data is set to 0
19 ///////////////////////////////////////////////////////////////////////////
20 AliCalcluster::~AliCalcluster()
22 // Destructor to delete dynamically allocated memory
30 ///////////////////////////////////////////////////////////////////////////
31 AliCalcluster::AliCalcluster(AliCalmodule& m)
33 // Cluster constructor with module m as center.
34 // Module data is only entered for a module which contains
35 // a signal and has not been used in a cluster yet.
36 // Modules situated at a detector edge are not allowed to start a cluster.
38 Float_t pos[3]={0,0,0};
40 if ((m.GetClusteredSignal() > 0.) && (m.GetEdgeValue() == 0))
43 m.GetPosition(pos,"sph");
44 SetPosition(pos,"sph");
45 fSig=m.GetClusteredSignal();
47 fSig11=m.GetClusteredSignal();
48 fSig33=m.GetClusteredSignal();
49 fSig55=m.GetClusteredSignal();
52 m.SetClusteredSignal(0.); // mark module as used in cluster
59 SetPosition(pos,"sph");
71 ///////////////////////////////////////////////////////////////////////////
72 Int_t AliCalcluster::GetRow()
74 // Provide the row number of the cluster center
77 return fCenter->GetRow();
84 ///////////////////////////////////////////////////////////////////////////
85 Int_t AliCalcluster::GetColumn()
87 // Provide the column number of the cluster center
90 return fCenter->GetColumn();
97 ///////////////////////////////////////////////////////////////////////////
98 Float_t AliCalcluster::GetSignal(Int_t n)
100 // Provide the total signal of a module matrix of n modules around
101 // the cluster center.
102 // Example : n=9 --> total signal in the 3x3 matrix
103 // 1 --> signal of central module
104 // Note : n=0 provides the total cluster signal (Default)
108 if (n == 0) signal=fSig;
109 if (n == 1) signal=fSig11;
110 if (n == 9) signal=fSig33;
111 if (n == 25) signal=fSig55;
119 cout << " *AliCalcluster::GetSignal* Invalid argument n = " << n << endl;
123 ///////////////////////////////////////////////////////////////////////////
124 Int_t AliCalcluster::GetNmodules()
126 // Provide the number of modules in the cluster
129 ///////////////////////////////////////////////////////////////////////////
130 Float_t AliCalcluster::GetRowDispersion()
132 // Provide the normalised row dispersion of the cluster
135 return fRowdisp/fSig;
142 ///////////////////////////////////////////////////////////////////////////
143 Float_t AliCalcluster::GetColumnDispersion()
145 // Provide the normalised column dispersion of the cluster
148 return fColdisp/fSig;
155 ///////////////////////////////////////////////////////////////////////////
156 void AliCalcluster::Start(AliCalmodule& m)
158 // Reset cluster data and start with module m
159 // A module can only start a cluster when it contains
160 // a signal, has not been used in a cluster yet and is not
161 // situated at a detector edge
163 Float_t pos[3]={0,0,0};
165 if ((m.GetClusteredSignal() > 0.) && (m.GetEdgeValue() == 0))
168 m.GetPosition(pos,"sph");
169 SetPosition(pos,"sph");
172 fSig11=m.GetSignal();
173 fSig33=m.GetSignal();
174 fSig55=m.GetSignal();
177 m.SetClusteredSignal(0.); // mark module as used in cluster
182 SetPosition(pos,"sph");
192 ///////////////////////////////////////////////////////////////////////////
193 void AliCalcluster::Add(AliCalmodule& m)
195 // Add module data to the cluster
197 Float_t signal=m.GetClusteredSignal();
199 if (signal > 0.) // only add unused modules
203 Int_t drow=int(fabs(double(GetRow()-m.GetRow()))); // row distance to center
204 Int_t dcol=int(fabs(double(GetColumn()-m.GetColumn()))); // column distance to center
205 if ((drow < 2) && (dcol < 2)) fSig33+=signal;
206 if ((drow < 3) && (dcol < 3)) fSig55+=signal;
207 fRowdisp+=signal*float(drow*drow);
208 fColdisp+=signal*float(dcol*dcol);
209 m.SetClusteredSignal(0.); // mark module as used in cluster
212 ///////////////////////////////////////////////////////////////////////////
213 void AliCalcluster::AddVetoSignal(Float_t* r,TString f,Float_t s)
215 // Associate an (extrapolated) AliSignal at location r as veto to the cluster
216 // Note : The default signal value (s) is 0
220 fVetos=new TObjArray();
223 fVetos->Add(new AliSignal);
226 ((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
227 ((AliSignal*)fVetos->At(fNvetos-1))->SetSignal(s);
229 ///////////////////////////////////////////////////////////////////////////
230 Int_t AliCalcluster::GetNvetos()
232 // Provide the number of veto signals associated to the cluster
235 ///////////////////////////////////////////////////////////////////////////
236 AliSignal* AliCalcluster::GetVetoSignal(Int_t i)
238 // Provide access to the i-th veto signal of this cluster
239 // Note : The first hit corresponds to i=1
241 if (i>0 && i<=fNvetos)
243 return (AliSignal*)fVetos->At(i-1);
247 cout << " *AliCalcluster::GetVetoSignal* Signal number " << i
248 << " out of range." << endl;
249 cout << " --- First signal (if any) returned." << endl;
250 return (AliSignal*)fVetos->At(0);
253 ///////////////////////////////////////////////////////////////////////////