Changeset 17035
- Timestamp:
- 08/21/13 16:35:22 (11 years ago)
- Location:
- trunk/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/fits.h
r16935 r17035 463 463 return it==cols.end() ? 0 : it->second.num; 464 464 } 465 466 465 467 466 468 // There may be a gap between the main table and the start of the heap: … … 660 662 // Check for table name. Skip until eof or requested table are found. 661 663 // skip the current table? 662 if (!tableName.empty() && tableName!=fTable.Get<string>("EXTNAME")) 664 if ((!tableName.empty() && tableName!=fTable.Get<string>("EXTNAME")) || 665 ( tableName.empty() && "ZDrsCellOffsets"==fTable.Get<string>("EXTNAME"))) 663 666 { 664 667 const streamoff skip = fTable.GetTotalBytes(); … … 711 714 fits(const string &fname, const string& tableName="", bool force=false) : izstream(fname.c_str()) 712 715 { 716 gLog << "Here..." <<endl; 713 717 Constructor(fname, "", tableName, force); 718 if ((fTable.is_compressed && !force) || 719 (fTable.name == "ZDrsCellOffsets" && !force)) 720 { 721 #ifdef __EXCEPTIONS 722 throw runtime_error("You are trying to read a compressed fits with the base fits class. Please use factfits instead."); 723 #else 724 gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << endl; 725 #endif 726 clear(rdstate()|ios::badbit); 727 } 714 728 } 715 729 716 730 fits(const string &fname, const string &fout, const string& tableName, bool force=false) : izstream(fname.c_str()) 717 731 { 732 gLog << "There..." << endl; 718 733 Constructor(fname, fout, tableName, force); 734 if ((fTable.is_compressed && !force) || 735 (fTable.name == "ZDrsCellOffsets" && !force)) 736 { 737 #ifdef __EXCEPTIONS 738 throw runtime_error("You are trying to read a compressed fits with the base fits class. Please use factfits instead."); 739 #else 740 gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << endl; 741 #endif 742 clear(rdstate()|ios::badbit); 743 } 744 } 745 746 fits() : izstream() 747 { 748 719 749 } 720 750 … … 999 1029 } 1000 1030 1001 size_t GetNumRows() const { return fTable.num_rows; }1031 // size_t GetNumRows() const { return fTable.num_rows; } 1002 1032 size_t GetRow() const { return fRow==(size_t)-1 ? 0 : fRow; } 1003 1033 … … 1011 1041 1012 1042 bool IsCompressedFITS() const { return fTable.is_compressed;} 1043 1044 virtual size_t GetNumRows() const 1045 { 1046 return fTable.Get<size_t>("NAXIS2"); 1047 } 1048 1049 virtual size_t GetBytesPerRow() const 1050 { 1051 return fTable.Get<size_t>("NAXIS1"); 1052 } 1013 1053 }; 1014 1054 -
trunk/Mars/mcore/zfits.h
r16898 r17035 37 37 38 38 // Basic constructor 39 zfits(const string& fname, const string& tableName="", 40 bool force=false) : fits(fname, tableName, force), 41 fNumTiles(0), 42 fNumRowsPerTile(0), 43 fCurrentRow(-1), 44 fHeapOff(0), 45 fTileSize(0) 46 { 39 zfits(const string& fname, const string& tableName="", bool force=false) : fits(), 40 fNumTiles(0), 41 fNumRowsPerTile(0), 42 fCurrentRow(-1), 43 fHeapOff(0), 44 fTileSize(0) 45 { 46 open(fname.c_str()); 47 Constructor(fname, "", tableName, force); 47 48 InitCompressionReading(); 48 49 } 49 50 50 51 // Alternative contstructor 51 zfits(const string& fname, const string& fout, const string& tableName, 52 bool force=false) : fits(fname, fout, tableName, force), 53 fNumTiles(0), 54 fNumRowsPerTile(0), 55 fCurrentRow(-1), 56 fHeapOff(0), 57 fTileSize(0) 58 { 52 zfits(const string& fname, const string& fout, const string& tableName, bool force=false) : fits(), 53 fNumTiles(0), 54 fNumRowsPerTile(0), 55 fCurrentRow(-1), 56 fHeapOff(0), 57 fTileSize(0) 58 { 59 open(fname.c_str()); 60 Constructor(fname, fout, tableName, force); 59 61 InitCompressionReading(); 60 62 } … … 83 85 return fits::IsFileOk() && rawsum; 84 86 }; 87 88 size_t GetNumRows() const 89 { 90 if (fTable.is_compressed) 91 return fTable.Get<size_t>("ZNAXIS2"); 92 else 93 return fTable.Get<size_t>("NAXIS2"); 94 } 95 size_t GetBytesPerRow() const 96 { 97 if (fTable.is_compressed) 98 return fTable.Get<size_t>("ZNAXIS1"); 99 else 100 return fTable.Get<size_t>("NAXIS1"); 101 } 85 102 86 103 protected: -
trunk/Mars/mraw/MRawFitsRead.cc
r14095 r17035 45 45 #include "MLogManip.h" 46 46 47 #include "f its.h"47 #include "factfits.h" 48 48 #include "MTime.h" 49 49 … … 133 133 Bool_t MRawFitsRead::IsFits(const char *name) 134 134 { 135 return f its(name).good();135 return factfits(name).good(); 136 136 } 137 137 138 138 istream *MRawFitsRead::OpenFile(const char *filename) 139 139 { 140 return new f its(filename);140 return new factfits(filename); 141 141 } 142 142 143 143 Bool_t MRawFitsRead::ReadRunHeader(istream &stream) 144 144 { 145 f its &fin = static_cast<fits&>(stream);145 factfits &fin = static_cast<factfits&>(stream); 146 146 147 147 if (fin.GetStr("TELESCOP")!="FACT") … … 154 154 155 155 fRawRunHeader->SetValidMagicNumber(); 156 fRawRunHeader->SetNumEvents(fin.Get UInt("NAXIS2"));156 fRawRunHeader->SetNumEvents(fin.GetNumRows());//GetUInt("NAXIS2")); 157 157 fRawRunHeader->InitPixels(fin.GetUInt("NPIX")); 158 158 fRawRunHeader->SetObservation(type=="4294967295"?"":fin.GetStr("RUNTYPE"), "FACT"); … … 175 175 Bool_t MRawFitsRead::InitReadData(istream &stream) 176 176 { 177 f its &fin = static_cast<fits&>(stream);177 factfits &fin = static_cast<factfits&>(stream); 178 178 179 179 MArrayB **data = reinterpret_cast<MArrayB**>(fRawEvtData1->DataMember("fHiGainFadcSamples")); … … 216 216 Bool_t MRawFitsRead::ReadEvent(istream &stream) 217 217 { 218 if (!static_cast<f its&>(stream).GetNextRow())218 if (!static_cast<factfits&>(stream).GetNextRow()) 219 219 return kFALSE; 220 220 … … 231 231 void MRawFitsRead::SkipEvent(istream &fin) 232 232 { 233 static_cast<f its&>(fin).SkipNextRow();234 } 233 static_cast<factfits&>(fin).SkipNextRow(); 234 }
Note:
See TracChangeset
for help on using the changeset viewer.