source: branches/Corsika7405Compatibility/fact/analysis/callisto.C@ 20095

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