Changeset 1203 for trunk/MagicSoft
- Timestamp:
- 01/21/02 20:52:12 (23 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 10 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1192 r1203 1 1 -*-*- END -*-*- 2 3 2002/01/19: Thomas Bretz 4 5 * mbase/MParContainer.cc: 6 - generalized virtual function AsciiWrite 7 8 * changed to fit new MHillas inhertance model: 9 - manalysis/MHillas.[h,cc] 10 - manalysis/MHillasCalc.[h,cc] 11 - mhist/MHHillas.[h,cc] 12 - mhist/MHStarMap.[h,cc] 13 14 * added to fit new MHillas inhertance model: 15 - manalysis/MSrcPosCam.[h,cc] 16 - manalysis/MHillasSrc.[h,cc] 17 - manalysis/MHillasSrcCalc.[h,cc] 18 - manalysis/MHillasExt.[h,cc] 19 - mhist/MHHillasSrc.[h,cc] 20 21 * manalysis/MCerPhotEvt.[cc,h]: 22 - introduced weighting with pixel size in GetNumPhotonsMin 23 - introduced weighting with pixel size in GetNumPhotonsMax 24 25 * mgui/MCamDisplay.cc: 26 - weight the displayed color with the pixel size 27 28 29 2 30 2002/01/18: Thomas Bretz 3 31 -
trunk/MagicSoft/Mars/NEWS
r1190 r1203 3 3 *** Version 0.7 4 4 5 - Ascii Output can now also be used for parameter containers which 6 doesn't overload MParCointainer::AsciiWrite 7 8 - replaced old MHillas by a new structure which allows you to extend 9 the parameters stored in MHillas very easily. 10 11 - Added classes to handle source dependancy of image parameters. 12 5 13 - Added container (MBinning) to have a standard input for the binning 6 14 in different histograms (eg. the Energy bins should be the same in -
trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
r1151 r1203 21 21 #pragma link C++ class MMcPedestalNSBAdd+; 22 22 23 #pragma link C++ class MSrcPosCam+; 23 24 #pragma link C++ class MHillas+; 25 #pragma link C++ class MHillasSrc+; 26 #pragma link C++ class MHillasSrcCalc+; 27 #pragma link C++ class MHillasExt+; 24 28 #pragma link C++ class MHillasCalc+; 25 29 -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r1081 r1203 32 32 33 33 #include "MLog.h" 34 35 #include "MGeomCam.h" 36 #include "MGeomPix.h" 37 34 38 #include "MHexagon.h" 35 39 … … 148 152 // -------------------------------------------------------------------------- 149 153 // 150 // get the minimum number of photons of all valid pixels in the list 151 // 152 Float_t MCerPhotEvt::GetNumPhotonsMin() const 154 // get the minimum number of photons of all valid pixels in the list 155 // If you specify a geometry the number of photons is weighted with the 156 // area of the pixel 157 // 158 Float_t MCerPhotEvt::GetNumPhotonsMin(const MGeomCam *geom) const 153 159 { 154 160 if (fNumPixels <= 0) 155 161 return -5.; 156 162 163 const Float_t A0 = geom ? (*geom)[0].GetA() : 0; 164 157 165 Float_t minval = (*this)[0].GetNumPhotons(); 158 166 159 167 for (UInt_t i=1; i<fNumPixels; i++) 160 168 { 161 const Float_t testval = (*this)[i].GetNumPhotons(); 169 const MCerPhotPix &pix = (*this)[i]; 170 171 Float_t testval = pix.GetNumPhotons(); 172 173 if (geom) 174 testval *= A0/(*geom)[pix.GetPixId()].GetA(); 162 175 163 176 if (testval < minval) … … 171 184 // 172 185 // get the maximum number of photons of all valid pixels in the list 173 // 174 Float_t MCerPhotEvt::GetNumPhotonsMax() const 186 // If you specify a geometry the number of photons is weighted with the 187 // area of the pixel 188 // 189 Float_t MCerPhotEvt::GetNumPhotonsMax(const MGeomCam *geom) const 175 190 { 176 191 if (fNumPixels <= 0) 177 192 return 50.; 178 193 194 const Float_t A0 = geom ? (*geom)[0].GetA() : 0; 179 195 Float_t maxval = (*this)[0].GetNumPhotons(); 180 196 181 197 for (UInt_t i=1; i<fNumPixels; i++) 182 198 { 183 const Float_t testval = (*this)[i].GetNumPhotons(); 199 const MCerPhotPix &pix = (*this)[i]; 200 201 Float_t testval = pix.GetNumPhotons(); 202 203 if (geom) 204 testval *= A0/(*geom)[pix.GetPixId()].GetA(); 184 205 185 206 if (testval > maxval) -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r1083 r1203 9 9 #endif 10 10 11 class MGeomCam; 11 12 class MCerPhotPix; 12 13 … … 34 35 Bool_t IsPixelCore (Int_t id) const; 35 36 36 Float_t GetNumPhotonsMin( ) const;37 Float_t GetNumPhotonsMax( ) const;37 Float_t GetNumPhotonsMin(const MGeomCam *geom=NULL) const; 38 Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const; 38 39 39 40 MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); } -
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r1081 r1203 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de> 19 ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de) 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de> 19 ! Author(s): Harald Kornmayer 1/2001 20 ! Author(s): Rudolf Bock 10/2001 <mailto:Rudolf.Bock@cern.ch> 20 21 ! 21 22 ! Copyright: MAGIC Software Development, 2000-2001 … … 25 26 26 27 ///////////////////////////////////////////////////////////////////////////// 27 // // 28 // MHillas // 29 // // 30 // Storage Container for the Hillas parameter // 31 // // 32 // FIXME: - Here everybody should find an explanation of the parameters // 33 // - using boooleans for fIsPixelUsed, fIsPixelCore, ... is rather // 34 // slow because you have to loop over all pixels in any loop. // 35 // There could be a huge speed improvement using Hash Tables // 36 // (linked lists, see THashTable and THashList, too) // 37 // // 28 // 29 // MHillas 30 // 31 // Storage Container for image parameters 32 // 33 // basic image parameters 34 // fLength major axis of ellipse 35 // fWidth minor axis 36 // fDelta angle of major axis wrt x-axis 37 // fSize total sum of pixels 38 // fMeanx x of center of ellipse 39 // fMeany y of center of ellipse 40 // 38 41 ///////////////////////////////////////////////////////////////////////////// 39 42 #include "MHillas.h" 40 43 41 #include <math.h>42 44 #include <fstream.h> 43 45 … … 51 53 52 54 #include "MLog.h" 55 #include "MLogManip.h" 53 56 54 57 ClassImp(MHillas); … … 61 64 { 62 65 fName = name ? name : "MHillas"; 63 fTitle = title ? title : "Storage container for Hillas parameterof one event";66 fTitle = title ? title : "Storage container for image parameters of one event"; 64 67 65 68 Reset(); 66 69 // FIXME: (intelligent) initialization of values missing 70 71 fEllipse = new TEllipse; 67 72 } 68 73 … … 76 81 } 77 82 83 // -------------------------------------------------------------------------- 84 // 78 85 void MHillas::Reset() 79 86 { 80 fAlpha = 0; 81 fTheta = 0; 87 fLength = 0; 82 88 fWidth = 0; 83 f Length= 0;89 fDelta = 0; 84 90 fSize = 0; 85 fDist = 0; 91 fMeanx = 0; 92 fMeany = 0; 86 93 87 94 Clear(); … … 94 101 void MHillas::Print(Option_t *) const 95 102 { 96 *fLog << "Hillas Parameter: " << GetDescriptor() << endl; 97 *fLog << " - Alpha = " << fabs(fAlpha) << " deg" << endl; 98 *fLog << " - Width = " << fWidth << " mm" << endl; 99 *fLog << " - Length = " << fLength << " mm" << endl; 100 *fLog << " - Size = " << fSize << " #CerPhot" << endl; 101 *fLog << " - Dist = " << fDist << " mm" << endl; 103 Double_t atg = atan2(fMeany, fMeanx)*kRad2Deg; 104 105 if (atg<0) 106 atg += 180; 107 108 *fLog << all; 109 *fLog << "Basic Image Parameters (" << GetName() << ")" << endl; 110 *fLog << " - Length [mm] = " << fLength << endl; 111 *fLog << " - Width [mm] = " << fWidth << endl; 112 *fLog << " - Meanx [mm] = " << fMeanx << endl; 113 *fLog << " - Meany [mm] = " << fMeany << endl; 114 *fLog << " - Delta [deg] = " << fDelta*kRad2Deg << endl; 115 *fLog << " - atg(y/x) [deg] = " << atg << endl; 116 *fLog << " - Size [1] = " << fSize << " #CherPhot" << endl; 102 117 } 103 118 104 119 /* 105 // ----------------------------------------------------------- ---------------120 // ----------------------------------------------------------- 106 121 // 107 122 // call the Paint function of the Ellipse if a TEllipse exists 108 123 // 109 124 void MHillas::Paint(Option_t *) 125 { 126 fEllipse->SetLineWidth(2); 127 fEllipse->PaintEllipse(fMeanx, fMeany, fLength, fWidth, 128 0, 360, fDelta*kRad2Deg+180); 129 } 130 */ 131 132 // -------------------------------------------------------------------------- 133 // 134 // Instead of adding MHillas itself to the Pad 135 // (s. AppendPad in TObject) we create an ellipse, 136 // which is added to the Pad by its Draw function 137 // You can remove it by deleting the Ellipse Object 138 // (s. Clear() ) 139 // 140 void MHillas::Draw(Option_t *opt) 141 { 142 143 Clear(); 144 145 fEllipse = new TEllipse(fMeanx, fMeany, fLength, fWidth, 146 0, 360, fDelta*kRad2Deg+180); 147 148 fEllipse->SetLineWidth(2); 149 fEllipse->Draw(); 150 151 /* 152 fEllipse->SetPhimin(); 153 fEllipse->SetPhimax(); 154 fEllipse->SetR1(fLength); 155 fEllipse->SetR2(fWidth); 156 fEllipse->SetTheta(fDelta*kRad2Deg+180); 157 fEllipse->SetX1(fMeanx); 158 fEllipse->SetY1(fMeany); 159 160 fEllipse->SetLineWidth(2); 161 fEllipse->PaintEllipse(fMeanx, fMeany, fLength, fWidth, 162 0, 360, fDelta*kRad2Deg+180); 163 164 AppendPad(opt); 165 166 // This is from TH1 167 TString opt = option; 168 opt.ToLower(); 169 if (gPad && !opt.Contains("same")) { 170 //the following statement is necessary in case one attempts to draw 171 //a temporary histogram already in the current pad 172 if (TestBit(kCanDelete)) gPad->GetListOfPrimitives()->Remove(this); 173 gPad->Clear(); 174 } 175 */ 176 } 177 178 // -------------------------------------------------------------------------- 179 // 180 // If a TEllipse object exists it is deleted 181 // 182 void MHillas::Clear(Option_t *) 110 183 { 111 184 if (!fEllipse) 112 185 return; 113 186 114 fEllipse->Paint();115 }116 */117 118 // --------------------------------------------------------------------------119 //120 // Instead of adding MHillas itself to the Pad121 // (s. AppendPad in TObject) we create an ellipse,122 // which is added to the Pad by it's Draw function123 // You can remove it by deleting the Ellipse Object124 // (s. Clear() )125 //126 void MHillas::Draw(Option_t *opt)127 {128 Clear();129 130 fEllipse = new TEllipse(cos(fTheta)*fDist, sin(fTheta)*fDist,131 fLength, fWidth,132 0, 360, fTheta*kRad2Deg+fAlpha-180);133 134 fEllipse->SetLineWidth(2);135 fEllipse->Draw();136 //AppendPad(opt);137 138 /*139 This is from TH1140 TString opt = option;141 opt.ToLower();142 if (gPad && !opt.Contains("same")) {143 //the following statement is necessary in case one attempts to draw144 //a temporary histogram already in the current pad145 if (TestBit(kCanDelete)) gPad->GetListOfPrimitives()->Remove(this);146 gPad->Clear();147 }148 AppendPad(opt.Data());149 */150 }151 152 // --------------------------------------------------------------------------153 //154 // If a TEllipse object exists it is deleted155 //156 void MHillas::Clear(Option_t *)157 {158 if (!fEllipse)159 return;160 161 187 delete fEllipse; 162 188 … … 164 190 } 165 191 166 // -------------------------------------------------------------------------- 167 // 168 // Calculate the Hillas parameters from a cerenkov photon event 169 // (The calcualtion is some kind of two dimentional statistics) 170 // 171 // FIXME: MHillas::Calc is rather slow at the moment because it loops 172 // unnecessarily over all pixels in all its loops (s.MImgCleanStd) 173 // The speed could be improved very much by using Hash-Tables 174 // (linked lists, see THashTable and THashList, too) 192 193 // -------------------------------------------------------------------------- 194 // 195 // Calculate the image parameters from a Cherenkov photon event 196 // assuming Cher.photons/pixel and pixel coordinates are given 175 197 // 176 198 Bool_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 177 199 { 178 const UInt_t nevt = evt.GetNumPixels(); 200 // FIXME: MHillas::Calc is rather slow at the moment because it loops 201 // unnecessarily over all pixels in all its loops (s.MImgCleanStd) 202 // The speed could be improved very much by using Hash-Tables 203 // (linked lists, see THashTable and THashList, too) 204 // 205 206 const UInt_t npixevt = evt.GetNumPixels(); 179 207 180 208 // 181 209 // sanity check 182 210 // 183 if (n evt <= 2)211 if (npixevt <= 2) 184 212 return kFALSE; 185 213 186 214 // 187 // calculate mean valu of pixels188 // 189 float xmean =0;190 f loat ymean =0;191 192 fSize = 0;215 // calculate mean value of pixel coordinates and fSize 216 // ----------------------------------------------------- 217 // 218 fMeanx = 0; 219 fMeany = 0; 220 fSize = 0; 193 221 194 222 // … … 196 224 // 197 225 UShort_t npix=0; 198 for (UInt_t i=0; i<n evt; i++)226 for (UInt_t i=0; i<npixevt; i++) 199 227 { 200 228 const MCerPhotPix &pix = evt[i]; … … 207 235 const float nphot = pix.GetNumPhotons(); 208 236 209 fSize += nphot;210 xmean += nphot * gpix.GetX();// [mm]211 ymean += nphot * gpix.GetY();// [mm]237 fSize += nphot; // [counter] 238 fMeanx += nphot * gpix.GetX(); // [mm] 239 fMeany += nphot * gpix.GetY(); // [mm] 212 240 213 241 npix++; … … 220 248 return kFALSE; 221 249 222 xmean /= fSize; // [mm] 223 ymean /= fSize; // [mm] 224 225 // 226 // calculate sdev 227 // 228 float sigmaxx=0; 229 float sigmaxy=0; 230 float sigmayy=0; 231 232 for (UInt_t i=0; i<nevt; i++) 250 fMeanx /= fSize; // [mm] 251 fMeany /= fSize; // [mm] 252 253 // 254 // calculate 2nd moments 255 // ------------------- 256 // 257 float corrxx=0; // [m^2] 258 float corrxy=0; // [m^2] 259 float corryy=0; // [m^2] 260 261 for (UInt_t i=0; i<npixevt; i++) 233 262 { 234 263 const MCerPhotPix &pix = evt[i]; … … 238 267 239 268 const MGeomPix &gpix = geom[pix.GetPixId()]; 240 241 const float dx = gpix.GetX() - xmean; 242 const float dy = gpix.GetY() - ymean; 243 244 const float nphot = pix.GetNumPhotons(); 245 246 sigmaxx += nphot * dx*dx; // [mm^2] 247 sigmaxy += nphot * dx*dy; // [mm^2] 248 sigmayy += nphot * dy*dy; // [mm^2] 269 const float dx = gpix.GetX() - fMeanx; // [mm] 270 const float dy = gpix.GetY() - fMeany; // [mm] 271 272 const float nphot = pix.GetNumPhotons(); // [#phot] 273 274 corrxx += nphot * dx*dx; // [mm^2] 275 corrxy += nphot * dx*dy; // [mm^2] 276 corryy += nphot * dy*dy; // [mm^2] 249 277 } 250 278 251 279 // 252 // check for orientation 253 // 254 const float theta = atan(sigmaxy/(sigmaxx-sigmayy)*2)/2; 255 256 float c = cos(theta); // [1] 257 float s = sin(theta); // [1] 258 259 // 260 // calculate the length of the two axis 261 // 262 float axis1 = 2.0*c*s*sigmaxy + c*c*sigmaxx + s*s*sigmayy; // [mm^2] 263 float axis2 = -2.0*c*s*sigmaxy + s*s*sigmaxx + c*c*sigmayy; // [mm^2] 264 265 axis1 /= fSize; // [mm^2] 266 axis2 /= fSize; // [mm^2] 267 268 // 269 // check for numerical negatives 270 // (very small number can get negative by chance) 271 // 280 // calculate the basic Hillas parameters: orientation and size of axes 281 // ------------------------------------------------------------------- 282 // 283 const float d = corryy - corrxx; 284 285 fDelta = atan2(d + sqrt(d*d + corrxy*corrxy*4), corrxy*2); 286 287 fCosDelta = cos(fDelta); // need these in derived classes 288 fSinDelta = sin(fDelta); // like MHillasExt 289 290 float axis1 = ( fCosDelta*fSinDelta*corrxy*2 + fCosDelta*fCosDelta*corrxx + fSinDelta*fSinDelta*corryy) / fSize; // [mm^2] 291 float axis2 = (-fCosDelta*fSinDelta*corrxy*2 + fSinDelta*fSinDelta*corrxx + fCosDelta*fCosDelta*corryy) / fSize; // [mm^2] 292 293 // very small numbers can get negative by rounding 272 294 if (axis1 < 0) axis1=0; 273 if (axis2 < 0) axis2=0; 274 275 // 276 // calculate the main Hillas parameters 277 // 278 // fLength, fWidth describes the two axis of the ellipse 279 // fAlpha is the angle between the length-axis and the center 280 // of the camera 281 // fDist is the distance between the center of the camera and the 282 // denter of the ellipse 283 // 284 const int rotation = axis1<axis2; 285 286 fLength = rotation ? sqrt(axis2) : sqrt(axis1); // [mm] 287 fWidth = rotation ? sqrt(axis1) : sqrt(axis2); // [mm] 288 289 const float a = c*xmean + s*ymean; 290 const float b = c*ymean - s*xmean; 291 292 fAlpha = rotation ? atan(a/b) : atan(-b/a); // [rad] 293 fAlpha *= kRad2Deg; // [deg] 294 295 fDist = sqrt(xmean*xmean + ymean*ymean); // [mm] 296 297 fTheta = atan(ymean/xmean); // [rad] 298 if (xmean<0) fTheta += kPI; // [rad] 295 if (axis2 < 0) axis2=0; 296 297 fLength = sqrt(axis1); // [mm] 298 fWidth = sqrt(axis2); // [mm] 299 299 300 300 SetReadyToSave(); … … 303 303 } 304 304 305 // -------------------------------------------------------------------------- 306 // 305 307 void MHillas::AsciiRead(ifstream &fin) 306 308 { 307 fin >> fAlpha; 308 fin >> fTheta; 309 fin >> fLength; 309 310 fin >> fWidth; 310 fin >> f Length;311 fin >> fDelta; 311 312 fin >> fSize; 312 fin >> fDist; 313 } 314 313 fin >> fMeanx; 314 fin >> fMeany; 315 } 316 317 // -------------------------------------------------------------------------- 318 // 315 319 void MHillas::AsciiWrite(ofstream &fout) const 316 320 { 317 fout << fAlpha << " ";318 fout << fTheta << " ";319 fout << fWidth << " ";320 321 fout << fLength << " "; 321 fout << fSize << " "; 322 fout << fDist << endl; 323 } 322 fout << fWidth << " "; 323 fout << fDelta << " "; 324 fout << fSize << " "; 325 fout << fMeanx << " "; 326 fout << fMeany; 327 } -
trunk/MagicSoft/Mars/manalysis/MHillas.h
r1018 r1203 14 14 { 15 15 private: 16 Float_t fAlpha; // [deg] Angle between the length axis of the ellipse and the camera center 17 Float_t fTheta; // [rad] Angle between the x axis and the center of the ellipse 18 Float_t fWidth; // [mm] Width of the ellipse 19 Float_t fLength; // [mm] Length of the ellipse 20 Float_t fSize; // [#CerPhot] Size of the ellipse 21 Float_t fDist; // [mm] Distance of the ellipse COM from the camera center 16 // for description see MHillas.cc 17 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 22 23 23 TEllipse *fEllipse; //! Graphical Object to Display Ellipse 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 27 TEllipse *fEllipse; //! Graphical Object to Display Ellipse 28 29 protected: 30 // 31 // This is only for calculations in derived classes because 32 // we don't want to read/write this data members 33 // 34 Float_t GetCosDelta() const { return fCosDelta; } 35 Float_t GetSinDelta() const { return fSinDelta; } 24 36 25 37 public: … … 29 41 void Reset(); 30 42 31 Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);43 virtual Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix); 32 44 33 v oid Print(Option_t *opt=NULL) const;34 v oid Draw(Option_t *opt=NULL);35 //v oid Paint(Option_t *opt=NULL);45 virtual void Print(Option_t *opt=NULL) const; 46 virtual void Draw(Option_t *opt=NULL); 47 //virtual void Paint(Option_t *); 36 48 37 v oid Clear(Option_t *opt=NULL);49 virtual void Clear(Option_t *opt=NULL); 38 50 39 Float_t Get Alpha() const { return fAlpha; }51 Float_t GetLength() const { return fLength; } 40 52 Float_t GetWidth() const { return fWidth; } 41 Float_t GetLength() const { return fLength; } 42 Float_t GetDist() const { return fDist; } 53 Float_t GetDelta() const { return fDelta; } 43 54 Float_t GetSize() const { return fSize; } 44 Float_t GetTheta() const { return fTheta; } 55 Float_t GetMeanX() const { return fMeanx; } 56 Float_t GetMeanY() const { return fMeany; } 45 57 46 v oid AsciiRead(ifstream &fin);47 v oid AsciiWrite(ofstream &fout) const;58 virtual void AsciiRead(ifstream &fin); 59 virtual void AsciiWrite(ofstream &fout) const; 48 60 49 61 ClassDef(MHillas, 1) // Storage Container for Hillas Parameter … … 51 63 52 64 #endif 53 -
trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc
r1081 r1203 54 54 // Default constructor. 55 55 // 56 MHillasCalc::MHillasCalc(const char * name, const char *title)56 MHillasCalc::MHillasCalc(const char *hil, const char *name, const char *title) 57 57 { 58 58 fName = name ? name : "MHillasCalc"; 59 59 fTitle = title ? title : "Task to calculate Hillas parameters"; 60 61 fHilName = hil; 60 62 } 61 63 … … 82 84 } 83 85 84 fHillas = (MHillas*)pList->FindCreateObj( "MHillas");86 fHillas = (MHillas*)pList->FindCreateObj(fHilName); 85 87 if (!fHillas) 86 88 return kFALSE; -
trunk/MagicSoft/Mars/manalysis/MHillasCalc.h
r1014 r1203 24 24 MHillas *fHillas; // ouput container to store result 25 25 26 TString fHilName; 26 27 public: 27 MHillasCalc(const char * name=NULL, const char *title=NULL);28 MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL); 28 29 29 30 Bool_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
r1081 r1203 194 194 // 195 195 // Look for the boundary pixels around the core pixels 196 // if a pixel has more than 2.5 (clean level 2 ) sigma, and196 // if a pixel has more than 2.5 (clean level 2.5) sigma, and 197 197 // a core neigbor it is declared as used. 198 198 // -
trunk/MagicSoft/Mars/manalysis/Makefile
r1151 r1203 34 34 MMcPedestalNSBAdd.cc \ 35 35 MImgCleanStd.cc \ 36 MSrcPosCam.cc \ 36 37 MHillas.cc \ 38 MHillasExt.cc \ 37 39 MHillasCalc.cc \ 40 MHillasSrc.cc \ 41 MHillasSrcCalc.cc \ 38 42 MCerPhotCalc.cc \ 39 43 MCerPhotEvt.cc \ -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1080 r1203 37 37 #include "MParContainer.h" 38 38 39 #include <fstream.h> // ofstream, AsciiWrite 40 39 41 #include <TClass.h> // IsA 40 42 #include <TROOT.h> // TROOT::Identlevel 43 #include <TMethodCall.h> // TMethodCall, AsciiWrite 44 #include <TDataMember.h> // TDataMember, AsciiWrite 41 45 #include <TVirtualPad.h> // gPad 42 46 … … 211 215 // 212 216 // If you want to use Ascii-Input/-Output (eg. MWriteAsciiFile) of a 213 // container, overload this function. 217 // container, you may overload this function. If you don't overload it 218 // the data member of a class are written to the file in the order of 219 // appearance in the class header (be more specfic: root dictionary) 220 // Only data members which are of integer (Bool_t, Int_t, ...) or 221 // floating point (Float_t, Double_t, ...) type are written. 214 222 // 215 223 void MParContainer::AsciiWrite(ofstream &fout) const 216 224 { 217 *fLog << warn << "To use the the ascii output of " << GetName(); 218 *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl; 219 } 225 // *fLog << warn << "To use the the ascii output of " << GetName(); 226 // *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl; 227 228 TDataMember *data = NULL; 229 230 TIter Next(IsA()->GetListOfDataMembers()); 231 while ((data=(TDataMember*)Next())) 232 { 233 if (!data->IsPersistent()) 234 continue; 235 236 /*const*/ TMethodCall *call = data->GetterMethod(); //FIXME: Root 237 if (!call) 238 continue; 239 240 switch (call->ReturnType()) 241 { 242 case TMethodCall::kLong: 243 Long_t l; 244 call->Execute((void*)this, l); // FIXME: const, root 245 fout << l << " "; 246 continue; 247 248 case TMethodCall::kDouble: 249 Double_t d; 250 call->Execute((void*)this, d); // FIXME: const, root 251 fout << d << " "; 252 continue; 253 254 case TMethodCall::kOther: 255 /* someone may want to enhance this? */ 256 continue; 257 } 258 } 259 } -
trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc
r1172 r1203 114 114 if (fRun->Process()) 115 115 { 116 TString name(GetFileName()); 117 name.Remove(0, name.Last('/')+1); 118 119 *fLog << inf << "MReadMarsFile: Switching to '" << name << "' "; 116 *fLog << inf << "MReadMarsFile: Switching to '" << GetFileName() << "' "; 120 117 *fLog << "(before event #" << GetEventNum()-1 << ")" << endl; 121 118 -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r1192 r1203 407 407 if (!fNumEntries) 408 408 { 409 *fLog << warn << dbginf << "No entries found in file(s) ." << endl;409 *fLog << warn << dbginf << "No entries found in file(s)" << endl; 410 410 return kFALSE; 411 411 } … … 692 692 // Return the name of the file we are actually reading from. 693 693 // 694 const char *MReadTree::GetFileName() const 695 { 696 return fChain->GetFile()->GetName(); 694 TString MReadTree::GetFileName() const 695 { 696 const TFile *file = fChain->GetFile(); 697 698 if (!file) 699 return TString("<unknown>"); 700 701 TString name(file->GetName()); 702 name.Remove(0, name.Last('/')+1); 703 return name; 697 704 } 698 705 -
trunk/MagicSoft/Mars/mbase/MReadTree.h
r1114 r1203 58 58 UInt_t GetEntries() const { return fNumEntries; } 59 59 60 const char *GetFileName() const;60 TString GetFileName() const; 61 61 62 62 virtual void AddNotify(TObject *obj); -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r1082 r1203 11 11 12 12 #include "MHexagon.h" 13 14 #include "MGeomPix.h" 13 15 #include "MGeomCam.h" 14 16 … … 27 29 : fAutoScale(kTRUE), fMinPhe(-2), fMaxPhe(50), fW(0), fH(0), fDrawingPad(NULL) 28 30 { 31 fGeomCam = geom; // FIXME: Clone doesn't work! (MGeomCam*)geom->Clone(); 32 29 33 // 30 34 // create the hexagons of the display … … 80 84 delete fLegend; 81 85 delete fLegText; 82 } 83 84 inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix) 85 { 86 (*this)[pix.GetPixId()].SetFillColor(GetColor(pix.GetNumPhotons())); 86 87 delete fGeomCam; 88 } 89 90 inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix, const Int_t i) 91 { 92 // 93 // Fixme: Divide pnum by the (real) area of the pixel 94 // 95 96 const Float_t ratio = (*fGeomCam)[0].GetA()/(*fGeomCam)[i].GetA(); 97 const Float_t pnum = ratio*pix.GetNumPhotons(); 98 99 (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum)); 87 100 } 88 101 … … 221 234 if (fAutoScale) 222 235 { 223 fMinPhe = event->GetNumPhotonsMin( );224 fMaxPhe = event->GetNumPhotonsMax( );236 fMinPhe = event->GetNumPhotonsMin(fGeomCam); 237 fMaxPhe = event->GetNumPhotonsMax(fGeomCam); 225 238 226 239 if (fMaxPhe < 20.) … … 242 255 continue; 243 256 244 SetPixColor(pix );257 SetPixColor(pix, i); 245 258 } 246 259 -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r1023 r1203 21 21 { 22 22 private: 23 MGeomCam *fGeomCam; // pointer to camera geometry 24 23 25 Bool_t fAutoScale; // indicating the autoscale function 24 26 … … 42 44 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 43 45 44 void SetPixColor(const MCerPhotPix &pix );46 void SetPixColor(const MCerPhotPix &pix, const Int_t i); 45 47 Int_t GetColor(Float_t wert); 46 48 -
trunk/MagicSoft/Mars/mhist/HistLinkDef.h
r1015 r1203 11 11 #pragma link C++ class MHFadcPix+; 12 12 #pragma link C++ class MHHillas+; 13 #pragma link C++ class MHHillasSrc+; 13 14 #pragma link C++ class MHStarMap+; 14 15 #pragma link C++ class MHMcEnergy+; -
trunk/MagicSoft/Mars/mhist/MHHillas.cc
r1082 r1203 45 45 // -------------------------------------------------------------------------- 46 46 // 47 // Setup four histograms for Alpha, Width, Length and Dist47 // Setup four histograms for Width, Length 48 48 // 49 49 MHHillas::MHHillas (const char *name, const char *title) … … 60 60 // connect all the histogram with the container fHist 61 61 // 62 fAlpha = new TH1F("Alpha [deg]", "Alpha of Hillas", 90, 0, 90);63 62 fWidth = new TH1F("Width [mm]", "Width of Hillas", 100, 0, 300); 64 63 fLength = new TH1F("Length [mm]", "Length of Hillas", 100, 0, 300); 65 fDist = new TH1F("Dist [mm]", "Dist of Hillas", 100, 0, 300);66 64 67 fAlpha->SetDirectory(NULL);68 65 fLength->SetDirectory(NULL); 69 fDist->SetDirectory(NULL);70 66 fWidth->SetDirectory(NULL); 71 67 72 fAlpha->GetXaxis()->SetTitle("\\alpha [\\circ]");73 68 fLength->GetXaxis()->SetTitle("Length [mm]"); 74 fDist->GetXaxis()->SetTitle("Dist [mm]");75 69 fWidth->GetXaxis()->SetTitle("Width [mm]"); 76 70 77 fAlpha->GetYaxis()->SetTitle("Counts");78 71 fLength->GetYaxis()->SetTitle("Counts"); 79 fDist->GetYaxis()->SetTitle("Counts");80 72 fWidth->GetYaxis()->SetTitle("Counts"); 81 73 } … … 87 79 MHHillas::~MHHillas() 88 80 { 89 delete fAlpha;90 81 delete fWidth; 91 82 delete fLength; 92 delete fDist;93 83 } 94 84 … … 102 92 const MHillas &h = *(MHillas*)par; 103 93 104 fAlpha ->Fill(fabs(h.GetAlpha()));105 94 fWidth ->Fill(h.GetWidth()); 106 95 fLength->Fill(h.GetLength()); 107 fDist ->Fill(h.GetDist());108 96 } 109 97 … … 118 106 TObject *MHHillas::DrawClone(Option_t *opt) const 119 107 { 120 TCanvas *c = MakeDefCanvas("Hillas", "Histograms of Hillas Parameters"); 121 c->Divide(2, 2); 108 TCanvas *c = MakeDefCanvas("Hillas", "Histograms of Hillas Parameters", 109 350, 500); 110 c->Divide(1, 2); 122 111 123 112 gROOT->SetSelectedPad(NULL); … … 127 116 // 128 117 c->cd(1); 129 f Alpha->DrawCopy();118 fLength->DrawCopy(); 130 119 131 120 c->cd(2); 132 fLength->DrawCopy();133 134 c->cd(3);135 fDist->DrawCopy();136 137 c->cd(4);138 121 fWidth->DrawCopy(); 139 122 … … 153 136 { 154 137 if (!gPad) 155 MakeDefCanvas("Hillas", "Histograms of Hillas Parameters" );138 MakeDefCanvas("Hillas", "Histograms of Hillas Parameters", 350, 500); 156 139 157 gPad->Divide( 2,2);140 gPad->Divide(1, 2); 158 141 159 142 gPad->cd(1); 160 f Alpha->Draw();143 fLength->Draw(); 161 144 162 145 gPad->cd(2); 163 fLength->Draw();164 165 gPad->cd(3);166 fDist->Draw();167 168 gPad->cd(4);169 146 fWidth->Draw(); 170 147 -
trunk/MagicSoft/Mars/mhist/MHHillas.h
r1015 r1203 12 12 { 13 13 private: 14 TH1F *fAlpha;15 14 TH1F *fWidth; 16 15 TH1F *fLength; 17 TH1F *fDist;18 16 19 17 public: 20 18 MHHillas(const char *name=NULL, const char *title=NULL); 21 19 ~MHHillas(); 22 20 23 21 void Fill(const MParContainer *par); 24 22 25 TH1F *GetHistAlpha() { return fAlpha; }26 23 TH1F *GetHistWidth() { return fWidth; } 27 24 TH1F *GetHistLength() { return fLength; } 28 TH1F *GetHistDist() { return fDist; }29 25 30 26 void Draw(Option_t *opt=NULL); … … 35 31 36 32 #endif 37 -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r1082 r1203 47 47 // Create the star map histogram 48 48 // 49 MHStarMap::MHStarMap 49 MHStarMap::MHStarMap(const char *name, const char *title) 50 50 { 51 51 // … … 72 72 fStarMap->SetDirectory(NULL); 73 73 74 fStarMap->SetXTitle("x /mm");75 fStarMap->SetYTitle("y /mm");74 fStarMap->SetXTitle("x [mm]"); 75 fStarMap->SetYTitle("y [mm]"); 76 76 fStarMap->SetZTitle("Counts"); 77 77 } … … 95 95 const MHillas &h = *(MHillas*)par; 96 96 97 const float dist = h.GetDist(); 98 const float theta = h.GetTheta(); 99 const float alpha = h.GetAlpha()/kRad2Deg; 100 101 const float m = tan(theta+alpha-kPI); 102 const float t = dist*(sin(theta)-cos(theta)*m); 97 const float delta = h.GetDelta(); 98 99 const float m = tan(delta); 100 const float t = m*h.GetMeanX()-h.GetMeanY(); 103 101 104 102 if (m>-1 && m<1) … … 211 209 gPad->Update(); 212 210 } 213 -
trunk/MagicSoft/Mars/mhist/MHStarMap.h
r1015 r1203 20 20 21 21 public: 22 22 MHStarMap(const char *name=NULL, const char *title=NULL); 23 23 ~MHStarMap(); 24 24 … … 34 34 35 35 #endif 36 -
trunk/MagicSoft/Mars/mhist/Makefile
r1052 r1203 30 30 SRCFILES = MFillH.cc \ 31 31 MH.cc \ 32 32 MHFadcPix.cc \ 33 33 MHFadcCam.cc \ 34 34 MHHillas.cc \ 35 MHHillasSrc.cc \ 35 36 MHStarMap.cc \ 36 37 MHMcCollectionArea.cc \ … … 53 54 54 55 # @endcode 55 -
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx
r1101 r1203 2 2 3 3 #include <iostream.h> 4 #include <fstream.h> 4 5 5 6 … … 162 163 163 164 165 void MMcEvt::AsciiWrite(ofstream &fout) const 166 { 167 fout << fEnergy << " "; 168 fout << fTheta ; 169 } 164 170 165 171 void MMcEvt::Print(Option_t *Option) const { -
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx
r1193 r1203 43 43 UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, UInt_t ) ; 44 44 45 virtual void AsciiWrite(ofstream &fout) const; 45 46 46 47 void Print(Option_t *opt=NULL) const;
Note:
See TracChangeset
for help on using the changeset viewer.