Changeset 14791 for trunk/FACT++/gui/RawEventsViewer
- Timestamp:
- 01/28/13 10:21:39 (12 years ago)
- Location:
- trunk/FACT++/gui/RawEventsViewer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
r14250 r14791 189 189 else 190 190 191 color = float(eventData[nRoi*hardwareMapping[i] + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1); 191 // if (_softwareOrdering) 192 // color = float(eventData[nRoi*i + whichSlice] + (VALUES_SPAN/2))/(float)(VALUES_SPAN-1); 193 // else 194 color = float(eventData[nRoi*hardwareMapping[i] + whichSlice]+(VALUES_SPAN/2))/(float)(VALUES_SPAN-1); 192 195 if (logScale) 193 196 { … … 291 294 }*/ 292 295 293 const int hw = hardwareMapping[selectedPixel]; 296 // int mapping = _softwareOrdering ? selectedPixel : hardwareMapping[selectedPixel]; 297 int mapping = hardwareMapping[selectedPixel]; 298 const int hw = mapping; 294 299 const PixelMapEntry& mapEntry = fPixelMap.index(selectedPixel); 295 300 const int pixelIdInPatch = mapEntry.pixel(); … … 385 390 patchesColor[i][j] = color[j]; 386 391 } 392 fZeroArray = NULL; 393 394 _softwareOrdering = false; 387 395 388 396 } … … 402 410 delete[] waveLetArray; 403 411 } 404 } 405 412 if (fZeroArray != NULL) 413 delete[] fZeroArray; 414 } 415 void RawDataViewer::allocateZeroArray() 416 { 417 if (fZeroArray == NULL) 418 { 419 fZeroArray = new char[8192]; 420 } 421 } 406 422 /************************************************************ 407 423 * PAINT GL. main drawing function. … … 572 588 } 573 589 } 590 574 591 nRows = inputFile->HasKey("NAXIS2") ? inputFile->GetInt("NAXIS2") : 0; 575 592 nRoi = inputFile->HasKey("NROI") ? inputFile->GetInt("NROI") : 0; … … 584 601 nBoards = inputFile->HasKey("NBOARD") ? inputFile->GetInt("NBOARD") : 0; 585 602 nPixels = inputFile->HasKey("NPIX") ? inputFile->GetInt("NPIX") : 0; 586 timeSystem = inputFile->HasKey("TIMESYS") ? inputFile->GetStr("TIMESYS") : 0;587 creationDate = inputFile->HasKey("DATE") ? inputFile->GetStr("DATE") : 0;603 timeSystem = inputFile->HasKey("TIMESYS") ? inputFile->GetStr("TIMESYS") : ""; 604 creationDate = inputFile->HasKey("DATE") ? inputFile->GetStr("DATE") : ""; 588 605 nightInt = inputFile->HasKey("NIGHT") ? inputFile->GetInt("NIGHT") : 0; 589 camera = inputFile->HasKey("CAMERA") ? inputFile->GetStr("CAMERA") : 0;590 daq = inputFile->HasKey("DAQ") ? inputFile->GetStr("DAQ") : 0;606 camera = inputFile->HasKey("CAMERA") ? inputFile->GetStr("CAMERA") : ""; 607 daq = inputFile->HasKey("DAQ") ? inputFile->GetStr("DAQ") : ""; 591 608 adcCount = inputFile->HasKey("ADCRANGE") ? inputFile->GetFloat("ADCRANGE") : 2000; 609 if (nPixels == 0) 610 { 611 cout << "could not read num pixels from fits header. Assuming 1440 (FACT)." << endl; 612 nPixels = 1440; 613 } 614 if (nRoi == 0 && !inputFile->HasKey("NROI")) 615 {//let's try to figure out the roi from the column's format 616 const fits::Table::Columns& cols = inputFile->GetColumns(); 617 if (cols.find("Data") == cols.end()) 618 { 619 cout << "ERROR: Column \"Data\" could not be found. abortin load." << endl; 620 return; 621 } 622 const fits::Table::Columns::const_iterator col = cols.find("Data"); 623 if (col->second.type != 'I') 624 { 625 cout << "ERROR: Data Column has type " << col->second.type << " while viewer expects I" << endl; 626 return; 627 } 628 if (col->second.num % nPixels != 0) 629 { 630 cout << "ERROR: Num pixels (" << nPixels << ") does not match Data length (" << col->second.num << "). Aborting" << endl; 631 return; 632 } 633 nRoi = col->second.num/nPixels; 634 cout << "Estimate num samples per pixels to be " << nRoi; 635 _softwareOrdering = true; 636 } 637 else 638 _softwareOrdering = false; 592 639 593 640 if (inputFile->HasKey("OFFSET")) … … 598 645 nbBad = 0;//inputFile->GetInt("NBEVTBAD"); 599 646 600 eventNum = 0;647 eventNum = 1; 601 648 602 649 if (eventData != NULL) { … … 612 659 { 613 660 inputFile->SetPtrAddress("Data", rawEventData); 614 inputFile->SetPtrAddress("EventNum", &eventNum); 615 inputFile->SetPtrAddress("TriggerType", &triggerType); 616 inputFile->SetPtrAddress("SoftTrig", &softTrig); 617 inputFile->SetPtrAddress("BoardTime", boardTime); 618 inputFile->SetPtrAddress("StartCellData", startPix); 619 inputFile->SetPtrAddress("StartCellTimeMarker", startTM); 620 inputFile->SetPtrAddress("TimeMarker", &rawEventData[1440*nRoi]); 661 if (inputFile->HasColumn("EventNum")) 662 inputFile->SetPtrAddress("EventNum", &eventNum); 663 else 664 cout << "Warning: could not find column \"EventNum\"" << endl; 665 if (inputFile->HasColumn("TriggerType")) 666 inputFile->SetPtrAddress("TriggerType", &triggerType); 667 else 668 cout << "Warning: could not find column \"TriggerType\"" << endl; 669 if (inputFile->HasColumn("SoftTrig")) 670 inputFile->SetPtrAddress("SoftTrig", &softTrig); 671 else 672 cout << "Warning: could not find column \"SoftTrig\"" << endl; 673 if (inputFile->HasColumn("BoardTime")) 674 inputFile->SetPtrAddress("BoardTime", boardTime); 675 else 676 cout << "Warning: could not find column \"BoardTime\"" << endl; 677 if (inputFile->HasColumn("StartCellData")) 678 inputFile->SetPtrAddress("StartCellData", startPix); 679 else 680 cout << "Warning: could not find column \"StartCellData\"" << endl; 681 if (inputFile->HasColumn("StartCellTimeMarker")) 682 inputFile->SetPtrAddress("StartCellTimeMarker", startTM); 683 else 684 cout << "Warning: could not find column \"StartCellTimeMarker\"" << endl; 685 if (inputFile->HasColumn("TimeMarker")) 686 inputFile->SetPtrAddress("TimeMarker", &rawEventData[1440*nRoi]); 687 else 688 cout << "Warning: could not find column \"TimeMarker\"" << endl; 621 689 } 622 690 catch (const runtime_error &e) … … 633 701 { 634 702 pcTime[0] = pcTime[1] = 0; 635 inputFile->SetPtrAddress("UnixTimeUTC", pcTime); 703 if (inputFile->HasColumn("UnixTimeUTC")) 704 inputFile->SetPtrAddress("UnixTimeUTC", pcTime); 636 705 } 637 706 catch (const runtime_error&) … … 639 708 try 640 709 { 641 inputFile->SetPtrAddress("PCTime", pcTime); 710 if (inputFile->HasColumn("PCTime")) 711 inputFile->SetPtrAddress("PCTime", pcTime); 712 else 713 cout << "Warning: could not find column \"UnixTimeUTC\" nor \"PCTime\"" << endl; 714 642 715 } 643 716 catch (const runtime_error&) … … 824 897 return; 825 898 inputFile->GetRow(rowNum); 899 if (_softwareOrdering) 900 {//remap pixels data according to hardware id 901 if (nRoiTM != 0) 902 cout << "Warning: did not expect Time Markers data from Monte-Carlo simulations. These will not be mapped properly." << endl; 903 //first copy the data 904 int16_t* tempData = new int16_t[1440*nRoi]; 905 for (int i=0;i<1440*nRoi;i++) 906 tempData[i] = rawEventData[i]; 907 //copy back the data and re-map it on the fly 908 for (int i=0;i<1440;i++) 909 for (int j=0;j<nRoi;j++) 910 rawEventData[i*nRoi + j] = tempData[softwareMapping[i]*nRoi + j]; 911 912 delete[] tempData; 913 } 826 914 // cout << "Getting row " << rowNum << endl; 827 915 … … 1273 1361 return; 1274 1362 } 1275 const int idx = 1276 GLWindow->nRoi*GLWindow->hardwareMapping[GLWindow->selectedPixel]1277 1363 // int mapping = GLWindow->_softwareOrdering ? GLWindow->selectedPixel : GLWindow->hardwareMapping[GLWindow->selectedPixel]; 1364 int mapping = GLWindow->hardwareMapping[GLWindow->selectedPixel]; 1365 const int idx = GLWindow->nRoi*mapping + GLWindow->whichSlice; 1278 1366 1279 1367 ostringstream str; … … 1874 1962 return; 1875 1963 int softwarePix = pixel; 1876 pixel = GLWindow->hardwareMapping[pixel]; 1964 // if (!GLWindow->_softwareOrdering) 1965 pixel = GLWindow->hardwareMapping[pixel]; 1877 1966 1878 1967 HwIDBox->setValue(pixel); … … 1997 2086 return; 1998 2087 1999 HwIDBox->setValue(GLWindow->hardwareMapping[swid]); 2088 // if (GLWindow->_softwareOrdering) 2089 // HwIDBox->setValue(swid); 2090 // else 2091 HwIDBox->setValue(GLWindow->hardwareMapping[swid]); 2000 2092 } 2001 2093 -
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h
r14077 r14791 120 120 valarray<double> Maxvalues; 121 121 valarray<double> PosOfMaxvalues; 122 123 ///Used to load zero data in case of missing fits columns 124 void allocateZeroArray(); 125 char* fZeroArray; 126 //bool telling whether the data is natively ordered in software or hardware id 127 //used to correctly display monte-carlo data. 128 bool _softwareOrdering; 122 129 123 130 private: … … 177 184 178 185 186 179 187 // int hardwareMapping[1440]; 180 188 // int softwareMapping[1440];
Note:
See TracChangeset
for help on using the changeset viewer.