source: branches/Mars_use_drstimefiles/fact/analysis/produce_drs_time_fits_file.C@ 18003

Last change on this file since 18003 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: 2.3 KB
Line 
1// The FACT collaboration
2// Dominik Neise and Sebastian Mueller October 2014
3// A callisto like CERN-Root script to process the FACT DRS
4// (Domino-Ring-Sampler) time calibration files.
5//
6// The basic script is taken from the October 2014 analysis framework running on
7// La Palma, maintained by Daniela Dorner and Thomas Bretz. There it was called
8// "callisto_drs_time.C"
9
10// Dominik and Sebastian:
11// Our first approach was to use the MWriteFitsFile class but we have not been
12// able to use it.
13
14// MWriteFitsFile fitsfile(outfile,
15// MWriteFitsFile::kSingleFile,
16// "RECREATE",
17// "fitsfile",
18// "atitle");
19// fitsfile.SetBytesPerSample("Data", 2);
20// fitsfile.AddContainer("MDrsCalibrationTime","DANDELION");
21
22#include "MLogManip.h"
23
24int produce_drs_time_fits_file(
25 const char *drs_time_file, //* path to raw drs-time-calib-file
26 const char *drs_file, //* path to drs.fits(.gz) file
27 const char *outfile //* output path like yyyymmdd_rrr.drs.time.fits
28){
29 gLog.Separator("produce_drs_time_fits_file");
30 gLog << all;
31 gLog << "DRS Timing " << drs_time_file << '\n';
32 gLog << "DRS 1024 " << drs_file << '\n';
33 gLog << endl;
34
35 MParList plist0;
36
37 MTaskList tlist0;
38 plist0.AddToList(&tlist0);
39
40 MDrsCalibration drscalib1024;
41 if (!drscalib1024.ReadFits(drs_file)){
42 gLog << "Error while opening drs amplitude calibration file:"
43 << drs_file << "Aborting" << endl;
44 return 52; // DN: Why 52 I don't know.
45 }
46 plist0.AddToList(&drscalib1024);
47
48 MDrsCalibrationTime timecam;
49 plist0.AddToList(&timecam);
50
51 MEvtLoop loop0("DetermineTimeCal");
52 loop0.SetParList(&plist0);
53
54 MRawFitsRead read0(drs_time_file);
55 tlist0.AddToList(&read0);
56 MGeomApply apply0;
57 tlist0.AddToList(&apply0);
58 MDrsCalibApply drsapply0;
59 tlist0.AddToList(&drsapply0);
60 MContinue cont0("MRawEvtHeader.GetTriggerID!=33792", "SelectTim");
61 tlist0.AddToList(&cont0);
62 MFillH fill0("MHDrsCalibrationTime");
63 fill0.SetNameTab("DeltaT");
64 tlist0.AddToList(&fill0);
65
66 if (!loop0.Eventloop(0)){
67 gLog << "Error performing the loop over the drs-time-run:"
68 << drs_time_file << "Aborting" << endl;
69 return 8; // DN: why 8 I don't know.
70 }
71
72 timecam.WriteToFits(outfile);
73
74 return 0;
75}
Note: See TracBrowser for help on using the repository browser.