Changeset 3368 for trunk


Ignore:
Timestamp:
03/01/04 13:14:28 (21 years ago)
Author:
raducci
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/msignal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msignal/MArrivalTimeCalc.cc

    r3320 r3368  
    5555#include "MRawEvtPixelIter.h"
    5656
     57#include "MPedestalCam.h"
     58#include "MPedestalPix.h"
     59
    5760ClassImp(MArrivalTimeCalc);
    5861
     
    7679// The PreProcess searches for the following input containers:
    7780//  - MRawEvtData
    78 //  - MArrivalTime
     81//  - MPedestalCam
    7982//
    8083// The following output containers are also searched and created if
    8184// they were not found:
    82 //  - MArrivalTime
     85//  - MArrivalTimeCam
    8386//
    8487
     
    9396        return kFALSE;
    9497    }
     98   
     99    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
     100    if (!fPedestals)
     101    {
     102        *fLog << err << AddSerialNumber("MPedestalCam") << " not found... aborting" << endl;
     103        return kFALSE;
     104    }
     105
    95106
    96107    fArrTime = (MArrivalTimeCam*)pList->FindCreateObj(AddSerialNumber("MArrivalTimeCam"));
     
    142153         
    143154          const Short_t nslices = fRawEvt->GetNumLoGainSamples();
    144           time = Calc(pixel.GetLoGainSamples(),nslices);
     155          time = Calc(pixel.GetLoGainSamples(),nslices,idx);
    145156        }
    146157     
     
    153164         
    154165          const Short_t nslices = fRawEvt->GetNumHiGainSamples();
    155           time = Calc(pixel.GetHiGainSamples(),nslices);
     166          time = Calc(pixel.GetHiGainSamples(),nslices,idx);
    156167        }
    157168     
     
    174185// Case 1: MCubicSpline (3rd order spline)
    175186//
    176 Float_t MArrivalTimeCalc::Calc(const Byte_t *fadcSamples, const Short_t nslices)
     187Float_t MArrivalTimeCalc::Calc(const Byte_t *fadcSamples, const Short_t nslices, const UInt_t idx)
    177188{
    178189
     
    185196  // Now find the maximum 
    186197  //
    187    return (Float_t)spline->EvalAbMax();
    188 }
    189 
     198    Double_t abMaximum = spline->EvalAbMax();
     199    Double_t maximum = spline->EvalMax();
     200    const MPedestalPix &ped = (*fPedestals)[idx];
     201    const Float_t halfMax = (maximum - ped.GetPedestal())/2;
     202    return (halfMax > 0.0) ? (Float_t ) spline->FindVal(halfMax,abMaximum,'l'): 0.0;
     203   
     204}
     205
  • trunk/MagicSoft/Mars/msignal/MArrivalTimeCalc.h

    r3320 r3368  
    99class MRawRunHeader;
    1010class MArrivalTimeCam;
     11class MPedestalCam;
    1112class MArrivalTimeCalc : public MTask
    1213{
     
    1415    MRawEvtData    *fRawEvt;     // raw event data (time slices)
    1516    MRawRunHeader  *fRunHeader;  // RunHeader information
     17    MPedestalCam   *fPedestals;  // pedestal information
    1618
    1719    MArrivalTimeCam *fArrTime;   // Container with the photons arrival times
     
    2224    Int_t PostProcess() {return kTRUE;}
    2325
    24     Float_t Calc(const Byte_t *fadcSamples, const Short_t nslices);
     26    Float_t Calc(const Byte_t *fadcSamples, const Short_t nslices, const UInt_t idx);
    2527 
    2628public:
Note: See TracChangeset for help on using the changeset viewer.