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

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.