IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 25, 2009, 3:47:24 PM (17 years ago)
Author:
eugene
Message:

do not crash if cell is not specified: assume parity, binning = 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceUtils.c

    r23187 r24578  
    9494    source->peak = pmPeakAlloc (xChip, yChip, Io, PM_PEAK_LONE);
    9595
    96     int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");
    97     int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");
    98     int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY");
    99     int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY");
     96    float xReadout, yReadout;
    10097
    101     // XXX fix the binning : currently not selected from concepts
    102     // int xBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.XBIN"); // Binning in x and y
    103     // int yBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.YBIN"); // Binning in x and y
    104     int xBin = 1;
    105     int yBin = 1;
     98    // if we have information about the chip & cell, adjust the coordinates chip->cell->readout
     99    // otherwise, assume 0,0 offset and 1,1 parity
     100    if (cell) {
     101      int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");
     102      int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");
     103      int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY");
     104      int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY");
    106105
    107     // Position on the cell
    108     float xCell = PM_CHIP_TO_CELL(xChip, x0Cell, xParityCell, xBin);
    109     float yCell = PM_CHIP_TO_CELL(yChip, y0Cell, yParityCell, yBin);
     106      // XXX fix the binning : currently not selected from concepts
     107      // int xBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.XBIN"); // Binning in x and y
     108      // int yBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.YBIN"); // Binning in x and y
     109      int xBin = 1;
     110      int yBin = 1;
    110111
    111     // Position on the readout
    112     // float xReadout = CELL_TO_READOUT(xCell, x0Readout);
    113     // float yReadout = CELL_TO_READOUT(yCell, y0Readout);
     112      // Position on the cell
     113      float xCell = PM_CHIP_TO_CELL(xChip, x0Cell, xParityCell, xBin);
     114      float yCell = PM_CHIP_TO_CELL(yChip, y0Cell, yParityCell, yBin);
     115
     116      // Position on the readout
     117      // float xReadout = CELL_TO_READOUT(xCell, x0Readout);
     118      // float yReadout = CELL_TO_READOUT(yCell, y0Readout);
     119      xReadout = xCell;
     120      yReadout = yCell;
     121    } else {
     122      xReadout = xChip;
     123      yReadout = yChip;
     124    }
    114125   
    115     pmSourceDefinePixels (source, readout, xCell, yCell, radius);
     126    pmSourceDefinePixels (source, readout, xReadout, yReadout, radius);
    116127
    117128    return (source);
Note: See TracChangeset for help on using the changeset viewer.