Changeset 7690 for trunk/MagicSoft


Ignore:
Timestamp:
05/04/06 15:10:54 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7689 r7690  
    3232       at which the normalization is calculated instead of
    3333       the integral
     34
     35   * mpointing/MSrcPosRndm.[h,cc]:
     36     - added new option which allows to create a random wobble
     37       source position
    3438
    3539
  • trunk/MagicSoft/Mars/mpointing/MSrcPosRndm.cc

    r7565 r7690  
    3636#include "MSrcPosRndm.h"
    3737
     38#include <TRandom.h>
     39
    3840#include "MLog.h"
    3941#include "MLogManip.h"
     
    6668        return kFALSE;
    6769
    68     fHist = (MHSrcPosCam*)plist->FindObject("MHSrcPosCam");
    69     if (!fHist)
     70    if (fDistOfSource<0)
    7071    {
    71         *fLog << inf << "MHSrcPosCam not found... skipping." << endl;
    72         return kSKIP;
     72        fHist = (MHSrcPosCam*)plist->FindObject("MHSrcPosCam");
     73        if (!fHist)
     74        {
     75            *fLog << inf << "MHSrcPosCam not found... skipping." << endl;
     76            return kSKIP;
     77        }
     78
     79        *fLog << inf << "MHSrcPosCam found... taken to produce a random distribution." << endl;
    7380    }
    74 
    75     *fLog << inf << "MHSrcPosCam found... taken to produce a random distribution." << endl;
     81    else
     82        *fLog << inf << "Source position will be produced randomly in a distance of " << fDistOfSource << "° from the camera center!" << endl;
    7683
    7784    fConvMm2Deg = geom->GetConvMm2Deg();
     
    8794{
    8895    Axis_t x, y;
    89 
    90     fHist->GetHist().GetRandom2(x, y);
     96    if (fDistOfSource<0)
     97        fHist->GetHist().GetRandom2(x, y);
     98    else
     99    {
     100        const Double_t phi = gRandom->Uniform(TMath::TwoPi());
     101        x = TMath::Cos(phi)*fDistOfSource;
     102        y = TMath::Sin(phi)*fDistOfSource;
     103    }
    91104
    92105    fSrcPos->SetXY(x/fConvMm2Deg, y/fConvMm2Deg);
    93 
    94106    return kTRUE;
    95107}
  • trunk/MagicSoft/Mars/mpointing/MSrcPosRndm.h

    r7565 r7690  
    1717    Double_t fConvMm2Deg;
    1818
     19    Double_t fDistOfSource; // [deg] Distance of the source from the camera center
     20
    1921    Int_t  PreProcess(MParList *plist);
    2022    Int_t  Process();
    2123
    2224public:
    23     MSrcPosRndm() : fSrcPos(0), fHist(0)
     25    MSrcPosRndm() : fSrcPos(0), fHist(0), fDistOfSource(-1)
    2426    {
    2527        fName  = "MSrcPosRndm";
     
    2729    }
    2830
     31    void SetDistOfSource(Double_t dist=-1) { fDistOfSource=dist; }
     32
    2933    ClassDef(MSrcPosRndm, 0) //Overwrite the source position with a random one from MHSrcPosCam
    3034};
Note: See TracChangeset for help on using the changeset viewer.