| 1 | #include "MLogManip.h"
|
|---|
| 2 |
|
|---|
| 3 | int callisto_drstime(const char *timfile, const char *drs1024, const char *outfile="callisto-drstime.root")
|
|---|
| 4 | {
|
|---|
| 5 | // ======================================================
|
|---|
| 6 |
|
|---|
| 7 | // Maximum number of events to be procesed
|
|---|
| 8 | Long_t max = 0;
|
|---|
| 9 |
|
|---|
| 10 | // ======================================================
|
|---|
| 11 |
|
|---|
| 12 | MDrsCalibration drscalib1024;
|
|---|
| 13 | if (!drscalib1024.ReadFits(drs1024))
|
|---|
| 14 | return 52;
|
|---|
| 15 |
|
|---|
| 16 | // ======================================================
|
|---|
| 17 |
|
|---|
| 18 | MStatusDisplay *d = new MStatusDisplay;
|
|---|
| 19 |
|
|---|
| 20 | // ======================================================
|
|---|
| 21 |
|
|---|
| 22 | gLog.Separator("Callisto");
|
|---|
| 23 | gLog << all;
|
|---|
| 24 | gLog << "DRS Timing " << timfile << '\n';
|
|---|
| 25 | gLog << "DRS 1024 " << drs1024 << '\n';
|
|---|
| 26 | gLog << endl;
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | MDrsCalibrationTime timecam;
|
|---|
| 30 |
|
|---|
| 31 | gStyle->SetOptFit(kTRUE);
|
|---|
| 32 |
|
|---|
| 33 | // ======================================================
|
|---|
| 34 |
|
|---|
| 35 | gLog << endl;
|
|---|
| 36 | gLog.Separator("Processing DRS timing calibration run");
|
|---|
| 37 |
|
|---|
| 38 | MTaskList tlist0;
|
|---|
| 39 |
|
|---|
| 40 | MParList plist0;
|
|---|
| 41 | plist0.AddToList(&tlist0);
|
|---|
| 42 | plist0.AddToList(&drscalib1024);
|
|---|
| 43 | plist0.AddToList(&timecam);
|
|---|
| 44 |
|
|---|
| 45 | MEvtLoop loop0("DetermineTimeCal");
|
|---|
| 46 | loop0.SetDisplay(d);
|
|---|
| 47 | loop0.SetParList(&plist0);
|
|---|
| 48 |
|
|---|
| 49 | // ------------------ Setup the tasks ---------------
|
|---|
| 50 |
|
|---|
| 51 | MRawFitsRead read0(timfile);
|
|---|
| 52 |
|
|---|
| 53 | MContinue cont0("MRawEvtHeader.GetTriggerID!=33792", "SelectTim");
|
|---|
| 54 |
|
|---|
| 55 | MGeomApply apply0;
|
|---|
| 56 |
|
|---|
| 57 | MDrsCalibApply drsapply0;
|
|---|
| 58 |
|
|---|
| 59 | MFillH fill0("MHDrsCalibrationTime");
|
|---|
| 60 | fill0.SetNameTab("DeltaT");
|
|---|
| 61 |
|
|---|
| 62 | tlist0.AddToList(&read0);
|
|---|
| 63 | tlist0.AddToList(&apply0);
|
|---|
| 64 | tlist0.AddToList(&drsapply0);
|
|---|
| 65 | tlist0.AddToList(&cont0);
|
|---|
| 66 | tlist0.AddToList(&fill0);
|
|---|
| 67 |
|
|---|
| 68 | if (!loop0.Eventloop(max))
|
|---|
| 69 | return 8;
|
|---|
| 70 |
|
|---|
| 71 | if (!loop0.GetDisplay())
|
|---|
| 72 | return 9;
|
|---|
| 73 |
|
|---|
| 74 | //MHDrsCalibrationTime *t = (MHDrsCalibrationTime*)plist0.FindObject("MHDrsCalibrationTime");
|
|---|
| 75 | //t->SetDisplay(d);
|
|---|
| 76 | //t->PlotAll();
|
|---|
| 77 |
|
|---|
| 78 | // ======================================================
|
|---|
| 79 |
|
|---|
| 80 | TString title = "-- DRS timing ";
|
|---|
| 81 | title += " [";
|
|---|
| 82 | title += timfile;
|
|---|
| 83 | title += "] --";
|
|---|
| 84 | d->SetTitle(title, kFALSE);
|
|---|
| 85 | d->SaveAs(outfile);
|
|---|
| 86 |
|
|---|
| 87 | TFile file(outfile, "UPDATE");
|
|---|
| 88 | timecam.Write();
|
|---|
| 89 |
|
|---|
| 90 | return 0;
|
|---|
| 91 | }
|
|---|