]>
Commit | Line | Data |
---|---|---|
48265b32 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | /* | |
17 | $Log$ | |
fb3305d1 | 18 | Revision 1.2 2007/10/12 13:36:27 cvetan |
19 | Coding convention fixes from Stefan | |
20 | ||
ca7b8371 | 21 | Revision 1.1 2007/09/17 10:23:31 cvetan |
22 | New TPC monitoring package from Stefan Kniege. The monitoring package can be started by running TPCMonitor.C macro located in macros folder. | |
23 | ||
48265b32 | 24 | */ |
25 | ||
fb3305d1 | 26 | ////////////////////////////////////////////////////////////////////////// |
27 | //// | |
28 | //// AliTPCMonitorConfig class | |
29 | //// | |
30 | //// Configuration handler class for AliTPCMonitor | |
31 | //// | |
32 | //// The basic configuration will be read from the file AliTPCMonitorConfig.txt | |
33 | //// and can be changed online via the Button "Conf. Ranges" | |
34 | //// Basic configuration settings are e.g. the range for the determination | |
35 | //// of the baseline, maximum adc value and the settings for the pedestal calculation. | |
36 | //// | |
37 | //// Author: Stefan Kniege, IKF, Frankfurt | |
38 | //// | |
39 | //// | |
ca7b8371 | 40 | ///////////////////////////////////////////////////////////////////////// |
41 | ||
42 | ||
48265b32 | 43 | #include "AliTPCMonitorConfig.h" |
ca7b8371 | 44 | #include "AliLog.h" |
45 | #include <Riostream.h> | |
46 | ||
c64cb1f6 | 47 | using std::cout; |
48 | using std::endl; | |
49 | using std::ifstream; | |
50 | using std::ofstream; | |
51 | using std::string; | |
52 | ||
48265b32 | 53 | ClassImp(AliTPCMonitorConfig) |
54 | ||
ca7b8371 | 55 | // _______________________________________________________________________________________________________________ |
56 | AliTPCMonitorConfig::AliTPCMonitorConfig(const Char_t* name, const Char_t* title) : | |
57 | TNamed(name,title), | |
58 | fFormat(-1), | |
59 | fSector(0), | |
60 | fSectorLast(-1), | |
61 | fSectorLastDisplayed(-1), | |
c60053f6 | 62 | fFileLast(), |
ca7b8371 | 63 | fFileLastSet(0), |
c60053f6 | 64 | fFileCurrent(), |
ca7b8371 | 65 | fEventNext(1), |
66 | fEventNextID(1), | |
67 | fEventProcessed(0), | |
68 | fRangeMaxAdcMin(50), | |
69 | fRangeMaxAdcMax(100), | |
70 | fRangeBaseMin(300), | |
71 | fRangeBaseMax(600), | |
72 | fRangeSumMin(50), | |
73 | fRangeSumMax(100), | |
74 | fCanvasXSize(100), | |
75 | fCanvasYSize(100), | |
76 | fCanvasXSpace(10), | |
77 | fCanvasYSpace(10), | |
78 | fCanvasXOffset(130), | |
79 | fCanvasMainSize(200), | |
80 | fMainXSize(100), | |
81 | fMainYSize(600), | |
82 | fBorderXSize(10), | |
83 | fBorderYSize(10), | |
84 | fButtonXSize(100), | |
85 | fButtonYSize(20), | |
86 | fButtonFirstX1(10), | |
87 | fButtonFirstX2(50), | |
88 | fButtonFirstY(300), | |
89 | fWrite10Bit(0), | |
ca7b8371 | 90 | fSamplingFreq(1000000), |
91 | fPedestals(1), | |
92 | fNumOfChannels(16000), | |
93 | fTimeBins(1024), | |
94 | fMaxHwAddr(24000), | |
95 | fFitPulse(1), | |
fb3305d1 | 96 | fProcOneSector(0) |
48265b32 | 97 | { |
48265b32 | 98 | // Constructor |
ca7b8371 | 99 | for(Int_t i =0; i<36; i++) { fSectorArr[i] = 0;} |
100 | for(Int_t i =0; i<10;i++) { fComponents[i] =0.0;} | |
48265b32 | 101 | SetMainSize(130,720,10,26 ); |
48265b32 | 102 | |
103 | } | |
104 | ||
105 | ||
ca7b8371 | 106 | //_______________________________________________________________________________________________________________ |
107 | AliTPCMonitorConfig::AliTPCMonitorConfig(const AliTPCMonitorConfig &config) : | |
108 | TNamed(config.GetName(),config.GetTitle()), | |
109 | fFormat(config.fFormat), | |
110 | fSector(config.fSector), | |
111 | fSectorLast(config.fSectorLast), | |
112 | fSectorLastDisplayed(config.fSectorLastDisplayed), | |
c60053f6 | 113 | fFileLast(config.fFileLast), |
ca7b8371 | 114 | fFileLastSet(config.fFileLastSet), |
c60053f6 | 115 | fFileCurrent(config.fFileCurrent), |
ca7b8371 | 116 | fEventNext(config.fEventNext), |
117 | fEventNextID(config.fEventNextID), | |
118 | fEventProcessed(config.fEventProcessed), | |
119 | fRangeMaxAdcMin(config.fRangeMaxAdcMin), | |
120 | fRangeMaxAdcMax(config.fRangeMaxAdcMax), | |
121 | fRangeBaseMin(config.fRangeBaseMin), | |
122 | fRangeBaseMax(config.fRangeBaseMax), | |
123 | fRangeSumMin(config.fRangeSumMin), | |
124 | fRangeSumMax(config.fRangeSumMax), | |
125 | fCanvasXSize(config.fCanvasXSize), | |
126 | fCanvasYSize(config.fCanvasYSize), | |
127 | fCanvasXSpace(config.fCanvasXSpace), | |
128 | fCanvasYSpace(config.fCanvasYSpace), | |
129 | fCanvasXOffset(config.fCanvasXOffset), | |
130 | fCanvasMainSize(config.fCanvasMainSize), | |
131 | fMainXSize(config.fMainXSize), | |
132 | fMainYSize(config.fMainYSize), | |
133 | fBorderXSize(config.fBorderXSize), | |
134 | fBorderYSize(config.fBorderYSize), | |
b718d136 | 135 | fButtonXSize(config.fButtonXSize), |
ca7b8371 | 136 | fButtonYSize(config.fButtonYSize), |
137 | fButtonFirstX1(config.fButtonFirstX1), | |
138 | fButtonFirstX2(config.fButtonFirstX2), | |
139 | fButtonFirstY(config.fButtonFirstY), | |
140 | fWrite10Bit(config.fWrite10Bit), | |
ca7b8371 | 141 | fSamplingFreq(config.fSamplingFreq), |
142 | fPedestals(config.fPedestals), | |
143 | fNumOfChannels(config.fNumOfChannels), | |
144 | fTimeBins(config.fTimeBins), | |
145 | fMaxHwAddr(config.fMaxHwAddr), | |
146 | fFitPulse(config.fFitPulse), | |
147 | fProcOneSector(config.fProcOneSector) | |
148 | { | |
149 | // copy constructor | |
ca7b8371 | 150 | |
6f19bddf | 151 | for(Int_t i =0; i<36; i++) { fSectorArr[i] = config.fSectorArr[i]; } |
152 | for(Int_t i =0; i<10;i++) { fComponents[i] = config.fComponents[i];} | |
ca7b8371 | 153 | |
154 | ||
155 | } | |
156 | //_______________________________________________________________________________________________________________ | |
157 | AliTPCMonitorConfig &AliTPCMonitorConfig::operator =(const AliTPCMonitorConfig& config) | |
158 | { | |
159 | // assignement operator | |
1359267b | 160 | if(this == &config) return *this; |
161 | ||
162 | TNamed::operator=(config); | |
163 | fFormat=config.fFormat; | |
164 | fSector=config.fSector; | |
165 | fSectorLast=config.fSectorLast; | |
166 | fSectorLastDisplayed=config.fSectorLastDisplayed; | |
1359267b | 167 | fFileLast= config.fFileLast; |
168 | fFileLastSet=config.fFileLastSet; | |
169 | fFileCurrent=config.fFileCurrent; | |
170 | fEventNext=config.fEventNext; | |
171 | fEventNextID=config.fEventNextID; | |
172 | fEventProcessed=config.fEventProcessed; | |
173 | fRangeMaxAdcMin=config.fRangeMaxAdcMin; | |
174 | fRangeMaxAdcMax=config.fRangeMaxAdcMax; | |
175 | fRangeBaseMin=config.fRangeBaseMin; | |
176 | fRangeBaseMax=config.fRangeBaseMax; | |
177 | fRangeSumMin=config.fRangeSumMin; | |
178 | fRangeSumMax=config.fRangeSumMax; | |
179 | fCanvasXSize=config.fCanvasXSize; | |
180 | fCanvasYSize=config.fCanvasYSize; | |
181 | fCanvasXSpace=config.fCanvasXSpace; | |
182 | fCanvasYSpace=config.fCanvasYSpace; | |
183 | fCanvasXOffset=config.fCanvasXOffset; | |
184 | fCanvasMainSize=config.fCanvasMainSize; | |
185 | fMainXSize=config.fMainXSize; | |
186 | fMainYSize=config.fMainYSize; | |
187 | fBorderXSize=config.fBorderXSize; | |
188 | fBorderYSize=config.fBorderYSize; | |
189 | fButtonXSize=config.fButtonXSize; | |
190 | fButtonYSize=config.fButtonYSize; | |
191 | fButtonFirstX1=config.fButtonFirstX1; | |
192 | fButtonFirstX2=config.fButtonFirstX2; | |
193 | fButtonFirstY=config.fButtonFirstY; | |
194 | fWrite10Bit=config.fWrite10Bit; | |
1359267b | 195 | fSamplingFreq=config.fSamplingFreq; |
196 | fPedestals=config.fPedestals; | |
197 | fNumOfChannels=config.fNumOfChannels; | |
198 | fTimeBins=config.fTimeBins; | |
199 | fMaxHwAddr=config.fMaxHwAddr; | |
200 | fFitPulse=config.fFitPulse; | |
201 | fProcOneSector=config.fProcOneSector; | |
202 | ||
6f19bddf | 203 | for(Int_t i =0; i<36; i++) { fSectorArr[i] = config.fSectorArr[i]; } |
204 | for(Int_t i =0; i<10;i++) { fComponents[i] = config.fComponents[i];} | |
ca7b8371 | 205 | |
ca7b8371 | 206 | return *this; |
207 | } | |
208 | ||
209 | ||
48265b32 | 210 | //_______________________________________________________________________________________________________________ |
211 | AliTPCMonitorConfig::~AliTPCMonitorConfig() | |
212 | { | |
213 | // Destructor | |
214 | } | |
215 | ||
216 | ||
217 | //_______________________________________________________________________________________________________________ | |
218 | void AliTPCMonitorConfig::SetMainSize(Int_t mainx, Int_t mainy, Int_t borderx=10, Int_t bordery=26) | |
219 | { | |
220 | // Set Size of Main window, buttons and canvases | |
221 | ||
222 | ||
223 | // size of main frame /////////////////////// | |
224 | fMainXSize = mainx; | |
225 | fMainYSize = mainy; | |
226 | ||
227 | // border size depending on window manager/// | |
228 | fBorderXSize = borderx; | |
229 | fBorderYSize = bordery; | |
230 | ||
231 | // y-pos of first sector button ///////////// | |
232 | fButtonFirstY = (int) (0.50*fMainYSize); | |
233 | ||
234 | // canvas size for Minitor Canvases /////////////////////// | |
235 | fCanvasMainSize = (Int_t)(fMainYSize/3); | |
236 | ||
237 | fCanvasXSize = (int)fCanvasMainSize; | |
238 | fCanvasYSize = (int)fCanvasMainSize; | |
239 | fCanvasXSpace = (int)(-1*(fCanvasMainSize+ fBorderXSize )); | |
240 | fCanvasYSpace = (int)( fCanvasMainSize+ fBorderYSize ); | |
241 | fCanvasXOffset = (int)(-1*(fMainXSize + fBorderXSize )); | |
242 | ||
243 | // adjust main size in y //////////////////// | |
244 | fMainYSize = fMainYSize+fBorderYSize; | |
245 | ||
246 | // y-size of the main window also defines /// | |
247 | fButtonXSize = (Int_t)(fMainXSize/2-10); | |
248 | fButtonYSize = (Int_t)fMainYSize/47; | |
249 | fButtonFirstX1 = 5; | |
250 | fButtonFirstX2 = fMainXSize/2+5; | |
251 | ||
252 | } | |
253 | ||
254 | //_______________________________________________________________________________________________________________ | |
ca7b8371 | 255 | void AliTPCMonitorConfig::SetBaseConfig(Float_t* confarr) |
48265b32 | 256 | { |
ca7b8371 | 257 | // Set base configuration stored in array confarr |
48265b32 | 258 | |
ca7b8371 | 259 | fRangeBaseMin = (int)confarr[0]; |
260 | fRangeBaseMax = (int)confarr[1]; | |
48265b32 | 261 | |
ca7b8371 | 262 | fRangeMaxAdcMin = (int)confarr[2]; |
263 | fRangeMaxAdcMax = (int)confarr[3]; | |
48265b32 | 264 | |
ca7b8371 | 265 | fRangeSumMin = (int)confarr[4]; |
266 | fRangeSumMax = (int)confarr[5]; | |
48265b32 | 267 | |
268 | cout << " Set Ranges to : " << endl; | |
269 | cout << " range base :: " << fRangeBaseMin << "\t : " << fRangeBaseMax << endl; | |
270 | cout << " range adc max :: " << fRangeMaxAdcMin << "\t : " << fRangeMaxAdcMax << endl; | |
271 | cout << " range sum :: " << fRangeSumMin << "\t : " << fRangeSumMax << endl; | |
272 | ||
273 | } | |
274 | ||
275 | //_______________________________________________________________________________________________________________ | |
c60053f6 | 276 | void AliTPCMonitorConfig::ReadConfig(const Char_t* nameconf) |
48265b32 | 277 | { |
278 | // Read base configuration from file | |
279 | // Update main window size | |
280 | ||
77f88633 | 281 | // string line; |
48265b32 | 282 | ifstream datin; |
283 | datin.open(nameconf); | |
284 | ||
6f19bddf | 285 | if(!datin.is_open()) { |
286 | AliWarning(Form("Could not read configfile '%s'",nameconf)); | |
287 | return; | |
288 | } | |
48265b32 | 289 | |
290 | cout << "//// Read Configuration ///////// " << endl; | |
291 | while(!datin.eof()) | |
6f19bddf | 292 | { |
293 | string line; | |
294 | getline(datin,line); | |
295 | if(line.find("max adc")!=string::npos) | |
296 | { | |
297 | datin >> fRangeMaxAdcMin ; | |
298 | datin >> fRangeMaxAdcMax ; | |
299 | cout << " range max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl; | |
300 | } | |
301 | ||
302 | if(line.find("baseline")!=string::npos) | |
303 | { | |
304 | datin >> fRangeBaseMin ; | |
305 | datin >> fRangeBaseMax ; | |
306 | cout << " range base :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl; | |
307 | } | |
308 | if(line.find("adc sum")!=string::npos) | |
309 | { | |
310 | datin >> fRangeSumMin ; | |
311 | datin >> fRangeSumMax ; | |
312 | cout << " range sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl; | |
313 | } | |
314 | if(line.find("frequency")!=string::npos) | |
315 | { | |
316 | datin >> fSamplingFreq ; | |
317 | cout << " sampling frequency :: " << fSamplingFreq << endl; | |
318 | } | |
319 | if(line.find("timebins")!=string::npos) | |
320 | { | |
321 | datin >> fTimeBins ; | |
322 | cout << " timebins :: " << fTimeBins << endl; | |
323 | } | |
324 | if(line.find("pedestal")!=string::npos) | |
325 | { | |
326 | datin >> fPedestals ; | |
327 | cout << " pedestal scheme :: " << fPedestals << endl; | |
328 | } | |
329 | if(line.find("main window size")!=string::npos) | |
330 | { | |
331 | datin >> fMainXSize ; | |
332 | datin >> fMainYSize ; | |
333 | cout << " main window size :: " << fMainXSize << " , " << fMainYSize << endl; | |
334 | } | |
335 | if(line.find("border size")!=string::npos) | |
48265b32 | 336 | { |
6f19bddf | 337 | datin >> fBorderXSize ; |
338 | datin >> fBorderYSize ; | |
339 | cout << " border size :: " << fBorderXSize << " , " << fBorderYSize << endl; | |
48265b32 | 340 | } |
6f19bddf | 341 | } |
48265b32 | 342 | cout << "//// Read Configuration done //// " << endl; |
343 | SetMainSize(fMainXSize,fMainYSize,fBorderXSize,fBorderYSize) ; | |
344 | } | |
345 | ||
346 | //_______________________________________________________________________________________________________________ | |
347 | void AliTPCMonitorConfig::PrintConfig() | |
348 | { | |
349 | // Print base configuration | |
350 | ||
351 | cout << " /////// Configuration /////////////////////////////// " << endl; | |
352 | cout << " Timebins :: " << fTimeBins << endl; | |
353 | cout << " Range to det ADC max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl; | |
354 | cout << " Range to det Baseline :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl; | |
355 | cout << " Range to det ADC sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl; | |
356 | cout << " Pedestal setting :: " << fPedestals << endl; | |
357 | cout << " Sampling Frequency :: " << fSamplingFreq << endl; | |
358 | cout << " Sector (Last) :: " << fSector <<" ("<< fSectorLast <<")" << endl; | |
359 | cout << " Data Format :: " << fFormat << endl; | |
360 | cout << " File current :: " << fFileCurrent << endl; | |
361 | ||
c60053f6 | 362 | if(fFileLastSet) { cout << " File last :: " << fFileLast.Data() << endl; } |
48265b32 | 363 | return; |
364 | ||
365 | } | |
366 | ||
367 | //______________________________________________________________________________________________________________ | |
c60053f6 | 368 | const Char_t* AliTPCMonitorConfig::GetLastProcFile() |
48265b32 | 369 | { |
370 | // Return name of last processed file | |
371 | // Get from file if written | |
372 | if(!fFileLastSet) | |
373 | { | |
c60053f6 | 374 | ifstream datin("AliTPCMonitorLastFile.txt"); |
ac940b58 | 375 | if(!datin.is_open()) { |
376 | AliWarning("Could not read file containing name of last processed file: Check permissions and path"); | |
c60053f6 | 377 | fFileLast=""; |
378 | fFileLastSet=0; | |
379 | return fFileLast.Data(); | |
ac940b58 | 380 | } |
48265b32 | 381 | datin >> fFileLast; |
382 | datin.close(); | |
383 | fFileLastSet=1; | |
384 | } | |
385 | return fFileLast; | |
386 | } | |
387 | ||
388 | //_______________________________________________________________________________________________________________ | |
c60053f6 | 389 | void AliTPCMonitorConfig::SetLastProcFile(const Char_t* file) |
48265b32 | 390 | { |
391 | // Set name of last processed file | |
392 | // Write name to a file | |
393 | ||
c60053f6 | 394 | fFileLast=file; |
395 | ofstream datout("AliTPCMonitorLastFile.txt"); | |
48265b32 | 396 | if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");} |
397 | datout << fFileLast << endl; | |
398 | datout.close(); | |
399 | fFileLastSet =1; | |
400 | } |