/* ======================================================================== *\ ! ! * ! * 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): Keiichi Mase 10/2004 ! Author(s): Markus Meyer 10/2004 ! ! Copyright: MAGIC Software Development, 2000-2005 ! ! \* ======================================================================== */ ///////////////////////////////////////////////////////////////////////////// // // MMuonSearchPar // // Storage Container for muon // // This class is the container for muon parameters. Actually, the calculation // is done here. Muons are searched by fitting the image with a circle. // (This function will be called by using the class of MMuonSearchParCalc.) // This container especially holds the information of the results of the // search (fit of a image by a circle). // // In order to use further information of muons such as the width of arcs, // the arc length along it, the muons size. Use the infomation stored in // MMuonCalibPar. The information will be available by using the task of // MMuonCalibParCalc. // // --- How to search muons --- // (This information is a little bit technical. You can skip to read if you // don't need the technical information.) // // 1. A temporal center position of a circle is determined by using // the Hillas parameters. Assumed that the center position will be on the // line which is perpendicular to the longitudinal image axis and the // distance from the gravity center of the image to the center position of // a ring is approximately 1 deg. (corresponding to the Cherenkov angle.). // Therefore, we will have two candidates of the center positions. // // 2. Find the ring radius which gives the minimum RMS between the camera // images and the estimated circle. // // 3. Select one temporal position which gives smaller RMS as a true temporal // center position. // // 4. Changing the center position of a circle on the camera plane from the // determined temporal center position, find the position which gives the // minimum RMS of the fit. // // // Input Containers: // MGeomCam // MHillas // MSignalCam // ///////////////////////////////////////////////////////////////////////////// #include "MMuonSearchPar.h" #include #include "MLog.h" #include "MLogManip.h" #include "MHillas.h" #include "MGeomCam.h" #include "MGeomPix.h" #include "MSignalPix.h" #include "MSignalCam.h" using namespace std; ClassImp(MMuonSearchPar); // -------------------------------------------------------------------------- // // Default constructor. // MMuonSearchPar::MMuonSearchPar(const char *name, const char *title) { fName = name ? name : "MMuonSearchPar"; fTitle = title ? title : "Muon search parameters"; } // -------------------------------------------------------------------------- // void MMuonSearchPar::Reset() { fRadius = -1; fDeviation = -1; fCenterX = 0; fCenterY = 0; } // -------------------------------------------------------------------------- // // This is a wrapper function to have direct access to the data members // in the function calculating the minimization value. // void MMuonSearchPar::fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag) { const MMuonSearchPar *optim = (MMuonSearchPar*)gMinuit->GetObjectFit(); f = optim->Fcn(par); } // -------------------------------------------------------------------------- // // This function gives you the ring radius fitted best to the camera image // and its RMS for the input position. // Double_t MMuonSearchPar::Fcn(Double_t *par) const { const Int_t entries = fSignal.GetSize(); Double_t meanr=0; Double_t devr =0; Double_t sums =0; // It seems that the loop is easy enough for a compiler optimization. // Using pointer arithmetics doesn't improve the speed of the fit. for (Int_t i=0; i0 ? TMath::Sqrt(sigma) : 0; gMinuit = minsave; } // -------------------------------------------------------------------------- // // Calculation of muon parameters // void MMuonSearchPar::Calc(const MGeomCam &geom, const MSignalCam &evt, const MHillas &hillas) { Double_t x = hillas.GetMeanX(); Double_t y = hillas.GetMeanY(); // ------------------------------------------------- // Keiichi suggested trying to precalculate the Muon // center a bit better, but it neither improves the // fit result nor the speed // // const Float_t tmpr = 300.; // assume that the temporal cherenkov angle is 1 deg. (300 mm). // // const Double_t a = TMath::Tan(hillas.GetDelta()); // // const Double_t dx = a/TMath::Sqrt(tmpr+a*a)/3.; // const Double_t dy = -tmpr/TMath::Sqrt(1+a*a)/3.; // // Double_t par1[] = { x+dx, y+dy, 0, 0 }; // Double_t par2[] = { x-dx, y-dy, 0, 0 }; // // const Double_t dev1 = MMuonSearchPar::Fcn(par1); // const Double_t dev2 = MMuonSearchPar::Fcn(par2); // // if (dev1