1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include "AliCalcluster.h"
22 ClassImp(AliCalcluster) // Class implementation to enable ROOT I/O
24 AliCalcluster::AliCalcluster()
26 // Default constructer, all data is set to 0
38 ///////////////////////////////////////////////////////////////////////////
39 AliCalcluster::~AliCalcluster()
41 // Destructor to delete dynamically allocated memory
49 ///////////////////////////////////////////////////////////////////////////
50 AliCalcluster::AliCalcluster(AliCalmodule& m)
52 // Cluster constructor with module m as center.
53 // Module data is only entered for a module which contains
54 // a signal and has not been used in a cluster yet.
55 // Modules situated at a detector edge are not allowed to start a cluster.
57 Float_t pos[3]={0,0,0};
59 if ((m.GetClusteredSignal() > 0.) && (m.GetEdgeValue() == 0))
62 m.GetPosition(pos,"sph");
63 SetPosition(pos,"sph");
64 fSig=m.GetClusteredSignal();
66 fSig11=m.GetClusteredSignal();
67 fSig33=m.GetClusteredSignal();
68 fSig55=m.GetClusteredSignal();
71 m.SetClusteredSignal(0.); // mark module as used in cluster
78 SetPosition(pos,"sph");
90 ///////////////////////////////////////////////////////////////////////////
91 Int_t AliCalcluster::GetRow()
93 // Provide the row number of the cluster center
96 return fCenter->GetRow();
103 ///////////////////////////////////////////////////////////////////////////
104 Int_t AliCalcluster::GetColumn()
106 // Provide the column number of the cluster center
109 return fCenter->GetColumn();
116 ///////////////////////////////////////////////////////////////////////////
117 Float_t AliCalcluster::GetSignal(Int_t n)
119 // Provide the total signal of a module matrix of n modules around
120 // the cluster center.
121 // Example : n=9 --> total signal in the 3x3 matrix
122 // 1 --> signal of central module
123 // Note : n=0 provides the total cluster signal (Default)
127 if (n == 0) signal=fSig;
128 if (n == 1) signal=fSig11;
129 if (n == 9) signal=fSig33;
130 if (n == 25) signal=fSig55;
138 cout << " *AliCalcluster::GetSignal* Invalid argument n = " << n << endl;
142 ///////////////////////////////////////////////////////////////////////////
143 Int_t AliCalcluster::GetNmodules()
145 // Provide the number of modules in the cluster
148 ///////////////////////////////////////////////////////////////////////////
149 Float_t AliCalcluster::GetRowDispersion()
151 // Provide the normalised row dispersion of the cluster
154 return fRowdisp/fSig;
161 ///////////////////////////////////////////////////////////////////////////
162 Float_t AliCalcluster::GetColumnDispersion()
164 // Provide the normalised column dispersion of the cluster
167 return fColdisp/fSig;
174 ///////////////////////////////////////////////////////////////////////////
175 void AliCalcluster::Start(AliCalmodule& m)
177 // Reset cluster data and start with module m
178 // A module can only start a cluster when it contains
179 // a signal, has not been used in a cluster yet and is not
180 // situated at a detector edge
182 Float_t pos[3]={0,0,0};
184 if ((m.GetClusteredSignal() > 0.) && (m.GetEdgeValue() == 0))
187 m.GetPosition(pos,"sph");
188 SetPosition(pos,"sph");
191 fSig11=m.GetSignal();
192 fSig33=m.GetSignal();
193 fSig55=m.GetSignal();
196 m.SetClusteredSignal(0.); // mark module as used in cluster
201 SetPosition(pos,"sph");
211 ///////////////////////////////////////////////////////////////////////////
212 void AliCalcluster::Add(AliCalmodule& m)
214 // Add module data to the cluster
216 Float_t signal=m.GetClusteredSignal();
218 if (signal > 0.) // only add unused modules
222 Int_t drow=int(fabs(double(GetRow()-m.GetRow()))); // row distance to center
223 Int_t dcol=int(fabs(double(GetColumn()-m.GetColumn()))); // column distance to center
224 if ((drow < 2) && (dcol < 2)) fSig33+=signal;
225 if ((drow < 3) && (dcol < 3)) fSig55+=signal;
226 fRowdisp+=signal*float(drow*drow);
227 fColdisp+=signal*float(dcol*dcol);
228 m.SetClusteredSignal(0.); // mark module as used in cluster
231 ///////////////////////////////////////////////////////////////////////////
232 void AliCalcluster::AddVetoSignal(Float_t* r,TString f,Float_t s)
234 // Associate an (extrapolated) AliSignal at location r as veto to the cluster
235 // Note : The default signal value (s) is 0
239 fVetos=new TObjArray();
242 fVetos->Add(new AliSignal);
245 ((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
246 ((AliSignal*)fVetos->At(fNvetos-1))->SetSignal(s);
248 ///////////////////////////////////////////////////////////////////////////
249 Int_t AliCalcluster::GetNvetos()
251 // Provide the number of veto signals associated to the cluster
254 ///////////////////////////////////////////////////////////////////////////
255 AliSignal* AliCalcluster::GetVetoSignal(Int_t i)
257 // Provide access to the i-th veto signal of this cluster
258 // Note : The first hit corresponds to i=1
260 if (i>0 && i<=fNvetos)
262 return (AliSignal*)fVetos->At(i-1);
266 cout << " *AliCalcluster::GetVetoSignal* Signal number " << i
267 << " out of range." << endl;
268 cout << " --- First signal (if any) returned." << endl;
269 return (AliSignal*)fVetos->At(0);
272 ///////////////////////////////////////////////////////////////////////////