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