source: trunk/Mars/fact/analysis/callisto.C@ 18274

Last change on this file since 18274 was 18274, checked in by Daniela Dorner, 9 years ago
commented loop for lp-run as data were removed from archive at isdc
File size: 23.5 KB
Line 
1#include "MLogManip.h"
2
3int callisto(const char *seqfile="seq/2012/01/23/20120123_023.seq", const char *outpath = "output",
4// TString drstime = "/gpfs0/fact/processing/drs_time_calib/20111115.time.drs.fits",
5 const char *drstime = "/gpfs0/fact/processing/drs_time_calib/20111115.time.drs.fits",
6 const char *delays="resources/delays-20150217.txt")
7{
8 // ======================================================
9
10 // true: Display correctly mapped pixels in the camera displays
11 // but the value-vs-index plot is in software/spiral indices
12 // false: Display pixels in hardware/linear indices,
13 // but the order is the camera display is distorted
14 bool usemap = true;
15
16 // map file to use (get that from La Palma!)
17// const char *map = usemap ? "/home/fact/FACT++/FACTmap111030.txt" : NULL;
18 const char *map = usemap ? "/scratch/fact/FACTmap111030.txt" : NULL;
19
20 // ------------------------------------------------------
21
22 MStatusDisplay *d = new MStatusDisplay;
23
24 MBadPixelsCam badpixels;
25 badpixels.InitSize(1440);
26 badpixels[ 424].SetUnsuitable(MBadPixelsPix::kUnsuitable);
27 badpixels[ 583].SetUnsuitable(MBadPixelsPix::kUnsuitable);
28 badpixels[ 830].SetUnsuitable(MBadPixelsPix::kUnsuitable);
29 badpixels[ 923].SetUnsuitable(MBadPixelsPix::kUnsuitable);
30 badpixels[1208].SetUnsuitable(MBadPixelsPix::kUnsuitable);
31 badpixels[1399].SetUnsuitable(MBadPixelsPix::kUnsuitable);
32 // Twin pixel
33 // 113
34 // 115
35 // 354
36 // 423
37 // 1195
38 // 1393
39
40 // ------------------------------------------------------
41
42 // ------------------------------------------------------
43
44 // Calib: 51 / 90 / 197 (20% TH)
45 // Data: 52 / 64 / 104 (20% TH)
46
47 // Extraction range in slices. It will always(!) contain the full range
48 // of integration
49 const int first_slice = 25; // 10ns
50 const int last_slice = 225; // 125ns
51
52 const double heighttm = 0.5; // IntegralAbs { 1.5pe * 9.6mV/pe } / IntegralRel { 0.5 }
53
54 Long_t max = 0; // All
55 Long_t max0 = max; // Time marker
56 Long_t max1 = max; // Light pulser
57 //Long_t max2 = 3000; // Calibration ratio
58 Long_t max3 = max; // Pedestal Rndm
59 Long_t max4 = max; // Pedestal Ext
60 Long_t max5 = max; // Data
61
62 // ========================= Result ==================================
63
64 //double scale = 0.1;
65 double scale = 0.1024;
66
67 // ======================================================
68
69 if (map && gSystem->AccessPathName(map, kFileExists))
70 {
71 gLog << err << "ERROR - Cannot access mapping file '" << map << "'" << endl;
72 return 1;
73 }
74
75 // The sequence file which defines the files for the analysis
76 MSequence seq(seqfile);
77 if (!seq.IsValid())
78 {
79 gLog << err << "ERROR - Sequence '" << seqfile << "' invalid!" << endl;
80 return 2;
81 }
82
83 // --------------------------------------------------------------------------------
84
85 gLog.Separator("Callisto");
86 gLog << all << "Calibrate data of sequence '" << seq.GetFileName() << "'" << endl;
87 gLog << endl;
88
89 // ------------------------------------------------------
90
91 ostringstream drsname;
92 drsname << gSystem->DirName(seqfile) << "/";
93 drsname << seq.GetNight().GetNightAsInt() << "_";
94 drsname << Form("%03d", seq.GetDrsSequence()) << ".drs.seq";
95
96 MSequence drs(drsname.str().c_str());
97 if (!drs.IsValid())
98 {
99 gLog << err << "ERROR - DRS sequence invalid!" << endl;
100 return 3;
101 }
102
103 gLog << all << "DRS sequence file: " << drsname.str() << '\n' << endl;
104
105 TString drsfile = seq.GetFileName(0, MSequence::kRawDrs);
106 if (drsfile.IsNull())
107 {
108 gLog << err << "No DRS file available in sequence." << endl;
109 return 4;
110 }
111
112 TString drs1024 = drs.GetFileName(0, MSequence::kFitsDrs);
113 TString pedfile = seq.GetFileName(0, MSequence::kFitsPed);
114 TString calfile = seq.GetFileName(0, MSequence::kFitsCal);
115
116 gLog << all;
117 gLog << "DRS calib 300: " << drsfile << '\n';
118 gLog << "DRS calib 1024: " << drs1024 << "\n\n";
119 gLog << "DRS calib Time: " << drstime << "\n\n";
120
121 MDrsCalibrationTime drscalibtime;
122 if (!drscalibtime.ReadFits(drstime)))
123 return 5;
124
125 MDrsCalibration drscalib300;
126 if (!drscalib300.ReadFits(drsfile.Data()))
127 return 6;
128
129 MDrsCalibration drscalib1024;
130 if (!drscalib1024.ReadFits(drs1024.Data()))
131 return 7;
132
133 gLog << all;
134 gLog << "Pedestal file: " << pedfile << '\n';
135 gLog << "Light Pulser file: " << calfile << '\n' << endl;
136
137 // ------------------------------------------------------
138
139 MDirIter iter;
140 if (seq.GetRuns(iter, MSequence::kFitsDat)<=0)
141 {
142 gLog << err << "ERROR - Sequence valid but without files." << endl;
143 return 8;
144 }
145 iter.Print();
146
147 // ======================================================
148
149/*
150 MStatusArray arrt, arrp;
151
152 TFile ft(lp_template);
153 if (arrt.Read()<=0)
154 {
155 gLog << err << "ERROR - Reading LP template from " << lp_template << endl;
156 return 100;
157 }
158
159 MHCamera *lpref = (MHCamera*)arrt.FindObjectInCanvas("ExtCalSig;avg", "MHCamera", "Cam");
160 if (!lpref)
161 {
162 gLog << err << "ERROR - LP Template not found in " << lp_template << endl;
163 return 101;
164 }
165 lpref->SetDirectory(0);
166
167 MHCamera *gain = (MHCamera*)arrt.FindObjectInCanvas("gain", "MHCamera", "Gain");
168 if (!gain)
169 {
170 gLog << err << "ERROR - Gain not found in " << lp_template << endl;
171 return 101;
172 }
173 gain->SetDirectory(0);
174
175 TFile fp(pulse_template);
176 if (arrp.Read()<=0)
177 {
178 gLog << err << "ERROR - Reading Pulse template from " << pulse_template << endl;
179 return 102;
180 }
181
182 TH1F *hpulse = (TH1F*)arrp.FindObjectInCanvas("hPixelEdgeMean0_0", "TH1F", "cgpPixelPulses0");
183 if (!hpulse)
184 {
185 gLog << err << "ERROR - Pulse Template not found in " << pulse_template << endl;
186 return 103;
187 }
188 hpulse->SetDirectory(0);
189*/
190 // ======================================================
191
192 // Plot the trigger pattern rates vs. run-number
193 MH3 hrate("MRawRunHeader.GetFileID", "MRawEvtHeader.GetTriggerID&0xff00");
194 hrate.SetWeight("1./TMath::Max(MRawRunHeader.GetRunLength,1)");
195 hrate.SetName("Rate");
196 hrate.SetTitle("Event rate [Hz];File Id;Trigger Type;");
197 hrate.InitLabels(MH3::kLabelsXY);
198 hrate.DefineLabelY( 0, "Data"); // What if TriggerID==0 already???
199 hrate.DefineLabelY(0x100, "Cal");
200 hrate.DefineLabelY(0x400, "Ped");
201 // hrate.DefaultLabelY("ERROR");
202
203// MDrsCalibrationTime timecam;
204
205 gStyle->SetOptFit(kTRUE);
206
207 // ======================================================
208/*
209 gLog << endl;
210 gLog.Separator("Processing DRS timing calibration run");
211
212 MTaskList tlist0;
213
214 MParList plist0;
215 plist0.AddToList(&tlist0);
216 plist0.AddToList(&drscalib1024);
217 plist0.AddToList(&timecam);
218
219 MEvtLoop loop0("DetermineTimeCal");
220 loop0.SetDisplay(d);
221 loop0.SetParList(&plist0);
222
223 // ------------------ Setup the tasks ---------------
224
225 MRawFitsRead read0(timfile);
226
227 MContinue cont0("MRawEvtHeader.GetTriggerID!=33792", "SelectTim");
228
229 MGeomApply apply0;
230
231 MDrsCalibApply drsapply0;
232 //drsapply0.SetRemoveSpikes(4);
233
234 MFillH fill0("MHDrsCalibrationTime");
235 fill0.SetNameTab("DeltaT");
236
237 tlist0.AddToList(&read0);
238 tlist0.AddToList(&apply0);
239 tlist0.AddToList(&drsapply0);
240 tlist0.AddToList(&cont0);
241 tlist0.AddToList(&fill0);
242
243 if (!loop0.Eventloop(max0))
244 return 8;
245
246 if (!loop0.GetDisplay())
247 return 9;
248*/
249 /*
250 MHDrsCalibrationT *t = (MHDrsCalibrationT*)plist4.FindObject("MHDrsCalibrationT");
251 t->SetDisplay(d);
252 t->PlotAll();
253 */
254
255 // ======================================================
256
257 gLog << endl;
258 gLog.Separator("Processing external light pulser run");
259
260 MTaskList tlist1;
261
262 MParList plist1;
263 plist1.AddToList(&tlist1);
264 plist1.AddToList(&drscalib300);
265 plist1.AddToList(&badpixels);
266 plist1.AddToList(&drscalibtime);
267
268 MEvtLoop loop1("DetermineCalConst");
269 loop1.SetDisplay(d);
270 loop1.SetParList(&plist1);
271
272 // ------------------ Setup the tasks ---------------
273
274 MRawFitsRead read1;
275 read1.LoadMap(map);
276 read1.AddFile(calfile);
277
278 MContinue cont1("(MRawEvtHeader.GetTriggerID&0xff00)!=0x100", "SelectCal");
279
280 MGeomApply apply1;
281
282 MDrsCalibApply drsapply1;
283 //drsapply1.SetRemoveSpikes(4);
284
285 MFilterData filterdata1;
286
287 // ---
288
289 MExtractFACT extractor1b("ExtractPulse");
290 extractor1b.SetRange(first_slice, last_slice);
291 extractor1b.SetNoiseCalculation(kFALSE);
292
293 // ---
294
295 MHCamEvent evt1f(0, "ExtCalSig", "Extracted calibration signal;;S [mV·sl]");
296 MHCamEvent evt1g(4, "ExtCalTm", "Extracted arrival times;;T [sl]");
297 MHCamEvent evt1h(6, "CalCalTm", "Calibrated arrival times;;T [sl]");
298
299 MHSectorVsTime hist1rmsb("ExtSigVsTm");
300 MHSectorVsTime hist1tmb("CalTmVsTm");
301 hist1rmsb.SetTitle("Extracted calibration vs event number;;S [mV·sl]");
302 hist1rmsb.SetType(0);
303 hist1tmb.SetTitle("Extracted arrival time vs event number;;T [sl]");
304 //hist1tmb.SetType(4);
305 hist1tmb.SetType(6);
306
307 MFillH fill1f(&evt1f, "MExtractedSignalCam", "FillExtSig");
308 MFillH fill1g(&evt1g, "MArrivalTimeCam", "FillExtTm");
309 MFillH fill1h(&evt1h, "MSignalCam", "FillCalTm");
310 MFillH fill1r(&hist1rmsb, "MExtractedSignalCam", "FillExtSigVsTm");
311 //MFillH fill1j(&hist1tmb, "MArrivalTimeCam", "FillExtTmVsTm");
312 MFillH fill1j(&hist1tmb, "MSignalCam", "FillCalTmVsTm");
313
314 fill1f.SetDrawOption("gaus");
315 fill1h.SetDrawOption("gaus");
316
317 // ---
318
319 MCalibrateDrsTimes calctm1a("CalibrateCalEvents");
320 calctm1a.SetNameUncalibrated("UncalibratedTimes");
321
322 MBadPixelsTreat treat1;
323 treat1.SetProcessPedestalRun(kFALSE);
324 treat1.SetProcessPedestalEvt(kFALSE);
325
326 // ---
327
328 MHCamEvent evt1c(6, "ExtCalTmShift", "Relative extracted arrival time of calibration pulse (w.r.t. event-median);;\\Delta T [ns]");
329 MHCamEvent evt1d(6, "CalCalTmShift", "Relative calibrated arrival time of calibration pulse (w.r.t. event-median);;\\Delta T [ns]");
330
331 evt1c.SetMedianShift();
332 evt1d.SetMedianShift();
333
334 MFillH fill1c(&evt1c, "UncalibratedTimes", "FillExtCalTm");
335 MFillH fill1d(&evt1d, "MSignalCam", "FillCalCalTm");
336 fill1d.SetDrawOption("gaus");
337
338 // ------------------ Setup eventloop and run analysis ---------------
339
340 tlist1.AddToList(&read1);
341 tlist1.AddToList(&apply1);
342 tlist1.AddToList(&drsapply1);
343 tlist1.AddToList(&cont1);
344 tlist1.AddToList(&filterdata1);
345 tlist1.AddToList(&extractor1b);
346 tlist1.AddToList(&calctm1a);
347 tlist1.AddToList(&treat1);
348 tlist1.AddToList(&fill1f);
349 tlist1.AddToList(&fill1g);
350 tlist1.AddToList(&fill1h);
351 tlist1.AddToList(&fill1r);
352 tlist1.AddToList(&fill1j);
353 tlist1.AddToList(&fill1c);
354 tlist1.AddToList(&fill1d);
355
356 //if (!loop1.Eventloop(max1))
357 // return 10;
358
359 //if (!loop1.GetDisplay())
360 // return 11;
361
362 if (delays)
363 {
364 TGraph g(delays);
365 if (g.GetN()!=1440)
366 {
367 gLog << err << "Error reading file " << delays << endl;
368 return 41;
369 }
370
371 drscalibtime.SetDelays(g);
372 }
373
374 // ======================================================
375
376 gLog << endl;
377 gLog.Separator("Extracting random pedestal");
378
379 MTaskList tlist3;
380
381 MParList plist3;
382 plist3.AddToList(&tlist3);
383 plist3.AddToList(&drscalib300);
384 plist3.AddToList(&badpixels);
385 plist3.AddToList(&drscalibtime);
386
387 MEvtLoop loop3("DetermineRndmPed");
388 loop3.SetDisplay(d);
389 loop3.SetParList(&plist3);
390
391 // ------------------ Setup the tasks ---------------
392
393 MRawFitsRead read3;
394 read3.LoadMap(map);
395 read3.AddFile(pedfile);
396
397 MFillH fill3a(&hrate);
398
399 MContinue cont3("(MRawEvtHeader.GetTriggerID&0xff00)!=0x400", "SelectPed");
400
401 MGeomApply apply3;
402
403 MDrsCalibApply drsapply3;
404 //drsapply3.SetRemoveSpikes(4);
405
406 MFilterData filterdata3;
407
408 //---
409
410 MExtractFACT extractor3;
411 extractor3.SetRange(first_slice, last_slice);
412 extractor3.SetNoiseCalculation(kTRUE);
413
414 MCalibrateFact conv3;
415 conv3.SetScale(scale);
416 //conv3.SetCalibConst(calib);
417
418 MBadPixelsTreat treat3;
419 treat3.SetProcessPedestalRun(kFALSE);
420 treat3.SetProcessPedestalEvt(kFALSE);
421 treat3.SetProcessTimes(kFALSE);
422
423 MHCamEvent evt3b(0, "PedRdm","Interpolated random pedestal;;Signal [~phe]");
424 //evt2b.SetErrorSpread(kFALSE);
425
426 MFillH fill3b(&evt3b, "MSignalCam", "FillPedRdm");
427 fill3b.SetDrawOption("gaus");
428
429 // ------------------ Setup eventloop and run analysis ---------------
430
431 tlist3.AddToList(&read3);
432 tlist3.AddToList(&apply3);
433 tlist3.AddToList(&drsapply3);
434 tlist3.AddToList(&cont3);
435 tlist3.AddToList(&filterdata3);
436 tlist3.AddToList(&extractor3);
437// tlist3.AddToList(&fill3a);
438 tlist3.AddToList(&conv3);
439 tlist3.AddToList(&treat3);
440 tlist3.AddToList(&fill3b);
441
442 if (!loop3.Eventloop(max3))
443 return 14;
444
445 if (!loop3.GetDisplay())
446 return 15;
447
448 // ======================================================
449
450 gLog << endl;
451 gLog.Separator("Extracting pedestal");
452
453 MTaskList tlist4;
454
455 MParList plist4;
456 plist4.AddToList(&tlist4);
457 plist4.AddToList(&drscalib300);
458 plist4.AddToList(&badpixels);
459 plist4.AddToList(&drscalibtime);
460
461 MEvtLoop loop4("DetermineExtractedPed");
462 loop4.SetDisplay(d);
463 loop4.SetParList(&plist4);
464
465 // ------------------ Setup the tasks ---------------
466
467 MRawFitsRead read4;
468 read4.LoadMap(map);
469 read4.AddFile(pedfile);
470
471 MContinue cont4("(MRawEvtHeader.GetTriggerID&0xff00)!=0x400", "SelectPed");
472
473 MGeomApply apply4;
474
475 MDrsCalibApply drsapply4;
476 //drsapply4.SetRemoveSpikes(4);
477
478 MFilterData filterdata4;
479
480 MExtractFACT extractor4;
481 extractor4.SetRange(first_slice, last_slice);
482 extractor4.SetNoiseCalculation(kFALSE);
483
484 MCalibrateFact conv4;
485 conv4.SetScale(scale);
486 //conv4.SetCalibConst(calib);
487
488 MBadPixelsTreat treat4;
489 treat4.SetProcessPedestalRun(kFALSE);
490 treat4.SetProcessPedestalEvt(kFALSE);
491
492 MHCamEvent evt4b(0, "PedExt","Interpolated extracted pedestal;;Signal [~phe]");
493 //evt4b.SetErrorSpread(kFALSE);
494
495 MFillH fill4b(&evt4b, "MSignalCam", "FillPedExt");
496 fill4b.SetDrawOption("gaus");
497
498 // ------------------ Setup eventloop and run analysis ---------------
499
500 tlist4.AddToList(&read4);
501 tlist4.AddToList(&apply4);
502 tlist4.AddToList(&drsapply4);
503 tlist4.AddToList(&cont4);
504 tlist4.AddToList(&filterdata4);
505 tlist4.AddToList(&extractor4);
506 tlist4.AddToList(&conv4);
507 tlist4.AddToList(&treat4);
508 tlist4.AddToList(&fill4b);
509
510 if (!loop4.Eventloop(max4))
511 return 15;
512
513 if (!loop4.GetDisplay())
514 return 16;
515
516 // ===================================================================
517
518 gLog << endl;
519 gLog.Separator("Extracting and calibration data");
520
521 MTaskList tlist5;
522
523 MParList plist5;
524 plist5.AddToList(&tlist5);
525 plist5.AddToList(&drscalib300);
526 plist5.AddToList(&badpixels);
527 plist5.AddToList(&drscalibtime);
528
529 MEvtLoop loop5("CalibratingData");
530 loop5.SetDisplay(d);
531 loop5.SetParList(&plist5);
532
533 // ------------------ Setup the tasks ---------------
534
535 MRawFitsRead read5;
536 read5.LoadMap(map);
537 read5.AddFiles(iter);
538
539 MFillH fill5a(&hrate);
540
541 MGeomApply apply5;
542
543 MDrsCalibApply drsapply5;
544 //drsapply5.SetRemoveSpikes(4);
545
546 MTreatSaturation treatsat5;
547
548 MFilterData filterdata5;
549
550 MFDataPhrase filterdat("(MRawEvtHeader.GetTriggerID&0xff00)==0", "SelectDat");
551 MFDataPhrase filtercal("(MRawEvtHeader.GetTriggerID&0xff00)==0x100", "SelectCal");
552 MFDataPhrase filterped("(MRawEvtHeader.GetTriggerID&0xff00)==0x400", "SelectPed");
553 MFDataPhrase filterncl("(MRawEvtHeader.GetTriggerID&0xff00)!=0x100", "SelectNonCal");
554
555 //MContinue cont4("MRawEvtHeader.GetTriggerID!=4", "SelectData");
556
557 // ---
558
559 MExtractFACT extractor5dat;
560 extractor5dat.SetRange(first_slice, last_slice);
561 extractor5dat.SetNoiseCalculation(kFALSE);
562
563 MExtractFACT extractor5cal;
564 extractor5cal.SetRange(first_slice, last_slice);
565 extractor5cal.SetNoiseCalculation(kFALSE);
566
567 MExtractFACT extractor5tm("ExtractTM");
568 extractor5tm.SetRange(last_slice, 294);
569 extractor5tm.SetNoiseCalculation(kFALSE);
570 extractor5tm.SetNameSignalCam("TimeMarkerAmplitude");
571 extractor5tm.SetNameTimeCam("TimeMarkerTime");
572
573 extractor5dat.SetFilter(&filterncl);
574 extractor5cal.SetFilter(&filtercal);
575 //extractor4tm.SetFilter(&filtercal);
576
577 // ---
578 MCalibrateFact conv5;
579 conv5.SetScale(scale);
580 //conv5.SetCalibConst(calib);
581
582 MCalibrateDrsTimes calctm5;
583 calctm5.SetNameUncalibrated("UncalibratedTimes");
584
585 MCalibrateDrsTimes calctm5tm("CalibrateTimeMarker");
586 calctm5tm.SetNameArrivalTime("TimeMarkerTime");
587 calctm5tm.SetNameUncalibrated("UncalTimeMarker");
588 calctm5tm.SetNameCalibrated("TimeMarker");
589 calctm5tm.SetTimeMarker();
590 //calctm4tm.SetFilter(&filtercal);
591
592 MHCamEvent evt5m(6, "ExtTm", "Extracted arrival times of calibration pulse;;\\Delta T [ns]");
593 MHCamEvent evt5n(6, "CalTm", "Calibrated arrival times of calibration pulse;;\\Delta T [ns]");
594 MHCamEvent evt5q(6, "ExtTmShift", "Relative extracted arrival times of calibration pulse (w.r.t. event-median);;\\Delta T [ns]");
595 MHCamEvent evt5r(6, "CalTmShift", "Relative calibrated arrival times of calibration pulse (w.r.t. event-median);;\\Delta T [ns]");
596 MHCamEvent evt5s(6, "ExtTM", "Extracted absolute time marker position;;T [sl]");
597 MHCamEvent evt5t(6, "CalTM", "Calibrated absolute time marker position;;T [ns]");
598 MHCamEvent evt5u(6, "ExtTMshift", "Relative extracted time marker position (w.r.t. event-median);;\\Delta T [ns]");
599 MHCamEvent evt5v(6, "CalTMshift", "Relative calibrated time marker position (w.r.t. event-median);;\\Delta T [ns]");
600 MHCamEvent evt5w(6, "ExtDiff", "Difference between extracted arrival time of time marker and calibration pulse;;\\Delta T [ns]");
601 MHCamEvent evt5x(6, "CalDiff", "Difference between calibrated arrival time of time marker and calibration pulse;;\\Delta T [ns]");
602
603 evt5w.SetNameSub("UncalibratedTimes");
604 evt5x.SetNameSub("MSignalCam");
605
606 evt5q.SetMedianShift();
607 evt5r.SetMedianShift();
608 evt5u.SetMedianShift();
609 evt5v.SetMedianShift();
610 //evt4w.SetMedianShift();
611 //evt4x.SetMedianShift();
612
613 MFillH fill5m(&evt5m, "UncalibratedTimes", "FillExtTm");
614 MFillH fill5n(&evt5n, "MSignalCam", "FillCalTm");
615 MFillH fill5q(&evt5q, "UncalibratedTimes", "FillExtTmShift");
616 MFillH fill5r(&evt5r, "MSignalCam" , "FillCalTmShift");
617 MFillH fill5s(&evt5s, "UncalTimeMarker", "FillExtTM");
618 MFillH fill5t(&evt5t, "TimeMarker", "FillCalTM");
619 MFillH fill5u(&evt5u, "UncalTimeMarker", "FillExtTMshift");
620 MFillH fill5v(&evt5v, "TimeMarker", "FillCalTMshift");
621 MFillH fill5w(&evt5w, "UncalTimeMarker", "FillExtDiff");
622 MFillH fill5x(&evt5x, "TimeMarker", "FillCalDiff");
623
624 fill5m.SetDrawOption("gaus");
625 fill5n.SetDrawOption("gaus");
626 fill5q.SetDrawOption("gaus");
627 fill5r.SetDrawOption("gaus");
628 //fill5s.SetDrawOption("gaus");
629 //fill5t.SetDrawOption("gaus");
630 //fill5u.SetDrawOption("gaus");
631 //fill5v.SetDrawOption("gaus");
632 //fill5w.SetDrawOption("gaus");
633 //fill5x.SetDrawOption("gaus");
634
635
636 MBadPixelsTreat treat5;
637 treat5.SetProcessPedestalRun(kFALSE);
638 treat5.SetProcessPedestalEvt(kFALSE);
639
640 MHSectorVsTime hist5cal("CalVsTm");
641 MHSectorVsTime hist5ped("PedVsTm");
642 hist5cal.SetTitle("Median calibrated calibration signal vs event number;;Signal [~phe]");
643 hist5ped.SetTitle("Median calibrated pedestal signal vs event number;;Signal [~phe]");
644 hist5cal.SetType(0);
645 hist5ped.SetType(0);
646 hist5cal.SetMinimum(0);
647 hist5ped.SetMinimum(0);
648 hist5cal.SetUseMedian();
649 hist5ped.SetUseMedian();
650 hist5cal.SetNameTime("MTime");
651 hist5ped.SetNameTime("MTime");
652
653 MFillH fill5cal(&hist5cal, "MSignalCam", "FillCalVsTm");
654 MFillH fill5ped(&hist5ped, "MSignalCam", "FillPedVsTm");
655 fill5cal.SetFilter(&filtercal);
656 fill5ped.SetFilter(&filterped);
657
658 MHCamEvent evt5b(0, "ExtSig", "Extracted signal;;S [mV·sl]");
659 MHCamEvent evt5c(0, "CalSig", "Calibrated and interpolated signal;;S [~phe]");
660 MHCamEvent evt5d(4, "ExtSigTm", "Extracted time;;T [sl]");
661 MHCamEvent evt5e(6, "CalSigTm", "Calibrated and interpolated time;;T [ns]");
662
663 MFillH fill5b(&evt5b, "MExtractedSignalCam", "FillExtSig");
664 MFillH fill5c(&evt5c, "MSignalCam", "FillCalSig");
665 MFillH fill5d(&evt5d, "MArrivalTimeCam", "FillExtTm");
666 MFillH fill5e(&evt5e, "MSignalCam", "FillCalTm");
667
668 fill5c.SetDrawOption("gaus");
669 fill5d.SetDrawOption("gaus");
670 fill5e.SetDrawOption("gaus");
671
672 /*
673 fill4b.SetFilter(&filterdat);
674 fill4c.SetFilter(&filterdat);
675 fill4d.SetFilter(&filterdat);
676 fill4e.SetFilter(&filterdat);
677 */
678
679 //MFSoftwareTrigger swtrig;
680 //MContinue contsw(&swtrig, "FilterSwTrigger", "Software trigger");
681 //contsw.SetInverted();
682
683 const TString fname(Form("s/([0-9]+_[0-9]+)[.]fits([.][fg]z)?$/%s\\/$1_C.root/",
684 MJob::Esc(outpath).Data()));
685
686 // The second rule is for the case reading raw-files!
687 MWriteRootFile write5(2, fname, "RECREATE", "Calibrated Data");
688 write5.AddContainer("MRawRunHeader", "RunHeaders");
689 write5.AddContainer("MGeomCam", "RunHeaders");
690 write5.AddContainer("MSignalCam", "Events");
691 write5.AddContainer("MTime", "Events");
692 write5.AddContainer("MRawEvtHeader", "Events");
693 //write.AddContainer("MTriggerPattern", "Events");
694
695 // ------------------ Setup histograms and fill tasks ----------------
696
697 MContinue test;
698 test.SetFilter(&filterncl);
699
700 MTaskList tlist5tm;
701 tlist5tm.AddToList(&extractor5tm);
702 tlist5tm.AddToList(&calctm5tm);
703 tlist5tm.AddToList(&fill5m);
704 tlist5tm.AddToList(&fill5n);
705 tlist5tm.AddToList(&fill5q);
706 tlist5tm.AddToList(&fill5r);
707 //tlist5tm.AddToList(&fill5s);
708 //tlist5tm.AddToList(&fill5t);
709 tlist5tm.AddToList(&fill5u);
710 tlist5tm.AddToList(&fill5v);
711 tlist5tm.AddToList(&fill5w);
712 tlist5tm.AddToList(&fill5x);
713 tlist5tm.SetFilter(&filtercal);
714
715 MTaskList tlist5dat;
716 tlist5dat.AddToList(&fill5b);
717 tlist5dat.AddToList(&fill5c);
718 tlist5dat.AddToList(&fill5d);
719 tlist5dat.AddToList(&fill5e);
720 tlist5dat.SetFilter(&filterdat);
721
722 tlist5.AddToList(&read5);
723 tlist5.AddToList(&apply5);
724 tlist5.AddToList(&drsapply5);
725 tlist5.AddToList(&filterncl);
726 //tlist5.AddToList(&test);
727 tlist5.AddToList(&filterdat);
728 tlist5.AddToList(&filtercal);
729 tlist5.AddToList(&filterped);
730 tlist5.AddToList(&fill5a);
731 tlist5.AddToList(&treatsat5);
732 tlist5.AddToList(&filterdata5);
733 tlist5.AddToList(&extractor5dat);
734 tlist5.AddToList(&extractor5cal);
735 tlist5.AddToList(&calctm5);
736 tlist5.AddToList(&tlist5tm);
737 tlist5.AddToList(&conv5);
738 tlist5.AddToList(&treat5);
739 tlist5.AddToList(&fill5ped);
740 tlist5.AddToList(&fill5cal);
741 tlist5.AddToList(&tlist5dat);
742 tlist5.AddToList(&write5);
743
744 if (!loop5.Eventloop(max5))
745 return 18;
746
747 if (!loop5.GetDisplay())
748 return 19;
749
750 TString title = "-- Calibrated signal #";
751 title += seq.GetSequence();
752 title += " (";
753 title += drsfile;
754 title += ") --";
755 d->SetTitle(title, kFALSE);
756
757 TString path;
758 path += Form("%s/20%6d_%03d-calibration.root", outpath,
759 seq.GetSequence()/1000, seq.GetSequence()%1000);
760
761 d->SaveAs(path);
762
763 return 0;
764}
Note: See TracBrowser for help on using the repository browser.