X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=RALICE%2FAliCalmodule.cxx;h=4fae9d32040f02acc5b05a6bc6980a4cb8182902;hb=8e8eae84c82d2951bab0d875cdd742d409f5b196;hp=c16cc4cefff233dc282621d094ca9f6b5faac1d9;hpb=d88f97ccd1c218106504dbf4cbf5bc65038e2a78;p=u%2Fmrichter%2FAliRoot.git diff --git a/RALICE/AliCalmodule.cxx b/RALICE/AliCalmodule.cxx index c16cc4cefff..4fae9d32040 100644 --- a/RALICE/AliCalmodule.cxx +++ b/RALICE/AliCalmodule.cxx @@ -1,16 +1,42 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +// $Id$ + +/////////////////////////////////////////////////////////////////////////// +// Class AliCalmodule +// Description of a module in a calorimeter system. +// A matrix geometry is assumed, such that a module +// is identified by (row,col) and contains a certain signal. +// Note : row and col start counting at 1. +// +//--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht +//- Modified: NvE $Date$ UU-SAP Utrecht +/////////////////////////////////////////////////////////////////////////// + #include "AliCalmodule.h" +#include "Riostream.h" ClassImp(AliCalmodule) // Class implementation to enable ROOT I/O -AliCalmodule::AliCalmodule() +AliCalmodule::AliCalmodule() : AliSignal() { // Default constructor, all module data is set to 0 fRow=0; fCol=0; fSigc=0; - fEdge=0; - fDead=0; - fGain=1; } /////////////////////////////////////////////////////////////////////////// AliCalmodule::~AliCalmodule() @@ -18,16 +44,21 @@ AliCalmodule::~AliCalmodule() // Default destructor } /////////////////////////////////////////////////////////////////////////// -AliCalmodule::AliCalmodule(Int_t row,Int_t col,Float_t sig) +AliCalmodule::AliCalmodule(AliCalmodule& m) : AliSignal(m) +{ +// Copy constructor + fRow=m.fRow; + fCol=m.fCol; + fSigc=m.fSigc; +} +/////////////////////////////////////////////////////////////////////////// +AliCalmodule::AliCalmodule(Int_t row,Int_t col,Double_t sig) : AliSignal() { // Module constructor with initialisation of module data fRow=row; fCol=col; - fSignal=sig; + AliSignal::SetSignal(sig); fSigc=sig; - fEdge=0; - fDead=0; - fGain=1; } /////////////////////////////////////////////////////////////////////////// void AliCalmodule::SetRow(Int_t i) @@ -42,74 +73,28 @@ void AliCalmodule::SetColumn(Int_t i) fCol=i; } /////////////////////////////////////////////////////////////////////////// -void AliCalmodule::SetSignal(Int_t row,Int_t col,Float_t sig) +void AliCalmodule::SetSignal(Double_t sig,Int_t j) { -// Set or change the data of the module - fRow=row; - fCol=col; - fSignal=sig; - fSigc=sig; +// Set or change the data of the module. +// This is an extension of AliSignal::SetSignal in view of the clustered signal. + AliSignal::SetSignal(sig,j); + if (j==1) fSigc=sig; } /////////////////////////////////////////////////////////////////////////// -void AliCalmodule::AddSignal(Int_t row,Int_t col,Float_t sig) +void AliCalmodule::AddSignal(Double_t sig,Int_t j) { // Add or change the data of the module - fRow=row; - fCol=col; - fSignal+=sig; - fSigc+=sig; +// This is an extension of AliSignal::AddSignal in view of the clustered signal. + AliSignal::AddSignal(sig,j); + if (j==1) fSigc+=sig; } /////////////////////////////////////////////////////////////////////////// -void AliCalmodule::SetClusteredSignal(Float_t sig) +void AliCalmodule::SetClusteredSignal(Double_t sig) { // Set or change the signal of the module after clustering fSigc=sig; } /////////////////////////////////////////////////////////////////////////// -void AliCalmodule::SetEdgeOn() -{ -// Indicate the module as edge module - fEdge=1; -} -/////////////////////////////////////////////////////////////////////////// -void AliCalmodule::SetEdgeOff() -{ -// Indicate the module as non-edge module - fEdge=0; -} -/////////////////////////////////////////////////////////////////////////// -void AliCalmodule::EdgeUp() -{ -// Increase the edge value by 1 -// This simplifies treatment of edge modules around temp. dead modules - fEdge+=1; -} -/////////////////////////////////////////////////////////////////////////// -void AliCalmodule::EdgeDown() -{ -// Decrease the edge value by 1 -// This simplifies treatment of edge modules around temp. dead modules - if (fEdge > 0) fEdge-=1; -} -/////////////////////////////////////////////////////////////////////////// -void AliCalmodule::SetDead() -{ -// Indicate the module as dead - fDead=1; -} -/////////////////////////////////////////////////////////////////////////// -void AliCalmodule::SetAlive() -{ -// Indicate the module as dead - fDead=0; -} -/////////////////////////////////////////////////////////////////////////// -void AliCalmodule::SetGain(Float_t gain) -{ -// Set the gain value of the readout system - fGain=gain; -} -/////////////////////////////////////////////////////////////////////////// Int_t AliCalmodule::GetRow() { // Provide the row number of the module @@ -122,23 +107,11 @@ Int_t AliCalmodule::GetColumn() return fCol; } /////////////////////////////////////////////////////////////////////////// -Float_t AliCalmodule::GetSignal() -{ -// Provide the signal value of the module - if (!fDead) - { - return fSignal; - } - else - { - return 0; - } -} -/////////////////////////////////////////////////////////////////////////// Float_t AliCalmodule::GetClusteredSignal() { -// Provide the signal of the module after clustering - if (!fDead) +// Provide the signal of the module after clustering. + Int_t dead=GetDeadValue(); + if (!dead) { return fSigc; } @@ -148,21 +121,22 @@ Float_t AliCalmodule::GetClusteredSignal() } } /////////////////////////////////////////////////////////////////////////// -Int_t AliCalmodule::GetEdgeValue() -{ -// Provide the value of the edge indicator (1=edge 0=no-edge) - return fEdge; -} -/////////////////////////////////////////////////////////////////////////// -Int_t AliCalmodule::GetDeadValue() +TObject* AliCalmodule::Clone(const char* name) { -// Provide the value of the dead indicator (1=dead 0=alive) - return fDead; -} -/////////////////////////////////////////////////////////////////////////// -Float_t AliCalmodule::GetGain() -{ -// Provide the gain value of the readout system - return fGain; +// Make a deep copy of the current object and provide the pointer to the copy. +// This memberfunction enables automatic creation of new objects of the +// correct type depending on the object type, a feature which may be very useful +// for containers like AliCalorimeter when adding objects in case the +// container owns the objects. This feature allows e.g. AliCalorimeter +// to store either AliCalmodule objects or objects derived from AliCalmodule +// via tha AddSignal memberfunction, provided these derived classes also have +// a proper Clone memberfunction. + + AliCalmodule* m=new AliCalmodule(*this); + if (name) + { + if (strlen(name)) m->SetName(name); + } + return m; } ///////////////////////////////////////////////////////////////////////////