Changeset 1434 for trunk/MagicSoft/Mars
- Timestamp:
- 07/25/02 09:14:36 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1425 r1434 1 1 -*-*- END -*-*- 2 3 2002/07/23: Thomas Bretz 4 5 * mgui/MineSweeper.cc, mgui/MCamDisplay.cc: 6 - fixed a bug which could caused the destructor of the created canvas 7 not to be called if the object was deleted. 8 9 * mgui/MCamDisplay.h: 10 - some reordering 11 12 * mgui/MHexagon.cc: 13 - return the correct distance to primitive 14 - do a sanity check in DistancetoPrimitive 15 16 * mhist/HistLinkDef.h: 17 - added missing classes 18 19 20 21 2002/07/23: Wolfgang Wittek, Thomas Bretz 22 23 * manalysis/MHillas.cc, manalysis/MHillasSrc.cc: 24 - replaced algorithms by the ones from the corresponding TDAS note 25 - made results of calculations (hopefully) more accurate 26 - added some output warnings and sanity checks 27 - changed the default parameters in the Reset function 28 29 * manalysis/MHillasSrc.[h,cc]: 30 - added fCosDeltaAlpha 31 - made Calc returning a Bool_t 32 33 * manalysis/MHillasSrcCalc.cc: 34 - make use of the return value of MHillasSrc::Calc 35 36 2 37 3 38 2002/07/22: Abelardo Moralejo … … 8 43 * macros/MagicHillas.C: 9 44 -added example on how to use MCerPhotCalc2 45 46 10 47 11 48 2002/07/22: Thomas Bretz -
trunk/MagicSoft/Mars/NEWS
r1408 r1434 2 2 3 3 *** Version 0.8 4 5 - added all subdirectories as Include-Paths for ACLIC (s. rootlogon.C) 4 6 5 7 - changed trigrate.C: now it calculates the pure NSB triggers from … … 21 23 (MMultiDimDistCalc, multidimdist.C, MHMatrix) 22 24 23 - Changed the Alpha range according to TDAS 02-03 to [-90°,90°]24 25 25 - Added a camera display displaying the pixel numbers to the 26 26 event display gui. … … 34 34 - Added the number of used and core pixels after image cleaning 35 35 to MHillas 36 37 - Changed the algorithm used in MHillas according to TDAS 02-03 38 39 - Changed the Alpha range according to TDAS 02-03 to [-90°,90°] 40 41 - Changed the algorithm used in MHillasSrc according to TDAS 02-03 42 43 - Added fCosDeltaAlpha to MHillasSrc 36 44 37 45 - Fixed a bug in the table describing the Next Neighbours of the -
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r1394 r1434 19 19 ! Author(s): Harald Kornmayer 1/2001 20 20 ! Author(s): Rudolf Bock 10/2001 <mailto:Rudolf.Bock@cern.ch> 21 ! Author(s): Wolfgang Wittek 6/2002 <mailto:wittek@mppmu.mpg.de> 21 22 ! 22 23 ! Copyright: MAGIC Software Development, 2000-2002 … … 35 36 // Version 1: 36 37 // ---------- 37 // fLength major axis of ellipse 38 // fWidth minor axis 39 // fDelta angle of major axis wrt x-axis 40 // fSize total sum of pixels 41 // fMeanX x of center of ellipse 42 // fMeanY y of center of ellipse 38 // fLength [mm] major axis of ellipse 39 // fWidth [mm] minor axis 40 // fDelta [rad] angle of major axis with x-axis 41 // by definition the major axis is pointing into 42 // the hemisphere x>0, thus -pi/2 < delta < pi/2 43 // fSize [#CerPhot] total sum of pixels 44 // fMeanX [mm] x of center of ellipse 45 // fMeanY [mm] y of center of ellipse 43 46 // 44 47 // Version 2: … … 91 94 // -------------------------------------------------------------------------- 92 95 // 96 // Initializes the values with defaults. For the default values see the 97 // source code. 98 // 93 99 void MHillas::Reset() 94 100 { 95 fLength = 0;96 fWidth = 0;97 fDelta = 0;101 fLength = -1; 102 fWidth = -1; 103 fDelta = 0; 98 104 99 105 fSize = -1; … … 122 128 *fLog << " - Length [mm] = " << fLength << endl; 123 129 *fLog << " - Width [mm] = " << fWidth << endl; 130 *fLog << " - Delta [deg] = " << fDelta*kRad2Deg << endl; 131 *fLog << " - Size [1] = " << fSize << " #CherPhot" << endl; 124 132 *fLog << " - Meanx [mm] = " << fMeanX << endl; 125 133 *fLog << " - Meany [mm] = " << fMeanY << endl; 126 *fLog << " - Delta [deg] = " << fDelta*kRad2Deg << endl;127 134 *fLog << " - atg(y/x) [deg] = " << atg << endl; 128 *fLog << " - Size [1] = " << fSize << " #CherPhot" << endl;129 135 } 130 136 … … 207 213 // Calculate the image parameters from a Cherenkov photon event 208 214 // assuming Cher.photons/pixel and pixel coordinates are given 215 // In case you don't call Calc from within an eventloop make sure, that 216 // you call the Reset member function before. 209 217 // 210 218 Bool_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 211 219 { 212 // FIXME: MHillas::Calc is rather slow at the moment because it loops213 // unnecessarily over all pixels in all its loops (s.MImgCleanStd)214 // The speed could be improved very much by using Hash-Tables215 // (linked lists, see THashTable and THashList, too)216 //217 218 220 const UInt_t npixevt = evt.GetNumPixels(); 219 221 … … 222 224 // 223 225 if (npixevt <= 2) 226 { 227 *fLog << warn << "MHillas::Calc: Event has less than two pixels... skipped." << endl; 224 228 return kFALSE; 229 } 225 230 226 231 // 227 232 // calculate mean value of pixel coordinates and fSize 228 233 // ----------------------------------------------------- 234 // 235 // Because this are only simple sums of roughly 600 values 236 // with an accuracy less than three digits there should not 237 // be any need to use double precision (Double_t) for the 238 // calculation of fMeanX, fMeanY and fSize. 229 239 // 230 240 fMeanX = 0; … … 235 245 fNumCorePixels = 0; 236 246 237 //238 // FIXME! npix should be retrieved from MCerPhotEvt239 //240 247 for (UInt_t i=0; i<npixevt; i++) 241 248 { … … 247 254 const MGeomPix &gpix = geom[pix.GetPixId()]; 248 255 249 const float nphot = pix.GetNumPhotons(); 256 const Float_t nphot = pix.GetNumPhotons(); 257 258 if (nphot==0) 259 *fLog << warn << GetDescriptor() << ": Pixel #" << pix.GetPixId() << " has no photons." << endl; 250 260 251 261 fSize += nphot; // [counter] … … 260 270 261 271 // 262 // sanity check 263 // 264 if (fSize==0 || fNumUsedPixels<=2) 272 // sanity checks 273 // 274 if (fSize==0) 275 { 276 *fLog << warn << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl; 265 277 return kFALSE; 278 } 279 280 if (fNumUsedPixels<3) 281 { 282 *fLog << warn << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl; 283 return kFALSE; 284 } 266 285 267 286 fMeanX /= fSize; // [mm] … … 270 289 // 271 290 // calculate 2nd moments 272 // ------------------- 273 // 274 float corrxx=0; // [m^2] 275 float corrxy=0; // [m^2] 276 float corryy=0; // [m^2] 291 // --------------------- 292 // 293 // To make sure that the more complicated sum is evaluated as 294 // accurate as possible (because it is needed for more 295 // complicated calculations (see below) we calculate it using 296 // double prcision. 297 // 298 Double_t corrxx=0; // [m^2] 299 Double_t corrxy=0; // [m^2] 300 Double_t corryy=0; // [m^2] 277 301 278 302 for (UInt_t i=0; i<npixevt; i++) … … 284 308 285 309 const MGeomPix &gpix = geom[pix.GetPixId()]; 286 const float dx = gpix.GetX() - fMeanX; // [mm] 287 const float dy = gpix.GetY() - fMeanY; // [mm] 288 289 const float nphot = pix.GetNumPhotons(); // [#phot] 310 311 const Float_t dx = gpix.GetX() - fMeanX; // [mm] 312 const Float_t dy = gpix.GetY() - fMeanY; // [mm] 313 314 const Float_t nphot = pix.GetNumPhotons(); // [#phot] 290 315 291 316 corrxx += nphot * dx*dx; // [mm^2] … … 295 320 296 321 // 322 // If corrxy=0 (which should never happen, because fSize>0) we 323 // cannot calculate Length and Width. The calculation failed 324 // and returnes kFALSE 325 // 326 if (corrxy==0) 327 { 328 *fLog << warn << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl; 329 return kFALSE; 330 } 331 332 // 297 333 // calculate the basic Hillas parameters: orientation and size of axes 298 334 // ------------------------------------------------------------------- 299 335 // 300 const float d = (corryy - corrxx)/(corrxy*2); 301 302 fDelta = atan(d + sqrt(d*d + 1)); 303 304 fCosDelta = cos(fDelta); // need these in derived classes 305 fSinDelta = sin(fDelta); // like MHillasExt 306 307 float axis1 = ( fCosDelta*fSinDelta*corrxy*2 + fCosDelta*fCosDelta*corrxx + fSinDelta*fSinDelta*corryy) / fSize; // [mm^2] 308 float axis2 = (-fCosDelta*fSinDelta*corrxy*2 + fSinDelta*fSinDelta*corrxx + fCosDelta*fCosDelta*corryy) / fSize; // [mm^2] 309 336 // fDelta is the angle between the major axis of the ellipse and 337 // the x axis. It is independent of the position of the ellipse 338 // in the camera it has values between -pi/2 and pi/2 degrees 339 // 340 const Double_t d0 = corryy - corrxx; 341 const Double_t d1 = corrxy*2; 342 const Double_t d2 = d0 + sqrt(d0*d0 + d1*d1); 343 const Double_t tand = d2 / d1; 344 345 fDelta = atan(tand); 346 347 const Double_t s2 = tand*tand+1; 348 const Double_t s = sqrt(s2); 349 350 fCosDelta = 1.0/s; // need these in derived classes 351 fSinDelta = tand/s; // like MHillasExt 352 353 Double_t axis1 = (tand*tand*corryy + d2 + corrxx)/s2/fSize; 354 Double_t axis2 = (tand*tand*corrxx - d2 + corryy)/s2/fSize; 355 356 // 357 // fLength^2 is the second moment along the major axis of the ellipse 358 // fWidth^2 is the second moment along the minor axis of the ellipse 359 // 360 // From the algorithm we get: fWidth <= fLength is always true 361 // 310 362 // very small numbers can get negative by rounding 311 if (axis1 < 0) axis1=0; 312 if (axis2 < 0) axis2=0; 313 314 fLength = sqrt(axis1); // [mm] 315 fWidth = sqrt(axis2); // [mm] 363 // 364 fLength = axis1<0 ? 0 : sqrt(axis1); // [mm] 365 fWidth = axis2<0 ? 0 : sqrt(axis2); // [mm] 316 366 317 367 SetReadyToSave(); … … 322 372 // -------------------------------------------------------------------------- 323 373 // 374 /* 324 375 void MHillas::AsciiRead(ifstream &fin) 325 376 { … … 331 382 fin >> fMeanY; 332 383 } 333 384 */ 334 385 // -------------------------------------------------------------------------- 335 386 /* -
trunk/MagicSoft/Mars/manalysis/MHillas.h
r1394 r1434 15 15 private: 16 16 // for description see MHillas.cc 17 Float_t fLength;// [mm] major axis of ellipse18 Float_t fWidth;// [mm] minor axis of ellipse19 Float_t fDelta;// [rad] angle of major axis with x-axis20 Float_t fSize;// [#CerPhot] sum of content of all pixels (number of Cherenkov photons)21 Float_t fMeanX;// [mm] x-coordinate of center of ellipse22 Float_t fMeanY;// [mm] y-coordinate of center of ellipse17 Float_t fLength; // [mm] major axis of ellipse 18 Float_t fWidth; // [mm] minor axis of ellipse 19 Float_t fDelta; // [rad] angle of major axis with x-axis 20 Float_t fSize; // [#CerPhot] sum of content of all pixels (number of Cherenkov photons) 21 Float_t fMeanX; // [mm] x-coordinate of center of ellipse 22 Float_t fMeanY; // [mm] y-coordinate of center of ellipse 23 23 24 Float_t fSinDelta;//! [1] sin of Delta (to be used in derived classes)25 Float_t fCosDelta;//! [1] cos of Delta (to be used in derived classes)24 Float_t fSinDelta; //! [1] sin of Delta (to be used in derived classes) 25 Float_t fCosDelta; //! [1] cos of Delta (to be used in derived classes) 26 26 27 27 Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning 28 28 Short_t fNumCorePixels; // number of core pixels 29 29 30 TEllipse *fEllipse; //! Graphical Object to Display Ellipse30 TEllipse *fEllipse; //! Graphical Object to Display Ellipse 31 31 32 32 protected: … … 62 62 Int_t GetNumCorePixels() const { return fNumCorePixels; } 63 63 64 virtual void AsciiRead(ifstream &fin);64 //virtual void AsciiRead(ifstream &fin); 65 65 //virtual void AsciiWrite(ofstream &fout) const; 66 66 -
trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc
r1350 r1434 19 19 ! Author(s): Harald Kornmayer 1/2001 20 20 ! Author(s): Rudolf Bock 10/2001 <mailto:Rudolf.Bock@cern.ch> 21 ! Author(s): Wolfgang Wittek 06/2002 <mailto:wittek@mppmu.mpg.de> 21 22 ! 22 23 ! Copyright: MAGIC Software Development, 2000-2002 … … 32 33 // 33 34 // source-dependent image parameters 34 // fAlpha angle between major axis and line source-to-center 35 // fDist distance from source to center of ellipse 35 // 36 // Version 1: 37 // ---------- 38 // fAlpha angle between major axis and line source-to-center 39 // fDist distance from source to center of ellipse 40 // 41 // Version 2: 42 // ---------- 43 // fHeadTail 44 // 45 // Version 3: 46 // ---------- 47 // fCosDeltaLenth cosine of angle between d and a, where 48 // - d is the vector from the source position to the 49 // center of the ellipse 50 // - a is a vector along the main axis of the ellipse 36 51 // 37 52 ///////////////////////////////////////////////////////////////////////////// … … 57 72 } 58 73 74 void MHillasSrc::Reset() 75 { 76 fDist = -1; 77 fAlpha = 0; 78 fHeadTail = 0; 79 fCosDeltaAlpha = 0; 80 } 81 59 82 // -------------------------------------------------------------------------- 60 83 // 61 // calculation of source-dependent parameters 84 // Calculation of source-dependent parameters 85 // In case you don't call Calc from within an eventloop make sure, that 86 // you call the Reset member function before. 62 87 // 63 voidMHillasSrc::Calc(const MHillas *hillas)88 Bool_t MHillasSrc::Calc(const MHillas *hillas) 64 89 { 65 const Double_t mx = hillas->GetMeanX(); // [mm] 66 const Double_t my = hillas->GetMeanY(); // [mm] 90 fHillas = hillas; 67 91 68 const Double_t sx = mx - fSrcPos->GetX();// [mm]69 const Double_t sy = my - fSrcPos->GetY();// [mm]92 const Double_t mx = GetMeanX(); // [mm] 93 const Double_t my = GetMeanY(); // [mm] 70 94 71 const Double_t s d = sin(hillas->GetDelta()); // [1]72 const Double_t cd = cos(hillas->GetDelta()); // [1]95 const Double_t sx = mx - fSrcPos->GetX(); // [mm] 96 const Double_t sy = my - fSrcPos->GetY(); // [mm] 73 97 98 const Double_t sd = sin(GetDelta()); // [1] 99 const Double_t cd = cos(GetDelta()); // [1] 74 100 75 fHeadTail = cd*sx + sd*sy; // [mm] 76 fDist = sqrt(sx*sx + sy*sy); // [mm] 77 fAlpha = atan((cd*sy - sd*sx)/fHeadTail); // [rad] 78 fAlpha *= kRad2Deg; // [deg] 101 const Double_t tand = tan(GetDelta()); // [1] 79 102 80 fHillas = hillas; 103 fHeadTail = cd*sx + sd*sy; // [mm] 104 105 // 106 // Distance from source position to center of ellipse. 107 // If the distance is 0 distance, Alpha is not specified. 108 // The calculation has failed and returnes kFALSE. 109 // 110 Double_t dist = sqrt(sx*sx + sy*sy); // [mm] 111 112 if (dist==0) 113 { 114 *fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl; 115 return kFALSE; 116 } 117 118 fDist = dist; 119 // [mm] 120 // 121 // Calculate Alpha and Cosda = cos(d,a) 122 // The sign of Cosda will be used for quantities containing 123 // a head-tail information 124 // 125 const Double_t arg = (sy-tand*sx) / (fDist*sqrt(tand*tand+1)); 126 127 fAlpha = asin(arg)*kRad2Deg; // [deg] 128 fCosDeltaAlpha = fHeadTail/fDist; // [1] 81 129 82 130 SetReadyToSave(); 131 132 return kTRUE; 83 133 } 84 134 … … 87 137 *fLog << all; 88 138 *fLog << "Source dependant Image Parameters (" << GetName() << ")" << endl; 89 *fLog << " - Dist = " << fDist << " mm" << endl; 90 *fLog << " - Alpha = " << fAlpha << " deg" << endl; 91 *fLog << " - HeadTail = " << fHeadTail << " mm" << endl; 139 *fLog << " - Dist [mm] = " << fDist << endl; 140 *fLog << " - Alpha [deg] = " << fAlpha << endl; 141 *fLog << " - HeadTail [mm] = " << fHeadTail << endl; 142 *fLog << " - CosDeltaAlpha = " << fCosDeltaAlpha << endl; 92 143 } 93 144 … … 96 147 // overloaded MParContainer to read MHillasSrc from an ascii file 97 148 // 149 /* 98 150 void MHillasSrc::AsciiRead(ifstream &fin) 99 151 { … … 102 154 fin >> fHeadTail; 103 155 } 104 156 */ 105 157 // ----------------------------------------------------------------------- 106 158 // -
trunk/MagicSoft/Mars/manalysis/MHillasSrc.h
r1237 r1434 14 14 const MSrcPosCam *fSrcPos; //! Source position in the camere 15 15 16 Float_t fAlpha; // [deg] angle of major axis with vector to src 17 Float_t fDist; // [mm] distance from src to center of ellipse 18 Float_t fHeadTail; // [mm] 16 Float_t fAlpha; // [deg] angle of major axis with vector to src 17 Float_t fDist; // [mm] distance between src and center of ellipse 18 Float_t fHeadTail; // [mm] 19 Float_t fCosDeltaAlpha; // [1] cosine of angle between d and a 19 20 20 21 public: … … 24 25 const MSrcPosCam *GetSrcPos() const { return fSrcPos; } 25 26 26 Float_t GetLength() const { return fHillas->GetLength(); } 27 Float_t GetWidth() const { return fHillas->GetWidth(); } 28 Float_t GetDelta() const { return fHillas->GetDelta(); } 29 Float_t GetSize() const { return fHillas->GetSize(); } 30 Float_t GetMeanX() const { return fHillas->GetMeanX(); } 31 Float_t GetMeanY() const { return fHillas->GetMeanY(); } 32 Float_t GetAlpha() const { return fAlpha; } 33 Float_t GetDist() const { return fDist; } 34 Float_t GetHeadTail() const { return fHeadTail; } 27 void Reset(); 28 29 Float_t GetLength() const { return fHillas->GetLength(); } 30 Float_t GetWidth() const { return fHillas->GetWidth(); } 31 Float_t GetDelta() const { return fHillas->GetDelta(); } 32 Float_t GetSize() const { return fHillas->GetSize(); } 33 Float_t GetMeanX() const { return fHillas->GetMeanX(); } 34 Float_t GetMeanY() const { return fHillas->GetMeanY(); } 35 Float_t GetAlpha() const { return fAlpha; } 36 Float_t GetDist() const { return fDist; } 37 Float_t GetHeadTail() const { return fHeadTail; } 38 Float_t GetCosDeltaAlpha() const { return fCosDeltaAlpha; } 35 39 36 40 void Print(Option_t *opt=NULL) const; 37 41 38 virtual voidCalc(const MHillas *hillas);42 virtual Bool_t Calc(const MHillas *hillas); 39 43 40 virtual void AsciiRead(ifstream &fin);44 //virtual void AsciiRead(ifstream &fin); 41 45 //virtual void AsciiWrite(ofstream &fout) const; 42 46 43 ClassDef(MHillasSrc, 2) // Container to hold source position dependant parameters47 ClassDef(MHillasSrc, 3) // Container to hold source position dependant parameters 44 48 }; 45 49 46 /*47 Version 1: fAlpha, fDist48 Version 2: fAlpha, fDist, fSign49 */50 51 50 #endif -
trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
r1211 r1434 91 91 Bool_t MHillasSrcCalc::Process() 92 92 { 93 fHillasSrc->Calc(fHillas); 94 95 return kTRUE; 93 return fHillasSrc->Calc(fHillas) ? kTRUE : kCONTINUE; 96 94 } 97 95 -
trunk/MagicSoft/Mars/mgui/MineSweeper.h
r1423 r1434 41 41 enum 42 42 { 43 // kBlack = 1, // schwarz44 // kWhite = 10,45 43 kHidden = 50, 46 44 kIsVisible = BIT(15), 47 45 kHasBomb = BIT(16), 48 46 kHasFlag = BIT(17), 49 kUserBits = 0x0000ff00, // 14-23 are allowed 50 47 kUserBits = 0x0000ff00 // 14-23 are allowed 51 48 }; 52 49
Note:
See TracChangeset
for help on using the changeset viewer.