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