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.fBorderXSize),
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 fFileLastSet=config.fFileLastSet;
165 fEventNext=config.fEventNext;
166 fEventNextID=config.fEventNextID;
167 fEventProcessed=config.fEventProcessed;
168 fRangeMaxAdcMin=config.fRangeMaxAdcMin;
169 fRangeMaxAdcMax=config.fRangeMaxAdcMax;
170 fRangeBaseMin=config.fRangeBaseMin;
171 fRangeBaseMax=config.fRangeBaseMax;
172 fRangeSumMin=config.fRangeSumMin;
173 fRangeSumMax=config.fRangeSumMax;
174 fCanvasXSize=config.fCanvasXSize;
175 fCanvasYSize=config.fCanvasYSize;
176 fCanvasXSpace=config.fCanvasXSpace;
177 fCanvasYSpace=config.fCanvasYSpace;
178 fCanvasXOffset=config.fCanvasXOffset;
179 fCanvasMainSize=config.fCanvasMainSize;
180 fMainXSize=config.fMainXSize;
181 fMainYSize=config.fMainYSize;
182 fBorderXSize=config.fBorderXSize;
183 fButtonYSize=config.fButtonYSize;
184 fButtonFirstX1=config.fButtonFirstX1;
185 fButtonFirstX2=config.fButtonFirstX2;
186 fButtonFirstY=config.fButtonFirstY;
187 fWrite10Bit=config.fWrite10Bit;
188 fPedestals=config.fPedestals;
189 fNumOfChannels=config.fNumOfChannels;
190 fTimeBins=config.fTimeBins;
191 fMaxHwAddr=config.fMaxHwAddr;
192 fFitPulse=config.fFitPulse;
193 fProcOneSector=config.fProcOneSector;
195 fFileLast = config.fFileLast;
196 fFileCurrent = config.fFileCurrent;
198 fSectorArr = new Int_t[36]; for(Int_t i =0; i<36; i++) { fSectorArr[i] = 0;}
199 fComponents = new Float_t[10]; for(Int_t i =0; i<10;i++) { fComponents[i] =0.0;}
207 //_______________________________________________________________________________________________________________
208 AliTPCMonitorConfig::~AliTPCMonitorConfig()
212 delete[] fComponents;
216 //_______________________________________________________________________________________________________________
217 void AliTPCMonitorConfig::SetMainSize(Int_t mainx, Int_t mainy, Int_t borderx=10, Int_t bordery=26)
219 // Set Size of Main window, buttons and canvases
222 // size of main frame ///////////////////////
226 // border size depending on window manager///
227 fBorderXSize = borderx;
228 fBorderYSize = bordery;
230 // y-pos of first sector button /////////////
231 fButtonFirstY = (int) (0.50*fMainYSize);
233 // canvas size for Minitor Canvases ///////////////////////
234 fCanvasMainSize = (Int_t)(fMainYSize/3);
236 fCanvasXSize = (int)fCanvasMainSize;
237 fCanvasYSize = (int)fCanvasMainSize;
238 fCanvasXSpace = (int)(-1*(fCanvasMainSize+ fBorderXSize ));
239 fCanvasYSpace = (int)( fCanvasMainSize+ fBorderYSize );
240 fCanvasXOffset = (int)(-1*(fMainXSize + fBorderXSize ));
242 // adjust main size in y ////////////////////
243 fMainYSize = fMainYSize+fBorderYSize;
245 // y-size of the main window also defines ///
246 fButtonXSize = (Int_t)(fMainXSize/2-10);
247 fButtonYSize = (Int_t)fMainYSize/47;
249 fButtonFirstX2 = fMainXSize/2+5;
253 //_______________________________________________________________________________________________________________
254 void AliTPCMonitorConfig::SetBaseConfig(Float_t* confarr)
256 // Set base configuration stored in array confarr
258 fRangeBaseMin = (int)confarr[0];
259 fRangeBaseMax = (int)confarr[1];
261 fRangeMaxAdcMin = (int)confarr[2];
262 fRangeMaxAdcMax = (int)confarr[3];
264 fRangeSumMin = (int)confarr[4];
265 fRangeSumMax = (int)confarr[5];
267 cout << " Set Ranges to : " << endl;
268 cout << " range base :: " << fRangeBaseMin << "\t : " << fRangeBaseMax << endl;
269 cout << " range adc max :: " << fRangeMaxAdcMin << "\t : " << fRangeMaxAdcMax << endl;
270 cout << " range sum :: " << fRangeSumMin << "\t : " << fRangeSumMax << endl;
274 //_______________________________________________________________________________________________________________
275 void AliTPCMonitorConfig::ReadConfig(const Char_t* nameconf)
277 // Read base configuration from file
278 // Update main window size
282 datin.open(nameconf);
284 if(!datin) { AliWarning("Could not read configfile");}
286 cout << "//// Read Configuration ///////// " << endl;
291 if(line.find("max adc")!=string::npos)
293 datin >> fRangeMaxAdcMin ;
294 datin >> fRangeMaxAdcMax ;
295 cout << " range max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
298 if(line.find("baseline")!=string::npos)
300 datin >> fRangeBaseMin ;
301 datin >> fRangeBaseMax ;
302 cout << " range base :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
304 if(line.find("adc sum")!=string::npos)
306 datin >> fRangeSumMin ;
307 datin >> fRangeSumMax ;
308 cout << " range sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
310 if(line.find("frequency")!=string::npos)
312 datin >> fSamplingFreq ;
313 cout << " sampling frequency :: " << fSamplingFreq << endl;
315 if(line.find("timebins")!=string::npos)
318 cout << " timebins :: " << fTimeBins << endl;
320 if(line.find("pedestal")!=string::npos)
322 datin >> fPedestals ;
323 cout << " pedestal scheme :: " << fPedestals << endl;
325 if(line.find("main window size")!=string::npos)
327 datin >> fMainXSize ;
328 datin >> fMainYSize ;
329 cout << " main window size :: " << fMainXSize << " , " << fMainYSize << endl;
331 if(line.find("border size")!=string::npos)
333 datin >> fBorderXSize ;
334 datin >> fBorderYSize ;
335 cout << " border size :: " << fBorderXSize << " , " << fBorderYSize << endl;
338 cout << "//// Read Configuration done //// " << endl;
339 SetMainSize(fMainXSize,fMainYSize,fBorderXSize,fBorderYSize) ;
342 //_______________________________________________________________________________________________________________
343 void AliTPCMonitorConfig::PrintConfig()
345 // Print base configuration
347 cout << " /////// Configuration /////////////////////////////// " << endl;
348 cout << " Timebins :: " << fTimeBins << endl;
349 cout << " Range to det ADC max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
350 cout << " Range to det Baseline :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
351 cout << " Range to det ADC sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
352 cout << " Pedestal setting :: " << fPedestals << endl;
353 cout << " Sampling Frequency :: " << fSamplingFreq << endl;
354 cout << " Sector (Last) :: " << fSector <<" ("<< fSectorLast <<")" << endl;
355 cout << " Data Format :: " << fFormat << endl;
356 cout << " File current :: " << fFileCurrent << endl;
358 if(fFileLastSet) { cout << " File last :: " << fFileLast.Data() << endl; }
363 //______________________________________________________________________________________________________________
364 const Char_t* AliTPCMonitorConfig::GetLastProcFile()
366 // Return name of last processed file
367 // Get from file if written
370 ifstream datin("AliTPCMonitorLastFile.txt");
371 if(!datin.is_open()) {
372 AliWarning("Could not read file containing name of last processed file: Check permissions and path");
375 return fFileLast.Data();
384 //_______________________________________________________________________________________________________________
385 void AliTPCMonitorConfig::SetLastProcFile(const Char_t* file)
387 // Set name of last processed file
388 // Write name to a file
391 ofstream datout("AliTPCMonitorLastFile.txt");
392 if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");}
393 datout << fFileLast << endl;