- Timestamp:
- 01/22/05 15:54:06 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5941 r5942 38 38 - replace title of that times-averageing Tab from "RelTimes" by 39 39 "Times". 40 41 * macros/calibration.C 42 - update to changes in MJExtractCalibTest 40 43 41 44 2005/01/21 Markus Gaug -
trunk/MagicSoft/Mars/macros/calibration.C
r5862 r5942 86 86 //static TString inpath = "/home/rootdata/Calib/2004_07_06"; 87 87 //static TString inpath = "/home/rootdata/Calib/2004_09_22"; 88 static TString inpath = "/ home/rootdata/Calib/2004_12_18";88 static TString inpath = "/.magic/magicserv01/MAGIC/rootdata/2004_12_18"; 89 89 static TString badfile; 90 90 //static TString badfile = "badpixels_only0_388_559.dat"; … … 122 122 // A switch to use the PIN Diode 123 123 // 124 static Bool_t pindiode = k TRUE;124 static Bool_t pindiode = kFALSE; 125 125 // 126 126 // Tell if you want to use the display: … … 341 341 testloop.SetBadPixels(calloop.GetBadPixels()); 342 342 343 if (!testloop.ProcessD(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam())) 343 if (!testloop.Process(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam(), 344 calloop.GetRelTimeCam())) 344 345 return 3; 345 346 -
trunk/MagicSoft/Mars/mjobs/MJExtractCalibTest.cc
r5810 r5942 45 45 #include "MParList.h" 46 46 #include "MTaskList.h" 47 #include "MTaskEnv.h" 47 48 #include "MEvtLoop.h" 48 49 … … 52 53 #include "MBadPixelsCam.h" 53 54 #include "MBadPixelsTreat.h" 55 #include "MBadPixelsCalc.h" 56 #include "MBadPixelsMerge.h" 54 57 #include "MCerPhotEvt.h" 55 58 #include "MArrivalTime.h" … … 64 67 #include "MReadMarsFile.h" 65 68 #include "MGeomApply.h" 66 #include "MExtract SlidingWindow.h"69 #include "MExtractTimeAndChargeSlidingWindow.h" 67 70 #include "MExtractor.h" 68 71 #include "MExtractTime.h" … … 73 76 #include "MCalibrateData.h" 74 77 #include "MCalibrateRelTimes.h" 75 #include "MPedPhotCalc.h" 78 79 #include "MTriggerPattern.h" 80 #include "MTriggerPatternDecode.h" 81 #include "MFTriggerPattern.h" 76 82 77 83 #include "MStatusDisplay.h" … … 89 95 MJExtractCalibTest::MJExtractCalibTest(const char *name, const char *title) 90 96 : fUseCosmicsFilter(kTRUE), fRuns(NULL), fExtractor(NULL), fTimeExtractor(NULL), 91 fDisplayType(kNormalDisplay) 97 fDisplayType(kNormalDisplay), fGeometry("MGeomCamMagic") 92 98 { 93 99 fName = name ? name : "MJExtractCalibTest"; … … 247 253 248 254 249 Bool_t MJExtractCalibTest::ProcessD(MPedestalCam &pedcam, MCalibrationChargeCam &calcam, MCalibrationQECam &qecam) 255 Bool_t MJExtractCalibTest::Process(MPedestalCam &pedcam, 256 MCalibrationChargeCam &calcam, MCalibrationQECam &qecam, 257 MCalibrationRelTimeCam &reltime, 258 Byte_t filetype) 250 259 { 251 260 // const TString fname = GetOutputFile(); 252 261 253 262 // if (gSystem->AccessPathName(fname, kFileExists)) 254 return ProcessFile D(pedcam,calcam,qecam);263 return ProcessFile(pedcam,calcam,qecam,reltime,filetype); 255 264 256 265 // return kTRUE; 257 266 } 258 267 259 Bool_t MJExtractCalibTest::ProcessFileD(MPedestalCam &pedcam, MCalibrationChargeCam &calcam, MCalibrationQECam &qecam) 268 Bool_t MJExtractCalibTest::ProcessFile(MPedestalCam &pedcam, 269 MCalibrationChargeCam &calcam, MCalibrationQECam &qecam, 270 MCalibrationRelTimeCam &relcam, 271 Byte_t filetype) 260 272 { 261 273 if (!fRuns) … … 269 281 return kFALSE; 270 282 } 271 283 272 284 *fLog << inf; 273 285 fLog->Separator(GetDescriptor()); 274 286 *fLog << "Calculate MExtractedSignalCam from Runs " << fRuns->GetRunsAsString() << endl; 275 287 *fLog << endl; 276 288 289 MBadPixelsCam badcam; 290 291 // Setup Lists 292 MParList plist; 293 plist.AddToList(this); // take care of fDisplay! 294 plist.AddToList(&fTestCam); 295 plist.AddToList(&fTestTimeCam); 296 plist.AddToList(&badcam); 297 plist.AddToList(&pedcam); 298 plist.AddToList(&calcam); 299 plist.AddToList(&qecam); 300 plist.AddToList(&relcam); 301 277 302 MCerPhotEvt cerphot; 278 303 MPedPhotCam pedphot; 279 304 MHCalibrationTestCam testcam; 280 305 281 // Setup Lists282 MParList plist;283 plist.AddToList(&pedcam);284 plist.AddToList(&calcam);285 plist.AddToList(&qecam);286 306 plist.AddToList(&cerphot); 287 307 plist.AddToList(&pedphot); 288 308 plist.AddToList(&testcam); 289 plist.AddToList(&fTestCam); 290 p list.AddToList(&fBadPixels);291 309 310 pedcam.SetName("MPedestalFundamental"); 311 292 312 MTaskList tlist; 293 313 plist.AddToList(&tlist); … … 298 318 static_cast<MRead&>(read).AddFiles(*fRuns); 299 319 320 // Check for interleaved events 321 MTriggerPatternDecode decode; 322 MFTriggerPattern fcalib; 323 fcalib.DenyCalibration(); 324 MContinue conttp(&fcalib, "ContTrigPattern"); 325 300 326 MGeomApply apply; // Only necessary to craete geometry 301 MExtractSlidingWindow extract2; 327 apply.SetGeometry(fGeometry); 328 MBadPixelsMerge merge(&fBadPixels); 329 330 MExtractTimeAndChargeSlidingWindow extrsw; 331 MExtractTimeFastSpline extime; 332 extime.SetPedestals(&pedcam); 333 334 MTaskEnv taskenv1("ExtractSignal"); 335 MTaskEnv taskenv2("ExtractTime"); 336 337 if (fExtractor) 338 { 339 fExtractor->SetPedestals(&pedcam); 340 taskenv1.SetDefault(fExtractor); 341 } 342 if (fTimeExtractor) 343 { 344 fTimeExtractor->SetPedestals(&pedcam); 345 taskenv2.SetDefault(fTimeExtractor); 346 } 347 else 348 { 349 extrsw.SetPedestals(&pedcam); 350 extrsw.SetWindowSize(8,8); 351 taskenv2.SetDefault(&extrsw); 352 *fLog << warn << GetDescriptor() 353 << ": No extractor has been chosen, take default MExtractTimeAndChargeSlidingWindow " << endl; 354 } 355 302 356 MCalibrateData photcalc; 303 photcalc.SetCalibrationMode(MCalibrateData::kFfactor); 304 MPedPhotCalc pedphotcalc; 357 MCalibrateRelTimes caltimes; 358 if (filetype==3) // MC file 359 { 360 photcalc.SetCalibrationMode(MCalibrateData::kFfactor); 361 photcalc.SetPedestalFlag(MCalibrateData::kRun); 362 photcalc.AddPedestal("MPedestalCam", "MPedPhotFundamental"); 363 } 364 else 365 { 366 photcalc.SetCalibrationMode(MCalibrateData::kFfactor); 367 photcalc.AddPedestal("Fundamental"); 368 photcalc.SetPedestalFlag(MCalibrateData::kEvent); 369 photcalc.SetSignalType(MCalibrateData::kPhot); 370 } 371 372 MBadPixelsCalc badcalc; 305 373 MBadPixelsTreat badtreat; 306 badtreat.SetUseInterpolation(); 374 badtreat.SetProcessTimes(kFALSE); 375 376 badcalc.SetNamePedPhotCam("MPedPhotFundamental"); 377 //badtreat.SetUseInterpolation(); 378 badtreat.AddNamePedPhotCam("MPedPhotFundamental"); 379 307 380 MCalibrationTestCalc testcalc; 308 381 … … 313 386 } 314 387 315 MHCamEvent evt("ExtSignal"); 316 evt.SetType(0); 317 MFillH fill(&evt, "MExtractedSignalCam"); 388 MHCamEvent evt0(0,"Signal", "Un-Calibrated Signal;;S [FADC cnts]" ); 389 MHCamEvent evt1(3,"CalSig", "Calibrated and Interpolated Signal;;S [\\gamma]"); 390 MHCamEvent evt2(0,"Times" , "Arrival Time;;T [slice]"); 391 392 MFillH fill0(&evt0, "MExtractedSignalCam", "FillUncalibrated"); 393 MFillH fill1(&evt1, "MCerPhotEvt", "FillCalibrated"); 394 MFillH fill2(&evt2, "MArrivalTime","FillTimes"); 318 395 319 396 MFillH fillcam("MHCalibrationTestCam", "MCerPhotEvt"); 320 397 fillcam.SetNameTab("Test"); 398 MFillH filltme("MHCalibrationTestTimeCam", "MArrivalTime"); 399 filltme.SetNameTab("TestTime"); 321 400 322 401 MFCosmics cosmics; 323 MContinue cont(&cosmics); 402 cosmics.SetNamePedestalCam("MPedestalFundamental"); 403 MContinue contcos(&cosmics,"ContCosmics"); 324 404 325 405 tlist.AddToList(&read); 406 tlist.AddToList(&decode); 326 407 tlist.AddToList(&apply); 327 328 if (fExtractor) 329 tlist.AddToList(fExtractor); 330 else 331 { 332 *fLog << warn << GetDescriptor() 333 << ": No extractor has been chosen, take default MExtractSlidingWindow " << endl; 334 tlist.AddToList(&extract2); 335 } 336 337 338 if (fUseCosmicsFilter) 339 tlist.AddToList(&cont); 340 341 tlist.AddToList(&fill); 408 tlist.AddToList(&merge); 409 tlist.AddToList(&conttp); 410 tlist.AddToList(&taskenv1); 411 if (!fExtractor->InheritsFrom("MExtractTimeAndCharge")) 412 tlist.AddToList(&taskenv2); 413 tlist.AddToList(&contcos); 414 tlist.AddToList(&fill0); 342 415 tlist.AddToList(&photcalc); 343 tlist.AddToList(&pedphotcalc); 416 tlist.AddToList(&caltimes); 417 tlist.AddToList(&badcalc); 344 418 tlist.AddToList(&badtreat); 419 tlist.AddToList(&fill1); 420 tlist.AddToList(&fill2); 345 421 tlist.AddToList(&fillcam); 422 tlist.AddToList(&filltme); 346 423 tlist.AddToList(&testcalc); 347 424 … … 363 440 DisplayResult(plist); 364 441 365 if (!WriteResult D())442 if (!WriteResult()) 366 443 return kFALSE; 367 444 … … 370 447 return kTRUE; 371 448 } 372 373 Bool_t MJExtractCalibTest::ProcessT(MPedestalCam &pedcam, MCalibrationRelTimeCam &relcam)374 {375 376 // const TString fname = GetOutputFile();377 378 // if (gSystem->AccessPathName(fname, kFileExists))379 return ProcessFileT(pedcam,relcam);380 381 // return kTRUE;382 }383 384 Bool_t MJExtractCalibTest::ProcessFileT(MPedestalCam &pedcam, MCalibrationRelTimeCam &relcam)385 {386 387 if (!fRuns)388 {389 *fLog << err << "No Runs choosen... abort." << endl;390 return kFALSE;391 }392 if (fRuns->GetNumRuns() != fRuns->GetNumEntries())393 {394 *fLog << err << "Number of files found doesn't match number of runs... abort." << endl;395 return kFALSE;396 }397 398 *fLog << inf;399 fLog->Separator(GetDescriptor());400 *fLog << "Calculate MExtractedSignalCam from Runs " << fRuns->GetRunsAsString() << endl;401 *fLog << endl;402 403 MArrivalTime arrtime;404 405 // Setup Lists406 MParList plist;407 plist.AddToList(&pedcam);408 plist.AddToList(&relcam);409 plist.AddToList(&arrtime);410 plist.AddToList(&fTestTimeCam);411 plist.AddToList(&fBadPixels);412 413 MTaskList tlist;414 plist.AddToList(&tlist);415 416 // Setup Task-lists417 MReadMarsFile read("Events");418 read.DisableAutoScheme();419 static_cast<MRead&>(read).AddFiles(*fRuns);420 421 MGeomApply apply; // Only necessary to craete geometry422 MExtractTimeFastSpline extract;423 MExtractSlidingWindow extcharge; // Only for the cosmics filter424 MCalibrateRelTimes timecalc;425 MFCosmics cosmics;426 MContinue cont(&cosmics);427 428 MHCamEvent evt("ExtTimes");429 evt.SetType(0);430 MFillH fill(&evt, "MArrivalTimeCam");431 432 MFillH fillcam("MHCalibrationTestTimeCam", "MArrivalTime");433 fillcam.SetNameTab("TestTime");434 435 tlist.AddToList(&read);436 tlist.AddToList(&apply);437 438 if (fTimeExtractor)439 tlist.AddToList(fTimeExtractor);440 else441 {442 *fLog << warn << GetDescriptor()443 << ": No extractor has been chosen, take default MExtractTimeFastSpline " << endl;444 tlist.AddToList(&extract);445 }446 447 tlist.AddToList(&extcharge);448 tlist.AddToList(&cont);449 tlist.AddToList(&fill);450 tlist.AddToList(&timecalc);451 tlist.AddToList(&fillcam);452 453 // Create and setup the eventloop454 MEvtLoop evtloop(fName);455 evtloop.SetParList(&plist);456 evtloop.SetDisplay(fDisplay);457 evtloop.SetLogStream(fLog);458 459 // Execute first analysis460 if (!evtloop.Eventloop())461 {462 *fLog << err << GetDescriptor() << ": Failed." << endl;463 return kFALSE;464 }465 466 tlist.PrintStatistics();467 468 DisplayResultT(plist);469 470 if (!WriteResultT())471 return kFALSE;472 473 *fLog << inf << GetDescriptor() << ": Done." << endl;474 475 return kTRUE;476 }477 478 449 479 450 Bool_t MJExtractCalibTest::ReadPedPhotCam() … … 514 485 } 515 486 516 Bool_t MJExtractCalibTest::WriteResult D()487 Bool_t MJExtractCalibTest::WriteResult() 517 488 { 518 489 … … 544 515 } 545 516 517 if (fTestTimeCam.Write()<=0) 518 { 519 *fLog << err << "Unable to write MCalibrationTestCam to " << oname << endl; 520 return kFALSE; 521 } 522 546 523 return kTRUE; 547 524 548 525 } 549 526 550 Bool_t MJExtractCalibTest::WriteResultT()551 {552 553 if (fPathOut.IsNull())554 return kTRUE;555 556 const TString oname(GetOutputFile());557 558 *fLog << inf << "Writing to file: " << oname << endl;559 560 TFile file(oname, "UPDATE");561 562 if (fDisplay && fDisplay->Write()<=0)563 {564 *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;565 return kFALSE;566 }567 568 if (fTestTimeCam.Write()<=0)569 {570 *fLog << err << "Unable to write MHCalibrationTestTimeCam to " << oname << endl;571 return kFALSE;572 }573 574 return kTRUE;575 576 }577 527 578 528
Note:
See TracChangeset
for help on using the changeset viewer.