Ignore:
Timestamp:
02/12/04 11:34:32 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.