Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1867)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1868)
@@ -1,193 +1,19 @@
                                                  -*-*- END OF LINE -*-*-
- 2003/03/24: Abelardo Moralejo
-
-    * manalysis/MEnergyEstParam.cc
-      - now energy estimation (for CT1) is done using the same model 
-	as in D.Krannich's thesis.
-
-
-
- 2003/03/24: Thomas Bretz
-
-    * manalysis/MHillasSrcCalc.[h,cc]:
-      - removed last argument in constructor, replaced by SetInput
-
-    * mfilter/MFEventSelector.[h,cc]:
-      - removed unnecessary last argument
-
-
-
-
- 2003/03/21: Thomas Hengstebeck
- 
-    * manalysis/MRanTree.[h,cc]
-      - new; parameter container to store a single random tree
-
-    * manalysis/MRanForest.[h,cc]
-      - new; parameter container to store complete forest
-
-    * manalysis/MRanForestGrow.[h,cc]
-      - new; task to grow trees (training)
-
-    * manalysis/MRanForestCalc.[h,cc]
-      - new; task to calculate hadronness using random forest
-
-    * manalysis/MRanForestFill.[h,cc]
-      - new; task to read in the trees of the random forest
-
-    * manalysis/Makefile, manalysis/HistLinkDef.h:
-      - added MRanTree, MRanForest, MRanForestGrow, MRanForestCalc, MRanForestFill
-
-    * mhist/MHRanForest.[h,cc]
-      - new; histogram showing variance of estimated hadronness as function of no. of combined trees 
-
-    * mhist/MHRanForestGini.[h,cc]
-      - new; histogram showing mean decrease in Gini-index as function of RF-input-parameters
-
-    * mhist/Makefile, mhist/HistLinkDef.h:
-      - added MHRanForest, MHRanForestHillas
-
-    * macros/RanForest.C
-      - new; g/h-separation by Random Forest-method
-
-    * macros/RanForest2.C
-      - new; reading in saved random forest (using MRanForestFill)
-
-
-
- 2003/03/21: Abelardo Moralejo
-
-    * mhist/MHMatrix.[h,cc]:
-      - Added third argument (a filter) to the second instantiation 
-	of the Fill procedure.
-
-    * macros/CT1EnergyEst.C:
-      - Example of the parameter calculation and use of the energy 
-	estimation method for CT1.
-
-
-
- 2003/03/21: Thomas Bretz
-
-    * manalysis/MEnergyEstParam.[h,cc]
-      - Added StopMapping and Print functions.
-
-    * manalysis/MSel*.h:
-      -	set default for HilName to MHillas
-      -	set default for HilNameSrc to MHillasSrc
-
-    * mfileio/MCT1ReadPreProc.[h,cc]:
-      - do not flood the output with all events from the first run
-      - output meaningfull text instead of variable names
-      - removed a 'goto'!
-      - changed savePedRMS according to the coding conventions to
-        fPedRMS and the array of fixed size to a TArrayF
-    
-    * mbase/MEvtLoop.cc:
-      - added a events counter which counts the real number of 
-        processed events.
-
-    * mdata/MDataChain.[h,cc]:
-      - implemented random numbers
-      - implemented a conversion from degrees to radians and vice versa
-
-
-
- 2003/03/20: Thomas Bretz
-
-    * mfilter/MF.[h,cc]:
-      -	changed fFilter (already used in base class MTask) to fF
-
-
-
- 2003/03/19: Abelardo Moralejo
-
-    * macros/CT1collarea.C:
-      -	Added filter to cut in hadronness (now available in new version
-        of root CT1 Monte Carlo file from Wolfgang).
-
-
-
- 2003/03/19: Robert Wagner
-
-    * mhist/MH3.cc:
-      - changed MH3::New() such that constructor according to Thomas'
-        previous changes is supported
-
-
-
- 2003/03/19: Thomas Bretz
-
-    * mhist/MH3.[h,cc]:
-      - changed default constructor to support different dimensions
-
-    * mhist/MHArray.[h,cc]:
-      - added AddHistogram
-
-    * meventdisp/MGEvtDisplay.cc, mfileio/MReadTree.[h,cc],
-      meventdisp/MReadMarsFile.cc:
-      - changed MReadTree::GetEventNum to MReadTree::GetNumEntry
-
-    * macros/estfit.C:
-      - adopted to new MChisqEval
-
-    * mtools/MChisqEval.[h,cc]:
-      - added
-
-    * mtools/Makefile, mtools/ToolsLinkDef.h:
-      - added MChisqEval
-
-    * manalysis/MEnergyEstParam.[h,cc]:
-      - slight changes
-    
-    * mfileio/MCT1ReadPreProc.cc:
-      - changed name to MRead
-
-
-
- 2003/03/18: Thomas Bretz
-
-    * mfileio/MReadTree.cc:
-      - fixed a bug in the AddFile function
-
-    * mhist/MHMatrix.[h,cc]:
-      - implemented a request of Th. Hengstebeck: Let DefRefMatrix
-        return the 'unused' events
-
-
-
- 2003/03/18: Abelardo Moralejo
-
-    * mhist/MHMcCT1CollectionArea.[h,cc]
-      - Added arguments in constructor: number of bins and ranges of the 
-	x-axis (energy) of the 2-d histograms. Changed type of binning:
-	now the x-axis is log10(energy) and bins have equal width.
-
-    * macros/CT1collarea.C
-      - The MHMcCT1CollectionArea object is now created and added to the 
-       	parlist so that  we can choose the binning. Changed the way 
-       	histograms are written to the output file.
-
-
- 2003/03/13: Abelardo moralejo
-
-    * mhist/MHMcCT1CollectionArea.[h,cc]
-      - Added for calculations of collection area for CT1.Contains three
-        2-d histograms with axis energy vs theta angle: one histogram for
-        all events, one for analyzed events, one for the collection area.
-
-    * mmontecarlo/MMcCT1CollectionAreaCalc.[h,cc]
-      - Added for the same reason. 
-
-    * macros/CT1collarea.C
-      - Uses the above classes
-
-
-
- 2003/03/12: Abelardo Moralejo
-
-    * macros/mergecamera.C
-      - Added. Merges several MC camera output files into a single file.
-
+
+
+ 2003/03/25: Wolfgang Wittek
+
+    * mhist/MHStarMap.[h,cc]
+      - use constant step size along the main axis of the ellipse
+
+    * manalysis/MPointingCorr.[h,cc]
+      - new class for calculating the pointing correction
+
+    * mmc/MMMcEvt.hxx
+      - add GetOtherCphFraction()
+
+    * manalysis/Makefile
+
+    * manalysis/AnalysisLinkDef.h
 
 
@@ -204,15 +30,15 @@
       - add SetDirectory(NULL)
 
-    * manalysis/MSelBasic.[h,cc]
-                MSelStandard.[h,cc]
-                MSelFinal.[h,cc]
+    * manalysis/ MSelBasic.[h,cc]
+                 MSelStandard.[h,cc]
+                 MSelFinal.[h,cc]
       - more detailed output for errors
       - bugs removed
       
-    * manalysis/MPadSchweizer.[h,cc]
+    * manalysis/ MPadSchweizer.[h,cc]
       - add SetDirectory(NULL)
       - add fErrors
 
-    * mfilter/MFEventSelector.[h,cc]
+    * mfilter/ MFEventSelector.[h,cc]
       - add fErrors
 
@@ -232,7 +58,6 @@
         a run header
 
-    * mmc/MMcEvt.[hxx,cxx]]
+    * mmc/ MMcEvt.[hxx,cxx]]
       - add GetEvtNumber()
-
 
 
@@ -253,7 +78,6 @@
 
     * mmain/MMonteCarlo.cc
-      - Fixed bug: matrix BgR was created with dimension "dim", a number
-        which can be negative. Put "num" instead of "dim".
-
+      - Fixed bug: matrix BgR was created with dimension "dim", a number which
+	can be negative. Put "num" instead of "dim".
 
 
Index: trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 1867)
+++ trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 1868)
@@ -57,4 +57,5 @@
 #pragma link C++ class MSelStandard+;
 #pragma link C++ class MSelFinal+;
+#pragma link C++ class MPointingCorr+;
 
 #pragma link C++ class MMcTriggerLvl2+;
@@ -66,2 +67,3 @@
 
 
+
Index: trunk/MagicSoft/Mars/manalysis/MPointingCorr.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPointingCorr.cc	(revision 1868)
+++ trunk/MagicSoft/Mars/manalysis/MPointingCorr.cc	(revision 1868)
@@ -0,0 +1,137 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Wolfgang Wittek  03/2003 <wittek@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+//  MPointingCorr                                                          //
+//                                                                         //
+//  This is a task to do the pointing correction                           //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MPointingCorr.h"
+
+#include "MParList.h"
+
+#include "MMcEvt.hxx"
+#include "MSrcPosCam.h"
+#include "MGeomCam.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MPointingCorr);
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MPointingCorr::MPointingCorr(const char *name, const char *title,
+                             const char *srcname)
+{
+    fName  = name  ? name  : "MPointingCorr";
+    fTitle = title ? title : "Task to do the pointing correction";
+
+    fSrcName = srcname;
+}
+
+// --------------------------------------------------------------------------
+//
+// 
+// 
+// 
+//
+Bool_t MPointingCorr::PreProcess(MParList *pList)
+{
+    MGeomCam *geom = (MGeomCam*)pList->FindObject("MGeomCam");
+    if (!geom)
+        *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
+    else
+    {
+        fMm2Deg = geom->GetConvMm2Deg();
+    }
+
+
+    fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
+    if (!fMcEvt)
+    {
+        *fLog << dbginf << "MMcEvt not found... aborting." << endl;
+        return kFALSE;
+    }
+
+
+    fSrcPos = (MSrcPosCam*)pList->FindObject(fSrcName, "MSrcPosCam");
+    if (!fSrcPos)
+    {
+        *fLog << err << dbginf << fSrcName << " [MSrcPosCam] not found... aborting." << endl;
+        return kFALSE;
+    }
+
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Do the pointing correction
+//
+// the parametrization is for Mkn421 2001 data (Daniel Kranich)
+// 
+Bool_t MPointingCorr::Process()
+{
+   // fhourangle is the hour angle [degrees]
+   // (cx, cy) is the source position in the camera [mm]
+   //
+   Float_t fhourangle = fMcEvt->GetOtherCphFraction();
+   Float_t cx = -0.05132 - 0.001064 * fhourangle 
+                         - 3.530e-6 * fhourangle * fhourangle;
+   cx /= fMm2Deg;
+
+   Float_t cy = -0.04883 - 0.0003175* fhourangle
+                         - 2.165e-5 * fhourangle * fhourangle;
+   cy /= fMm2Deg;
+
+   fSrcPos->SetXY(cx, cy);
+
+   //*fLog << "MPointingCorr::Process; fhourangle, cx, cy, fMm2Deg = "
+   //      << fhourangle << ",  " << cx << ",  " << cy << ",  " 
+   //      << fMm2Deg << endl;
+
+   return kTRUE;
+}
+// --------------------------------------------------------------------------
+//
+//  
+//
+Bool_t MPointingCorr::PostProcess()
+{
+    return kTRUE;
+}
+//============================================================================
+
+
+
+
+
+
Index: trunk/MagicSoft/Mars/manalysis/MPointingCorr.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPointingCorr.h	(revision 1868)
+++ trunk/MagicSoft/Mars/manalysis/MPointingCorr.h	(revision 1868)
@@ -0,0 +1,50 @@
+#ifndef MARS_MPointingCorr
+#define MARS_MPointingCorr
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MPointingCorr                                                           //
+//                                                                         //
+// Task to do the pointing correction                                      //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef MARS_MTask
+#include "MTask.h"
+#endif
+
+class MMcEvt;
+class MSrcPosCam;
+
+class MPointingCorr : public MTask
+{
+private:
+    MMcEvt       *fMcEvt;       
+    MSrcPosCam   *fSrcPos;
+    TString       fSrcName;
+
+    Float_t      fMm2Deg;
+
+public:
+    MPointingCorr(const char *name=NULL, const char *title=NULL,
+                  const char *srcname="MSrcPosCam");
+
+    Bool_t PreProcess(MParList *pList);
+    Bool_t Process();
+    Bool_t PostProcess();
+
+    ClassDef(MPointingCorr, 0)   // Task to do the pointing correction
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- trunk/MagicSoft/Mars/manalysis/Makefile	(revision 1867)
+++ trunk/MagicSoft/Mars/manalysis/Makefile	(revision 1868)
@@ -69,5 +69,7 @@
 	   MSelBasic.cc \
 	   MSelStandard.cc \
-	   MSelFinal.cc 
+	   MSelFinal.cc \
+	   MPointingCorr.cc 
+
 
 SRCS    = $(SRCFILES)
