]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RALICE/AliCalmodule.cxx
Bug fix: corrected file name (Levente)
[u/mrichter/AliRoot.git] / RALICE / AliCalmodule.cxx
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
16 // $Id$
17
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
26 //- Modified: NvE $Date$ UU-SAP Utrecht
27 ///////////////////////////////////////////////////////////////////////////
28
29 #include "AliCalmodule.h"
30 #include "Riostream.h"
31  
32 ClassImp(AliCalmodule) // Class implementation to enable ROOT I/O
33  
34 AliCalmodule::AliCalmodule() : AliSignal()
35 {
36 // Default constructor, all module data is set to 0
37  fRow=0;
38  fCol=0;
39  fSigc=0;
40 }
41 ///////////////////////////////////////////////////////////////////////////
42 AliCalmodule::~AliCalmodule()
43 {
44 // Default destructor
45 }
46 ///////////////////////////////////////////////////////////////////////////
47 AliCalmodule::AliCalmodule(const AliCalmodule& m) : AliSignal(m)
48 {
49 // Copy constructor
50  fRow=m.fRow;
51  fCol=m.fCol;
52  fSigc=m.fSigc;
53 }
54 ///////////////////////////////////////////////////////////////////////////
55 AliCalmodule::AliCalmodule(Int_t row,Int_t col,Double_t sig) : AliSignal()
56 {
57 // Module constructor with initialisation of module data
58  fRow=row;
59  fCol=col;
60  AliSignal::SetSignal(sig);
61  fSigc=sig;
62 }
63 ///////////////////////////////////////////////////////////////////////////
64 void AliCalmodule::SetRow(Int_t i)
65 {
66 // Set the row number for this module
67  fRow=i;
68 }
69 ///////////////////////////////////////////////////////////////////////////
70 void AliCalmodule::SetColumn(Int_t i)
71 {
72 // Set the column number for this module
73  fCol=i;
74 }
75 ///////////////////////////////////////////////////////////////////////////
76 void AliCalmodule::SetSignal(Double_t sig,Int_t j)
77 {
78 // Set or change the data of the module.
79 // This is an extension of AliSignal::SetSignal in view of the clustered signal.
80  AliSignal::SetSignal(sig,j);
81  if (j==1) fSigc=sig;
82 }
83 ///////////////////////////////////////////////////////////////////////////
84 void AliCalmodule::AddSignal(Double_t sig,Int_t j)
85 {
86 // Add or change the data of the module
87 // This is an extension of AliSignal::AddSignal in view of the clustered signal.
88  AliSignal::AddSignal(sig,j);
89  if (j==1) fSigc+=sig;
90 }
91 ///////////////////////////////////////////////////////////////////////////
92 void AliCalmodule::SetClusteredSignal(Double_t sig)
93 {
94 // Set or change the signal of the module after clustering
95  fSigc=sig;
96 }
97 ///////////////////////////////////////////////////////////////////////////
98 Int_t AliCalmodule::GetRow() const
99 {
100 // Provide the row number of the module
101  return fRow;
102 }
103 ///////////////////////////////////////////////////////////////////////////
104 Int_t AliCalmodule::GetColumn() const
105 {
106 // Provide the column number of the module
107  return fCol;
108 }
109 ///////////////////////////////////////////////////////////////////////////
110 Float_t AliCalmodule::GetClusteredSignal() const
111 {
112 // Provide the signal of the module after clustering.
113  Int_t dead=GetDeadValue();
114  if (!dead)
115  {
116   return fSigc;
117  }
118  else
119  {
120   return 0;
121  }
122 }
123 ///////////////////////////////////////////////////////////////////////////
124 TObject* AliCalmodule::Clone(const char* name) const
125 {
126 // Make a deep copy of the current object and provide the pointer to the copy.
127 // This memberfunction enables automatic creation of new objects of the
128 // correct type depending on the object type, a feature which may be very useful
129 // for containers like AliCalorimeter when adding objects in case the
130 // container owns the objects. This feature allows e.g. AliCalorimeter
131 // to store either AliCalmodule objects or objects derived from AliCalmodule
132 // via tha AddSignal memberfunction, provided these derived classes also have
133 // a proper Clone memberfunction. 
134
135  AliCalmodule* m=new AliCalmodule(*this);
136  if (name)
137  {
138   if (strlen(name)) m->SetName(name);
139  }
140  return m;
141 }
142 ///////////////////////////////////////////////////////////////////////////