- Timestamp:
- 02/25/10 11:50:23 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MMoonPointing.cc
r9556 r9557 19 19 public: 20 20 MPositionOffsetCalc(Double_t offset) : 21 fCosOffset(offset <=0?0:TMath::Cos(offset*TMath::DegToRad())),22 fSinOffset(offset <=0?0:TMath::Sin(offset*TMath::DegToRad())),21 fCosOffset(offset==0 ? 0 : TMath::Cos(offset*TMath::DegToRad())), 22 fSinOffset(offset==0 ? 0 : TMath::Sin(offset*TMath::DegToRad())), 23 23 fCosAngle(0), fSinAngle(0) 24 24 { … … 26 26 27 27 MPositionOffsetCalc(Double_t offset, Double_t angle) : 28 fCosOffset(offset <=0?0:TMath::Cos(offset*TMath::DegToRad())),29 fSinOffset(offset <=0?0:TMath::Sin(offset*TMath::DegToRad())),28 fCosOffset(offset==0 ? 0 : TMath::Cos(offset*TMath::DegToRad())), 29 fSinOffset(offset==0 ? 0 : TMath::Sin(offset*TMath::DegToRad())), 30 30 fCosAngle(TMath::Cos(angle*TMath::DegToRad())), 31 31 fSinAngle(TMath::Sin(angle*TMath::DegToRad())) … … 34 34 35 35 MPositionOffsetCalc(Double_t offset, Double_t cos, Double_t sin) : 36 fCosOffset(offset <=0?0:TMath::Cos(offset*TMath::DegToRad())),37 fSinOffset(offset <=0?0:TMath::Sin(offset*TMath::DegToRad())),36 fCosOffset(offset==0 ? 0 : TMath::Cos(offset*TMath::DegToRad())), 37 fSinOffset(offset==0 ? 0 : TMath::Sin(offset*TMath::DegToRad())), 38 38 fCosAngle(cos), fSinAngle(sin) 39 39 { … … 45 45 ZdAz Calc(const ZdAz &pos, Double_t *sn=0, Double_t *cs=0) const 46 46 { 47 // This is to avoid unnecessary calculations 48 // in case the offset is zero 47 49 if (fCosOffset==0 && fSinOffset==0) 48 50 { 49 51 if (sn) 50 *sn = fSinAngle;52 *sn = -fCosAngle; 51 53 if (cs) 52 *cs = fCosAngle;54 *cs = fSinAngle; 53 55 return pos; 54 56 } … … 119 121 Bool_t MMoonPointing::CalcPosition(const ZdAz &moon, ZdAz &srcpos, ZdAz &pointpos) const 120 122 { 121 // Avoid unnecessary calculations122 if (fOffsetShadow==0)123 {124 pointpos = srcpos = moon;125 return kTRUE;126 }127 128 123 const Double_t fcos = const_cast<TGraph2D&>(fCos).Interpolate(moon.Az(), moon.Zd()); 129 124 const Double_t fsin = const_cast<TGraph2D&>(fSin).Interpolate(moon.Az(), moon.Zd()); … … 134 129 return kFALSE; 135 130 136 // Calculate Moon Shadow Position and apply a small numerical improvement131 // Apply a small numerical improvement 137 132 Double_t sn=fsin/norm; 138 133 Double_t cs=fcos/norm; 139 134 135 // Calculate moon shadow position 140 136 const MPositionOffsetCalc calc1(fOffsetShadow, fcos, fsin); 141 137 srcpos = calc1.Calc(moon, &sn, &cs); 142 138 if (srcpos.Zd()==0) 143 139 return kFALSE; 144 145 // Avoid unnecessary calculations146 if (fOffsetWobble==0)147 {148 pointpos = srcpos;149 return kTRUE;150 }151 140 152 141 // Calaculate Telescope pointing position:
Note:
See TracChangeset
for help on using the changeset viewer.