Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 685)
+++ trunk/MagicSoft/Mars/Makefile	(revision 686)
@@ -35,5 +35,5 @@
 #  ----->>>   mars libraries
 #
-SUBDIRS = mgui manalysis meventdisp mdatacheck mbase mraw mmc
+SUBDIRS = mgui manalysis meventdisp mdatacheck mmontecarlo mbase mraw mmc
 
 LIBRARIES = $(SUBDIRS:=.a)
@@ -100,4 +100,7 @@
 	@cd manalysis; make mrproper; cd ..
 	@echo "cd .."
+	@echo "cd mmontecarlo"
+	@cd mmontecarlo; make mrproper; cd ..
+	@echo "cd .."
 
 tar:	mrproper
Index: trunk/MagicSoft/Mars/macros/getCollArea.C
===================================================================
--- trunk/MagicSoft/Mars/macros/getCollArea.C	(revision 686)
+++ trunk/MagicSoft/Mars/macros/getCollArea.C	(revision 686)
@@ -0,0 +1,36 @@
+{{ 
+  
+  MParList  *parlist  = new MParList() ; 
+  MTaskList *tasklist = new MTaskList() ; 
+  
+  MMcEvt *mcEvt = new MMcEvt() ; 
+  parlist->AddToList( mcEvt ) ; 
+
+  MMcTrig *McTrig = new MMcTrig() ; 
+  parlist->AddToList( McTrig ) ;
+
+  MCollArea *collArea = new MCollArea() ; 
+  parlist->AddToList( collArea ) ; 
+
+
+  MReadTree reader("/big0/Maggi/CamData/Gamma/gamma_15_on.root","Events" ) ; 
+  tasklist->AddToList( &reader ) ; 
+
+  MCollAreaTrigger  effi ; 
+  tasklist->AddToList( &effi) ; 
+  
+  parlist.AddToList( tasklist);
+
+  tasklist->Print() ; 
+
+  //    set up the loop for the processing 
+  
+  MEvtLoop magic;
+  magic.SetParList( parlist );
+
+
+  magic.Eventloop() ; 
+
+  collArea->Draw() ; 
+  
+}} 
Index: trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc	(revision 686)
+++ trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc	(revision 686)
@@ -0,0 +1,106 @@
+#include "MCollArea.h" 
+
+#include <MLog.h>
+#include <TH2.h> 
+
+ClassImp(MCollArea)
+
+
+
+MCollArea::MCollArea(const char *name, const char *title) 
+{ 
+  //
+  //   default constructor
+  //
+
+  //   initialize the histogram for the distribution r vs E 
+  // 
+  //   we set the energy range from 1 Gev to 10000 GeV (in log 5 orders
+  //   of magnitude) and for each order we take 10 subdivision --> 50 xbins
+  //
+  //   we set the radius range from 0 m to 500 m with 10 m bin --> 50 ybins
+
+  
+  *fName  = name  ? name  : "MCollArea";
+  *fTitle = title ? title : "Data to Calculate Coll-Area";
+  
+  
+  fHistAll = new TH2D("collAreaAll", "all showers - Radius vs log(E) distribution", 
+		      50, 0., 5., 
+		      50, 0., 500. ) ;
+  
+  fHistSel = new TH2D("collAreaSel", "selected showers - Radius vs log(E) distribution", 
+		      50, 0., 5., 
+		      50, 0., 500. ) ; 
+
+  fHistColl = new TH1D("collArea", "Collection Area", 
+		       50, 0., 5.) ; 
+  
+} 
+
+MCollArea::~MCollArea()
+{ 
+  delete fHistAll ; 
+  delete fHistSel ; 
+  delete fHistColl ; 
+} 
+
+void MCollArea::FillAll(Float_t log10E, Float_t radius)
+{ 
+  fHistAll->Fill(log10E, radius ) ; 
+} 
+
+void MCollArea::FillSel(Float_t log10E, Float_t radius)
+{ 
+  fHistSel->Fill(log10E, radius ) ; 
+} 
+
+void MCollArea::DrawAll() 
+{ 
+  fHistAll->Draw() ; 
+} 
+
+void MCollArea::DrawSel() 
+{ 
+  fHistSel->Draw() ; 
+} 
+
+void MCollArea::Draw(Option_t* option) 
+{ 
+  fHistColl->Draw(option) ; 
+} 
+
+void MCollArea::CalculateEffi()
+{ 
+  //  first of all calculate the efficency
+  fHistSel->Divide( fHistAll) ; 
+  
+  // 
+  //  now calculate the Collection area for different 
+  //  energies
+  //   
+  
+  Int_t iBinx = ( (TAxis *) fHistSel->GetXaxis())->GetNbins() ; 
+  Int_t iBiny = ( (TAxis *) fHistSel->GetYaxis())->GetNbins() ; 
+  
+  Double_t  r1, r2, eff, A ; 
+
+  for (Int_t ix=1; ix<=iBiny; ix++ ) 
+    {
+      A = 0. ; 
+      for (Int_t iy=1; iy<=iBiny; iy++ ) 
+	{ 
+	  r1 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy) ; 
+	  r2 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy+1) ; 
+	  eff= fHistSel->GetCellContent(ix, iy) ; 
+	  A += eff * 3.141592654 * ( r2*r2 - r1*r1 ) ; 
+
+	}
+      cout << ix << " --> " << A
+	   << endl ; 
+      
+      fHistColl->SetBinContent(ix, A ) ; 
+      
+
+    } 
+} 
Index: trunk/MagicSoft/Mars/mmontecarlo/MCollArea.h
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MCollArea.h	(revision 686)
+++ trunk/MagicSoft/Mars/mmontecarlo/MCollArea.h	(revision 686)
@@ -0,0 +1,30 @@
+#ifndef __MCollArea__
+#define __MCollArea__
+
+#include "MParContainer.h"
+
+#include <TH2.h>
+
+class MCollArea : public MParContainer { 
+
+ private: 
+  TH2D  *fHistAll ; //!    all simulated showers 
+  TH2D  *fHistSel ; //!    the selected showers
+  TH1D  *fHistColl ; //!   the collection area
+
+ public: 
+  
+  MCollArea(const char *name=NULL, const char *title=NULL) ; 
+  ~MCollArea() ; 
+
+  void FillAll(Float_t log10E, Float_t radius) ;  
+  void FillSel(Float_t log10E, Float_t radius) ;  
+  void DrawAll() ;
+  void DrawSel() ;
+  void Draw(Option_t* option = "") ; 
+  void CalculateEffi() ; 
+
+  ClassDef(MCollArea, 1)  //  Data Container to calculate Collection Area
+} ; 
+
+#endif 
Index: trunk/MagicSoft/Mars/mmontecarlo/MCollAreaTrigger.cc
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MCollAreaTrigger.cc	(revision 686)
+++ trunk/MagicSoft/Mars/mmontecarlo/MCollAreaTrigger.cc	(revision 686)
@@ -0,0 +1,69 @@
+#include "MCollAreaTrigger.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+#include "MParList.h"
+
+#include "MCollArea.h"
+#include "MMcEvt.hxx" 
+#include "MMcTrig.hxx" 
+
+ClassImp(MCollAreaTrigger)
+
+MCollAreaTrigger::MCollAreaTrigger (const char *name, const char *title)
+{
+  *fName  = name  ? name  : "MCollAreaTrigger";
+  *fTitle = title ? title : "Task to calc the collection area ";
+} 
+
+
+Bool_t MCollAreaTrigger::PreProcess (MParList *pList)
+{
+  // connect the raw data with this task
+  
+  fMcEvt  = (MMcEvt*)pList->FindCreateObj("MMcEvt") ; 
+  if (!fMcEvt) { 
+    *fLog << dbginf << " Error: MMcEvt not found... exit." << endl;
+    return kFALSE;
+  } 
+
+  fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig") ; 
+  if (!fMcTrig) { 
+    *fLog << dbginf << " Error: MMcTrig not found... exit." << endl;
+    return kFALSE;
+  } 
+
+  fCollArea = (MCollArea*)pList->FindCreateObj("MCollArea") ; 
+  if (!fCollArea) { 
+    *fLog << dbginf << " Error: MCollArea not found... exit." << endl;
+    return kFALSE;
+  } 
+
+  return kTRUE ; 
+
+} 
+
+
+Bool_t MCollAreaTrigger::Process () 
+{ 
+
+  fCollArea->FillAll( log10( fMcEvt->GetEnergy()) , 
+			     fMcEvt->GetImpact()/100. ) ; 
+  
+  if ( fMcTrig->GetFirstLevel() > 0 ) 
+    fCollArea->FillSel( log10( fMcEvt->GetEnergy()) , 
+			fMcEvt->GetImpact()/100. ) ; 
+  
+  return kTRUE ; 
+} 
+
+Bool_t MCollAreaTrigger::PostProcess () 
+{ 
+  // 
+  //   do the calculation of the effectiv area
+  //
+
+  fCollArea->CalculateEffi() ; 
+
+  return kTRUE ; 
+}
Index: trunk/MagicSoft/Mars/mmontecarlo/MCollAreaTrigger.h
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MCollAreaTrigger.h	(revision 686)
+++ trunk/MagicSoft/Mars/mmontecarlo/MCollAreaTrigger.h	(revision 686)
@@ -0,0 +1,31 @@
+#ifndef MCOLLAREATRIGGER_H
+#define MCOLLAREATRIGGER_H
+
+#ifndef MTASK_H
+#include "MTask.h"
+#endif
+
+class MParList;
+class MMcEvt ; 
+class MMcTrig ; 
+class MCollArea;
+
+class MCollAreaTrigger : public MTask {
+ private:
+  MMcEvt          *fMcEvt    ; //!
+  MMcTrig         *fMcTrig   ; //!
+  MCollArea       *fCollArea ; //!
+
+ public:   
+  MCollAreaTrigger (const char *name=NULL, const char *title=NULL); 
+
+  Bool_t PreProcess(MParList *pList);
+  Bool_t Process() ;
+  Bool_t PostProcess() ;
+  
+  ClassDef(MCollAreaTrigger, 1)	// Task to fill the collection area histograms
+
+};
+
+#endif 
+
Index: trunk/MagicSoft/Mars/mmontecarlo/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/Makefile	(revision 686)
+++ trunk/MagicSoft/Mars/mmontecarlo/Makefile	(revision 686)
@@ -0,0 +1,48 @@
+##################################################################
+#
+#   makefile
+# 
+#   for the MARS software
+#
+##################################################################
+include ../Makefile.conf.$(OSTYPE)
+include ../Makefile.conf.general
+
+#
+# Handling name of the Root Dictionary Files
+#
+CINT  = MonteCarlo
+
+#
+# Library name to creatre
+#
+LIB   = mmontecarlo.a
+
+#
+#  connect the include files defined in the config.mk file
+#
+INCLUDES = -I. -I../mbase -I../mmc
+
+#------------------------------------------------------------------------------
+
+.SUFFIXES: .c .cc .cxx .h .hxx .o 
+
+SRCFILES = MCollArea.cc \
+	   MCollAreaTrigger.cc 
+
+SRCS    = $(SRCFILES)
+HEADERS = $(SRCFILES:.cc=.h)
+OBJS    = $(SRCFILES:.cc=.o) 
+
+############################################################
+
+all: $(LIB)
+
+include ../Makefile.rules
+
+clean:	rmlib rmcint rmobjs rmcore rmbin
+
+mrproper:	clean rmbak
+
+# @endcode
+
Index: trunk/MagicSoft/Mars/mmontecarlo/MonteCarloIncl.h
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MonteCarloIncl.h	(revision 686)
+++ trunk/MagicSoft/Mars/mmontecarlo/MonteCarloIncl.h	(revision 686)
@@ -0,0 +1,5 @@
+#ifndef __CINT__
+
+#include "MParContainer.h"
+
+#endif // __CINT__
Index: trunk/MagicSoft/Mars/mmontecarlo/MonteCarloLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MonteCarloLinkDef.h	(revision 686)
+++ trunk/MagicSoft/Mars/mmontecarlo/MonteCarloLinkDef.h	(revision 686)
@@ -0,0 +1,10 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class MCollArea ; 
+#pragma link C++ class MCollAreaTrigger ; 
+
+#endif
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx	(revision 685)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx	(revision 686)
@@ -20,4 +20,7 @@
   //  default constructor
   //  set all values to zero
+ 
+  *fName  = "MMcEvt";
+  *fTitle = "Event info from Monte Carlo simulation";
 
   fPartId = 0  ;
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcTrig.cxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcTrig.cxx	(revision 685)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcTrig.cxx	(revision 686)
@@ -21,4 +21,9 @@
   //  set all values to zero
 
+  
+  *fName  = "MMcTrig";
+  *fTitle = "Trigger info from Monte Carlo";
+
+    
   Int_t i,j;
 
