source: branches/Mars_McMismatchStudy/macros/fact/fake_drs_calibration.C@ 20029

Last change on this file since 20029 was 17208, checked in by ftemme, 11 years ago
changed values for baselineMean and gainMean according to a simulated 12 bit ADC
File size: 1.8 KB
Line 
1#include "DrsCalib.h"
2
3
4using namespace std;
5
6// --------------------------------------------------------------------------
7
8int fake_drs_calibration()
9{
10 DrsCalibration drscalib;
11 uint16_t fRoi = 300;
12 const string filename = "/fhgfs/groups/app/fact/mc_test/testingdrsfile/12bitADC/offsetMinus1850/test300samples.drs.fits";
13 uint16_t fNumTm = 0;
14 float baselineMean = -1850.0 * 2000.0/4096.0;
15 float baselineRms = 0;
16 float gainMean = 1907.35;
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.fNumOffset = 1000;
55 drscalib.fNumGain = 1000*1953125;
56 drscalib.fNumTrgOff = 1000;
57
58 drscalib.WriteFitsImp(filename,vec);
59
60 return 0;
61}
62
Note: See TracBrowser for help on using the repository browser.