Changeset 4235
- Timestamp:
- 05/28/04 16:09:39 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4227 r4235 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2004/05/28: Markus Gaug 22 23 * macros/calibration.C 24 - make the macro compilable with possibility to run it in batch 25 mode. 26 27 * msignal/MExtractor.cc 28 - put an additional check in case that the number of FADC slices 29 in the run header is smaller or equal to 0. 30 20 31 21 32 2004/05/27: Javier Rico -
trunk/MagicSoft/Mars/macros/calibration.C
r4122 r4235 55 55 // 56 56 ///////////////////////////////////////////////////////////////////////////// 57 static const TString outpath = "./"; 57 #include "MJPedestal.h" 58 #include "MJCalibration.h" 59 #include "MJExtractCalibTest.h" 60 #include "TObject.h" 61 #include "TObjectTable.h" 62 #include "MExtractFixedWindowPeakSearch.h" 63 #include "MExtractSlidingWindow.h" 64 #include "MExtractFixedWindow.h" 65 #include "MExtractTimeHighestIntegral.h" 66 #include "MExtractTimeFastSpline.h" 67 #include "MRunIter.h" 68 #include "MStatusDisplay.h" 69 #include "TStyle.h" 70 #include "MCalibrationQECam.h" 71 #include "MHCalibrationTestCam.h" 72 #include "MHCalibrationTestPix.h" 73 #include "MBadPixelsCam.h" 74 #include "MArgs.h" 75 #include "MArray.h" 76 #include "MLog.h" 77 #include "MParContainer.h" 78 79 using namespace std; 80 81 static TString outpath = "./"; 58 82 static const TString inpath = "./"; 59 //static const TString inpath = "/home/rootdata/Calib/";60 //61 // Tell if you want to calibrate times:62 //63 static const Bool_t useTimes = kTRUE;64 83 // 65 84 // the default pedestal run for the calibration 66 85 // 67 static const Int_t pedrun = 26 210;86 static const Int_t pedrun = 26851; 68 87 // 69 88 // the default start calibration run 70 89 // 71 static const Int_t calrun1 = 26 209;90 static const Int_t calrun1 = 26849; 72 91 // 73 92 // the default last calibration run (if 0, only one run is taken, otherwise consecutive runs 74 93 // between calrun1 and calrun2) 75 94 // 76 static const Int_t calrun2 = 0;95 static const Int_t calrun2 = 0; 77 96 // 78 97 // A switch to output debugging information about Objects use 79 98 // 80 static const Bool_t debug = kFALSE; 81 // 82 void calibration(const Int_t prun=pedrun, const Int_t crun1=calrun1, const Int_t crun2=calrun2) 99 static Bool_t debug = kFALSE; 100 // 101 // A switch to use the Blind Pixel 102 // 103 static Bool_t blindpix = kTRUE; 104 // 105 // A switch to use the PIN Diode 106 // 107 static Bool_t pindiode = kFALSE; 108 // 109 // Tell if you want to calibrate times: 110 // 111 static Bool_t useTimes = kFALSE; 112 // 113 // Tell if you want to use the display: 114 // 115 static Bool_t useDisplay = kTRUE; 116 // 117 Int_t calibration(const Int_t prun=pedrun, 118 const Int_t crun1=calrun1, const Int_t crun2=calrun2) 83 119 { 84 120 85 86 TObject::SetObjectStat(kTRUE);121 if (debug) 122 TObject::SetObjectStat(kTRUE); 87 123 88 124 // … … 91 127 // MExtractFixedWindowPeakSearch extractor; 92 128 // MExtractSlidingWindow extractor; 93 MExtractFixedWindowextractor;129 MExtractFixedWindow extractor; 94 130 95 131 // 96 132 // Set Ranges or Windows 97 133 // 98 extractor.SetRange(3,14,3,14); 134 extractor.SetRange(0,15,3,14); 135 // extractor.SetRange(5,9 ,5,9 ); 99 136 // extractor.SetWindows(8,8); 100 137 … … 107 144 // Set Ranges or Windows 108 145 // 109 timeext.SetRange( 2,12,4,14);146 timeext.SetRange(1,14,3,14); 110 147 111 148 MRunIter pruns; … … 119 156 cruns.AddRuns(crun1,crun2,inpath); 120 157 121 gStyle->SetOptStat(1 );158 gStyle->SetOptStat(111111); 122 159 gStyle->SetOptFit(); 123 160 124 MStatusDisplay *display = new MStatusDisplay; 125 display->SetUpdateTime(3000); 126 display->Resize(850,700); 161 MStatusDisplay *display = NULL; 162 163 if (useDisplay) 164 { 165 display = new MStatusDisplay; 166 display->SetUpdateTime(3000); 167 display->Resize(850,700); 168 } 127 169 128 170 /************************************/ … … 132 174 MCalibrationQECam qecam; 133 175 MBadPixelsCam badcam; 134 MGeomCamMagic geomcam;135 MGeomApply geomapl;136 176 // 137 177 // If you want to exclude pixels from the beginning, read 138 178 // an ascii-file with the corr. pixel numbers (see MBadPixelsCam) 139 179 // 140 // badcam.AsciiRead("badpixels.dat");180 // badcam.AsciiRead("badpixels.dat"); 141 181 142 182 MJPedestal pedloop; … … 144 184 pedloop.SetInput(&pruns); 145 185 pedloop.SetOutputPath(outpath.Data()); 146 pedloop.SetDisplay(display); 186 if (useDisplay) 187 pedloop.SetDisplay(display); 147 188 pedloop.SetBadPixels(badcam); 148 189 149 190 if (!pedloop.Process()) 150 return ;191 return 1; 151 192 152 193 /****************************************/ … … 174 215 calloop.SetInput(&cruns); 175 216 calloop.SetOutputPath(outpath.Data()); 176 calloop.SetDisplay(display); 217 if (useDisplay) 218 calloop.SetDisplay(display); 219 calloop.SetUseBlindPixel(blindpix); 220 calloop.SetUsePINDiode(pindiode); 177 221 calloop.SetQECam(qecam); 178 222 calloop.SetBadPixels(pedloop.GetBadPixels()); 179 223 180 calloop.Process(pedloop.GetPedestalCam()); 224 if (!calloop.Process(pedloop.GetPedestalCam())) 225 return 2; 226 227 // 228 // The next lines are the use the Print() function and have 229 // all the results as ascii-tables: 230 // 231 if (debug) 232 { 233 MCalibrationChargeCam &chargecam = calloop.GetCalibrationCam(); 234 MCalibrationQECam &nqecam = calloop.GetQECam(); 235 MBadPixelsCam &badbad = calloop.GetBadPixels(); 236 chargecam.Print(); 237 nqecam.Print(); 238 badbad.Print(); 239 } 240 241 gLog << endl; 242 gLog << "Mean number of photons from pulser Inner pixels (F-Factor Method): " 243 << calloop.GetCalibrationCam().GetNumPhotonsFFactorMethod() 244 << " +- " << calloop.GetCalibrationCam().GetNumPhotonsFFactorMethodErr() << endl; 245 gLog << endl; 181 246 182 247 /********************************************************************/ … … 190 255 testloop.SetInput(&cruns); 191 256 testloop.SetOutputPath(outpath); 192 testloop.SetDisplay(display); 257 if (useDisplay) 258 testloop.SetDisplay(display); 193 259 testloop.SetBadPixels(calloop.GetBadPixels()); 194 testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()); 260 261 if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 262 return 3; 263 195 264 if (useTimes) 196 testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam()); 197 198 TObject::SetObjectStat(kFALSE); 199 // 200 // List of useful containers: 265 if (!testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam())) 266 return 4; 267 268 gLog << endl; 269 gLog << "Mean equiv. number of photons from cascades per mm^2 Inner pixels: " 270 << testloop.GetTestCam().GetMeanMeanPhotPerArea(0) 271 << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(0) << endl; 272 gLog << "Sigma equiv. number of photons from cascades per mm^2 Inner pixels: " 273 << testloop.GetTestCam().GetMeanSigmaPhotPerArea(0) 274 << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(0) << endl; 275 276 gLog << endl; 277 gLog << "Mean equiv. number of photons from cascades per mm^2 Outer pixels: " 278 << testloop.GetTestCam().GetMeanMeanPhotPerArea(1) 279 << " +- " << testloop.GetTestCam().GetRmsMeanPhotPerArea(1) << endl; 280 gLog << "Sigma equiv. number of photons from cascades per mm^2 Outer pixels: " 281 << testloop.GetTestCam().GetMeanSigmaPhotPerArea(1) 282 << " +- " << testloop.GetTestCam().GetRmsSigmaPhotPerArea(1) << endl; 283 gLog << endl; 284 285 286 if (debug) 287 TObject::SetObjectStat(kFALSE); 288 289 // 290 // Debugging at the end: 201 291 // 202 292 if (debug) … … 206 296 // List of useful containers: 207 297 // 298 MHCalibrationTestCam &testcam = testloop.GetTestCam(); 299 testcam[100].DrawClone("events"); 300 208 301 /* 209 302 MPedestalCam &pedcam = pedloop.GetPedestalCam(); … … 214 307 MHCalibrationTestTimeCam &testtime = testloop.GetTestTimeCam(); 215 308 */ 309 310 // 311 // List of interesting plots: 312 // 313 /* 314 testcam.GetAverageHiGainArea(0).DrawClone(); 315 testcam.GetAverageLoGainArea(0).DrawClone(); 316 testcam.GetAverageHiGainArea(1).DrawClone(); 317 testcam.GetAverageLoGainArea(1).DrawClone(); 318 319 testcam.GetAverageHiGainSector(1).DrawClone(); 320 testcam.GetAverageLoGainSector(1).DrawClone(); 321 testcam.GetAverageHiGainSector(2).DrawClone(); 322 testcam.GetAverageLoGainSector(2).DrawClone(); 323 testcam.GetAverageHiGainSector(3).DrawClone(); 324 testcam.GetAverageLoGainSector(3).DrawClone(); 325 testcam.GetAverageHiGainSector(4).DrawClone(); 326 testcam.GetAverageLoGainSector(4).DrawClone(); 327 testcam.GetAverageHiGainSector(5).DrawClone(); 328 testcam.GetAverageLoGainSector(5).DrawClone(); 329 testcam.GetAverageHiGainSector(6).DrawClone(); 330 testcam.GetAverageLoGainSector(6).DrawClone(); 331 */ 332 return 0; 333 216 334 } 217 335 218 336 static void Usage() 337 { 338 gLog << endl; 339 gLog << "Usage:" << endl; 340 gLog << endl; 341 gLog << " calibration [ped.run nr.] [first cal.run nr.] [last cal.run nr.]" << endl ; 342 gLog << endl; 343 gLog << " ped.run.nr: Run number of the pedestal file." << endl; 344 gLog << " first cal.run nr.: Run number of the first calibration file." << endl; 345 gLog << " last cal.run nr.: Run number of the last calibration file." << endl; 346 gLog << endl; 347 gLog << "All calibration runs between (first cal.run nr.) and (last cal.run nr.) will be used" << endl; 348 gLog << "If last.cal.run.nr is 0 (default), only one calibration run is taken" << endl; 349 gLog << endl; 350 gLog << "Additional Options: " << endl; 351 gLog << " --inpath=# Find the data in inpath" << endl; 352 gLog << " --outpath=# Write the output containers to outpath" << endl; 353 gLog << " --debug Use the TObjectTable for debugging " << endl; 354 gLog << " and write out the pixels as ascii tables" << endl; 355 gLog << " --useTimes Calibrate the relative arrival times" << endl; 356 gLog << " --skipBlindPix Skip the blind pixel calibration" << endl; 357 gLog << " --skipPINDiode Skip the PIN Diode calibration" << endl; 358 } 359 360 361 int main(int argc, char **argv) 362 { 363 // 364 // Evaluate arguments 365 // 366 MArgs arg(argc, argv); 367 368 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help")) 369 { 370 Usage(); 371 return -1; 372 } 373 374 debug = arg.HasOnlyAndRemove("--debug") || arg.HasOnlyAndRemove("-d"); 375 useTimes = arg.HasOnlyAndRemove("--useTimes") || arg.HasOnlyAndRemove("-t"); 376 blindpix = !(arg.HasOnlyAndRemove("--skipBlindPix")); 377 pindiode = !(arg.HasOnlyAndRemove("--skipPINDiode")); 378 379 if (arg.HasOption("--inpath=")) 380 inpath = arg.GetStringAndRemove("--inpath="); 381 382 if (arg.HasOption("--outpath=")) 383 outpath = arg.GetStringAndRemove("--outpath="); 384 385 // 386 // check for the right usage of the program 387 // 388 if (arg.GetNumArguments()>4) 389 { 390 Usage(); 391 return -1; 392 } 393 394 // 395 // Initialize Non-GUI (batch) mode 396 // 397 gROOT->SetBatch(); 398 399 // 400 // Switch off the display 401 // 402 useDisplay = kFALSE; 403 404 405 // 406 // check for the arguments 407 // 408 Int_t pedr = 0; 409 Int_t calr1 = 0; 410 Int_t calr2 = 0; 411 412 const Int_t nargs = arg.GetNumArguments(); 413 414 if (nargs>=3) 415 { 416 pedr = arg.GetArgumentInt(0); 417 calr1 = arg.GetArgumentInt(1); 418 calr2 = arg.GetArgumentInt(2); 419 return calibration(pedr,calr1,calr2); 420 } 421 422 if (nargs>=2) 423 { 424 pedr = arg.GetArgumentInt(0); 425 calr1 = arg.GetArgumentInt(1); 426 return calibration(pedr,calr1); 427 } 428 429 if (nargs>=1) 430 { 431 pedr = arg.GetArgumentInt(0); 432 gLog << "PEDR: " << pedr << endl; 433 return calibration(pedr); 434 } 435 436 return calibration(); 437 } -
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r3962 r4235 181 181 Int_t lastdesired = (Int_t)(fLoGainLast); 182 182 Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1; 183 184 if (lastavailable < 0) 185 *fLog << warn << GetDescriptor() 186 << ": WARNING: Number of available Low-Gain Slices is smaller than or equal zero!" << endl; 183 187 184 188 if (lastdesired > lastavailable) … … 197 201 lastavailable = (Int_t)fRunHeader->GetNumSamplesHiGain()-1; 198 202 203 if (lastavailable < 0) 204 { 205 *fLog << err << GetDescriptor() 206 << ": ERROR: Number of available High-Gain Slices is smaller than or equal zero!" << endl; 207 return kFALSE; 208 } 209 199 210 if (lastdesired > lastavailable) 200 211 {
Note:
See TracChangeset
for help on using the changeset viewer.