source: branches/AddingGoogleTestEnvironment/fact/analysis/callisto.C@ 18717

Last change on this file since 18717 was 17894, checked in by Daniela Dorner, 11 years ago
fixed typo
File size: 23.0 KB
Line 
1#include "MLogManip.h"
2
3int callisto(const char *seqfile="seq/2012/01/23/20120123_023.seq", const char *outpath = "output", bool use_delays=false)
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 (use_delays)
357 timecam.SetDelays(*evt1h.GetHist());
358
359 // ======================================================
360
361 gLog << endl;
362 gLog.Separator("Extracting random pedestal");
363
364 MTaskList tlist3;
365
366 MParList plist3;
367 plist3.AddToList(&tlist3);
368 plist3.AddToList(&drscalib300);
369 plist3.AddToList(&badpixels);
370 plist3.AddToList(&timecam);
371
372 MEvtLoop loop3("DetermineRndmPed");
373 loop3.SetDisplay(d);
374 loop3.SetParList(&plist3);
375
376 // ------------------ Setup the tasks ---------------
377
378 MRawFitsRead read3;
379 read3.LoadMap(map);
380 read3.AddFile(pedfile);
381
382 MFillH fill3a(&hrate);
383
384 MContinue cont3("(MRawEvtHeader.GetTriggerID&0xff00)!=0x400", "SelectPed");
385
386 MGeomApply apply3;
387
388 MDrsCalibApply drsapply3;
389 //drsapply3.SetRemoveSpikes(4);
390
391 MFilterData filterdata3;
392
393 //---
394
395 MExtractFACT extractor3;
396 extractor3.SetRange(first_slice, last_slice);
397 extractor3.SetNoiseCalculation(kTRUE);
398
399 MCalibrateFact conv3;
400 conv3.SetScale(scale);
401 //conv3.SetCalibConst(calib);
402
403 MBadPixelsTreat treat3;
404 treat3.SetProcessPedestalRun(kFALSE);
405 treat3.SetProcessPedestalEvt(kFALSE);
406 treat3.SetProcessTimes(kFALSE);
407
408 MHCamEvent evt3b(0, "PedRdm","Interpolated random pedestal;;Signal [~phe]");
409 //evt2b.SetErrorSpread(kFALSE);
410
411 MFillH fill3b(&evt3b, "MSignalCam", "FillPedRdm");
412 fill3b.SetDrawOption("gaus");
413
414 // ------------------ Setup eventloop and run analysis ---------------
415
416 tlist3.AddToList(&read3);
417 tlist3.AddToList(&apply3);
418 tlist3.AddToList(&drsapply3);
419 tlist3.AddToList(&cont3);
420 tlist3.AddToList(&filterdata3);
421 tlist3.AddToList(&extractor3);
422// tlist3.AddToList(&fill3a);
423 tlist3.AddToList(&conv3);
424 tlist3.AddToList(&treat3);
425 tlist3.AddToList(&fill3b);
426
427 if (!loop3.Eventloop(max3))
428 return 14;
429
430 if (!loop3.GetDisplay())
431 return 15;
432
433 // ======================================================
434
435 gLog << endl;
436 gLog.Separator("Extracting pedestal");
437
438 MTaskList tlist4;
439
440 MParList plist4;
441 plist4.AddToList(&tlist4);
442 plist4.AddToList(&drscalib300);
443 plist4.AddToList(&badpixels);
444 plist4.AddToList(&timecam);
445
446 MEvtLoop loop4("DetermineExtractedPed");
447 loop4.SetDisplay(d);
448 loop4.SetParList(&plist4);
449
450 // ------------------ Setup the tasks ---------------
451
452 MRawFitsRead read4;
453 read4.LoadMap(map);
454 read4.AddFile(pedfile);
455
456 MContinue cont4("(MRawEvtHeader.GetTriggerID&0xff00)!=0x400", "SelectPed");
457
458 MGeomApply apply4;
459
460 MDrsCalibApply drsapply4;
461 //drsapply4.SetRemoveSpikes(4);
462
463 MFilterData filterdata4;
464
465 MExtractFACT extractor4;
466 extractor4.SetRange(first_slice, last_slice);
467 extractor4.SetNoiseCalculation(kFALSE);
468
469 MCalibrateFact conv4;
470 conv4.SetScale(scale);
471 //conv4.SetCalibConst(calib);
472
473 MBadPixelsTreat treat4;
474 treat4.SetProcessPedestalRun(kFALSE);
475 treat4.SetProcessPedestalEvt(kFALSE);
476
477 MHCamEvent evt4b(0, "PedExt","Interpolated extracted pedestal;;Signal [~phe]");
478 //evt4b.SetErrorSpread(kFALSE);
479
480 MFillH fill4b(&evt4b, "MSignalCam", "FillPedExt");
481 fill4b.SetDrawOption("gaus");
482
483 // ------------------ Setup eventloop and run analysis ---------------
484
485 tlist4.AddToList(&read4);
486 tlist4.AddToList(&apply4);
487 tlist4.AddToList(&drsapply4);
488 tlist4.AddToList(&cont4);
489 tlist4.AddToList(&filterdata4);
490 tlist4.AddToList(&extractor4);
491 tlist4.AddToList(&conv4);
492 tlist4.AddToList(&treat4);
493 tlist4.AddToList(&fill4b);
494
495 if (!loop4.Eventloop(max4))
496 return 15;
497
498 if (!loop4.GetDisplay())
499 return 16;
500
501 // ===================================================================
502
503 gLog << endl;
504 gLog.Separator("Extracting and calibration data");
505
506 MTaskList tlist5;
507
508 MParList plist5;
509 plist5.AddToList(&tlist5);
510 plist5.AddToList(&drscalib300);
511 plist5.AddToList(&badpixels);
512 plist5.AddToList(&timecam);
513
514 MEvtLoop loop5("CalibratingData");
515 loop5.SetDisplay(d);
516 loop5.SetParList(&plist5);
517
518 // ------------------ Setup the tasks ---------------
519
520 MRawFitsRead read5;
521 read5.LoadMap(map);
522 read5.AddFiles(iter);
523
524 MFillH fill5a(&hrate);
525
526 MGeomApply apply5;
527
528 MDrsCalibApply drsapply5;
529 //drsapply5.SetRemoveSpikes(4);
530
531 MTreatSaturation treatsat5;
532
533 MFilterData filterdata5;
534
535 MFDataPhrase filterdat("(MRawEvtHeader.GetTriggerID&0xff00)==0", "SelectDat");
536 MFDataPhrase filtercal("(MRawEvtHeader.GetTriggerID&0xff00)==0x100", "SelectCal");
537 MFDataPhrase filterped("(MRawEvtHeader.GetTriggerID&0xff00)==0x400", "SelectPed");
538 MFDataPhrase filterncl("(MRawEvtHeader.GetTriggerID&0xff00)!=0x100", "SelectNonCal");
539
540 //MContinue cont4("MRawEvtHeader.GetTriggerID!=4", "SelectData");
541
542 // ---
543
544 MExtractFACT extractor5dat;
545 extractor5dat.SetRange(first_slice, last_slice);
546 extractor5dat.SetNoiseCalculation(kFALSE);
547
548 MExtractFACT extractor5cal;
549 extractor5cal.SetRange(first_slice, last_slice);
550 extractor5cal.SetNoiseCalculation(kFALSE);
551
552 MExtractFACT extractor5tm("ExtractTM");
553 extractor5tm.SetRange(last_slice, 294);
554 extractor5tm.SetNoiseCalculation(kFALSE);
555 extractor5tm.SetNameSignalCam("TimeMarkerAmplitude");
556 extractor5tm.SetNameTimeCam("TimeMarkerTime");
557
558 extractor5dat.SetFilter(&filterncl);
559 extractor5cal.SetFilter(&filtercal);
560 //extractor4tm.SetFilter(&filtercal);
561
562 // ---
563 MCalibrateFact conv5;
564 conv5.SetScale(scale);
565 //conv5.SetCalibConst(calib);
566
567 MCalibrateDrsTimes calctm5;
568 calctm5.SetNameUncalibrated("UncalibratedTimes");
569
570 MCalibrateDrsTimes calctm5tm("CalibrateTimeMarker");
571 calctm5tm.SetNameArrivalTime("TimeMarkerTime");
572 calctm5tm.SetNameUncalibrated("UncalTimeMarker");
573 calctm5tm.SetNameCalibrated("TimeMarker");
574 calctm5tm.SetTimeMarker();
575 //calctm4tm.SetFilter(&filtercal);
576
577 MHCamEvent evt5m(6, "ExtTm", "Extracted arrival times of calibration pulse;;\\Delta T [ns]");
578 MHCamEvent evt5n(6, "CalTm", "Calibrated arrival times of calibration pulse;;\\Delta T [ns]");
579 MHCamEvent evt5q(6, "ExtTmShift", "Relative extracted arrival times of calibration pulse (w.r.t. event-median);;\\Delta T [ns]");
580 MHCamEvent evt5r(6, "CalTmShift", "Relative calibrated arrival times of calibration pulse (w.r.t. event-median);;\\Delta T [ns]");
581 MHCamEvent evt5s(6, "ExtTM", "Extracted absolute time marker position;;T [sl]");
582 MHCamEvent evt5t(6, "CalTM", "Calibrated absolute time marker position;;T [ns]");
583 MHCamEvent evt5u(6, "ExtTMshift", "Relative extracted time marker position (w.r.t. event-median);;\\Delta T [ns]");
584 MHCamEvent evt5v(6, "CalTMshift", "Relative calibrated time marker position (w.r.t. event-median);;\\Delta T [ns]");
585 MHCamEvent evt5w(6, "ExtDiff", "Difference between extracted arrival time of time marker and calibration pulse;;\\Delta T [ns]");
586 MHCamEvent evt5x(6, "CalDiff", "Difference between calibrated arrival time of time marker and calibration pulse;;\\Delta T [ns]");
587
588 evt5w.SetNameSub("UncalibratedTimes");
589 evt5x.SetNameSub("MSignalCam");
590
591 evt5q.SetMedianShift();
592 evt5r.SetMedianShift();
593 evt5u.SetMedianShift();
594 evt5v.SetMedianShift();
595 //evt4w.SetMedianShift();
596 //evt4x.SetMedianShift();
597
598 MFillH fill5m(&evt5m, "UncalibratedTimes", "FillExtTm");
599 MFillH fill5n(&evt5n, "MSignalCam", "FillCalTm");
600 MFillH fill5q(&evt5q, "UncalibratedTimes", "FillExtTmShift");
601 MFillH fill5r(&evt5r, "MSignalCam" , "FillCalTmShift");
602 MFillH fill5s(&evt5s, "UncalTimeMarker", "FillExtTM");
603 MFillH fill5t(&evt5t, "TimeMarker", "FillCalTM");
604 MFillH fill5u(&evt5u, "UncalTimeMarker", "FillExtTMshift");
605 MFillH fill5v(&evt5v, "TimeMarker", "FillCalTMshift");
606 MFillH fill5w(&evt5w, "UncalTimeMarker", "FillExtDiff");
607 MFillH fill5x(&evt5x, "TimeMarker", "FillCalDiff");
608
609 fill5m.SetDrawOption("gaus");
610 fill5n.SetDrawOption("gaus");
611 fill5q.SetDrawOption("gaus");
612 fill5r.SetDrawOption("gaus");
613 //fill5s.SetDrawOption("gaus");
614 //fill5t.SetDrawOption("gaus");
615 //fill5u.SetDrawOption("gaus");
616 //fill5v.SetDrawOption("gaus");
617 //fill5w.SetDrawOption("gaus");
618 //fill5x.SetDrawOption("gaus");
619
620
621 MBadPixelsTreat treat5;
622 treat5.SetProcessPedestalRun(kFALSE);
623 treat5.SetProcessPedestalEvt(kFALSE);
624
625 MHSectorVsTime hist5cal("CalVsTm");
626 MHSectorVsTime hist5ped("PedVsTm");
627 hist5cal.SetTitle("Median calibrated calibration signal vs event number;;Signal [~phe]");
628 hist5ped.SetTitle("Median calibrated pedestal signal vs event number;;Signal [~phe]");
629 hist5cal.SetType(0);
630 hist5ped.SetType(0);
631 hist5cal.SetMinimum(0);
632 hist5ped.SetMinimum(0);
633 hist5cal.SetUseMedian();
634 hist5ped.SetUseMedian();
635 hist5cal.SetNameTime("MTime");
636 hist5ped.SetNameTime("MTime");
637
638 MFillH fill5cal(&hist5cal, "MSignalCam", "FillCalVsTm");
639 MFillH fill5ped(&hist5ped, "MSignalCam", "FillPedVsTm");
640 fill5cal.SetFilter(&filtercal);
641 fill5ped.SetFilter(&filterped);
642
643 MHCamEvent evt5b(0, "ExtSig", "Extracted signal;;S [mV·sl]");
644 MHCamEvent evt5c(0, "CalSig", "Calibrated and interpolated signal;;S [~phe]");
645 MHCamEvent evt5d(4, "ExtSigTm", "Extracted time;;T [sl]");
646 MHCamEvent evt5e(6, "CalSigTm", "Calibrated and interpolated time;;T [ns]");
647
648 MFillH fill5b(&evt5b, "MExtractedSignalCam", "FillExtSig");
649 MFillH fill5c(&evt5c, "MSignalCam", "FillCalSig");
650 MFillH fill5d(&evt5d, "MArrivalTimeCam", "FillExtTm");
651 MFillH fill5e(&evt5e, "MSignalCam", "FillCalTm");
652
653 fill5c.SetDrawOption("gaus");
654 fill5d.SetDrawOption("gaus");
655 fill5e.SetDrawOption("gaus");
656
657 /*
658 fill4b.SetFilter(&filterdat);
659 fill4c.SetFilter(&filterdat);
660 fill4d.SetFilter(&filterdat);
661 fill4e.SetFilter(&filterdat);
662 */
663
664 //MFSoftwareTrigger swtrig;
665 //MContinue contsw(&swtrig, "FilterSwTrigger", "Software trigger");
666 //contsw.SetInverted();
667
668 const TString fname(Form("s/([0-9]+_[0-9]+)[.]fits([.][fg]z)?$/%s\\/$1_C.root/",
669 MJob::Esc(outpath).Data()));
670
671 // The second rule is for the case reading raw-files!
672 MWriteRootFile write5(2, fname, "RECREATE", "Calibrated Data");
673 write5.AddContainer("MRawRunHeader", "RunHeaders");
674 write5.AddContainer("MGeomCam", "RunHeaders");
675 write5.AddContainer("MSignalCam", "Events");
676 write5.AddContainer("MTime", "Events");
677 write5.AddContainer("MRawEvtHeader", "Events");
678 //write.AddContainer("MTriggerPattern", "Events");
679
680 // ------------------ Setup histograms and fill tasks ----------------
681
682 MContinue test;
683 test.SetFilter(&filterncl);
684
685 MTaskList tlist5tm;
686 tlist5tm.AddToList(&extractor5tm);
687 tlist5tm.AddToList(&calctm5tm);
688 tlist5tm.AddToList(&fill5m);
689 tlist5tm.AddToList(&fill5n);
690 tlist5tm.AddToList(&fill5q);
691 tlist5tm.AddToList(&fill5r);
692 //tlist5tm.AddToList(&fill5s);
693 //tlist5tm.AddToList(&fill5t);
694 tlist5tm.AddToList(&fill5u);
695 tlist5tm.AddToList(&fill5v);
696 tlist5tm.AddToList(&fill5w);
697 tlist5tm.AddToList(&fill5x);
698 tlist5tm.SetFilter(&filtercal);
699
700 MTaskList tlist5dat;
701 tlist5dat.AddToList(&fill5b);
702 tlist5dat.AddToList(&fill5c);
703 tlist5dat.AddToList(&fill5d);
704 tlist5dat.AddToList(&fill5e);
705 tlist5dat.SetFilter(&filterdat);
706
707 tlist5.AddToList(&read5);
708 tlist5.AddToList(&apply5);
709 tlist5.AddToList(&drsapply5);
710 tlist5.AddToList(&filterncl);
711 //tlist5.AddToList(&test);
712 tlist5.AddToList(&filterdat);
713 tlist5.AddToList(&filtercal);
714 tlist5.AddToList(&filterped);
715 tlist5.AddToList(&fill5a);
716 tlist5.AddToList(&treatsat5);
717 tlist5.AddToList(&filterdata5);
718 tlist5.AddToList(&extractor5dat);
719 tlist5.AddToList(&extractor5cal);
720 tlist5.AddToList(&calctm5);
721 tlist5.AddToList(&tlist5tm);
722 tlist5.AddToList(&conv5);
723 tlist5.AddToList(&treat5);
724 tlist5.AddToList(&fill5ped);
725 tlist5.AddToList(&fill5cal);
726 tlist5.AddToList(&tlist5dat);
727 tlist5.AddToList(&write5);
728
729 if (!loop5.Eventloop(max5))
730 return 18;
731
732 if (!loop5.GetDisplay())
733 return 19;
734
735 TString title = "-- Calibrated signal #";
736 title += seq.GetSequence();
737 title += " (";
738 title += drsfile;
739 title += ") --";
740 d->SetTitle(title, kFALSE);
741
742 TString path;
743 path += Form("%s/20%6d_%03d-calibration.root", outpath,
744 seq.GetSequence()/1000, seq.GetSequence()%1000);
745
746 d->SaveAs(path);
747
748 return 0;
749}
Note: See TracBrowser for help on using the repository browser.