Changeset 5532 for trunk/MagicSoft/Mars/macros
- Timestamp:
- 11/30/04 20:43:15 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/calibration.C
r5411 r5532 55 55 // 56 56 ////////////////////////////////////////////////////////////////////////////////////////// 57 #include "getExtractor.C" 58 57 59 #include "MJPedestal.h" 58 60 #include "MJCalibration.h" 59 61 #include "MJExtractSignal.h" 60 62 #include "MJExtractCalibTest.h" 61 #include "MExtractFixedWindowPeakSearch.h"62 #include "MExtractSlidingWindow.h"63 #include "MExtractFixedWindow.h"64 #include "MExtractFixedWindowSpline.h"65 #include "MExtractAmplitudeSpline.h"66 #include "MExtractTimeHighestIntegral.h"67 #include "MExtractTimeFastSpline.h"68 #include "MExtractTimeAndChargeDigitalFilter.h"69 #include "MExtractTimeAndChargeSlidingWindow.h"70 #include "MExtractTimeAndChargeSpline.h"71 63 #include "MRunIter.h" 72 64 #include "MStatusDisplay.h" … … 76 68 #include "MArgs.h" 77 69 #include "MArray.h" 78 #include "MLog.h"79 70 #include "MParContainer.h" 80 71 … … 82 73 #include "TObject.h" 83 74 #include "TObjectTable.h" 84 #include "TSystem.h" 85 86 #include <fstream> 75 #include "TCanvas.h" 76 #include "TPad.h" 77 #include "TH1.h" 78 #include "TPaveStats.h" 87 79 88 80 using namespace std; 89 81 90 82 static TString outpath = "./"; 91 static TString inpath = "/home/rootdata/Calib/2004_07_06"; 92 static TString badfile = ""; 93 //static TString badfile = "badpixels_only0_559_560.dat"; 94 static TString weightfile = "msignal/calibration_weights_UV.dat"; 95 //static TString weightfile = "msignal/cosmics_weights.dat"; 83 static TString inpath = "/home/rootdata/Calib/2004_09_22"; 84 //static TString badfile = ""; 85 static TString badfile = "badpixels_only0_388_559.dat"; 96 86 // 97 87 // the default pedestal run for the calibration 98 88 // 99 static const Int_t pedrun = 3 1756;89 static const Int_t pedrun = 38995; 100 90 // 101 91 // the default start calibration run 102 92 // 103 static const Int_t calrun1 = 3 1755;93 static const Int_t calrun1 = 38997; 104 94 // 105 95 // the default last calibration run (if 0, only one run is taken, otherwise consecutive runs … … 120 110 static Bool_t pindiode = kTRUE; 121 111 // 122 // Tell if you want to calibrate times:123 //124 static Bool_t useTimes = kTRUE;125 //126 // Tell if you want to use a combined extractor:127 //128 static Bool_t useTimeAndCharge = kTRUE;129 //130 112 // Tell if you want to use the display: 131 113 // … … 140 122 static Bool_t useIntensity = kFALSE; 141 123 // 142 // Tell if you want to use MPedCalcFromLogain for the pedestal calculation143 //144 static Bool_t usedata = kFALSE;145 //146 124 // Tell if you want to store and read the F0 and F1- files 147 125 // 148 126 static Bool_t usestorage = kFALSE; 149 127 // 150 Int_t calibration(const Int_t prun=pedrun, 128 // Tell which extractor you want to use. The flags are counted according 129 // to the extractor-TDAS 130 // 131 static Int_t extractorflag = 1; 132 // 133 Int_t calibration(const UInt_t extflag=extractorflag, const Int_t prun=pedrun, 151 134 const Int_t crun1=calrun1, const Int_t crun2=calrun2) 152 135 { 153 136 137 MExtractor *extractor = getExtractor(extflag); 138 139 if (!extractor) 140 return 99; 141 142 extractor->SetName(Form("%s_Run_%05d",extractor->GetName(),prun)); 143 const Bool_t timeandcharge = extractor->InheritsFrom("MExtractTimeAndCharge"); 144 145 gStyle->SetOptStat(1111); 146 gStyle->SetOptFit(); 147 gStyle->SetTitleSize(0.35,"u"); 148 gStyle->SetTitleFontSize(0.9); 149 gStyle->SetTitleH(0.12); 150 gStyle->SetTitleW(0.95); 151 gStyle->SetLineWidth(1); 152 154 153 if (debug) 155 154 TObject::SetObjectStat(kTRUE); 156 157 //158 // Choose the signal Extractor:159 //160 // PURE CHARGE EXTRACTORS:161 // MExtractFixedWindowPeakSearch extractor;162 // MExtractSlidingWindow extractor;163 // MExtractFixedWindow extractor;164 // MExtractFixedWindowSpline extractor;165 // MExtractAmplitudeSpline extractor;166 //167 // PURE TIME EXTRACTORS:168 // ATTENTION: If an extractor deriving from MExtractTimeAndCharge is169 // used, you may want to use the timing calculated directly170 // from there. Use the flag: "useTimeAndCharge" in this case171 //172 // MExtractTimeHighestIntegral timeext;173 MExtractTimeFastSpline timeext;174 // MExtractTimeSpline timeext;175 //176 // COMBINED TIME AND CHARGE EXTRACTORS:177 // (You have to set the variable "useTimeAndCharge" in order to use the178 // time calculated by this extractor!)179 MExtractTimeAndChargeDigitalFilter extractor;180 // MExtractTimeAndChargeSpline extractor;181 // MExtractTimeAndChargeSlidingWindow extractor;182 //183 // Set Ranges or Windows184 //185 // extractor.SetRange(1,14,4,12);186 // extractor.SetWindowSize(6,6);187 // timeext.SetRange(1,14,4,12);188 // timeext.SetWindowSize(6,6);189 //190 // Set additional information for some extractors191 //192 // Digital Filter:193 extractor.ReadWeightsFile(weightfile.Data());194 // extractor.ReadWeightsFile("");195 // TimeAndChargeSpline:196 // extractor.SetChargeType(MExtractTimeAndChargeSpline::kIntegral);197 // extractor.SetTimeType(MExtractTimeAndChargeSpline::kHalfMaximum);198 155 199 156 MRunIter pruns; … … 207 164 cruns.AddRuns(crun1,crun2,inpath); 208 165 209 gStyle->SetOptStat(1111);210 gStyle->SetOptFit();211 gStyle->SetTitleSize(0.1,"u");212 gStyle->SetLineWidth(1);213 214 166 MStatusDisplay *display = NULL; 215 167 … … 221 173 } 222 174 223 /************************************/ 224 /* FIRST LOOP: PEDESTAL COMPUTATION */ 225 /************************************/ 226 175 /*****************************************/ 176 /* FIRST LOOP: PURE PEDESTAL COMPUTATION */ 177 /*****************************************/ 227 178 // 228 179 // Hand over to the jobs a QE Cam with Cornings initialized … … 241 192 } 242 193 243 MJPedestal pedloop; 244 if (usedata) 245 pedloop.SetUseData(); 246 pedloop.SetNoStorage(!usestorage); 247 pedloop.SetEnvDebug(debug); 248 pedloop.SetExtractor(&extractor); 249 pedloop.SetInput(&pruns); 250 pedloop.SetPathOut(outpath.Data()); 194 MJPedestal pedloop1; 195 pedloop1.SetNoStorage(!usestorage); 196 pedloop1.SetEnvDebug(debug); 197 pedloop1.SetExtractor(extractor); 198 pedloop1.SetInput(&pruns); 199 pedloop1.SetPathOut(outpath.Data()); 251 200 if (useDisplay) 252 201 { 253 pedloop .SetDisplay(display);254 pedloop .SetDataCheckDisplay();255 } 256 pedloop .SetBadPixels(badcam);257 258 if (!pedloop .Process())202 pedloop1.SetDisplay(display); 203 pedloop1.SetDataCheckDisplay(); 204 } 205 pedloop1.SetBadPixels(badcam); 206 207 if (!pedloop1.Process()) 259 208 return 1; 260 209 … … 263 212 /****************************************/ 264 213 214 MJPedestal pedloop2; 265 215 MJCalibration calloop; 216 217 if (timeandcharge) 218 { 219 /***********************************************************/ 220 /* NEEDE FOR SECOND LOOP: EXTRACTOR RESOLUTION COMPUTATION */ 221 /***********************************************************/ 222 223 pedloop2.SetUseData(); 224 pedloop2.SetNoStorage(!usestorage); 225 pedloop2.SetEnvDebug(debug); 226 pedloop2.SetExtractor(extractor); 227 pedloop2.SetExtractorResolution(); 228 pedloop2.SetPedestals(pedloop1.GetPedestalCam()); 229 pedloop2.SetInput(&pruns); 230 pedloop2.SetPathOut(outpath.Data()); 231 if (useDisplay) 232 { 233 pedloop2.SetDisplay(display); 234 pedloop2.SetDataCheckDisplay(); 235 } 236 pedloop2.SetBadPixels(badcam); 237 238 if (!pedloop2.Process()) 239 return 1; 240 241 extractor->SetNoiseCalculation(kFALSE); 242 calloop.SetExtractorCam(pedloop2.GetPedestalCam()); 243 } 244 245 MPedestalCam &pedcam = pedloop1.GetPedestalCam(); 266 246 267 247 if (debug) … … 289 269 // If you want to calibrate the times as well, choose: 290 270 // 291 calloop.SetRelTimeCalibration(useTimes); 292 calloop.SetExtractor(&extractor); 293 calloop.SetTimeAndCharge(useTimeAndCharge); 294 calloop.SetTimeExtractor(&timeext); 271 calloop.SetExtractor(extractor); 295 272 calloop.SetInput(&cruns); 296 273 calloop.SetPathOut(outpath.Data()); … … 300 277 calloop.SetUsePINDiode(pindiode); 301 278 calloop.SetQECam(qecam); 302 calloop.SetBadPixels(pedloop .GetBadPixels());303 304 if (!calloop.Process(ped loop.GetPedestalCam()))279 calloop.SetBadPixels(pedloop1.GetBadPixels()); 280 281 if (!calloop.Process(pedcam)) 305 282 return 2; 306 283 … … 331 308 testloop.SetDataCheckDisplay(); 332 309 333 testloop.SetExtractor(&extractor); 334 testloop.SetTimeExtractor(&timeext); 310 testloop.SetExtractor(extractor); 335 311 testloop.SetInput(&cruns); 336 312 testloop.SetPathOut(outpath); … … 339 315 testloop.SetBadPixels(calloop.GetBadPixels()); 340 316 341 if (!testloop.ProcessD(pedloop .GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))317 if (!testloop.ProcessD(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 342 318 return 3; 343 319 344 if (useTimes)345 if (!testloop.ProcessT(pedloop.GetPedestalCam(),calloop.GetRelTimeCam()))346 320 return 4; 347 321 … … 354 328 MJExtractSignal pedphotloop; 355 329 356 pedphotloop.SetExtractor(&extractor); 357 pedphotloop.SetTimeExtractor(&timeext); 330 pedphotloop.SetExtractor(extractor); 358 331 pedphotloop.SetInput(&pruns); 359 332 pedphotloop.SetOutputPath(outpath); … … 362 335 pedphotloop.SetBadPixels(calloop.GetBadPixels()); 363 336 364 if (!pedphotloop.ProcessP(pedloop .GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))337 if (!pedphotloop.ProcessP(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 365 338 return 5; 366 339 … … 375 348 376 349 return 0; 377 378 350 } 379 351 … … 393 365 gLog << endl; 394 366 gLog << "Additional Options: " << endl; 367 gLog << " --extractor=# Choose one of the following possible extractors (integer)" << endl; 368 gLog << endl; 369 gLog << " Nr. Extractor Parameters " << endl; 370 gLog << endl; 371 gLog << " MExtractFixedWindow: " << endl; 372 gLog << " with the following parameters, if 'maxbin' defines the mean position" << endl; 373 gLog << " of the High-Gain FADC slice carrying the pulse maximum: " << endl; 374 gLog << " 1: SetRange('maxbin}}-1,'maxbin}}+2,'maxbin}}+0.5,'maxbin}}+3.5) " << endl; 375 gLog << " 2: SetRange('maxbin'-1,'maxbin'+2,'maxbin'-0.5,'maxbin'+4.5)" << endl; 376 gLog << " 3: SetRange('maxbin'-2,'maxbin'+3,'maxbin'-0.5,'maxbin'+4.5)" << endl; 377 gLog << " 4: SetRange('maxbin'-3,'maxbin'+4,'maxbin'-1.5,'maxbin'+5.5)" << endl; 378 gLog << " 5: SetRange('maxbin'-5,'maxbin'+8,'maxbin'-1.5,'maxbin'+7.5)" << endl; 379 gLog << " MExtractFixedWindowSpline: " << endl; 380 gLog << " 6: SetRange('maxbin'-1,'maxbin'+2,'maxbin'+0.5,'maxbin'+3.5)" << endl; 381 gLog << " 7: SetRange('maxbin'-1,'maxbin'+2,'maxbin'-0.5,'maxbin'+4.5)" << endl; 382 gLog << " 8: SetRange('maxbin'-2,'maxbin'+3,'maxbin'-0.5,'maxbin'+4.5)" << endl; 383 gLog << " 9: SetRange('maxbin'-3,'maxbin'+4,'maxbin'-1.5,'maxbin'+5.5)" << endl; 384 gLog << " 10: SetRange('maxbin'-5,'maxbin'+8,'maxbin'-1.5,'maxbin'+7.5)" << endl; 385 gLog << " MExtractFixedWindowPeakSearch: " << endl; 386 gLog << " SetRange(0,18,2,14) and the following parameters:" << endl; 387 gLog << " 11: SetWindows(2,2,2)" << endl; 388 gLog << " 12: SetWindows(4,4,2)" << endl; 389 gLog << " 13: SetWindows(6,6,4)" << endl; 390 gLog << " 14: SetWindows(4,6,4)" << endl; 391 gLog << " 15: SetWindows(8,8,4)" << endl; 392 gLog << " 16: SetWindows(14,10,4)" << endl; 393 gLog << " MExtractTimeAndChargeSlidingWindow:" << endl; 394 gLog << " SetRange(0,18,2,14) and the following parameters:" << endl; 395 gLog << " 17: SetWindowSize(2,2)" << endl; 396 gLog << " 18: SetWindowSize(4,4)" << endl; 397 gLog << " 19: SetWindowSize(6,6)" << endl; 398 gLog << " 20: SetWindowSize(4,6)" << endl; 399 gLog << " 21: SetWindowSize(8,8)" << endl; 400 gLog << " 22: SetWindowSize(14,10)" << endl; 401 gLog << " MExtractTimeAndChargeSpline: " << endl; 402 gLog << " SetChargeType(MExtractTimeAndChargeSpline::kIntegral) and:" << endl; 403 gLog << " SetRange(0,18,2,14) and the following parameters:" << endl; 404 gLog << " 23: SetRiseTime(1.5); SetFallTime(4.5)" << endl; 405 gLog << " 24: SetRiseTime(0.5); SetFallTime(2.5)" << endl; 406 gLog << " 25: SetRiseTime(0.5); SetFallTime(1.5)" << endl; 407 gLog << " 26: SetRiseTime(0.5); SetFallTime(0.5)" << endl; 408 gLog << " 27: SetChargeType(MExtractTimeAndChargeSpline::kAmplitude" << endl; 409 gLog << " SetRange(0,10,4,11)" << endl; 410 gLog << " MExtractTimeAndChargeDigitalFilter" << endl; 411 gLog << " SetRange(0,18,2,14) and the following parameters:" << endl; 412 gLog << " 28: SetNameWeightsFile('msignal/cosmics_weights.dat')" << endl; 413 gLog << " 29: SetNameWeightsFile('msignal/cosmics_weights4.dat')" << endl; 414 gLog << " 30: SetNameWeightsFile('msignal/cosmics_weights_logain6.dat')" << endl; 415 gLog << " 31: SetNameWeightsFile('msignal/cosmics_weights_logain4.dat')" << endl; 416 gLog << " 32: SetNameWeightsFile('msignal/calibration_weights_UV.dat')" << endl; 417 gLog << " 33: SetNameWeightsFile('msignal/calibration_weights_UV4.dat')" << endl; 418 gLog << " 34: SetNameWeightsFile('msignal/calibration_weights_UV_logain6.dat')" << endl; 419 gLog << " 35: SetNameWeightsFile('msignal/calibration_weights_UV_logain4.dat')" << endl; 420 gLog << " 36: Real Fit: (not yet implemented)" << endl; 421 gLog << endl; 395 422 gLog << " --inpath=# Find the data in inpath" << endl; 396 423 gLog << " --outpath=# Write the output containers to outpath" << endl; … … 398 425 gLog << " --debug Use the TObjectTable for debugging " << endl; 399 426 gLog << " and write out the pixels as ascii tables" << endl; 400 gLog << " --useTimes Calibrate the relative arrival times" << endl;401 427 gLog << " --useTest Use the class MJExtractCalibTest to test the calibration on itself" << endl; 402 428 gLog << " --skipBlindPix Skip the blind pixel calibration" << endl; … … 419 445 420 446 debug = arg.HasOnlyAndRemove("--debug") || arg.HasOnlyAndRemove("-d"); 421 useTimes = arg.HasOnlyAndRemove("--useTimes") || arg.HasOnlyAndRemove("-t");422 447 useTest = arg.HasOnlyAndRemove("--useTest") || arg.HasOnlyAndRemove("-e"); 423 448 blindpix = !(arg.HasOnlyAndRemove("--skipBlindPix")); 424 449 pindiode = !(arg.HasOnlyAndRemove("--skipPINDiode")); 450 451 if (arg.HasOption("--extractor=")) 452 extractorflag = arg.GetIntAndRemove("--extractor="); 425 453 426 454 if (arg.HasOption("--inpath=")) … … 455 483 // Switch off the display 456 484 // 457 useDisplay = kFALSE; 458 459 485 useDisplay = kTRUE; 460 486 // 461 487 // check for the arguments … … 479 505 pedr = arg.GetArgumentInt(0); 480 506 calr1 = arg.GetArgumentInt(1); 481 return calibration(pedr,calr1); 507 gLog << "PEDR: " << pedr << " CALR1: " << calr1 << " CALR2 " << calr2 << endl; 508 gLog << "inpath: " << inpath << endl; 509 gLog << "extractor: " << extractorflag << endl; 510 return calibration(); 482 511 } 483 512 … … 485 514 { 486 515 pedr = arg.GetArgumentInt(0); 487 gLog << "PEDR: " << pedr << endl; 488 return calibration(pedr); 489 } 490 491 return calibration(); 516 return calibration(pedr,calr1,calr2); 517 } 518 519 return calibration(pedr,calr1,calr2); 492 520 } 521
Note:
See TracChangeset
for help on using the changeset viewer.