01-sep-2003 NvE Explicit initialisation of TObject() introduced in default constructo...
[u/mrichter/AliRoot.git] / RALICE / AliCalmodule.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
f531a546 16// $Id$
4c039060 17
959fbac5 18///////////////////////////////////////////////////////////////////////////
19// Class AliCalmodule
20// Description of a module in a calorimeter system.
21// A matrix geometry is assumed, such that a module
22// is identified by (row,col) and contains a certain signal.
23// Note : row and col start counting at 1.
24//
25//--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
f531a546 26//- Modified: NvE $Date$ UU-SAP Utrecht
959fbac5 27///////////////////////////////////////////////////////////////////////////
28
d88f97cc 29#include "AliCalmodule.h"
c72198f1 30#include "Riostream.h"
d88f97cc 31
32ClassImp(AliCalmodule) // Class implementation to enable ROOT I/O
33
c72198f1 34AliCalmodule::AliCalmodule() : AliSignal()
d88f97cc 35{
36// Default constructor, all module data is set to 0
37 fRow=0;
38 fCol=0;
39 fSigc=0;
d88f97cc 40}
41///////////////////////////////////////////////////////////////////////////
42AliCalmodule::~AliCalmodule()
43{
44// Default destructor
45}
46///////////////////////////////////////////////////////////////////////////
c72198f1 47AliCalmodule::AliCalmodule(AliCalmodule& m) : AliSignal(m)
48{
49// Copy constructor
50 fRow=m.fRow;
51 fCol=m.fCol;
52 fSigc=m.fSigc;
c72198f1 53}
54///////////////////////////////////////////////////////////////////////////
55AliCalmodule::AliCalmodule(Int_t row,Int_t col,Float_t sig) : AliSignal()
d88f97cc 56{
57// Module constructor with initialisation of module data
58 fRow=row;
59 fCol=col;
959fbac5 60 AliSignal::SetSignal(sig);
d88f97cc 61 fSigc=sig;
d88f97cc 62}
63///////////////////////////////////////////////////////////////////////////
64void AliCalmodule::SetRow(Int_t i)
65{
66// Set the row number for this module
67 fRow=i;
68}
69///////////////////////////////////////////////////////////////////////////
70void AliCalmodule::SetColumn(Int_t i)
71{
72// Set the column number for this module
73 fCol=i;
74}
75///////////////////////////////////////////////////////////////////////////
76void AliCalmodule::SetSignal(Int_t row,Int_t col,Float_t sig)
77{
78// Set or change the data of the module
79 fRow=row;
80 fCol=col;
959fbac5 81 AliSignal::SetSignal(sig);
d88f97cc 82 fSigc=sig;
83}
84///////////////////////////////////////////////////////////////////////////
85void AliCalmodule::AddSignal(Int_t row,Int_t col,Float_t sig)
86{
87// Add or change the data of the module
88 fRow=row;
89 fCol=col;
959fbac5 90 AliSignal::AddSignal(sig);
d88f97cc 91 fSigc+=sig;
92}
93///////////////////////////////////////////////////////////////////////////
94void AliCalmodule::SetClusteredSignal(Float_t sig)
95{
96// Set or change the signal of the module after clustering
97 fSigc=sig;
98}
99///////////////////////////////////////////////////////////////////////////
d88f97cc 100Int_t AliCalmodule::GetRow()
101{
102// Provide the row number of the module
103 return fRow;
104}
105///////////////////////////////////////////////////////////////////////////
106Int_t AliCalmodule::GetColumn()
107{
108// Provide the column number of the module
109 return fCol;
110}
111///////////////////////////////////////////////////////////////////////////
d88f97cc 112Float_t AliCalmodule::GetClusteredSignal()
113{
1fbffa23 114// Provide the signal of the module after clustering.
115 Int_t dead=GetDeadValue();
116 if (!dead)
d88f97cc 117 {
118 return fSigc;
119 }
120 else
121 {
122 return 0;
123 }
124}
125///////////////////////////////////////////////////////////////////////////
c72198f1 126AliCalmodule* AliCalmodule::MakeCopy(AliCalmodule& m)
127{
128// Make a deep copy of the input object and provide the pointer to the copy.
129// This memberfunction enables automatic creation of new objects of the
130// correct type depending on the argument type, a feature which may be very useful
131// for containers like AliCalorimeter when adding objects in case the
132// container owns the objects. This feature allows e.g. AliCalorimeter
133// to store either AliCalmodule objects or objects derived from AliCalmodule
134// via tha AddSignal memberfunction, provided these derived classes also have
135// a proper MakeCopy memberfunction.
136
137 AliCalmodule* cal=new AliCalmodule(m);
138 return cal;
139}
140///////////////////////////////////////////////////////////////////////////