1 /**************************************************************************
2 * Copyright(c) 2007-2009, 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 ///////////////////////////////////////////////////////////////////////////////
20 /// This class provides storage container ITS SSD channel callibration data
23 ///////////////////////////////////////////////////////////////////////////////
26 #include <Riostream.h>
27 #include "AliITSChannelDaSSD.h"
31 ClassImp(AliITSChannelDaSSD)
35 const Short_t AliITSChannelDaSSD::fgkMinStripId = 0; // minimum strip id
36 const Short_t AliITSChannelDaSSD::fgkMaxStripId = 1535; // maximum strip id
38 const Short_t AliITSChannelDaSSD::fgkSignalOverflow = 2047; // ADC overflow value
39 const Short_t AliITSChannelDaSSD::fgkSignalUnderflow = -2048; // ADC underflow value
40 const UShort_t AliITSChannelDaSSD::fgkDefaultSignal = 0x7F; // initialization value for fNoise, fPedestal, fSignal[i]
41 const Float_t AliITSChannelDaSSD::fgkUndefinedValue = 32639.0f; // = 0x7F7F
44 //______________________________________________________________________________
45 AliITSChannelDaSSD::AliITSChannelDaSSD() :
49 fPedestal(fgkUndefinedValue),
50 fNoise(fgkUndefinedValue),
51 fNoiseCM(fgkUndefinedValue),
58 //______________________________________________________________________________
59 AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID) :
63 fPedestal(fgkUndefinedValue),
64 fNoise(fgkUndefinedValue),
65 fNoiseCM(fgkUndefinedValue),
68 // Costructor, initialize channal id
72 //______________________________________________________________________________
73 AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID, const Long_t eventsnumber) :
77 fPedestal(fgkUndefinedValue),
78 fNoise(fgkUndefinedValue),
79 fNoiseCM(fgkUndefinedValue),
82 // Costructor, initialize channal id and allocate array for events data
83 if (stripID > fgkMaxStripId)
84 AliWarning(Form("AliITSChannelDaSSD: Wrong StripID: %i", stripID));
85 fSignal = new (nothrow) Short_t[eventsnumber];
87 fEventsNumber = eventsnumber;
88 memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
90 AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", eventsnumber));
98 //______________________________________________________________________________
99 AliITSChannelDaSSD::AliITSChannelDaSSD(const AliITSChannelDaSSD& strip) :
101 fStripId(strip.fStripId),
102 fEventsNumber(strip.fEventsNumber),
104 fPedestal(strip.fPedestal),
105 fNoise(strip.fNoise),
106 fNoiseCM(strip.fNoiseCM),
107 fNOverflowEv(strip.fNOverflowEv)
110 if ((strip.fEventsNumber > 0) && (strip.fSignal)) {
111 fSignal = new (nothrow) Short_t[strip.fEventsNumber];
113 memcpy(fSignal, strip.fSignal, (strip.fEventsNumber * sizeof(Short_t)));
115 AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", strip.fEventsNumber));
124 //______________________________________________________________________________
125 AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& strip)
127 // assignment operator
128 if (this == &strip) return *this;
129 TObject::operator=(strip);
130 if (fSignal) { delete [] fSignal; fSignal = NULL; }
131 fStripId = strip.fStripId;
132 fEventsNumber = strip.fEventsNumber;
133 fPedestal = strip.fPedestal;
134 fNoise = strip.fNoise;
135 fNoiseCM = strip.fNoiseCM;
136 fNOverflowEv = strip.fNOverflowEv;
137 if ((strip.fEventsNumber > 0) && (strip.fSignal)) fSignal = new (nothrow) Short_t[strip.fEventsNumber];
140 memcpy(fSignal, strip.fSignal, (strip.fEventsNumber * sizeof(Short_t)));
142 AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", strip.fEventsNumber));
150 //______________________________________________________________________________
151 AliITSChannelDaSSD::~AliITSChannelDaSSD()
154 if (fSignal) delete [] fSignal;
158 //______________________________________________________________________________
159 Bool_t AliITSChannelDaSSD::SetEvenetsNumber(const Long_t eventsnumber)
161 // Allocate array for events data
162 if (fSignal) {delete [] fSignal; fSignal = NULL; }
163 fSignal = new (nothrow) Short_t[eventsnumber];
165 fEventsNumber = eventsnumber;
166 memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
169 AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", eventsnumber));
177 //______________________________________________________________________________
178 Bool_t AliITSChannelDaSSD::SetSignal(const Long_t eventnumber, const Short_t signal)
180 // put signal value to array
181 if (eventnumber < fEventsNumber && fSignal)
183 fSignal[eventnumber] = signal;