Ignore:
Timestamp:
02/12/04 11:34:32 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mfilter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mfilter/MFCosmics.cc

    r3105 r3112  
    4848//
    4949//  Output Containers:
     50//   -/-
    5051//
    5152//////////////////////////////////////////////////////////////////////////////
     
    7778      fRawEvt(NULL), fMaxEmptyPixels(230)
    7879{
    79 
    8080    fName  = name  ? name  : "MFCosmics";
    8181    fTitle = title ? title : "Filter to reject cosmics";
     
    9191Int_t MFCosmics::PreProcess(MParList *pList)
    9292{
    93 
    9493    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
    9594    if (!fRawEvt)
    9695    {
    97       *fLog << err << dbginf << "MRawEvtData not found... aborting." << endl;
     96      *fLog << err << "MRawEvtData not found... aborting." << endl;
    9897      return kFALSE;
    9998    }
     
    101100    fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
    102101    if (!fPedestals)
    103       {
    104         *fLog << err << dbginf << "Cannot find MPedestalCam ... aborting" << endl;
     102    {
     103        *fLog << err << "MPedestalCam not found... aborting." << endl;
    105104        return kFALSE;
    106       }
     105    }
    107106
    108107    fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
    109108    if (!fSignals)
    110       {
    111         *fLog << err << dbginf << "Cannot find MExtractedSignalCam ... aborting" << endl;
     109    {
     110        *fLog << err << "MExtractedSignalCam not found... aborting." << endl;
    112111        return kFALSE;
    113       }
     112    }
    114113
    115114    memset(fCut, 0, sizeof(fCut));
     
    124123//  - MExtractedSignalCam
    125124//
    126 Bool_t MFCosmics::ReInit(MParList *pList )
    127 {
    128  
     125Bool_t MFCosmics::ReInit(MParList *pList)
     126{
    129127    fSqrtHiGainSamples = TMath::Sqrt((Float_t) fSignals->GetNumUsedHiGainFADCSlices());
    130128
     
    140138Int_t MFCosmics::Process()
    141139{
    142 
    143   fResult = CosmicsRejection();
    144  
    145   fCut[fResult ? 0 : 1]++;
    146   return kTRUE;
     140    fResult = CosmicsRejection();
     141
     142    fCut[fResult ? 0 : 1]++;
     143    return kTRUE;
    147144}
    148145
     
    158155// the outer pixels have some defect).
    159156//
    160 Bool_t MFCosmics::CosmicsRejection()
    161 {
    162  
    163   MRawEvtPixelIter pixel(fRawEvt);
    164  
    165   Int_t cosmicpix = 0;
    166      
    167   //
    168   // Create a first loop to sort out the cosmics ...
    169   //
    170   while (pixel.Next())
    171     {
    172      
    173       const UInt_t idx = pixel.GetPixelId();
    174      
    175       MExtractedSignalPix &sig =  (*fSignals)[idx];
    176       MPedestalPix        &ped =  (*fPedestals)[idx];
    177       const Float_t pedrms      = ped.GetPedestalRms()*fSqrtHiGainSamples;
    178       const Float_t sumhi       = sig.GetExtractedSignalHiGain();
    179 
    180       //
    181       // We consider a pixel as presumably due to cosmics
    182       // if its sum of FADC slices is lower than 3 pedestal RMS
    183       //
    184       if (sumhi < 3.*pedrms ) 
    185         cosmicpix++;
    186     }
    187  
    188 
    189   //
    190   // If the camera contains more than fMaxEmptyPixels
    191   // presumed pixels due to cosmics, then the event is discarted.
    192   //
    193   if (cosmicpix > fMaxEmptyPixels)
    194     return kTRUE;
    195 
    196   return kFALSE;
     157Bool_t MFCosmics::CosmicsRejection() const
     158{
     159    MRawEvtPixelIter pixel(fRawEvt);
     160
     161    Int_t cosmicpix = 0;
     162
     163    //
     164    // Create a first loop to sort out the cosmics ...
     165    //
     166    while (pixel.Next())
     167    {
     168        const UInt_t idx = pixel.GetPixelId();
     169
     170        MExtractedSignalPix &sig =  (*fSignals)[idx];
     171        MPedestalPix        &ped =  (*fPedestals)[idx];
     172
     173        const Float_t pedrms = ped.GetPedestalRms()*fSqrtHiGainSamples;
     174        const Float_t sumhi  = sig.GetExtractedSignalHiGain();
     175
     176        //
     177        // We consider a pixel as presumably due to cosmics
     178        // if its sum of FADC slices is lower than 3 pedestal RMS
     179        //
     180        if (sumhi < 3.*pedrms )
     181            cosmicpix++;
     182    }
     183
     184    //
     185    // If the camera contains more than fMaxEmptyPixels
     186    // presumed pixels due to cosmics, then the event is discarted.
     187    //
     188    return cosmicpix > fMaxEmptyPixels;
    197189}
    198190
    199191Int_t MFCosmics::PostProcess()
    200192{
    201 
    202   if (GetNumExecutions()==0)
    203     return kTRUE;
    204  
    205   *fLog << inf << endl;
    206   *fLog << GetDescriptor() << " execution statistics:" << endl;
    207   *fLog << dec << setfill(' ');
    208  
    209   *fLog << " " << setw(7) << fCut[1] << " (" << setw(3) ;
    210   *fLog << (int)(fCut[1]*100/GetNumExecutions()) ;
    211   *fLog << "%) Evts skipped due to: Cosmics Rejection applied " ;
    212   *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels << ")" << endl;
    213 
    214   *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ;
    215   *fLog << (int)(fCut[0]*100/GetNumExecutions()) ;
    216   *fLog << "%) Evts survived the cosmics rejection!" << endl;
    217   *fLog << endl;
    218 
    219   return kTRUE;
    220 }
    221 
     193    if (GetNumExecutions()==0)
     194        return kTRUE;
     195
     196    *fLog << inf << endl;
     197    *fLog << GetDescriptor() << " execution statistics:" << endl;
     198    *fLog << dec << setfill(' ');
     199
     200    *fLog << " " << setw(7) << fCut[1] << " (" << setw(3) ;
     201    *fLog << (int)(fCut[1]*100/GetNumExecutions()) ;
     202    *fLog << "%) Evts skipped due to: Cosmics Rejection applied " ;
     203    *fLog << " (with fMaxEmptyPixels = " << fMaxEmptyPixels << ")" << endl;
     204
     205    *fLog << " " << setw(7) << fCut[0] << " (" << setw(3) ;
     206    *fLog << (int)(fCut[0]*100/GetNumExecutions()) ;
     207    *fLog << "%) Evts survived the cosmics rejection!" << endl;
     208    *fLog << endl;
     209
     210    return kTRUE;
     211}
     212
  • trunk/MagicSoft/Mars/mfilter/MFCosmics.h

    r3084 r3112  
    11#ifndef MARS_MFCosmics
    22#define MARS_MFCosmics
    3 
    4 /////////////////////////////////////////////////////////////////////////////
    5 //                                                                         //
    6 // MFCosmics                                                               //
    7 //                                                                         //
    8 // Filter against cosmics (used especially by the calibration              //
    9 //                                                                         //
    10 /////////////////////////////////////////////////////////////////////////////
    113
    124#ifndef MARS_MFilter
     
    2214{
    2315private:
     16    MPedestalCam        *fPedestals; // Pedestals of all pixels in the camera
     17    MExtractedSignalCam *fSignals;   // Calibration events of all pixels in the camera
    2418
    25   MPedestalCam             *fPedestals;    // Pedestals of all pixels in the camera
    26   MExtractedSignalCam      *fSignals;      // Calibration events of all pixels in the camera
     19    MRawEvtData         *fRawEvt;    // raw event data (time slices)
    2720
    28   MRawEvtData              *fRawEvt;       // raw event data (time slices)
     21    Int_t   fCut[2];
     22    Bool_t  fResult;
    2923
    30   Int_t   fCut[2];   
    31   Bool_t  fResult;
    32   Int_t   fMaxEmptyPixels;                 // Maximum number of empty pixels before declaring event as cosmic
    33   Float_t fSqrtHiGainSamples;              // Square root of the number of used Hi-Gain Samples
    34  
    35   Bool_t ReInit(MParList *pList);
    36   Int_t PreProcess(MParList *pList);
    37   Int_t Process();
    38   Int_t PostProcess();
     24    Int_t   fMaxEmptyPixels;         // Maximum number of empty pixels before declaring event as cosmic
     25    Float_t fSqrtHiGainSamples;      // Square root of the number of used Hi-Gain Samples
    3926
    40   Bool_t CosmicsRejection();
    41  
    42   Bool_t IsExpressionTrue() const { return fResult; }
     27    Bool_t ReInit(MParList *pList);
     28    Int_t  PreProcess(MParList *pList);
     29    Int_t  Process();
     30    Int_t  PostProcess();
     31
     32    Bool_t CosmicsRejection() const;
     33
     34    Bool_t IsExpressionTrue() const { return fResult; }
    4335 
    4436public:
     37    MFCosmics(const char *name=NULL, const char *title=NULL);
    4538
    46   MFCosmics(const char *name=NULL, const char *title=NULL);
     39    void  SetMaxEmptyPixels(const Int_t n) { fMaxEmptyPixels = n; }
     40    Int_t GetMaxEmptyPixels() const        { return fMaxEmptyPixels; }
    4741
    48   void SetMaxEmptyPixels(const Int_t n)             { fMaxEmptyPixels = n; }
    49   Int_t GetMaxEmptyPixels()          const    { return fMaxEmptyPixels; }
    50 
    51   ClassDef(MFCosmics, 0)   // Filter to perform a cosmics rejection
     42    ClassDef(MFCosmics, 0)   // Filter to perform a cosmics rejection
    5243};
    5344
Note: See TracChangeset for help on using the changeset viewer.