Ignore:
Timestamp:
10/18/13 17:52:38 (11 years ago)
Author:
tbretz
Message:
Hopefully finished removing the std namespace from the headers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/factfits.h

    r17038 r17264  
    1111#include "zfits.h"
    1212
    13 #ifndef __MARS__
    14 namespace std
    15 {
    16 #endif
    17 
    1813class factfits : public zfits
    1914{
    2015public:
    2116    // Default constructor
    22     factfits(const string& fname, const string& tableName="", bool force=false) :
     17    factfits(const std::string& fname, const std::string& tableName="", bool force=false) :
    2318        zfits(fname, tableName, force),
    2419        fOffsetCalibration(0),
     
    3227
    3328    // Alternative constructor
    34     factfits(const string& fname, const string& fout, const string& tableName, bool force=false) :
     29    factfits(const std::string& fname, const std::string& fout, const std::string& tableName, bool force=false) :
    3530        zfits(fname, fout, tableName, force),
    3631        fOffsetCalibration(0),
     
    4843    {
    4944        zfits::StageRow(row, dest);
     45
    5046        // This file does not contain fact data or no calibration to be applied
    51          if (fOffsetCalibration.empty())
    52              return;
    53 
    54          //re-get the pointer to the data to access the offsets
    55          const uint8_t offset = (row*fTable.bytes_per_row)%4;
    56 
    57          int16_t *startCell = reinterpret_cast<int16_t*>(fBufferRow.data() + offset + fOffsetStartCellData);
    58          int16_t *data      = reinterpret_cast<int16_t*>(fBufferRow.data() + offset + fOffsetData);
     47        if (fOffsetCalibration.empty())
     48            return;
     49
     50        //re-get the pointer to the data to access the offsets
     51        const uint8_t offset = (row*fTable.bytes_per_row)%4;
     52
     53        int16_t *startCell = reinterpret_cast<int16_t*>(fBufferRow.data() + offset + fOffsetStartCellData);
     54        int16_t *data      = reinterpret_cast<int16_t*>(fBufferRow.data() + offset + fOffsetData);
    5955
    6056         /*
     
    7167         */
    7268
    73          // This version is faster because the compilers optimization
    74          // is not biased by the evaluation of %1024
    75          for (int ch=0; ch<1440; ch++)
    76          {
    77              if (startCell[ch]<0)
    78              {
    79                  data += fNumRoi;
    80                  continue;
    81              }
    82 
    83              const int16_t modStart = startCell[ch] % 1024;
    84              const int16_t *off = fOffsetCalibration.data() + ch*1024;
    85 
    86              const int16_t *cal = off+modStart;
    87              const int16_t *end_stride = data+fNumRoi;
    88 
    89              if (modStart+fNumRoi>1024)
    90              {
    91                  while (cal<off+1024)
    92                      *data++ += *cal++;
    93 
    94                  cal = off;
    95              }
    96              while (data<end_stride)
    97                  *data++ += *cal++;
    98          }
    99 
    100 }
     69        // This version is faster because the compilers optimization
     70        // is not biased by the evaluation of %1024
     71        for (int ch=0; ch<1440; ch++)
     72        {
     73            if (startCell[ch]<0)
     74            {
     75                data += fNumRoi;
     76                continue;
     77            }
     78
     79            const int16_t modStart = startCell[ch] % 1024;
     80            const int16_t *off = fOffsetCalibration.data() + ch*1024;
     81
     82            const int16_t *cal = off+modStart;
     83            const int16_t *end_stride = data+fNumRoi;
     84
     85            if (modStart+fNumRoi>1024)
     86            {
     87                while (cal<off+1024)
     88                    *data++ += *cal++;
     89
     90                cal = off;
     91            }
     92            while (data<end_stride)
     93                *data++ += *cal++;
     94        }
     95
     96    }
    10197
    10298    bool init()
     
    129125
    130126    //  Read the Drs calibration data
    131     void readDrsCalib(const string& fileName)
     127    void readDrsCalib(const std::string& fileName)
    132128    {
    133129        //should not be mandatory, but improves the perfs a lot when reading not compressed, gzipped files
     
    205201}; //class factfits
    206202
    207 #ifndef __MARS__
    208 }; //namespace std
    209 #endif
    210 
    211 #endif
     203#endif
Note: See TracChangeset for help on using the changeset viewer.