]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSChannelDaSSD.cxx
Put index into track's name instead of its label.
[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
29 ClassImp(AliITSChannelDaSSD)
30
31 using namespace std;
32
33 const Float_t  AliITSChannelDaSSD::fgkUndefinedValue  = 32639.0f;  // = 0x7F7F
34
35 AliITSChannelDaSSD::AliITSChannelDaSSD() :
36   fStripId(0),
37   fEventsNumber(0),
38   fSignal(NULL),
39   fPedestal(fgkUndefinedValue),
40   fNoise(fgkUndefinedValue),
41   fZsThresholdFactor(0.0f)
42 {
43 // Default costructor
44 }
45
46
47 AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID) :
48   fStripId(stripID),
49   fEventsNumber(0),
50   fSignal(NULL),
51   fPedestal(fgkUndefinedValue),
52   fNoise(fgkUndefinedValue),
53   fZsThresholdFactor(0.0f)
54 {
55 // Costructor, initialize channal id
56 }
57
58
59 AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID, const Long_t eventsnumber) :
60   fStripId(stripID),
61   fEventsNumber(0),
62   fSignal(NULL),
63   fPedestal(fgkUndefinedValue),
64   fNoise(fgkUndefinedValue),
65   fZsThresholdFactor(0.0f)
66 {
67 // Costructor, initialize channal id and allocate array for events data
68   if (stripID > fgkMaxStripId)
69     Warning("AliITSChannelDaSSD", "Wrong StripID: %i", stripID);
70   fSignal = new (nothrow) Short_t[eventsnumber];
71   if (fSignal) {
72     fEventsNumber = eventsnumber;
73     memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
74   } else {
75     Error("AliITSChannelDaSSD", "Error allocating memory for %i Short_t objects!", eventsnumber);
76     fSignal = NULL;
77     fEventsNumber = 0;
78   }
79 }
80
81
82
83 AliITSChannelDaSSD::AliITSChannelDaSSD(const AliITSChannelDaSSD& strip) :
84   TObject(strip),
85   fStripId(strip.fStripId),
86   fEventsNumber(strip.fEventsNumber),
87   fSignal(strip.fSignal),
88   fPedestal(strip.fPedestal),
89   fNoise(strip.fNoise),
90   fZsThresholdFactor(strip.fZsThresholdFactor)
91 {
92   // copy constructor
93
94   Fatal("AliITSChannelDaSSD", "copy constructor not implemented");
95 }
96
97 AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& strip)
98 {
99 // assignment operator
100
101   Fatal("operator =", "assignment operator not implemented");
102   return *this;
103 }
104
105
106 AliITSChannelDaSSD::~AliITSChannelDaSSD()
107 {
108 // Destructor
109   if (fSignal) 
110   {
111      delete [] fSignal;
112   }
113 }
114
115
116 Bool_t AliITSChannelDaSSD::SetEvenetsNumber(const Long_t eventsnumber)
117 {
118 // Allocate array for events data
119   if (fSignal) {delete [] fSignal; fSignal = NULL; }
120   fSignal = new (nothrow) Short_t[eventsnumber];
121   if (fSignal) {
122     fEventsNumber = eventsnumber;
123     memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
124     return kTRUE;
125   } else {
126     Error("AliITSChannelDaSSD", "Error allocating memory for %i Short_t objects!", eventsnumber);
127     fSignal = NULL;
128     fEventsNumber = 0;
129     return kFALSE;
130   }
131 }
132
133
134
135 Bool_t AliITSChannelDaSSD::SetSignal(const Long_t eventnumber, const Short_t signal)
136 {
137 // put signal value to array 
138   if (eventnumber < fEventsNumber && fSignal)
139   {
140      fSignal[eventnumber] = signal;
141      return kTRUE;
142   }
143   return kFALSE;
144 }