Changeset 2918


Ignore:
Timestamp:
01/26/04 16:10:29 (21 years ago)
Author:
galante
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2917 r2918  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6
     7 2004/01/26: Nicola Galante
     8
     9   * manalisys/MMcTriggerLvl2.[cc,h]:
     10     - Defined some static constants to avoid ugly "magic numbers"
     11       in arrays: gsNCells, gsNTrigPixels,
     12       gsNPixInCell, gsNLutInCell, gsNPixInLut, fNumPixCell.
     13     - Added method MMcTriggerLvl2::GetCellCompactPixel(int cell, MGeomCam *fCam)
     14       which computes compact pixels into a given L2T macrocell.
     15     - Added method MMcTriggerLvl2::CalcBiggerCellPseudoSize() which
     16       computes fCellPseudoSize, the maximum Pseudo Size into L2T macrocells
     17     - Added method MMcTriggerLvl2::GetCellPseudoSize() const which
     18       returns fCellPseudoSize
     19     - Added method MMcTriggerLvl2::IsPixelInCell(Int_t pixel, Int_t cell),
     20       which controls whether a pixel belongs to a given L2T cell.
     21     - Added method MMcTriggerLvl2::GetMaxCell() const which returns fMaxCell, the cell with
     22       the maximum fCellPseudoSize.
     23     - Re-declared methods MMcTriggerLvl2::CalcCompactPixels(MGeomCam *fCam)
     24       and MMcTriggerLvl2::CalcTriggerPattern(MGeomCam *fCam) as private.
     25
     26
    627 2004/01/26: Markus Gaug
    728
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc

    r2478 r2918  
    7272// This correspondence is valid only for MAGIC-like geometries!
    7373//
    74 const  Int_t  MMcTriggerLvl2::gsPixelsInCell[36][19] = {
     74//  FIXME!  These definitions should be included in a GeomTrig class
     75//
     76const  Int_t  MMcTriggerLvl2::gsPixelsInCell[gsNPixInCell][gsNCells] = {
    7577    {26,  91,  66,  71,  76,  81,  86,  269,  224,  233,  242,  251,  260,  391,  336,  347,  358,      369,  380},
    7678    {25,  61,  41,  45,  49,  53,  57,  215,  175,  183,  191,  199,  207,  325,  275,  285,  295,  305,  315},
     
    114116// corrispondence between pixels in cell and lut (pix numbering starts from 1)
    115117//
    116 const Int_t MMcTriggerLvl2::gsPixelsInLut[3][12] = {
     118const Int_t MMcTriggerLvl2::gsPixelsInLut[gsNLutInCell][gsNPixInLut] = {
    117119    { 1,  2,  3,  4,  6,  7,  8,  9, 12, 13, 14, 15},
    118120    {34, 29, 23, 16, 30, 24, 17, 10, 25, 18, 11,  5},
     
    135137  // Initialization of the fPixels array to zero
    136138  //
    137   memset (fPixels,0,36*19*sizeof(Int_t));
    138   memset (fFiredPixel,0,397*sizeof(Int_t));
     139  memset (fPixels,0,gsNPixInCell*gsNCells*sizeof(Int_t));
     140  memset (fFiredPixel,0,gsNTrigPixels*sizeof(Int_t));
    139141
    140142  // create a new camera
     
    180182    {
    181183      *fLog << "    Status of cells 1-9" <<endl;
    182       for(int i=0; i<36; i++)
     184      for(int i=0; i<gsNPixInCell; i++)
    183185        {
    184186          for(int j=0; j<9; j++)
     
    193195    {
    194196      *fLog << "   Pixel numbering in cells 1-9" <<endl;
    195       for (int i=0;i<36;i++)
     197      for (int i=0;i<gsNPixInCell;i++)
    196198        {
    197199          for(int j=0; j<9; j++)
     
    210212  else
    211213    {
    212       *fLog << "  L2T selection parameters:" << endl;
     214      *fLog << "  L2T selection parameters: " << endl;
    213215      *fLog << "   - LutPseudoSize  = " << fLutPseudoSize <<  endl;
    214       *fLog << "   - PseudoSize     = " << fPseudoSize << endl;
     216      *fLog << "   - CellPseudoSize  = " << fCellPseudoSize <<  endl;
     217      *fLog << "   - PseudoSize  = " << fPseudoSize <<  endl;
    215218      *fLog << "   - BiggerCellSize = " << fSizeBiggerCell << endl;
    216219      *fLog << "   - TriggerPattern = " << fTriggerPattern << endl;
     
    233236  fMcTrig = trig;
    234237
    235   for(int i=0; i<36; i++)
    236     {
    237       for(int j=0; j<19; j++)
     238  for(int i=0; i<gsNPixInCell; i++)
     239    {
     240      for(int j=0; j<gsNCells; j++)
    238241        {
    239242          int pixel = gsPixelsInCell[i][j]-1;
     
    256259void MMcTriggerLvl2::SetPixelFired(Int_t pixel, Int_t fired)
    257260{
    258   for(int i=0; i<36; i++)
    259     {
    260       for(int j=0; j<19; j++)
     261  for(int i=0; i<gsNPixInCell; i++)
     262    {
     263      for(int j=0; j<gsNCells; j++)
    261264        {
    262265          if(gsPixelsInCell[i][j]-1==pixel) fPixels[i][j]=fired;
     
    277280  // Find the Lut and cell with the higher LutPseudoSize.
    278281  int lutcell = CalcBiggerLutPseudoSize();
    279   int maxcell = lutcell/10;
    280   int maxlut = lutcell-maxcell*10;
    281   fLutPseudoSize = GetLutCompactPixel(maxcell,maxlut);
    282 
     282  fMaxCell = lutcell/10;
     283  int maxlut = lutcell-fMaxCell*10;
     284  fLutPseudoSize = GetLutCompactPixel(fMaxCell,maxlut);
     285
     286  fMaxCell = CalcBiggerCellPseudoSize();  // fCellPseudoSize
     287  // fMaxCell is used by the PseudoSize to find the starting pixel
    283288  CalcPseudoSize();
    284289
     
    298303  int size=0;
    299304 
    300   for(int i=0; i<36; i++)
     305  for(int i=0; i<gsNPixInCell; i++)
    301306    {
    302307      size += fPixels[i][cell];
     
    318323  int cell=-1;
    319324
    320   for(int j=0; j<19; j++)
     325  for(int j=0; j<gsNCells; j++)
    321326    {
    322327      if (GetCellNumberFired(j) > size)
     
    349354  int lut=-1;
    350355 
    351   for(int j=0; j<19; j++)
    352     {
    353       for(int i=0; i<3; i++)
     356  for(int j=0; j<gsNCells; j++)
     357    {
     358      for(int i=0; i<gsNLutInCell; i++)
    354359        {
    355360          if (GetLutCompactPixel(j,i) >= size)
     
    387392{
    388393  int size=0;
    389   int lutpix, a[12];
     394  int lutpix, a[gsNPixInLut];
    390395  int neighpix= (*this).fCompactNN;
    391396
     
    395400    return(-1);
    396401
    397   if (cell<0 || cell>18)
     402  if (cell<0 || cell> gsNCells-1)
    398403    return(-2);
    399404
    400   if (lut<0 || lut>2)
     405  if (lut<0 || lut> gsNLutInCell-1)
    401406    return(-3);
    402407
    403408
     409  //
     410  // Warning!!! Following configurations are valid only for the standard MAGIC
     411  // trigger geometry; FIXME! these should be coded somewhere else....
     412  //
     413
    404414  // LUT 1 and 2 are similar; LUT 3 differs
    405415 
    406   for(int j=0; j<12; j++)
     416  for(int j=0; j< gsNPixInLut; j++)
    407417    {
    408418      lutpix = gsPixelsInLut[lut][j]-1;
     
    613623 
    614624
    615   if(size<0 ||size>12)
     625  if(size<0 ||size>gsNPixInLut)
    616626    *fLog << "*" << size <<"-";
    617627 
     
    634644  // seek the LUT with higher number of compact pixels
    635645  //
    636   int cellut = CalcBiggerLutPseudoSize();
    637   int maxcell = cellut/10;
    638   int maxlut = cellut - maxcell*10;
     646  //int fMaxCell = CalcBiggerCellPseudoSize();
     647  int sizetemp=0;
     648  int maxlut=0;
     649
     650  for (int i=0;i<gsNLutInCell;i++)
     651    if (GetLutCompactPixel(fMaxCell,i) > sizetemp)
     652      {
     653        maxlut=i;
     654        sizetemp = GetLutCompactPixel(fMaxCell,i);
     655      }
     656
    639657  int startpix;
    640   //if (GetLutCompactPixel(maxcell,maxlut)==0)
    641     //*fLog << "Max lut size:" << GetLutCompactPixel(maxcell,maxlut) <<endl;
    642 
    643658  //
    644   // seek a starting pixel in the lut for the iteration
     659  // seek a starting pixel for the iteration inside the lut
    645660  //
    646661  int check=1;
    647   for (int pixlut=0;pixlut<12;pixlut++)
     662  for (int pixlut=0;pixlut<gsNPixInLut;pixlut++)
    648663    {
    649664      int pixcell =gsPixelsInLut[maxlut][pixlut]-1;
    650       startpix = gsPixelsInCell[pixcell][maxcell]-1;
     665      startpix = gsPixelsInCell[pixcell][fMaxCell]-1;
    651666      //*fLog << "pix, compact:" << startpix << "@"<<fCompactPixel[startpix];
    652667      if (fCompactPixel[startpix]) // a starting pixel was found
    653         break;
     668                break;
    654669      check++;
    655670    }
     
    657672  //*fLog << "check = " << check << endl;
    658673  // A LUT contains 12 pixels
    659   if (check > 12)
    660     {
    661       check=1;
    662       // A starting pixel was not found using the LutPseudoSize.
    663       // We look for it in the BiggerCell
    664       maxcell=CalcBiggerFiredCell();
    665       for (int pixcell=0;pixcell<36;pixcell++)
    666         {
    667           startpix = gsPixelsInCell[pixcell][maxcell]-1;
    668           //*fLog << "pix, compact:" << startpix << "@"<<fCompactPixel[startpix];
    669           if (fCompactPixel[startpix]) // a starting pixel was found
    670             break;
    671           check++;
    672         }
    673       if (check > 36)
    674         {   
    675           //       *fLog <<"Warning: a starting pixel was not found! - PseudoSize = "<< fPseudoSize << endl;
    676           fPseudoSize=-1;
    677           return;
    678         }
    679     }
     674  if (check > gsNPixInLut)
     675          {   
     676                   *fLog <<"Warning: a starting pixel was not found! - PseudoSize = "<< fPseudoSize << endl;
     677            fPseudoSize=-1;
     678            return;
     679          }
     680
    680681  //
    681682  // Bulding cluster
    682683  //
    683   Int_t cluster[397];
     684  Int_t cluster[gsNTrigPixels];
    684685  int pnt=0;
    685686  int pnt2=0; //pointer in the array fCluster_pix, needed for filling
    686687
    687   memset (cluster,0,397*sizeof(Int_t));
    688   memset (fCluster_pix,-1,397*sizeof(Int_t));
     688  memset (cluster,0,gsNTrigPixels*sizeof(Int_t));
     689  memset (fCluster_pix,-1,gsNTrigPixels*sizeof(Int_t));
    689690
    690691  cluster[startpix]=1; 
     
    701702
    702703      for (int i=0;i<pix.GetNumNeighbors();i++)
    703         {
    704           int pix_neigh = pix.GetNeighbor(i);
    705           // check if pixel is fired and doesn't belong to cluster
    706           if (fCompactPixel[pix_neigh] && !cluster[pix_neigh])
    707           //if (fCompactPixel[pix_neigh])
    708704            {
    709               cluster[pix_neigh] = 1;
    710               fCluster_pix[++pnt2] = pix_neigh;
     705               int pix_neigh = pix.GetNeighbor(i);
     706               // check if pixel is fired and doesn't belong to cluster
     707               if (fCompactPixel[pix_neigh] && !cluster[pix_neigh])
     708                 {
     709                    cluster[pix_neigh] = 1;
     710                    fCluster_pix[++pnt2] = pix_neigh;
     711                 }
    711712            }
    712         }
    713713      pnt++;
    714714    }
    715715
    716716  fPseudoSize = pnt;
     717
    717718  //if (fPseudoSize < 4)
    718719    //    *fLog << "fPseudoSize = " << fPseudoSize << endl;
    719720
    720721  //  *fLog << "ClusterID:" <<(*clust).GetClusterId() << " Mult:" << (*clust).GetMultiplicity()<<endl; 
    721 
    722   //  *fLog <<"PSize: "<< fPseudoSize << " in cell:" << maxcell << " lut:" <<maxlut <<endl;
    723 
     722  /*
     723  *fLog <<"PSize: "<< fPseudoSize << " in cell:" << fMaxCell << " lut:" <<maxlut << endl << "   Pixels: ";
     724  for (int i =0;i<fPseudoSize; i++)
     725    *fLog << fCluster_pix[i]+1 <<"; ";
     726  *fLog << endl;
     727  */
    724728  return;
    725729}
     
    737741void MMcTriggerLvl2::CalcCompactPixels(MGeomCam *geom)
    738742{
    739   memset (fCompactPixel,0,397*sizeof(Int_t));
     743  memset (fCompactPixel,0,gsNTrigPixels*sizeof(Int_t));
    740744  //  *fLog << endl << "NEW Event!";
    741   for(UInt_t pixid=0;pixid<397;pixid++)
     745  for(Int_t pixid=0; pixid<gsNTrigPixels; pixid++)
    742746    {
    743747      // Look if the pixel is fired, otherwise continue
    744748      if (!fFiredPixel[pixid])
    745         continue;
     749             continue;
    746750     
    747751      const MGeomPix &pix=(*geom)[pixid];
    748752     
     753      // Reshuffle pixneighbour order, to arrange them (anti)clockwise
     754      //   around the current pixel (Bubble sorting)
     755      // The NeighPixOrdered array has a doubledd size so that
     756      // the content in the first index is repeated in the last one
     757      // to have a closed loop
     758
     759      Int_t NeighPixOrdered[2*pix.GetNumNeighbors()];
     760
     761      for (Int_t j=0; j<pix.GetNumNeighbors(); j++)
     762        NeighPixOrdered[j] = pix.GetNeighbor(j);
     763     
     764      for (Int_t j=0; j<pix.GetNumNeighbors()-1; j++)
     765        {
     766          for (Int_t jk=pix.GetNumNeighbors()-1;jk>j;--jk)
     767            {
     768               UInt_t tmp = NeighPixOrdered[j+1];
     769               const MGeomPix &pixneigh = (*geom)[NeighPixOrdered[j]];
     770               for (int k=0; k<pix.GetNumNeighbors(); k++)
     771                 if (NeighPixOrdered[jk] == pixneigh.GetNeighbor(k))
     772                       {
     773                      NeighPixOrdered[j+1] = NeighPixOrdered[jk];
     774                      NeighPixOrdered[jk] = tmp;
     775                   }
     776                }
     777        }
     778     
     779      // Duplicate second half to take into account configurations
     780          //  containing tha last and first pixel
     781      for (Int_t j=pix.GetNumNeighbors(); j<2*pix.GetNumNeighbors(); j++)
     782        NeighPixOrdered[j] = NeighPixOrdered[j-pix.GetNumNeighbors()];
     783
    749784      // Look for compact pixels.
    750       // A compact pixel must have at least fCompactNN adjacent neighbors
    751       // It checks the 6 different configurations of neighbors pixels
    752       int j=0;
     785      // A compact pixel must have at least fCompactNN adjacent fired neighbors
     786      // It checks the 6 different configurations of neighbors pixels; if
     787          // one has fCompacNN adjacent fired pixels than the pixel pixid is
     788          // promoted to compact pixel and saved into the fCompactPixel array.
     789          //
    753790      for (int i=0;i<pix.GetNumNeighbors();i++)
    754         {
    755           //*fLog << pixid <<"->"<< pix.GetNeighbor(i+j) << endl;
    756           while ((fFiredPixel[pix.GetNeighbor(i+j)]==1) && (j < fCompactNN))
    757             j++; 
    758           if (j!=fCompactNN)  continue;  // configuration doesn't satisfy compact condition 
    759          
    760           fCompactPixel[pixid]=1; // pixel is compact
    761 
    762           //      *fLog << ","<<pixid;
    763 
    764           break;
    765         }     
    766     }
    767 }
    768 
    769 
     791            {
     792              int j=0; // j counts the adjacent fired pixels
     793              //*fLog << pixid <<"->"<< pix.GetNeighbor(i+j) << endl;
     794              while ((i+j < 2*pix.GetNumNeighbors()) && (fFiredPixel[NeighPixOrdered[i+j]]==1) && (j < fCompactNN))
     795                j++; 
     796              if (j>=fCompactNN)         // configuration satisfies the compact condition 
     797                {
     798                  fCompactPixel[pixid]=1; // pixel is compact
     799                  //      *fLog << ","<<pixid;
     800                  break;
     801                }
     802            }     
     803    }
     804
     805}
    770806
    771807// --------------------------------------------------------------------------
     
    778814  const MMcEvt &h = *(MMcEvt *)fMcEvt;
    779815  fEnergy = h.GetEnergy();
     816  return;
    780817}
    781818
     
    808845  fTriggerPattern=0; //initialize
    809846
    810   for(UInt_t pixid=0;pixid<397;pixid++)
     847  for(Int_t pixid=0;pixid<gsNTrigPixels;pixid++)
    811848    {
    812849      // Look if the pixel is fired, otherwise continue
    813850      if (!fFiredPixel[pixid])
    814         continue;
     851                continue;
    815852     
    816853      const MGeomPix &pix=(*geom)[pixid];
     
    824861      int j=1;
    825862      for (int i=0;i<pix.GetNumNeighbors();i++)
    826         if (fFiredPixel[pix.GetNeighbor(i)]==1) j++;
     863                if (fFiredPixel[pix.GetNeighbor(i)]==1) j++;
    827864             
    828865      if (j > fTriggerPattern)
    829         fTriggerPattern=j;       
     866                fTriggerPattern=j;       
    830867
    831868      if (fTriggerPattern==7)
    832           break;         // the 7-NN (max) pattern was found: exit 
     869                break;   // the 7-NN (max) pattern was found: exit 
    833870
    834871    } // next pixel
    835872}
    836873
     874
     875// --------------------------------------------------------------------------
     876//  Look for the cell with higher number of Compact pixels
     877//  Return the cell number (starting from 0)
     878//
     879Int_t MMcTriggerLvl2::CalcBiggerCellPseudoSize()
     880{
     881  Int_t fMaxCell=-1;
     882
     883  fCellPseudoSize=0;
     884
     885  for (Int_t i=0;i<gsNCells;i++)
     886    {
     887      int size = GetCellCompactPixel(i,fGeomCam);
     888      if (size > fCellPseudoSize)
     889        {
     890          fCellPseudoSize = size;
     891          fMaxCell = i;
     892        }
     893    }
     894 
     895  //*fLog << "fCellPseudoSize = " << fCellPseudoSize << " in cell N. " << fMaxCell+1 << endl;
     896
     897  return fMaxCell;
     898}
     899
     900// --------------------------------------------------------------------------
     901//  Compute the number of compact pixels in one cell
     902//
     903Int_t MMcTriggerLvl2::GetCellCompactPixel(int cell, MGeomCam *geom)
     904{
     905  int size=0;
     906
     907  // check on input variables
     908
     909  if (cell<0 || cell>gsNCells-1)
     910    return(-2);
     911
     912  //*fLog << " CNN:" << fCompactNN;
     913  //*fLog << "Cell: " << cell+1 << " Compat Pixels:";
     914
     915  for(Int_t id=0; id<gsNPixInCell; id++)
     916    {
     917      UInt_t pixid = gsPixelsInCell[id][cell]-1;
     918 
     919      // Look if the pixel is fired, otherwise continue
     920      if (!fFiredPixel[pixid])
     921        continue;
     922
     923      //*fLog << "Fired pix:"<<pixid+1 << " ";
     924
     925      const MGeomPix &pix=(*geom)[pixid];
     926     
     927      // Reshuffle pixneighbour order, to arrange them (anti)clockwise
     928      //   around the current pixel (Bubble sorting)
     929      // The NeighPixOrdered has one index more so that
     930      // the content in the first index is repeated in the last one
     931      // to have a closed loop
     932      Int_t NeighPixOrdered[2*pix.GetNumNeighbors()];
     933      for (Int_t j=0; j<pix.GetNumNeighbors(); j++)
     934        NeighPixOrdered[j] = pix.GetNeighbor(j);
     935     
     936      for (Int_t j=0; j<pix.GetNumNeighbors()-1; j++)
     937        {
     938          for (Int_t jk=pix.GetNumNeighbors()-1;jk>j;--jk)
     939            {
     940              UInt_t tmp = NeighPixOrdered[j+1];                 
     941              const MGeomPix &pixneigh = (*geom)[NeighPixOrdered[j]];
     942              for (int k=0; k<pix.GetNumNeighbors(); k++)
     943                if (NeighPixOrdered[jk] == pixneigh.GetNeighbor(k))
     944                  {
     945                    NeighPixOrdered[j+1] = NeighPixOrdered[jk];
     946                    NeighPixOrdered[jk] = tmp;
     947                  }
     948            }
     949        }
     950
     951      // Duplicate second half of the array to take into account configurations
     952      // containing tha last and first pixel
     953      for (Int_t j=pix.GetNumNeighbors(); j<2*pix.GetNumNeighbors(); j++)
     954        NeighPixOrdered[j] = NeighPixOrdered[j-pix.GetNumNeighbors()];
     955
     956      // Look for compact pixels.
     957
     958      // A compact pixel must have at least fCompactNN adjacent neighbors
     959      // It checks the 6 different configurations of neighbors pixels.
     960      // The neighbour pixels must belong to the cell
     961
     962      //      *fLog << "cell:"<< cell << "   ordered pixels:";
     963      /*
     964      for (int i=0;i<2*pix.GetNumNeighbors();i++)
     965        {
     966          if (fFiredPixel[NeighPixOrdered[i]])
     967            *fLog << NeighPixOrdered[i]+1 << "*;";
     968          else
     969            *fLog << NeighPixOrdered[i]+1 << ";";
     970        }
     971      */
     972      //*fLog <<endl;
     973      //*fLog << pixid <<"->"<< pix.GetNumNeighbors() << " CNN="<< fCompactNN <<endl;
     974
     975
     976      for (int i=0;i<pix.GetNumNeighbors();i++)
     977        {
     978          int j=0;
     979          while ((i+j < 2*pix.GetNumNeighbors()) && (fFiredPixel[NeighPixOrdered[i+j]]==1) && (j < fCompactNN) && IsPixelInCell(NeighPixOrdered[i+j],cell) )
     980            j++; 
     981
     982          if (j>=fCompactNN) //configuration satisfies the compact condition 
     983            {         
     984              size++; // pixel is compact
     985              //*fLog << "->" << pixid+1;
     986              break; // (new pixel)
     987            }
     988        }
     989    }
     990 
     991  //*fLog <<" - size:" << size << endl<<endl;
     992 
     993  return size;
     994 
     995}
     996
     997//---------------------------------------------------------------------
     998//  Check if a given pixel belongs to a given cell
     999//
     1000Bool_t MMcTriggerLvl2::IsPixelInCell(Int_t pixel, Int_t cell)
     1001{
     1002  for (int i=0; i<gsNPixInCell; i++)
     1003    if ((gsPixelsInCell[i][cell]-1) == pixel)
     1004      return kTRUE;
     1005 
     1006  return kFALSE;
     1007}
     1008
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h

    r2446 r2918  
    77
    88class MMcTrig;
    9 
    109class MMcEvt;
    11 
    1210class MGeomCamMagic;
    13 
    1411class MGeomCam;
    1512class MGeomPix;
     
    1714class MMcTriggerLvl2 : public MParContainer
    1815{
     16 private:
     17 
     18  // Global trigger variables related to the geometry and trigger structures are here defined. 
     19  // FIXME!  this is a temporary solution: these variables should be defined in a GeomTrg class   
    1920
    20  private:
     21  static const Int_t fNumPixCell = 36; // Number of pixels in one cell
    2122
    22   Int_t fPixels[36][19];  // Array with flag for triggered pixels. 1st idx:pixels in trigger cell; 2nd idx:trigger cell number 
     23  static const Int_t gsNCells = 19;   
     24  static const Int_t gsNTrigPixels = 397;   
     25  static const Int_t gsNPixInCell = 36; 
     26  static const Int_t gsNLutInCell = 3; 
     27  static const Int_t gsNPixInLut = 12;
     28  Int_t fPixels[gsNPixInCell][gsNCells]; 
     29 
     30  // Array with flag for triggered pixels. 1st idx:pixels in trigger cell; 2nd idx:trigger cell number     
    2331
    24   Int_t fFiredPixel[397]; // Array with flag for triggered pixel. idx: pixel id
     32  Int_t fFiredPixel[gsNTrigPixels]; // Array with flag for triggered pixel. idx: pixel id   
     33  static const Int_t gsPixelsInCell[gsNPixInCell][gsNCells];   
     34  static const Int_t gsPixelsInLut[gsNLutInCell][gsNPixInLut];     
    2535
    26   static const Int_t gsPixelsInCell[36][19];
    27   static const Int_t gsPixelsInLut[3][12];
     36  Int_t fMaxCell;  // Cell with maximum number of fired pixels
    2837
    29   Int_t fLutPseudoSize;  // number of compact pixels in one lut
    30   Int_t fPseudoSize;  // Multiplicity of the cluster identified by the L2T
    31   Int_t fSizeBiggerCell; // Number of fired pixel in bigger cell
     38  Int_t fLutPseudoSize;   // number of compact pixels in one lut   
     39  Int_t fPseudoSize;   // Multiplicity of the cluster identified by the L2T   
     40  Int_t fSizeBiggerCell; // Number of fired pixel in bigger cell   
     41  Int_t fCompactNN;    //Number of NN pixels that define a compact pixel   
     42  Int_t fCompactPixel[gsNTrigPixels]; //Array with flag for compact pixels   
     43  Int_t fCluster_pix[gsNTrigPixels]; //Array with pixel in cluster   
     44  Double_t fEnergy;  // Energy of the shower   
     45  Int_t fTriggerPattern; // x-NN compact trigger pattern;   
     46  Int_t fCellPseudoSize; // number of compact pixels in one cell   
     47  //  Int_t fCellCompactPixels[fNumPixCell]; // Array with compact pixels in cell
    3248
    33   Int_t fCompactNN;  //Number of NN pixels that define a compact pixel
    34 
    35   Int_t fCompactPixel[397]; //Array with flag for compact pixels
    36 
    37   Int_t fCluster_pix[397]; //Array with pixel in cluster
    38 
    39   Double_t fEnergy;  // Energy of the shower
    40 
    41   Int_t fTriggerPattern; // x-NN compact trigger pattern;
    42 
    43   MMcTrig *fMcTrig;
    44   MGeomCam *fGeomCam; 
    45 
    46   Int_t CalcBiggerFiredCell();
    47   Int_t CalcBiggerLutPseudoSize();
    48   void CalcPseudoSize();
    49    
    50   void SetNewCamera(MGeomCam *geom) {fGeomCam = geom;}
    51 
    52  public:
    53 
    54   MMcTriggerLvl2(const char* name = NULL, const char* title = NULL);
    55   ~MMcTriggerLvl2(); 
    56  
    57 
    58   virtual void Calc();
    59 
    60   virtual void Print(Option_t *opt="") const;
    61 
    62   void SetLv1(MMcTrig *trig = NULL);
    63   void SetPixelFired(Int_t pixel, Int_t fired=1);
    64  
    65   void SetCompactNN(Int_t neighpix)     {fCompactNN=neighpix;}
    66 
    67   Int_t GetPseudoSize() const     {return fPseudoSize;}
    68   Int_t GetLutPseudoSize() const  {return fLutPseudoSize;}
    69   Int_t GetSizeBiggerCell() const {return fSizeBiggerCell;}
    70   Int_t GetCompactNN() const      {return fCompactNN;}
    71 
    72   Int_t GetCellNumberFired(int cell);
    73   Int_t GetLutCompactPixel(int cell, int lut);
     49  MMcTrig *fMcTrig;   
     50  MGeomCam *fGeomCam;     
    7451
    7552  void CalcCompactPixels(MGeomCam *fCam);
     53  void CalcTriggerPattern(MGeomCam *fCam);   
     54  Int_t CalcBiggerFiredCell();   
     55  Int_t CalcBiggerLutPseudoSize();   
     56  void CalcPseudoSize();   
     57  Int_t CalcCellPseudoSize();   
     58  Int_t CalcBiggerCellPseudoSize();   
     59  Int_t GetCellCompactPixel(int cell, MGeomCam *fCam);
    7660
    77   void GetEnergy(MMcEvt *fMcEvt = NULL);
     61  void SetNewCamera(MGeomCam *geom) {fGeomCam = geom;}   
    7862
    79   Double_t GetEnergy() const    {return fEnergy;}
    80  
    81   void CalcTriggerPattern(MGeomCam *fCam);
    82   Int_t GetTriggerPattern() const {return fTriggerPattern;}
     63 public:     
    8364
     65  MMcTriggerLvl2(const char* name = NULL, const char* title = NULL);   
     66  ~MMcTriggerLvl2();     
    8467
    85   ClassDef(MMcTriggerLvl2,0) // Container for 2nd Level Trigger selection parameters
    86 };
     68  virtual void Calc();   
     69  virtual void Print(Option_t *opt="") const;   
    8770
    88 #endif
     71  void SetLv1(MMcTrig *trig = NULL);   
     72  void SetPixelFired(Int_t pixel, Int_t fired=1);     
     73  void SetCompactNN(Int_t neighpix)     {fCompactNN=neighpix;}   
    8974
     75  Int_t GetPseudoSize() const     {return fPseudoSize;}   
     76  Int_t GetLutPseudoSize() const  {return fLutPseudoSize;}   
     77  Int_t GetSizeBiggerCell() const {return fSizeBiggerCell;}   
     78  Int_t GetCompactNN() const      {return fCompactNN;}   
     79  Int_t GetCellPseudoSize() const {return fCellPseudoSize;}
     80  Int_t GetMaxCell() const        {return (fMaxCell+1);} // Returns
     81                     // cell with maximum number of compact pixels
     82  Int_t GetCellNumberFired(int cell);   
     83  Int_t GetLutCompactPixel(int cell, int lut);   
     84   
     85  Int_t GetTriggerPattern() const {return fTriggerPattern;}   
    9086
     87  void GetEnergy(MMcEvt *fMcEvt = NULL);   
     88  Double_t GetEnergy() const    {return fEnergy;}     
    9189
     90  Bool_t IsPixelInCell(Int_t pixel, Int_t cell);   
    9291
    93 
     92  ClassDef(MMcTriggerLvl2,0) // Container for 2nd Level Trigger selection parameters
     93    }; 
     94   
     95#endif     
     96   
Note: See TracChangeset for help on using the changeset viewer.