Changeset 7177 for trunk/MagicSoft/Mars/mimage
- Timestamp:
- 07/08/05 11:49:41 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/mimage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mimage/MHillas.cc
r6873 r7177 159 159 *fLog << " - Width [mm] = " << fWidth << endl; 160 160 *fLog << " - Delta [deg] = " << fDelta*kRad2Deg << endl; 161 *fLog << " - Size [ 1] = " << fSize << " #CherPhot"<< endl;161 *fLog << " - Size [phe] = " << fSize << endl; 162 162 *fLog << " - Meanx [mm] = " << fMeanX << endl; 163 163 *fLog << " - Meany [mm] = " << fMeanY << endl; … … 182 182 *fLog << " - Width [deg] = " << fWidth *geom.GetConvMm2Deg() << endl; 183 183 *fLog << " - Delta [deg] = " << fDelta*kRad2Deg << endl; 184 *fLog << " - Size [ 1] = " << fSize << " #CherPhot"<< endl;184 *fLog << " - Size [phe] = " << fSize << endl; 185 185 *fLog << " - Meanx [deg] = " << fMeanX *geom.GetConvMm2Deg() << endl; 186 186 *fLog << " - Meany [deg] = " << fMeanY *geom.GetConvMm2Deg() << endl; … … 215 215 line.PaintLine(+w*fSinDelta+fMeanX, -w*fCosDelta+fMeanY, 216 216 -w*fSinDelta+fMeanX, +w*fCosDelta+fMeanY); 217 218 // Rough estimate for disp 219 const Double_t p = 362*(1-fWidth/fLength); 220 221 // Disp line 222 line.PaintLine( p*fCosDelta+20*fSinDelta+fMeanX, p*fSinDelta-20*fCosDelta+fMeanY, 223 p*fCosDelta-20*fSinDelta+fMeanX, p*fSinDelta+20*fCosDelta+fMeanY); 224 line.PaintLine(-p*fCosDelta+20*fSinDelta+fMeanX, -p*fSinDelta-20*fCosDelta+fMeanY, 225 -p*fCosDelta-20*fSinDelta+fMeanX, -p*fSinDelta+20*fCosDelta+fMeanY); 217 226 218 227 TEllipse e(fMeanX, fMeanY, fLength, fWidth, 0, 360, fDelta*kRad2Deg+180); … … 259 268 260 269 UInt_t numused = 0; 261 /* 262 MSignalPix *pix = 0; 263 264 TIter Next(evt); 265 while ((pix=(MSignalPix*)Next()))*/ 270 266 271 for (UInt_t i=0; i<numpix; i++) 267 272 { … … 273 278 continue; 274 279 275 const MGeomPix &gpix = geom[i /*pix->GetPixId()*/];280 const MGeomPix &gpix = geom[i]; 276 281 277 282 const Float_t nphot = pix.GetNumPhotons(); … … 312 317 Double_t corryy=0; // [m^2] 313 318 314 //Next.Reset();315 //while ((pix=(MSignalPix*)Next()))316 //{317 319 for (UInt_t i=0; i<numpix; i++) 318 320 { … … 324 326 continue; 325 327 326 const MGeomPix &gpix = geom[i /*pix->GetPixId()*/];328 const MGeomPix &gpix = geom[i]; 327 329 328 330 const Float_t dx = gpix.GetX() - fMeanX; // [mm] … … 337 339 338 340 // 339 // If corrxy=0 (which should happen not very often, because fSize>0)340 // we cannot calculate Length and Width.341 // In reallity it is almost impossible to have a distribution of342 // cerenkov photons in the used pixels which is exactly symmetric343 // along one of the axis.344 // It seems to be less than 0.1% of all events.345 //346 if (corrxy==0)347 return 4;348 349 //350 341 // calculate the basic Hillas parameters: orientation and size of axes 351 342 // ------------------------------------------------------------------- … … 360 351 const Double_t d0 = corryy - corrxx; 361 352 const Double_t d1 = corrxy*2; 362 const Double_t d2 = d0 + TMath::Sqrt(d0*d0 + d1*d1); 363 const Double_t tand = d2 / d1; 353 const Double_t d2 = TMath::Sqrt(d0*d0 + d1*d1) + d0; // [0 354 355 const Double_t tand = d2==0 ? 0 : d2 / d1; // Force 0 also if d1==0 364 356 const Double_t tand2 = tand*tand; 365 357 366 fDelta = TMath::ATan(tand); 367 368 const Double_t s2 = tand2+1; 369 const Double_t s = TMath::Sqrt(s2); 370 371 fCosDelta = 1.0/s; // need these in derived classes 372 fSinDelta = tand/s; // like MHillasExt 373 374 const Double_t axis1 = (tand2*corryy + d2 + corrxx)/s2/fSize; 375 const Double_t axis2 = (tand2*corrxx - d2 + corryy)/s2/fSize; 376 377 // 378 // fLength^2 is the second moment along the major axis of the ellipse 379 // fWidth^2 is the second moment along the minor axis of the ellipse 358 const Double_t s2 = tand2+1; 359 const Double_t s = TMath::Sqrt(s2); 360 361 // Set default for the case in which the image is symmetric on the y-axis 362 fDelta = TMath::Pi()/2; 363 fCosDelta = 0; 364 fSinDelta = 1; 365 366 Double_t axis1 = corryy; 367 Double_t axis2 = corrxx; 368 369 // This are all cases in which the image is not symmetric on the y-axis 370 if (d1!=0 || d2==0) 371 { 372 fDelta = TMath::ATan(tand); 373 374 fCosDelta = 1.0 /s; // need these in derived classes 375 fSinDelta = tand/s; // like MHillasExt 376 377 axis1 = (tand2*corryy + d2 + corrxx)/s2; 378 axis2 = (tand2*corrxx - d2 + corryy)/s2; 379 } 380 381 // 382 // fLength^2 is the second moment along the major axis of the distribution 383 // fWidth^2 is the second moment along the minor axis of the distribution 380 384 // 381 385 // From the algorithm we get: fWidth <= fLength is always true … … 383 387 // very small numbers can get negative by rounding 384 388 // 385 fLength = axis1<0 ? 0 : TMath::Sqrt(axis1 ); // [mm]386 fWidth = axis2<0 ? 0 : TMath::Sqrt(axis2 ); // [mm]389 fLength = axis1<0 ? 0 : TMath::Sqrt(axis1/fSize); // [mm] 390 fWidth = axis2<0 ? 0 : TMath::Sqrt(axis2/fSize); // [mm] 387 391 388 392 SetReadyToSave(); -
trunk/MagicSoft/Mars/mimage/MHillasCalc.cc
r6910 r7177 376 376 PrintSkipped(fErrors[2], "Calculated Size == 0 (after cleaning)"); 377 377 PrintSkipped(fErrors[3], "Number of used pixels < 3"); 378 PrintSkipped(fErrors[4], "CorrXY==0");378 //PrintSkipped(fErrors[4], "CorrXY==0"); 379 379 } 380 380 if (TestFlag(kCalcHillasSrc))
Note:
See TracChangeset
for help on using the changeset viewer.