]>
Commit | Line | Data |
---|---|---|
223dda26 | 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> | |
f67db810 | 27 | #include "AliITSChannelDaSSD.h" |
c4d90345 | 28 | #include "TString.h" |
29 | #include "AliLog.h" | |
f67db810 | 30 | |
31 | ClassImp(AliITSChannelDaSSD) | |
32 | ||
33 | using namespace std; | |
34 | ||
c4d90345 | 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] | |
f67db810 | 41 | const Float_t AliITSChannelDaSSD::fgkUndefinedValue = 32639.0f; // = 0x7F7F |
42 | ||
c4d90345 | 43 | |
44 | //______________________________________________________________________________ | |
f67db810 | 45 | AliITSChannelDaSSD::AliITSChannelDaSSD() : |
46 | fStripId(0), | |
47 | fEventsNumber(0), | |
48 | fSignal(NULL), | |
49 | fPedestal(fgkUndefinedValue), | |
50 | fNoise(fgkUndefinedValue), | |
c4d90345 | 51 | fNoiseCM(fgkUndefinedValue), |
52 | fNOverflowEv(0) | |
f67db810 | 53 | { |
223dda26 | 54 | // Default costructor |
f67db810 | 55 | } |
56 | ||
57 | ||
c4d90345 | 58 | //______________________________________________________________________________ |
f67db810 | 59 | AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID) : |
60 | fStripId(stripID), | |
61 | fEventsNumber(0), | |
62 | fSignal(NULL), | |
63 | fPedestal(fgkUndefinedValue), | |
64 | fNoise(fgkUndefinedValue), | |
c4d90345 | 65 | fNoiseCM(fgkUndefinedValue), |
66 | fNOverflowEv(0) | |
f67db810 | 67 | { |
223dda26 | 68 | // Costructor, initialize channal id |
f67db810 | 69 | } |
70 | ||
71 | ||
c4d90345 | 72 | //______________________________________________________________________________ |
f67db810 | 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), | |
c4d90345 | 79 | fNoiseCM(fgkUndefinedValue), |
80 | fNOverflowEv(0) | |
f67db810 | 81 | { |
223dda26 | 82 | // Costructor, initialize channal id and allocate array for events data |
f67db810 | 83 | if (stripID > fgkMaxStripId) |
c4d90345 | 84 | AliWarning(Form("AliITSChannelDaSSD: Wrong StripID: %i", stripID)); |
223dda26 | 85 | fSignal = new (nothrow) Short_t[eventsnumber]; |
86 | if (fSignal) { | |
87 | fEventsNumber = eventsnumber; | |
88 | memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t))); | |
89 | } else { | |
c4d90345 | 90 | AliError(Form("AliITSChannelDaSSD: Error allocating memory for %i Short_t objects!", eventsnumber)); |
223dda26 | 91 | fSignal = NULL; |
92 | fEventsNumber = 0; | |
f67db810 | 93 | } |
f67db810 | 94 | } |
95 | ||
96 | ||
97 | ||
c4d90345 | 98 | //______________________________________________________________________________ |
f67db810 | 99 | AliITSChannelDaSSD::AliITSChannelDaSSD(const AliITSChannelDaSSD& strip) : |
100 | TObject(strip), | |
101 | fStripId(strip.fStripId), | |
102 | fEventsNumber(strip.fEventsNumber), | |
103 | fSignal(strip.fSignal), | |
104 | fPedestal(strip.fPedestal), | |
105 | fNoise(strip.fNoise), | |
c4d90345 | 106 | fNoiseCM(strip.fNoiseCM), |
107 | fNOverflowEv(strip.fNOverflowEv) | |
f67db810 | 108 | { |
109 | // copy constructor | |
110 | ||
c4d90345 | 111 | AliFatal("AliITSChannelDaSSD, copy constructor not implemented"); |
f67db810 | 112 | } |
113 | ||
c4d90345 | 114 | |
115 | ||
116 | //______________________________________________________________________________ | |
f67db810 | 117 | AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& strip) |
118 | { | |
119 | // assignment operator | |
120 | ||
c4d90345 | 121 | AliFatal("operator =, assignment operator not implemented"); |
f67db810 | 122 | return *this; |
123 | } | |
124 | ||
125 | ||
c4d90345 | 126 | //______________________________________________________________________________ |
f67db810 | 127 | AliITSChannelDaSSD::~AliITSChannelDaSSD() |
128 | { | |
223dda26 | 129 | // Destructor |
f67db810 | 130 | if (fSignal) |
131 | { | |
132 | delete [] fSignal; | |
133 | } | |
134 | } | |
135 | ||
136 | ||
c4d90345 | 137 | //______________________________________________________________________________ |
f67db810 | 138 | Bool_t AliITSChannelDaSSD::SetEvenetsNumber(const Long_t eventsnumber) |
139 | { | |
223dda26 | 140 | // Allocate array for events data |
141 | if (fSignal) {delete [] fSignal; fSignal = NULL; } | |
142 | fSignal = new (nothrow) Short_t[eventsnumber]; | |
143 | if (fSignal) { | |
144 | fEventsNumber = eventsnumber; | |
145 | memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t))); | |
146 | return kTRUE; | |
147 | } else { | |
c4d90345 | 148 | AliError(Form("AliITSChannelDaSSD: Error allocating memory for %i Short_t objects!", eventsnumber)); |
223dda26 | 149 | fSignal = NULL; |
150 | fEventsNumber = 0; | |
151 | return kFALSE; | |
f67db810 | 152 | } |
f67db810 | 153 | } |
154 | ||
155 | ||
c4d90345 | 156 | //______________________________________________________________________________ |
f67db810 | 157 | Bool_t AliITSChannelDaSSD::SetSignal(const Long_t eventnumber, const Short_t signal) |
158 | { | |
223dda26 | 159 | // put signal value to array |
f67db810 | 160 | if (eventnumber < fEventsNumber && fSignal) |
161 | { | |
162 | fSignal[eventnumber] = signal; | |
163 | return kTRUE; | |
164 | } | |
165 | return kFALSE; | |
166 | } |