source: trunk/Mars/mmc/MMcCorsikaRunHeader.cc@ 19344

Last change on this file since 19344 was 17386, checked in by tbretz, 11 years ago
Removed svn:executable property, these are no executables.
File size: 5.6 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Oscar Blanch 11/2002 (blanch@ifae.es)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MMcCorsikaRunHeader
28//
29// Root storage container for the CORSIKA run header
30//
31// It saves in a root file all variable that are in the CORSIKA run header, except
32// dummies.
33//
34////////////////////////////////////////////////////////////////////////////
35
36
37#include "MGeomCorsikaCT.h"
38#include "MMcCorsikaRunHeader.h"
39#include "MLog.h"
40#include "MLogManip.h"
41
42ClassImp(MMcCorsikaRunHeader);
43
44using namespace std;
45
46// --------------------------------------------------------------------------
47//
48// Default constructor.
49//
50//
51MMcCorsikaRunHeader::MMcCorsikaRunHeader(const char *name, const char *title,
52 int NumCT)
53 : fTelescopes(NumCT)
54{
55 fName = name ? name : "MMcCorsikaRunHeader";
56 fTitle = title ? title : "Translation of the CORSIKA header";
57
58 fRunNumber = 0;
59 fDate = 0;
60 fCorsikaVersion = 0;
61 fNumObsLev = 0;
62
63 for (int i=0; i<10; i++)
64 fHeightLev[i]=0;
65
66 fSlopeSpec = 0;
67 fELowLim = 0;
68 fEUppLim = 0;
69 fEGS4flag = 0;
70 fNKGflag = 0;
71 fEcutoffh = 0;
72 fEcutoffm = 0;
73 fEcutoffe = 0;
74 fEcutoffg = 0;
75
76 for(int i=0; i<50; i++) fC[i] = 0;
77 for(int i=0; i<40; i++) fCKA[i] = 0;
78 for(int i=0; i<5; i++) fCETA[i] = 0;
79 for(int i=0; i<11; i++) fCSTRBA[i] = 0;
80 for(int i=0; i<5; i++)
81 {
82 fAATM[i] = 0;
83 fBATM[i] = 0;
84 fCATM[i] = 0;
85 }
86 for (int i=0;i<4; i++) fNFL[i] = 0;
87
88 fViewconeAngles[0]=0.0;
89 fViewconeAngles[1]=0.0;
90
91 fWobbleMode=0;
92 fAtmosphericModel=0;
93
94 fNumCT=NumCT;
95
96 fTelescopes.SetOwner();
97
98 for (int i=0;i<NumCT;i++)
99 {
100 MGeomCorsikaCT* dummy = new MGeomCorsikaCT();
101 fTelescopes.Add(dummy);
102 }
103
104 SetReadyToSave();
105}
106
107// -------------------------------------------------------------------------
108//
109// Fill Corsika Run Header
110//
111void MMcCorsikaRunHeader::Fill(const Float_t runnumber,
112 const Float_t date,
113 const Float_t vers,
114 const Float_t numobslev,
115 const Float_t height[10],
116 const Float_t slope,
117 const Float_t elow,
118 const Float_t eupp,
119 const Float_t egs4,
120 const Float_t nkg,
121 const Float_t eh,
122 const Float_t em,
123 const Float_t ee,
124 const Float_t eg,
125 const Float_t c[50],
126 const Float_t cka[40],
127 const Float_t ceta[5],
128 const Float_t cstrba[11],
129 const Float_t aatm[5],
130 const Float_t batm[5],
131 const Float_t catm[5],
132 const Float_t nfl[4],
133 const Float_t viewcone[2],
134 const Float_t wobble,
135 const Float_t atmospher
136 )
137{
138 fRunNumber = runnumber;
139 fDate = date;
140 fCorsikaVersion = vers;
141 fNumObsLev = numobslev;
142
143 for (int i=0; i<10; i++)
144 fHeightLev[i]=height[i];
145
146 fSlopeSpec = slope;
147 fELowLim = elow;
148 fEUppLim = eupp;
149 fEGS4flag = egs4;
150 fNKGflag = nkg;
151 fEcutoffh = eh;
152 fEcutoffm = em;
153 fEcutoffe = ee;
154 fEcutoffg = eg;
155
156 for (int i=0; i<50; i++) fC[i] = c[i];
157 for (int i=0; i<40; i++) fCKA[i] = cka[i];
158 for (int i=0; i<5 ; i++) fCETA[i] = ceta[i];
159 for (int i=0; i<11; i++) fCSTRBA[i] = cstrba[i];
160 for (int i=0; i<5; i++)
161 {
162 fAATM[i] = aatm[i];
163 fBATM[i] = batm[i];
164 fCATM[i] = catm[i];
165 }
166 for (int i=0; i<4; i++) fNFL[i] = nfl[i];
167
168 fViewconeAngles[0]=viewcone[0];
169 fViewconeAngles[1]=viewcone[1];
170
171 fWobbleMode=wobble;
172 fAtmosphericModel=atmospher;
173
174}
175
176// -------------------------------------------------------------------------
177//
178// Fill C Telescope information in Corsika Run Header
179//
180void MMcCorsikaRunHeader::FillCT(Float_t ctx, Float_t cty, Float_t ctz,
181 Float_t cttheta, Float_t ctphi,
182 Float_t ctdiam, Float_t ctfocal,
183 Int_t CTnum){
184
185 static_cast<MGeomCorsikaCT*>(fTelescopes.UncheckedAt(CTnum))
186 ->Fill(ctx, cty, ctz, cttheta, ctphi, ctdiam, ctfocal);
187
188}
189
190// -------------------------------------------------------------------------
191//
192// Returns a reference of the i-th entry (the telescope with the index i)
193//
194MGeomCorsikaCT &MMcCorsikaRunHeader::operator[](Int_t i) const
195{
196 return *static_cast<MGeomCorsikaCT*>(fTelescopes.UncheckedAt(i));
197}
198
199// --------------------------------------------------------------------------
200//
201// Prints the information of all telescopes
202//
203void MMcCorsikaRunHeader::Print(Option_t *) const
204{
205 //
206 // Print Information about the Geometry of the camera
207 //
208 *fLog << all << GetTitle() <<":" << endl;
209 *fLog << " Spectral Slope: " << fSlopeSpec << " from " << fELowLim << "GeV to " << fEUppLim << "GeV" << endl;
210 *fLog << " Number of Telescopes: " << fNumCT << endl;
211 fTelescopes.Print();
212}
Note: See TracBrowser for help on using the repository browser.