Changeset 9336 for trunk/MagicSoft/Mars/msim/MSimPointingPos.cc
- Timestamp:
- 02/15/09 13:24:59 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msim/MSimPointingPos.cc
r9243 r9336 41 41 // Output Containers: 42 42 // MPointingPos 43 // PointingCorsika [MPointingPos] 43 44 // 44 45 ////////////////////////////////////////////////////////////////////////////// 45 46 #include "MSimPointingPos.h" 47 48 #include <TRandom.h> 49 #include <TVector3.h> 46 50 47 51 #include "MLog.h" … … 64 68 // 65 69 MSimPointingPos::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 67 73 { 68 74 fName = name ? name : "MSimPointingPos"; … … 77 83 Int_t MSimPointingPos::PreProcess(MParList *pList) 78 84 { 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) 81 91 return kFALSE; 82 92 … … 95 105 } 96 106 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 97 123 return kTRUE; 98 124 } 125 126 /* 127 Bool_t MSimPointingPos::ReInit(MParList *pList) 128 { 129 // FIXME: Check also the enlightened region on the ground! 130 return kTRUE; 131 } 132 */ 99 133 100 134 // -------------------------------------------------------------------------- … … 102 136 Int_t MSimPointingPos::Process() 103 137 { 138 104 139 // If a view cone is given use the fixed telescope orientation 105 140 const Bool_t fixed = fRunHeader->HasViewCone(); 106 141 107 142 // 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 } 110 165 111 166 // 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? ) 113 172 114 173 return kTRUE; 115 174 } 116 175 117 /*118 176 Int_t MSimPointingPos::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 119 177 { 120 178 Bool_t rc = kFALSE; 121 if (IsEnvDefined(env, prefix, " FileName", print))179 if (IsEnvDefined(env, prefix, "OffTargetDistance", print)) 122 180 { 123 181 rc = kTRUE; 124 Set FileName(GetEnvValue(env, prefix, "FileName", fFileName));182 SetOffTargetDistance(GetEnvValue(env, prefix, "OffTargetDistance", GetOffTargetDistance())); 125 183 } 126 184 127 if (IsEnvDefined(env, prefix, " UseTheta", print))185 if (IsEnvDefined(env, prefix, "OffTargetPhi", print)) 128 186 { 129 187 rc = kTRUE; 130 Set UseTheta(GetEnvValue(env, prefix, "UseTheta", fUseTheta));188 SetOffTargetPhi(GetEnvValue(env, prefix, "OffTargetPhi", GetOffTargetPhi())); 131 189 } 132 190 133 191 return rc; 134 192 } 135 */ 193
Note:
See TracChangeset
for help on using the changeset viewer.