Changeset 9336 for trunk/MagicSoft


Ignore:
Timestamp:
02/15/09 13:24:59 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9332 r9336  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2009/02/15 Thomas Bretz
     21
     22   * mjobs/MJCalibrateSignal.cc:
     23     - updated the rule to allow for file names without the leading date
     24
     25   * mjobs/MJSpectrum.[h,cc]:
     26     - set the kMustCleanup bit for sanity
     27     - replaced a lot of Form by MString::Format
     28     - moved the getting of the right Alpha-histogram to GetHAlpha
     29     - the tlist2 doesn't neet to replace anything because all previous
     30       tasklists added to the list have been removed again
     31     - "DataType" already in parlist? Don't add a second one
     32     - replaced some gLog by fLog
     33     - make sure that the "Done." message is printed even in case
     34       no output is written at the end
     35
     36   * ceres.rc:
     37     - added some more info
     38
     39   * datacenter/scripts/runcorsika:
     40     - added magnetic field Azimuth direction (ARRANG), currently
     41       at ~ -7deg at La Palma
     42
     43   * mbase/MLog.cc:
     44     - finallyadded a really stupid hack/workaround to suppress these
     45       annoying errors in case of a log-scale set too early
     46
     47   * mbase/MTask.[h,cc]:
     48     - Replaced OverwritesProcess by Overwrites
     49
     50   * mcorsika/MCorsikaEvtHeader.cc:
     51     - fixed particle momentum coordinate system
     52
     53   * mcorsika/MCorsikaRunHeader.[h,cc]:
     54     - added magnetic field values
     55     - improved output
     56
     57   * mjobs/MJSimulation.cc:
     58     - updated height scale
     59     - use MPhotonStatistics.fLength
     60     - plot median dev of photon arrival times
     61
     62   * mmc/MMcRunHeader.hxx:
     63     - added a getter IsCeres
     64     - added a setter for the Corsika Version
     65
     66   * mpedestal/MMcPedestalCopy.cc:
     67     - use the new IsCeres
     68
     69   * msim/MSimMMCS.[h,cc]:
     70     - use the telescope pointing in telescope coordinates for MMcEvt
     71     - correct the shower direction by the magnetic field azimuth
     72     - set corsika program version
     73
     74   * msim/MSimPointingPos.[h,cc]:
     75     - splitted the output into coordinated in the corsika frame
     76       (module the magnetic field) and the poiting direction in
     77       telescope coordinates
     78     - added possibility to "observe" in off-target mode
     79
     80   * msimreflector/MSimReflector.cc:
     81     - use new pointing direction in the corsika frame
     82
     83
     84
     85
    2086 2009/02/13 Thomas Bretz
    2187
     
    66132     - added reading of a default psf from the input file
    67133
     134   * mjobs/MSequence.cc:
     135     - fixed a bug in GetArrays which could cause seg-faults
     136     - added a sanity check
    68137
    69138
  • trunk/MagicSoft/Mars/ceres.rc

    r9332 r9336  
    6060
    6161# -------------------------------------------------------------------------
    62 # Ceres specific setup
     62# Ceres general setup
    6363# -------------------------------------------------------------------------
    6464
     
    6868# Force the use of the "hardware" trigger for calibration data
    6969#ForceTrigger: Yes
     70
     71
     72# -------------------------------------------------------------------------
     73# Here you can control the poiting of the telescope.
     74# To switch on off-target observations set a value for the distance >0.
     75# Whether they are randomly disributed (<0) or at a fixed phi can also
     76# be decided. Note, that this is options are ignored in the case
     77# a view-cone was used. (All valued given in degree)
     78# -------------------------------------------------------------------------
     79
     80#MSimPointingPos.OffTargetDistance: 0.4
     81#MSimPointingPos.OffTargetPhi: -1
    7082
    7183
     
    183195
    184196#MSimReadout.fConversionFactor: 1
     197
  • trunk/MagicSoft/Mars/datacenter/scripts/runcorsika

    r9301 r9336  
    6565   # the detector, BZ is the vertical component (muT) downwards)
    6666   echo "MAGNET 30.3 24.1"
     67   # Rotation angle between array x-direction and magnetic north direction
     68   # positive if array x-direction points to the west
     69   echo "ARRANG -7.0"
    6770   # Atmosphere
    6871   echo "ATMOSPHERE 11 T"
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r9302 r9336  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MLog.cc,v 1.62 2009-02-07 20:40:07 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MLog.cc,v 1.63 2009-02-15 13:24:59 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    814814        gLog << ": " << msg << std::endl;
    815815    else
    816         if (!location || strlen(location) == 0)
     816        if (location==0 || location[0]==0)
    817817            gLog << ": " << msg << std::endl;
    818818        else
     
    830830    if (ErrorHandlerIgnore(level))
    831831        return;
     832
     833    // This is a really stupid hack/workaround to suppress these
     834    // annoying errors in case of a log-scale set too early
     835    if (level==kError && !strcmp(location, "THistPainter::PaintInit"))
     836        level=kInfo;
    832837
    833838    gLog << std::flush;
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r9314 r9336  
    452452void MTask::PrintStatistics(const Int_t lvl, Bool_t title, Double_t time) const
    453453{
    454     if (!OverwritesProcess() && IsA()!=MTask::Class())
     454    if (!Overwrites("Process") && IsA()!=MTask::Class())
    455455        return;
    456456
     
    511511// leave out the argument.
    512512//
    513 Bool_t MTask::OverwritesProcess(TClass *cls) const
     513Bool_t MTask::Overwrites(const char *name, TClass *cls) const
    514514{
    515515    if (!cls)
     
    525525    // Check whether the class cls overwrites Process
    526526    //
    527     if (cls->GetMethodAny("Process"))
     527    if (cls->GetMethodAny(name))
    528528        return kTRUE;
    529529
     
    535535    while ((base=(TBaseClass*)NextBase()))
    536536    {
    537         if (OverwritesProcess(base->GetClassPointer()))
     537        if (Overwrites(name, base->GetClassPointer()))
    538538            return kTRUE;
    539539    }
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r8642 r9336  
    7979
    8080    const TList *GetListOfBranches() const { return fListOfBranches; }
    81     Bool_t OverwritesProcess(TClass *cls=NULL) const;
     81    Bool_t Overwrites(const char *name, TClass *cls=NULL) const;
    8282
    8383    // Filter functions
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaEvtHeader.cc

    r9308 r9336  
    121121    // Pointing along particle direction
    122122    // (x=east, y=north, z=upwards)
    123     fMomentumX = -f[7];
    124     fMomentumY =  f[6];
     123    fMomentumX =  f[7];
     124    fMomentumY = -f[6];
    125125    fMomentumZ = -f[8];
    126126
     
    136136    }
    137137
    138     //fX = f[97];
    139     //fY = f[117];
    140 
    141     fX =  f[117];
    142     fY = -f[97];
     138    fX =  f[117];   //fX = f[97];
     139    fY = -f[97];    //fY = f[117];
    143140
    144141    fin.seekg(1088-273*4, ios::cur);
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.cc

    r9312 r9336  
    3434//  + UInt_t fParticleID
    3535//  + Float_t fImpactMax
     36//  + Float_t fMagneticFieldX
     37//  + Float_t fMagneticFieldZ
     38//  + Float_t fMagneticFieldAz
    3639//
    3740////////////////////////////////////////////////////////////////////////////
     
    8689    fRunStart.SetCorsikaTime(f[1]);
    8790
    88     fProgramVersion = f[2];          //FIXME: INT???
     91    fProgramVersion = f[2];
    8992    fNumObsLevel    = TMath::Nint(f[3]);
    9093
     
    149152    fParticleID = TMath::Nint(g[1]);
    150153
    151     fImpactMax = g[86];
     154    // MAGNETIC FIELD: x/z-component of earth magnetic field in muT
     155    fMagneticFieldX  =  g[69];  // x-component ( BX)
     156    fMagneticFieldZ  = -g[70];  // z-component (-BZ)
     157    fMagneticFieldAz =  g[91];  // Azimuth angle of magnetic north expressed in telescope coordinates
    152158
    153159    fZdMin = g[79];                // lower edge of theta in °
     
    157163    // FIXME: Correct for direction of magnetic field!
    158164
     165    // Number of cherenkov detectors in x
     166    // Number of cherenkov detectors in y
     167    // Grid spacing x
     168    // Grid spacing y
     169
     170    // g[93] angle between array x-direction and magnetic north
     171
     172
     173    fImpactMax = g[86];
     174
    159175    fWavelengthMin = g[95];        // Cherenkov bandwidth lower end in nm
    160176    fWavelengthMax = g[96];        // Cherenkov bandwidth upper end in nm
     
    222238{
    223239    *fLog << all << endl;
    224     *fLog << "Run Number:  " << fRunNumber << "  (" << fRunStart.GetStringFmt("%d.%m.%Y") << ", V" << fProgramVersion << ")" << endl;
    225     *fLog << "Particle ID: " << MMcEvt::GetParticleName(fParticleID) << endl;
     240    *fLog << "Run Number:    " << fRunNumber << "  (" << fRunStart.GetStringFmt("%d.%m.%Y") << ", V" << fProgramVersion << ")" << endl;
     241    *fLog << "Particle ID:   " << MMcEvt::GetParticleName(fParticleID) << endl;
    226242    if (fNumEvents>0)
    227         *fLog << "Num Events:  " << fNumEvents << endl;
    228     *fLog << "Obs Level:  ";
     243        *fLog << "Num Events:    " << fNumEvents << endl;
     244    *fLog << "Obs Level:    ";
    229245    for (Byte_t i=0; i<fNumObsLevel; i++)
    230246        *fLog << " " << fObsLevel[i]/100. << "m";
    231247    *fLog << endl;
    232     *fLog << "Spectrum:    Slope=" << fSlopeSpectrum << "  (" << fEnergyMin << "GeV-" << fEnergyMax << "GeV)" <<  endl;
     248
     249    *fLog << "MagneticField: X/Z=(" << fMagneticFieldX << "/";
     250    *fLog << fMagneticFieldZ << ")  Az=" << fMagneticFieldAz*TMath::RadToDeg() << "deg" << endl;
     251
     252    *fLog << "Spectrum:      Slope=" << fSlopeSpectrum << "  (" << fEnergyMin << "GeV-" << fEnergyMax << "GeV)" <<  endl;
    233253
    234254    if (fViewConeOuterAngle>0)
    235         *fLog << "ViewCone:    " << fViewConeInnerAngle << "deg-" << fViewConeOuterAngle << "deg" << endl;
     255        *fLog << "ViewCone:      " << fViewConeInnerAngle << "deg-" << fViewConeOuterAngle << "deg" << endl;
    236256
    237257    if (fZdMax>=0)
    238258    {
    239         *fLog << "Zd/Az:       " << fZdMin << "deg";
     259        *fLog << "Zd/Az:         " << fZdMin << "deg";
    240260        if (fZdMin==fZdMax)
    241261            *fLog << " (fixed)";
  • trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h

    r9332 r9336  
    1616
    1717private:
    18     UInt_t   fRunNumber;              // Run number
    19     UInt_t   fParticleID;             // Particle ID (see MMcEvtBasic or CORSIKA manual)
    20     UInt_t   fNumEvents;              // Number of events
    21     MTime    fRunStart;               // Date of begin (yymmdd)
    22     Float_t  fProgramVersion;         // Version of program
     18    UInt_t  fRunNumber;               // Run number
     19    UInt_t  fParticleID;              // Particle ID (see MMcEvtBasic or CORSIKA manual)
     20    UInt_t  fNumEvents;               // Number of events
     21    MTime   fRunStart;                // Date of begin (yymmdd)
     22    Float_t fProgramVersion;          // Version of program
    2323
    24     Byte_t   fNumObsLevel;            // Number of observation levels
    25     Float_t  fObsLevel[10];           // Observation levels [cm]
     24    Byte_t  fNumObsLevel;             // Number of observation levels
     25    Float_t fObsLevel[10];            // Observation levels [cm]
    2626
    27     Float_t  fImpactMax;              // [cm] Maximum simulated impact
     27    Float_t fImpactMax;               // [cm] Maximum simulated impact
    2828
    29     Float_t  fSlopeSpectrum;          // Slope of energy spectrum
    30     Float_t  fEnergyMin;              // Lower limit of energy range
    31     Float_t  fEnergyMax;              // Upper limit of energy range
     29    Float_t fSlopeSpectrum;           // Slope of energy spectrum
     30    Float_t fEnergyMin;               // Lower limit of energy range
     31    Float_t fEnergyMax;               // Upper limit of energy range
    3232
    33     Float_t  fZdMin;                  // [rad] Zenith distance
    34     Float_t  fZdMax;                  // [rad] Zenith distance
    35     Float_t  fAzMin;                  // [rad] Azimuth (north=0; east=90)
    36     Float_t  fAzMax;                  // [rad] Azimuth (north=0; east=90) (north denotes the magnet north which is defined to be in the geografic north!)
     33    Float_t fZdMin;                   // [rad] Zenith distance
     34    Float_t fZdMax;                   // [rad] Zenith distance
     35    Float_t fAzMin;                   // [rad] Azimuth (north=0; east=90)
     36    Float_t fAzMax;                   // [rad] Azimuth (north=0; east=90) (north denotes the magnet north which is defined to be in the geografic north!)
     37
     38    Float_t fMagneticFieldX;          // [muT] x-component of earth magnetic field (ceres coordinate system)
     39    Float_t fMagneticFieldZ;          // [muT] z-component of earth magnetic field (ceres coordinate system)
     40    Float_t fMagneticFieldAz;         // [rad] Azimuth angle of magnetic north expressed in telescope coordinates
    3741
    3842    Float_t fWavelengthMin;           // [nm] Wavelength bandwidth lo edge
     
    5054    UInt_t GetNumEvents() const { return fNumEvents; }
    5155
    52     UInt_t GetFormatVersion() const { return (UInt_t)fProgramVersion; }
     56    const MTime &GetRunStart() const { return fRunStart; }
     57
     58    Float_t GetProgramVersion() const { return fProgramVersion; }
    5359
    5460    Float_t GetZdMin() const { return fZdMin; }
     
    6773    Float_t GetImpactMax() const { return fImpactMax; }
    6874
     75    Float_t GetMagneticFieldX() const  { return fMagneticFieldX; }
     76    Float_t GetMagneticFieldZ() const  { return fMagneticFieldZ; }
     77    Float_t GetMagneticFieldAz() const { return fMagneticFieldAz; }
     78
    6979    Float_t GetViewConeOuterAngle() const { return fViewConeOuterAngle; }
    7080    Bool_t HasViewCone() const { return fViewConeOuterAngle>0; }
  • trunk/MagicSoft/Mars/mjobs/MJSimulation.cc

    r9332 r9336  
    331331    MBinning binss( 100,     1, 10000000, "BinningSize",   "log");
    332332    MBinning binsi(  50,  -250,      250, "BinningImpact");
    333     MBinning binsh(  50,     0,       12, "BinningHeight");
    334     MBinning binsaz(360,  -360,      360, "BinningAz");
     333    MBinning binsh( 150,     0,       50, "BinningHeight");
     334    MBinning binsaz(720,  -360,      360, "BinningAz");
    335335    MBinning binszd( 70,     0,       70, "BinningZd");
    336     MBinning binsvc(155,     0,       31, "BinningViewCone");
     336    MBinning binsvc( 45,     0,        9, "BinningViewCone");
    337337    MBinning binsew(150,     0,       50, "BinningEvtWidth");
    338338    MBinning binstr("BinningTrigPos");
     
    357357    mhtp.SetTitle("Trigger position w.r.t. the first photon hitting a detector");
    358358
    359     MH3 mhew("MPhotonStatistics.fTimeLast-MPhotonStatistics.fTimeFirst - MRawRunHeader.GetFreqSampling/1000.*MRawRunHeader.fNumSamplesHiGain - 2*MPulseShape.GetPulseWidth");
     359    MH3 mhew("MPhotonStatistics.fLength");
    360360    mhew.SetName("EvtWidth");
    361361    mhew.SetTitle("Time between first and last photon hitting a detector");
     362
     363    MH3 mhed("MPhotonStatistics.fTimeMedDev");
     364    mhed.SetName("EvtMedDev;EvtWidth");
    362365
    363366    MFillH fillh1(&mhn1, "", "FillCorsika");
     
    366369    MFillH filltp(&mhtp, "", "FillTriggerPos");
    367370    MFillH fillew(&mhew, "", "FillEvtWidth");
     371    MFillH filled(&mhed, "", "FillMedDev");
    368372    fillh1.SetNameTab("Corsika",    "Distribution as simulated by Corsika");
    369373    fillh2.SetNameTab("Detectable", "Distribution of events hit the detector");
     
    371375    filltp.SetNameTab("TrigPos",    "TriggerPosition w.r.t the first photon");
    372376    fillew.SetNameTab("EvtWidth",   "Time between first and last photon hitting a detector");
     377    filled.SetNameTab("MedDev",     "Time between first and last photon hitting a detector");
    373378
    374379    MHPhotonEvent planeG(1);     // Get from MaxImpact
     
    621626    }
    622627    if (header.IsDataRun())
     628    {
    623629        tasks.AddToList(&fillew);
     630        tasks.AddToList(&filled);
     631    }
    624632    if (!header.IsPedestalRun())
    625633    {
  • trunk/MagicSoft/Mars/mpedestal/MMcPedestalCopy.cc

    r9330 r9336  
    114114
    115115    // Check if it is a ceres file
    116     if (mcrun && mcrun->GetCamVersion()==UShort_t(-1))
     116    if (mcrun && mcrun->IsCeres())
    117117    {
    118118        *fLog << inf << "This is a ceres file... subtracting Baseline from ElectronicNoise [MPedestalCam]." << endl;
  • trunk/MagicSoft/Mars/msim/MSimMMCS.cc

    r9319 r9336  
    8484        return kFALSE;
    8585
    86     fPointingPos = (MPointingPos*)plist->FindObject("MPointingPos");
    87     if (!fPointingPos)
     86    fPointingTel = (MPointingPos*)plist->FindObject("MPointingPos");
     87    if (!fPointingTel)
    8888    {
    8989        *fLog << err << "MPointingPos not found... aborting." << endl;
     
    134134
    135135    //    fNumPheFromDNSB        MMcPedestalNSBAdd   // Number of phe/ns from diffuse NSB
     136
     137    // FIXME: Is there a way to write them as LAST entry in the file?
    136138    mrh->SetNumSimulatedShowers(fRunHeader->GetNumEvents());
    137139    mrh->SetImpactMax(fRunHeader->GetImpactMax());
     140    mrh->SetCorsikaVersion(TMath::Nint(fRunHeader->GetProgramVersion()*100));
    138141
    139142    // ----------------------------------------------------
     
    148151    const UInt_t id = fRunHeader->GetParticleID();
    149152
     153    // FIXME: Is there a way to write them as LAST entry in the file?
    150154    rh->SetRunInfo(1, fRunHeader->GetRunNumber(), 0);
    151155    rh->SetSourceInfo(MMcEvtBasic::GetParticleName(id));
     
    166170    fMcEvtBasic->SetImpact(fEvtHeader->GetImpact());
    167171
    168     fMcEvtBasic->SetTelescopeTheta(fPointingPos->GetZdRad());
    169     fMcEvtBasic->SetTelescopePhi(fPointingPos->GetAzRad());
     172    fMcEvtBasic->SetTelescopeTheta(fPointingTel->GetZdRad());
     173    fMcEvtBasic->SetTelescopePhi(fPointingTel->GetAzRad());
    170174
    171175    fMcEvtBasic->SetReadyToSave();
     
    173177    static_cast<MMcEvtBasic&>(*fMcEvt) = *fMcEvtBasic;
    174178
     179    // Convert from corsika franme to telescope frame, taking
     180    // the magnetic field into account: tel = corsika+offset
    175181    fMcEvt->SetTheta(fEvtHeader->GetZd());
    176     fMcEvt->SetPhi(fEvtHeader->GetAz());
     182    fMcEvt->SetPhi(fEvtHeader->GetAz()+fRunHeader->GetMagneticFieldAz());
    177183
    178184    fMcEvt->SetEvtNumber(fEvtHeader->GetEvtNumber());
  • trunk/MagicSoft/Mars/msim/MSimMMCS.h

    r9319 r9336  
    1818    MMcEvtBasic       *fMcEvtBasic;
    1919    MMcEvt            *fMcEvt;
    20     MPointingPos      *fPointingPos;
     20    MPointingPos      *fPointingTel;  //! telescope poiting position in local (telescope) coordinate system
    2121    MCorsikaEvtHeader *fEvtHeader;
    2222    MCorsikaRunHeader *fRunHeader;
  • trunk/MagicSoft/Mars/msim/MSimPointingPos.cc

    r9243 r9336  
    4141//  Output Containers:
    4242//   MPointingPos
     43//   PointingCorsika [MPointingPos]
    4344//
    4445//////////////////////////////////////////////////////////////////////////////
    4546#include "MSimPointingPos.h"
     47
     48#include <TRandom.h>
     49#include <TVector3.h>
    4650
    4751#include "MLog.h"
     
    6468//
    6569MSimPointingPos::MSimPointingPos(const char* name, const char *title)
    66     : fRunHeader(0), fEvtHeader(0), fPointing(0)
     70    : fRunHeader(0), fEvtHeader(0), fPointingCorsika(0), fPointingLocal(0),
     71    fOffTargetDistance(-1), fOffTargetPhi(-1)
     72
    6773{
    6874    fName  = name  ? name  : "MSimPointingPos";
     
    7783Int_t MSimPointingPos::PreProcess(MParList *pList)
    7884{
    79     fPointing = (MPointingPos*)pList->FindCreateObj("MPointingPos");
    80     if (!fPointing)
     85    fPointingCorsika = (MPointingPos*)pList->FindCreateObj("MPointingPos", "PointingCorsika");
     86    if (!fPointingCorsika)
     87        return kFALSE;
     88
     89    fPointingLocal = (MPointingPos*)pList->FindCreateObj("MPointingPos");
     90    if (!fPointingLocal)
    8191        return kFALSE;
    8292
     
    95105    }
    96106
     107    // FIXED offset
     108    // Diffuse?  ( FOV of camera folded with mirror diameter as Corsika input? )
     109    // Hour angle!
     110    // Angle to magnetic field!
     111
     112    if (IsOffTargetObservation())
     113    {
     114        *fLog << inf;
     115        *fLog << "Off target observations switched on with" << endl;
     116        *fLog <<"   a pointing distance of " << GetOffTargetDistance() << "deg ";
     117        if (fOffTargetPhi<0)
     118            *fLog << "randomly distributed in phi." << endl;
     119        else
     120            *fLog << "and phi=" << GetOffTargetPhi() << "deg." << endl;
     121    }
     122
    97123    return kTRUE;
    98124}
     125
     126/*
     127Bool_t MSimPointingPos::ReInit(MParList *pList)
     128{
     129    // FIXME: Check also the enlightened region on the ground!
     130    return kTRUE;
     131}
     132*/
    99133
    100134// --------------------------------------------------------------------------
     
    102136Int_t MSimPointingPos::Process()
    103137{
     138
    104139    // If a view cone is given use the fixed telescope orientation
    105140    const Bool_t fixed = fRunHeader->HasViewCone();
    106141
    107142    // Local sky coordinates (direction of telescope axis)
    108     const Double_t zd = fixed ? fRunHeader->GetZdMin() : fEvtHeader->GetZd()*TMath::RadToDeg();  // x==north
    109     const Double_t az = fixed ? fRunHeader->GetAzMin() : fEvtHeader->GetAz()*TMath::RadToDeg();  // y==west
     143    /*const*/ Double_t zd = fixed ? fRunHeader->GetZdMin() : fEvtHeader->GetZd()*TMath::RadToDeg();  // x==north
     144    /*const*/ Double_t az = fixed ? fRunHeader->GetAzMin() : fEvtHeader->GetAz()*TMath::RadToDeg();  // y==west
     145
     146    if (!fixed && IsOffTargetObservation())
     147    {
     148        const Double_t theta = zd*TMath::DegToRad();
     149        const Double_t phi   = az*TMath::DegToRad();
     150
     151        /*const*/ TVector3 source;
     152        source.SetMagThetaPhi(1, theta, phi);
     153
     154        /*const*/ TVector3 point;
     155        point.SetMagThetaPhi(1, theta+fOffTargetDistance, phi);
     156
     157        const Double_t delta = fOffTargetPhi>0 ? fOffTargetPhi :
     158            gRandom->Uniform(TMath::TwoPi());
     159
     160        point.Rotate(delta, source);
     161
     162        zd = point.Theta()*TMath::RadToDeg();
     163        az = point.Phi()*TMath::RadToDeg();
     164    }
    110165
    111166    // Setup the pointing position
    112     fPointing->SetLocalPosition(zd, az);
     167    fPointingCorsika->SetLocalPosition(zd, az);
     168    fPointingLocal->SetLocalPosition(zd, az+fRunHeader->GetMagneticFieldAz());
     169
     170    // Calculate incident angle between magnetic field direction
     171    // and pointing direction ( phi and theta? )
    113172
    114173    return kTRUE;
    115174}
    116175
    117 /*
    118176Int_t MSimPointingPos::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    119177{
    120178    Bool_t rc = kFALSE;
    121     if (IsEnvDefined(env, prefix, "FileName", print))
     179    if (IsEnvDefined(env, prefix, "OffTargetDistance", print))
    122180    {
    123181        rc = kTRUE;
    124         SetFileName(GetEnvValue(env, prefix, "FileName", fFileName));
     182        SetOffTargetDistance(GetEnvValue(env, prefix, "OffTargetDistance", GetOffTargetDistance()));
    125183    }
    126184
    127     if (IsEnvDefined(env, prefix, "UseTheta", print))
     185    if (IsEnvDefined(env, prefix, "OffTargetPhi", print))
    128186    {
    129187        rc = kTRUE;
    130         SetUseTheta(GetEnvValue(env, prefix, "UseTheta", fUseTheta));
     188        SetOffTargetPhi(GetEnvValue(env, prefix, "OffTargetPhi", GetOffTargetPhi()));
    131189    }
    132190
    133191    return rc;
    134192}
    135 */
     193
  • trunk/MagicSoft/Mars/msim/MSimPointingPos.h

    r9232 r9336  
    1414{
    1515private:
    16     MCorsikaRunHeader *fRunHeader;  //! Header storing event information
    17     MCorsikaEvtHeader *fEvtHeader;  //! Header storing event information
    18     MPointingPos      *fPointing;   //! Output storing telescope poiting position
     16    MCorsikaRunHeader *fRunHeader;         //! Header storing event information
     17    MCorsikaEvtHeader *fEvtHeader;         //! Header storing event information
     18    MPointingPos      *fPointingCorsika;   //! Output storing telescope poiting position in corsika coordinate system (modulo magnetig field declination)
     19    MPointingPos      *fPointingLocal;     //! Output storing telescope poiting position in local (telescope) coordinate system
     20
     21    Double_t fOffTargetDistance;  // [rad] Distance of the observed off-target position from the source
     22    Double_t fOffTargetPhi;       // [rad] Rotation angle of the off-target position (phi==0 means south, phi=90 west) [0;2pi], phi<0 means random
    1923
    2024    // MParContainer
    21     //Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     25    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    2226
    2327    // MTask
    24     Int_t PreProcess(MParList *pList);
    25     Int_t Process();
    26 
     28    Int_t  PreProcess(MParList *pList);
     29    //Bool_t ReInit(MParList *pList);
     30    Int_t  Process();
    2731
    2832public:
    2933    MSimPointingPos(const char *name=NULL, const char *title=NULL);
    3034
     35    // Getter
     36    Double_t GetOffTargetDistance() const { return fOffTargetDistance*TMath::RadToDeg(); }
     37    Double_t GetOffTargetPhi() const { return fOffTargetPhi*TMath::RadToDeg(); }
     38
     39    // Setter
     40    void SetOffTargetDistance(Double_t d=-1) { fOffTargetDistance = d*TMath::DegToRad(); }
     41    void SetOffTargetPhi(Double_t p=-1) { fOffTargetPhi = p*TMath::DegToRad(); }
     42
    3143    // MSimPointingPos
     44    Bool_t IsOffTargetObservation() const { return fOffTargetDistance>0; }
    3245
    3346    // TObject
  • trunk/MagicSoft/Mars/msimreflector/MSimReflector.cc

    r9328 r9336  
    147147    }
    148148
    149     fPointing = (MPointingPos*)pList->FindObject("MPointingPos");
     149    fPointing = (MPointingPos*)pList->FindObject("PointingCorsika", "MPointingPos");
    150150    if (!fPointing)
    151151    {
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.hxx

    r9312 r9336  
    161161  Float_t GetImpactMax() const            {return fImpactMax;}
    162162
     163  Bool_t IsCeres() const { return fCamVersion==UShort_t(-1); }
     164
    163165  void SetNumSimulatedShowers(UInt_t n) { fNumSimulatedShowers=n; }
    164166  void SetImpactMax(Float_t im) { fImpactMax=im; }
     167  void SetCorsikaVersion(UInt_t v) { fCorsikaVersion=v; }
    165168
    166169  ClassDef(MMcRunHeader, 7)     // storage container for general run info
Note: See TracChangeset for help on using the changeset viewer.