-
+/**************************************************************************
+ * Copyright(c) 2007-2009, 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+///
+/// This class provides storage container ITS SSD channel callibration data
+/// used by DA.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include <Riostream.h>
#include "AliITSChannelDaSSD.h"
+#include "TString.h"
+#include "AliLog.h"
ClassImp(AliITSChannelDaSSD)
using namespace std;
-const Float_t AliITSChannelDaSSD::fgkUndefinedValue = 32639.0f; // = 0x7F7F
+const Short_t AliITSChannelDaSSD::fgkMinStripId = 0; // minimum strip id
+const Short_t AliITSChannelDaSSD::fgkMaxStripId = 1535; // maximum strip id
+
+const Short_t AliITSChannelDaSSD::fgkSignalOverflow = 2047; // ADC overflow value
+const Short_t AliITSChannelDaSSD::fgkSignalUnderflow = -2048; // ADC underflow value
+const UShort_t AliITSChannelDaSSD::fgkDefaultSignal = 0x7F; // initialization value for fNoise, fPedestal, fSignal[i]
+const Float_t AliITSChannelDaSSD::fgkUndefinedValue = 32639.0f; // = 0x7F7F
+
+//______________________________________________________________________________
AliITSChannelDaSSD::AliITSChannelDaSSD() :
fStripId(0),
fEventsNumber(0),
fSignal(NULL),
fPedestal(fgkUndefinedValue),
fNoise(fgkUndefinedValue),
- fZsThresholdFactor(0.0f)
+ fNoiseCM(fgkUndefinedValue),
+ fNOverflowEv(0)
{
+// Default costructor
}
+//______________________________________________________________________________
AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID) :
fStripId(stripID),
fEventsNumber(0),
fSignal(NULL),
fPedestal(fgkUndefinedValue),
fNoise(fgkUndefinedValue),
- fZsThresholdFactor(0.0f)
+ fNoiseCM(fgkUndefinedValue),
+ fNOverflowEv(0)
{
+// Costructor, initialize channal id
}
+//______________________________________________________________________________
AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID, const Long_t eventsnumber) :
fStripId(stripID),
fEventsNumber(0),
fSignal(NULL),
fPedestal(fgkUndefinedValue),
fNoise(fgkUndefinedValue),
- fZsThresholdFactor(0.0f)
+ fNoiseCM(fgkUndefinedValue),
+ fNOverflowEv(0)
{
+// Costructor, initialize channal id and allocate array for events data
if (stripID > fgkMaxStripId)
- Warning("AliITSChannelDaSSD", "Wrong StripID: %i", stripID);
- try
- {
- fSignal = new Short_t [eventsnumber];
- fEventsNumber = eventsnumber;
- memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
+ AliWarning(Form("AliITSChannelDaSSD: Wrong StripID: %i", stripID));
+ fSignal = new (nothrow) Short_t[eventsnumber];
+ if (fSignal) {
+ fEventsNumber = eventsnumber;
+ memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
+ } else {
+ AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", eventsnumber));
+ fSignal = NULL;
+ fEventsNumber = 0;
}
- catch (bad_alloc&)
- {
- cout << "Error allocating memory for " << (long) eventsnumber << " Short_t objects in AliITSChannelDaSSD constructor!" << endl;
- fSignal = NULL;
- fEventsNumber = 0;
- }
}
+//______________________________________________________________________________
AliITSChannelDaSSD::AliITSChannelDaSSD(const AliITSChannelDaSSD& strip) :
TObject(strip),
fStripId(strip.fStripId),
fEventsNumber(strip.fEventsNumber),
- fSignal(strip.fSignal),
+ fSignal(NULL),
fPedestal(strip.fPedestal),
fNoise(strip.fNoise),
- fZsThresholdFactor(strip.fZsThresholdFactor)
+ fNoiseCM(strip.fNoiseCM),
+ fNOverflowEv(strip.fNOverflowEv)
{
// copy constructor
-
- Fatal("AliITSChannelDaSSD", "copy constructor not implemented");
+ if ((strip.fEventsNumber > 0) && (strip.fSignal)) {
+ fSignal = new (nothrow) Short_t[strip.fEventsNumber];
+ if (fSignal) {
+ memcpy(fSignal, strip.fSignal, (strip.fEventsNumber * sizeof(Short_t)));
+ } else {
+ AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", strip.fEventsNumber));
+ fSignal = NULL;
+ fEventsNumber = 0;
+ }
+ }
}
+
+
+//______________________________________________________________________________
AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& strip)
{
// assignment operator
-
- Fatal("operator =", "assignment operator not implemented");
+ if (this == &strip) return *this;
+ TObject::operator=(strip);
+ if (fSignal) { delete [] fSignal; fSignal = NULL; }
+ fStripId = strip.fStripId;
+ fEventsNumber = strip.fEventsNumber;
+ fPedestal = strip.fPedestal;
+ fNoise = strip.fNoise;
+ fNoiseCM = strip.fNoiseCM;
+ fNOverflowEv = strip.fNOverflowEv;
+ if ((strip.fEventsNumber > 0) && (strip.fSignal)) fSignal = new (nothrow) Short_t[strip.fEventsNumber];
+ else return *this;
+ if (fSignal) {
+ memcpy(fSignal, strip.fSignal, (strip.fEventsNumber * sizeof(Short_t)));
+ } else {
+ AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", strip.fEventsNumber));
+ fSignal = NULL;
+ fEventsNumber = 0;
+ }
return *this;
}
+//______________________________________________________________________________
AliITSChannelDaSSD::~AliITSChannelDaSSD()
{
- if (fSignal)
- {
- delete [] fSignal;
- }
+// Destructor
+ if (fSignal) delete [] fSignal;
}
+//______________________________________________________________________________
Bool_t AliITSChannelDaSSD::SetEvenetsNumber(const Long_t eventsnumber)
{
- try
- {
- fSignal = new Short_t[eventsnumber];
- fEventsNumber = eventsnumber;
- memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
- return kTRUE;
+// Allocate array for events data
+ if (fSignal) {delete [] fSignal; fSignal = NULL; }
+ fSignal = new (nothrow) Short_t[eventsnumber];
+ if (fSignal) {
+ fEventsNumber = eventsnumber;
+ memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
+ return kTRUE;
+ } else {
+ AliError(Form("AliITSChannelDaSSD: Error allocating memory for %ld Short_t objects!", eventsnumber));
+ fSignal = NULL;
+ fEventsNumber = 0;
+ return kFALSE;
}
- catch (bad_alloc&)
- {
- cout << "Error allocating memory for " << (long) eventsnumber << " Short_t objects!" << endl;
- fSignal = NULL;
- fEventsNumber = 0;
- return kFALSE;
- }
}
-
+//______________________________________________________________________________
Bool_t AliITSChannelDaSSD::SetSignal(const Long_t eventnumber, const Short_t signal)
{
+// put signal value to array
if (eventnumber < fEventsNumber && fSignal)
{
fSignal[eventnumber] = signal;