Changeset 702 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 03/27/01 11:34:04 (24 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r701 r702 20 20 ClassImp(MHillas) 21 21 22 MHillas::MHillas(const char *name, const char *title) : fEllipse(NULL) 22 MHillas::MHillas(const char *name, const char *title) : 23 fAlpha(0), fTheta(0), fWidth(0), fLength(0), fSize(0), fDist(0), fEllipse(NULL) 23 24 { 24 25 *fName = name ? name : "MHillas"; … … 36 37 { 37 38 *fLog << "Hillas Parameter:" << endl; 38 *fLog << " - Alpha = " << f Alpha<< endl;39 *fLog << " - Alpha = " << fabs(fAlpha) << endl; 39 40 *fLog << " - Width = " << fWidth << endl; 40 41 *fLog << " - Length = " << fLength << endl; 42 *fLog << " - Size = " << fSize << endl; 41 43 *fLog << " - Dist = " << fDist << endl; 44 } 45 46 void MHillas::Paint(Option_t *) 47 { 48 if (!fEllipse) 49 return; 50 51 fEllipse->Paint(); 42 52 } 43 53 … … 60 70 fEllipse->SetLineWidth(2); 61 71 fEllipse->Draw(); 72 73 /* 74 This is from TH1 75 TString opt = option; 76 opt.ToLower(); 77 if (gPad && !opt.Contains("same")) { 78 //the following statement is necessary in case one attempts to draw 79 //a temporary histogram already in the current pad 80 if (TestBit(kCanDelete)) gPad->GetListOfPrimitives()->Remove(this); 81 gPad->Clear(); 82 } 83 AppendPad(opt.Data()); 84 */ 62 85 } 63 86 … … 138 161 139 162 // 140 // resolve four-fold ambiguity of solution163 // calculate the length of the two axis 141 164 // 142 165 float axis1 = 2.0*c*s*sigmaxy + c*c*sigmaxx + s*s*sigmayy; // [mm^2] … … 148 171 // 149 172 // check for numerical negatives 173 // (very small number can get negative by chance) 150 174 // 151 175 if (axis1 < 0) axis1=0; … … 153 177 154 178 // 155 // check the rotation of the axis (maybe turn by 90ø) 156 // 157 const int rotation = axis1<axis2; 158 159 fLength = rotation ? sqrt(axis2) : sqrt(axis1); // [mm] 160 fWidth = rotation ? sqrt(axis1) : sqrt(axis2); // [mm] 161 162 fAlpha = rotation ? 163 fabs(atan((-xmean*c - ymean*s)/(c*ymean - s*xmean))) : 164 fabs(atan(( ymean*c - xmean*s)/(c*xmean + s*ymean))) ; 165 166 // [deg] 167 168 fAlpha *= kRad2Deg; // [deg] 169 170 fDist = sqrt(xmean*xmean + ymean*ymean); // [mm] 171 172 fTheta = atan(ymean/xmean); // [rad] 173 if (xmean<0) fTheta += kPI; // [rad] 174 } 179 // calculate the main Hillas parameters 180 // 181 // fLength, fWidth describes the two axis of the ellipse 182 // fAlpha is the angle between the length-axis and the center 183 // of the camera 184 // fDist is the distance between the center of the camera and the 185 // denter of the ellipse 186 // 187 const int rotation = axis1<axis2; 188 189 fLength = rotation ? sqrt(axis2) : sqrt(axis1); // [mm] 190 fWidth = rotation ? sqrt(axis1) : sqrt(axis2); // [mm] 191 192 const float a = c*xmean + s*ymean; 193 const float b = c*ymean - s*xmean; 194 195 fAlpha = rotation ? atan(a/b) : atan(-b/a); // [rad] 196 fAlpha *= kRad2Deg; // [deg] 197 198 fDist = sqrt(xmean*xmean + ymean*ymean); // [mm] 199 200 fTheta = atan(ymean/xmean); // [rad] 201 if (xmean<0) fTheta += kPI; // [rad] 202 } -
trunk/MagicSoft/Mars/manalysis/MHillas.h
r698 r702 31 31 void Print(Option_t *opt=NULL); 32 32 void Draw(Option_t *opt=NULL); 33 void Paint(Option_t *opt=NULL); 33 34 34 35 void Clear(Option_t *opt=NULL); … … 38 39 Float_t GetLength() const { return fLength; } 39 40 Float_t GetDist() const { return fDist; } 41 Float_t GetSize() const { return fSize; } 42 Float_t GetTheta() const { return fTheta; } 40 43 41 44 ClassDef(MHillas, 1) // Storage Container for Hillas Parameter
Note:
See TracChangeset
for help on using the changeset viewer.