source: branches/Mars_use_drstimefiles/fact/analysis/callisto_drstime.C@ 19899

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