- Timestamp:
- 04/05/05 13:30:39 (20 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r6911 r6912 36 36 * mimage/MHillasCalc.[h,cc]: 37 37 - implemented missing ReadEnv - DON'T KNOW WHERE IT WAS! argh... 38 39 * mmc/MMcCorsikaRunHeader.h: 40 - added Getter for fWobbleMode 41 42 * mpointing/MSrcPosCalc.[h,cc]: 43 - added detection of MC files and setting of source position 44 according to wobble mode flag in MMcCorsikaRunHeader 45 - fixed a bug in ReadEnv (wrong return statement) found 46 by Abelardo. Correct handling of floating point numbers 47 in the source position (12.5) was affected. 38 48 39 49 -
trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc
r6903 r6912 66 66 #include "MSrcPosCalc.h" 67 67 68 #include <TVector2.h> 69 68 70 #include "MParList.h" 69 71 … … 75 77 #include "MPointingPos.h" 76 78 #include "MSrcPosCam.h" 79 #include "MRawRunHeader.h" 80 #include "MMcCorsikaRunHeader.h" 77 81 78 82 #include "MAstro.h" … … 138 142 // -------------------------------------------------------------------------- 139 143 // 140 // Search and if necessary create MSrcPosCam in the parameter list. Search MSourcePos. 141 // If not found, do nothing else, and skip the task. If MSrcPosCam did not exist 142 // before and has been created here, it will contain as source position the camera 143 // center (0,0). 144 // In the case that MSourcePos is found, go ahead in searching the rest of necessary 145 // containers. The source position will be calculated for each event in Process. 144 // Search and if necessary create MSrcPosCam in the parameter list. Search 145 // MSourcePos. If not found, do nothing else, and skip the task. If MSrcPosCam 146 // did not exist before and has been created here, it will contain as source 147 // position the camera center (0,0). 148 // In the case that MSourcePos is found, go ahead in searching the rest of 149 // necessary containers. The source position will be calculated for each 150 // event in Process. 146 151 // 147 152 Int_t MSrcPosCalc::PreProcess(MParList *pList) … … 160 165 if (!fSourcePos) 161 166 { 162 *fLog << warn << "MSourcePos [MPointPos] not found... The source position" << endl; 163 *fLog << warn << "set in MSrcPosCam (camera center if not set explicitely) will" << endl; 164 *fLog << warn << "be left unchanged, same for all events." << endl; 165 return kSKIP; 167 *fLog << warn; 168 *fLog << "MSourcePos [MPointPos] not found... The source position" << endl; 169 *fLog << "set in MSrcPosCam (camera center if not set explicitely)" << endl; 170 *fLog << "will be left unchanged if not wobble mode Monte Carlo." << endl; 171 return kTRUE; 166 172 } 167 173 } … … 199 205 //*fLog << "Pointing Position: " << GetRaDec(*fPointPos) << endl; 200 206 *fLog << "Source Position: " << GetRaDec(*fSourcePos) << endl; 207 208 return kTRUE; 209 } 210 211 // -------------------------------------------------------------------------- 212 // 213 // If fIsWobbleMode==kFALSE set source position to v and anto-source 214 // position to -v, if fIsWobbleMode==kTRUE vice versa. 215 // 216 void MSrcPosCalc::SetSrcPos(TVector2 v) const 217 { 218 if (fIsWobbleMode) 219 { 220 fSrcPosAnti->SetXY(v); 221 v *= -1; 222 fSrcPosCam->SetXY(v); 223 } 224 else 225 { 226 fSrcPosCam->SetXY(v); 227 v *= -1; 228 fSrcPosAnti->SetXY(v); 229 } 230 } 231 232 // -------------------------------------------------------------------------- 233 // 234 // Checking for file type. If the file type is Monte Carlo the 235 // source position is arbitrarily determined from the MC headers. 236 // 237 Bool_t MSrcPosCalc::ReInit(MParList *plist) 238 { 239 MRawRunHeader *run = (MRawRunHeader*)plist->FindObject("MRawRunHeader"); 240 if (!run) 241 { 242 *fLog << err << "MRawRunHeader not found... aborting." << endl; 243 return kFALSE; 244 } 245 246 fRunType = run->GetRunType(); 247 248 if (fRunType!=MRawRunHeader::kRTMonteCarlo) 249 return kTRUE; 250 251 MMcCorsikaRunHeader *h = (MMcCorsikaRunHeader*)plist->FindObject("MMcCorsikaRunHeader"); 252 if (!h) 253 { 254 *fLog << err << "MMcCorsikaRunHeader not found... aborting." << endl; 255 return kFALSE; 256 } 257 258 TVector2 v(0, 0); 259 if (h->GetWobbleMode()>0.5) 260 v.Set(120., 0.); 261 if (h->GetWobbleMode()<-0.5) 262 v.Set(-120., 0.); 263 264 265 SetSrcPos(v); 266 267 *fLog << inf; 268 *fLog << "Source Position set to x=" << fSrcPosCam->GetX() << "mm "; 269 *fLog << "y=" << fSrcPosCam->GetY() << "mm" << endl; 201 270 202 271 return kTRUE; … … 243 312 Int_t MSrcPosCalc::Process() 244 313 { 314 if (fRunType==MRawRunHeader::kRTMonteCarlo) 315 return kTRUE; 316 245 317 // *fLog << dbg << "Camera center : Zd=" << fPointPos->GetZd() << " Az=" << fPointPos->GetAz() << endl; 246 318 // *fLog << dbg << "Camera center : RA=" << fPointPos->GetRa() << " Dec=" << fPointPos->GetDec() << endl; … … 287 359 // Calculate source position in camera, and convert to mm: 288 360 TVector2 v = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000; 289 if (fIsWobbleMode) 290 { 291 fSrcPosAnti->SetXY(v); 292 v *= -1; 293 fSrcPosCam->SetXY(v); 294 } 295 else 296 { 297 fSrcPosCam->SetXY(v); 298 v *= -1; 299 fSrcPosAnti->SetXY(v); 300 } 361 SetSrcPos(v); 301 362 302 363 // v *= fGeom->GetConvMm2Deg(); … … 326 387 327 388 if (str.First(':')<0) 328 return atof(str); 389 { 390 ret = atof(str); 391 return kTRUE; 392 } 329 393 330 394 if (MAstro::Coordinate2Angle(str, ret)) -
trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h
r6874 r6912 32 32 MTime *fTime; 33 33 34 UShort_t fRunType; //! Run Type to decide where to get pointing position from 35 34 36 Bool_t fIsWobbleMode; 35 37 36 38 // MSrcPosCalc 39 void SetSrcPos(TVector2 v) const; 37 40 TVector2 CalcXYinCamera(const MVector3 &pos0, const MVector3 &pos) const; 38 41 TString GetRaDec(const MPointingPos &pos) const; … … 44 47 45 48 // MTask 46 Int_t PreProcess(MParList *pList); 47 Int_t Process(); 49 Bool_t ReInit(MParList *pList); 50 Int_t PreProcess(MParList *pList); 51 Int_t Process(); 48 52 49 53 public: -
trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.h
r3381 r6912 96 96 Float_t GetEUppLim() const { return fEUppLim; } 97 97 Float_t GetSlopeSpec() const { return fSlopeSpec; } 98 Float_t GetWobbleMode() const { return fWobbleMode; } 98 99 99 100 Int_t GetNumCT() const { return fNumCT; }
Note:
See TracChangeset
for help on using the changeset viewer.