Changeset 654 for trunk/MagicSoft/Mars/mraw
- Timestamp:
- 03/01/01 15:56:58 (24 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawCrateData.cc
r454 r654 12 12 } 13 13 14 void MRawCrateData::ReadEvt(i fstream& fin)14 void MRawCrateData::ReadEvt(istream& fin) 15 15 { 16 16 // -
trunk/MagicSoft/Mars/mraw/MRawCrateData.h
r454 r654 42 42 void Print(Option_t *t=NULL); 43 43 44 void ReadEvt(i fstream& fin);44 void ReadEvt(istream& fin); 45 45 46 46 ClassDef(MRawCrateData, 1) //Container to store the Raw CRATE DATA -
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r609 r654 216 216 } 217 217 218 void MRawEvtData::DeletePixels( )218 void MRawEvtData::DeletePixels(Bool_t flag) 219 219 { 220 220 // … … 222 222 // 223 223 DeleteArrays(); 224 InitArrays( );224 InitArrays(flag); 225 225 } 226 226 … … 233 233 } 234 234 235 void MRawEvtData::InitArrays() 236 { 237 fHiGainPixId = new MArrayS(0); //UShort_t[0]; 238 fLoGainPixId = new MArrayS(0); //new UShort_t[0]; 239 fHiGainFadcSamples = new MArrayB(0); //new Byte_t[0]; 240 fLoGainFadcSamples = new MArrayB(0); //new Byte_t[0]; 235 void MRawEvtData::InitArrays(Bool_t flag) 236 { 237 // const int npix = !flag ? 0 : fRunHeader->GetNumCrates()*fRunHeader->GetNumPixInCrate(); 238 239 fHiGainPixId = new MArrayS(0);//npix); 240 fLoGainPixId = new MArrayS(0);//npix); 241 fHiGainFadcSamples = new MArrayB(0);//npix*fRunHeader->GetNumSamplesHiGain()); 242 fLoGainFadcSamples = new MArrayB(0);//npix*fRunHeader->GetNumSamplesLoGain()); 241 243 } 242 244 … … 248 250 // Add to lo gains if lflag = 1 249 251 // 250 251 252 MArrayS *arrpix = lflag ? fLoGainPixId : fHiGainPixId; 252 253 MArrayB *arrsam = lflag ? fLoGainFadcSamples : fHiGainFadcSamples; … … 286 287 } 287 288 288 /* 289 void MRawEvtData::AddPixelLo(UShort_t nOfPixel, TArrayC *data, int nr, int pos) 290 { 291 // 292 // add the number of the new pixel to the array as last entry 293 // 294 fLoGainPixId->AddAt(nOfPixel, nr); 295 296 // 297 // add the new slices as last entries to array 298 // 299 fLoGainFadcSamples->AddAt((Byte_t*)data->GetArray(), pos, data->GetSize()); 300 } 301 302 void MRawEvtData::AddPixelHi(UShort_t nOfPixel, TArrayC *data, int nr, int pos) 303 { 304 // check whether we got the right number of new samples 305 // if there are no samples already stored: this is the new number of samples 306 // 307 const Byte_t ns = data->GetSize(); 308 309 // 310 // add the number of the new pixel to the array as last entry 311 // 312 fHiGainPixId->AddAt(nOfPixel, nr); 313 314 // 315 // add the new slices as last entries to array 316 // 317 fHiGainFadcSamples->AddAt((Byte_t*)data->GetArray(), arrsam->GetSize()-ns, ns); 318 } 319 */ 320 void MRawEvtData::ReadEvt(ifstream &fin) 289 void MRawEvtData::ReadEvt(istream &fin) 321 290 { 322 291 // … … 327 296 const UShort_t nhi = fRunHeader->GetNumSamplesHiGain(); 328 297 329 TArrayC lo(nlo);330 TArrayC hi(nhi);331 332 298 const UShort_t npic = fRunHeader->GetNumPixInCrate(); 299 300 // 301 // Enhance array by the size which we'll read now 302 // 303 Byte_t lo[nlo]; 304 Byte_t hi[nhi]; 305 306 const int npixhi = fHiGainPixId->GetSize(); 307 const int npixlo = fLoGainPixId->GetSize(); 308 309 fHiGainPixId->Set(npixhi+npic); 310 fLoGainPixId->Set(npixlo+npic); 311 312 const int nsamhi = fHiGainFadcSamples->GetSize(); 313 const int nsamlo = fLoGainFadcSamples->GetSize(); 314 315 fHiGainFadcSamples->Set(nsamhi+nhi*npic); 316 fLoGainFadcSamples->Set(nsamlo+nlo*npic); 333 317 334 318 for (int i=0; i<npic; i++) … … 339 323 const UShort_t npix = fRunHeader->GetPixAssignment(i); 340 324 341 fin.read((Byte_t*)hi.GetArray(), nhi); 342 AddPixel(npix, &hi, kFALSE); 325 // 326 // This is to fill the data of one pixel to the MRawEvtHeader Class. 327 // The parameters are the pixelnumber and the FADC_SLICES values of ADCs 328 // Add to lo gains if lflag = 1 329 // 330 fin.read(hi, nhi); 331 fHiGainPixId->AddAt(npix, npixhi+i); 332 fHiGainFadcSamples->AddAt(hi, nsamhi+i*nhi, nhi); 343 333 344 334 // FIXME: Not implemented in the raw files yet 345 335 //if (IsLoGainOn(i, j)) 346 336 //{ 347 fin.read((Byte_t*)lo.GetArray(), nlo); 348 AddPixel(npix, &lo, kTRUE); 337 fin.read(lo, nlo); 338 fLoGainPixId->AddAt(npix, npixlo+i); 339 fLoGainFadcSamples->AddAt(lo, nsamlo+i*nlo, nlo); 349 340 //} 350 341 } -
trunk/MagicSoft/Mars/mraw/MRawEvtData.h
r454 r654 27 27 MArrayB *fLoGainFadcSamples; // list of lo gain samples of all pixels (ordering: see fLoGainPixId) 28 28 29 void InitArrays( );29 void InitArrays(Bool_t flag=kFALSE); 30 30 void DeleteArrays(); 31 31 … … 47 47 void Draw (Option_t * = NULL); 48 48 49 void DeletePixels( );49 void DeletePixels(Bool_t flag=kFALSE); 50 50 void AddPixel(UShort_t nOfPixel, TArrayC *data, Bool_t lflag=kFALSE); 51 51 … … 54 54 Byte_t GetNumPixels() const; 55 55 56 void ReadEvt(i fstream &fin);56 void ReadEvt(istream &fin); 57 57 58 58 ClassDef(MRawEvtData, 1) //Container to store the raw Event Data -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r609 r654 169 169 *fLog << "Number of Lo Gains On: " << fNumLoGainOn << endl; 170 170 171 for ( int i=0; i<fPixLoGainOn->GetSize(); i++)171 for (unsigned int i=0; i<fPixLoGainOn->GetSize(); i++) 172 172 { 173 173 for (int j=0; j<8; j++) … … 194 194 } 195 195 196 int MRawEvtHeader::ReadEvt(i fstream &fin)196 int MRawEvtHeader::ReadEvt(istream &fin) 197 197 { 198 198 // … … 220 220 221 221 fNumLoGainOn = 0; 222 for ( int i=0; i<fPixLoGainOn->GetSize(); i++)222 for (unsigned int i=0; i<fPixLoGainOn->GetSize(); i++) 223 223 for (int j=0; j<8; j++) 224 224 if ((*fPixLoGainOn)[i] & (1<<j)) -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
r454 r654 46 46 UShort_t GetTrigType() const { return fTrigType; } 47 47 48 int ReadEvt(i fstream& fin);48 int ReadEvt(istream& fin); 49 49 50 50 ClassDef(MRawEvtHeader, 1) // Parameter Conatiner for raw EVENT HEADER -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r609 r654 24 24 ClassImp(MRawFileRead) 25 25 26 /* 27 ----------- please don't delete ------------ 28 #define kBUFSZ 1024 29 30 class bifstream : public istream, public streambuf 31 { 32 private: 33 char fBuffer[kBUFSZ]; //! 34 FILE *fd; 35 36 int sync() 37 { 38 memset(fBuffer, 0, kBUFSZ); 39 return 0; 40 } 41 int underflow() 42 { 43 int sz=fread(fBuffer, 1, kBUFSZ, fd); 44 setg(fBuffer, fBuffer, fBuffer+kBUFSZ); 45 46 return sz==kBUFSZ ? *(unsigned char*)fBuffer : EOF;//EOF; 47 } 48 public: 49 bifstream(const char *name) : istream(this) 50 { 51 fd = fopen(name, "rb"); 52 setbuf(fBuffer, kBUFSZ); 53 } 54 }; 55 */ 56 26 57 MRawFileRead::MRawFileRead(const char *fname, const char *name, const char *title) 27 58 { … … 38 69 } 39 70 40 Bool_t MRawFileRead::PreProcess (MParList *pList) 71 MRawFileRead::~MRawFileRead() 72 { 73 delete fIn; 74 } 75 76 Bool_t MRawFileRead::PreProcess(MParList *pList) 41 77 { 42 78 // 43 79 // remember the pointer to the parameter list fur further usage 44 80 // 45 pParList = pList;46 81 47 82 // … … 103 138 return kTRUE; 104 139 } 105 140 106 141 Bool_t MRawFileRead::Process() 107 142 { … … 112 147 if (!fRawEvtHeader->ReadEvt(*fIn)) 113 148 return kFALSE; 114 //fRawEvtHeader->Print();115 149 116 150 // … … 135 169 { 136 170 fRawCrateArray->GetEntry(i)->ReadEvt(*fIn); 137 //fRawCrateArray->GetEntry(i)->Print();138 171 139 172 fRawEvtData->ReadEvt(*fIn); 140 173 } 141 //fRawEvtData->Print();142 174 143 175 return kTRUE; 144 145 176 } 146 177 -
trunk/MagicSoft/Mars/mraw/MRawFileRead.h
r454 r654 18 18 { 19 19 private: 20 MParList *pParList; 20 MRawRunHeader *fRawRunHeader; // run header information container to fill from file 21 MRawEvtHeader *fRawEvtHeader; // event header information container to fill from file 22 MRawEvtData *fRawEvtData; // raw evt header infomation container to fill from file 23 MRawCrateArray *fRawCrateArray; // crate information array container to fill from file 24 MTime *fRawEvtTime; // raw evt time information container to fill from file 21 25 22 MRawRunHeader *fRawRunHeader; 23 MRawEvtHeader *fRawEvtHeader; 24 MRawEvtData *fRawEvtData; 25 MRawCrateArray *fRawCrateArray; 26 MTime *fRawEvtTime; 27 28 ifstream *fIn; //! 26 ifstream *fIn; //! buffered input stream (file to read from) 29 27 30 28 public: 31 29 MRawFileRead(const char *filename, const char *name=NULL, const char *title=NULL); 30 ~MRawFileRead(); 32 31 33 32 Bool_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r609 r654 33 33 } 34 34 35 void MRawRunHeader::ReadEvt(i fstream& fin)35 void MRawRunHeader::ReadEvt(istream& fin) 36 36 { 37 37 // … … 87 87 // print run header information on screen 88 88 // 89 *fLog << endl; 89 90 *fLog << "MagicNumber: 0x" << hex << fMagicNumber << " - " << (fMagicNumber==0xc0c0?"OK":"Wrong!") << endl; 90 91 *fLog << "Version: " << dec << "Format=" << fFormatVersion << " "; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r454 r654 11 11 #endif 12 12 13 class TBuffer; 13 14 class ifstream; 14 15 class MArrayS; … … 77 78 void Print(Option_t *t=NULL); 78 79 79 void ReadEvt(i fstream& fin);80 void ReadEvt(istream& fin); 80 81 81 82 ClassDef(MRawRunHeader, 1) // storage container for general info
Note:
See TracChangeset
for help on using the changeset viewer.