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>
53 ClassImp(AliTPCMonitorConfig)
55 // _______________________________________________________________________________________________________________
56 AliTPCMonitorConfig::AliTPCMonitorConfig(const Char_t* name, const Char_t* title) :
61 fSectorLastDisplayed(-1),
90 fSamplingFreq(1000000),
92 fNumOfChannels(16000),
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;}
101 SetMainSize(130,720,10,26 );
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),
113 fFileLast(config.fFileLast),
114 fFileLastSet(config.fFileLastSet),
115 fFileCurrent(config.fFileCurrent),
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),
135 fButtonXSize(config.fButtonXSize),
136 fButtonYSize(config.fButtonYSize),
137 fButtonFirstX1(config.fButtonFirstX1),
138 fButtonFirstX2(config.fButtonFirstX2),
139 fButtonFirstY(config.fButtonFirstY),
140 fWrite10Bit(config.fWrite10Bit),
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)
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];}
156 //_______________________________________________________________________________________________________________
157 AliTPCMonitorConfig &AliTPCMonitorConfig::operator =(const AliTPCMonitorConfig& config)
159 // assignement operator
160 if(this == &config) return *this;
162 TNamed::operator=(config);
163 fFormat=config.fFormat;
164 fSector=config.fSector;
165 fSectorLast=config.fSectorLast;
166 fSectorLastDisplayed=config.fSectorLastDisplayed;
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;
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;
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];}
210 //_______________________________________________________________________________________________________________
211 AliTPCMonitorConfig::~AliTPCMonitorConfig()
217 //_______________________________________________________________________________________________________________
218 void AliTPCMonitorConfig::SetMainSize(Int_t mainx, Int_t mainy, Int_t borderx=10, Int_t bordery=26)
220 // Set Size of Main window, buttons and canvases
223 // size of main frame ///////////////////////
227 // border size depending on window manager///
228 fBorderXSize = borderx;
229 fBorderYSize = bordery;
231 // y-pos of first sector button /////////////
232 fButtonFirstY = (int) (0.50*fMainYSize);
234 // canvas size for Minitor Canvases ///////////////////////
235 fCanvasMainSize = (Int_t)(fMainYSize/3);
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 ));
243 // adjust main size in y ////////////////////
244 fMainYSize = fMainYSize+fBorderYSize;
246 // y-size of the main window also defines ///
247 fButtonXSize = (Int_t)(fMainXSize/2-10);
248 fButtonYSize = (Int_t)fMainYSize/47;
250 fButtonFirstX2 = fMainXSize/2+5;
254 //_______________________________________________________________________________________________________________
255 void AliTPCMonitorConfig::SetBaseConfig(Float_t* confarr)
257 // Set base configuration stored in array confarr
259 fRangeBaseMin = (int)confarr[0];
260 fRangeBaseMax = (int)confarr[1];
262 fRangeMaxAdcMin = (int)confarr[2];
263 fRangeMaxAdcMax = (int)confarr[3];
265 fRangeSumMin = (int)confarr[4];
266 fRangeSumMax = (int)confarr[5];
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;
275 //_______________________________________________________________________________________________________________
276 void AliTPCMonitorConfig::ReadConfig(const Char_t* nameconf)
278 // Read base configuration from file
279 // Update main window size
283 datin.open(nameconf);
285 if(!datin.is_open()) {
286 AliWarning(Form("Could not read configfile '%s'",nameconf));
290 cout << "//// Read Configuration ///////// " << endl;
295 if(line.find("max adc")!=string::npos)
297 datin >> fRangeMaxAdcMin ;
298 datin >> fRangeMaxAdcMax ;
299 cout << " range max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
302 if(line.find("baseline")!=string::npos)
304 datin >> fRangeBaseMin ;
305 datin >> fRangeBaseMax ;
306 cout << " range base :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
308 if(line.find("adc sum")!=string::npos)
310 datin >> fRangeSumMin ;
311 datin >> fRangeSumMax ;
312 cout << " range sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
314 if(line.find("frequency")!=string::npos)
316 datin >> fSamplingFreq ;
317 cout << " sampling frequency :: " << fSamplingFreq << endl;
319 if(line.find("timebins")!=string::npos)
322 cout << " timebins :: " << fTimeBins << endl;
324 if(line.find("pedestal")!=string::npos)
326 datin >> fPedestals ;
327 cout << " pedestal scheme :: " << fPedestals << endl;
329 if(line.find("main window size")!=string::npos)
331 datin >> fMainXSize ;
332 datin >> fMainYSize ;
333 cout << " main window size :: " << fMainXSize << " , " << fMainYSize << endl;
335 if(line.find("border size")!=string::npos)
337 datin >> fBorderXSize ;
338 datin >> fBorderYSize ;
339 cout << " border size :: " << fBorderXSize << " , " << fBorderYSize << endl;
342 cout << "//// Read Configuration done //// " << endl;
343 SetMainSize(fMainXSize,fMainYSize,fBorderXSize,fBorderYSize) ;
346 //_______________________________________________________________________________________________________________
347 void AliTPCMonitorConfig::PrintConfig()
349 // Print base configuration
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;
362 if(fFileLastSet) { cout << " File last :: " << fFileLast.Data() << endl; }
367 //______________________________________________________________________________________________________________
368 const Char_t* AliTPCMonitorConfig::GetLastProcFile()
370 // Return name of last processed file
371 // Get from file if written
374 ifstream datin("AliTPCMonitorLastFile.txt");
375 if(!datin.is_open()) {
376 AliWarning("Could not read file containing name of last processed file: Check permissions and path");
379 return fFileLast.Data();
388 //_______________________________________________________________________________________________________________
389 void AliTPCMonitorConfig::SetLastProcFile(const Char_t* file)
391 // Set name of last processed file
392 // Write name to a file
395 ofstream datout("AliTPCMonitorLastFile.txt");
396 if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");}
397 datout << fFileLast << endl;