Changeset 11871 for trunk/Mars/mraw
- Timestamp:
- 08/09/11 23:55:12 (13 years ago)
- Location:
- trunk/Mars/mraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mraw/MRawFitsRead.cc
r11690 r11871 38 38 #include "MRawFitsRead.h" 39 39 40 #include <fstream> 41 40 42 #include <TClass.h> 41 43 … … 64 66 : MRawFileRead(fname, name, title) 65 67 { 68 } 69 70 Bool_t MRawFitsRead::LoadMap(const char *name) 71 { 72 fPixelMap.resize(1440); 73 74 ifstream fin(name); 75 76 int l = 0; 77 78 string buf; 79 while (getline(fin, buf, '\n')) 80 { 81 if (l>1439) 82 break; 83 84 const TString bf = TString(buf.c_str()).Strip(TString::kBoth); 85 if (bf[0]=='#') 86 continue; 87 88 stringstream str(bf.Data()); 89 90 int index, cbpx; 91 92 str >> index; 93 str >> cbpx; 94 95 const int c = cbpx/1000; 96 const int b = (cbpx/100)%10; 97 const int p = (cbpx/10)%10; 98 const int x = cbpx%10; 99 100 const int hw = x+p*9+b*36+c*360; 101 if (hw>1439) 102 break; 103 104 fPixelMap[hw] = index; 105 l++; 106 } 107 108 if (l!=1440) 109 { 110 gLog << err << "ERROR - Problems reading FACTmapV5.txt" << endl; 111 fPixelMap.resize(0); 112 return kFALSE; 113 } 114 115 return kTRUE; 66 116 } 67 117 … … 91 141 fRawRunHeader->SetObservation("", "FACT"); 92 142 fRawRunHeader->SetRunInfo(0, fin.GetUInt("NIGHT"), fin.GetUInt("RUNID")); 93 fRawRunHeader->InitFact(fin.GetUInt("NPIX")/9, 9, fin.GetUInt("NROI") );143 fRawRunHeader->InitFact(fin.GetUInt("NPIX")/9, 9, fin.GetUInt("NROI"), fPixelMap.size()==0?0:fPixelMap.data()); 94 144 fRawRunHeader->SetFormat(0xf172, fin.GetUInt("BLDVER")); 95 145 fRawRunHeader->SetRunType(0/*data*/); … … 129 179 return kFALSE; 130 180 131 fRawEvtData1->SetIndices( );181 fRawEvtData1->SetIndices(fRawRunHeader->GetPixAssignment()); 132 182 133 183 return kTRUE; -
trunk/Mars/mraw/MRawFitsRead.h
r11490 r11871 11 11 { 12 12 private: 13 std::vector<UInt_t> fPCTime; //! Buffer 13 std::vector<UInt_t> fPCTime; //! Buffer 14 std::vector<UShort_t> fPixelMap; //! 14 15 15 16 istream *OpenFile(const char *filename); … … 24 25 static Bool_t IsFits(const char *name); 25 26 27 Bool_t LoadMap(const char *name); 28 26 29 ClassDef(MRawFitsRead, 0) // Task to read the raw data binary file 27 30 };
Note:
See TracChangeset
for help on using the changeset viewer.