Changeset 2365 for trunk


Ignore:
Timestamp:
09/29/03 17:39:49 (21 years ago)
Author:
stamerra
Message:
*** empty log message ***
Location:
trunk/MagicSoft
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2363 r2365  
    11                                                 -*-*- END OF LINE -*-*-
    2  
     2  2003/09/29: Nicola Galante & Antonio Stamerra
     3
     4   * mmc/MMcTrig.cxx:
     5     - Fixed a bug in function IsPixelFired():  the binary shift, introduced
     6       by T.B. to replace "pow" for power of two, was wrong.
     7       The correct operator to be used is "<<" and not ">>"!
     8
     9   * manalysis/MMcTriggerLvl2.[h,cc]:
     10     - Added method "CalcEnergy(MMcEvt *)" used to get correlation between
     11       energy and size.
     12     - Removed graphical functions "Drawcell" and "DrawLvl1"
     13     - Fixed bug in the pixcell setting (pixel numbering in the cell starts
     14       from 0 but gsPixelInLut starts from 1).   
     15     - Fixed bug in the "check" variable.       
     16
     17   * manalysis/MMcTriggerCalc.[h,cc]:
     18     - Added call to MMcTriggerLvl2::CalcEnergy() in Process()
     19     - Removed 'const' from fMcEvt declaration 
     20
     21   * mhistmc/MHMcTriggerLvl2.[h,cc]:
     22     - Added method "Draw2DHist" (draw correlation between
     23       energy and size)
     24     - Fixed bug in "DrawClone" function (histogram normalization)
     25
     26   * macros/triglvl2.C:
     27     - Fixed a bug in the task list order to apply correctly the filters
     28     - Now it writes on disk a root file with some histograms
     29
     30
    331 2003/09/26: Robert Wagner
    432   * mfileio/MCT1ReadPreProc.cc
  • trunk/MagicSoft/Mars/macros/triglvl2.C

    r1991 r2365  
    2424    parlist.AddToList(&tasklist);
    2525
    26     MGeomCamMagic geocam;
    27     parlist.AddToList(&geocam);
    28 
    29     //    MHillas hillas;
    30     // parlist.AddToList(&hillas);
    31 
    32     // An instance of the class MMcTriggerLvl2 is created and added to the
    33     //  parameter list
    34     MMcTriggerLvl2 cell;     
    35     parlist.AddToList(&cell);
    36 
    37     // Set the number of Next Neighbourhoods that define a compact pixel
    38     //
    39     cell.SetCompactNN(3);
    40     //  USER:       --^
    41 
    42     //
    43     //  A filter to select events using the L2T parameters is created
    44     //
    45     MF lvl2filter("MMcTriggerLvl2.fLutPseudoSize > 8");
    46 
    47     //
    48     // A second filter is created using the class MFTriggerLvl2
    49     //
    50     MFTriggerLvl2 fTrig("MMcTriggerLvl2", '>', 8);
    51     //      USER:       fValue to be compared --^
    52 
    53     //
    54     // A selection on the number and energy of the events
    55     //
    56     MF energyfilter("MMcEvt.fEnergy > 100");
    57     MFEventSelector selector;
    58     //selector.SetNumSelectEvts(4000);
    59 
    60 
    61     // Filter to select events according to a give slope
    62     MFEnergySlope eslope;
    63 
    64     eslope.SetMcMinEnergy(50.);
    65     eslope.SetMcMaxEnergy(400.);
    66     eslope.SetNewSlope(-3.91);
    67 
    68     // A filter list is created; the filters created can be added to the list
    69     //
    70     MFilterList flist;
    71     //   flist.AddToList(&energyfilter);
    72     //   flist.AddToList(&lvl2filter);
    73     //   flist.AddToList(&selector);
    74     //   flist.AddToList(&eslope);
    75        flist.AddToList(&fTrig);
    76 
    77 
    7826    //
    7927    // Setup our tasks:
     
    8129    //  - Then we can fill the efficiency histograms
    8230    //
     31   
     32
    8333    MReadMarsFile reader("Events", filename);
    8434    reader.DisableAutoScheme();
     
    8939    tasklist.AddToList(&reader);
    9040
     41    MGeomCamMagic geocam;
     42    parlist.AddToList(&geocam);
     43
     44    //    MHillas hillas;
     45    // parlist.AddToList(&hillas);
     46
     47    // An instance of the class MMcTriggerLvl2 is created and added to the
     48    //  parameter list
     49    MMcTriggerLvl2 cell;     
     50    parlist.AddToList(&cell);
     51
     52    MMcEvt mevt;
     53    parlist.AddToList(&mevt);
     54
     55    // Set the number of Next Neighbourhoods that define a compact pixel
     56    //
     57    cell.SetCompactNN(2);
     58    //  USER:       --^
     59
     60    //
     61    //  A filter to select events using the L2T parameters is created
     62    //
     63
     64    // MF lvl2filter("MMcTriggerLvl2.fPseudoSize > 25 && MMcTriggerLvl2.fPseudoSize < 31");
     65    MF lvl2filter("MMcTriggerLvl2.fPseudoSize > 15");
     66 
     67    //
     68    // A second filter is created using the class MFTriggerLvl2
     69    //
     70    MFTriggerLvl2 fTrig("MMcTriggerLvl2", '>', 8);
     71    //      USER:       fValue to be compared --^
     72
     73    //
     74    // A selection on the number and energy of the events
     75    //
     76    MF energyfilter("MMcEvt.fEnergy > 100");
     77    MFEventSelector selector;
     78    //selector.SetNumSelectEvts(4000);
     79
     80
     81    // Filter to select events according to a give slope
     82    MFEnergySlope eslope;
     83
     84    eslope.SetMcMinEnergy(50.);
     85    eslope.SetMcMaxEnergy(400.);
     86    eslope.SetNewSlope(-.5);
     87
     88    // A filter list is created; the filters created can be added to the list
     89    //
     90    MFilterList flist;
     91    //flist.AddToList(&energyfilter);
     92    //flist.AddToList(&lvl2filter);
     93    //   flist.AddToList(&selector);
     94    //   flist.AddToList(&eslope);
     95    //   flist.AddToList(&fTrig);
     96
     97
     98   
     99    //
     100    // The task to calculate the L2T parameter is added to the task list
     101    //
     102    MMcTriggerLvl2Calc calcps("MMcTriggerLvl2","MMcTriggerLvl2"); 
     103    tasklist.AddToList(&calcps);
     104
    91105    //
    92106    // The filter list is added to the task list
     
    98112    //
    99113    MMcCollectionAreaCalc effi;
    100     tasklist.AddToList(&effi);
    101 
     114    tasklist.AddToList(&effi);   
    102115    //
    103116    // The filter list selects events for the effective area calculation
     
    105118    effi.SetFilter(&flist);
    106119 
    107     //
    108     // The task to calculate the L2T parameter is added to the task list
    109     //
    110     MMcTriggerLvl2Calc fill("MMcTriggerLvl2","MMcTriggerLvl2"); 
    111     tasklist.AddToList(&fill);
    112120
    113121    //
     
    116124    MFillH hfill1("MHMcTriggerLvl2","MMcTriggerLvl2");
    117125    tasklist.AddToList(&hfill1);
    118 
     126    //hfill1.SetFilter(&flist);
     127    //MFillH hfill2("MHMcTriggerLvl2", &mevt, &cell);
     128    //tasklist.AddToList(&hfill2);
     129    //hfill2.SetFilter(&flist);
     130
     131   
     132   
    119133    //
    120134    // set up the loop for the processing
     
    123137    magic.SetParList(&parlist);
    124138
     139   
    125140    //
    126141    // Start to loop over all events
     
    129144    magic.SetProgressBar(&bar);
    130145
     146
    131147    if (!magic.Eventloop())
    132148      return;
     149    /*
     150    if (!magic.PreProcess())
     151    return;
     152   
     153    while (tasklist.Process())
     154      {
     155        cout<< mevt.GetEnergy()<<endl;
     156       
     157        cell.Print();
     158      }
     159    */
     160    //fMcEvt = (MMcEvt*)parlist->FindObject("MMcEvt");
     161    //if (!fMcEvt)
     162    //{
     163    //cout << "MMcEvt not found... exit." << endl;
     164    //*fLog << err << dbginf << "MMcEvt not found... exit." << endl;
     165    //  return kFALSE;
     166    //}
     167    //   cout << "fMcEvt = " << fMcEvt << endl;
     168
     169    //parlist.FindObject("MHMcTriggerLvl2")->Fill((Double_t) fMcEvt->GetEnergy(), cell);
     170
    133171
    134172    tasklist.PrintStatistics();
     
    140178    parlist.FindObject("MHMcCollectionArea")->DrawClone();
    141179
     180    parlist.FindObject("MHMcTriggerLvl2")->DrawClone("sbc");
    142181    parlist.FindObject("MHMcTriggerLvl2")->DrawClone("lps");
    143     //     parlist.FindObject("MHMcTriggerLvl2")->DrawClone();
     182    parlist.FindObject("MHMcTriggerLvl2")->DrawClone();
     183    parlist.FindObject("MHMcTriggerLvl2")->DrawClone("energy");
    144184
    145185    // Returns histogram of the class MHMcTriggerLvl2 
    146     //   parlist.FindObject("MHMcTriggerLvl2")->GetHistByName("hfPseudoSize"));
    147    
     186
     187    MHMcTriggerLvl2 *htrig = (MHMcTriggerLvl2 *)parlist.FindObject("MHMcTriggerLvl2");
     188    TH1F *h1 = htrig->GetHistByName("fHistPseudoSize");
     189    TH2D *h2 = htrig->GetHistPseudoSizeEnergy();
     190
     191    // h2->DrawClone();
     192
     193    hfile = new TFile("HistFileLUT.root", "RECREATE");
     194    h1->Write();
     195    h2->Write();
     196    hfile->Close();
     197
    148198}
    149199
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc

    r2229 r2365  
    1818!   Author(s): Antonio Stamerra  1/2003 <mailto:antono.stamerra@pi.infn.it>
    1919!   Author(s): Marcos Lopez 1/2003 <mailto:marcos@gae.ucm.es>
     20!   Author(s): Nicola Galante 7/2003 <mailto:nicola.galante@pi.infn.it>
    2021!
    2122!   Copyright: MAGIC Software Development, 2000-2003
     
    4849#include "MGeomPix.h"
    4950#include "MGeomCamMagic.h"
    50 #include "MHCamera.h"
    5151
    5252#include "MMcTrig.hxx"
     53
     54#include "MMcEvt.hxx"
    5355
    5456#include "MLog.h"
     
    144146MMcTriggerLvl2::~MMcTriggerLvl2()
    145147{
    146   delete fCam;
    147148  delete fGeomCam;
    148149}
     
    218219  fMcTrig = trig;
    219220
    220   //fMcTrig->PrintPixelsFirstLevel();
    221  
    222221  for(int i=0; i<36; i++)
    223222    {
     
    227226          fPixels[i][j] = (fMcTrig->IsPixelFired(pixel,0)) ? 1 : 0;
    228227          fFiredPixel[pixel]=(fMcTrig->IsPixelFired(pixel,0)) ? 1 : 0;
    229         }
    230     }
     228          //if (fFiredPixel[pixel]==1)
     229          //*fLog << pixel<<",";
     230        }
     231    }
     232  //*fLog<<endl<<"Fine evento"<<endl;
    231233}
    232234
     
    269271  fSizeBiggerCell = GetCellNumberFired(CalcBiggerFiredCell());
    270272
    271 }
    272 
    273 
    274 // --------------------------------------------------------------------------
    275 //
    276 //  Display the MAGIC Camera a draw the pixels corresponding to a given cell
    277 //  (preliminary)   <to be fixed>
    278 //
    279 void MMcTriggerLvl2::DrawCell(Int_t cell)
    280 {
    281 
    282   if(cell>18) return;
    283 
    284   //
    285   // Use MHCamera class variable for avoiding to create a MHCamera each
    286   // time this function is called. Also, now all the hexagons are drawn in
    287   // the same camera pad
    288   //
    289   if (!fGeomCam)
    290     fGeomCam = new MGeomCamMagic; 
    291   if (!fCam)
    292     {
    293       fCam = new MHCamera(*fGeomCam);
    294       fCam->Draw();
    295       fCam->DrawPixelIndices();
    296     }
    297 
    298   //fCam->Draw();
    299   fCam->Reset();
    300 
    301   int color=0;
    302 
    303   for(int i=0; i<36; i++)
    304     {
    305       color = (fPixels[i][cell]) ? 5 : 3;
    306       fCam->SetPix( gsPixelsInCell[i][cell]-1, color, 1, 5 );
    307     }
    308  
    309   //
    310   // Update the display (paint the camera with the new colors)
    311   //
    312   gPad->Modified();
    313   gPad->Update();
    314 }
    315 
    316 
    317 
    318 // --------------------------------------------------------------------------
    319 //
    320 //  Display the MAGIC camera and draw all the pixel fired after Lvl1
    321 //  (preliminary)   <to be fixed>
    322 //
    323 //
    324 void MMcTriggerLvl2::DrawLv1()
    325 {
    326   //
    327   // Use MHCamera class variable for avoiding to create a MHCamera each
    328   // time this function is called. Also, now all the hexagons are drawn in
    329   // the same camera pad
    330   //
    331   //  !FixMe! Delete this method when the trigger display is available!
    332   //
    333   if (!fGeomCam)
    334     fGeomCam = new MGeomCamMagic; 
    335   if (!fCam)
    336     {
    337       fCam = new MHCamera(*fGeomCam);
    338       fCam->Draw(); 
    339       fCam->DrawPixelIndices();
    340     }
    341 
    342   //
    343   // Set the array of colors for each pixel (that will be painted after
    344   // updating the dispaly)
    345   //
    346   int color=0;
    347 
    348   for(int i=0; i<577; i++)
    349     {
    350       color = (fMcTrig->IsPixelFired(i,0)) ? 1 : 2;
    351       fCam->SetPix( i, color, 1, 5 );
    352     }
    353 
    354   //
    355   // Update the display (paint the camera with the new colors)
    356   //
    357   gPad->Modified();
    358   gPad->Update();
    359 
    360 }
     273  //*fLog << "fLPS="<<fLutPseudoSize<<endl;
     274}
     275
     276
    361277
    362278// --------------------------------------------------------------------------
     
    432348    }
    433349 
    434   //  *fLog <<"Max cell: " << cell+1 << "  Max Lut: " << lut+1 << "  PseudoSize: " << size <<endl;
     350  //*fLog <<"Max cell: " << cell+1 << "  Max Lut: " << lut+1 << "  PseudoSize: " << size <<endl;
    435351   
    436352  return cell*10+lut;
     
    708624  int maxlut = cellut - maxcell*10;
    709625  int startpix;
     626  //if (GetLutCompactPixel(maxcell,maxlut)==0)
     627    //*fLog << "Max lut size:" << GetLutCompactPixel(maxcell,maxlut) <<endl;
    710628
    711629  //
     
    715633  for (int pixlut=0;pixlut<12;pixlut++)
    716634    {
    717       int pixcell =gsPixelsInLut[maxlut][pixlut];
     635      int pixcell =gsPixelsInLut[maxlut][pixlut]-1;
    718636      startpix = gsPixelsInCell[pixcell][maxcell]-1;
    719       *fLog << "pix, compact:" << startpix << "@"<<fCompactPixel[startpix];
     637      //*fLog << "pix, compact:" << startpix << "@"<<fCompactPixel[startpix];
    720638      if (fCompactPixel[startpix]) // a starting pixel was found
    721639        break;
     
    723641    }
    724642
     643  //*fLog << "check = " << check << endl;
    725644  // A LUT contains 12 pixels
    726   if (check >= 12)
    727     {
    728     *fLog <<"Error: a starting pixels was not found!"<<endl;
    729     return;
     645  if (check > 12)
     646    {
     647      check=1;
     648      // A starting pixel was not found using the LutPseudoSize.
     649      // We look for it in the BiggerCell
     650      maxcell=CalcBiggerFiredCell();
     651      for (int pixcell=0;pixcell<36;pixcell++)
     652        {
     653          startpix = gsPixelsInCell[pixcell][maxcell]-1;
     654          //*fLog << "pix, compact:" << startpix << "@"<<fCompactPixel[startpix];
     655          if (fCompactPixel[startpix]) // a starting pixel was found
     656            break;
     657          check++;
     658        }
     659      if (check > 36)
     660        {   
     661           *fLog <<"Error: a starting pixels was not found! - PseudoSize = "<< fPseudoSize << endl;
     662          fPseudoSize=0;
     663          return;
     664        }
    730665    }
    731666  //
     
    755690          int pix_neigh = pix.GetNeighbor(i);
    756691          // check if pixel is fired and doesn't belong to cluster
    757           if (fFiredPixel[pix_neigh] && !cluster[pix_neigh])
     692          if (fCompactPixel[pix_neigh] && !cluster[pix_neigh])
     693          //if (fCompactPixel[pix_neigh])
    758694            {
    759695              cluster[pix_neigh] = 1;
     
    765701
    766702  fPseudoSize = pnt;
     703  //if (fPseudoSize < 4)
     704    //    *fLog << "fPseudoSize = " << fPseudoSize << endl;
    767705
    768706  //  *fLog << "ClusterID:" <<(*clust).GetClusterId() << " Mult:" << (*clust).GetMultiplicity()<<endl; 
    769707
    770   *fLog <<"PSize: "<< fPseudoSize << " in cell:" << maxcell << " lut:" <<maxlut <<endl;
     708  //  *fLog <<"PSize: "<< fPseudoSize << " in cell:" << maxcell << " lut:" <<maxlut <<endl;
    771709
    772710  return;
     
    786724{
    787725  memset (fCompactPixel,0,397*sizeof(Int_t));
    788  
     726  //  *fLog << endl << "NEW Event!";
    789727  for(UInt_t pixid=0;pixid<397;pixid++)
    790728    {
     
    798736      // A compact pixel must have at least fCompactNN adjacent neighbors
    799737      // It checks the 6 different configurations of neighbors pixels
     738      int j=0;
    800739      for (int i=0;i<pix.GetNumNeighbors();i++)
    801740        {
    802           int j=0;
    803           while (fFiredPixel[pix.GetNeighbor(i+j)]==1 && j < fCompactNN)
     741          //*fLog << pixid <<"->"<< pix.GetNeighbor(i+j) << endl;
     742          while ((fFiredPixel[pix.GetNeighbor(i+j)]==1) && (j < fCompactNN))
    804743            j++; 
    805744          if (j!=fCompactNN)  continue;  // configuration doesn't satisfy compact condition 
     
    807746          fCompactPixel[pixid]=1; // pixel is compact
    808747
    809           *fLog << ","<<pixid;
     748          //      *fLog << ","<<pixid;
    810749
    811750          break;
     
    816755
    817756
     757void MMcTriggerLvl2::CalcEnergy(MMcEvt *fMcEvt)
     758{
     759  const MMcEvt &h = *(MMcEvt *)fMcEvt;
     760  fEnergy = h.GetEnergy();
     761}
     762
     763
     764
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h

    r2210 r2365  
    88class MMcTrig;
    99
    10 class MHCamera;
     10class MMcEvt;
     11
    1112class MGeomCamMagic;
    1213
     
    3637  Int_t fCluster_pix[397]; //Array with pixel in cluster
    3738
     39  Double_t fEnergy;  // Energy of the shower
     40
     41
    3842  MMcTrig *fMcTrig;
    3943  MGeomCam *fGeomCam; 
    40   MHCamera *fCam;
    41   //  MCluster *fClust;
    4244
    4345  Int_t CalcBiggerFiredCell();
     
    5254  ~MMcTriggerLvl2(); 
    5355 
    54   void DrawCell(Int_t cell); 
    55   void DrawLv1();
    5656
    5757  virtual void Calc();
     
    7474  void CalcCompactPixels(MGeomCam *fCam);
    7575
     76  void CalcEnergy(MMcEvt *fMcEvt = NULL);
     77
     78  Double_t GetEnergy() const    {return fEnergy;}
     79
    7680
    7781  ClassDef(MMcTriggerLvl2,0) // Container for 2nd Level Trigger selection parameters
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc

    r2206 r2365  
    132132Int_t MMcTriggerLvl2Calc::Process()
    133133{
    134   //const Float_t energy = fMcEvt->GetEnergy();
     134  fMMcTriggerLvl2->CalcEnergy(fMcEvt);
    135135
    136136  fMMcTriggerLvl2->SetLv1(fMcTrig);
     
    139139
    140140  fMMcTriggerLvl2->Calc();
    141 
    142   //fMMcTriggerLvl2->DrawLv1();
    143   //fMMcTriggerLvl2->DrawCell(fMMcTriggerLvl2->GetBiggerFiredCell() );
    144   //fMMcTriggerLvl2->Print();
    145141
    146142  return kTRUE;
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.h

    r2206 r2365  
    2020 private:
    2121
    22   const MMcEvt  *fMcEvt;
     22  MMcEvt  *fMcEvt;
    2323  MMcTrig *fMcTrig;
    2424
  • trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.cc

    r2173 r2365  
    3333#include "MHMcTriggerLvl2.h"
    3434
    35 #include <math.h>
    36 
     35#include <TMath.h>
     36
     37#include <TH2.h>
    3738#include <TH1.h>
    3839#include <TF1.h>
     
    4849
    4950#include "MMcTriggerLvl2.h"
    50 #include "MGeomCam.h"
    51 #include "MBinning.h"
    5251
    5352using namespace std;
    54 
    55 /*
    56  Please, DON'T USE IFDEFS IN SUCH A CONTEXT, Thomas.
    57  --------------------------------------------------
    58 #ifndef COLOR_LINELPS
    59 #define COLOR_LINELPS Int_t colorlps = 1
    60 COLOR_LINELPS;
    61 #endif
    62 
    63 #ifndef COLOR_LINESBC
    64 #define COLOR_LINESBC Int_t colorsbc = 1
    65 COLOR_LINESBC;
    66 #endif
    67 
    68 #ifndef COLOR_LINEPS
    69 #define COLOR_LINEPS Int_t colorps = 1
    70 COLOR_LINEPS;
    71 #endif
    72 */
    7353
    7454/* Use this insteadif you want to have some value which is the same for all
     
    8060Int_t MHMcTriggerLvl2::fColorSbc = 1;
    8161Int_t MHMcTriggerLvl2::fColorPs = 1;
     62Int_t MHMcTriggerLvl2::fColorPsE = 1;
    8263
    8364ClassImp(MHMcTriggerLvl2);
     
    9576    fTitle = title ? title : "Trigger L2 image parameters";
    9677
    97     fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                13,   0, 12);
    98     fHistPseudoSize     = new TH1F("fHistPseudoSize",   "Multiplicity of the cluster identified by the L2T",    41,   0, 40);
    99     fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            37,   0, 36);
    100 
    101     fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                13,   0, 12);
    102     fHistPseudoSizeNorm     = new TH1F("fHistPseudoSizeNorm",   "Normalized Multiplicity of the cluster identified by the L2T",    41,   0, 40);
    103     fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            37,   0, 36);
     78    fHistLutPseudoSize  = new TH1F("fHistLutPseudoSize",  "number of compact pixels in one lut",                12,   0, 12);
     79    fHistPseudoSize     = new TH1F("fHistPseudoSize",   "Multiplicity of the cluster identified by the L2T",    397,   0, 397);
     80    fHistSizeBiggerCell  = new TH1F("fHistSizeBiggerCell",   "Number of fired pixel in bigger cell",            36,   0, 36);
     81
     82    fHistLutPseudoSizeNorm  = new TH1F("fHistLutPseudoSizeNorm",  "Normalized Number of compact pixels in one lut",                12,   0, 12);
     83    fHistPseudoSizeNorm     = new TH1F("fHistPseudoSizeNorm",   "Normalized Multiplicity of the cluster identified by the L2T",    397,   0, 397);
     84    fHistSizeBiggerCellNorm  = new TH1F("fHistSizeBiggerCellNorm",   "Normalized Number of fired pixel in bigger cell",            36,   0, 36);
    10485
    10586    fHistLutPseudoSize->SetDirectory(NULL);
     
    124105    fHistSizeBiggerCellNorm->SetYTitle("Counts/Total Counts");
    125106
    126     fFNorm = new TF1("FNorm", "1", -1, 40);
     107    fHistPseudoSizeEnergy = new TH2D("fHistPseudoSizeEnergy","Ps Size vs Energy", 40, 1, 5, 397, 0,397);
     108 
     109    fHistPseudoSizeEnergy->SetName("fHistPseudoSizeEnergy");
     110    fHistPseudoSizeEnergy->SetTitle("PseudoSize vs. Energy");
     111    fHistPseudoSizeEnergy->SetXTitle("Log(E[GeV])");
     112    fHistPseudoSizeEnergy->SetYTitle("PseudoSize");
     113
     114    fFNorm = new TF1("FNorm", "1", -1, 397);
    127115}
    128116
     
    139127    delete fHistPseudoSizeNorm;
    140128    delete fHistSizeBiggerCellNorm;
     129    delete fHistPseudoSizeEnergy;
    141130
    142131    delete fFNorm;
    143132}
     133
    144134
    145135// --------------------------------------------------------------------------
     
    155145  fHistPseudoSize->Fill(h.GetPseudoSize());
    156146  fHistSizeBiggerCell->Fill(h.GetSizeBiggerCell());
     147  //fHistPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetPseudoSize());
     148  fHistPseudoSizeEnergy->Fill(TMath::Log10(h.GetEnergy()), h.GetLutPseudoSize());
    157149
    158150  return kTRUE;
    159151}
     152
     153
    160154
    161155
     
    186180    histNorm.SetLineColor(col);
    187181    histNorm.DrawCopy(same?"same":"");
     182
     183    return c;
     184}
     185
     186
     187// --------------------------------------------------------------------------
     188//
     189// This is the private function member which draw a clone of a 2D-histogram.
     190// This method is called by the DrawClone method.
     191//
     192TObject *MHMcTriggerLvl2::Draw2DHist(TH1 &hist, const TString &canvasname, Int_t &col) const
     193{
     194    col++;
     195
     196    TCanvas *c = (TCanvas*)gROOT->FindObject(canvasname);
     197
     198    Bool_t same = kTRUE;
     199    if (!c)
     200    {
     201        c = MakeDefCanvas(canvasname,canvasname, 800, 600);
     202        same = kFALSE;
     203    }
     204
     205    hist.SetLineColor(col);
     206    hist.DrawCopy(same?"same":"");
    188207
    189208    return c;
     
    213232    if (!str.Contains("lps", TString::kIgnoreCase) &&
    214233        !str.Contains("sbc", TString::kIgnoreCase) &&
    215         !str.Contains("ps",  TString::kIgnoreCase))
     234        !str.Contains("ps",  TString::kIgnoreCase) &&
     235        !str.Contains("energy",  TString::kIgnoreCase))
    216236    {
    217237        *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl;
     
    219239    }
    220240
    221     TH1 *hist=NormalizeHist(fHistLutPseudoSizeNorm, fHistLutPseudoSize);
    222 
    223     if (!hist)
    224         return NULL;
    225 
    226     if (str.Contains("lps",TString::kIgnoreCase))
    227         return DrawHist(*fHistLutPseudoSize, *hist, "CanvasLPS", fColorLps);
    228 
    229     if (str.Contains("sbc",TString::kIgnoreCase))
    230         return DrawHist(*fHistSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
    231 
    232     if (str.Contains("ps",TString::kIgnoreCase))
    233         return DrawHist(*fHistPseudoSize, *hist, "CanvasPS", fColorPs);
     241    if (str.Contains("lps",TString::kIgnoreCase)){
     242      TH1 *hist=NormalizeHist(fHistLutPseudoSizeNorm, fHistLutPseudoSize);
     243      return DrawHist(*fHistLutPseudoSize, *hist, "CanvasLPS", fColorLps);
     244    }
     245
     246    if (str.Contains("sbc",TString::kIgnoreCase)){
     247      TH1 *hist=NormalizeHist(fHistSizeBiggerCellNorm, fHistSizeBiggerCell);
     248      return DrawHist(*fHistSizeBiggerCell, *hist, "CanvasSBC", fColorSbc);
     249    }
     250
     251    if (str.Contains("ps",TString::kIgnoreCase)){
     252      TH1 *hist=NormalizeHist(fHistPseudoSizeNorm, fHistPseudoSize);
     253      return DrawHist(*fHistPseudoSize, *hist, "CanvasPS", fColorPs);
     254    }
     255
     256    if (str.Contains("energy",TString::kIgnoreCase))
     257      return Draw2DHist(*fHistPseudoSizeEnergy, "CanvasPSE", fColorPsE);
    234258
    235259    return NULL;
  • trunk/MagicSoft/Mars/mhistmc/MHMcTriggerLvl2.h

    r2043 r2365  
    66#endif
    77
     8class TH2D;
    89class TH1F;
    910class TF1;
     
    2021    TH1F *fHistSizeBiggerCell;       // Histogram of fSizeBiggerCell
    2122    TH1F *fHistSizeBiggerCellNorm;   // Histogram of fSizeBiggerCell normalized on integral of distribution
    22 
     23    TH2D *fHistPseudoSizeEnergy;           // 2D-Histogram of fPseudoSize vs. Energy
    2324    TF1* fFNorm;                     // Function used to normalize histograms
    2425
     
    2627    static Int_t fColorSbc;
    2728    static Int_t fColorPs;
     29    static Int_t fColorPsE;
    2830
    2931    TObject *DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &colore) const;
     32    TObject *Draw2DHist(TH1 &hist, const TString &canvasname, Int_t &col) const;
    3033   
    3134public:
     
    3437
    3538    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
    36 
     39    //    Bool_t Fill(const Double_t energy, const MParContainer *par, const Stat_t w=1);
    3740    TH1 *GetHistByName(const TString name);
    3841
     
    4346    TH1F *GetHistSizeBiggerCell()  const { return fHistSizeBiggerCell; }
    4447    TH1F *GetHistSizeBiggerCellNorm()  const { return fHistSizeBiggerCellNorm; }
     48    TH2D *GetHistPseudoSizeEnergy() const { return fHistPseudoSizeEnergy; }
    4549
    4650    void Draw(Option_t *opt=NULL);
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcTrig.cxx

    r2173 r2365  
    11#include "MMcTrig.hxx"
    22
    3 #include <iostream>
     3#include <iostream.h>
    44
    55
     
    123123  //  first level trigger happened, 0 if not.
    124124  //
    125 
     125 
    126126  const Int_t  body=npix/8;
    127   const Byte_t reminder= 1>>(npix%8);
     127  const Byte_t reminder= 1<<(npix%8);
    128128
    129129  return reminder&fPixelsFirst[body][nfirstlevel];
     130  /*
     131  Byte_t ret=0;
     132  Byte_t reminder;
     133  Int_t body;
     134
     135  body=npix/8;
     136  reminder=(Byte_t)(pow(2,npix%8));
     137  ret=reminder&fPixelsFirst[body][nfirstlevel];
     138  return(ret);
     139  */
    130140}
Note: See TracChangeset for help on using the changeset viewer.