Changeset 597 for trunk


Ignore:
Timestamp:
02/07/01 16:50:22 (24 years ago)
Author:
harald
Message:
Adding the first version of an Image Cleaning. Therefore a first version
of Class MCamNeigbor was implemented.

The Image cleaning is done in class MNphotEvent.
Location:
trunk/MagicSoft/Mars
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/readCT1.C

    r596 r597  
    1111  MNphotEvent *phevt = new MNphotEvent() ;
    1212
    13 
    1413  plist->AddToList( phevt ) ;
    1514 
    16 
    1715  //MReadCT1Ascii *readct1 = new MReadCT1Ascii("/hd10/www/Anal_MAGIC/MCCT1_99_ga20.dat") ;
    1816
     
    2220
    2321  Int_t icount = 0 ;
    24 
    2522  MCamDisplay display(0) ;
    2623
     
    3128      cout << "Event: " << icount++  << endl  ;
    3229     
    33       if ( icount == 3 ) {
    34         phevt->Print() ;
    35       }
    36 
     30     
     31      phevt->Print() ;
     32     
    3733      display->Draw( phevt )  ;
    38       // display->DrawError( phevt )  ;
    39 
    4034      gClient->HandleInput();   
    41      
    4235      if(getchar()=='q')
    4336        break;
     37     
     38      phevt->CleanLevel1() ;
     39     
     40      phevt->CleanLevel2() ;
     41     
     42      display->Draw( phevt )  ;
     43      gClient->HandleInput();   
     44      if(getchar()=='q')
     45        break;
     46     
     47
    4448    }
    4549
  • trunk/MagicSoft/Mars/manalysis/AnalysisIncl.h

    r592 r597  
    55
    66#include "MParContainer.h"
     7#include "MCamNeighbor.h"
    78
    89#endif // __CINT__
  • trunk/MagicSoft/Mars/manalysis/MNphotEvent.cc

    r596 r597  
    66
    77#include "MCamGeom.h"
     8#include "MCamNeighbor.h"
    89#include "MCamDisplay.h"
    910#include "MHexagon.h"
     
    1617  //  default constructor
    1718  fPixId    = pix ;
     19  fIsUsed   = kTRUE ;
    1820  fPhot     = phot ;
    1921  fErrPhot  = errphot ;
     
    2325{
    2426  fPixId    = pix ;
     27  fIsUsed   = kTRUE ;
    2528  fPhot     = phot ;
    2629  fErrPhot  = errphot ;
     
    3033{
    3134  //   information about a pixel
    32   cout << "MNphotPix: Pixel: "<< fPixId
    33        << "  Nphot= " << fPhot
     35  cout << "MNphotPix: Pixel: "<< fPixId ;
     36 
     37  if ( fIsUsed == kTRUE )
     38    cout << "   Used " ;
     39  else
     40    if ( fIsUsed == kFALSE )
     41      cout << " UnUsed " ;
     42
     43  cout << "  Nphot= " << fPhot
    3444       << "  Error(Nphot) = " << fErrPhot
    3545       << endl ;
     
    5464  fPixels = new TClonesArray ("MNphotPix", 577) ;
    5565 
     66  fNN = new MCamNeighbor() ;
     67
    5668  fPixels->Clear() ;
    5769}
     
    5971void MNphotEvent::Draw(Option_t* option)
    6072{
    61   //
     73  //   FIXME!!!
    6274  //
    6375 
     
    102114    }
    103115}
    104  
     116
     117void MNphotEvent::CleanLevel1()
     118{
     119  //  This method looks for all pixels with an entry (photons)
     120  //  that is three times bigger than the noise of the pixel
     121 
     122  Float_t entry, noise ;
     123 
     124  // first look for pixels above some noise level
     125 
     126  for (Int_t il=0; il<fPixels->GetEntries(); il++ )
     127    {
     128      entry = ((MNphotPix *) fPixels->At(il))->GetPhotons() ;
     129      noise =  3 * ((MNphotPix *) fPixels->At(il))->GetErrorPhot() ;
     130     
     131      if (entry < 3 * noise )
     132        ((MNphotPix *) fPixels->At(il))->SetPixelUnused() ;
     133       
     134    }
     135}
     136
     137void MNphotEvent::CleanLevel2()
     138{
     139  //  check if the  survived pixel have a neighbor, that also
     140  //  survived
     141 
     142  Int_t id, id2 ;
     143  Int_t itest ;
     144 
     145  for (Int_t il=0; il<fPixels->GetEntries(); il++ )
     146    {
     147      if ( ((MNphotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE )
     148        {
     149          id = ((MNphotPix *) fPixels->At(il))->GetPixId() ;
     150         
     151          itest = 0 ;
     152          for (Int_t in=0 ; in < 6 ; in++ ) {
     153             
     154            id2 = fNN->GetNN(id, in ) ;
     155           
     156            if ( PixelIsUsed(id2) == kTRUE )
     157              cout << " hulibu " << id << "/" << id2 << endl ; 
     158           
     159           
     160          }
     161        }
     162    }
     163}
     164
     165Bool_t MNphotEvent::PixelExist(Int_t id )
     166{
     167  //   Checks if in the pixel list is an entry with pixel id
     168 
     169  for (Int_t il=0; il<fPixels->GetEntries(); il++ )
     170    {
     171      if ( id == ((MNphotPix *) fPixels->At(il))->GetPixId() ) {
     172       
     173        cout << " PixelExist " << il ;
     174        return kTRUE ;
     175      }
     176    }
     177
     178  return kFALSE ;
     179
     180}
     181
     182Bool_t MNphotEvent::PixelIsUsed(Int_t id )
     183{
     184  //   Checks if in the pixel list is an entry with pixel id
     185 
     186  for (Int_t il=0; il<fPixels->GetEntries(); il++ )
     187    {
     188      if ( id == ((MNphotPix *) fPixels->At(il))->GetPixId() &&
     189           ((MNphotPix *) fPixels->At(il))->IsPixelUsed() == kTRUE ) {
     190       
     191        cout << " PixelIsUsed  " << il ;
     192        return kTRUE ;
     193      }
     194    }
     195
     196  return kFALSE ;
     197
     198}
     199
    105200Int_t MNphotEvent::GetPixelId(Int_t i )
    106201{
     
    108203}
    109204
     205Bool_t  MNphotEvent::IsPixelUsed(Int_t i )
     206{
     207  return ( ( (MNphotPix *) fPixels->At(i))->IsPixelUsed() ) ;
     208}
     209 
    110210Float_t MNphotEvent::GetPhotons(Int_t i )
    111211{
  • trunk/MagicSoft/Mars/manalysis/MNphotEvent.h

    r596 r597  
    1010class TClonesArray ;
    1111class TObjArray ;
     12class MCamNeighbor ;
    1213
    1314class MNphotPix : public TObject
     
    1617 
    1718  Int_t    fPixId     ;  //   the pixel Id
     19  Bool_t   fIsUsed    ;  //   the pixel is used for calculations --> kTRUE
    1820  Float_t  fPhot      ;  //   The number of Cerenkov photons
    1921  Float_t  fErrPhot   ;  //   the error of fPhot
    20 
     22 
    2123 public:
    2224 
     
    4244  void SetPixelContent(Int_t pix , Float_t phot , Float_t errphot ) ;
    4345
     46  Bool_t IsPixelUsed()
     47    {
     48      return fIsUsed ;
     49    } 
     50 
     51  void SetPixelUnused()
     52    {
     53      fIsUsed = kFALSE ;
     54    } 
     55 
     56  void SetPixelUsed()
     57    {
     58      fIsUsed = kTRUE ;
     59    } 
     60 
     61 
     62 
    4463  ClassDef(MNphotPix, 1)  // Cerenkov Photons class for the pixel
    4564} ;
     
    5776  Int_t            fNbPixels ;   //
    5877  TClonesArray     *fPixels   ;  //
     78
     79
     80  MCamNeighbor     *fNN  ;   //!   the class with the information about neighbors
    5981 
    6082 public:
     
    7294  void Print() ;
    7395
     96  void CleanLevel1() ;
     97  void CleanLevel2() ;
     98 
     99  Bool_t PixelExist( Int_t id ) ;
     100  Bool_t PixelIsUsed( Int_t id ) ;
     101 
    74102  Int_t GetPixelId(Int_t i ) ;
     103  Bool_t  IsPixelUsed(Int_t i ) ;
    75104  Float_t GetPhotons(Int_t i ) ;
    76105  Float_t GetErrorPhot(Int_t i ) ;
     
    80109 
    81110  ClassDef(MNphotEvent, 1)    // class for Nphotons Events
    82 };
     111}; 
    83112
    84113#endif
  • trunk/MagicSoft/Mars/manalysis/MReadCT1Ascii.cc

    r596 r597  
    2727
    2828    fFileName = fname;
     29
     30    // set the pedestals to default values
     31   
     32    for (Int_t i = 0; i<127; i++ )
     33      {
     34       
     35        fPedest[i] = 1.5  ;
     36      }
     37   
    2938}
    3039
     
    6776    return kFALSE ;
    6877
     78  // if the first number is negativ this is the pedestal line
     79 
     80  if (dummyI < 0 )
     81    ReadPedestal() ;
     82
    6983  fscanf ( fInputfile, "%d", &dummyI ) ;
    7084  fscanf ( fInputfile, "%d", &dummyI ) ;
     
    7892      fscanf ( fInputfile, "%f", &dummyF ) ;
    7993     
    80      
    8194      if ( dummyF > 0.0 ) {
    82         fNphot->AddPixel(i, dummyF, sqrt(dummyF) ) ;
     95        fNphot->AddPixel(i, dummyF, fPedest[i] ) ;
    8396      }
    8497     
     
    94107}
    95108
     109
     110void MReadCT1Ascii::ReadPedestal()
     111{
     112  cout << " Read in the Pedestals " << endl ;
     113  Int_t   dummyI ;
     114  Float_t dummyF ;
     115 
     116  // the next for values are for dummy
     117  fscanf ( fInputfile, "%d", &dummyI ) ;
     118  fscanf ( fInputfile, "%d", &dummyI ) ;
     119  fscanf ( fInputfile, "%d", &dummyI ) ;
     120  fscanf ( fInputfile, "%d", &dummyI ) ;
     121
     122  //    read in the next 127 numbers as the pedestals
     123
     124  for (Int_t i = 0; i<127; i++ )
     125    {
     126      fscanf ( fInputfile, "%f", &dummyF ) ;
     127     
     128      if ( dummyF > 0.0 ) {
     129        fPedest[i] = dummyF ;
     130      }
     131     
     132    }
     133
     134  fscanf ( fInputfile, "%d", &dummyI ) ;
     135
     136
     137}
     138
  • trunk/MagicSoft/Mars/manalysis/MReadCT1Ascii.h

    r592 r597  
    1717  MNphotEvent *fNphot ; //! the data container for all data.
    1818
     19  Float_t fPedest[127] ; //!
     20
    1921 public:
    2022  MReadCT1Ascii(const char *filename,
     
    2628  Bool_t PostProcess();
    2729 
     30  void   ReadPedestal() ;
     31
    2832  ClassDef(MReadCT1Ascii, 1)    // Reads the CT1 data file
    2933};
    30    
     34
    3135#endif
     36
  • trunk/MagicSoft/Mars/mgui/GuiLinkDef.h

    r589 r597  
    1515#pragma link C++ class MPixGeom;
    1616#pragma link C++ class MCamGeom;
     17#pragma link C++ class MCamNeighbor;
    1718
    1819#pragma link C++ class MCamDisplay;
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.cc

    r596 r597  
    144144      UpdateLegend() ;
    145145    } 
    146  
    147 
    148  
    149   cout << fMinPhe << "/" << fMaxPhe << endl ;
     146
     147  //   update the picture
    150148
    151149  for (Int_t i=0 ; i<event->GetNbPixels() ; i++ )
    152150    {
    153       ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetPhotons(i))) ;
    154     }
    155  
     151      if ( event->IsPixelUsed(i) == TRUE )
     152        ( (MHexagon*) fPixels->At( event->GetPixelId(i) ))->SetFillColor( GetColor(event->GetPhotons(i))) ;
     153   
     154    }
     155 
    156156  Draw() ;
    157157 
  • trunk/MagicSoft/Mars/mgui/MCamGeom.h

    r589 r597  
    8282  void Print() ;
    8383
    84  
    85 
    8684  ClassDef(MCamGeom, 1)         // Base (abstract) class for a task
    8785};
  • trunk/MagicSoft/Mars/mgui/Makefile

    r595 r597  
    5959           MHexagon.cc \
    6060           MCamGeom.cc \
     61           MCamNeighbor.cc \
    6162           MCamDisplay.cc
    6263
Note: See TracChangeset for help on using the changeset viewer.