]>
Commit | Line | Data |
---|---|---|
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 | |
32 | ClassImp(AliCalmodule) // Class implementation to enable ROOT I/O | |
33 | ||
c72198f1 | 34 | AliCalmodule::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 | /////////////////////////////////////////////////////////////////////////// | |
42 | AliCalmodule::~AliCalmodule() | |
43 | { | |
44 | // Default destructor | |
45 | } | |
46 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 47 | AliCalmodule::AliCalmodule(const AliCalmodule& m) : AliSignal(m) |
c72198f1 | 48 | { |
49 | // Copy constructor | |
50 | fRow=m.fRow; | |
51 | fCol=m.fCol; | |
52 | fSigc=m.fSigc; | |
c72198f1 | 53 | } |
54 | /////////////////////////////////////////////////////////////////////////// | |
1c01b4f8 | 55 | AliCalmodule::AliCalmodule(Int_t row,Int_t col,Double_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 | /////////////////////////////////////////////////////////////////////////// | |
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 | /////////////////////////////////////////////////////////////////////////// | |
1c01b4f8 | 76 | void AliCalmodule::SetSignal(Double_t sig,Int_t j) |
d88f97cc | 77 | { |
1c01b4f8 | 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; | |
d88f97cc | 82 | } |
83 | /////////////////////////////////////////////////////////////////////////// | |
1c01b4f8 | 84 | void AliCalmodule::AddSignal(Double_t sig,Int_t j) |
d88f97cc | 85 | { |
86 | // Add or change the data of the module | |
1c01b4f8 | 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; | |
d88f97cc | 90 | } |
91 | /////////////////////////////////////////////////////////////////////////// | |
1c01b4f8 | 92 | void AliCalmodule::SetClusteredSignal(Double_t sig) |
d88f97cc | 93 | { |
94 | // Set or change the signal of the module after clustering | |
95 | fSigc=sig; | |
96 | } | |
97 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 98 | Int_t AliCalmodule::GetRow() const |
d88f97cc | 99 | { |
100 | // Provide the row number of the module | |
101 | return fRow; | |
102 | } | |
103 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 104 | Int_t AliCalmodule::GetColumn() const |
d88f97cc | 105 | { |
106 | // Provide the column number of the module | |
107 | return fCol; | |
108 | } | |
109 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 110 | Float_t AliCalmodule::GetClusteredSignal() const |
d88f97cc | 111 | { |
1fbffa23 | 112 | // Provide the signal of the module after clustering. |
113 | Int_t dead=GetDeadValue(); | |
114 | if (!dead) | |
d88f97cc | 115 | { |
116 | return fSigc; | |
117 | } | |
118 | else | |
119 | { | |
120 | return 0; | |
121 | } | |
122 | } | |
123 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 124 | TObject* AliCalmodule::Clone(const char* name) const |
c72198f1 | 125 | { |
1c01b4f8 | 126 | // Make a deep copy of the current object and provide the pointer to the copy. |
c72198f1 | 127 | // This memberfunction enables automatic creation of new objects of the |
1c01b4f8 | 128 | // correct type depending on the object type, a feature which may be very useful |
c72198f1 | 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 | |
1c01b4f8 | 133 | // a proper Clone memberfunction. |
c72198f1 | 134 | |
1c01b4f8 | 135 | AliCalmodule* m=new AliCalmodule(*this); |
136 | if (name) | |
137 | { | |
138 | if (strlen(name)) m->SetName(name); | |
139 | } | |
140 | return m; | |
c72198f1 | 141 | } |
142 | /////////////////////////////////////////////////////////////////////////// |