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 ///////////////////////////////////////////////////////////////////////////
19 // Class AliCalcluster
20 // Description of a cluster of calorimeter modules.
21 // A matrix geometry is assumed in which a cluster center
22 // is identified by (row,col) and contains sig as signal
23 // being the signal of the complete cluster.
24 // Some info about cluster topology is provided in order
25 // to enable EM or hadronic cluster identification.
27 //--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
28 //- Modified: NvE $Date$ UU-SAP Utrecht
29 ///////////////////////////////////////////////////////////////////////////
31 #include "AliCalcluster.h"
33 ClassImp(AliCalcluster) // Class implementation to enable ROOT I/O
35 AliCalcluster::AliCalcluster()
37 // Default constructer, all data is set to 0
49 ///////////////////////////////////////////////////////////////////////////
50 AliCalcluster::~AliCalcluster()
52 // Destructor to delete dynamically allocated memory
60 ///////////////////////////////////////////////////////////////////////////
61 AliCalcluster::AliCalcluster(AliCalmodule& m)
63 // Cluster constructor with module m as center.
64 // Module data is only entered for a module which contains a signal,
65 // has not been used in a cluster yet, and is not declared dead.
68 // It is advised NOT to start a cluster with modules situated at a detector edge.
69 // This feature is automatically checked when using the built-in clustering
74 if (m.GetClusteredSignal()>0. && m.GetDeadValue()==0)
79 fSig=m.GetClusteredSignal();
81 fSig11=m.GetClusteredSignal();
82 fSig33=m.GetClusteredSignal();
83 fSig55=m.GetClusteredSignal();
86 m.SetClusteredSignal(0.); // mark module as used in cluster
105 ///////////////////////////////////////////////////////////////////////////
106 Int_t AliCalcluster::GetRow()
108 // Provide the row number of the cluster center
111 return fCenter->GetRow();
118 ///////////////////////////////////////////////////////////////////////////
119 Int_t AliCalcluster::GetColumn()
121 // Provide the column number of the cluster center
124 return fCenter->GetColumn();
131 ///////////////////////////////////////////////////////////////////////////
132 Float_t AliCalcluster::GetSignal(Int_t n)
134 // Provide the total signal of a module matrix of n modules around
135 // the cluster center.
136 // Example : n=9 --> total signal in the 3x3 matrix
137 // 1 --> signal of central module
138 // Note : n=0 provides the total cluster signal (Default)
142 if (n == 0) signal=fSig;
143 if (n == 1) signal=fSig11;
144 if (n == 9) signal=fSig33;
145 if (n == 25) signal=fSig55;
153 cout << " *AliCalcluster::GetSignal* Invalid argument n = " << n << endl;
157 ///////////////////////////////////////////////////////////////////////////
158 Int_t AliCalcluster::GetNmodules()
160 // Provide the number of modules in the cluster
163 ///////////////////////////////////////////////////////////////////////////
164 Float_t AliCalcluster::GetRowDispersion()
166 // Provide the normalised row dispersion of the cluster
169 return fRowdisp/fSig;
176 ///////////////////////////////////////////////////////////////////////////
177 Float_t AliCalcluster::GetColumnDispersion()
179 // Provide the normalised column dispersion of the cluster
182 return fColdisp/fSig;
189 ///////////////////////////////////////////////////////////////////////////
190 void AliCalcluster::Start(AliCalmodule& m)
192 // Reset cluster data and start with module m.
193 // A module can only start a cluster when it contains a signal,
194 // has not been used in a cluster yet, and is not declared dead.
197 // It is advised NOT to start a cluster with modules situated at a detector edge.
198 // This feature is automatically checked when using the built-in clustering
199 // of AliCalorimeter.
203 if (m.GetClusteredSignal()>0. && m.GetDeadValue()==0)
210 fSig11=m.GetSignal();
211 fSig33=m.GetSignal();
212 fSig55=m.GetSignal();
215 m.SetClusteredSignal(0.); // mark module as used in cluster
230 ///////////////////////////////////////////////////////////////////////////
231 void AliCalcluster::Add(AliCalmodule& m)
233 // Add module data to the cluster.
234 // Dead modules are NOT added to the cluster.
236 Float_t signal=m.GetClusteredSignal();
238 if (signal>0. && m.GetDeadValue()==0) // only add unused modules
242 Int_t drow=int(fabs(double(GetRow()-m.GetRow()))); // row distance to center
243 Int_t dcol=int(fabs(double(GetColumn()-m.GetColumn()))); // column distance to center
244 if ((drow < 2) && (dcol < 2)) fSig33+=signal;
245 if ((drow < 3) && (dcol < 3)) fSig55+=signal;
246 fRowdisp+=signal*float(drow*drow);
247 fColdisp+=signal*float(dcol*dcol);
248 m.SetClusteredSignal(0.); // mark module as used in cluster
251 ///////////////////////////////////////////////////////////////////////////
252 void AliCalcluster::AddVetoSignal(Float_t* r,TString f,Float_t s)
254 // Associate an (extrapolated) AliSignal at location r as veto to the cluster.
255 // The signal value s indicates the confidence level of hit association
256 // and has to be provided by the user.
257 // Note : The default signal value (s) is 0
261 fVetos=new TObjArray();
264 fVetos->Add(new AliSignal(1));
267 ((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
268 ((AliSignal*)fVetos->At(fNvetos-1))->SetSignal(s);
270 ///////////////////////////////////////////////////////////////////////////
271 Int_t AliCalcluster::GetNvetos()
273 // Provide the number of veto signals associated to the cluster
276 ///////////////////////////////////////////////////////////////////////////
277 AliSignal* AliCalcluster::GetVetoSignal(Int_t i)
279 // Provide access to the i-th veto signal of this cluster.
280 // Note : The first hit corresponds to i=1.
282 if (i>0 && i<=fNvetos)
284 return (AliSignal*)fVetos->At(i-1);
288 cout << " *AliCalcluster::GetVetoSignal* Signal number " << i
289 << " out of range." << endl;
290 cout << " --- First signal (if any) returned." << endl;
291 return (AliSignal*)fVetos->At(0);
294 ///////////////////////////////////////////////////////////////////////////
295 Float_t AliCalcluster::GetVetoLevel()
297 // Provide the confidence level of best associated veto signal.
302 for (Int_t i=0; i<fNvetos; i++)
304 cl=((AliSignal*)fVetos->At(i))->GetSignal();
305 if (cl>clmax) clmax=cl;
310 ///////////////////////////////////////////////////////////////////////////
311 Int_t AliCalcluster::HasVetoHit(Double_t cl)
313 // Investigate if cluster has an associated veto hit with conf. level > cl.
314 // Returns 1 if there is such an associated veto hit, otherwise returns 0.
315 // Note : This function is faster than GetVetoLevel().
318 for (Int_t i=0; i<fNvetos; i++)
320 if (((AliSignal*)fVetos->At(i))->GetSignal() > cl) return 1;
325 ///////////////////////////////////////////////////////////////////////////