]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSChannelDaSSD.cxx
Histogram ranges changed to cut off saturation peak and noise
[u/mrichter/AliRoot.git] / ITS / AliITSChannelDaSSD.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2009, 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
16 /* $Id$  */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 ///
20 /// This class provides storage container ITS SSD channel callibration data
21 /// used by DA. 
22 ///
23 ///////////////////////////////////////////////////////////////////////////////
24
25
26 #include <Riostream.h>
27 #include "AliITSChannelDaSSD.h"
28 #include "TString.h"
29 #include "AliLog.h"
30
31 ClassImp(AliITSChannelDaSSD)
32
33 using namespace std;
34
35 const Short_t AliITSChannelDaSSD::fgkMinStripId = 0;               // minimum strip id
36 const Short_t AliITSChannelDaSSD::fgkMaxStripId = 1535;            // maximum strip id
37
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
42
43
44 //______________________________________________________________________________
45 AliITSChannelDaSSD::AliITSChannelDaSSD() :
46   fStripId(0),
47   fEventsNumber(0),
48   fSignal(NULL),
49   fPedestal(fgkUndefinedValue),
50   fNoise(fgkUndefinedValue),
51   fNoiseCM(fgkUndefinedValue),
52   fNOverflowEv(0)
53 {
54 // Default costructor
55 }
56
57
58 //______________________________________________________________________________
59 AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID) :
60   fStripId(stripID),
61   fEventsNumber(0),
62   fSignal(NULL),
63   fPedestal(fgkUndefinedValue),
64   fNoise(fgkUndefinedValue),
65   fNoiseCM(fgkUndefinedValue),
66   fNOverflowEv(0)
67 {
68 // Costructor, initialize channal id
69 }
70
71
72 //______________________________________________________________________________
73 AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID, const Long_t eventsnumber) :
74   fStripId(stripID),
75   fEventsNumber(0),
76   fSignal(NULL),
77   fPedestal(fgkUndefinedValue),
78   fNoise(fgkUndefinedValue),
79   fNoiseCM(fgkUndefinedValue),
80   fNOverflowEv(0)
81 {
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];
86   if (fSignal) {
87     fEventsNumber = eventsnumber;
88     memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
89   } else {
90     AliError(Form("AliITSChannelDaSSD: Error allocating memory for %i Short_t objects!", eventsnumber));
91     fSignal = NULL;
92     fEventsNumber = 0;
93   }
94 }
95
96
97
98 //______________________________________________________________________________
99 AliITSChannelDaSSD::AliITSChannelDaSSD(const AliITSChannelDaSSD& strip) :
100   TObject(strip),
101   fStripId(strip.fStripId),
102   fEventsNumber(strip.fEventsNumber),
103   fSignal(NULL),
104   fPedestal(strip.fPedestal),
105   fNoise(strip.fNoise),
106   fNoiseCM(strip.fNoiseCM),
107   fNOverflowEv(strip.fNOverflowEv)
108 {
109   // copy constructor
110   if ((strip.fEventsNumber > 0) && (strip.fSignal)) {
111     fSignal = new (nothrow) Short_t[strip.fEventsNumber];
112     if (fSignal) {
113       memcpy(fSignal, strip.fSignal, (strip.fEventsNumber * sizeof(Short_t)));
114     } else {
115       AliError(Form("AliITSChannelDaSSD: Error allocating memory for %i Short_t objects!", strip.fEventsNumber));
116       fSignal = NULL;
117       fEventsNumber = 0;
118     }
119   }  
120 }
121
122
123
124 //______________________________________________________________________________
125 AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& strip)
126 {
127 // assignment operator
128   if (this == &strip)  return *this;  
129   if (fSignal) { delete [] fSignal; fSignal = NULL; }
130   fStripId = strip.fStripId;
131   fEventsNumber = strip.fEventsNumber;
132   fPedestal = strip.fPedestal;
133   fNoise = strip.fNoise;
134   fNoiseCM = strip.fNoiseCM;
135   fNOverflowEv = strip.fNOverflowEv;
136   if ((strip.fEventsNumber > 0) && (strip.fSignal)) fSignal = new (nothrow) Short_t[strip.fEventsNumber];
137   else return *this;
138   if (fSignal) {
139     memcpy(fSignal, strip.fSignal, (strip.fEventsNumber * sizeof(Short_t)));
140   } else {
141     AliError(Form("AliITSChannelDaSSD: Error allocating memory for %i Short_t objects!", strip.fEventsNumber));
142     fSignal = NULL;
143     fEventsNumber = 0;
144   }
145   return *this;
146 }
147
148
149 //______________________________________________________________________________
150 AliITSChannelDaSSD::~AliITSChannelDaSSD()
151 {
152 // Destructor
153   if (fSignal) delete [] fSignal;
154 }
155
156
157 //______________________________________________________________________________
158 Bool_t AliITSChannelDaSSD::SetEvenetsNumber(const Long_t eventsnumber)
159 {
160 // Allocate array for events data
161   if (fSignal) {delete [] fSignal; fSignal = NULL; }
162   fSignal = new (nothrow) Short_t[eventsnumber];
163   if (fSignal) {
164     fEventsNumber = eventsnumber;
165     memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
166     return kTRUE;
167   } else {
168     AliError(Form("AliITSChannelDaSSD: Error allocating memory for %i Short_t objects!", eventsnumber));
169     fSignal = NULL;
170     fEventsNumber = 0;
171     return kFALSE;
172   }
173 }
174
175
176 //______________________________________________________________________________
177 Bool_t AliITSChannelDaSSD::SetSignal(const Long_t eventnumber, const Short_t signal)
178 {
179 // put signal value to array 
180   if (eventnumber < fEventsNumber && fSignal)
181   {
182      fSignal[eventnumber] = signal;
183      return kTRUE;
184   }
185   return kFALSE;
186 }