Changeset 18532 for trunk/Mars
- Timestamp:
- 08/05/16 15:26:53 (8 years ago)
- Location:
- trunk/Mars/mcorsika
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcorsika/MCorsikaFormat.cc
r10213 r18532 40 40 41 41 42 const unsigned int MCorsikaFormat::kSyncMarker = 0xd41f8a37; 42 const unsigned int MCorsikaFormat::kMagicNumber = 0x5994; 43 const unsigned int MCorsikaFormat::kSyncMarker = 0xd41f8a37; 43 44 44 45 // -------------------------------------------------------------------------- … … 60 61 memset(buffer, 0, 5); 61 62 fileIn->read(buffer, 4); 63 64 // This seems to be a new corsika binary identifier 65 const bool hasMagicNumber = *reinterpret_cast<unsigned int*>(buffer) == kMagicNumber; 66 if (hasMagicNumber) 67 fileIn->read(buffer, 4); 68 62 69 fileIn->seekg(-4, ios::cur); 63 70 … … 65 72 { 66 73 delete [] buffer; 67 return new MCorsikaFormatRaw(fileIn); 74 gLog << inf2 << "Corsika RAW format detected." << endl; 75 return new MCorsikaFormatRaw(fileIn, hasMagicNumber); 68 76 } 69 77 … … 71 79 { 72 80 delete [] buffer; 81 gLog << inf2 << "Corsika EventIO format detected." << endl; 73 82 return new MCorsikaFormatEventIO(fileIn); 74 83 } … … 159 168 for (int i=1; i<22; i++) 160 169 { 161 fIn->seekg(-i*273*4 , ios::end);170 fIn->seekg(-i*273*4-(fHasMagicNumber?4:0), ios::end); 162 171 163 172 char runh[5]="\0\0\0\0"; … … 170 179 } 171 180 } 172 173 return k TRUE;181 182 return kFALSE; 174 183 } 175 184 /////////////////////////////////////////////////////////////////////////////// -
trunk/Mars/mcorsika/MCorsikaFormat.h
r10213 r18532 20 20 public: 21 21 static const unsigned int kSyncMarker; 22 static const unsigned int kMagicNumber; 22 23 23 24 MCorsikaFormat(std::istream * in) … … 45 46 { 46 47 private: 48 bool fHasMagicNumber; 47 49 48 50 public: 49 MCorsikaFormatRaw(std::istream * in )50 : MCorsikaFormat(in) {}51 MCorsikaFormatRaw(std::istream * in, bool h) 52 : MCorsikaFormat(in), fHasMagicNumber(h) {} 51 53 52 54 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
Note:
See TracChangeset
for help on using the changeset viewer.