source: trunk/MagicSoft/Mars/mtemp/mberlin/macros/Convert2Matrix.C@ 5138

Last change on this file since 5138 was 4137, checked in by hengsteb, 21 years ago
*** empty log message ***
File size: 2.1 KB
Line 
1#include "TString.h"
2#include "TChain.h"
3#include "TFile.h"
4#include "TH1F.h"
5#include "TMatrix.h"
6
7#include "MParList.h"
8#include "MTaskList.h"
9#include "MReadTree.h"
10#include "MHMatrix.h"
11#include "MFillH.h"
12#include "MEvtLoop.h"
13
14//--------------------------------------------------------------------------------------
15// MAIN INPUT/OUTPUT
16
17#include "IOMkn421.h"
18//--------------------------------------------------------------------------------------
19
20void Convert2Matrix()
21{
22 //------------------------------------------------------
23 // ON + OFF data to be filled into matrix
24
25 MReadTree readOn("Events", fileOptOn);
26 MReadTree readOff("Events", fileOptOff);
27
28 const Int_t nent=readOn.GetEntries();
29
30 //------------------------------------------------------
31
32 // process On data
33 MParList plistOn;
34 MTaskList tlistOn;
35 plistOn.AddToList(&tlistOn);
36
37 readOn.DisableAutoScheme();
38
39 TString sdist = Form("MHillasSrc.fDist*%f",mm2deg);
40
41 MHMatrix matOn("Matrix");
42 matOn.AddColumn("MHillas.fSize"); // 0
43 matOn.AddColumn(sdist.Data()); // 1
44 matOn.AddColumn("MHillas.fWidth"); // 2
45 matOn.AddColumn("MHillas.fLength");// 3
46 matOn.AddColumn("MHillasSrc.fAlpha");
47 plistOn.AddToList(&matOn);
48 MFillH fillOn("Matrix");
49
50 tlistOn.AddToList(&readOn);
51 tlistOn.AddToList(&fillOn);
52
53 MEvtLoop evtloopOn;
54 evtloopOn.SetParList(&plistOn);
55
56 if (!evtloopOn.Eventloop(0.5*nent))
57 return;
58
59 tlistOn.PrintStatistics();
60
61 TFile fileOn2(fileMatOn.Data(),"recreate","");
62 matOn.Write();
63 fileOn2.Close();
64
65
66 // process Off data
67
68 MParList plistOff;
69 MTaskList tlistOff;
70 plistOff.AddToList(&tlistOff);
71
72 readOff.DisableAutoScheme();
73
74 MHMatrix matOff("Matrix");
75 matOff.AddColumns(matOn.GetColumns());
76 plistOff.AddToList(&matOff);
77 MFillH fillOff("Matrix");
78
79 tlistOff.AddToList(&readOff);
80 tlistOff.AddToList(&fillOff);
81
82 MEvtLoop evtloopOff;
83 evtloopOff.SetParList(&plistOff);
84
85 if (!evtloopOff.Eventloop())
86 return;
87
88 tlistOff.PrintStatistics();
89
90 TFile fileOff2(fileMatOff.Data(),"recreate","");
91 matOff.Write();
92 fileOff2.Close();
93}
Note: See TracBrowser for help on using the repository browser.