Changeset 9186 for trunk/MagicSoft/Mars/mcorsika
- Timestamp:
- 12/02/08 11:23:24 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mcorsika
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc
r9182 r9186 37 37 38 38 #include "MMcEvt.hxx" 39 #include "MCorsikaRunHeader.h"40 39 41 40 ClassImp(MCorsikaEvtHeader); … … 78 77 // return FALSE if there is no header anymore, else TRUE 79 78 // 80 Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin , MCorsikaRunHeader &header)79 Int_t MCorsikaEvtHeader::ReadEvt(std::istream &fin) 81 80 { 82 81 char evth[4]; … … 125 124 fX = f[117]; 126 125 fY = -f[97]; 127 126 /* 128 127 if (fEvtNumber==1) 129 128 { … … 138 137 header.Print(); 139 138 } 140 139 */ 141 140 fin.seekg(1088-273*4, ios::cur); 142 141 -
trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.h
r9182 r9186 13 13 //class ifstream; 14 14 #include <iosfwd> 15 16 class MCorsikaRunHeader;17 15 18 16 class MCorsikaEvtHeader : public MParContainer … … 57 55 Float_t GetY() const { return fY; } 58 56 59 Int_t ReadEvt(istream& fin, MCorsikaRunHeader &header); // read in event header block57 Int_t ReadEvt(istream& fin); // read in event header block 60 58 Bool_t ReadEvtEnd(istream& fin); // read in event end block 61 59 -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.cc
r9182 r9186 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 1 2/2000<mailto:tbretz@astro.uni-wuerzburg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200718 ! Author(s): Thomas Bretz 11/2008 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: Software Development, 2000-2008 21 21 ! 22 22 ! … … 26 26 // 27 27 // MCorsikaRead 28 //29 // This tasks reads the raw binary file like specified in the TDAS???30 // and writes the data in the corresponding containers which are31 // either retrieved from the parameter list or created and added.32 //33 // Use SetInterleave() if you don't want to read all events, eg34 // SetInterleave(5) reads only each 5th event.35 28 // 36 29 // Input Containers: … … 38 31 // 39 32 // Output Containers: 40 // MCorsikaRunHeader, MCorsikaEvtHeader, MCorsikaEvtData, MCorsikaCrateArray, MCorsikaEvtTime 33 // MCorsikaRunHeader 34 // MCorsikaEvtHeader 35 // MPhotonEvent 41 36 // 42 37 ////////////////////////////////////////////////////////////////////////////// … … 51 46 #include "MLogManip.h" 52 47 53 //#include "MZlib.h"54 //#include "MTime.h"55 48 #include "MParList.h" 56 49 #include "MStatusDisplay.h" … … 59 52 #include "MCorsikaEvtHeader.h" 60 53 61 //#include "MPhotonData.h"62 54 #include "MPhotonEvent.h" 63 55 … … 103 95 // 104 96 MCorsikaRead::MCorsikaRead(const char *fname, const char *name, const char *title) 105 : fRunHeader(0), fEvtHeader(0), fEvent(0), fEvtData(0),fForceMode(kFALSE),97 : fRunHeader(0), fEvtHeader(0), fEvent(0), /*fEvtData(0),*/ fForceMode(kFALSE), 106 98 fFileNames(0), fNumFile(0), fNumEvents(0), fNumTotalEvents(0), 107 99 fIn(0), fParList(0) … … 212 204 213 205 const char *expname = gSystem->ExpandPathName(name); 214 fIn = new fstream(expname);206 fIn = new ifstream(expname); 215 207 216 208 const Bool_t noexist = !(*fIn); … … 245 237 if (!fRunHeader->ReadEvt(*fIn)) 246 238 return kERROR; 247 248 if (!(*fIn)) 249 { 250 *fLog << err << "Error: Accessing file '" << name << "'" << endl; 251 return kERROR; 252 } 239 // if (!fEvtHeader->ReadRunHeader(*fIn, *fRunHeader)) 240 // return kERROR; 253 241 254 242 const streampos pos = fIn->tellg(); 255 256 243 if (!ReadEvtEnd()) 257 244 return kERROR; 258 259 245 fIn->seekg(pos, ios::beg); 260 246 … … 267 253 // We print it after the first event was read because 268 254 // we still miss information which is stored in the event header?!? 269 //if (print)270 //fRunHeader->Print();255 if (print) 256 fRunHeader->Print(); 271 257 272 258 if (!fParList) … … 386 372 return kFALSE; 387 373 388 fEvtData = (MPhotonData*)pList->FindCreateObj("MPhotonData");389 if (!fEvtData)390 return kFALSE;391 392 374 fEvent = (MPhotonEvent*)pList->FindCreateObj("MPhotonEvent"); 393 375 if (!fEvent) 394 376 return kFALSE; 395 377 396 //*fLog << inf << "Maintaining " << fEvent->GetClassName() << " found in MCorsikaEvent." << endl;397 398 378 *fLog << inf << "Calculating number of total events..." << flush; 399 379 if (!CalcNumTotalEvents()) … … 419 399 // if there is no next event anymore stop eventloop 420 400 // 421 Int_t rc = fEvtHeader->ReadEvt(fin , *fRunHeader); //read event header block401 Int_t rc = fEvtHeader->ReadEvt(fin); //read event header block 422 402 if (!rc) 423 403 return kFALSE; -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h
r9182 r9186 12 12 class MCorsikaRunHeader; 13 13 class MCorsikaEvtHeader; 14 class MPhotonData;15 14 class MPhotonEvent; 16 15 … … 18 17 { 19 18 private: 20 MCorsikaRunHeader 21 MCorsikaEvtHeader 19 MCorsikaRunHeader *fRunHeader; // run header information container to fill from file 20 MCorsikaEvtHeader *fEvtHeader; // event header information container to fill from file 22 21 MPhotonEvent *fEvent; // event information 23 MPhotonData *fEvtData; // raw evt data information container to fill from file24 22 25 Bool_t fForceMode; // Force mode skipping defect events23 Bool_t fForceMode; // Force mode skipping defect RUNE 26 24 27 25 TList *fFileNames; // list of file names … … 30 28 UInt_t fNumTotalEvents; //! total number of events in all files 31 29 32 fstream*fIn; //! input stream (file to read from)30 ifstream *fIn; //! input stream (file to read from) 33 31 34 32 MParList *fParList; //! tasklist to call ReInit from -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc
r9182 r9186 170 170 fin.seekg(1020, ios::cur); // skip the remaining data of this block 171 171 172 return kTRUE; 172 // -------------------- Read first event header ------------------- 173 174 char evth[4]; 175 fin.read(evth, 4); 176 if (memcmp(evth, "EVTH", 4)) 177 { 178 *fLog << err << "ERROR - Wrong identifier: EVTH expected." << endl; 179 return kFALSE; 180 } 181 182 Float_t g[273]; 183 fin.read((char*)&g, 273*4); 184 if (fin.eof()) 185 return kFALSE; 186 187 fin.seekg(-274*4, ios::cur); 188 189 const Int_t n = TMath::Nint(g[96]); 190 if (n!=1) 191 { 192 *fLog << err << "ERROR - Currently only one impact parameter per event is supported." << endl; 193 return kFALSE; 194 } 195 196 //fImpactMax = g[86]; 197 198 fZdMin = g[79]; 199 fZdMax = g[80]; 200 fAzMin = 180-g[81]; 201 fAzMax = 180-g[82]; 202 203 fViewConeInnerAngle = g[151]; 204 fViewConeOuterAngle = g[152]; 205 206 return kTRUE;; 173 207 } 174 208 -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h
r9182 r9186 33 33 Float_t fAzMax; // [rad] Azimuth (north=0; west=90) 34 34 35 //Float_t fImpactMax; // [cm] Maximum simulated impact 36 35 37 Float_t fViewConeInnerAngle; // [deg] 36 38 Float_t fViewConeOuterAngle; // [deg] … … 48 50 Float_t GetAzMax() const { return fAzMax; } 49 51 52 //Float_t GetImpactMax() const { return fImpactMax; } 53 54 Float_t GetViewConeOuterAngle() const { return fViewConeOuterAngle; } 55 50 56 UInt_t GetNumEvents() const { return fNumEvents; } 51 57
Note:
See TracChangeset
for help on using the changeset viewer.