Changeset 4738
- Timestamp:
- 08/26/04 13:19:20 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4736 r4738 26 26 - changed calculation of sign of SignificanceLiMaSigned due to 27 27 bug #131 28 29 * readdaq.cc, readraw.cc: 30 - updated to support MRawEvtData2 31 32 * mraw/MRawEvtData.[h,cc], mraw/MRawFileRead.cc, 33 mraw/MRawFileWrite.[h,cc], mraw/MRawRead.[h,cc], 34 mraw/MRawSocketRead.cc: 35 - updated to support negative pixel ids 36 37 * mraw/MRawRunHeader.[h,cc]: 38 - increased max format version to 4 39 - added GetNumNormalPixels 40 - added GetNumSpecialPixels 41 - added GetMinPixId 42 - added GetMaxPixId 28 43 29 44 -
trunk/MagicSoft/Mars/NEWS
r4723 r4738 37 37 - added program doing the calibration and the signal extraction 38 38 and signal calibration: callisto 39 40 - implemented support for pixels with negative IDs (Raw file format 41 version 4) 39 42 40 43 -
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r4648 r4738 100 100 // 101 101 MRawEvtData::MRawEvtData(const char *name, const char *title) 102 : fRunHeader(0) 102 103 { 103 104 fName = name ? name : "MRawEvtData"; … … 185 186 186 187 *fLog << dec << all; 187 *fLog << "HiGain: " << nHiPix << " Pixels with " << (Int_t)nHiSamp << " Samples" << endl; 188 *fLog << "LoGain: " << nLoPix << " Pixels with " << (Int_t)nLoSamp << " Samples";; 188 *fLog << GetDescriptor() << ": " << endl; 189 *fLog << "HiGain: " << nHiPix << " Pixels with " << (Int_t)nHiSamp << " Samples "; 190 *fLog << "LoGain: " << nLoPix << " Pixels with " << (Int_t)nLoSamp << " Samples"; 189 191 190 192 TString str(opt); … … 361 363 // -------------------------------------------------------------------------- 362 364 // 363 // Deletes all arrays describing the pixel Id and Samples in pixels. 364 // The flag is for future usage. 365 // 366 void MRawEvtData::DeletePixels(Bool_t flag) 367 { 368 if (fRunHeader && flag) 369 { 370 //const int npix = fRunHeader->GetNumCrates()*fRunHeader->GetNumPixInCrate(); 371 const int npix = fRunHeader->GetNumConnectedPixels(); 372 373 if (fArraySize == npix) 374 { 375 fPosInArray = 0; 376 fConnectedPixels = 0; 377 return; 378 } 379 } 380 381 DeleteArrays(); 382 InitArrays(flag); 365 // Deletes all the arrays 366 // The flag is for future usage. 367 // 368 void MRawEvtData::InitArrays(UShort_t numconnected, UShort_t maxid) 369 { 370 fHiGainPixId = new MArrayS(numconnected); 371 fLoGainPixId = new MArrayS(numconnected); 372 fHiGainFadcSamples = new MArrayB(numconnected*fRunHeader->GetNumSamplesHiGain()); 373 fLoGainFadcSamples = new MArrayB(numconnected*fRunHeader->GetNumSamplesLoGain()); 374 375 fABFlags = new MArrayB(maxid/8+1); 376 377 fConnectedPixels = 0; 383 378 } 384 379 … … 398 393 // -------------------------------------------------------------------------- 399 394 // 400 // Deletes all the arrays 401 // The flag is for future usage. 402 // 403 void MRawEvtData::InitArrays(Bool_t flag) 404 { 405 if (flag && fRunHeader) 406 { 407 const int npix = fRunHeader->GetNumConnectedPixels(); 408 409 fHiGainPixId = new MArrayS(npix); 410 fLoGainPixId = new MArrayS(npix); 411 fHiGainFadcSamples = new MArrayB(npix*fRunHeader->GetNumSamplesHiGain()); 412 fLoGainFadcSamples = new MArrayB(npix*fRunHeader->GetNumSamplesLoGain()); 413 fABFlags = new MArrayB(fRunHeader->GetMaxPixId()/8+1); 414 415 fArraySize = npix; 416 } 417 else 418 { 419 fHiGainPixId = new MArrayS(0); 420 fLoGainPixId = new MArrayS(0); 421 fHiGainFadcSamples = new MArrayB(0); 422 fLoGainFadcSamples = new MArrayB(0); 423 fABFlags = new MArrayB(0); 424 425 fArraySize = 0; 426 } 427 428 fPosInArray = 0; 429 fConnectedPixels = 0; 395 // Deletes all arrays describing the pixel Id and Samples in pixels. 396 // The flag is for future usage. 397 // 398 void MRawEvtData::ResetPixels(UShort_t numconnected, UShort_t maxid) 399 { 400 //const int npix = fRunHeader->GetNumCrates()*fRunHeader->GetNumPixInCrate(); 401 if (fHiGainPixId && fHiGainPixId->GetSize()==numconnected && (UShort_t)fABFlags->GetSize()==(maxid/8+1)) 402 { 403 fConnectedPixels = 0; 404 return; 405 } 406 407 DeleteArrays(); 408 InitArrays(numconnected, maxid); 430 409 } 431 410 … … 475 454 } 476 455 456 void MRawEvtData::ReadPixel(istream &fin, Int_t npix, Bool_t ab) 457 { 458 Byte_t *poshi = fHiGainFadcSamples->GetArray() + fConnectedPixels*fRunHeader->GetNumSamplesHiGain(); 459 Byte_t *poslo = fLoGainFadcSamples->GetArray() + fConnectedPixels*fRunHeader->GetNumSamplesLoGain(); 460 461 // Read data for one pixel 462 fin.read((char*)poshi, fRunHeader->GetNumSamplesHiGain()); 463 fin.read((char*)poslo, fRunHeader->GetNumSamplesLoGain()); 464 465 // 466 // This is to fill the data of one pixel to the MRawEvtHeader Class. 467 // The parameters are the pixelnumber and the FADC_SLICES values of ADCs 468 // Add to lo gains if lflag = 1 469 // 470 fHiGainPixId->AddAt(npix, fConnectedPixels); 471 472 // FIXME: Not implemented in the raw files yet 473 //if (IsLoGainOn(i, j)) 474 //{ 475 fLoGainPixId->AddAt(npix, fConnectedPixels); 476 //} 477 478 if (ab) 479 SETBIT((*fABFlags)[npix/8], npix%8); 480 else 481 CLRBIT((*fABFlags)[npix/8], npix%8); 482 483 fConnectedPixels++; 484 } 485 477 486 // -------------------------------------------------------------------------- 478 487 // … … 480 489 // WARNING: you have to use Init() before you can do this 481 490 // 482 void MRawEvtData::ReadEvt(istream &fin) 483 { 484 const UShort_t nlo = fRunHeader->GetNumSamplesLoGain(); 485 const UShort_t nhi = fRunHeader->GetNumSamplesHiGain(); 491 /* 492 void MRawEvtData::ReadEvt(istream &fin, Int_t posinarray) 493 { 486 494 487 495 const UShort_t npic = fRunHeader->GetNumPixInCrate(); 488 496 489 const UShort_t npos = npic*fPosInArray; 490 491 const Byte_t ab = fCrateArray->GetEntry(fPosInArray)->GetABFlags(); 492 493 Byte_t *higainsam = fHiGainFadcSamples->GetArray()+nhi*fConnectedPixels; 494 Byte_t *logainsam = fLoGainFadcSamples->GetArray()+nlo*fConnectedPixels; 495 496 for (int i=0; i<npic; i++) 497 { 498 fin.read((char*)higainsam, nhi); 499 fin.read((char*)logainsam, nlo); 500 497 const UShort_t npos = npic*posinarray; 498 499 //const Byte_t ab = fCrateArray->GetEntry(posinarray)->GetABFlags(); 500 501 for (int i=npos; i<npic+npos; i++) 502 { 501 503 // calc the spiral hardware pixel number 502 const UShort_t ipos = npos+i;504 const UShort_t ipos = i; 503 505 504 506 // Get Hardware Id … … 506 508 507 509 // Check whether the pixel is connected or not 508 if (hwid<=0) 509 continue; 510 if (hwid==0) 511 { 512 const UShort_t n = fRunHeader->GetNumSamplesLoGain()+fRunHeader->GetNumSamplesHiGain(); 513 fin.seekg(n, ios::cur); 514 return; 515 } 510 516 511 517 // -1 converts the hardware pixel Id into the software pixel index 512 const Int_t npix = /*hwid>0 ?*/ (Int_t)hwid-1 /*: hwid*/; 513 514 // 515 // This is to fill the data of one pixel to the MRawEvtHeader Class. 516 // The parameters are the pixelnumber and the FADC_SLICES values of ADCs 517 // Add to lo gains if lflag = 1 518 // 519 fHiGainPixId->AddAt(npix, fConnectedPixels); 520 higainsam += nhi; 521 522 // FIXME: Not implemented in the raw files yet 523 //if (IsLoGainOn(i, j)) 524 //{ 525 fLoGainPixId->AddAt(npix, fConnectedPixels); 526 logainsam += nlo; 527 //} 528 529 if (TESTBIT(ab, i)) 530 SETBIT((*fABFlags)[npix/8], npix%8); 531 else 532 CLRBIT((*fABFlags)[npix/8], npix%8); 533 534 fConnectedPixels++; 535 } 536 537 fPosInArray++; 538 } 518 const Int_t npix = (Int_t)hwid-1; 519 520 const Byte_t ab = fCrateArray->GetEntry(posinarray)->GetABFlags(); 521 AddPixel(fin, npix, TESTBIT(ab, i-npos)); 522 } 523 } 524 */ 539 525 540 526 // -------------------------------------------------------------------------- … … 608 594 *evt.fABFlags = *fABFlags; 609 595 610 evt.fPosInArray = fPosInArray;611 596 evt.fConnectedPixels = fConnectedPixels; 612 evt.fArraySize = fArraySize; 613 } 597 } -
trunk/MagicSoft/Mars/mraw/MRawEvtData.h
r4648 r4738 25 25 private: 26 26 MRawRunHeader *fRunHeader; //! provides information about numbers 27 MRawCrateArray *fCrateArray; //! provides information about ab flag28 27 29 28 // FIXME: COMMENT ABOUT ORDERING … … 37 36 MArrayB *fABFlags; //-> A information about the exact trigger position 38 37 39 Int_t fPosInArray; //!40 38 Int_t fConnectedPixels; //! 41 Int_t fArraySize; //!42 39 43 void InitArrays( Bool_t flag=kFALSE);40 void InitArrays(UShort_t numconnected=0, UShort_t maxid=0); 44 41 void DeleteArrays(); 45 42 … … 50 47 ~MRawEvtData(); 51 48 52 void InitRead(MRawRunHeader *rh , MRawCrateArray *arr)49 void InitRead(MRawRunHeader *rh) 53 50 { 54 51 // … … 57 54 // 58 55 fRunHeader = rh; 59 fCrateArray = arr;60 56 } 61 57 … … 64 60 void Draw (Option_t * = NULL); 65 61 66 void DeletePixels(Bool_t flag=kFALSE); 67 void ResetPixels() { DeletePixels(kTRUE); } 62 void ResetPixels(UShort_t npix, UShort_t maxid); 68 63 void AddPixel(UShort_t nOfPixel, TArrayC *data, Bool_t lflag=kFALSE); 69 64 … … 72 67 UShort_t GetNumPixels() const; 73 68 74 void ReadEvt(istream &fin); 69 void ReadPixel(istream &fin, Int_t npix, Bool_t ab); 70 //void ReadEvt(istream &fin, Int_t posinarray); 75 71 void SkipEvt(istream &fin); 76 72 -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r4694 r4738 207 207 // 208 208 fRawEvtHeader->InitRead(fRawRunHeader, fRawEvtTime); 209 fRawEvtData ->InitRead(fRawRunHeader, fRawCrateArray); 209 fRawEvtData1 ->InitRead(fRawRunHeader); 210 fRawEvtData2 ->InitRead(fRawRunHeader); 210 211 211 212 // -
trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc
r4694 r4738 31 31 // 32 32 // Input Containers: 33 // MRawRunHeader, MRawEvtHeader, MRawEvtData, MRawCrateArray, MRawEvtTime 33 // MRawRunHeader 34 // MRawEvtHeader 35 // MRawEvtData 36 // MRawEvtData2 [MRawEvtData] 37 // MRawCrateArray 38 // MTime 34 39 // 35 40 // Output Containers: … … 61 66 // Default constructor. It opens the output file (root-file) 62 67 // 63 MRawFileWrite::MRawFileWrite(const char *fname, 64 const Option_t *opt, 65 const char *ftitle, 66 const Int_t comp, 67 const char *name, const char *title) : fSplit(kFALSE) 68 MRawFileWrite::MRawFileWrite(const char *fname, const Option_t *opt, 69 const char *ftitle, const Int_t comp, 70 const char *name, const char *title) 71 : fTData(0), fSplit(kFALSE) 68 72 { 69 73 fName = name ? name : "MRawFileWrite"; … … 82 86 MRawFileWrite::~MRawFileWrite() 83 87 { 84 if (fOut != fTData->GetCurrentFile()) 85 { 86 *fLog << warn << endl; 87 *fLog << "WARNING - MWriteRootFile: Root's TTree/TFile has opened a new file" << endl; 88 *fLog << " automatically. You can change this behaviour using TTree::SetMaxTreeSize." << endl; 89 *fLog << " You won't be able to read splitted files correctly with MReadMarsFile if" << endl; 90 *fLog << " they have more than one entry in 'RunHeaders' or you try to read more than" << endl; 91 *fLog << " one of such sequences at once." << endl; 92 *fLog << endl; 93 } 94 95 // 96 // For more information see TTree:ChangeFile() 97 // 98 fOut = fTData->GetCurrentFile(); 88 if (fTData) 89 { 90 if (fOut != fTData->GetCurrentFile()) 91 { 92 *fLog << warn << endl; 93 *fLog << "WARNING - MWriteRootFile: Root's TTree/TFile has opened a new file" << endl; 94 *fLog << " automatically. You can change this behaviour using TTree::SetMaxTreeSize." << endl; 95 *fLog << " You won't be able to read splitted files correctly with MReadMarsFile if" << endl; 96 *fLog << " they have more than one entry in 'RunHeaders' or you try to read more than" << endl; 97 *fLog << " one of such sequences at once." << endl; 98 *fLog << endl; 99 } 100 101 // 102 // For more information see TTree:ChangeFile() 103 // 104 fOut = fTData->GetCurrentFile(); 105 } 99 106 100 107 // … … 147 154 if (!fRawEvtHeader) 148 155 { 149 *fLog << err << dbginf << "MRawEvtHeader not found... aborting." << endl; 150 return kFALSE; 151 } 152 153 fRawEvtData = (MRawEvtData*)pList->FindObject("MRawEvtData"); 154 if (!fRawEvtData) 155 { 156 *fLog << err << dbginf << "MRawEvtData not found... aborting." << endl; 156 *fLog << err << "MRawEvtHeader not found... aborting." << endl; 157 return kFALSE; 158 } 159 160 fRawEvtData1 = (MRawEvtData*)pList->FindObject("MRawEvtData"); 161 if (!fRawEvtData1) 162 { 163 *fLog << err << "MRawEvtData not found... aborting." << endl; 164 return kFALSE; 165 } 166 fRawEvtData2 = (MRawEvtData*)pList->FindObject("MRawEvtData2", "MRawEvtData"); 167 if (!fRawEvtData2) 168 { 169 *fLog << err << "MRawEvtData2 [MRawEvtData] not found... aborting." << endl; 157 170 return kFALSE; 158 171 } … … 161 174 if (!fRawCrateArray) 162 175 { 163 *fLog << err << dbginf <<"MRawCrateArray not found... aborting." << endl;176 *fLog << err << "MRawCrateArray not found... aborting." << endl; 164 177 return kFALSE; 165 178 } … … 168 181 if (!fTime) 169 182 { 170 *fLog << err << dbginf <<"MTime not found... aborting." << endl;183 *fLog << err << "MTime not found... aborting." << endl; 171 184 return kFALSE; 172 185 } … … 175 188 if (!fRawRunHeader) 176 189 { 177 *fLog << err << dbginf <<"MRawRunHeader not found... aborting." << endl;190 *fLog << err << "MRawRunHeader not found... aborting." << endl; 178 191 return kFALSE; 179 192 } … … 220 233 fTData->Branch("MTime.", "MTime", &fTime, 32000); 221 234 fTData->Branch("MRawEvtHeader.", "MRawEvtHeader", &fRawEvtHeader, 32000); 222 fTData->Branch("MRawEvtData.", "MRawEvtData", &fRawEvtData, 320000); 235 fTData->Branch("MRawEvtData.", "MRawEvtData", &fRawEvtData1, 320000); 236 fTData->Branch("MRawEvtData2.", "MRawEvtData", &fRawEvtData2, 320000); 223 237 fTData->Branch("MRawCrateArray.", "MRawCrateArray", &fRawCrateArray, 32000); 224 238 if (!fSplit) … … 229 243 fTPedestal ->Branch("MRawEvtHeader.", "MRawEvtHeader", &fRawEvtHeader, 32000); 230 244 fTCalibration->Branch("MRawEvtHeader.", "MRawEvtHeader", &fRawEvtHeader, 32000); 231 fTPedestal ->Branch("MRawEvtData.", "MRawEvtData", &fRawEvtData, 320000); 232 fTCalibration->Branch("MRawEvtData.", "MRawEvtData", &fRawEvtData, 320000); 245 fTPedestal ->Branch("MRawEvtData.", "MRawEvtData", &fRawEvtData1, 320000); 246 fTCalibration->Branch("MRawEvtData.", "MRawEvtData", &fRawEvtData1, 320000); 247 fTPedestal ->Branch("MRawEvtData2.", "MRawEvtData", &fRawEvtData2, 320000); 248 fTCalibration->Branch("MRawEvtData2.", "MRawEvtData", &fRawEvtData2, 320000); 233 249 fTPedestal ->Branch("MRawCrateArray.", "MRawCrateArray", &fRawCrateArray, 32000); 234 250 fTCalibration->Branch("MRawCrateArray.", "MRawCrateArray", &fRawCrateArray, 32000); -
trunk/MagicSoft/Mars/mraw/MRawFileWrite.h
r4694 r4738 22 22 MRawRunHeader *fRawRunHeader; 23 23 MRawEvtHeader *fRawEvtHeader; 24 MRawEvtData *fRawEvtData; 24 MRawEvtData *fRawEvtData1; 25 MRawEvtData *fRawEvtData2; 25 26 MRawCrateArray *fRawCrateArray; 26 27 … … 40 41 41 42 public: 42 MRawFileWrite(const char *fname, 43 const Option_t *opt="RECREATE", 44 const char *ftitle="Untitled", 45 const Int_t comp=2, 43 MRawFileWrite(const char *fname, const Option_t *opt="RECREATE", 44 const char *ftitle="Untitled", const Int_t comp=2, 46 45 const char *name=NULL, const char *title=NULL); 47 46 ~MRawFileWrite(); -
trunk/MagicSoft/Mars/mraw/MRawRead.cc
r4040 r4738 24 24 25 25 ////////////////////////////////////////////////////////////////////////////// 26 // 26 // 27 27 // MRawRead 28 // 29 // This tasks reads the raw binary file like specified in the TDAS??? 30 // and writes the data in the corresponding containers which are 31 // either retrieved from the parameter list or created and added. 32 // 33 // Input Containers: 34 // -/- 35 // 28 // 29 // This tasks reads the raw binary file like specified in the TDAS??? 30 // and writes the data in the corresponding containers which are 31 // either retrieved from the parameter list or created and added. 32 // 33 // Input Containers: 34 // -/- 35 // 36 36 // Output Containers: 37 37 // MRawRunHeader 38 38 // MRawEvtHeader 39 39 // MRawEvtData 40 // MRawEvtData2 [MRawEvtData] 40 41 // MRawCrateArray 41 // M RawEvtTime42 // 42 // MTime 43 // 43 44 ////////////////////////////////////////////////////////////////////////////// 44 45 #include "MRawRead.h" … … 105 106 return kFALSE; 106 107 107 fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData"); 108 if (!fRawEvtData) 108 fRawEvtData1 = (MRawEvtData*)pList->FindCreateObj("MRawEvtData"); 109 if (!fRawEvtData1) 110 return kFALSE; 111 112 fRawEvtData2 = (MRawEvtData*)pList->FindCreateObj("MRawEvtData", "MRawEvtData2"); 113 if (!fRawEvtData2) 109 114 return kFALSE; 110 115 … … 180 185 // Delete arrays which stores the pixel information (time slices) 181 186 // 182 fRawEvtData->ResetPixels(); 187 fRawEvtData1->ResetPixels(fRawRunHeader->GetNumNormalPixels(), fRawRunHeader->GetMaxPixId()); 188 fRawEvtData2->ResetPixels(fRawRunHeader->GetNumSpecialPixels(), fRawRunHeader->GetMinPixId()); 183 189 184 190 // … … 189 195 190 196 // 197 // Calculate the number of byte to be skipped in a file if a pixel is not connected 198 // 199 const UShort_t nskip = fRawRunHeader->GetNumSamplesLoGain()+fRawRunHeader->GetNumSamplesHiGain(); 200 201 // 191 202 // read the CRATE DATA (see specification) from file 192 203 // 204 Int_t posinarray=0; 193 205 for (int i=0; i<nc; i++) 194 206 { … … 197 209 return kFALSE; 198 210 199 fRawEvtData->ReadEvt(fin); 211 //fRawEvtData1->ReadEvt(fin, posinarray++); 212 213 const UShort_t npic = fRawRunHeader->GetNumPixInCrate(); 214 const Byte_t ab = fRawCrateArray->GetEntry(posinarray)->GetABFlags(); 215 for (int j=0; j<npic; j++) 216 { 217 // calc the spiral hardware pixel number 218 const UShort_t ipos = posinarray*npic+j; 219 220 // Get Hardware Id 221 const Short_t hwid = fRawRunHeader->GetPixAssignment(ipos); 222 223 // Check whether the pixel is connected or not 224 if (hwid==0) 225 { 226 fin.seekg(nskip, ios::cur); 227 continue; 228 } 229 230 // -1 converts the hardware pixel Id into the software pixel index 231 if (hwid>0) 232 fRawEvtData1->ReadPixel(fin, hwid-1, TESTBIT(ab, j)); 233 else 234 fRawEvtData2->ReadPixel(fin, -(hwid-1), TESTBIT(ab, j)); 235 236 } 200 237 if (!fin) 201 238 return kFALSE; 239 240 posinarray++; 202 241 } 203 242 … … 226 265 { 227 266 fRawCrateArray->GetEntry(i)->SkipEvt(fin, ver); 228 fRawEvtData ->SkipEvt(fin);267 fRawEvtData1->SkipEvt(fin); 229 268 } 230 269 } -
trunk/MagicSoft/Mars/mraw/MRawRead.h
r4114 r4738 18 18 MRawRunHeader *fRawRunHeader; // run header information container to fill from file 19 19 MRawEvtHeader *fRawEvtHeader; // event header information container to fill from file 20 MRawEvtData *fRawEvtData; // raw evt header infomation container to fill from file 20 MRawEvtData *fRawEvtData1; // raw evt data infomation container to fill from file 21 MRawEvtData *fRawEvtData2; // raw evt data for pixels with negative indices 21 22 MRawCrateArray *fRawCrateArray; // crate information array container to fill from file 22 23 MTime *fRawEvtTime; // raw evt time information container to fill from file -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r3734 r4738 29 29 // Root storage container for the RUN HEADER information 30 30 // 31 // Format Version 4: 32 // ----------------- 33 // - added support for pixels with negative IDs 34 // 35 // Format Version 3: 36 // ----------------- 37 // - ??? 38 // 31 39 // Format Version 2: 32 40 // ----------------- … … 62 70 63 71 const UShort_t MRawRunHeader::kMagicNumber = 0xc0c0; 64 const Byte_t MRawRunHeader::kMaxFormatVersion = 3;72 const Byte_t MRawRunHeader::kMaxFormatVersion = 4; 65 73 66 74 // -------------------------------------------------------------------------- … … 239 247 // Return the assigned pixel number for the given FADC channel 240 248 // 241 UShort_t MRawRunHeader::GetPixAssignment(UShort_t i) const249 Short_t MRawRunHeader::GetPixAssignment(UShort_t i) const 242 250 { 243 251 // FIXME: Do we need a range check here? 244 return ( *fPixAssignment)[i];252 return (Short_t)(*fPixAssignment)[i]; 245 253 } 246 254 … … 248 256 // 249 257 // Return the number of pixel which are markes as connected in the 250 // pix assignment ( >0)258 // pix assignment (!=0) 251 259 // 252 260 UShort_t MRawRunHeader::GetNumConnectedPixels() const 261 { 262 const Int_t num = fPixAssignment->GetSize(); 263 264 UShort_t rc = 0; 265 for (int i=0; i<num; i++) 266 { 267 if (GetPixAssignment(i)!=0) 268 rc++; 269 } 270 return rc; 271 } 272 273 // -------------------------------------------------------------------------- 274 // 275 // Return the number of pixel which are markes as connected and so-called 276 // 'normal' pixels in the pix assignment (>0) 277 // 278 UShort_t MRawRunHeader::GetNumNormalPixels() const 253 279 { 254 280 const Int_t num = fPixAssignment->GetSize(); … … 265 291 // -------------------------------------------------------------------------- 266 292 // 293 // Return the number of pixel which are markes as connected and so-called 294 // 'special' pixels in the pix assignment (<0) 295 // 296 UShort_t MRawRunHeader::GetNumSpecialPixels() const 297 { 298 const Int_t num = fPixAssignment->GetSize(); 299 300 UShort_t rc = 0; 301 for (int i=0; i<num; i++) 302 { 303 if (GetPixAssignment(i)<0) 304 rc++; 305 } 306 return rc; 307 } 308 309 // -------------------------------------------------------------------------- 310 // 267 311 // Return the maximum id which exists in the pix assignment 268 312 // … … 271 315 const Int_t num = fPixAssignment->GetSize(); 272 316 273 UShort_t rc = 0;317 Short_t rc = 0; 274 318 for (int i=0; i<num; i++) 275 319 rc = TMath::Max(GetPixAssignment(i), rc); 276 320 277 321 return rc; 322 } 323 324 // -------------------------------------------------------------------------- 325 // 326 // Return minus th minimum id which exists in the pix assignment 327 // 328 UShort_t MRawRunHeader::GetMinPixId() const 329 { 330 const Int_t num = fPixAssignment->GetSize(); 331 332 Short_t rc = 0; 333 for (int i=0; i<num; i++) 334 rc = TMath::Min(GetPixAssignment(i), rc); 335 336 return (UShort_t)-rc; 278 337 } 279 338 -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r3734 r4738 95 95 const MTime &GetRunStart() const { return fRunStart; } 96 96 const MTime &GetRunEnd() const { return fRunStop; } 97 UShort_t GetPixAssignment(UShort_t i) const;97 Short_t GetPixAssignment(UShort_t i) const; 98 98 UShort_t GetMaxPixId() const; 99 UShort_t GetMinPixId() const; 99 100 UShort_t GetNumConnectedPixels() const; 101 UShort_t GetNumNormalPixels() const; 102 UShort_t GetNumSpecialPixels() const; 100 103 101 104 UInt_t GetNumSamplesPerCrate() const -
trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc
r4577 r4738 263 263 // 264 264 fRawEvtHeader->InitRead(fRawRunHeader, fRawEvtTime); 265 fRawEvtData ->InitRead(fRawRunHeader, fRawCrateArray); 265 fRawEvtData1 ->InitRead(fRawRunHeader); 266 fRawEvtData2 ->InitRead(fRawRunHeader); 266 267 267 268 if (!ReadEvent(*fIn)) -
trunk/MagicSoft/Mars/readdaq.cc
r2728 r4738 143 143 plist.AddToList(&evtdata); 144 144 145 MRawEvtData evtdata2("MRawEvtData2"); 146 plist.AddToList(&evtdata2); 147 145 148 MRawCrateArray cratearray; 146 149 plist.AddToList(&cratearray); … … 162 165 MPrint print3("MRawCrateArray", "", "PrintCrateArray"); 163 166 MPrint print4("MRawEvtData", kDecimal?"dec":"hex", "PrintEvtData"); 167 MPrint print5("MRawEvtData2", kDecimal?"dec":"hex", "PrintEvtData2"); 164 168 165 169 tasks.AddToList(&print0); … … 169 173 tasks.AddToList(&print3); 170 174 tasks.AddToList(&print4); 175 tasks.AddToList(&print5); 171 176 172 177 // -
trunk/MagicSoft/Mars/readraw.cc
r4576 r4738 169 169 MTime *evttime = NULL; 170 170 MRawEvtData *evtdata = NULL; 171 MRawEvtData *evtdata2 = NULL; 171 172 MRawCrateArray *evtcrate = NULL; 172 173 MMcEvt *evtmc = NULL; … … 176 177 EnableBranch(evttree, "MTime", &evttime); 177 178 EnableBranch(evttree, "MRawEvtData", &evtdata); 179 EnableBranch(evttree, "MRawEvtData2", &evtdata2); 178 180 EnableBranch(evttree, "MRawCrateArray", &evtcrate); 179 181 EnableBranch(evttree, "MMcEvt", &evtmc); … … 209 211 if (evtdata) 210 212 evtdata->Print(kDecimal?"dec":"hex"); 213 if (evtdata2) 214 evtdata2->Print(kDecimal?"dec":"hex"); 211 215 212 216 gLog << endl;
Note:
See TracChangeset
for help on using the changeset viewer.