]>
Commit | Line | Data |
---|---|---|
f67db810 | 1 | |
2 | ||
3 | #include "AliITSModuleDaSSD.h" | |
4 | ||
5 | ClassImp(AliITSModuleDaSSD) | |
6 | ||
7 | using namespace std; | |
8 | ||
9 | AliITSModuleDaSSD::AliITSModuleDaSSD() : | |
10 | fEquipId(0), | |
11 | fEquipType(0), | |
12 | fDdlId(0), | |
13 | fAd(0), | |
14 | fAdc(0), | |
15 | fModuleId(0), | |
16 | fNumberOfStrips(0), | |
17 | fStrips(NULL), | |
18 | fEventsNumber(0) | |
19 | { | |
20 | } | |
21 | ||
22 | ||
23 | AliITSModuleDaSSD::AliITSModuleDaSSD(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t moduleID) : | |
24 | fEquipId(0), | |
25 | fEquipType(0), | |
26 | fDdlId(ddlID), | |
27 | fAd(ad), | |
28 | fAdc(adc), | |
29 | fModuleId(moduleID), | |
30 | fNumberOfStrips(0), | |
31 | fStrips(NULL), | |
32 | fEventsNumber(0) | |
33 | { | |
34 | } | |
35 | ||
36 | ||
37 | ||
38 | AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips) : | |
39 | fEquipId(0), | |
40 | fEquipType(0), | |
41 | fDdlId(0), | |
42 | fAd(0), | |
43 | fAdc(0), | |
44 | fModuleId(0), | |
45 | fNumberOfStrips(0), | |
46 | fStrips(NULL), | |
47 | fEventsNumber(0) | |
48 | { | |
49 | if (numberofstrips != fgkStripsPerModule) | |
50 | Warning("AliITSModuleDaSSD", "ALICE ITS SSD Module contains %d strips", fgkStripsPerModule); | |
51 | try { | |
52 | fStrips = new AliITSChannelDaSSD* [numberofstrips]; | |
53 | fNumberOfStrips = numberofstrips; | |
54 | for (Int_t i = 0; i < numberofstrips; i++) fStrips[i]= NULL; | |
55 | } | |
56 | catch (bad_alloc&) { | |
57 | Error("AliITSModuleDaSSD", "Error allocating memory for %d AliITSChannelDaSSD objects!", numberofstrips); | |
58 | fNumberOfStrips = 0; | |
59 | fStrips = NULL; | |
60 | } | |
61 | } | |
62 | ||
63 | ||
64 | AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips, const Long_t eventsnumber) : | |
65 | fEquipId(0), | |
66 | fEquipType(0), | |
67 | fDdlId(0), | |
68 | fAd(0), | |
69 | fAdc(0), | |
70 | fModuleId(0), | |
71 | fNumberOfStrips(0), | |
72 | fStrips(NULL), | |
73 | fEventsNumber(0) | |
74 | { | |
75 | if (numberofstrips != fgkStripsPerModule) | |
76 | Warning("AliITSModuleDaSSD", "ALICE ITS SSD Module contains %d strips", fgkStripsPerModule); | |
77 | try { | |
78 | fStrips = new AliITSChannelDaSSD* [numberofstrips]; | |
79 | fNumberOfStrips = numberofstrips; | |
80 | } | |
81 | catch (bad_alloc&) { | |
82 | Error("AliITSModuleDaSSD", "Error allocating memory for %d AliITSChannelDaSSD objects!", numberofstrips); | |
83 | fNumberOfStrips = 0; | |
84 | fStrips = NULL; | |
85 | } | |
86 | if (fStrips) { | |
87 | Int_t i; | |
88 | try { | |
89 | for (i = 0; i < fNumberOfStrips; i++) fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber); | |
90 | } | |
91 | catch (bad_alloc&) { | |
92 | Error("AliITSModuleDaSSD", "Error allocating memory for %d-th AliITSChannelDaSSD objects!", i); | |
93 | for (Int_t j = 0; j < i; j++) delete fStrips[j]; | |
94 | delete [] fStrips; | |
95 | fNumberOfStrips = 0; | |
96 | fStrips = NULL; | |
97 | } | |
98 | } | |
99 | } | |
100 | ||
101 | ||
102 | ||
103 | AliITSModuleDaSSD::AliITSModuleDaSSD(const AliITSModuleDaSSD& module) : | |
104 | TObject(module), | |
105 | fEquipId(module.fEquipId), | |
106 | fEquipType(module.fEquipType), | |
107 | fDdlId(module.fDdlId), | |
108 | fAd(module.fAd), | |
109 | fAdc(module.fAdc), | |
110 | fModuleId(module.fModuleId), | |
111 | fNumberOfStrips(module.fNumberOfStrips), | |
112 | fStrips(module.fStrips), | |
113 | fEventsNumber(module.fEventsNumber) | |
114 | { | |
115 | // copy constructor | |
116 | ||
117 | Fatal("AliITSModuleDaSSD", "copy constructor not implemented"); | |
118 | } | |
119 | ||
120 | ||
121 | ||
122 | AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& module) | |
123 | { | |
124 | // assignment operator | |
125 | ||
126 | Fatal("AliITSModuleDaSSD: operator =", "assignment operator not implemented"); | |
127 | return *this; | |
128 | } | |
129 | ||
130 | ||
131 | ||
132 | AliITSModuleDaSSD::~AliITSModuleDaSSD() | |
133 | { | |
134 | if (fStrips) | |
135 | { | |
136 | for (Long_t i = 0; i < fNumberOfStrips; i++) | |
137 | { | |
138 | if (fStrips[i]) delete fStrips[i]; | |
139 | // if (!(i % 100)) cout << "Deleted fStrips[i], i = " << i << endl; | |
140 | } | |
141 | delete [] fStrips; | |
142 | } | |
143 | } | |
144 | ||
145 | ||
146 | ||
147 | Bool_t AliITSModuleDaSSD::SetModuleIdData (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t moduleID) | |
148 | { | |
149 | if (ad > fgkMaxAdNumber) { | |
150 | Warning("AliITSModuleDaSSD", "Wrong AD number: %i", ad); | |
151 | return kFALSE; | |
152 | } | |
153 | if (adc > fgkMaxAdcNumber || ForbiddenAdcNumber(adc)) { | |
154 | Warning("AliITSModuleDaSSD", "Wrong ADC number: %i", adc); | |
155 | return kFALSE; | |
156 | } | |
157 | fDdlId = ddlID; | |
158 | fAd = ad; | |
159 | fAdc = adc; | |
160 | fModuleId = moduleID; | |
161 | return kTRUE; | |
162 | } | |
163 | ||
164 | ||
165 | ||
166 | void AliITSModuleDaSSD::SetModuleFEEId (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) | |
167 | { | |
168 | fDdlId = ddlID; | |
169 | fAd = ad; | |
170 | fAdc = adc; | |
171 | } | |
172 | ||
173 | ||
174 | void AliITSModuleDaSSD::SetModuleRorcId (const Int_t equipid, const Int_t equiptype) | |
175 | { | |
176 | fEquipId = equipid; | |
177 | fEquipType = equiptype; | |
178 | } | |
179 | ||
180 | ||
181 | Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber) | |
182 | { | |
183 | Int_t i; | |
184 | if (!fStrips) return kFALSE; | |
185 | try { | |
186 | for (i = 0; i < fNumberOfStrips; i++) { | |
187 | if (fStrips[i]) fStrips[i]->SetEvenetsNumber(eventsnumber); | |
188 | else fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber); | |
189 | } | |
190 | } | |
191 | catch (bad_alloc&) { | |
192 | Error("AliITSModuleDaSSD", "Error allocating memory for %d-th AliITSChannelDaSSD objects!", i); | |
193 | for (Int_t j = 0; j < i; j++) delete fStrips[j]; | |
194 | delete [] fStrips; | |
195 | fNumberOfStrips = 0; | |
196 | fStrips = NULL; | |
197 | return kFALSE; | |
198 | } | |
199 | return kTRUE; | |
200 | } | |
201 | ||
202 | ||
203 | ||
204 | AliITSNoiseSSD* AliITSModuleDaSSD::GetCalibrationSSDModule() const | |
205 | { | |
206 | AliITSNoiseSSD *mc; | |
207 | if (!fStrips) return NULL; | |
208 | mc = new AliITSNoiseSSD(); | |
209 | mc->SetMod(fModuleId); | |
210 | mc->SetNNoiseP(fgkPNStripsPerModule); | |
211 | mc->SetNNoiseN(fgkPNStripsPerModule); | |
212 | for (Int_t i = 0; i < fNumberOfStrips; i++) { | |
213 | if (!fStrips[i]) { | |
214 | delete mc; | |
215 | return NULL; | |
216 | } | |
217 | if (i < fgkPNStripsPerModule) | |
218 | mc->AddNoiseP(i, fStrips[i]->GetNoise()); | |
219 | else mc->AddNoiseN((i - fgkPNStripsPerModule), fStrips[i]->GetNoise()); | |
220 | } | |
221 | return mc; | |
222 | } |