| 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): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de) | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2001 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | // MMcRunHeader | 
|---|
| 28 | // | 
|---|
| 29 | // Root storage container for the RUN MONTE CARLO HEADER information | 
|---|
| 30 | // | 
|---|
| 31 | // This the second version of this output class. Old root files, which have | 
|---|
| 32 | // a previous version of this class, are still compatibles and can be used. | 
|---|
| 33 | // But of course, you can no try to get infromatino in these old files about | 
|---|
| 34 | // the new data members. | 
|---|
| 35 | // | 
|---|
| 36 | // The following data member have been introduced in this second version | 
|---|
| 37 | // and they do not exist in the previous one: | 
|---|
| 38 | // | 
|---|
| 39 | //  Float_t fMcRunNumber;      Run Number | 
|---|
| 40 | //  UInt_t  fProductionSite;   code to know where the run was generated | 
|---|
| 41 | //  Float_t fDateRunMMCs;      Date of the MMCs production | 
|---|
| 42 | //  Float_t fDateRunCamera;    Date, when the Camera program is run. | 
|---|
| 43 | //  Byte_t  fRawEvt;           RawEvt[Data,Hedaer] stored or not | 
|---|
| 44 | //  Byte_t  fElecNoise;        Electronic Noise simulated or not | 
|---|
| 45 | //  Byte_t  fStarFieldRotate;  Is the starfield rotation switched on (1) or | 
|---|
| 46 | //                             off (0) | 
|---|
| 47 | //  Float_t fCWaveLower;       Wavelength limits for the Cerenkov photons | 
|---|
| 48 | //  Float_t fCWaveUpper; | 
|---|
| 49 | //  UInt_t  fNumObsLev;        Observation levels | 
|---|
| 50 | //  Float_t fHeightLev[10]; | 
|---|
| 51 | //  Float_t fSlopeSpec;        Spectral index | 
|---|
| 52 | // | 
|---|
| 53 | //  Third version: | 
|---|
| 54 | // | 
|---|
| 55 | //  Byte_t fOpticLinksNoise;   Flag to state if the optic noise is simualted | 
|---|
| 56 | //                             or not | 
|---|
| 57 | // | 
|---|
| 58 | // | 
|---|
| 59 | // Note: All the azimuth Phi angles in this and other MC classes follow | 
|---|
| 60 | // the convention in the Corsika program (see Corsika manual). There, phi | 
|---|
| 61 | // is the azimuth of the momentum vector of particles, and is measured | 
|---|
| 62 | // from the north direction, anticlockwise (i.e, west is phi=90 degrees). | 
|---|
| 63 | // | 
|---|
| 64 | // | 
|---|
| 65 | // Class Version 5: | 
|---|
| 66 | // ---------------- | 
|---|
| 67 | // removed members fSourceOffsetTheta, fSourceOffsetPhi (were no longer used)                                  // | 
|---|
| 68 | // | 
|---|
| 69 | // Class Version 6: | 
|---|
| 70 | // ---------------- | 
|---|
| 71 | // removed members fTelesTheta, fTelesPhi (were no longer used)                                  // | 
|---|
| 72 | // | 
|---|
| 73 | // Class Version 7: | 
|---|
| 74 | // ---------------- | 
|---|
| 75 | // + Float_t fRandomPointingConeSemiAngle; | 
|---|
| 76 | // | 
|---|
| 77 | //////////////////////////////////////////////////////////////////////////// | 
|---|
| 78 | #include "MMcRunHeader.hxx" | 
|---|
| 79 |  | 
|---|
| 80 | #include <fstream> | 
|---|
| 81 | #include <iomanip> | 
|---|
| 82 |  | 
|---|
| 83 | #include "MLog.h" | 
|---|
| 84 |  | 
|---|
| 85 | ClassImp(MMcRunHeader); | 
|---|
| 86 |  | 
|---|
| 87 | using namespace std; | 
|---|
| 88 |  | 
|---|
| 89 | // -------------------------------------------------------------------------- | 
|---|
| 90 | // | 
|---|
| 91 | // Default constructor. | 
|---|
| 92 | // | 
|---|
| 93 | // | 
|---|
| 94 | MMcRunHeader::MMcRunHeader(const char *name, const char *title) | 
|---|
| 95 | { | 
|---|
| 96 | fName  = name  ? name  : "MMcRunHeader"; | 
|---|
| 97 | fTitle = title ? title : "Raw Run Header Information"; | 
|---|
| 98 |  | 
|---|
| 99 | fMcRunNumber =0; | 
|---|
| 100 | fProductionSite = 0; | 
|---|
| 101 | fDateRunMMCs = 0; | 
|---|
| 102 | fDateRunCamera = 0; | 
|---|
| 103 | fNumTrigCond = 0; | 
|---|
| 104 | fAllEvtsTriggered = 0 ; | 
|---|
| 105 | fMcEvt = 0; | 
|---|
| 106 | fMcTrig = 0; | 
|---|
| 107 | fMcFadc = 0; | 
|---|
| 108 | fRawEvt = 0; | 
|---|
| 109 | fElecNoise = 0; | 
|---|
| 110 | fStarFieldRotate = 0; | 
|---|
| 111 | fNumAnalisedPixels = 0; | 
|---|
| 112 | fNumSimulatedShowers = 0; | 
|---|
| 113 | fNumStoredShowers = 0; | 
|---|
| 114 | fNumEvents = 0; | 
|---|
| 115 |  | 
|---|
| 116 | fStarFieldRaH = 0; | 
|---|
| 117 | fStarFieldRaM = 0; | 
|---|
| 118 | fStarFieldRaS = 0; | 
|---|
| 119 | fStarFieldDeD = 0; | 
|---|
| 120 | fStarFieldDeM = 0; | 
|---|
| 121 | fStarFieldDeS = 0; | 
|---|
| 122 |  | 
|---|
| 123 | fNumPheFromDNSB = 0.0; | 
|---|
| 124 | fShowerThetaMax = 0.0; | 
|---|
| 125 | fShowerThetaMin = 0.0; | 
|---|
| 126 | fShowerPhiMax = 0.0; | 
|---|
| 127 | fShowerPhiMin = 0.0; | 
|---|
| 128 |  | 
|---|
| 129 | fImpactMax = -1; | 
|---|
| 130 |  | 
|---|
| 131 | fCWaveLower = 0.0; | 
|---|
| 132 | fCWaveUpper = 0.0; | 
|---|
| 133 |  | 
|---|
| 134 | fNumObsLev = 0; | 
|---|
| 135 | for (int i=0; i<10; i++){ | 
|---|
| 136 | fHeightLev[i]=0.0; | 
|---|
| 137 | } | 
|---|
| 138 | fSlopeSpec = 0.0; | 
|---|
| 139 |  | 
|---|
| 140 | fCorsikaVersion = UShort_t(-1); | 
|---|
| 141 | fReflVersion    = UShort_t(-1); | 
|---|
| 142 | fCamVersion     = UShort_t(-1); | 
|---|
| 143 |  | 
|---|
| 144 | fOpticLinksNoise= 0; | 
|---|
| 145 |  | 
|---|
| 146 | fRandomPointingConeSemiAngle=0; | 
|---|
| 147 | } | 
|---|
| 148 |  | 
|---|
| 149 | // ------------------------------------------------------------------------- | 
|---|
| 150 | // | 
|---|
| 151 | // Fill. Put data in the container | 
|---|
| 152 | // | 
|---|
| 153 | void MMcRunHeader::Fill(const Float_t  runnumber, | 
|---|
| 154 | const UInt_t   productionsite, | 
|---|
| 155 | const Float_t  daterunMMCs, | 
|---|
| 156 | const Float_t   daterunCamera, | 
|---|
| 157 | const UInt_t   numtrigcond, | 
|---|
| 158 | const Byte_t   allevts, | 
|---|
| 159 | const Byte_t   mcevt, | 
|---|
| 160 | const Byte_t   mctrig, | 
|---|
| 161 | const Byte_t   mcfadc, | 
|---|
| 162 | const Byte_t   rawevt, | 
|---|
| 163 | const Byte_t   elecnoise, | 
|---|
| 164 | const Int_t    numanalpixels, | 
|---|
| 165 | const UInt_t   numsim, | 
|---|
| 166 | const UInt_t   numsto, | 
|---|
| 167 | const Byte_t   starfieldrotate, | 
|---|
| 168 | const Int_t    sfRaH, | 
|---|
| 169 | const Int_t    sfRaM, | 
|---|
| 170 | const Int_t    sfRaS, | 
|---|
| 171 | const Int_t    sfDeD, | 
|---|
| 172 | const Int_t    sfDeM, | 
|---|
| 173 | const Int_t    sfDeS, | 
|---|
| 174 | const Float_t  numdnsb, | 
|---|
| 175 | const Float_t  shthetamax, | 
|---|
| 176 | const Float_t  shthetamin, | 
|---|
| 177 | const Float_t  shphimax, | 
|---|
| 178 | const Float_t  shphimin, | 
|---|
| 179 | const Float_t  impactmax, | 
|---|
| 180 | const Float_t  cwavelower, | 
|---|
| 181 | const Float_t  cwaveupper, | 
|---|
| 182 | const Float_t  slopespec, | 
|---|
| 183 | const UInt_t   numObslev, | 
|---|
| 184 | const Float_t  heightlev[10], | 
|---|
| 185 | const UInt_t   corsika, | 
|---|
| 186 | const UInt_t   refl, | 
|---|
| 187 | const UInt_t   cam, | 
|---|
| 188 | const Byte_t   opticnoise, | 
|---|
| 189 | const Float_t  conesmiangle) | 
|---|
| 190 | { | 
|---|
| 191 | fMcRunNumber =runnumber; | 
|---|
| 192 | fProductionSite = productionsite; | 
|---|
| 193 | fDateRunMMCs = daterunMMCs; | 
|---|
| 194 | fDateRunCamera = daterunCamera; | 
|---|
| 195 | fNumTrigCond = numtrigcond; | 
|---|
| 196 | fAllEvtsTriggered = allevts; | 
|---|
| 197 | fMcEvt = mcevt; | 
|---|
| 198 | fMcTrig = mctrig; | 
|---|
| 199 | fMcFadc = mcfadc; | 
|---|
| 200 | fRawEvt = rawevt; | 
|---|
| 201 | fElecNoise = elecnoise; | 
|---|
| 202 | fStarFieldRotate = starfieldrotate; | 
|---|
| 203 | fNumAnalisedPixels = numanalpixels; | 
|---|
| 204 | fNumSimulatedShowers = numsim; | 
|---|
| 205 | fNumStoredShowers = numsto; | 
|---|
| 206 | fNumEvents = numsto; | 
|---|
| 207 |  | 
|---|
| 208 | fStarFieldRaH = sfRaH; | 
|---|
| 209 | fStarFieldRaM = sfRaM; | 
|---|
| 210 | fStarFieldRaS = sfRaS; | 
|---|
| 211 | fStarFieldDeD = sfDeD; | 
|---|
| 212 | fStarFieldDeM = sfDeM; | 
|---|
| 213 | fStarFieldDeS = sfDeS; | 
|---|
| 214 |  | 
|---|
| 215 | fNumPheFromDNSB = numdnsb; | 
|---|
| 216 | fShowerThetaMax = shthetamax; | 
|---|
| 217 | fShowerThetaMin = shthetamin; | 
|---|
| 218 | fShowerPhiMax = shphimax; | 
|---|
| 219 | fShowerPhiMin = shphimin; | 
|---|
| 220 |  | 
|---|
| 221 | fImpactMax=impactmax; | 
|---|
| 222 |  | 
|---|
| 223 | fCWaveLower = cwavelower; | 
|---|
| 224 | fCWaveUpper = cwaveupper; | 
|---|
| 225 |  | 
|---|
| 226 | fNumObsLev = numObslev; | 
|---|
| 227 | for (UInt_t i=0; i<numObslev; i++){ | 
|---|
| 228 | fHeightLev[i]=heightlev[i]; | 
|---|
| 229 | } | 
|---|
| 230 | fSlopeSpec = slopespec; | 
|---|
| 231 |  | 
|---|
| 232 | fCorsikaVersion = corsika; | 
|---|
| 233 | fReflVersion = refl; | 
|---|
| 234 | fCamVersion = cam; | 
|---|
| 235 | fOpticLinksNoise= opticnoise; | 
|---|
| 236 |  | 
|---|
| 237 | fRandomPointingConeSemiAngle=conesmiangle; | 
|---|
| 238 | } | 
|---|
| 239 |  | 
|---|
| 240 | // ------------------------------------------------------------------------- | 
|---|
| 241 | // | 
|---|
| 242 | // GetStarFieldRa. Get RA coordinates of the starfield | 
|---|
| 243 | // | 
|---|
| 244 | void MMcRunHeader::GetStarFieldRa(Int_t *hour, Int_t *minute, Int_t *second) const | 
|---|
| 245 | { | 
|---|
| 246 | *hour   = fStarFieldRaH; | 
|---|
| 247 | *minute = fStarFieldRaM; | 
|---|
| 248 | *second = fStarFieldRaS; | 
|---|
| 249 | } | 
|---|
| 250 | // ------------------------------------------------------------------------- | 
|---|
| 251 | // | 
|---|
| 252 | // GetStarFieldDec. Get DE coordinates of the starfield | 
|---|
| 253 | // | 
|---|
| 254 | void MMcRunHeader::GetStarFieldDec(Int_t *degree, Int_t *minute, Int_t *second) const | 
|---|
| 255 | { | 
|---|
| 256 | *degree = fStarFieldDeD; | 
|---|
| 257 | *minute = fStarFieldDeM; | 
|---|
| 258 | *second = fStarFieldDeS; | 
|---|
| 259 | } | 
|---|