Ignore:
Timestamp:
11/07/14 15:41:06 (10 years ago)
Author:
smueller
Message:
New feature: Fix temporal offsets in between the pixels can be simulated and defined in a text file. This is solving ticket #9
Location:
trunk/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars

  • trunk/Mars/msimcamera/MSimCamera.cc

    r17844 r18009  
    122122        return kFALSE;
    123123    }
     124    // -------------------------------------------------------------------
     125    // Dominik Neise and Sebastian Mueller on fix time offsets:
     126    // We obtain the fix temporal offsets for the FACT camera pixels out of
     127    // a text file. The textfile must be mentioned in the ceres.rc file.
     128    // There are no default offsets on purporse. The filename must be specified
     129    // in ceres.rc and the file must be parsed without errors and it must
     130    // provide exactly 1440 floating point numbers.   
     131    fFixTimeOffsetsBetweenPixelsInNs =
     132    (MMatrix*)pList->FindObject("MFixTimeOffset");
     133    if (!fFixTimeOffsetsBetweenPixelsInNs)
     134    {
     135        // the key value pair providing the text file is not present in the
     136        // environment env.
     137        *fLog << err << "In Source: "<< __FILE__ <<" in line: "<< __LINE__;
     138        *fLog << " in function: "<< __func__ <<"\n";
     139        *fLog << "MFixTimeOffset not found... aborting." << endl;
     140        return kFALSE;
     141
     142    }
     143    else if ( fFixTimeOffsetsBetweenPixelsInNs->fM.size() != 1440 )
     144    {
     145        // The number of time offsets must match the number of pixels in the
     146        // FACT camera.
     147        *fLog << err << "In Source: "<< __FILE__ <<" in line: "<< __LINE__;
     148        *fLog << " in function: "<< __func__ <<"\n";
     149        *fLog << "MFixTimeOffset has the wrong dimension! ";
     150        *fLog << "There should be "<< 1440 <<" time offsets ";
     151        *fLog << "(one for each pixel in FACT) but there are: ";
     152        *fLog << fFixTimeOffsetsBetweenPixelsInNs->fM.size() << "! ";
     153        *fLog << "... aborting." << endl;
     154        return kFALSE;
     155    }
     156    // Check all entries for inf and nan. Those are not accepted here.
     157    for( std::vector< double > row : fFixTimeOffsetsBetweenPixelsInNs->fM ){
     158        for( double number : row){
     159
     160            if( std::isnan(number) || std::isinf(number) ){
     161
     162                *fLog << err << "In Source: "<< __FILE__ <<" in line: ";
     163                *fLog << __LINE__;
     164                *fLog << " in function: "<< __func__ <<"\n";
     165                *fLog << "There is a non normal number in the fix temporal ";
     166                *fLog << "pixel offsets. This is at least one number is ";
     167                *fLog << "NaN or Inf. This here is >"<< number;
     168                *fLog << "<... aborting." << endl;               
     169                return kFALSE;
     170            }
     171        }
     172    }
     173    // -------------------------------------------------------------------
    124174/*
    125175    fPulsePos = (MParameterD*)pList->FindObject("IntendedPulsePos", "MParameterD");
     
    353403    }
    354404
     405    //--------------------------------------------------------------------------
     406
    355407    // Simulate pulses
    356408    for (Int_t i=0; i<num; i++)
     
    359411
    360412        const UInt_t   idx = ph.GetTag();
    361         const Double_t t   = (ph.GetTime()-fStat->GetTimeFirst())*freq+rndm;// - fSpline->GetXmin();
     413        Double_t t   = (ph.GetTime()-fStat->GetTimeFirst())*freq+rndm;// - fSpline->GetXmin();
     414
     415        // Sebastian Mueller and Dominik Neise on fix time offsets:
     416        // We add a fix temporal offset to the relative arrival time of the
     417        // individual pixel. The offsets are stored in the
     418        // fFixTimeOffsetsBetweenPixelsInNs -> fM matrix. We identify the first
     419        // column to hold the offsets in ns.
     420        t = t + freq*fFixTimeOffsetsBetweenPixelsInNs->fM[idx][0];
    362421
    363422        // FIXME: Time jitter?
Note: See TracChangeset for help on using the changeset viewer.