source: fact/tools/marsmacros/mc2csv/MonteCarlo.h@ 14605

Last change on this file since 14605 was 14605, checked in by Jens Buss, 12 years ago
initial commit: Class reading MC data from root-file with Mars classes and writing data to CSV
  • Property svn:executable set to *
File size: 5.4 KB
Line 
1#ifndef MONTECARLO_H
2#define MONTECARLO_H
3
4/** A one line description of the class.
5 *
6 * #include "XX.h" <BR>
7 * -llib
8 *
9 * A longer description.
10 *
11 * @see something
12 */
13
14
15// SYSTEM INCLUDES
16#include <vector>
17#include <fstream>
18#include <endian.h>
19#include <stdio.h>
20
21#include <TSystem.h>
22#include <TString.h>
23#include <TStyle.h>
24#include <TCanvas.h>
25#include <TMath.h>
26#include <TFile.h>
27#include <TH1.h>
28#include <TH2F.h>
29#include <TF1.h>
30#include <TTree.h>
31//
32
33// PROJECT INCLUDES
34#include "MStatusDisplay.h"
35#include "MStatusArray.h"
36#include "MParContainer.h"
37
38#include "MParameters.h"
39#include "MPedestalCam.h"
40#include "MMcRunHeader.hxx"
41#include "MGeomCamFACT.h"
42#include "MRawRunHeader.h"
43#include "MCorsikaRunHeader.h"
44
45//Evt data types
46#include "MRawEvtData.h"
47#include "MPedestalCam.h"
48#include "MMcEvt.hxx"
49#include "MMcEvtBasic.h"
50#include "MRawEvtHeader.h"
51#include "MCorsikaEvtHeader.h"
52
53
54
55//
56
57// LOCAL INCLUDES
58//
59
60// FORWARD REFERENCES
61//
62
63using namespace std;
64using namespace TMath;
65
66struct pixel_t
67{
68 int SoftId;
69// int ChId;
70 unsigned short* rawData;
71 float pedestal;
72};
73
74class MonteCarlo
75{
76public:
77// LIFECYCLE
78
79 /** Default constructor.
80 */
81 MonteCarlo();
82 MonteCarlo(TString filename);
83 MonteCarlo(TString filename, TString evtsTreeName);
84 MonteCarlo(TString filename, TString evtsTreeName, TString headerTreeName);
85
86
87// /** Copy constructor.
88// *
89// * @param from The value to copy to this object.
90// */
91// MonteCarlo(const MonteCarlo& from);
92
93
94 /** Destructor.
95 */
96 ~MonteCarlo(void);
97
98
99// OPERATORS
100
101// /** Assignment operator.
102// *
103// * @param from THe value to assign to this object.
104// *
105// * @return A reference to this object.
106// */
107// MonteCarlo& operator=(const XX& from);
108
109// OPERATIONS
110 void InitVariables();
111
112 void WriteMc2Csv(TString filename );
113 void WritePixelData2Csv(int pixelID);
114 void WriteEventData2Csv();
115 void WriteEventDataNames2Csv();
116 void WriteEventHeaderNames2Csv();
117 void WriteEventHeader2Csv();
118 void WriteRunHeaderNames2Csv();
119 void WriteRunHeader2Csv();
120 void WriteFileHeader2Csv();
121
122
123// ACCESS
124 void SetVerbosityLevel(int verbLvl);
125 int GetVerbosityLevel();
126
127 void OpenRootFile();
128 void CloseRootFile();
129
130 void OpenCsvFile( TString fileName);
131 void CloseCsvFile();
132
133 void LoadEventTree( TString treeName);
134 void LoadHeaderTree(TString treeName);
135
136 void ReadRunHeader();
137 void ReadEventRawData();
138 void ReadEventMetaData();
139 void ReadEvent(int Event);
140
141// INQUIRY
142private:
143 int mVerbosityLvl;
144
145 TString mCsvFileName;
146 ofstream mCsv;
147 TString mFileName;
148 TFile* mpRootFile;
149 pixel_t* mpPixel;
150
151 TTree* mpEventTree;
152 TTree* mpHeaderTree;
153
154 //header data types
155 MParameterD* mpIntendedPulsePos;
156 MMcRunHeader* mpMcRunHeader;
157 MGeomCamFACT* mpGeomCam;
158 MRawRunHeader* mpRawRunHeader;
159 MCorsikaRunHeader* mpCorsikaRunHeader;
160
161 //Evt data types
162 MPedestalCam* mpElectronicNoise;
163 MRawEvtData* mpRawEventData;
164 MParameterD* mpIncidentAngle;
165 MMcEvt* mpMcEventMetaData;
166 MRawEvtHeader* mpRawEventHeader;
167 MCorsikaEvtHeader* mpCorsikaEvtHeader;
168
169 unsigned short * mpSamples; // array with MC events raw data
170 TString mSeparator;
171
172 //Run Meta Data
173 int mNumberOfEntries;
174 int mNumberOfEvents;
175 float mIntendedPulsePos;
176 float mPedestalOffset;
177 int mNumSimulatedShowers;
178 int mNumberOfPixels;
179 int mNumberOfSectors;
180 int mNumberOfAreas;
181 float mNumberOfSamples;
182 float mSamplingFrequency;
183 int mNumberOfEventsRead;
184 float mCamDist;
185 const char* mSourceName;
186 float mSlopeSpectrum;
187 float mEnergyMin;
188 float mEnergyMax;
189 float mZdMin;
190 float mZdMax;
191 float mAzMin;
192 float mAzMax;
193 unsigned int mFileNumber;
194 int mRunNumber;
195 int mRunType;
196 int mNumberOfBytes;
197
198 //Event Meta Data
199 float mIncidentAngle;
200 int mPartId;
201 float mEnergy;
202 float mImpact;
203 float mTelescopePhi;
204 float mTelescopeTheta;
205 float mPhi;
206 float mTheta;
207 TString mPartName;
208 TString mPartSymbol;
209 unsigned int mCorsikaEventNumber;
210 unsigned int mPhotElFromShower;
211 unsigned int mPhotElinCamera;
212 int mEvtReuse;
213 int mEventNumber;
214 float mNumTriggerLvl1;
215 float mNumTriggerLvl2;
216 float mFirstInteractionHeight;
217 float mMomentumX;
218 float mMomentumY;
219 float mMomentumZ;
220 float mZd;
221 float mAz;
222 float mX;
223 float mY;
224// int mWeightedNumPhotons;
225
226
227
228
229protected:
230
231};
232
233// INLINE METHODS
234//
235
236// EXTERNAL REFERENCES
237//
238
239#endif // MONTECARLO_H
240
Note: See TracBrowser for help on using the repository browser.