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
158 if(this == &config) return *this;
160 TNamed::operator=(config);
161 fFormat=config.fFormat;
162 fSector=config.fSector;
163 fSectorLast=config.fSectorLast;
164 fSectorLastDisplayed=config.fSectorLastDisplayed;
165 if (!fSectorArr) fSectorArr= new Int_t[36];
166 fFileLast= config.fFileLast;
167 fFileLastSet=config.fFileLastSet;
168 fFileCurrent=config.fFileCurrent;
169 fEventNext=config.fEventNext;
170 fEventNextID=config.fEventNextID;
171 fEventProcessed=config.fEventProcessed;
172 fRangeMaxAdcMin=config.fRangeMaxAdcMin;
173 fRangeMaxAdcMax=config.fRangeMaxAdcMax;
174 fRangeBaseMin=config.fRangeBaseMin;
175 fRangeBaseMax=config.fRangeBaseMax;
176 fRangeSumMin=config.fRangeSumMin;
177 fRangeSumMax=config.fRangeSumMax;
178 fCanvasXSize=config.fCanvasXSize;
179 fCanvasYSize=config.fCanvasYSize;
180 fCanvasXSpace=config.fCanvasXSpace;
181 fCanvasYSpace=config.fCanvasYSpace;
182 fCanvasXOffset=config.fCanvasXOffset;
183 fCanvasMainSize=config.fCanvasMainSize;
184 fMainXSize=config.fMainXSize;
185 fMainYSize=config.fMainYSize;
186 fBorderXSize=config.fBorderXSize;
187 fBorderYSize=config.fBorderYSize;
188 fButtonXSize=config.fButtonXSize;
189 fButtonYSize=config.fButtonYSize;
190 fButtonFirstX1=config.fButtonFirstX1;
191 fButtonFirstX2=config.fButtonFirstX2;
192 fButtonFirstY=config.fButtonFirstY;
193 fWrite10Bit=config.fWrite10Bit;
194 if (!fComponents) fComponents= new Float_t[10];
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] = 0;}
204 for(Int_t i =0; i<10;i++) { fComponents[i] = 0.;}
210 //_______________________________________________________________________________________________________________
211 AliTPCMonitorConfig::~AliTPCMonitorConfig()
215 delete[] fComponents;
219 //_______________________________________________________________________________________________________________
220 void AliTPCMonitorConfig::SetMainSize(Int_t mainx, Int_t mainy, Int_t borderx=10, Int_t bordery=26)
222 // Set Size of Main window, buttons and canvases
225 // size of main frame ///////////////////////
229 // border size depending on window manager///
230 fBorderXSize = borderx;
231 fBorderYSize = bordery;
233 // y-pos of first sector button /////////////
234 fButtonFirstY = (int) (0.50*fMainYSize);
236 // canvas size for Minitor Canvases ///////////////////////
237 fCanvasMainSize = (Int_t)(fMainYSize/3);
239 fCanvasXSize = (int)fCanvasMainSize;
240 fCanvasYSize = (int)fCanvasMainSize;
241 fCanvasXSpace = (int)(-1*(fCanvasMainSize+ fBorderXSize ));
242 fCanvasYSpace = (int)( fCanvasMainSize+ fBorderYSize );
243 fCanvasXOffset = (int)(-1*(fMainXSize + fBorderXSize ));
245 // adjust main size in y ////////////////////
246 fMainYSize = fMainYSize+fBorderYSize;
248 // y-size of the main window also defines ///
249 fButtonXSize = (Int_t)(fMainXSize/2-10);
250 fButtonYSize = (Int_t)fMainYSize/47;
252 fButtonFirstX2 = fMainXSize/2+5;
256 //_______________________________________________________________________________________________________________
257 void AliTPCMonitorConfig::SetBaseConfig(Float_t* confarr)
259 // Set base configuration stored in array confarr
261 fRangeBaseMin = (int)confarr[0];
262 fRangeBaseMax = (int)confarr[1];
264 fRangeMaxAdcMin = (int)confarr[2];
265 fRangeMaxAdcMax = (int)confarr[3];
267 fRangeSumMin = (int)confarr[4];
268 fRangeSumMax = (int)confarr[5];
270 cout << " Set Ranges to : " << endl;
271 cout << " range base :: " << fRangeBaseMin << "\t : " << fRangeBaseMax << endl;
272 cout << " range adc max :: " << fRangeMaxAdcMin << "\t : " << fRangeMaxAdcMax << endl;
273 cout << " range sum :: " << fRangeSumMin << "\t : " << fRangeSumMax << endl;
277 //_______________________________________________________________________________________________________________
278 void AliTPCMonitorConfig::ReadConfig(const Char_t* nameconf)
280 // Read base configuration from file
281 // Update main window size
285 datin.open(nameconf);
287 if(!datin) { AliWarning("Could not read configfile");}
289 cout << "//// Read Configuration ///////// " << endl;
294 if(line.find("max adc")!=string::npos)
296 datin >> fRangeMaxAdcMin ;
297 datin >> fRangeMaxAdcMax ;
298 cout << " range max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
301 if(line.find("baseline")!=string::npos)
303 datin >> fRangeBaseMin ;
304 datin >> fRangeBaseMax ;
305 cout << " range base :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
307 if(line.find("adc sum")!=string::npos)
309 datin >> fRangeSumMin ;
310 datin >> fRangeSumMax ;
311 cout << " range sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
313 if(line.find("frequency")!=string::npos)
315 datin >> fSamplingFreq ;
316 cout << " sampling frequency :: " << fSamplingFreq << endl;
318 if(line.find("timebins")!=string::npos)
321 cout << " timebins :: " << fTimeBins << endl;
323 if(line.find("pedestal")!=string::npos)
325 datin >> fPedestals ;
326 cout << " pedestal scheme :: " << fPedestals << endl;
328 if(line.find("main window size")!=string::npos)
330 datin >> fMainXSize ;
331 datin >> fMainYSize ;
332 cout << " main window size :: " << fMainXSize << " , " << fMainYSize << endl;
334 if(line.find("border size")!=string::npos)
336 datin >> fBorderXSize ;
337 datin >> fBorderYSize ;
338 cout << " border size :: " << fBorderXSize << " , " << fBorderYSize << endl;
341 cout << "//// Read Configuration done //// " << endl;
342 SetMainSize(fMainXSize,fMainYSize,fBorderXSize,fBorderYSize) ;
345 //_______________________________________________________________________________________________________________
346 void AliTPCMonitorConfig::PrintConfig()
348 // Print base configuration
350 cout << " /////// Configuration /////////////////////////////// " << endl;
351 cout << " Timebins :: " << fTimeBins << endl;
352 cout << " Range to det ADC max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
353 cout << " Range to det Baseline :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
354 cout << " Range to det ADC sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
355 cout << " Pedestal setting :: " << fPedestals << endl;
356 cout << " Sampling Frequency :: " << fSamplingFreq << endl;
357 cout << " Sector (Last) :: " << fSector <<" ("<< fSectorLast <<")" << endl;
358 cout << " Data Format :: " << fFormat << endl;
359 cout << " File current :: " << fFileCurrent << endl;
361 if(fFileLastSet) { cout << " File last :: " << fFileLast.Data() << endl; }
366 //______________________________________________________________________________________________________________
367 const Char_t* AliTPCMonitorConfig::GetLastProcFile()
369 // Return name of last processed file
370 // Get from file if written
373 ifstream datin("AliTPCMonitorLastFile.txt");
374 if(!datin.is_open()) {
375 AliWarning("Could not read file containing name of last processed file: Check permissions and path");
378 return fFileLast.Data();
387 //_______________________________________________________________________________________________________________
388 void AliTPCMonitorConfig::SetLastProcFile(const Char_t* file)
390 // Set name of last processed file
391 // Write name to a file
394 ofstream datout("AliTPCMonitorLastFile.txt");
395 if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");}
396 datout << fFileLast << endl;