Changeset 7179 for trunk/MagicSoft/Mars/mpointing
- Timestamp:
- 07/11/05 10:34:49 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc
r7028 r7179 19 19 ! Author(s): Abelardo Moralejo 1/2005 <mailto:moralejo@pd.infn.it> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 421 ! Copyright: MAGIC Software Development, 2000-2005 22 22 ! 23 23 ! … … 28 28 // MSrcPosCalc 29 29 // 30 // Calculate the current source position in the camera from the (possibly already 31 // corrected, by starguider) J2000 sky coordinates of the camera center (contained 32 // in MPointingPos), and the source J2000 sky coordinates contained in MSourcePos 33 // (of type MPointingPos as well). If no MSourcePos is found in the parameter list, 34 // source position is assumed to be the same for all events, that specified in 35 // MSrcPosCam (if it already existed in the parameter list), or (0,0), the center 36 // of the camera, if no MSrcPosCam was present in the parameter list. In both cases, 37 // no calculation is necessary and then the PreProcess returns kSKIP so that the task 38 // is removed from the task list. 39 // 40 // The conversion factor between the camera plain (mm) and the 41 // sky (deg) is taken from MGeomCam. The time is taken from MTime, and the coordinates 42 // of the observatory from MObservatory. 43 // 30 // Calculate the current source position in the camera from the (possibly 31 // already corrected, by starguider) J2000 sky coordinates of the camera 32 // center (contained in MPointingPos), and the source J2000 sky 33 // coordinates contained in MSourcePos (of type MPointingPos as well). If 34 // no MSourcePos is found in the parameter list, source position is 35 // assumed to be the same for all events, that specified in MSrcPosCam 36 // (if it already existed in the parameter list), or (0,0), the center of 37 // the camera, if no MSrcPosCam was present in the parameter list. In both 38 // cases, no calculation is necessary and then the PreProcess returns 39 // kSKIP so that the task is removed from the task list. 40 // 41 // The conversion factor between the camera plain (mm) and the sky (deg) 42 // is taken from MGeomCam. The time is taken from MTime, and the 43 // coordinates of the observatory from MObservatory. 44 // 44 45 // Input Container: 45 46 // MPointingPos … … 53 54 // 54 55 // To be done: 55 // - wobble mode missing /// NOTE, A. Moralejo: I see no need for special code56 //57 56 // - a switch between using sky-coordinates and time or local-coordinates 58 57 // from MPointingPos for determine the rotation angle … … 98 97 fName = name ? name : "MSrcPosCalc"; 99 98 fTitle = title ? title : "Calculates the source position in the camera"; 99 100 AddToBranchList("MTime.*"); 101 AddToBranchList("MPointingPos.*"); 100 102 } 101 103 … … 191 193 //*fLog << "Pointing Position: " << GetRaDec(*fPointPos) << endl; 192 194 *fLog << "Source Position: " << GetRaDec(*fSourcePos) << endl; 195 196 // For the case ReInit is never called we try: 197 fObservatory = (MObservatory*)pList->FindObject("MObservatory"); 198 fTime = (MTime*) pList->FindObject("MTime"); 199 fRunType = MRawRunHeader::kRTNone; 193 200 194 201 return kTRUE; … … 321 328 Int_t MSrcPosCalc::Process() 322 329 { 323 if (fRunType==MRawRunHeader::kRTMonteCarlo || !fSourcePos )330 if (fRunType==MRawRunHeader::kRTMonteCarlo || !fSourcePos || !fTime || !fObservatory) 324 331 return kTRUE; 325 332 326 // *fLog << dbg << "Camera center : Zd=" << fPointPos->GetZd() << " Az=" << fPointPos->GetAz() << endl; 327 // *fLog << dbg << "Camera center : RA=" << fPointPos->GetRa() << " Dec=" << fPointPos->GetDec() << endl; 328 // *fLog << dbg << "MJD: " << fTime->GetMjd() << ", time [ms]: " << fTime->GetTime() << endl; 329 330 MVector3 pos, pos0; // pos: source position; pos0: camera center 331 332 if (fSourcePos) 333 { 334 // Set Sky coordinates of source, taken from container "MSourcePos" of type MPointingPos. The sky 335 // coordinates must be J2000, as the sky coordinates of the camera center that we get from the container 336 // "MPointingPos" filled by the Drive. 337 338 pos.SetRaDec(fSourcePos->GetRaRad(), fSourcePos->GetDecRad()); 339 340 // *fLog << dbg << "Sky position of source: Ra=" << fSourcePos->GetRa() << 341 // " Dec=" << fSourcePos->GetDec() << endl; 342 } 343 344 // Convert sky coordinates of source to local coordinates. Warning! These are not the "true" local 345 // coordinates, since this transformation ignores precession and nutation effects. 346 const MAstroSky2Local conv(*fTime, *fObservatory); 347 pos *= conv; 348 349 350 // Set sky coordinates of camera center in pos0, and then convert to local. Same comment as above. These 351 // coordinates differ from the true local coordinates of the camera center that one could get from 352 // "MPointingPos", calculated by the Drive: the reason is that the Drive takes into account precession 353 // and nutation corrections, while MAstroSky2Local (as of Jan 27 2005 at least) does not. Since we just 354 // want to get the source position on the camera from the local coordinates of the center and the source, 355 // it does not matter that the coordinates contained in pos and pos0 ignore precession and nutation... 356 // since the shift would be the same in both cases. What would be wrong is to set in pos0 directly the 357 // local coordinates found in MPointingPos! 358 359 pos0.SetRaDec(fPointPos->GetRaRad(), fPointPos->GetDecRad()); 360 pos0 *= conv; 361 362 // *fLog << dbg << "From MAstroSky2Local, without precession and nutation corrections:" << endl; 363 // *fLog << dbg << "- Camera center (2) from RA,dec and time : Zd=" << pos0.Theta()*180./TMath::Pi() 364 // << " Az=" << pos0.Phi()*180./TMath::Pi() << endl; 365 // *fLog << dbg << "- Local position of source: Zd=" << pos.Theta()*TMath::RadToDeg() << " Az=" << pos.Phi()*TMath::RadToDeg() << endl; 366 367 368 // Calculate source position in camera, and convert to mm: 369 TVector2 v = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000; 370 SetSrcPos(v); 371 372 // v *= fGeom->GetConvMm2Deg(); 373 // *fLog << dbg << "X=" << v.X() << " deg, Y=" << v.Y() << " deg" << endl; 374 // *fLog << *fTime << endl; 375 // *fLog << endl; 376 377 return kTRUE; 333 // Set Sky coordinates of source, taken from container "MSourcePos" 334 // of type MPointingPos. The sky coordinates must be J2000, as the 335 // sky coordinates of the camera center that we get from the container 336 // "MPointingPos" filled by the Drive. 337 MVector3 pos; // pos: source position 338 pos.SetRaDec(fSourcePos->GetRaRad(), fSourcePos->GetDecRad()); 339 340 // Convert sky coordinates of source to local coordinates. Warning! These are not the "true" local 341 // coordinates, since this transformation ignores precession and nutation effects. 342 const MAstroSky2Local conv(*fTime, *fObservatory); 343 pos *= conv; 344 345 // Set sky coordinates of camera center in pos0, and then convert to 346 // local. Same comment as above. These coordinates differ from the true 347 // local coordinates of the camera center that one could get from 348 // "MPointingPos", calculated by the Drive: the reason is that the Drive 349 // takes into account precession and nutation corrections, while 350 // MAstroSky2Local (as of Jan 27 2005 at least) does not. Since we just 351 // want to get the source position on the camera from the local 352 // coordinates of the center and the source, it does not matter that 353 // the coordinates contained in pos and pos0 ignore precession and 354 // nutation... since the shift would be the same in both cases. What 355 // would be wrong is to set in pos0 directly the local coordinates 356 // found in MPointingPos! 357 MVector3 pos0; // pos0: camera center 358 pos0.SetRaDec(fPointPos->GetRaRad(), fPointPos->GetDecRad()); 359 pos0 *= conv; 360 361 // Calculate source position in camera, and convert to mm: 362 TVector2 v = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000; 363 SetSrcPos(v); 364 365 return kTRUE; 378 366 } 379 367
Note:
See TracChangeset
for help on using the changeset viewer.