Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1781)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1782)
@@ -1,4 +1,18 @@
 
                                                          -*-*- END -*-*-
+ 2003/02/21: Antonio Stamerra 
+
+    * manalysis/MMcTriggerLvl2.[cc|h]
+      - new data member fCompactNN needed to define a compact pixels
+      - new inline functions SetCompactNN and GetCompactNN 
+      - Method Calc(int neighpix) -> Calc(). The value of neighpix
+	is read from fCompactNN
+
+    * manalysis/MMcTriggerLvl2Calc.[cc|h]
+      - Check on fCompactNN added in the PreProcess
+
+    * macros/triglvl2.C
+      - Set of fCompactNN added
+
 
  2003/02/21: Wolfgang Wittek
Index: trunk/MagicSoft/Mars/macros/triglvl2.C
===================================================================
--- trunk/MagicSoft/Mars/macros/triglvl2.C	(revision 1781)
+++ trunk/MagicSoft/Mars/macros/triglvl2.C	(revision 1782)
@@ -4,5 +4,11 @@
 //  Filters to select events using these parameter are also created.
 //
+//   Inputs:
+//      - filename      name of data file
+//      - CompactNN     number of NN to define a compact pixel
+//      - fValue        comparision value for the filter
+//
 void triglvl2(char *filename = "Gamma.root")
+  //    USER:   Data File Name    ---^
 { 
     //
@@ -19,4 +25,8 @@
     parlist.AddToList(&cell);
 
+    // Set the number of Next Neighbourhoods that define a compact pixel
+    //
+    cell.SetCompactNN(3);
+    //  USER:       --^
     //
     //  A filter to select events using the L2T parameters is created
@@ -24,7 +34,9 @@
     //    MF lvl2filter("MMcTriggerLvl2.fLutPseudoSize > 6");
     MF lvl2filter("MMcTriggerLvl2.fSizeBiggerCell > 16");
+    //
     // A second filter is created using the class MFTriggerLvl2
-    MFTriggerLvl2 fTrig1("MMcTriggerLvl2", '>', 6);
-    //       this is the value to be compared --^
+    //
+    MFTriggerLvl2 fTrig1("MMcTriggerLvl2", '>', 8);
+    //      USER:       fValue to be compared --^
 
     //
@@ -38,7 +50,7 @@
     //
     MFilterList flist;
-    flist.AddToList(&energyfilter);
-    flist.AddToList(&lvl2filter);
-    flist.AddToList(&selector);
+    //    flist.AddToList(&energyfilter);
+    //    flist.AddToList(&lvl2filter);
+    //    flist.AddToList(&selector);
     flist.AddToList(&fTrig1);
 
Index: trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc	(revision 1781)
+++ trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc	(revision 1782)
@@ -29,4 +29,7 @@
 //   Storage container for the 2nd level trigger selection parameters      //
 //    as part of the 2nd level trigger simulation                          //
+//                                                                         //
+// input parameter:                                                        //
+//    fCompactNN   number of next neighboors that define a compact pixel   //
 //                                                                         //
 //                                                                         //
@@ -236,6 +239,9 @@
 //
 //
-void MMcTriggerLvl2::Calc(int neighpix)
-{
+void MMcTriggerLvl2::Calc()
+{
+  // Reads the number of NN that define a compact pixel
+  int neighpix=(*this).fCompactNN;
+
   // Find the Lut and cell with the higher LutPseudoSize. 
   int lutcell = CalcBiggerLutPseudoSize(neighpix); 
@@ -402,7 +408,4 @@
   int lut=-1;
  
-  // only cases neighpix=2,3 (2NN,3NN) are considered 
-  if (neighpix >3 || neighpix < 2) return(-1);
-
   for(int j=0; j<19; j++)
     {
@@ -430,7 +433,7 @@
 //   (=number of compact pixels in one LUT)
 //  neighpix is the number of Next-Neighbors which defines the compact pixel
-//    topology. 
+//    topology.  
 //   Up to now only  2NN or 3NN are considered 
-//      if changed: change also GetBiggerLutPseudoSize 
+//    <!if changed: change check made by Preprocess in MMcTriggerLvl2Calc>    
 //
 //   Returns: 
Index: trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h	(revision 1781)
+++ trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h	(revision 1782)
@@ -24,4 +24,6 @@
   Int_t fSizeBiggerCell; // Number of fired pixel in bigger cell
 
+  Int_t fCompactNN;  //Number of NN pixels that define a compact pixel
+
   MMcTrig *fMcTrig;
   MGeomCamMagic *fGeomcam;  
@@ -40,5 +42,5 @@
   void DrawLv1();
 
-  virtual void Calc(int neighpix=2);
+  virtual void Calc();
 
   virtual void Print(Option_t *opt="") const;
@@ -47,10 +49,13 @@
   void SetPixelFired(Int_t pixel, Int_t fired=1);
  
+  void SetCompactNN(Int_t neighpix)     {fCompactNN=neighpix;}
+
   Int_t GetPseudoSize()     {return fPseudoSize;}
   Int_t GetLutPseudoSize()  {return fLutPseudoSize;}
   Int_t GetSizeBiggerCell() {return fSizeBiggerCell;}
+  Int_t GetCompactNN()      {return fCompactNN;}
 
   Int_t GetCellNumberFired(int cell);
-  Int_t GetLutCompactPixel(int cell, int lut, int neighpix=2);
+  Int_t GetLutCompactPixel(int cell, int lut, int neighpix);
 
   ClassDef(MMcTriggerLvl2,0) // Container for 2nd Level Trigger selection parameters
@@ -60,2 +65,5 @@
 
 
+
+
+
Index: trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc	(revision 1781)
+++ trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc	(revision 1782)
@@ -66,5 +66,5 @@
 
 
-  //  h1 = new TH1F("h1","h1",30,0,30);
+  // h1 = new TH1F("h1","h1",30,0,30);
 } 
 
@@ -100,4 +100,15 @@
     }
 
+    // Check if the variable fCompactNN has been correctly set;
+    //  accepted values for fCompactNN are (up to now) 2 and 3.
+    if (fMMcTriggerLvl2->GetCompactNN()<2 || fMMcTriggerLvl2->GetCompactNN()>3)
+      {
+	*fLog << err << dbginf << "fCompactNN is not correctly set ("<<fMMcTriggerLvl2->GetCompactNN() <<") ... exit" <<endl;
+        return kFALSE;	
+      }
+    else
+      *fLog << "Compact pixel is set with at least "<<fMMcTriggerLvl2->GetCompactNN() << " NN" <<endl;
+
+
     return kTRUE;
 }
@@ -120,5 +131,5 @@
   //fMMcTriggerLvl2->Print();
 
-  //    h1->Fill( fMMcTriggerLvl2->GetCellNumberFired(fMMcTriggerLvl2->GetBiggerFiredCell()) );
+  //      h1->Fill(fMMcTriggerLvl2->GetLutPseudoSize() );
 
 
Index: trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.h	(revision 1781)
+++ trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.h	(revision 1782)
@@ -30,4 +30,6 @@
     Bool_t PostProcess();
 
+    //    TH1F *h1;
+
     ClassDef(MMcTriggerLvl2Calc, 0) // Task to calculate the MMcTriggerLvl2 Parameters
 };
