Changeset 9362 for trunk/MagicSoft/Mars/msim/MSimPointingPos.cc
- Timestamp:
- 02/22/09 23:36:01 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msim/MSimPointingPos.cc
r9354 r9362 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // 27 // MSimPointingPos 27 // MSimPointingPos 28 // 28 29 // 29 30 // This task is meant to simulate the pointing position (mirror orientation). … … 31 32 // on the user request (e.g. Wobble mode). 32 33 // 33 // WARNING: Currently the telescope orientation is just fixed to the 34 // direction in the run-header (if a view cone was given) or 35 // the direction in the evt-header (if no view cone given) 34 // 35 // If fOffTragetDistance==0 the telescope is oriented depending on the 36 // view cone option. If a view cone was given the orientation is fixed to 37 // the main direction around the view cone was produced. If no view 38 // cone was given the telescope is oriented parallel to the shower axis. 39 // 40 // If no view cone option was given and off-target observations are switched 41 // on by setting fOffTargetDistance!=0 the poitnting position is calculated: 42 // 43 // 1) fOffTargetDistance < 0: 44 // The pointing position is randomly distributed in a disk of radius 45 // -fOffTragetDistance. fOffTargetDistance is silently ignored. 46 // 47 // 2) fOffTargetDistance > 0: 48 // The pointing position is set to a position in the given distance 49 // away from the shower axis. If fOffTargetPhi>=0 it is fixed at 50 // this phi value. For phi<0 it is randomly distributed at distances 51 // fOffTargetDistance. (phi==0 is the direction of positive theta) 52 // 36 53 // 37 54 // Input Containers: … … 41 58 // Output Containers: 42 59 // MPointingPos 43 // PointingCorsika [MPointingPos]44 60 // 45 61 ////////////////////////////////////////////////////////////////////////////// … … 68 84 // 69 85 MSimPointingPos::MSimPointingPos(const char* name, const char *title) 70 : fRunHeader(0), fEvtHeader(0), fPointing Corsika(0), fPointingLocal(0),71 fOffTargetDistance( -1), fOffTargetPhi(-1)86 : fRunHeader(0), fEvtHeader(0), fPointing(0), 87 fOffTargetDistance(0), fOffTargetPhi(-1) 72 88 73 89 { … … 83 99 Int_t MSimPointingPos::PreProcess(MParList *pList) 84 100 { 85 // fPointingCorsika = (MPointingPos*)pList->FindCreateObj("MPointingPos", "PointingCorsika"); 86 // if (!fPointingCorsika) 87 // return kFALSE; 88 89 fPointingLocal = (MPointingPos*)pList->FindCreateObj("MPointingPos"); 90 if (!fPointingLocal) 101 fPointing = (MPointingPos*)pList->FindCreateObj("MPointingPos"); 102 if (!fPointing) 91 103 return kFALSE; 92 104 … … 105 117 } 106 118 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; 119 if (!IsOffTargetObservation()) 120 return kTRUE; 121 122 *fLog << inf; 123 *fLog << "Off target observations switched on with" << endl; 124 if (fOffTargetDistance>0) 125 { 116 126 *fLog <<" a pointing distance of " << GetOffTargetDistance() << "deg "; 117 127 if (fOffTargetPhi<0) … … 120 130 *fLog << "and phi=" << GetOffTargetPhi() << "deg." << endl; 121 131 } 132 else 133 *fLog << " a homogenous distribution up to a distance of " << -GetOffTargetDistance() << "deg " << endl; 122 134 123 135 return kTRUE; 124 136 } 125 137 126 /*127 138 Bool_t MSimPointingPos::ReInit(MParList *pList) 128 139 { 140 if (fRunHeader->HasViewCone() && IsOffTargetObservation()) 141 { 142 *fLog << warn; 143 *fLog << "WARNING - Combining the view cone option with off-target observations doesn't make sense." << endl; 144 *fLog << " Option for off-target observations will be ignored." << endl; 145 } 129 146 // FIXME: Check also the enlightened region on the ground! 130 147 return kTRUE; 131 148 } 132 */ 149 150 void MSimPointingPos::GetDelta(Double_t &dtheta, Double_t &dphi) const 151 { 152 if (fOffTargetDistance>0) 153 { 154 dtheta = fOffTargetDistance; 155 dphi = fOffTargetPhi>0 ? fOffTargetPhi : gRandom->Uniform(TMath::TwoPi()); 156 } 157 else 158 { 159 dtheta = TMath::Sqrt(gRandom->Uniform(fOffTargetDistance)); 160 dphi = gRandom->Uniform(TMath::TwoPi()); 161 } 162 } 133 163 134 164 // -------------------------------------------------------------------------- … … 136 166 Int_t MSimPointingPos::Process() 137 167 { 138 139 168 // If a view cone is given use the fixed telescope orientation 140 const Bool_t fixed= fRunHeader->HasViewCone();169 const Bool_t viewcone = fRunHeader->HasViewCone(); 141 170 142 171 // Local sky coordinates (direction of telescope axis) 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 { 172 Double_t zd = viewcone ? fRunHeader->GetZdMin() : fEvtHeader->GetZd()*TMath::RadToDeg(); // x==north 173 Double_t az = viewcone ? fRunHeader->GetAzMin() : fEvtHeader->GetAz()*TMath::RadToDeg(); // y==west 174 175 if (!viewcone) 176 { 177 Double_t dtheta, dphi; 178 GetDelta(dtheta, dphi); 179 148 180 const Double_t theta = zd*TMath::DegToRad(); 149 181 const Double_t phi = az*TMath::DegToRad(); 150 182 151 /*const*/ TVector3 source;152 s ource.SetMagThetaPhi(1, theta,phi);153 154 /*const*/ TVector3 point; 155 p oint.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 }183 TVector3 src, pnt; 184 src.SetMagThetaPhi(1, theta, phi); 185 pnt.SetMagThetaPhi(1, theta+dtheta, phi); 186 187 pnt.Rotate(dphi, src); 188 189 zd = pnt.Theta()*TMath::RadToDeg(); 190 az = pnt.Phi() *TMath::RadToDeg(); 191 } 192 193 // Transform the corsika coordinate system (north is magnetic north) 194 // into the telescopes local coordinate system. Note, that all vectors 195 // are already correctly oriented. 196 az += fRunHeader->GetMagneticFieldAz()*TMath::RadToDeg(); 165 197 166 198 // Setup the pointing position 167 // fPointingCorsika->SetLocalPosition(zd, az/*+fRunHeader->GetMagneticFieldAz()*TMath::RadToDeg()*/); 168 fPointingLocal->SetLocalPosition(zd, az+fRunHeader->GetMagneticFieldAz()*TMath::RadToDeg()); 199 fPointing->SetLocalPosition(zd, az); 169 200 170 201 // Calculate incident angle between magnetic field direction
Note:
See TracChangeset
for help on using the changeset viewer.