1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.2 2007/10/12 13:36:27 cvetan
19 Coding convention fixes from Stefan
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.
26 //////////////////////////////////////////////////////////////////////////
28 //// AliTPCMonitorConfig class
30 //// Configuration handler class for AliTPCMonitor
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.
37 //// Author: Stefan Kniege, IKF, Frankfurt
40 /////////////////////////////////////////////////////////////////////////
43 #include "AliTPCMonitorConfig.h"
45 #include <Riostream.h>
47 ClassImp(AliTPCMonitorConfig)
49 // _______________________________________________________________________________________________________________
50 AliTPCMonitorConfig::AliTPCMonitorConfig(const Char_t* name, const Char_t* title) :
55 fSectorLastDisplayed(-1),
56 fSectorArr(new Int_t[36]),
85 fComponents(new Float_t[10]),
86 fSamplingFreq(1000000),
88 fNumOfChannels(16000),
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;}
97 SetMainSize(130,720,10,26 );
102 //_______________________________________________________________________________________________________________
103 AliTPCMonitorConfig::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]),
110 fFileLast(config.fFileLast),
111 fFileLastSet(config.fFileLastSet),
112 fFileCurrent(config.fFileCurrent),
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),
132 fButtonXSize(config.fButtonXSize),
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)
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;}
154 //_______________________________________________________________________________________________________________
155 AliTPCMonitorConfig &AliTPCMonitorConfig::operator =(const AliTPCMonitorConfig& config)
157 // assignement operator
159 ((TNamed *)this)->operator=(config);
160 fFormat=config.fFormat;
161 fSector=config.fSector;
162 fSectorLast=config.fSectorLast;
163 fSectorLastDisplayed=config.fSectorLastDisplayed;
164 fSectorArr= new Int_t[36];
165 fFileLast= config.fFileLast;
166 fFileLastSet=config.fFileLastSet;
167 fFileCurrent=config.fFileCurrent;
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;
186 fBorderYSize=config.fBorderYSize;
187 fButtonXSize=config.fButtonXSize;
188 fButtonYSize=config.fButtonYSize;
189 fButtonFirstX1=config.fButtonFirstX1;
190 fButtonFirstX2=config.fButtonFirstX2;
191 fButtonFirstY=config.fButtonFirstY;
192 fWrite10Bit=config.fWrite10Bit;
193 fComponents= new Float_t[10];
194 fSamplingFreq=config.fSamplingFreq;
195 fPedestals=config.fPedestals;
196 fNumOfChannels=config.fNumOfChannels;
197 fTimeBins=config.fTimeBins;
198 fMaxHwAddr=config.fMaxHwAddr;
199 fFitPulse=config.fFitPulse;
200 fProcOneSector=config.fProcOneSector;
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;}
212 //_______________________________________________________________________________________________________________
213 AliTPCMonitorConfig::~AliTPCMonitorConfig()
217 delete[] fComponents;
221 //_______________________________________________________________________________________________________________
222 void AliTPCMonitorConfig::SetMainSize(Int_t mainx, Int_t mainy, Int_t borderx=10, Int_t bordery=26)
224 // Set Size of Main window, buttons and canvases
227 // size of main frame ///////////////////////
231 // border size depending on window manager///
232 fBorderXSize = borderx;
233 fBorderYSize = bordery;
235 // y-pos of first sector button /////////////
236 fButtonFirstY = (int) (0.50*fMainYSize);
238 // canvas size for Minitor Canvases ///////////////////////
239 fCanvasMainSize = (Int_t)(fMainYSize/3);
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 ));
247 // adjust main size in y ////////////////////
248 fMainYSize = fMainYSize+fBorderYSize;
250 // y-size of the main window also defines ///
251 fButtonXSize = (Int_t)(fMainXSize/2-10);
252 fButtonYSize = (Int_t)fMainYSize/47;
254 fButtonFirstX2 = fMainXSize/2+5;
258 //_______________________________________________________________________________________________________________
259 void AliTPCMonitorConfig::SetBaseConfig(Float_t* confarr)
261 // Set base configuration stored in array confarr
263 fRangeBaseMin = (int)confarr[0];
264 fRangeBaseMax = (int)confarr[1];
266 fRangeMaxAdcMin = (int)confarr[2];
267 fRangeMaxAdcMax = (int)confarr[3];
269 fRangeSumMin = (int)confarr[4];
270 fRangeSumMax = (int)confarr[5];
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;
279 //_______________________________________________________________________________________________________________
280 void AliTPCMonitorConfig::ReadConfig(const Char_t* nameconf)
282 // Read base configuration from file
283 // Update main window size
287 datin.open(nameconf);
289 if(!datin) { AliWarning("Could not read configfile");}
291 cout << "//// Read Configuration ///////// " << endl;
296 if(line.find("max adc")!=string::npos)
298 datin >> fRangeMaxAdcMin ;
299 datin >> fRangeMaxAdcMax ;
300 cout << " range max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
303 if(line.find("baseline")!=string::npos)
305 datin >> fRangeBaseMin ;
306 datin >> fRangeBaseMax ;
307 cout << " range base :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
309 if(line.find("adc sum")!=string::npos)
311 datin >> fRangeSumMin ;
312 datin >> fRangeSumMax ;
313 cout << " range sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
315 if(line.find("frequency")!=string::npos)
317 datin >> fSamplingFreq ;
318 cout << " sampling frequency :: " << fSamplingFreq << endl;
320 if(line.find("timebins")!=string::npos)
323 cout << " timebins :: " << fTimeBins << endl;
325 if(line.find("pedestal")!=string::npos)
327 datin >> fPedestals ;
328 cout << " pedestal scheme :: " << fPedestals << endl;
330 if(line.find("main window size")!=string::npos)
332 datin >> fMainXSize ;
333 datin >> fMainYSize ;
334 cout << " main window size :: " << fMainXSize << " , " << fMainYSize << endl;
336 if(line.find("border size")!=string::npos)
338 datin >> fBorderXSize ;
339 datin >> fBorderYSize ;
340 cout << " border size :: " << fBorderXSize << " , " << fBorderYSize << endl;
343 cout << "//// Read Configuration done //// " << endl;
344 SetMainSize(fMainXSize,fMainYSize,fBorderXSize,fBorderYSize) ;
347 //_______________________________________________________________________________________________________________
348 void AliTPCMonitorConfig::PrintConfig()
350 // Print base configuration
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;
363 if(fFileLastSet) { cout << " File last :: " << fFileLast.Data() << endl; }
368 //______________________________________________________________________________________________________________
369 const Char_t* AliTPCMonitorConfig::GetLastProcFile()
371 // Return name of last processed file
372 // Get from file if written
375 ifstream datin("AliTPCMonitorLastFile.txt");
376 if(!datin.is_open()) {
377 AliWarning("Could not read file containing name of last processed file: Check permissions and path");
380 return fFileLast.Data();
389 //_______________________________________________________________________________________________________________
390 void AliTPCMonitorConfig::SetLastProcFile(const Char_t* file)
392 // Set name of last processed file
393 // Write name to a file
396 ofstream datout("AliTPCMonitorLastFile.txt");
397 if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");}
398 datout << fFileLast << endl;