handled completely dynamically at runtime.
Memberfunctions SetSignal() and AddSignal() of class AliCalmodule declared
virtual to enable inheritance.
09-feb-2003 NvE Class AliCalcluster derived from AliSignal to enable automatic signal setting
for various rings of modules around the cluster center.
///////////////////////////////////////////////////////////////////////////
// Class AliCalcluster
// Description of a cluster of calorimeter modules.
-// A matrix geometry is assumed in which a cluster center
-// is identified by (row,col) and contains sig as signal
-// being the signal of the complete cluster.
-// Some info about cluster topology is provided in order
+// A 2D (matrix) geometry is assumed in which a cluster center is identified
+// by two integer indices (i,j), e.g. row and column indicators.
+//
+// The 1st signal value is the signal of the complete cluster.
+// This is the signal which is provided as default by invoking GetSignal().
+//
+// In case clustering/grouping of module signals was performed over several
+// rings around the center (see e.g. AliCalorimeter::Group), the following
+// additional information is provided by the various signal values :
+//
+// The 2nd signal value is the original signal of the central module.
+// The 3rd signal value is the total signal within the 1st (i.e. 3x3) ring of
+// modules around the cluster center.
+// The 4th signal value is the total signal within the 2nd (i.e. 5x5) ring of
+// modules around the cluster center.
+// Etc....
+//
+// Note : In case the cluster consists of only 1 module, then only the
+// 1st signal value will be present (for obvious reasons).
+//
+// Some dispersion info about cluster topology is provided in order
// to enable EM or hadronic cluster identification.
//
//--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
{
// Default constructer, all data is set to 0
fCenter=0;
- fSig=0.;
fNmods=0;
- fSig11=0.;
- fSig33=0.;
- fSig55=0.;
fRowdisp=0.;
fColdisp=0.;
fNvetos=0;
fVetos=0;
+ SetName("AliCalcluster [sig, sig11, sig33, sig55, ...]");
}
///////////////////////////////////////////////////////////////////////////
AliCalcluster::~AliCalcluster()
Ali3Vector r;
- if (m.GetClusteredSignal()>0. && m.GetDeadValue()==0)
+ Float_t sig=m.GetClusteredSignal();
+
+ if (sig>0. && m.GetDeadValue()==0)
{
fCenter=&m;
r=m.GetPosition();
SetPosition(r);
- fSig=m.GetClusteredSignal();
+ SetSignal(sig);
fNmods=1;
- fSig11=m.GetClusteredSignal();
- fSig33=m.GetClusteredSignal();
- fSig55=m.GetClusteredSignal();
fRowdisp=0.;
fColdisp=0.;
m.SetClusteredSignal(0.); // mark module as used in cluster
{
fCenter=0;
SetPosition(r);
- fSig=0.;
fNmods=0;
- fSig11=0.;
- fSig33=0.;
- fSig55=0.;
fRowdisp=0.;
fColdisp=0.;
fNvetos=0;
fVetos=0;
}
+ SetName("AliCalcluster [sig, sig11, sig33, sig55, ...]");
}
///////////////////////////////////////////////////////////////////////////
Int_t AliCalcluster::GetRow()
}
}
///////////////////////////////////////////////////////////////////////////
-Float_t AliCalcluster::GetSignal(Int_t n)
-{
-// Provide the total signal of a module matrix of n modules around
-// the cluster center.
-// Example : n=9 --> total signal in the 3x3 matrix
-// 1 --> signal of central module
-// Note : n=0 provides the total cluster signal (Default)
-
- Float_t signal=-1;
-
- if (n == 0) signal=fSig;
- if (n == 1) signal=fSig11;
- if (n == 9) signal=fSig33;
- if (n == 25) signal=fSig55;
-
- if (signal > 0.)
- {
- return signal;
- }
- else
- {
- cout << " *AliCalcluster::GetSignal* Invalid argument n = " << n << endl;
- return 0;
- }
-}
-///////////////////////////////////////////////////////////////////////////
Int_t AliCalcluster::GetNmodules()
{
// Provide the number of modules in the cluster
///////////////////////////////////////////////////////////////////////////
Float_t AliCalcluster::GetRowDispersion()
{
-// Provide the normalised row dispersion of the cluster
- if (fSig > 0.)
+// Provide the normalised row dispersion of the cluster.
+ Float_t sig=GetSignal();
+ if (sig > 0.)
{
- return fRowdisp/fSig;
+ return fRowdisp/sig;
}
else
{
Float_t AliCalcluster::GetColumnDispersion()
{
// Provide the normalised column dispersion of the cluster
- if (fSig > 0.)
+ Float_t sig=GetSignal();
+ if (sig > 0.)
{
- return fColdisp/fSig;
+ return fColdisp/sig;
}
else
{
// This feature is automatically checked when using the built-in clustering
// of AliCalorimeter.
+ AliSignal::Reset();
+
Ali3Vector r;
if (m.GetClusteredSignal()>0. && m.GetDeadValue()==0)
fCenter=&m;
r=m.GetPosition();
SetPosition(r);
- fSig=m.GetSignal();
+ SetSignal(m.GetSignal());
fNmods=1;
- fSig11=m.GetSignal();
- fSig33=m.GetSignal();
- fSig55=m.GetSignal();
fRowdisp=0.;
fColdisp=0.;
m.SetClusteredSignal(0.); // mark module as used in cluster
{
fCenter=0;
SetPosition(r);
- fSig=0.;
fNmods=0;
- fSig11=0.;
- fSig33=0.;
- fSig55=0.;
fRowdisp=0.;
fColdisp=0.;
}
{
// Add module data to the cluster.
// Dead modules are NOT added to the cluster.
+// According to the distance of the module w.r.t. the cluster center
+// the various signal values are updated.
- Float_t signal=m.GetClusteredSignal();
+ if (fNmods)
+ {
+ Float_t sigm=m.GetClusteredSignal();
- if (signal>0. && m.GetDeadValue()==0) // only add unused modules
+ if (sigm>0. && m.GetDeadValue()==0) // only add unused modules
+ {
+ Int_t drow=int(fabs(double(GetRow()-m.GetRow()))); // row distance to center
+ Int_t dcol=int(fabs(double(GetColumn()-m.GetColumn()))); // column distance to center
+
+ // Determine the ring index for this module around the cluster center
+ Int_t jring=drow;
+ if (dcol>drow) jring=dcol;
+
+ Int_t nvalues=GetNvalues();
+
+ if ((jring+2)<=nvalues) // Module within existing ring(s) ==> Add module signal to the enclosing ring(s)
+ {
+ for (Int_t i=(jring+2); i<=nvalues; i++)
+ {
+ AddSignal(sigm,i);
+ }
+ }
+ else // Module outside all existing rings ==> Init. new ring signals with existing enclosed signal(s)
+ {
+ for (Int_t j=(nvalues+1); j<=(jring+2); j++)
+ {
+ SetSignal(GetSignal(j-1),j);
+ }
+ // Add current module signal to the signal value for the corresponding ring
+ AddSignal(sigm,(jring+2));
+ }
+
+ // Update total cluster signal
+ AddSignal(sigm);
+
+ fNmods+=1;
+ fRowdisp+=sigm*float(drow*drow);
+ fColdisp+=sigm*float(dcol*dcol);
+ m.SetClusteredSignal(0.); // mark module as used in cluster
+ }
+ }
+ else
{
- fSig+=signal;
- fNmods+=1;
- Int_t drow=int(fabs(double(GetRow()-m.GetRow()))); // row distance to center
- Int_t dcol=int(fabs(double(GetColumn()-m.GetColumn()))); // column distance to center
- if ((drow < 2) && (dcol < 2)) fSig33+=signal;
- if ((drow < 3) && (dcol < 3)) fSig55+=signal;
- fRowdisp+=signal*float(drow*drow);
- fColdisp+=signal*float(dcol*dcol);
- m.SetClusteredSignal(0.); // mark module as used in cluster
+ cout << " *AliCalcluster::Add* No action. Cluster should be started first."
+ << endl;
}
}
///////////////////////////////////////////////////////////////////////////
#include "Riostream.h"
#include <math.h>
-#include "TObject.h"
#include "TObjArray.h"
#include "TString.h"
#include "AliCalmodule.h"
#include "AliMath.h"
-class AliCalcluster : public TObject,public AliPosition
+class AliCalcluster : public AliSignal
{
public:
AliCalcluster(); // Default constructor, all data initialised to 0
AliCalcluster(AliCalmodule& m); // Create new cluster starting at module m
Int_t GetRow(); // Return row number of cluster center
Int_t GetColumn(); // Return column number of cluster center
- Float_t GetSignal(Int_t n=0); // Return signal of nxn matrix around the center
Int_t GetNmodules(); // Return number of modules in cluster
Float_t GetRowDispersion(); // Return normalised row dispersion of cluster
Float_t GetColumnDispersion(); // Return normalised column dispersion of cluster
protected:
AliCalmodule* fCenter; // Pointer to the central module of the cluster
- Float_t fSig; // The total signal value of the cluster
Int_t fNmods; // The number of modules in the cluster
- Float_t fSig11; // Cluster signal of the central module
- Float_t fSig33; // Cluster signal in 3x3 matrix around the center
- Float_t fSig55; // Cluster signal in 5x5 matrix around the center
Float_t fRowdisp; // Row dispersion of cluster (not normalised)
Float_t fColdisp; // Column dispersion of cluster (not normalised)
Int_t fNvetos; // The number of associated veto signals
TObjArray* fVetos; // The array of associated veto signals
- ClassDef(AliCalcluster,2) // Description of a cluster of calorimeter modules.
+ ClassDef(AliCalcluster,3) // Description of a cluster of calorimeter modules.
};
#endif
class AliCalmodule : public AliSignal
{
public:
- AliCalmodule(); // Default constructor
- ~AliCalmodule(); // Default destructor
- AliCalmodule(Int_t row,Int_t col,Float_t sig); // Create a module and initialise data
- void SetSignal(Int_t row,Int_t col,Float_t sig); // Set or change data for certain module
- void AddSignal(Int_t row,Int_t col,Float_t sig); // Add signal to a certain module
- void SetRow(Int_t i); // Set the row number of the module
- void SetColumn(Int_t i); // Set the column number of the module
- Int_t GetRow(); // Return the row number of the module
- Int_t GetColumn(); // Return the column number of the module
- void SetClusteredSignal(Float_t val); // Set the signal of the module after clustering
- Float_t GetClusteredSignal(); // Return module signal after clustering
- void SetDead(); // Set flag to indicate dead modules
- void SetAlive(); // Set flag to indicate active modules
- Int_t GetDeadValue(); // Return the value of the dead module indicator
- void SetGain(Float_t gain); // Set gain of the module's readout system
- Float_t GetGain(); // Return the gain value
+ AliCalmodule(); // Default constructor
+ ~AliCalmodule(); // Default destructor
+ AliCalmodule(Int_t row,Int_t col,Float_t sig); // Create a module and initialise data
+ virtual void SetSignal(Int_t row,Int_t col,Float_t sig); // Set or change data for certain module
+ virtual void AddSignal(Int_t row,Int_t col,Float_t sig); // Add signal to a certain module
+ void SetRow(Int_t i); // Set the row number of the module
+ void SetColumn(Int_t i); // Set the column number of the module
+ Int_t GetRow(); // Return the row number of the module
+ Int_t GetColumn(); // Return the column number of the module
+ void SetClusteredSignal(Float_t val); // Set the signal of the module after clustering
+ Float_t GetClusteredSignal(); // Return module signal after clustering
+ void SetDead(); // Set flag to indicate dead modules
+ void SetAlive(); // Set flag to indicate active modules
+ Int_t GetDeadValue(); // Return the value of the dead module indicator
+ void SetGain(Float_t gain); // Set gain of the module's readout system
+ Float_t GetGain(); // Return the gain value
protected:
Int_t fRow; // The current row number
Int_t fDead; // Flag to indicate dead module (1=dead 0=alive)
Float_t fGain; // Gain of the module's readout system
- ClassDef(AliCalmodule,1) // Description of a module in a calorimeter system.
+ ClassDef(AliCalmodule,2) // Description of a module in a calorimeter system.
};
#endif
///////////////////////////////////////////////////////////////////////////
// Class AliSignal
-// Handling of ALICE (extrapolated) signals.
+// Generic handling of (extrapolated) detector signals.
//
// Note :
// ------
// Float_t adc=s.GetSignal();
// Float_t sigma=s.GetSignalError();
//
-// AliSignal q(3); // q can store 3 signal values with their errors
+// AliSignal q(3); // q can store initially 3 signal values with their errors
// // In the example below a signal contains the
// // following data : timing, ADC and dE/dx
// q.SetName("TOF hit");
AliSignal::AliSignal(Int_t n)
{
// Creation of an AliSignal object and initialisation of parameters.
-// A total of n (default n=1) values (with errors) can be stored.
- fNvalues=n;
+// Initially a total of n (default n=1) values (with errors) can be stored.
+// If needed, the number of values (and errors) will be increased automatically
+// when entering values.
fSignal=0;
fDsignal=0;
- fName=" ";
+ fName="Unspecified";
}
///////////////////////////////////////////////////////////////////////////
AliSignal::~AliSignal()
AliSignal::AliSignal(AliSignal& s)
{
// Copy constructor
- fNvalues=s.GetNvalues();
fSignal=0;
fDsignal=0;
fName=s.GetName();
SetPosition((Ali3Vector&)s);
+ Int_t nvalues=s.GetNvalues();
Double_t sig,err;
- for (Int_t i=1; i<=fNvalues; i++)
+ for (Int_t i=1; i<=nvalues; i++)
{
sig=s.GetSignal(i);
err=s.GetSignalError(i);
void AliSignal::Reset()
{
// Reset all signal and position values and errors to 0.
-// The data arrays are also created if not already existing.
- if (!fSignal) fSignal=new TArrayF(fNvalues);
- if (!fDsignal) fDsignal=new TArrayF(fNvalues);
-
- Double_t r[3]={0,0,0};
- SetPosition(r,"sph");
- SetErrors(r,"car");
- for (Int_t i=0; i<fSignal->GetSize(); i++)
+ if (fSignal && fDsignal)
{
- fSignal->AddAt(0,i);
- fDsignal->AddAt(0,i);
+ Double_t r[3]={0,0,0};
+ SetPosition(r,"sph");
+ SetErrors(r,"car");
+ for (Int_t i=0; i<fSignal->GetSize(); i++)
+ {
+ fSignal->AddAt(0,i);
+ fDsignal->AddAt(0,i);
+ }
}
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::ResetSignals()
{
-// Reset all signal values and errors to 0.
-// The data arrays are also created if not already existing.
-
- if (!fSignal) fSignal=new TArrayF(fNvalues);
- if (!fDsignal) fDsignal=new TArrayF(fNvalues);
+// Reset all signal values and their errors to 0.
- for (Int_t i=0; i<fSignal->GetSize(); i++)
+ if (fSignal && fDsignal)
{
- fSignal->AddAt(0,i);
- fDsignal->AddAt(0,i);
+ for (Int_t i=0; i<fSignal->GetSize(); i++)
+ {
+ fSignal->AddAt(0,i);
+ fDsignal->AddAt(0,i);
+ }
}
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::ResetPosition()
{
-// Reset position and errors to 0.
+// Reset the position and corresponding errors to 0.
Double_t r[3]={0,0,0};
SetPosition(r,"sph");
SetErrors(r,"car");
{
// Store j-th (default j=1) signal value.
// Note : The first signal value is at j=1.
+// In case the value of the index j exceeds the maximum number of reserved
+// slots for signal values, the number of reserved slots for both the
+// signal values and errors is increased automatically.
- if (!fSignal) ResetSignals();
-
- Int_t size=fSignal->GetSize();
- if (j<=size)
+ if (!fSignal && !fDsignal)
{
- fSignal->AddAt(float(sig),j-1);
+ fSignal=new TArrayF(j);
+ fDsignal=new TArrayF(j);
+ ResetSignals();
}
- else
+
+ Int_t size=fSignal->GetSize();
+
+ if (j>size)
{
- cout << "*AliSignal::SetSignal* Index mismatch j : " << j
- << " size : " << size << endl;
+ fSignal->Set(j);
+ fDsignal->Set(j);
}
+
+ fSignal->AddAt(float(sig),j-1);
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::AddSignal(Double_t sig,Int_t j)
{
// Add value to j-th (default j=1) signal value.
// Note : The first signal value is at j=1.
+// In case the value of the index j exceeds the maximum number of reserved
+// slots for signal values, the number of reserved slots for both the
+// signal values and errors is increased automatically.
- if (!fSignal) ResetSignals();
-
- Int_t size=fSignal->GetSize();
- if (j<=size)
+ if (!fSignal && !fDsignal)
{
- Float_t sum=(fSignal->At(j-1))+sig;
- fSignal->AddAt(sum,j-1);
+ fSignal=new TArrayF(j);
+ fDsignal=new TArrayF(j);
+ ResetSignals();
}
- else
+
+ Int_t size=fSignal->GetSize();
+
+ if (j>size)
{
- cout << "*AliSignal::AddSignal* Index mismatch j : " << j
- << " size : " << size << endl;
+ fSignal->Set(j);
+ fDsignal->Set(j);
}
+
+ Float_t sum=(fSignal->At(j-1))+sig;
+ fSignal->AddAt(sum,j-1);
}
///////////////////////////////////////////////////////////////////////////
Float_t AliSignal::GetSignal(Int_t j)
{
// Store error on j-th (default j=1) signal value.
// Note : The error on the first signal value is at j=1.
+// In case the value of the index j exceeds the maximum number of reserved
+// slots for signal error values, the number of reserved slots for both the
+// signal values and errors is increased automatically.
- if (!fDsignal) ResetSignals();
-
- Int_t size=fDsignal->GetSize();
- if (j<=size)
+ if (!fSignal && !fDsignal)
{
- fDsignal->AddAt(float(dsig),j-1);
+ fSignal=new TArrayF(j);
+ fDsignal=new TArrayF(j);
+ ResetSignals();
}
- else
+
+ Int_t size=fDsignal->GetSize();
+
+ if (j>size)
{
- cout << "*AliSignal::SetSignalError* Index mismatch j : " << j
- << " size : " << size << endl;
+ fSignal->Set(j);
+ fDsignal->Set(j);
}
+
+ fDsignal->AddAt(float(dsig),j-1);
}
///////////////////////////////////////////////////////////////////////////
Float_t AliSignal::GetSignalError(Int_t j)
Int_t AliSignal::GetNvalues()
{
// Provide the number of values for this signal.
- return fNvalues;
+ Int_t n=0;
+ if (fSignal && fDsignal) n=fSignal->GetSize();
+ return n;
}
///////////////////////////////////////////////////////////////////////////
Int_t GetNvalues(); // Provide the number of signal values
protected:
- Int_t fNvalues; // The number of values per signal
TArrayF* fSignal; // Signal values
TArrayF* fDsignal; // Errors on signal values
TString fName; // Name tag to identify the kind of signal
- ClassDef(AliSignal,4) // Handling of ALICE (extrapolated) signals.
+ ClassDef(AliSignal,5) // Generic handling of (extrapolated) detector signals.
};
#endif
03-feb-2003 NvE File "gcclib" added to subdirectory "scripts" to provide Ralice installation
script for Linux machines using gcc.
Class AliObjMatrix introduced.
+08-feb-2003 NvE Class AliSignal modified such that the maximum number of signal slots is
+ handled completely dynamically at runtime.
+ Memberfunctions SetSignal() and AddSignal() of class AliCalmodule declared
+ virtual to enable inheritance.
+09-feb-2003 NvE Class AliCalcluster derived from AliSignal to enable automatic signal setting
+ for various rings of modules around the cluster center.