08-mar-2003 NvE Compiler option /GR introduced for MSVC++ in mklibs.bat to explicitly...
[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 fDead=0;
41 fGain=1;
42}
43///////////////////////////////////////////////////////////////////////////
44AliCalmodule::~AliCalmodule()
45{
46// Default destructor
47}
48///////////////////////////////////////////////////////////////////////////
c72198f1 49AliCalmodule::AliCalmodule(AliCalmodule& m) : AliSignal(m)
50{
51// Copy constructor
52 fRow=m.fRow;
53 fCol=m.fCol;
54 fSigc=m.fSigc;
55 fDead=m.fDead;
56 fGain=m.fGain;
57}
58///////////////////////////////////////////////////////////////////////////
59AliCalmodule::AliCalmodule(Int_t row,Int_t col,Float_t sig) : AliSignal()
d88f97cc 60{
61// Module constructor with initialisation of module data
62 fRow=row;
63 fCol=col;
959fbac5 64 AliSignal::SetSignal(sig);
d88f97cc 65 fSigc=sig;
d88f97cc 66 fDead=0;
67 fGain=1;
68}
69///////////////////////////////////////////////////////////////////////////
70void AliCalmodule::SetRow(Int_t i)
71{
72// Set the row number for this module
73 fRow=i;
74}
75///////////////////////////////////////////////////////////////////////////
76void AliCalmodule::SetColumn(Int_t i)
77{
78// Set the column number for this module
79 fCol=i;
80}
81///////////////////////////////////////////////////////////////////////////
82void AliCalmodule::SetSignal(Int_t row,Int_t col,Float_t sig)
83{
84// Set or change the data of the module
85 fRow=row;
86 fCol=col;
959fbac5 87 AliSignal::SetSignal(sig);
d88f97cc 88 fSigc=sig;
89}
90///////////////////////////////////////////////////////////////////////////
91void AliCalmodule::AddSignal(Int_t row,Int_t col,Float_t sig)
92{
93// Add or change the data of the module
94 fRow=row;
95 fCol=col;
959fbac5 96 AliSignal::AddSignal(sig);
d88f97cc 97 fSigc+=sig;
98}
99///////////////////////////////////////////////////////////////////////////
100void AliCalmodule::SetClusteredSignal(Float_t sig)
101{
102// Set or change the signal of the module after clustering
103 fSigc=sig;
104}
105///////////////////////////////////////////////////////////////////////////
d88f97cc 106void AliCalmodule::SetDead()
107{
108// Indicate the module as dead
109 fDead=1;
110}
111///////////////////////////////////////////////////////////////////////////
112void AliCalmodule::SetAlive()
113{
114// Indicate the module as dead
115 fDead=0;
116}
117///////////////////////////////////////////////////////////////////////////
118void AliCalmodule::SetGain(Float_t gain)
119{
120// Set the gain value of the readout system
121 fGain=gain;
122}
123///////////////////////////////////////////////////////////////////////////
124Int_t AliCalmodule::GetRow()
125{
126// Provide the row number of the module
127 return fRow;
128}
129///////////////////////////////////////////////////////////////////////////
130Int_t AliCalmodule::GetColumn()
131{
132// Provide the column number of the module
133 return fCol;
134}
135///////////////////////////////////////////////////////////////////////////
d88f97cc 136Float_t AliCalmodule::GetClusteredSignal()
137{
138// Provide the signal of the module after clustering
139 if (!fDead)
140 {
141 return fSigc;
142 }
143 else
144 {
145 return 0;
146 }
147}
148///////////////////////////////////////////////////////////////////////////
d88f97cc 149Int_t AliCalmodule::GetDeadValue()
150{
151// Provide the value of the dead indicator (1=dead 0=alive)
152 return fDead;
153}
154///////////////////////////////////////////////////////////////////////////
155Float_t AliCalmodule::GetGain()
156{
157// Provide the gain value of the readout system
158 return fGain;
159}
160///////////////////////////////////////////////////////////////////////////
c72198f1 161AliCalmodule* AliCalmodule::MakeCopy(AliCalmodule& m)
162{
163// Make a deep copy of the input object and provide the pointer to the copy.
164// This memberfunction enables automatic creation of new objects of the
165// correct type depending on the argument type, a feature which may be very useful
166// for containers like AliCalorimeter when adding objects in case the
167// container owns the objects. This feature allows e.g. AliCalorimeter
168// to store either AliCalmodule objects or objects derived from AliCalmodule
169// via tha AddSignal memberfunction, provided these derived classes also have
170// a proper MakeCopy memberfunction.
171
172 AliCalmodule* cal=new AliCalmodule(m);
173 return cal;
174}
175///////////////////////////////////////////////////////////////////////////