Changeset 9616 for trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc
- Timestamp:
- 07/23/10 10:48:12 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc
r9571 r9616 34 34 ///////////////////////////////////////////////////////////////////////////// 35 35 #include "MCorsikaEvtHeader.h" 36 #include "MCorsikaFormat.h" 36 37 37 38 #include <iomanip> … … 121 122 // return FALSE if there is no header anymore, else TRUE 122 123 // 123 Int_t MCorsikaEvtHeader::ReadEvt( std::istream &fin)124 Int_t MCorsikaEvtHeader::ReadEvt(MCorsikaFormat * fInFormat) 124 125 { 125 char evth[4]; 126 fin.read(evth, 4); 127 if (memcmp(evth, "EVTH", 4)) 128 { 129 fin.seekg(-4, ios::cur); 126 127 if (!fInFormat->SeekNextBlock("EVTH", 1202)) 130 128 return kFALSE; 131 }132 129 133 130 Float_t f[273]; 134 fin.read((char*)&f, 273*4); 131 if (!fInFormat->ReadData(272, f)) 132 return kFALSE; 135 133 136 134 fEvtNumber = TMath::Nint(f[0]); … … 160 158 if (n!=1) 161 159 { 162 *fLog << err << "ERROR- Currently only one impact parameter per event is supported." << endl;163 return kFALSE;160 *fLog << err << "ERROR - Currently only one impact parameter per event is supported." << endl; 161 *fLog << warn << "WARNING - This error is replaced by a warning." << endl; 164 162 } 165 163 … … 167 165 fY = -f[97]; //fY = f[117]; 168 166 169 fin.seekg(1088-273*4, ios::cur); 170 171 return !fin.eof(); 167 return !fInFormat->Eof(); 172 168 } 173 169 … … 175 171 // this member function is for reading the event end block 176 172 177 Bool_t MCorsikaEvtHeader::ReadEvtEnd( std::istream &fin)173 Bool_t MCorsikaEvtHeader::ReadEvtEnd(MCorsikaFormat * fInFormat) 178 174 { 175 176 if (!fInFormat->SeekNextBlock("EVTE", 1209)) 177 return kFALSE; 178 179 179 //fin.seekg(-1088,ios::cur); 180 180 181 181 Float_t f[2]; 182 fin.read((char*)&f, 2*4); 182 183 if (!fInFormat->ReadData(2, f)) 184 return kFALSE; 183 185 184 186 const UInt_t evtnum = TMath::Nint(f[0]); … … 192 194 fWeightedNumPhotons = f[1]; 193 195 194 fin.seekg(1080,ios::cur); 195 196 return !fin.eof(); 196 return !fInFormat->Eof(); 197 197 } 198 198
Note:
See TracChangeset
for help on using the changeset viewer.