Changeset 3446


Ignore:
Timestamp:
03/09/04 19:24:09 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3445 r3446  
    4747     - displaying saturation also for not-valid pixels in GetPixelContent
    4848
     49   * msignal/MExtractedSignalCam.[h,cc]
     50   * msignal/MExtractSignal.[h,cc]
     51   * msignal/MExtractSignal2.[h,cc]
     52   * mananlysis/MHPedestalCam.cc
     53   * mcalib/MCalibrationChargeCam.cc
     54     - in SetUsedFADCSlices, also the window (hi-and logain) is set.
     55       This because MExtractSignal2 set the whole window which was much
     56       bigger than the actually used one. This bug is now removed.
    4957
    5058
  • trunk/MagicSoft/Mars/manalysis/MHPedestalCam.cc

    r3168 r3446  
    160160 
    161161
    162   Float_t slices = (Float_t)signal->GetNumUsedFADCSlices();
     162  Float_t slices = signal->GetNumUsedHiGainFADCSlices();
    163163
    164164  if (slices == 0.)
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r3445 r3446  
    235235    SETBIT(fFlags, kHiLoGainCalibration);
    236236
    237     fNumHiGainSamples  = 0;
    238     fNumLoGainSamples  = 0;
     237    fNumHiGainSamples  = 0.;
     238    fNumLoGainSamples  = 0.;
    239239    fConversionHiLo    = 0;
    240240
     
    336336  fNumHiGainSamples  =  fSignals->GetNumUsedHiGainFADCSlices();
    337337  fNumLoGainSamples  =  fSignals->GetNumUsedLoGainFADCSlices();
    338   fSqrtHiGainSamples =  TMath::Sqrt((Float_t)fNumHiGainSamples);
     338  fSqrtHiGainSamples =  TMath::Sqrt(fNumHiGainSamples);
     339  fSqrtLoGainSamples =  TMath::Sqrt(fNumLoGainSamples);
    339340 
    340341  UInt_t npixels     = fGeom->GetNumPixels();
     
    424425      {
    425426          pix.SetPedestal(ped  * fNumLoGainSamples,
    426                           prms * TMath::Sqrt((Float_t)fNumLoGainSamples),
     427                          prms * fSqrtLoGainSamples,
    427428                          prms * fNumLoGainSamples / num);
    428           pix.SetNumLoGainSamples((Float_t)fNumLoGainSamples);
     429          pix.SetNumLoGainSamples(fNumLoGainSamples);
    429430          pix.ApplyLoGainConversion();
    430431      }
     
    432433      {
    433434          pix.SetPedestal(ped  * fNumHiGainSamples,
    434                           prms * TMath::Sqrt((Float_t)fNumHiGainSamples),
     435                          prms * fSqrtHiGainSamples,
    435436                          prms * fNumHiGainSamples / num);
    436437      }
     
    471472  {
    472473      avinnerpix->SetPedestal(avinnerped/avinnernum  * fNumLoGainSamples,
    473                          avinnerprms/avinnernum * TMath::Sqrt((Float_t)fNumLoGainSamples),
    474                          avinnerprms/avinnernum * TMath::Sqrt((Float_t)fNumLoGainSamples/avinnernum));
    475       avinnerpix->SetNumLoGainSamples((Float_t)fNumLoGainSamples);
     474                              avinnerprms/avinnernum * fSqrtLoGainSamples,
     475                              avinnerprms/avinnernum * fSqrtLoGainSamples/avinnernum);
     476      avinnerpix->SetNumLoGainSamples(fNumLoGainSamples);
    476477      avinnerpix->ApplyLoGainConversion();
    477478  }
     
    479480  {
    480481      avinnerpix->SetPedestal(avinnerped/avinnernum  * fNumHiGainSamples,
    481                          avinnerprms/avinnernum * TMath::Sqrt((Float_t)fNumHiGainSamples),
    482                          avinnerprms/avinnernum * TMath::Sqrt((Float_t)fNumHiGainSamples/avinnernum));
     482                              avinnerprms/avinnernum * fSqrtHiGainSamples,
     483                              avinnerprms/avinnernum * fSqrtHiGainSamples/avinnernum);
    483484  }
    484485
     
    486487  {
    487488      avouterpix->SetPedestal(avouterped/avouternum  * fNumLoGainSamples,
    488                               avouterprms/avouternum * TMath::Sqrt((Float_t)fNumLoGainSamples),
    489                               avouterprms/avouternum * TMath::Sqrt((Float_t)fNumLoGainSamples/avouternum));
    490       avouterpix->SetNumLoGainSamples((Float_t)fNumLoGainSamples);
     489                              avouterprms/avouternum * fSqrtLoGainSamples,
     490                              avouterprms/avouternum * fSqrtLoGainSamples/avouternum);
     491      avouterpix->SetNumLoGainSamples(fNumLoGainSamples);
    491492      avouterpix->ApplyLoGainConversion();
    492493  }
     
    494495  {
    495496      avouterpix->SetPedestal(avouterped/avouternum  * fNumHiGainSamples,
    496                               avouterprms/avouternum * TMath::Sqrt((Float_t)fNumHiGainSamples),
    497                               avouterprms/avouternum * TMath::Sqrt((Float_t)fNumHiGainSamples/avouternum));
     497                              avouterprms/avouternum * fSqrtHiGainSamples,
     498                              avouterprms/avouternum * fSqrtHiGainSamples/avouternum);
    498499  }
    499500
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r3429 r3446  
    317317                << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
    318318                << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
     319                << " Saturated? :" << pix->IsHiGainSaturation()
    319320                << endl;
    320321          id++;
     
    342343                << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
    343344                << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
     345                << " Saturated? :" << pix->IsHiGainSaturation()
    344346                << endl;
    345347            id++;
     
    366368                << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
    367369                << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
     370                << " Saturated? :" << pix->IsHiGainSaturation()
    368371                << endl;
    369372            id++;
     
    702705      break;
    703706    case 34:
    704       if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK())
    705         return kFALSE;
    706       if ((*this)[idx].IsHiGainSaturation())
    707         val = 1;
    708       else
    709         return kFALSE;
     707      if ((*this)[idx].IsExcluded())
     708        return kFALSE;
     709      val = (*this)[idx].IsHiGainSaturation();
    710710      break;
    711711    case 35:
  • trunk/MagicSoft/Mars/msignal/MExtractSignal.cc

    r3397 r3446  
    109109        return kFALSE;
    110110
    111     fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1,
    112                                 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1);
     111    fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, (Float_t)fNumHiGainSamples,
     112                                fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1, (Float_t)fNumLoGainSamples);
    113113
    114114    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
  • trunk/MagicSoft/Mars/msignal/MExtractSignal2.cc

    r3397 r3446  
    7777}
    7878
    79 void MExtractSignal2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast, Byte_t windowsize)
     79void MExtractSignal2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t windowh, Byte_t lofirst, Byte_t lolast, Byte_t windowl)
    8080{
    8181
     
    8686    fLoGainFirst = lofirst;
    8787
    88    
    89     fWindowSize = windowsize & ~1;
    90 
    91     if (fWindowSize != windowsize)
    92       *fLog << warn << "MExtractSignal2::SetRange - window size has to be even, set to: " << int(fWindowSize) << " samples " << endl;
     88    fWindowSizeHiGain = windowh & ~1;
     89    fWindowSizeLoGain = windowl & ~1;
     90
     91    if (fWindowSizeHiGain != windowh)
     92      *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size has to be even, set to: "
     93            << int(fWindowSizeHiGain) << " samples " << endl;
    9394   
    94     if (fWindowSize<2)
    95     {
    96       fWindowSize = 2;
    97       *fLog << warn << "MExtractSignal2::SetRange - window size set to two samples" << endl;
    98     }
    99 
    100     if (fWindowSize > fNumHiGainSamples)
    101     {
    102       fWindowSize = fNumLoGainSamples & ~1;
    103       *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl;
    104     }
     95    if (fWindowSizeLoGain != windowl)
     96      *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size has to be even, set to: "
     97            << int(fWindowSizeLoGain) << " samples " << endl;
    10598   
    106     if (fWindowSize > fNumLoGainSamples)
    107     {
    108       fWindowSize = fNumLoGainSamples & ~1;
    109       *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl;
    110     }
    111 
    112     fWindowSizeSqrt = TMath::Sqrt((Float_t)fWindowSize);
     99    if (fWindowSizeHiGain<2)
     100    {
     101      fWindowSizeHiGain = 2;
     102      *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size set to two samples" << endl;
     103    }
     104
     105    if (fWindowSizeLoGain<2)
     106    {
     107      fWindowSizeLoGain = 2;
     108      *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size set to two samples" << endl;
     109    }
     110
     111    if (fWindowSizeHiGain > fNumHiGainSamples)
     112    {
     113      fWindowSizeHiGain = fNumHiGainSamples & ~1;
     114      *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size set to "
     115            << int(fWindowSizeHiGain) << " samples " << endl;
     116    }
     117   
     118    if (fWindowSizeLoGain > fNumLoGainSamples)
     119    {
     120      fWindowSizeLoGain = fNumLoGainSamples & ~1;
     121      *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size set to "
     122            << int(fWindowSizeLoGain) << " samples " << endl;
     123    }
     124
     125    fWindowSqrtHiGain = TMath::Sqrt((Float_t)fWindowSizeHiGain);
     126    fWindowSqrtLoGain = TMath::Sqrt((Float_t)fWindowSizeLoGain);
    113127
    114128}
     
    141155        return kFALSE;
    142156
    143     fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1,
    144                                 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1);
     157    fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, (Float_t)fWindowSizeHiGain,
     158                                fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1, (Float_t)fWindowSizeLoGain);
    145159
    146160    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
     
    158172}
    159173
    160 void MExtractSignal2::FindSignal(Byte_t *ptr, Byte_t size, Int_t &max, Int_t &sat) const
     174void MExtractSignal2::FindSignal(Byte_t *ptr, Byte_t size, Byte_t window, Int_t &max, Int_t &sat) const
    161175{
    162176    const Byte_t *end = ptr + size;
     
    169183    sat = 0;
    170184    Byte_t *p = ptr;
    171     while (p<ptr+fWindowSize)
     185    while (p<ptr+window)
    172186    {
    173187        sum += *p;
     
    189203    //
    190204    max=sum;
    191     for (p=ptr; p+fWindowSize<end; p++)
    192     {
    193         sum += *(p+fWindowSize) - *p;
     205    for (p=ptr; p+window<end; p++)
     206    {
     207        sum += *(p+window) - *p;
    194208        if (sum>max)
    195209            max = sum;
     
    214228        //
    215229        Int_t sumhi, sathi;
    216         FindSignal(pixel.GetHiGainSamples()+fHiGainFirst, fNumHiGainSamples, sumhi, sathi);
     230        FindSignal(pixel.GetHiGainSamples()+fHiGainFirst, fNumHiGainSamples, fWindowSizeHiGain, sumhi, sathi);
    217231
    218232        Int_t sumlo=0;
     
    220234        if (pixel.HasLoGain())
    221235        {
    222             FindSignal(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, sumlo, satlo);
     236            FindSignal(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, fWindowSizeLoGain, sumlo, satlo);
    223237            if (satlo)
    224238                sat++;
     
    239253        // Set extracted signal with pedestal substracted
    240254        //
    241         pix.SetExtractedSignal(sumhi - pedes*fWindowSize, pedrms*fWindowSizeSqrt,
    242                                sumlo - pedes*fWindowSize, pedrms*fWindowSizeSqrt);
     255        pix.SetExtractedSignal(sumhi - pedes*fWindowSizeHiGain, pedrms*fWindowSqrtHiGain,
     256                               sumlo - pedes*fWindowSizeLoGain, pedrms*fWindowSqrtLoGain);
    243257
    244258        pix.SetGainSaturation(sathi, sathi, satlo);
  • trunk/MagicSoft/Mars/msignal/MExtractSignal2.h

    r3306 r3446  
    3737    Byte_t  fNumLoGainSamples;  // Number of lo gain to be used
    3838
    39     Byte_t  fWindowSize;            // Number of gains in window
    40     Float_t fWindowSizeSqrt;        // Sqaure root of number of gains in window
     39    Byte_t  fWindowSizeHiGain;  // Number of Hi Gain slices in window
     40    Float_t fWindowSqrtHiGain;  // Sqaure root of number of Hi Gain slices in window
     41
     42    Byte_t  fWindowSizeLoGain;  // Number of Lo Gain slices in window
     43    Float_t fWindowSqrtLoGain;  // Sqaure root of number of Lo Gain slices in window
    4144
    4245    Byte_t  fSaturationLimit;
    4346
    44     void   FindSignal(Byte_t *ptr, Byte_t size, Int_t &max, Int_t &sat) const;
     47    void   FindSignal(Byte_t *ptr, Byte_t size, Byte_t window, Int_t &max, Int_t &sat) const;
    4548
    4649    Int_t  PreProcess(MParList *pList);
     
    5053    MExtractSignal2(const char *name=NULL, const char *title=NULL);
    5154
    52     void SetRange(Byte_t hifirst=fgFirst, Byte_t hilast=fgLast, Byte_t lofirst=fgFirst, Byte_t lolast=fgLast, Byte_t window_size=fgWindowSize);
     55    void SetRange(Byte_t hifirst=fgFirst, Byte_t hilast=fgLast, Byte_t windowh=fgWindowSize,
     56                  Byte_t lofirst=fgFirst, Byte_t lolast=fgLast, Byte_t windowl=fgWindowSize);
    5357    void SetSaturationLimit(Byte_t lim) { fSaturationLimit = lim; }
    5458
  • trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.h

    r3306 r3446  
    2424    Byte_t fLastUsedSliceLoGain;
    2525
     26    Float_t fUsedWindowHiGain;
     27    Float_t fUsedWindowLoGain;
     28   
    2629public:
    2730
     
    3639    Int_t GetSize() const;
    3740
    38     Byte_t GetNumUsedFADCSlices() const       { return fLastUsedSliceHiGain-fFirstUsedSliceHiGain+1; }
    39     Byte_t GetNumUsedHiGainFADCSlices() const { return fLastUsedSliceHiGain-fFirstUsedSliceHiGain+1; }
    40     Byte_t GetNumUsedLoGainFADCSlices() const { return fLastUsedSliceLoGain-fFirstUsedSliceLoGain+1; }
     41    Float_t GetNumUsedHiGainFADCSlices() const { return fUsedWindowHiGain; }
     42    Float_t GetNumUsedLoGainFADCSlices() const { return fUsedWindowLoGain; }
    4143
    4244    Byte_t GetFirstUsedSliceHiGain() const    { return fFirstUsedSliceHiGain; }
    43     Byte_t GetLastUsedSliceHiGain() const     { return fLastUsedSliceHiGain; }
     45    Byte_t GetFirstUsedSliceLoGain() const    { return fFirstUsedSliceLoGain; }
    4446
    45     Byte_t GetFirstUsedSliceLoGain() const    { return fFirstUsedSliceLoGain; }
    46     Byte_t GetLastUsedSliceLoGain() const     { return fLastUsedSliceLoGain; }
     47    Byte_t GetLastUsedSliceHiGain()  const    { return fLastUsedSliceHiGain; }
     48    Byte_t GetLastUsedSliceLoGain()  const    { return fLastUsedSliceLoGain; }
    4749
    48     void   SetUsedFADCSlices(Byte_t firsth, Byte_t lasth,
    49                              Byte_t firstl, Byte_t lastl)
     50    void   SetUsedFADCSlices(Byte_t firsth, Byte_t lasth, Float_t winh,
     51                             Byte_t firstl, Byte_t lastl, Float_t winl)
    5052    {
    5153      fFirstUsedSliceHiGain    = firsth;
    5254      fLastUsedSliceHiGain     = lasth;
     55      fUsedWindowHiGain        = winh;
    5356      fFirstUsedSliceLoGain    = firstl;
    5457      fLastUsedSliceLoGain     = lastl;
     58      fUsedWindowLoGain        = winl;
    5559    }
    5660
Note: See TracChangeset for help on using the changeset viewer.