Changeset 18009 for trunk/Mars


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:
7 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/Mars

  • trunk/Mars/ceres.rc

    r17913 r18009  
    233233# Does not trigger anyway
    234234ContEmpty3.Condition: MPhotonEvent.GetNumPhotons<10
     235
     236MFixTimeOffset.FileName: resmc/fact/pixel_delays_ALL_ZERO.csv
     237# MFixTimeOffset.FileName: resmc/fact/AllPhidoFiles_delays.csv
     238
     239# last line comment
  • trunk/Mars/mfileio/FileIOLinkDef.h

    r14792 r18009  
    1919#pragma link C++ class MWriteRootFile+;
    2020#pragma link C++ class MWriteFitsFile+;
     21#pragma link C++ class MMatrix+;
    2122
    2223#endif
  • trunk/Mars/mfileio/Makefile

    r14792 r18009  
    3333           MWriteFitsFile.cc \
    3434           MTopFitsGroup.cc \
    35            MFitsArray.cc
     35           MFitsArray.cc \
     36           MMatrix.cc
    3637
    3738############################################################
  • trunk/Mars/mjobs/MJSimulation.cc

    r17866 r18009  
    113113#include "MParSpline.h"
    114114#include "MGeomCam.h"
     115#include "MMatrix.h"
    115116
    116117#include "MPedestalCam.h"
     
    718719    trigger.SetVal(0);
    719720    plist.AddToList(&trigger);
     721   
     722    // -------------------------------------------------------------------
     723    // Dominik and Sebastian on: fix time offsets
     724    MMatrix fix_time_offsets_between_pixels_in_ns(
     725        "MFixTimeOffset","titel"
     726    );
     727    plist.AddToList(&fix_time_offsets_between_pixels_in_ns);
    720728
    721729    // -------------------------------------------------------------------
  • 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?
  • trunk/Mars/msimcamera/MSimCamera.h

    r17663 r18009  
    77
    88#include "MArrayF.h"
     9#include "MMatrix.h"
    910
    1011class MMcEvt;
     
    3536
    3637    MParameterD       *fCrosstalkCoeffParam;
     38
     39    MMatrix *fFixTimeOffsetsBetweenPixelsInNs; //! Container to store the fix temporal offsets for each pixel in ns
     40
    3741    MTruePhotonsPerPixelCont    *fTruePhotons;  //! Container to store the number of photons per pixel
    3842
Note: See TracChangeset for help on using the changeset viewer.