Changeset 9336 for trunk/MagicSoft/Mars/msim
- Timestamp:
- 02/15/09 13:24:59 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/msim
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msim/MSimMMCS.cc
r9319 r9336 84 84 return kFALSE; 85 85 86 fPointing Pos= (MPointingPos*)plist->FindObject("MPointingPos");87 if (!fPointing Pos)86 fPointingTel = (MPointingPos*)plist->FindObject("MPointingPos"); 87 if (!fPointingTel) 88 88 { 89 89 *fLog << err << "MPointingPos not found... aborting." << endl; … … 134 134 135 135 // 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? 136 138 mrh->SetNumSimulatedShowers(fRunHeader->GetNumEvents()); 137 139 mrh->SetImpactMax(fRunHeader->GetImpactMax()); 140 mrh->SetCorsikaVersion(TMath::Nint(fRunHeader->GetProgramVersion()*100)); 138 141 139 142 // ---------------------------------------------------- … … 148 151 const UInt_t id = fRunHeader->GetParticleID(); 149 152 153 // FIXME: Is there a way to write them as LAST entry in the file? 150 154 rh->SetRunInfo(1, fRunHeader->GetRunNumber(), 0); 151 155 rh->SetSourceInfo(MMcEvtBasic::GetParticleName(id)); … … 166 170 fMcEvtBasic->SetImpact(fEvtHeader->GetImpact()); 167 171 168 fMcEvtBasic->SetTelescopeTheta(fPointing Pos->GetZdRad());169 fMcEvtBasic->SetTelescopePhi(fPointing Pos->GetAzRad());172 fMcEvtBasic->SetTelescopeTheta(fPointingTel->GetZdRad()); 173 fMcEvtBasic->SetTelescopePhi(fPointingTel->GetAzRad()); 170 174 171 175 fMcEvtBasic->SetReadyToSave(); … … 173 177 static_cast<MMcEvtBasic&>(*fMcEvt) = *fMcEvtBasic; 174 178 179 // Convert from corsika franme to telescope frame, taking 180 // the magnetic field into account: tel = corsika+offset 175 181 fMcEvt->SetTheta(fEvtHeader->GetZd()); 176 fMcEvt->SetPhi(fEvtHeader->GetAz() );182 fMcEvt->SetPhi(fEvtHeader->GetAz()+fRunHeader->GetMagneticFieldAz()); 177 183 178 184 fMcEvt->SetEvtNumber(fEvtHeader->GetEvtNumber()); -
trunk/MagicSoft/Mars/msim/MSimMMCS.h
r9319 r9336 18 18 MMcEvtBasic *fMcEvtBasic; 19 19 MMcEvt *fMcEvt; 20 MPointingPos *fPointing Pos;20 MPointingPos *fPointingTel; //! telescope poiting position in local (telescope) coordinate system 21 21 MCorsikaEvtHeader *fEvtHeader; 22 22 MCorsikaRunHeader *fRunHeader; -
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 -
trunk/MagicSoft/Mars/msim/MSimPointingPos.h
r9232 r9336 14 14 { 15 15 private: 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 19 23 20 24 // 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); 22 26 23 27 // 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(); 27 31 28 32 public: 29 33 MSimPointingPos(const char *name=NULL, const char *title=NULL); 30 34 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 31 43 // MSimPointingPos 44 Bool_t IsOffTargetObservation() const { return fOffTargetDistance>0; } 32 45 33 46 // TObject
Note:
See TracChangeset
for help on using the changeset viewer.