Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2488)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2489)
@@ -1,3 +1,19 @@
                                                  -*-*- END OF LINE -*-*-
+
+  
+  2003/11/08: Nicola Galante
+
+   * mhistmc/MHMcTriggerLvl2.[cc,h]:
+     - Changed binning of histograms fHistLutPseudoSize, fHistLutPseudoSizeNorm,
+       fHistSizeBiggerCell, fHistSizeBiggerCellNorm to fix an overflow bug
+     - In method GetHistByName(const TString name): changed the class of the returned object,
+       now it returns a (TObject *), no more a (TH1F *), in order to return
+       either (TH1 *) than (TH2 *); changed the order by which it checks the name of the
+       histogram in order to fix a bug in the lexing
+
+   * macros/triglvl2.C:
+     - Added some instruction to write all the MMcTriggerLvl2 histograms into
+       a TFile 
+
 
   2003/11/07: Thomas Bretz
Index: trunk/MagicSoft/Mars/macros/triglvl2.C
===================================================================
--- trunk/MagicSoft/Mars/macros/triglvl2.C	(revision 2488)
+++ trunk/MagicSoft/Mars/macros/triglvl2.C	(revision 2489)
@@ -38,5 +38,4 @@
    
     tasklist.AddToList(&reader);
-
     MGeomCamMagic geocam;
     parlist.AddToList(&geocam);
@@ -55,5 +54,5 @@
     // Set the number of Next Neighbourhoods that define a compact pixel
     //
-    cell.SetCompactNN(2);
+    cell.SetCompactNN(3);
     //  USER:       --^
 
@@ -61,7 +60,7 @@
     //  A filter to select events using the L2T parameters is created
     //
-
     // MF lvl2filter("MMcTriggerLvl2.fPseudoSize > 25 && MMcTriggerLvl2.fPseudoSize < 31");
-    MF lvl2filter("MMcTriggerLvl2.fPseudoSize > 15");
+    //    MF lvl2filter("MMcTriggerLvl2.fSizeBiggerCell > 34");
+    MF lvl2filter("MMcTriggerLvl2.fSizeBiggerCell > 18");
  
     //
@@ -90,11 +89,9 @@
     MFilterList flist;
     //flist.AddToList(&energyfilter);
-    //flist.AddToList(&lvl2filter);
+    flist.AddToList(&lvl2filter);
     //   flist.AddToList(&selector);
     //   flist.AddToList(&eslope);
     //   flist.AddToList(&fTrig);
 
-
-    
     //
     // The task to calculate the L2T parameter is added to the task list
@@ -107,4 +104,8 @@
     //
     tasklist.AddToList(&flist);
+
+
+    MContinue L1offline ("MMcTriggerLvl2.fLutPseudoSize < 6");
+    //    tasklist.AddToList(&L1offline);
 
     //
@@ -176,26 +177,49 @@
     // filled and can be displayd
     //
-    parlist.FindObject("MHMcCollectionArea")->DrawClone();
-
-    parlist.FindObject("MHMcTriggerLvl2")->DrawClone("sbc");
-    parlist.FindObject("MHMcTriggerLvl2")->DrawClone("lps");
-    parlist.FindObject("MHMcTriggerLvl2")->DrawClone();
+    
+
+    //parlist.FindObject("MHMcTriggerLvl2")->DrawClone("sbc");
+    //parlist.FindObject("MHMcTriggerLvl2")->DrawClone("lps");
+    //parlist.FindObject("MHMcTriggerLvl2")->DrawClone();
     //parlist.FindObject("MHMcTriggerLvl2")->DrawClone("energy");
-    parlist.FindObject("MHMcTriggerLvl2")->DrawClone("size-energy");
-
+    //parlist.FindObject("MHMcTriggerLvl2")->DrawClone("lut-energy");
+    //parlist.FindObject("MHMcCollectionArea")->DrawClone();
     // Returns histogram of the class MHMcTriggerLvl2  
-
+    
     MHMcTriggerLvl2 *htrig = (MHMcTriggerLvl2 *)parlist.FindObject("MHMcTriggerLvl2");
-    TH1F *h1 = (TH1F *)htrig->GetHistByName("fHistPseudoSize");
-    TH2D *h2 = htrig->GetHistSizeBiggerCellEnergy();
-    TH2D *h3 = (TH2D *)htrig->GetHistByName("fHistLutPseudoSizeEnergy");
-    //csbce = new TCanvas();
-    //h2->DrawClone();
-
-    hfile = new TFile("HistFileLUT.root", "RECREATE");
-    h1->Write();
-    h2->Write();
-    h3->Write();
+    MHMcCollectionArea *collarea = (MHMcCollectionArea *)parlist.FindObject("MHMcCollectionArea");
+    TH1F *hps = (TH1F *)htrig->GetHistByName("fHistPseudoSize");
+    TH1F *hlps = (TH1F *)htrig->GetHistByName("fHistLutPseudoSize");
+    TH1F *hsbc = (TH1F *)htrig->GetHistSizeBiggerCell();
+    TH1F *hpsn = (TH1F *)htrig->GetHistByName("fHistPseudoSizeNorm");
+    TH1F *hlpsn = (TH1F *)htrig->GetHistByName("fHistLutPseudoSizeNorm");
+    TH1F *hsbcn = (TH1F *)htrig->GetHistSizeBiggerCellNorm();
+    TH2D *hlpse = (TH2D *)htrig->GetHistByName("fHistLutPseudoSizeEnergy");
+    TH2D *hpse = (TH2D *)htrig->GetHistByName("fHistPseudoSizeEnergy");
+    TH2D *hsbce = (TH2D *)htrig->GetHistSizeBiggerCellEnergy();
+    TH1D *hcollarea = collarea->GetHist();
+
+    // Please set rootfile as the directory where you want to store
+    // your file.root containing histograms
+    rootfile = new TString(filename);
+    if (rootfile->Index("/*.root",1)>=0){
+      rootfile->Resize(rootfile->Index("/*.root",1));
+      rootfile[0]+="_sbcmag18_CNN3.root";
+    }
+      
+    hfile = new TFile((char *)rootfile[0], "RECREATE");
+    hlps->Write();
+    hps->Write();
+    hsbc->Write();
+    hlpsn->Write();
+    hpsn->Write();
+    hsbcn->Write();
+    hlpse->Write();
+    hpse->Write();
+    hsbce->Write();
+    hcollarea->Write();
     hfile->Close();
+    cout << "Histograms stored into " << rootfile[0] << endl;
+    
 
 }
Index: trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc
===================================================================
--- trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc	(revision 2488)
+++ trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc	(revision 2489)
@@ -79,11 +79,11 @@
     fTitle = title ? title : "Trigger L2 image parameters";
 
-    fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                12,   0, 12);
+    fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                13,   0, 13);
     fHistPseudoSize     = new TH1F("fHistPseudoSize",   "Multiplicity of the cluster identified by the L2T",    397,   0, 397);
-    fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            36,   0, 36);
-
-    fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                12,   0, 12);
+    fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            37,   0, 37);
+
+    fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                13,   0, 13);
     fHistPseudoSizeNorm     = new TH1F("fHistPseudoSizeNorm",   "Normalized Multiplicity of the cluster identified by the L2T",    397,   0, 397);
-    fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            36,   0, 36);
+    fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            37,   0, 37);
 
     fHistLutPseudoSize->SetDirectory(NULL);
@@ -329,6 +329,14 @@
 //  so remember to cast the returned object if you want to work with it.
 //
-TH1 *MHMcTriggerLvl2::GetHistByName(const TString name)
-{
+TObject *MHMcTriggerLvl2::GetHistByName(const TString name) const
+{
+  
+    if (name.Contains("fHistLutPseudoSizeEnergy", TString::kIgnoreCase))
+	return fHistLutPseudoSizeEnergy;
+    if (name.Contains("fHistSizeBiggerCellEnergy", TString::kIgnoreCase))
+        return fHistSizeBiggerCellEnergy;
+    if (name.Contains("fHistPseudoSizeEnergy", TString::kIgnoreCase))
+        return fHistPseudoSizeEnergy;
+
     if (name.Contains("fHistLutPseudoSize", TString::kIgnoreCase))
       return fHistLutPseudoSize;
@@ -344,11 +352,4 @@
     if (name.Contains("fHistPseudoSizeNorm", TString::kIgnoreCase))
         return fHistPseudoSizeNorm;
-
-    if (name.Contains("fHistLutPseudoSizeEnergy", TString::kIgnoreCase))
-	return fHistLutPseudoSizeEnergy;
-    if (name.Contains("fHistSizeBiggerCellEnergy", TString::kIgnoreCase))
-        return fHistSizeBiggerCellEnergy;
-    if (name.Contains("fHistPseudoSizeEnergy", TString::kIgnoreCase))
-        return fHistPseudoSizeEnergy;
 	    
     return NULL;
Index: trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h
===================================================================
--- trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h	(revision 2488)
+++ trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h	(revision 2489)
@@ -43,5 +43,5 @@
     Bool_t Fill(const MParContainer *par, const Stat_t w=1);
 
-    TH1 *GetHistByName(const TString name);
+    TObject *GetHistByName(const TString name) const;
 
     TH1F *GetHistLutPseudoSize() const { return fHistLutPseudoSize; }
