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),
84 fSamplingFreq(1000000),
86 fNumOfChannels(16000),
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;}
95 SetMainSize(130,720,10,26 );
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),
107 fFileLast(config.fFileLast),
108 fFileLastSet(config.fFileLastSet),
109 fFileCurrent(config.fFileCurrent),
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),
129 fButtonXSize(config.fButtonXSize),
130 fButtonYSize(config.fButtonYSize),
131 fButtonFirstX1(config.fButtonFirstX1),
132 fButtonFirstX2(config.fButtonFirstX2),
133 fButtonFirstY(config.fButtonFirstY),
134 fWrite10Bit(config.fWrite10Bit),
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)
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];}
150 //_______________________________________________________________________________________________________________
151 AliTPCMonitorConfig &AliTPCMonitorConfig::operator =(const AliTPCMonitorConfig& config)
153 // assignement operator
154 if(this == &config) return *this;
156 TNamed::operator=(config);
157 fFormat=config.fFormat;
158 fSector=config.fSector;
159 fSectorLast=config.fSectorLast;
160 fSectorLastDisplayed=config.fSectorLastDisplayed;
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;
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;
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];}
204 //_______________________________________________________________________________________________________________
205 AliTPCMonitorConfig::~AliTPCMonitorConfig()
211 //_______________________________________________________________________________________________________________
212 void AliTPCMonitorConfig::SetMainSize(Int_t mainx, Int_t mainy, Int_t borderx=10, Int_t bordery=26)
214 // Set Size of Main window, buttons and canvases
217 // size of main frame ///////////////////////
221 // border size depending on window manager///
222 fBorderXSize = borderx;
223 fBorderYSize = bordery;
225 // y-pos of first sector button /////////////
226 fButtonFirstY = (int) (0.50*fMainYSize);
228 // canvas size for Minitor Canvases ///////////////////////
229 fCanvasMainSize = (Int_t)(fMainYSize/3);
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 ));
237 // adjust main size in y ////////////////////
238 fMainYSize = fMainYSize+fBorderYSize;
240 // y-size of the main window also defines ///
241 fButtonXSize = (Int_t)(fMainXSize/2-10);
242 fButtonYSize = (Int_t)fMainYSize/47;
244 fButtonFirstX2 = fMainXSize/2+5;
248 //_______________________________________________________________________________________________________________
249 void AliTPCMonitorConfig::SetBaseConfig(Float_t* confarr)
251 // Set base configuration stored in array confarr
253 fRangeBaseMin = (int)confarr[0];
254 fRangeBaseMax = (int)confarr[1];
256 fRangeMaxAdcMin = (int)confarr[2];
257 fRangeMaxAdcMax = (int)confarr[3];
259 fRangeSumMin = (int)confarr[4];
260 fRangeSumMax = (int)confarr[5];
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;
269 //_______________________________________________________________________________________________________________
270 void AliTPCMonitorConfig::ReadConfig(const Char_t* nameconf)
272 // Read base configuration from file
273 // Update main window size
277 datin.open(nameconf);
279 if(!datin.is_open()) {
280 AliWarning(Form("Could not read configfile '%s'",nameconf));
284 cout << "//// Read Configuration ///////// " << endl;
289 if(line.find("max adc")!=string::npos)
291 datin >> fRangeMaxAdcMin ;
292 datin >> fRangeMaxAdcMax ;
293 cout << " range max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
296 if(line.find("baseline")!=string::npos)
298 datin >> fRangeBaseMin ;
299 datin >> fRangeBaseMax ;
300 cout << " range base :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
302 if(line.find("adc sum")!=string::npos)
304 datin >> fRangeSumMin ;
305 datin >> fRangeSumMax ;
306 cout << " range sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
308 if(line.find("frequency")!=string::npos)
310 datin >> fSamplingFreq ;
311 cout << " sampling frequency :: " << fSamplingFreq << endl;
313 if(line.find("timebins")!=string::npos)
316 cout << " timebins :: " << fTimeBins << endl;
318 if(line.find("pedestal")!=string::npos)
320 datin >> fPedestals ;
321 cout << " pedestal scheme :: " << fPedestals << endl;
323 if(line.find("main window size")!=string::npos)
325 datin >> fMainXSize ;
326 datin >> fMainYSize ;
327 cout << " main window size :: " << fMainXSize << " , " << fMainYSize << endl;
329 if(line.find("border size")!=string::npos)
331 datin >> fBorderXSize ;
332 datin >> fBorderYSize ;
333 cout << " border size :: " << fBorderXSize << " , " << fBorderYSize << endl;
336 cout << "//// Read Configuration done //// " << endl;
337 SetMainSize(fMainXSize,fMainYSize,fBorderXSize,fBorderYSize) ;
340 //_______________________________________________________________________________________________________________
341 void AliTPCMonitorConfig::PrintConfig()
343 // Print base configuration
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;
356 if(fFileLastSet) { cout << " File last :: " << fFileLast.Data() << endl; }
361 //______________________________________________________________________________________________________________
362 const Char_t* AliTPCMonitorConfig::GetLastProcFile()
364 // Return name of last processed file
365 // Get from file if written
368 ifstream datin("AliTPCMonitorLastFile.txt");
369 if(!datin.is_open()) {
370 AliWarning("Could not read file containing name of last processed file: Check permissions and path");
373 return fFileLast.Data();
382 //_______________________________________________________________________________________________________________
383 void AliTPCMonitorConfig::SetLastProcFile(const Char_t* file)
385 // Set name of last processed file
386 // Write name to a file
389 ofstream datout("AliTPCMonitorLastFile.txt");
390 if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");}
391 datout << fFileLast << endl;