Changeset 9212 for trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
- Timestamp:
- 01/06/09 13:07:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r8938 r9212 91 91 #include "MArrayS.h" 92 92 #include "MArrayB.h" 93 #include "MArrayI.h" 93 94 #include "MGeomCam.h" 94 95 … … 396 397 // The parameters are the pixelnumber and the FADC_SLICES values of ADCs 397 398 // 398 void MRawEvtData::AddPixel(UShort_t nOfPixel, TArrayC *data)399 void MRawEvtData::AddPixel(UShort_t nOfPixel, const TArrayC &data) 399 400 { 400 401 const Int_t n = fRunHeader->GetNumSamples(); 401 if (data ->GetSize()!=n)402 if (data.GetSize()!=n) 402 403 { 403 404 *fLog << err << "RawEvtData::AddPixel: Error, number of samples in "; 404 *fLog << "TArrayC " << data ->GetSize() << " doesn't match current number " << n << endl;405 *fLog << "TArrayC " << data.GetSize() << " doesn't match current number " << n << endl; 405 406 return; 406 407 } … … 424 425 // add the new slices as last entries to array 425 426 // 426 fHiGainFadcSamples->AddAt((Byte_t*)data->GetArray(), fHiGainFadcSamples->GetSize()-n, n); 427 } 427 fHiGainFadcSamples->AddAt((Byte_t*)data.GetArray(), fHiGainFadcSamples->GetSize()-n, n); 428 } 429 430 // -------------------------------------------------------------------------- 431 // 432 // Add the contents of the MArrayI to the fHiGainFadcSamples 433 // One Integer is added to one sample in the array. 434 // 435 void MRawEvtData::Set(const MArrayI &data) 436 { 437 const UInt_t n = fRunHeader->GetNumSamples()*fConnectedPixels; 438 439 Byte_t *dest = fHiGainFadcSamples->GetArray(); 440 441 UInt_t *src = reinterpret_cast<UInt_t*>(data.GetArray()); 442 UInt_t *end = reinterpret_cast<UInt_t*>(data.GetArray()) + n; 443 444 switch (fNumBytesPerSample) 445 { 446 case 1: 447 { 448 Byte_t *ptr = reinterpret_cast<Byte_t*>(dest); 449 while (src<end) 450 *ptr++ = *src++; 451 } 452 return; 453 454 case 2: 455 { 456 UShort_t *ptr = reinterpret_cast<UShort_t*>(dest); 457 while (src<end) 458 *ptr++ = *src++; 459 } 460 return; 461 462 case 4: 463 memcpy(dest, data.GetArray(), n*4); 464 return; 465 } 466 } 467 428 468 /* 429 469 void MRawEvtData::AddPixel(UShort_t nOfPixel, TArrayC *data, Bool_t lflag)
Note:
See TracChangeset
for help on using the changeset viewer.