1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliMUONCalibParam1I.h"
21 #include "Riostream.h"
25 ClassImp(AliMUONCalibParam1I)
27 //_____________________________________________________________________________
28 AliMUONCalibParam1I::AliMUONCalibParam1I()
29 : AliMUONVCalibParam(),
38 //_____________________________________________________________________________
39 AliMUONCalibParam1I::AliMUONCalibParam1I(Int_t theSize, Int_t fillWithValue)
40 : AliMUONVCalibParam(),
44 // Normal ctor, where theSize specifies the number of channels handled
45 // by this object, and fillWithValue the default value assigned to each
50 fValues = new Int_t[fSize];
51 memset(fValues,fillWithValue,fSize*sizeof(Int_t));
55 //______________________________________________________________________________
56 AliMUONCalibParam1I::AliMUONCalibParam1I(const AliMUONCalibParam1I& right)
57 : AliMUONVCalibParam(right)
59 /// Protected copy constructor (not implemented)
61 AliFatal("Copy constructor not provided.");
64 //_____________________________________________________________________________
65 AliMUONCalibParam1I::~AliMUONCalibParam1I()
73 //______________________________________________________________________________
75 AliMUONCalibParam1I::operator=(const AliMUONCalibParam1I& right)
77 /// Protected assignement operator (not implemented)
79 // check assignement to self
80 if (this == &right) return *this;
82 AliFatal("Assignement operator not provided.");
87 //_____________________________________________________________________________
89 AliMUONCalibParam1I::Print(Option_t* opt) const
92 // Output this object to stdout.
93 // If opt=="full", then all channels are printed, otherwise
94 // only the general characteristics are printed.
98 cout << "AliMUONCalibParam1I - Size=" << Size()
99 << " Dimension=" << Dimension()
101 if ( sopt.Contains("FULL") )
103 for ( Int_t i = 0; i < Size(); ++i )
105 cout << setw(6) << ValueAsInt(i) << " , " << endl;
110 //_____________________________________________________________________________
112 AliMUONCalibParam1I::SetValueAsFloat(Int_t i, Int_t j, Float_t value)
115 // Set the value as a float, which is casted to an int prior to storage.
117 SetValueAsInt(i,j,TMath::Nint(value));
120 //_____________________________________________________________________________
122 AliMUONCalibParam1I::SetValueAsInt(Int_t i, Int_t j, Int_t value)
125 // Set the value for a given channel.
126 // (i,j) are checked for correctness before use.
128 if ( j != 0 || i >= fSize || i < 0 )
130 AliError(Form("Invalid (i,j)=(%d,%d) max allowed is (%d,%d)",
131 i,j,Size()-1,Dimension()-1));
139 //_____________________________________________________________________________
141 AliMUONCalibParam1I::ValueAsFloat(Int_t i, Int_t j) const
144 // Return one value as a float.
146 return 1.0*ValueAsInt(i,j);
149 //_____________________________________________________________________________
151 AliMUONCalibParam1I::ValueAsInt(Int_t i, Int_t j) const
154 // Return one value as an integer, after checking that (i,j)
155 // are valid indices.
157 if ( j != 0 || i >= fSize || i < 0 )
159 AliError(Form("Invalid (i,j)=(%d,%d) max allowed is (%d,%d)",
160 i,j,Size()-1,Dimension()-1));