SSD detactor algorithm and related classes (E. Fragiacomo)
[u/mrichter/AliRoot.git] / ITS / AliITSChannelDaSSD.cxx
CommitLineData
f67db810 1
2#include "AliITSChannelDaSSD.h"
3
4ClassImp(AliITSChannelDaSSD)
5
6using namespace std;
7
8const Float_t AliITSChannelDaSSD::fgkUndefinedValue = 32639.0f; // = 0x7F7F
9
10AliITSChannelDaSSD::AliITSChannelDaSSD() :
11 fStripId(0),
12 fEventsNumber(0),
13 fSignal(NULL),
14 fPedestal(fgkUndefinedValue),
15 fNoise(fgkUndefinedValue),
16 fZsThresholdFactor(0.0f)
17{
18}
19
20
21AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID) :
22 fStripId(stripID),
23 fEventsNumber(0),
24 fSignal(NULL),
25 fPedestal(fgkUndefinedValue),
26 fNoise(fgkUndefinedValue),
27 fZsThresholdFactor(0.0f)
28{
29}
30
31
32AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID, const Long_t eventsnumber) :
33 fStripId(stripID),
34 fEventsNumber(0),
35 fSignal(NULL),
36 fPedestal(fgkUndefinedValue),
37 fNoise(fgkUndefinedValue),
38 fZsThresholdFactor(0.0f)
39{
40 if (stripID > fgkMaxStripId)
41 Warning("AliITSChannelDaSSD", "Wrong StripID: %i", stripID);
42 try
43 {
44 fSignal = new Short_t [eventsnumber];
45 fEventsNumber = eventsnumber;
46 memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
47 }
48 catch (bad_alloc&)
49 {
50 cout << "Error allocating memory for " << (long) eventsnumber << " Short_t objects in AliITSChannelDaSSD constructor!" << endl;
51 fSignal = NULL;
52 fEventsNumber = 0;
53 }
54}
55
56
57
58AliITSChannelDaSSD::AliITSChannelDaSSD(const AliITSChannelDaSSD& strip) :
59 TObject(strip),
60 fStripId(strip.fStripId),
61 fEventsNumber(strip.fEventsNumber),
62 fSignal(strip.fSignal),
63 fPedestal(strip.fPedestal),
64 fNoise(strip.fNoise),
65 fZsThresholdFactor(strip.fZsThresholdFactor)
66{
67 // copy constructor
68
69 Fatal("AliITSChannelDaSSD", "copy constructor not implemented");
70}
71
72AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& strip)
73{
74// assignment operator
75
76 Fatal("operator =", "assignment operator not implemented");
77 return *this;
78}
79
80
81AliITSChannelDaSSD::~AliITSChannelDaSSD()
82{
83 if (fSignal)
84 {
85 delete [] fSignal;
86 }
87}
88
89
90Bool_t AliITSChannelDaSSD::SetEvenetsNumber(const Long_t eventsnumber)
91{
92 try
93 {
94 fSignal = new Short_t[eventsnumber];
95 fEventsNumber = eventsnumber;
96 memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t)));
97 return kTRUE;
98 }
99 catch (bad_alloc&)
100 {
101 cout << "Error allocating memory for " << (long) eventsnumber << " Short_t objects!" << endl;
102 fSignal = NULL;
103 fEventsNumber = 0;
104 return kFALSE;
105 }
106}
107
108
109
110Bool_t AliITSChannelDaSSD::SetSignal(const Long_t eventnumber, const Short_t signal)
111{
112 if (eventnumber < fEventsNumber && fSignal)
113 {
114 fSignal[eventnumber] = signal;
115 return kTRUE;
116 }
117 return kFALSE;
118}