/* ======================================================================== *\ ! ! * ! * This file is part of MARS, the MAGIC Analysis and Reconstruction ! * Software. It is distributed to you in the hope that it can be a useful ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. ! * It is distributed WITHOUT ANY WARRANTY. ! * ! * Permission to use, copy, modify and distribute this software and its ! * documentation for any purpose is hereby granted without fee, ! * provided that the above copyright notice appear in all copies and ! * that both that copyright notice and this permission notice appear ! * in supporting documentation. It is provided "as is" without express ! * or implied warranty. ! * ! ! ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de) ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de) ! ! Copyright: MAGIC Software Development, 2000-2001 ! ! \* ======================================================================== */ ///////////////////////////////////////////////////////////////////////////// // // // MHillas // // // // Storage Container for the Hillas parameter // // // // FIXME: Here everybody should find an explanation of the parameters // // // ///////////////////////////////////////////////////////////////////////////// #include "MHillas.h" #include #include #include "MCerPhotEvt.h" #include "MCerPhotPix.h" #include "MGeomCam.h" #include "MLog.h" ClassImp(MHillas) // -------------------------------------------------------------------------- // // Default constructor. // MHillas::MHillas(const char *name, const char *title) : fAlpha(0), fTheta(0), fWidth(0), fLength(0), fSize(0), fDist(0), fEllipse(NULL) { *fName = name ? name : "MHillas"; *fTitle = title ? title : "Storage container for Hillas parameter of one event"; // FIXME: Initialization of values missing } // -------------------------------------------------------------------------- // // Destructor. Deletes the TEllipse if one exists. // MHillas::~MHillas() { Clear(); } // -------------------------------------------------------------------------- // // Print the hillas Parameters to *fLog // void MHillas::Print(Option_t *) { *fLog << "Hillas Parameter:" << endl; *fLog << " - Alpha = " << fabs(fAlpha) << endl; *fLog << " - Width = " << fWidth << endl; *fLog << " - Length = " << fLength << endl; *fLog << " - Size = " << fSize << endl; *fLog << " - Dist = " << fDist << endl; } // -------------------------------------------------------------------------- // // call the Paint function of the Ellipse if a TEllipse exists // void MHillas::Paint(Option_t *) { if (!fEllipse) return; fEllipse->Paint(); } // -------------------------------------------------------------------------- // // Instead of adding MHillas itself to the Pad // (s. AppendPad in TObject) we create an ellipse, // which is added to the Pad by it's Draw function // You can remove it by deleting the Ellipse Object // (s. Clear() ) // void MHillas::Draw(Option_t *) { Clear(); fEllipse = new TEllipse(cos(fTheta)*fDist, sin(fTheta)*fDist, fLength, fWidth, 0, 360, fTheta*kRad2Deg+fAlpha-180); fEllipse->SetLineWidth(2); fEllipse->Draw(); /* This is from TH1 TString opt = option; opt.ToLower(); if (gPad && !opt.Contains("same")) { //the following statement is necessary in case one attempts to draw //a temporary histogram already in the current pad if (TestBit(kCanDelete)) gPad->GetListOfPrimitives()->Remove(this); gPad->Clear(); } AppendPad(opt.Data()); */ } // -------------------------------------------------------------------------- // // If a TEllipse object exists it is deleted // void MHillas::Clear(Option_t *) { if (!fEllipse) return; delete fEllipse; fEllipse = NULL; } // -------------------------------------------------------------------------- // // Calculate the Hillas parameters from a cerenkov photon event // (The calcualtion is some kind of two dimentional statistics) // Bool_t MHillas::Calc(MGeomCam &geom, MCerPhotEvt &evt) { const UInt_t nevt = evt.GetNumPixels(); // // sanity check // if (nevt <= 2) return kFALSE; // // calculate mean valu of pixels // float xmean =0; float ymean =0; fSize = 0; // // FIXME! npix should be retrieved from MCerPhotEvt // UShort_t npix=0; for (UInt_t i=0; i