of sets of calorimeters and investigate all the hits of a certain set via the
AliEvent structure). To prevent matrix swapping restrictions, the memberfuctions
SetSwapMode and GetSwapMode of AliCalorimeter have been renamed to SetMatrixSwapMode
and GetMatrixSwapMode, respectively.
Examples in the AliEvent.cxx documentation updated accordingly.
Backward links reset for non-owned hits in AliDevice destructor.
ClassImp(AliCalorimeter) // Class implementation to enable ROOT I/O
-AliCalorimeter::AliCalorimeter() : TNamed()
+AliCalorimeter::AliCalorimeter() : AliDevice()
{
// Default constructor, all parameters set to 0.
// Create a calorimeter module matrix with fixed row and column size.
fVetos=0;
fAttributes=0;
fPositions=0;
- SetName("Unspecified");
- SetTitle("Unspecified");
}
///////////////////////////////////////////////////////////////////////////
AliCalorimeter::~AliCalorimeter()
}
}
///////////////////////////////////////////////////////////////////////////
-AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol) : TNamed()
+AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol) : AliDevice()
{
// Create a calorimeter module matrix with fixed row and column size.
// The modules at the edges are automatically marked as "edge modules".
fHclusters=0;
fVetos=0;
-
- SetName("Unspecified");
- SetTitle("Unspecified");
}
///////////////////////////////////////////////////////////////////////////
-AliCalorimeter::AliCalorimeter(const AliCalorimeter& c) : TNamed(c)
+AliCalorimeter::AliCalorimeter(const AliCalorimeter& c) : AliDevice(c)
{
// Copy constructor
fClusters=0;
}
m->SetSignal(sig);
+ AddHit(m);
}
///////////////////////////////////////////////////////////////////////////
void AliCalorimeter::AddSignal(Int_t row, Int_t col, Float_t sig)
}
}
fMatrix->EnterObject(row,col,m);
+ AddHit(m);
}
else
{
}
AliCalmodule* m=GetModule(row,col);
- if (m) fMatrix->RemoveObject(row,col);
+ if (m)
+ {
+ RemoveHit(m);
+ fMatrix->RemoveObject(row,col);
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliCalorimeter::Reset(Int_t mode)
fHclusters=0;
}
}
+
+ AliDevice::Reset(mode);
}
///////////////////////////////////////////////////////////////////////////
Float_t AliCalorimeter::GetSignal(Int_t row,Int_t col,Int_t mode) const
}
}
///////////////////////////////////////////////////////////////////////////
-void AliCalorimeter::SetSwapMode(Int_t swap)
+void AliCalorimeter::SetMatrixSwapMode(Int_t swap)
{
// Set the swap mode for the module and position matrices.
// At invokation of this memberfunction the default argument is swap=1.
}
else
{
- cout << " *AliCalorimeter::SetSwapMode* Invalid argument : swap = " << swap << endl;
+ cout << " *AliCalorimeter::SetMatrixSwapMode* Invalid argument : swap = " << swap << endl;
}
}
///////////////////////////////////////////////////////////////////////////
-Int_t AliCalorimeter::GetSwapMode() const
+Int_t AliCalorimeter::GetMatrixSwapMode() const
{
// Provide the swap mode for the module and position matrices.
// For further details see the documentation of AliObjMatrix.
#include "TH2.h"
#include "TString.h"
+#include "AliDevice.h"
#include "AliObjMatrix.h"
#include "AliCalmodule.h"
#include "AliCalcluster.h"
-#include "AliSignal.h"
#include "AliPositionObj.h"
#include "AliAttribObj.h"
-class AliCalorimeter : public TNamed
+class AliCalorimeter : public AliDevice
{
public:
AliCalorimeter(); // Default constructor
virtual TObject* Clone(const char* name="") const; // Make a deep copy and provide pointer of the copy
Int_t GetNrows() const; // Return number of rows of the matrix
Int_t GetNcolumns() const; // Return number of columns of the matrix
+ using AliDevice::SetSignal;
void SetSignal(Int_t row,Int_t col,Float_t s); // Set signal for a certain module
+ using AliDevice::AddSignal;
void AddSignal(Int_t row,Int_t col,Float_t s); // Add signal to a certain module
void AddSignal(AliCalmodule* m); // Add module signal to current calorimeter
void Reset(Int_t row,Int_t col); // Reset signal for a certain module
- void Reset(Int_t mode=0); // Reset the complete calorimeter
- Float_t GetSignal(Int_t row,Int_t col,Int_t mode=0) const; // Provide signal of a certain module
+ virtual void Reset(Int_t mode=0); // Reset the complete calorimeter
+ virtual Float_t GetSignal(Int_t row,Int_t col=0) const { return GetSignal(row,col,0); }
+ Float_t GetSignal(Int_t row,Int_t col,Int_t mode) const; // Provide signal of a certain module
Int_t GetNsignals() const; // Return number of modules with a signal
void Group(Int_t n=1,Int_t mode=1); // Group modules into clusters (n rings)
Int_t GetNclusters() const; // Return number of clusters
AliCalcluster* GetCluster(Int_t j) const; // Access to cluster number j
AliCalmodule* GetModule(Int_t j) const; // Access to 'fired' module number j
AliCalmodule* GetModule(Int_t row,Int_t col) const; // Access to module at (row,col)
+ using AliDevice::SetEdgeOn;
void SetEdgeOn(Int_t row,Int_t col); // Indicate module as 'edge module'
+ using AliDevice::SetEdgeOff;
void SetEdgeOff(Int_t row,Int_t col); // Indicate module as 'non-edge module'
+ using AliDevice::GetEdgeValue;
Int_t GetEdgeValue(Int_t row,Int_t col) const; // Provide the edge flag of a module
+ using AliDevice::SetDead;
void SetDead(Int_t row,Int_t col); // Indicate module as 'dead module'
+ using AliDevice::SetAlive;
void SetAlive(Int_t row,Int_t col); // Indicate module as 'active module'
+ using AliDevice::GetDeadValue;
Int_t GetDeadValue(Int_t row,Int_t col) const; // Provide the dead flag of a module
+ using AliDevice::SetGain;
void SetGain(Int_t row,Int_t col,Float_t g); // Set the gain value for a module
+ using AliDevice::SetOffset;
void SetOffset(Int_t row,Int_t col,Float_t o); // Set the offset value for a module
+ using AliDevice::GetGain;
Float_t GetGain(Int_t row,Int_t col) const; // Provide the gain value of a module
+ using AliDevice::GetGainFlag;
Int_t GetGainFlag(Int_t row,Int_t col) const; // Provide the gain flag value of a module
+ using AliDevice::GetOffset;
Float_t GetOffset(Int_t row,Int_t col) const; // Provide the offset value of a module
+ using AliDevice::GetOffsetFlag;
Int_t GetOffsetFlag(Int_t row,Int_t col) const; // Provide the offset flag value of a module
+ using AliDevice::SetPosition;
void SetPosition(Int_t row,Int_t col,Float_t* r,TString f); // Set module position
void SetPosition(Int_t row,Int_t col,Ali3Vector& r); // Set module position
+ using AliDevice::GetPosition;
void GetPosition(Int_t row,Int_t col,Float_t* r,TString f) const; // Return module position
AliPosition* GetPosition(Int_t row,Int_t col) const; // Access to module position
TH2F* DrawModules(Float_t thresh=0.,Int_t mode=0); // Lego plot of module (corr.) signals above threshold
void AddVetoSignal(AliSignal* s) { AddVetoSignal(*s); }
AliSignal* GetVetoSignal(Int_t j) const; // Access to veto signal number j
Int_t GetNvetos() const; // Provide the number of veto signals
- void SetSwapMode(Int_t swap=1); // Set the swapmode for the storage of the matrices
- Int_t GetSwapMode() const; // Provide the swapmode for the storage of the matrices
+ void SetMatrixSwapMode(Int_t swap=1); // Set the swapmode for the storage of the matrices
+ Int_t GetMatrixSwapMode() const; // Provide the swapmode for the storage of the matrices
protected:
Int_t fNrows; // The number of rows
TObjArray* fAttributes; //! Matrix with module attributes (e.g. gain, offset etc...)
AliObjMatrix* fPositions; //! The matrix of module position pointers
- ClassDef(AliCalorimeter,8) // Description of a modular calorimeter system.
+ ClassDef(AliCalorimeter,9) // Description of a modular calorimeter system.
};
#endif
AliDevice::~AliDevice()
{
// Default destructor.
+
+ // Remove backward links to this device from the hits
+ // which were not owned by it.
+ if (!fHitCopy)
+ {
+ for (Int_t ih=1; ih<=GetNhits(); ih++)
+ {
+ AliSignal* sx=GetHit(ih);
+ if (sx) sx->ResetLinks(this);
+ }
+ }
+
if (fHits)
{
delete fHits;
if (fHitCopy)
{
fHits->Add(sx->Clone());
- Int_t nhits=GetNhits();
- AliSignal* s=GetHit(nhits);
+ AliSignal* s=(AliSignal*)fHits->Last();
s->ResetLinks((AliDevice*)&dev);
s->AddLink(this);
}
void SetHitCopy(Int_t j); // (De)activate creation of private copies of hits
Int_t GetHitCopy() const; // Provide HitCopy flag value
void AddHit(AliSignal& s); // Register an AliSignal object as a hit to this module
+ void AddHit(AliSignal* s) { if (s) AddHit(*s); }
void RemoveHit(AliSignal& s); // Remove AliSignal object as hit from this module
+ void RemoveHit(AliSignal* s) { if (s) RemoveHit(*s); }
void RemoveHits(); // Remove all AliSignals as hits from this module
Int_t GetNhits() const; // Provide number of registered hits
AliSignal* GetHit(Int_t j) const; // Access to the AliSignal registered as hit number j
Int_t fHitCopy; // Flag to denote making private copies of added hits
TObjArray* fHits; // Array to hold the associated hits
- ClassDef(AliDevice,1) // Signal (Hit) handling of a generic device.
+ ClassDef(AliDevice,2) // Signal (Hit) handling of a generic device.
};
#endif
* provided "as is" without express or implied warranty. *
**************************************************************************/
-// $Id: AliEvent.cxx,v 1.21 2004/05/04 15:33:04 nick Exp $
+// $Id: AliEvent.cxx,v 1.22 2004/06/29 11:29:37 nick Exp $
///////////////////////////////////////////////////////////////////////////
// Class AliEvent
//
// Fill the event structure with the basic objects
//
-// AliCalorimeter emcal; // Note : AliCalorimeter is NOT derived from AliDevice
+// AliCalorimeter emcal1;
+// AliCalorimeter emcal2;
// ...
-// ... // code to fill the calorimeter data
+// ... // code to fill the emcal1 and emcal2 calorimeter data
// ...
//
-// evt.AddDevice(emcal);
+// evt.AddDevice(emcal1);
+// evt.AddDevice(emcal2);
//
// // Assume AliTOF has been derived from AliDevice
// AliTOF tof1;
// Order and investigate all the hits of all the TOF devices
//
// TObjArray* hits=evt.GetHits("AliTOF");
-// TObjArray ordered=evt.SortHits(hits);
-// Int_t nhits=ordered.GetEntries();
+// TObjArray orderedtofs=evt.SortHits(hits);
+// Int_t nhits=orderedtofs.GetEntries();
// for (Int_t i=0; i<nhits; i++)
// {
-// AliSignal* sx=(AliSignal*)ordered.At(i);
+// AliSignal* sx=(AliSignal*)orderedtofs.At(i);
+// if (sx) sx->Data();
+// }
+//
+// Order and investigate all the hits of all the calorimeter devices
+//
+// TObjArray* hits=evt.GetHits("AliCalorimeter");
+// TObjArray orderedcals=evt.SortHits(hits);
+// Int_t nhits=orderedcals.GetEntries();
+// for (Int_t i=0; i<nhits; i++)
+// {
+// AliSignal* sx=(AliSignal*)orderedcals.At(i);
// if (sx) sx->Data();
// }
//
// Note : All quantities are in GeV, GeV/c or GeV/c**2
//
//--- Author: Nick van Eijndhoven 27-may-2001 UU-SAP Utrecht
-//- Modified: NvE $Date: 2004/05/04 15:33:04 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2004/06/29 11:29:37 $ UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////
#include "AliEvent.h"
29-jun-2004 NvE New class AliDevice introduced.
New memberfunctions and datamembers introduced in AliEvent to support investigation
and ordering of hits of various (classes of) devices.
+01-jul-2004 NvE AliCalorimeter derived from AliDevice to extend functionality (e.g. allow definition
+ of sets of calorimeters and investigate all the hits of a certain set via the
+ AliEvent structure). To prevent matrix swapping restrictions, the memberfuctions
+ SetSwapMode and GetSwapMode of AliCalorimeter have been renamed to SetMatrixSwapMode
+ and GetMatrixSwapMode, respectively.
+ Examples in the AliEvent.cxx documentation updated accordingly.
+ Backward links reset for non-owned hits in AliDevice destructor.