Index: trunk/MagicSoft/Mars/macros/trigrate.C
===================================================================
--- trunk/MagicSoft/Mars/macros/trigrate.C	(revision 983)
+++ trunk/MagicSoft/Mars/macros/trigrate.C	(revision 984)
@@ -24,5 +24,5 @@
 
 
-void trigrate(int dim=0, char *filename = "/big0/Maggi/CamData/Gamma/gamma_15_on.root" )
+void trigrate(int dim=0, char *filename = "data/camera.root" )
 {
     // This macro has two input parameter:
@@ -67,5 +67,5 @@
     // Check if the list really contains the right number of histograms
     //
-    if (hists.GetEntriesFast() != dim)
+    if (hists.GetEntriesFast() != dim && dim)
         return;
 
@@ -83,4 +83,10 @@
     //
     MReadTree reader("Events", filename);
+    reader.UseLeaf("fImpact");
+    reader.UseLeaf("fEnergy");
+    reader.UseLeaf("fPhi");
+    reader.UseLeaf("fTheta");
+    reader.UseLeaf("fNumFirstLevel");
+    reader.UseLeaf("fPhotElfromShower");
     tasklist.AddToList(&reader);
 
@@ -88,5 +94,5 @@
     cout << "Number of Trigger conditions: " << dim << endl;
 
-    MMcTriggerRateCalc rate(dim, 14, BgR, 100000, 2.75, 10.91e-2);
+    MMcTriggerRateCalc rate(dim, 14, BgR, 100000);
     tasklist.AddToList(&rate);
 
@@ -104,6 +110,6 @@
 
     TIter Next(&hists);
-    MHMcRate *rate=NULL;
-    while ((rate=(MHMcRate*)Next()))
-        rate->Print();
+    MHMcRate *r=NULL;
+    while ((r=(MHMcRate*)Next()))
+        r->Print();
 }
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 983)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 984)
@@ -457,11 +457,11 @@
 //  from 1 to from.
 //
-TObjArray MParList::FindObjectList(const char *name, const UInt_t from, const UInt_t to) const
+TObjArray MParList::FindObjectList(const char *name, UInt_t first, const UInt_t last) const
 {
     TObjArray list;
 
-    if (to>0 && to<=from)
-    {
-        *fLog << dbginf << "Cannot create entries backwards (to<from)...skipped." << endl;
+    if (first>0 && last<first)
+    {
+        *fLog << dbginf << "Cannot create entries backwards (last<first)...skipped." << endl;
         return list;
     }
@@ -472,16 +472,14 @@
     strcpy(auxname, name);
 
+    if (first==0 && last!=0)
+        first = 1;
+
     //
     // If only 'from' is specified the number of entries are ment
     //
-    const Bool_t exc = from>0 && to==0;
-
-    const UInt_t first = exc ?    0 : from;
-    const UInt_t last  = exc ? from : to;
-
-    for (UInt_t num=first; num<last; num++)
-    {
-        if (from!=0 || to!=0)
-            sprintf(auxname+len, ";%d", num+1);
+    for (UInt_t i=first; i<=last; i++)
+    {
+        if (first!=0 || last!=0)
+            sprintf(auxname+len, ";%d", i);
 
         TObject *obj = FindObject(auxname);
@@ -505,11 +503,11 @@
 //  from 1 to from.
 //
-TObjArray MParList::FindCreateObjList(const char *cname, const UInt_t from, const UInt_t to, const char *oname)
+TObjArray MParList::FindCreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname)
 {
     TObjArray list;
 
-    if (to>0 && to<=from)
-    {
-        *fLog << dbginf << "Cannot create entries backwards (to<from)...skipped." << endl;
+    if (first>0 && last<first)
+    {
+        *fLog << dbginf << "Cannot create entries backwards (last<first)...skipped." << endl;
         return list;
     }
@@ -523,13 +521,11 @@
     // If only 'from' is specified the number of entries are ment
     //
-    const Bool_t exc = from>0 && to==0;
-
-    const UInt_t first = exc ?    0 : from;
-    const UInt_t last  = exc ? from : to;
-
-    for (UInt_t num=first; num<last; num++)
-    {
-        if (from!=0 || to!=0)
-            sprintf(auxname+len, ";%d", num+1);
+    if (first==0 && last!=0)
+        first = 1;
+
+    for (UInt_t i=first; i<=last; i++)
+    {
+        if (first!=0 || last!=0)
+            sprintf(auxname+len, ";%d", i);
 
         TObject *obj = FindCreateObj(auxname, oname);
@@ -558,7 +554,13 @@
 //  compiled programs if you are not 100% sure what you are doing.
 //
-TObjArray MParList::CreateObjList(const char *cname, const UInt_t from, const UInt_t to, const char *oname)
+TObjArray MParList::CreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname)
 {
     TObjArray list;
+
+    if (first>0 && last<first)
+    {
+        gLog << dbginf << "Cannot create entries backwards (last<first)...skipped." << endl;
+        return list;
+    }
 
     //
@@ -584,13 +586,11 @@
     // If only 'from' is specified the number of entries are ment
     //
-    const Bool_t exc = from>0 && to==0;
-
-    const UInt_t first = exc ?    0 : from;
-    const UInt_t last  = exc ? from : to;
-
-    for (UInt_t num=first; num<last; num++)
-    {
-        if (from!=0 || to!=0)
-            sprintf(auxname+len, ";%d", num+1);
+    if (first==0 && last!=0)
+        first = 1;
+
+    for (UInt_t i=first; i<=last; i++)
+    {
+        if (first!=0 || last!=0)
+            sprintf(auxname+len, ";%d", i);
 
         //
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 983)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 984)
@@ -20,4 +20,6 @@
 #include "MParContainer.h"
 #endif
+
+#include <TObjArray.h>
 
 class MLog;
@@ -49,8 +51,21 @@
     MParContainer *FindCreateObj(const char *classname, const char *objname=NULL);
 
-    TObjArray FindObjectList(const char *name, const UInt_t from, const UInt_t to=0) const;
-    TObjArray FindCreateObjList(const char *cname, const UInt_t from, const UInt_t to=0, const char *oname=NULL);
+    TObjArray FindObjectList(const char *name, UInt_t first, const UInt_t last) const;
+    TObjArray FindObjectList(const char *name, const UInt_t num) const
+    {
+        return FindObjectList(name, 0, num);
+    }
 
-    static TObjArray CreateObjList(const char *cname, const UInt_t from, const UInt_t to=0, const char *oname=NULL);
+    TObjArray FindCreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname=NULL);
+    TObjArray FindCreateObjList(const char *cname, const UInt_t num, const char *oname=NULL)
+    {
+        return FindCreateObjList(cname, 0, num, oname);
+    }
+
+    static TObjArray CreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname=NULL);
+    static TObjArray CreateObjList(const char *cname, const UInt_t num, const char *oname=NULL)
+    {
+        return CreateObjList(cname, 0, num, oname);
+    }
 
     void Reset();
Index: trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc	(revision 983)
+++ trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc	(revision 984)
@@ -103,24 +103,26 @@
     }
 
+    UInt_t from = fDimension>0 ?          1 : -fDimension;
+    UInt_t to   = fDimension>0 ? fDimension : -fDimension;
 
-    const UInt_t from = fDimension<=0 ? -fDimension : 0;
+    fNum = to-from+1;
 
-    if (fDimension<=0)
-        fDimension = -fDimension;
+    Int_t num;
 
-    if (fDimension==0)
-        fDimension=1;
-
-    fMcTrig = new TObjArray(pList->FindObjectList("MMcTrig", from, fDimension));
-    if (fMcTrig->GetEntriesFast() != fDimension)
+    fMcTrig = new TObjArray(pList->FindObjectList("MMcTrig", from, to));
+    num = fMcTrig->GetEntriesFast();
+    if (num != fNum)
     {
-        *fLog << dbginf << "Error: Not all requested MMcTrig objects are available...aborting." << endl;
+        *fLog << dbginf << fNum << " MMcTrig objects requested, ";
+        *fLog << num << " are available... aborting." << endl;
         return kFALSE;
     }
 
-    fEnergy = new TObjArray(pList->FindCreateObjList("MHMcEnergy", from, fDimension));
-    if (fMcTrig->GetEntriesFast() != fDimension && fDimension)
+    fEnergy = new TObjArray(pList->FindCreateObjList("MHMcEnergy", from, to));
+    num = fMcTrig->GetEntriesFast();
+    if (num != fNum)
     {
-        *fLog << dbginf << "Error: Not all requested MHMcEnergy objects are available...aborting." << endl;
+        *fLog << dbginf << fNum << " MHMcEnergy objects requested, ";
+        *fLog << num << " are available... aborting." << endl;
         return kFALSE;
     }
@@ -141,5 +143,5 @@
     const Float_t reciproc = 1./energy;
 
-    for (Int_t i=0; i<fDimension; i++)
+    for (Int_t i=0; i<fNum; i++)
         if (GetTrig(i)->GetFirstLevel()>0)
             GetHEnergy(i)->Fill(lg10, reciproc);
@@ -155,5 +157,5 @@
 Bool_t MMcThresholdCalc::PostProcess()
 {
-    for (Int_t i=0; i<fDimension; i++)
+    for (Int_t i=0; i<fNum; i++)
     {
         MHMcEnergy &hist = *GetHEnergy(i);
Index: trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.h	(revision 983)
+++ trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.h	(revision 984)
@@ -25,4 +25,5 @@
 private:
     Int_t fDimension;
+    Int_t fNum;
 
     const MMcEvt  *fMcEvt;       // Container with Monte Carlo information
Index: trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.cc	(revision 983)
+++ trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.cc	(revision 984)
@@ -43,5 +43,5 @@
     *fTitle = title ? title : "Task to calc the trigger rate ";
 
-    fDimension=dim;
+    fDimension = dim;
 
     for (int i=0;i<10;i++)
@@ -111,27 +111,30 @@
     }
 
-    const UInt_t from = fDimension<=0 ? -fDimension : 0;
-
-    if (fDimension<=0)
-        fDimension = -fDimension;
-
-    if (fDimension==0)
-        fDimension=1;
-
-    fMcTrig = new TObjArray(pList->FindObjectList("MMcTrig", from, fDimension));
-    if (fMcTrig->GetEntriesFast() != fDimension)
-    {
-        *fLog << dbginf << "Error: Not all requested MMcTrig objects are available...aborting." << endl;
+    UInt_t from = fDimension>0 ?          1 : -fDimension;
+    UInt_t to   = fDimension>0 ? fDimension : -fDimension;
+
+    fNum = to-from+1;
+
+    Int_t num;
+
+    fMcTrig = new TObjArray(pList->FindObjectList("MMcTrig", from, to));
+    num = fMcTrig->GetEntriesFast();
+    if (num != fNum)
+    {
+        *fLog << dbginf << fNum << " MMcTrig objects requested, ";
+        *fLog << num << " are available... aborting." << endl;
         return kFALSE;
     }
 
-    fMcRate = new TObjArray(pList->FindObjectList("MHMcRate", from, fDimension));
-    if (fMcRate->GetEntriesFast() != fDimension)
-    {
-        *fLog << dbginf << "Error: Not all requested MHMcRate objects are available...aborting." << endl;
+    fMcRate = new TObjArray(pList->FindObjectList("MHMcRate", from, to));
+    num = fMcRate->GetEntriesFast();
+    if (num != fNum)
+    {
+        *fLog << dbginf << fNum << " MHMcRate objects requested, ";
+        *fLog << num << " are available... aborting." << endl;
         return kFALSE;
     }
 
-    for (int i=0; i<fDimension; i++)
+    for (int i=0; i<fNum; i++)
     {
         MHMcRate &rate = *GetRate(i);
@@ -175,5 +178,5 @@
     //  Counting number of triggers
     //
-    for (int i=0; i<fDimension; i++)
+    for (int i=0; i<fNum; i++)
     {
         fTrigger[i] += GetTrig(i)->GetFirstLevel();
@@ -194,5 +197,5 @@
     // Computing trigger rate
     //
-    for (int i=0; i<fDimension; i++)
+    for (int i=0; i<fNum; i++)
         GetRate(i)->CalcRate(fTrigger[i], fAnalShow, fShowers);
 
Index: trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.h	(revision 983)
+++ trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.h	(revision 984)
@@ -27,4 +27,5 @@
     Int_t      fDimension;     // Information about the trigger conditions
                                // in the root file to be read.
+    Int_t      fNum;           // decoded dimension
 
     Float_t    fTrigger[10];   // Number of triggered showers
@@ -38,5 +39,5 @@
 
     MHMcRate *GetRate(UInt_t i) const { return (MHMcRate*)((*fMcRate)[i]); }
-    MMcTrig *GetTrig(UInt_t i) const { return (MMcTrig*)((*fMcTrig)[i]); }
+    MMcTrig  *GetTrig(UInt_t i) const { return (MMcTrig*)((*fMcTrig)[i]); }
 
 public:
