source: branches/Mars_MC/macros/fact/fake_drs_calibration.C@ 17063

Last change on this file since 17063 was 17051, checked in by ftemme, 11 years ago
Added the small macro to write a fake drs calibration file
File size: 1.7 KB
Line 
1#include "DrsCalib.h"
2
3
4using namespace std;
5
6// --------------------------------------------------------------------------
7
8int fake_drs_calibration()
9{
10 DrsCalibration drscalib;
11 const string filename = "/fhgfs/groups/app/testingdrsfile/test150samples_2.drs.fits";
12 uint16_t fRoi = 150;
13 uint16_t fNumTm = 0;
14 float baselineMean = 3280 * 2000.0/4096.0;
15 float baselineRms = 0;
16 float gainMean = 1907.35 * 16;
17 float gainRms = 0;
18 float triggerOffsetMean = 0;
19 float triggerOffsetRms = 0;
20 float triggerOffsetTmMean = 0;
21 float triggerOffsetTmRms = 0;
22
23 const size_t n = 1440*1024*4 + 1440*fRoi*2 + fNumTm*fRoi*2 + 3;
24 vector<float> vec;
25 vec.resize(n);
26
27 reinterpret_cast<uint32_t*>(vec.data())[0] = fRoi;
28 reinterpret_cast<uint32_t*>(vec.data())[1] = 1;
29 reinterpret_cast<uint32_t*>(vec.data())[2] = 2;
30 reinterpret_cast<uint32_t*>(vec.data())[3] = 3;
31
32 for (int i = 0 ; i < 1024*1440 ; i++)
33 {
34 vec.data()[i+4] = baselineMean;
35 vec.data()[i+4+1*1024*1440] = baselineRms;
36 vec.data()[i+4+2*1024*1440] = gainMean;
37 vec.data()[i+4+3*1024*1440] = gainRms;
38 }
39 for (int i = 0 ; i < fRoi*1440 ; i++)
40 {
41 vec.data()[i+4+4*1024*1440] = triggerOffsetMean;
42 vec.data()[i+4+4*1024*1440+1*fRoi*1440] = triggerOffsetRms;
43 }
44 for (int i = 0 ; i < fRoi*fNumTm ; i++)
45 {
46 vec.data()[i+4+2*1024*1440+2*fRoi*1440] = triggerOffsetTmMean;
47 vec.data()[i+4+3*1024*1440+2*fRoi*1440+fRoi*fNumTm] = triggerOffsetTmRms;
48 }
49
50 drscalib.fRoi = fRoi;
51 drscalib.fNumTm = fNumTm;
52 drscalib.fStep = 2;
53
54 drscalib.WriteFitsImp(filename,vec);
55
56 return 0;
57}
58
Note: See TracBrowser for help on using the repository browser.