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 **************************************************************************/
18 Revision 1.3 1999/11/03 14:23:17 fca
19 New version of RALICE introduced
21 Revision 1.2 1999/09/29 09:24:28 fca
22 Introduction of the Copyright and cvs Log
26 ///////////////////////////////////////////////////////////////////////////
27 // Class AliCalcluster
28 // Description of a cluster of calorimeter modules.
29 // A matrix geometry is assumed in which a cluster center
30 // is identified by (row,col) and contains sig as signal
31 // being the signal of the complete cluster.
32 // Some info about cluster topology is provided in order
33 // to enable EM or hadronic cluster identification.
35 //--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
36 //- Modified: NvE 18-jan-2000 UU-SAP Utrecht
37 ///////////////////////////////////////////////////////////////////////////
39 #include "AliCalcluster.h"
41 ClassImp(AliCalcluster) // Class implementation to enable ROOT I/O
43 AliCalcluster::AliCalcluster()
45 // Default constructer, all data is set to 0
57 ///////////////////////////////////////////////////////////////////////////
58 AliCalcluster::~AliCalcluster()
60 // Destructor to delete dynamically allocated memory
68 ///////////////////////////////////////////////////////////////////////////
69 AliCalcluster::AliCalcluster(AliCalmodule& m)
71 // Cluster constructor with module m as center.
72 // Module data is only entered for a module which contains a signal,
73 // has not been used in a cluster yet, and is not declared dead.
76 // It is advised NOT to start a cluster with modules situated at a detector edge.
77 // This feature is automatically checked when using the built-in clustering
82 if (m.GetClusteredSignal()>0. && m.GetDeadValue()==0)
87 fSig=m.GetClusteredSignal();
89 fSig11=m.GetClusteredSignal();
90 fSig33=m.GetClusteredSignal();
91 fSig55=m.GetClusteredSignal();
94 m.SetClusteredSignal(0.); // mark module as used in cluster
113 ///////////////////////////////////////////////////////////////////////////
114 Int_t AliCalcluster::GetRow()
116 // Provide the row number of the cluster center
119 return fCenter->GetRow();
126 ///////////////////////////////////////////////////////////////////////////
127 Int_t AliCalcluster::GetColumn()
129 // Provide the column number of the cluster center
132 return fCenter->GetColumn();
139 ///////////////////////////////////////////////////////////////////////////
140 Float_t AliCalcluster::GetSignal(Int_t n)
142 // Provide the total signal of a module matrix of n modules around
143 // the cluster center.
144 // Example : n=9 --> total signal in the 3x3 matrix
145 // 1 --> signal of central module
146 // Note : n=0 provides the total cluster signal (Default)
150 if (n == 0) signal=fSig;
151 if (n == 1) signal=fSig11;
152 if (n == 9) signal=fSig33;
153 if (n == 25) signal=fSig55;
161 cout << " *AliCalcluster::GetSignal* Invalid argument n = " << n << endl;
165 ///////////////////////////////////////////////////////////////////////////
166 Int_t AliCalcluster::GetNmodules()
168 // Provide the number of modules in the cluster
171 ///////////////////////////////////////////////////////////////////////////
172 Float_t AliCalcluster::GetRowDispersion()
174 // Provide the normalised row dispersion of the cluster
177 return fRowdisp/fSig;
184 ///////////////////////////////////////////////////////////////////////////
185 Float_t AliCalcluster::GetColumnDispersion()
187 // Provide the normalised column dispersion of the cluster
190 return fColdisp/fSig;
197 ///////////////////////////////////////////////////////////////////////////
198 void AliCalcluster::Start(AliCalmodule& m)
200 // Reset cluster data and start with module m.
201 // A module can only start a cluster when it contains a signal,
202 // has not been used in a cluster yet, and is not declared dead.
205 // It is advised NOT to start a cluster with modules situated at a detector edge.
206 // This feature is automatically checked when using the built-in clustering
207 // of AliCalorimeter.
211 if (m.GetClusteredSignal()>0. && m.GetDeadValue()==0)
218 fSig11=m.GetSignal();
219 fSig33=m.GetSignal();
220 fSig55=m.GetSignal();
223 m.SetClusteredSignal(0.); // mark module as used in cluster
238 ///////////////////////////////////////////////////////////////////////////
239 void AliCalcluster::Add(AliCalmodule& m)
241 // Add module data to the cluster.
242 // Dead modules are NOT added to the cluster.
244 Float_t signal=m.GetClusteredSignal();
246 if (signal>0. && m.GetDeadValue()==0) // only add unused modules
250 Int_t drow=int(fabs(double(GetRow()-m.GetRow()))); // row distance to center
251 Int_t dcol=int(fabs(double(GetColumn()-m.GetColumn()))); // column distance to center
252 if ((drow < 2) && (dcol < 2)) fSig33+=signal;
253 if ((drow < 3) && (dcol < 3)) fSig55+=signal;
254 fRowdisp+=signal*float(drow*drow);
255 fColdisp+=signal*float(dcol*dcol);
256 m.SetClusteredSignal(0.); // mark module as used in cluster
259 ///////////////////////////////////////////////////////////////////////////
260 void AliCalcluster::AddVetoSignal(Float_t* r,TString f,Float_t s)
262 // Associate an (extrapolated) AliSignal at location r as veto to the cluster.
263 // The signal value s indicates the confidence level of hit association
264 // and has to be provided by the user.
265 // Note : The default signal value (s) is 0
269 fVetos=new TObjArray();
272 fVetos->Add(new AliSignal(1));
275 ((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
276 ((AliSignal*)fVetos->At(fNvetos-1))->SetSignal(s);
278 ///////////////////////////////////////////////////////////////////////////
279 Int_t AliCalcluster::GetNvetos()
281 // Provide the number of veto signals associated to the cluster
284 ///////////////////////////////////////////////////////////////////////////
285 AliSignal* AliCalcluster::GetVetoSignal(Int_t i)
287 // Provide access to the i-th veto signal of this cluster.
288 // Note : The first hit corresponds to i=1.
290 if (i>0 && i<=fNvetos)
292 return (AliSignal*)fVetos->At(i-1);
296 cout << " *AliCalcluster::GetVetoSignal* Signal number " << i
297 << " out of range." << endl;
298 cout << " --- First signal (if any) returned." << endl;
299 return (AliSignal*)fVetos->At(0);
302 ///////////////////////////////////////////////////////////////////////////
303 Float_t AliCalcluster::GetVetoLevel()
305 // Provide the confidence level of best associated veto signal.
310 for (Int_t i=0; i<fNvetos; i++)
312 cl=((AliSignal*)fVetos->At(i))->GetSignal();
313 if (cl>clmax) clmax=cl;
318 ///////////////////////////////////////////////////////////////////////////
319 Int_t AliCalcluster::HasVetoHit(Double_t cl)
321 // Investigate if cluster has an associated veto hit with conf. level > cl.
322 // Returns 1 if there is such an associated veto hit, otherwise returns 0.
323 // Note : This function is faster than GetVetoLevel().
326 for (Int_t i=0; i<fNvetos; i++)
328 if (((AliSignal*)fVetos->At(i))->GetSignal() > cl) return 1;
333 ///////////////////////////////////////////////////////////////////////////