Changeset 18280 for trunk/Mars/msim


Ignore:
Timestamp:
08/18/15 10:16:43 (9 years ago)
Author:
ftemme
Message:
Reintegrating MarsWobble branch into trunk
Location:
trunk/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars

  • trunk/Mars/msim/MSimPointingPos.cc

    r17846 r18280  
    3939//
    4040// If no view cone option was given and off-target observations are switched
    41 // on by setting fOffTargetDistance!=0 the poitnting position is calculated:
     41// on by setting fOffTargetDistance!=0 the pointing position is calculated:
    4242//
    4343//  1) fOffTargetDistance < 0:
     
    5151//     fOffTargetDistance. (phi==0 is the direction of positive theta)
    5252//
     53// The original zenith and azimuth coordinates of the shower axis are stored in
     54// the MSimSourcePos container.
     55//
     56// If the view cone option was given and off-target observations are switched on
     57// the orientation is fixed to the main direction around the view cone was
     58// produced.
     59// In addition a 'quasi'-simulated source position is calculated,
     60// depending on fOffTargetDistance and fOffTargetPhi (see 1) and 2) above).
     61// The corresponding zenith and azimuth coordinates are stored in the
     62// MSimSourcePos container. This is of course not a physical source position,
     63// but it can be used to determine the performance of wobble analysis on
     64// background events (which are homogenous distributed).
     65//
     66//
    5367//
    5468//  Input Containers:
     
    5872//  Output Containers:
    5973//   MPointingPos
     74//   MSimSourcePos
    6075//
    6176//////////////////////////////////////////////////////////////////////////////
     
    8499//
    85100MSimPointingPos::MSimPointingPos(const char* name, const char *title)
    86     : fRunHeader(0), fEvtHeader(0), fPointing(0),
     101    : fRunHeader(0), fEvtHeader(0), fPointing(0), fSimSourcePosition(0),
    87102    fOffTargetDistance(0), fOffTargetPhi(-1)
    88103
     
    140155    fPointing = (MPointingPos*)pList->FindCreateObj("MPointingPos");
    141156    if (!fPointing)
     157        return kFALSE;
     158
     159    fSimSourcePosition = (MPointingPos*)pList->FindCreateObj("MPointingPos","MSimSourcePos");
     160    if (!fSimSourcePosition)
    142161        return kFALSE;
    143162
     
    180199    {
    181200        *fLog << warn;
    182         *fLog << "WARNING - Combining the view cone option with off-target observations doesn't make sense." << endl;
    183         *fLog << "          Option for off-target observations will be ignored." << endl;
     201        *fLog << "WARNING - Combining the view cone option with off-target pointing can lead to not homogenous events." << endl;
     202        *fLog << "          A simulated source position according to the off-target parameters will be created instead." << endl;
    184203    }
    185204    // FIXME: Check also the enlightened region on the ground!
     
    209228
    210229    // Local sky coordinates (direction of telescope axis)
    211     Double_t zd = viewcone ? fRunHeader->GetZdMin() : fEvtHeader->GetZd()*TMath::RadToDeg();  // x==north
    212     Double_t az = viewcone ? fRunHeader->GetAzMin() : fEvtHeader->GetAz()*TMath::RadToDeg();  // y==west
    213 
    214     if (!viewcone)
    215     {
    216         Double_t dtheta, dphi;
    217         GetDelta(dtheta, dphi);
    218 
    219         const Double_t theta = zd*TMath::DegToRad();
    220         const Double_t phi   = az*TMath::DegToRad();
    221 
    222         TVector3 src, pnt;
    223         src.SetMagThetaPhi(1, theta,        phi);
    224         pnt.SetMagThetaPhi(1, theta+dtheta, phi);
    225 
    226         pnt.Rotate(dphi, src);
    227 
    228         zd = pnt.Theta()*TMath::RadToDeg();
    229         az = pnt.Phi()  *TMath::RadToDeg();
    230     }
     230    Double_t zdCorsika = viewcone ? fRunHeader->GetZdMin() : fEvtHeader->GetZd()*TMath::RadToDeg();  // x==north
     231    Double_t azCorsika = viewcone ? fRunHeader->GetAzMin() : fEvtHeader->GetAz()*TMath::RadToDeg();  // y==west
     232
     233    // Calculate off target position in local sky coordinates
     234    Double_t dtheta, dphi;
     235    GetDelta(dtheta, dphi);
     236
     237    const Double_t theta = zdCorsika*TMath::DegToRad();
     238    const Double_t phi   = azCorsika*TMath::DegToRad();
     239
     240    TVector3 originalVector, wobbleVector;
     241    originalVector.SetMagThetaPhi(1, theta,        phi);
     242    wobbleVector.SetMagThetaPhi(1, theta+dtheta, phi);
     243
     244    wobbleVector.Rotate(dphi, originalVector);
     245
     246    Double_t zdWobble, azWobble;
     247    zdWobble = wobbleVector.Theta()*TMath::RadToDeg();
     248    azWobble = wobbleVector.Phi()  *TMath::RadToDeg();
    231249
    232250    // Transform the corsika coordinate system (north is magnetic north)
    233251    // into the telescopes local coordinate system. Note, that all vectors
    234252    // are already correctly oriented.
    235     az += fRunHeader->GetMagneticFieldAz()*TMath::RadToDeg();
    236 
    237     // Setup the pointing position
    238     fPointing->SetLocalPosition(zd, az);
    239 
    240     // Calculate incident angle between magnetic field direction
    241     // and pointing direction ( phi and theta? )
     253    azCorsika += fRunHeader->GetMagneticFieldAz()*TMath::RadToDeg();
     254    azWobble += fRunHeader->GetMagneticFieldAz()*TMath::RadToDeg();
     255
     256    // Setup the pointing and the simulated source position
     257    if (!viewcone)
     258    {
     259        fPointing->SetLocalPosition(zdWobble, azWobble);
     260        fSimSourcePosition->SetLocalPosition(zdCorsika, azCorsika);
     261    }
     262    else
     263    {
     264        fPointing->SetLocalPosition(zdCorsika, azCorsika);
     265        fSimSourcePosition->SetLocalPosition(zdWobble, azWobble);
     266    }
    242267
    243268    return kTRUE;
  • trunk/Mars/msim/MSimPointingPos.h

    r9367 r18280  
    1616    MCorsikaRunHeader *fRunHeader;  //! Header storing event information
    1717    MCorsikaEvtHeader *fEvtHeader;  //! Header storing event information
    18     MPointingPos      *fPointing;   //! Output storing telescope poiting position in local (telescope) coordinate system
     18    MPointingPos      *fPointing;   //! Output storing telescope pointing position in local (telescope) coordinate system
     19    MPointingPos      *fSimSourcePosition;   //! Output storing simulated source pointing position in local (telescope) coordinate system
    1920
    2021    Double_t fOffTargetDistance;    // [rad] Distance of the observed off-target position from the source
Note: See TracChangeset for help on using the changeset viewer.