Ignore:
Timestamp:
03/18/05 18:07:46 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r6489 r6858  
    5757//
    5858//  WARNING: Using trigger type kAllPattern resets the BIT(21) bit
    59 //           of all pixels in MCerPhotEvt
     59//           of all pixels in MSignalCam
    6060//
    6161//
    6262//  Input:
    63 //    MCerPhotEvt
    64 //    MArrivalTime
     63//    MSignalCam
    6564//    MGeomCam
    6665//
     
    7675#include "MGeomCam.h"
    7776
    78 #include "MCerPhotEvt.h"
    79 #include "MArrivalTime.h"
     77#include "MSignalCam.h"
     78//#include "MArrivalTime.h"
    8079
    8180ClassImp(MFSoftwareTrigger);
     
    8887//
    8988MFSoftwareTrigger::MFSoftwareTrigger(const char *name, const char *title)
    90     : fCam(NULL), fEvt(NULL), fTme(NULL), fThreshold(5),
     89    : fCam(NULL), fEvt(NULL), fThreshold(5),
    9190    fTimeWindow(0.5), fNumNeighbors(4), fType(kSinglePixelNeighbors)
    9291{
     
    112111{
    113112    // Try to get the pixel information of a pixel with this index
    114     MCerPhotPix *pix = fEvt->GetPixById(idx);
     113    MSignalPix *pix = fEvt->GetPixById(idx);
    115114
    116115    // If a pixel with this index is not existing... do nothing.
     
    133132        return 0;
    134133
    135     const Float_t tm1 = fTme ? (*fTme)[idx] : 0;
    136     if (fTme && TMath::Abs(tm1-tm0)>fTimeWindow)
     134    const Float_t tm1 = pix->GetArrivalTime();
     135    if (TMath::Abs(tm1-tm0)>fTimeWindow)
    137136        return 0;
    138137
     
    157156{
    158157    // Try to get the pixel information of a pixel with this index
    159     MCerPhotPix *pix = fEvt->GetPixById(idx);
     158    MSignalPix *pix = fEvt->GetPixById(idx);
    160159
    161160    // If a pixel with this index is not existing... do nothing.
     
    210209    ResetBits(kWasChecked);
    211210
     211    const UInt_t npixevt = fEvt->GetNumPixels();
     212    for (UInt_t idx=0; idx<npixevt; idx++)
     213    {
     214        const MSignalPix &pix = (*fEvt)[idx];
     215        if (!pix.IsPixelUsed())
     216            continue;
     217
     218        // Check if trigger condition is fullfilled for this pixel
     219        if (CountPixels(idx, pix.GetArrivalTime()) >= fNumNeighbors)
     220            return kTRUE;
     221    }
     222
     223/*
    212224    // Reset bit
    213     MCerPhotPix *pix=0;
     225    MSignalPix *pix=0;
    214226
    215227    // We could loop over all indices which looks more straight
    216228    // forward but should be a lot slower (assuming zero supression)
    217229    TIter Next(*fEvt);
    218     while ((pix=static_cast<MCerPhotPix*>(Next())))
     230    while ((pix=static_cast<MSignalPix*>(Next())))
    219231    {
    220232        // Check if trigger condition is fullfilled for this pixel
     
    223235            return kTRUE;
    224236    }
    225 
     237  */
    226238    return kFALSE;
    227239}
     
    230242{
    231243    // Try to get the pixel information of a pixel with this index
    232     MCerPhotPix *pix = fEvt->GetPixById(idx);
     244    MSignalPix *pix = fEvt->GetPixById(idx);
    233245
    234246    // If a pixel with this index is not existing... do nothing.
     
    283295{
    284296    // Reset bit
    285     MCerPhotPix *pix=0;
     297    MSignalPix *pix=0;
    286298
    287299    // We could loop over all indices which looks more straight
    288300    // forward but should be a lot slower (assuming zero supression)
    289301    TIter Next(*fEvt);
    290     while ((pix=static_cast<MCerPhotPix*>(Next())))
     302    while ((pix=static_cast<MSignalPix*>(Next())))
    291303    {
    292304        ResetBits(kWasChecked|kIsCoincident);
     
    302314*/
    303315
    304 Bool_t MFSoftwareTrigger::CheckPixel(const MCerPhotPix &pix) const
    305 {
     316const MSignalPix *MFSoftwareTrigger::CheckPixel(Int_t i) const
     317{
     318    const MSignalPix &pix = (*fEvt)[i];
     319
    306320    if (!pix.IsPixelUsed())
    307         return kFALSE;
    308 
    309     if (pix.GetNumPhotons()*fCam->GetPixRatio(pix.GetPixId())<fThreshold)
    310         return kFALSE;
    311 
    312     if ((*fCam)[pix.GetPixId()].IsInOutermostRing())
    313         return kFALSE;
    314 
    315     return kTRUE;
     321        return NULL;
     322
     323    if (pix.GetNumPhotons()*fCam->GetPixRatio(i)<fThreshold)
     324        return NULL;
     325
     326    if ((*fCam)[i].IsInOutermostRing())
     327        return NULL;
     328
     329    return &pix;
    316330}
    317331
     
    326340    for (Int_t i=0; i<entries; i++)
    327341    {
    328         const MCerPhotPix &pix0 = (*fEvt)[i];
    329         if (!CheckPixel(pix0))
     342        const MSignalPix *pix0 = CheckPixel(i);
     343        if (!pix0)
    330344            continue;
    331345
    332346        Int_t num = 1;
    333347
    334         const MGeomPix &gpix = (*fCam)[pix0.GetPixId()];
     348        const MGeomPix &gpix = (*fCam)[i];
    335349
    336350        const Int_t nneighbors = gpix.GetNumNeighbors();
     
    338352        {
    339353            const Int_t idx1 = gpix.GetNeighbor(n);
    340             if (!CheckPixel(*fEvt->GetPixById(idx1)))
     354
     355            const MSignalPix *pix1 = CheckPixel(idx1);
     356            if (!pix1)
    341357                continue;
    342358
    343             if (fTme)
    344             {
    345                 const Float_t t0 = (*fTme)[pix0.GetPixId()];
    346                 const Float_t t1 = (*fTme)[idx1];
    347 
    348                 if (TMath::Abs(t0-t1)>fTimeWindow)
    349                     continue;
    350             }
     359            const Float_t t0 = pix0->GetArrivalTime();
     360            const Float_t t1 = pix1->GetArrivalTime();
     361
     362            if (TMath::Abs(t0-t1)>fTimeWindow)
     363                continue;
    351364
    352365            if (++num==fNumNeighbors)
     
    359372// --------------------------------------------------------------------------
    360373//
    361 // Request pointer to MCerPhotEvt and MGeomCam from paremeter list
     374// Request pointer to MSignalCam and MGeomCam from paremeter list
    362375//
    363376Int_t MFSoftwareTrigger::PreProcess(MParList *pList)
    364377{
    365     fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
     378    fEvt = (MSignalCam*)pList->FindObject("MSignalCam");
    366379    if (!fEvt)
    367380    {
    368         *fLog << err << "MCerPhotEvt not found... aborting." << endl;
     381        *fLog << err << "MSignalCam not found... aborting." << endl;
    369382        return kFALSE;
    370383    }
     
    375388        *fLog << err << "MGeomCam not found... aborting." << endl;
    376389        return kFALSE;
    377     }
    378 
    379     fTme = 0;
    380     if (fTimeWindow>0)
    381     {
    382         fTme = (MArrivalTime*)pList->FindObject("MArrivalTime");
    383         if (!fTme)
    384         {
    385             *fLog << err << "MArrivalTime not found... aborting." << endl;
    386             return kFALSE;
    387         }
    388390    }
    389391
Note: See TracChangeset for help on using the changeset viewer.