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 **************************************************************************/
20 #include "AliTPCMonitorConfig.h"
21 ClassImp(AliTPCMonitorConfig)
23 //_______________________________________________________________________________________________________________
24 AliTPCMonitorConfig::AliTPCMonitorConfig(Char_t* name, Char_t* title) : TNamed(name,title)
28 // Set default values for Size of Window
30 fRangeMaxAdcMin = 50 ;
31 fRangeMaxAdcMax = 100 ;
45 SetMainSize(130,720,10,26 );
47 fFileLast = new Char_t[256] ;
49 fFileCurrent = new Char_t[256];
52 fSectorLastDisplayed =-1;
56 fSectorArr = new Int_t[36]; for(Int_t i =0; i<36; i++) { fSectorArr[i] = 0;}
57 fComponents = new Float_t[10]; for(Int_t i =0; i<10;i++) { fComponents[i] =0.0;}
59 fSamplingFreq = 1000000;
62 fNumOfChannels = 16000;
71 //_______________________________________________________________________________________________________________
72 AliTPCMonitorConfig::~AliTPCMonitorConfig()
78 //_______________________________________________________________________________________________________________
79 void AliTPCMonitorConfig::SetMainSize(Int_t mainx, Int_t mainy, Int_t borderx=10, Int_t bordery=26)
81 // Set Size of Main window, buttons and canvases
84 // size of main frame ///////////////////////
88 // border size depending on window manager///
89 fBorderXSize = borderx;
90 fBorderYSize = bordery;
92 // y-pos of first sector button /////////////
93 fButtonFirstY = (int) (0.50*fMainYSize);
95 // canvas size for Minitor Canvases ///////////////////////
96 fCanvasMainSize = (Int_t)(fMainYSize/3);
98 fCanvasXSize = (int)fCanvasMainSize;
99 fCanvasYSize = (int)fCanvasMainSize;
100 fCanvasXSpace = (int)(-1*(fCanvasMainSize+ fBorderXSize ));
101 fCanvasYSpace = (int)( fCanvasMainSize+ fBorderYSize );
102 fCanvasXOffset = (int)(-1*(fMainXSize + fBorderXSize ));
104 // adjust main size in y ////////////////////
105 fMainYSize = fMainYSize+fBorderYSize;
107 // y-size of the main window also defines ///
108 fButtonXSize = (Int_t)(fMainXSize/2-10);
109 fButtonYSize = (Int_t)fMainYSize/47;
111 fButtonFirstX2 = fMainXSize/2+5;
115 //_______________________________________________________________________________________________________________
116 void AliTPCMonitorConfig::SetBaseConfig(Float_t* conf_arr)
118 // Set base configuration stored in array conf_arr
120 fRangeBaseMin = (int)conf_arr[0];
121 fRangeBaseMax = (int)conf_arr[1];
123 fRangeMaxAdcMin = (int)conf_arr[2];
124 fRangeMaxAdcMax = (int)conf_arr[3];
126 fRangeSumMin = (int)conf_arr[4];
127 fRangeSumMax = (int)conf_arr[5];
129 cout << " Set Ranges to : " << endl;
130 cout << " range base :: " << fRangeBaseMin << "\t : " << fRangeBaseMax << endl;
131 cout << " range adc max :: " << fRangeMaxAdcMin << "\t : " << fRangeMaxAdcMax << endl;
132 cout << " range sum :: " << fRangeSumMin << "\t : " << fRangeSumMax << endl;
136 //_______________________________________________________________________________________________________________
137 void AliTPCMonitorConfig::ReadConfig(Char_t* nameconf)
139 // Read base configuration from file
140 // Update main window size
144 datin.open(nameconf);
146 if(!datin) { AliWarning("Could not read configfile");}
148 cout << "//// Read Configuration ///////// " << endl;
153 if(line.find("max adc")!=string::npos)
155 datin >> fRangeMaxAdcMin ;
156 datin >> fRangeMaxAdcMax ;
157 cout << " range max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
160 if(line.find("baseline")!=string::npos)
162 datin >> fRangeBaseMin ;
163 datin >> fRangeBaseMax ;
164 cout << " range base :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
166 if(line.find("adc sum")!=string::npos)
168 datin >> fRangeSumMin ;
169 datin >> fRangeSumMax ;
170 cout << " range sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
172 if(line.find("frequency")!=string::npos)
174 datin >> fSamplingFreq ;
175 cout << " sampling frequency :: " << fSamplingFreq << endl;
177 if(line.find("timebins")!=string::npos)
180 cout << " timebins :: " << fTimeBins << endl;
182 if(line.find("pedestal")!=string::npos)
184 datin >> fPedestals ;
185 cout << " pedestal scheme :: " << fPedestals << endl;
187 if(line.find("main window size")!=string::npos)
189 datin >> fMainXSize ;
190 datin >> fMainYSize ;
191 cout << " main window size :: " << fMainXSize << " , " << fMainYSize << endl;
193 if(line.find("border size")!=string::npos)
195 datin >> fBorderXSize ;
196 datin >> fBorderYSize ;
197 cout << " border size :: " << fBorderXSize << " , " << fBorderYSize << endl;
200 cout << "//// Read Configuration done //// " << endl;
201 SetMainSize(fMainXSize,fMainYSize,fBorderXSize,fBorderYSize) ;
204 //_______________________________________________________________________________________________________________
205 void AliTPCMonitorConfig::PrintConfig()
207 // Print base configuration
209 cout << " /////// Configuration /////////////////////////////// " << endl;
210 cout << " Timebins :: " << fTimeBins << endl;
211 cout << " Range to det ADC max :: " << fRangeMaxAdcMin << " : " << fRangeMaxAdcMax << endl;
212 cout << " Range to det Baseline :: " << fRangeBaseMin << " : " << fRangeBaseMax << endl;
213 cout << " Range to det ADC sum :: " << fRangeSumMin << " : " << fRangeSumMax << endl;
214 cout << " Pedestal setting :: " << fPedestals << endl;
215 cout << " Sampling Frequency :: " << fSamplingFreq << endl;
216 cout << " Sector (Last) :: " << fSector <<" ("<< fSectorLast <<")" << endl;
217 cout << " Data Format :: " << fFormat << endl;
218 cout << " File current :: " << fFileCurrent << endl;
220 if(fFileLastSet) { cout << " File last :: " << fFileLast << endl; }
225 //______________________________________________________________________________________________________________
226 Char_t* AliTPCMonitorConfig::GetLastProcFile()
228 // Return name of last processed file
229 // Get from file if written
233 sprintf(fnlast,"AliTPCMonitorLastFile.txt");
234 ifstream datin(fnlast);
235 if(!datin) { AliWarning("Could not read file containing name of last processed file: Check permissions and path");}
243 //_______________________________________________________________________________________________________________
244 void AliTPCMonitorConfig::SetLastProcFile(Char_t* file)
246 // Set name of last processed file
247 // Write name to a file
249 sprintf(fFileLast,file);
251 sprintf(fnlast,"AliTPCMonitorLastFile.txt");
252 ofstream datout(fnlast);
253 if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");}
254 datout << fFileLast << endl;