Changeset 5219 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
10/11/04 17:36:35 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5212 r5219  
    1919
    2020                                                 -*-*- END OF LINE -*-*-
     21
     22 2004/10/11: Markus Gaug
     23
     24   * mpedestal/MPedCalcPedRun.[h,cc]
     25     - calculate addtionally to the usual pedestal the ABOffset, like
     26       in MPedCalcFromLoGain.
     27
    2128
    2229 2004/10/08: Markus Meyer and Keiichi Mase
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc

    r5204 r5219  
    190190    fRunHeader = NULL;
    191191    fPedestals = NULL;
     192
     193    // If the size is yet set, set the size
     194    if (fSumx.GetSize()>0)
     195    {
     196        // Reset contents of arrays.
     197        fSumx.Reset();
     198        fSumx2.Reset();
     199        fSumAB0.Reset();
     200        fSumAB1.Reset();
     201
     202        fAreaSumx. Reset();
     203        fAreaSumx2.Reset();
     204        fAreaSumAB0.Reset();
     205        fAreaSumAB1.Reset();
     206        fAreaValid.Reset();
     207       
     208        fSectorSumx. Reset();
     209        fSectorSumx2.Reset();
     210        fSectorSumAB0.Reset();
     211        fSectorSumAB1.Reset();
     212        fSectorValid.Reset();
     213    }
    192214}
    193215
     
    241263    {
    242264        *fLog << warn;
    243         *fLog << GetDescriptor() << ": HiGain window currently set to 0, will set it to 2 samples ";
     265        *fLog << GetDescriptor() << ": HiGain window currently set to 0, will set it to 2 samples " << endl;
    244266        fWindowSizeHiGain = 2;
    245267    }
     
    248270    {
    249271        *fLog << warn;
    250         *fLog << GetDescriptor() << ": LoGain window currently set to 0, will set it to 2 samples ";
     272        *fLog << GetDescriptor() << ": LoGain window currently set to 0, will set it to 2 samples " << endl;
    251273        fWindowSizeLoGain = 2;
    252274    }
     
    346368Bool_t MPedCalcPedRun::ReInit(MParList *pList)
    347369{
     370
    348371  Int_t lastdesired   = (Int_t)fLoGainLast;
    349372  Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1;
     
    414437  if (fSumx.GetSize()==0)
    415438    {
    416       fSumx. Set(npixels);
    417       fSumx2.Set(npixels);
    418      
    419       fAreaSumx. Set(areas);
    420       fAreaSumx2.Set(areas);
    421       fAreaValid.Set(areas);
    422      
    423       fSectorSumx. Set(sectors);
    424       fSectorSumx2.Set(sectors);
    425       fSectorValid.Set(sectors);
    426      
    427       fSumx.Reset();
     439      fSumx.  Set(npixels);
     440      fSumx2. Set(npixels);
     441      fSumAB0.Set(npixels);
     442      fSumAB1.Set(npixels);
     443     
     444      fAreaSumx.  Set(areas);
     445      fAreaSumx2. Set(areas);
     446      fAreaSumAB0.Set(areas);
     447      fAreaSumAB1.Set(areas);
     448      fAreaValid. Set(areas);
     449     
     450      fSectorSumx.  Set(sectors);
     451      fSectorSumx2. Set(sectors);
     452      fSectorSumAB0.Set(sectors);
     453      fSectorSumAB1.Set(sectors);
     454      fSectorValid. Set(sectors);
     455     
     456      fSumx. Reset();
    428457      fSumx2.Reset();
    429458    }
     
    454483Int_t MPedCalcPedRun::Process()
    455484{
     485
    456486  MRawEvtPixelIter pixel(fRawEvt);
    457487 
     
    467497      UInt_t sum = 0;
    468498      UInt_t sqr = 0;
     499      UInt_t ab0 = 0;
     500      UInt_t ab1 = 0;
     501      Int_t  cnt = 0;
    469502
    470503      if (fWindowSizeHiGain != 0)
     
    474507              sum += *ptr;
    475508              sqr += *ptr * *ptr;
     509
     510              if (pixel.IsABFlagValid())
     511                {
     512                  const Int_t abFlag = (fHiGainFirst + pixel.HasABFlag() + cnt) & 0x1;
     513                  if (abFlag)
     514                    ab1 += *ptr;
     515                  else
     516                    ab0 += *ptr;
     517
     518                  cnt++;
     519                }
    476520            }
    477521          while (++ptr != end);
    478522        }
     523
     524      cnt = 0;
    479525     
    480526      if (fWindowSizeLoGain != 0)
     
    488534              sum += *ptr;
    489535              sqr += *ptr * *ptr;
     536
     537              if (pixel.IsABFlagValid())
     538                {
     539                  const Int_t abFlag = (fLoGainFirst + pixel.GetNumHiGainSamples() + pixel.HasABFlag() + cnt)
     540                                      & 0x1;
     541                  if (abFlag)
     542                    ab1 += *ptr;
     543                  else
     544                    ab0 += *ptr;
     545
     546                  cnt++;
     547                }
     548
    490549            }
    491550          while (++ptr != end);
     
    506565      fAreaSumx[aidx]     += msum;
    507566      fSectorSumx[sector] += msum;     
     567
    508568      //
    509569      // The old version:
     
    518578      fAreaSumx2[aidx]     += sqrsum;
    519579      fSectorSumx2[sector] += sqrsum;     
     580
     581      //
     582      // Now, the sums separated for AB0 and AB1
     583      //
     584      fSumAB0[idx]        += ab0;
     585      fSumAB1[idx]        += ab1;
     586
     587      fAreaSumAB0[aidx]   += ab0;
     588      fAreaSumAB1[aidx]   += ab1;     
     589     
     590      fSectorSumAB0[aidx] += ab0;
     591      fSectorSumAB1[aidx] += ab1;     
    520592    }
    521593 
     
    532604Int_t MPedCalcPedRun::PostProcess()
    533605{
     606
    534607  // Compute pedestals and rms from the whole run
    535608  const ULong_t n     = fNumSamplesTot;
     
    563636      higainVar /= (Float_t)(fWindowSizeHiGain+fWindowSizeLoGain);
    564637      // 3. Calculate the RMS from the Variance:
    565       (*fPedestals)[pixid].Set(higainped, higainVar < 0 ? 0. : TMath::Sqrt(higainVar));
     638      const Float_t rms = higainVar<0 ? 0. : TMath::Sqrt(higainVar);
     639      // 4. Calculate the amplitude of the 150MHz "AB" noise
     640      const Float_t abOffs = (fSumAB0.At(pixid) - fSumAB1.At(pixid)) / n;
     641     
     642      *fLog << "THIS is the aboffs: " << abOffs << endl;
     643
     644      (*fPedestals)[pixid].Set(higainped,rms,abOffs);
    566645
    567646    }
     
    594673      //    in order to be comparable to the mean of pedRMS of that area
    595674      higainrms *= TMath::Sqrt((Float_t)napix);
    596 
    597       fPedestals->GetAverageArea(aidx).Set(higainped, higainrms);
     675      // 5. Calculate the amplitude of the 150MHz "AB" noise
     676      const Float_t abOffs = (fAreaSumAB0.At(aidx) - fAreaSumAB1.At(aidx)) / an;
     677
     678      fPedestals->GetAverageArea(aidx).Set(higainped, higainrms,abOffs);
    598679    }
    599680 
     
    625706      //    in order to be comparable to the mean of pedRMS of that sector
    626707      higainrms *= TMath::Sqrt((Float_t)nspix);
    627 
    628       fPedestals->GetAverageSector(sector).Set(higainped, higainrms);
     708      // 5. Calculate the amplitude of the 150MHz "AB" noise
     709      const Float_t abOffs = (fSectorSumAB0.At(sector) - fSectorSumAB1.At(sector)) / sn;
     710
     711      fPedestals->GetAverageSector(sector).Set(higainped, higainrms, abOffs);
    629712    }
    630713 
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.h

    r4629 r5219  
    1515
    1616class MGeomCam;
    17 
    1817class MPedCalcPedRun : public MExtractor
    1918{
    20     static const Byte_t fgHiGainFirst;      // First FADC slice Hi-Gain (currently set to: 3)
    21     static const Byte_t fgHiGainLast;       // Last FADC slice Hi-Gain (currently set to: 14)
    22     static const Byte_t fgLoGainFirst;      // First FADC slice Lo-Gain (currently set to: 3)
    23     static const Byte_t fgLoGainLast;       // Last FADC slice Lo-Gain (currently set to: 14)
    24     static const Byte_t fgHiGainWindowSize; // The extraction window Hi-Gain
    25     static const Byte_t fgLoGainWindowSize; // The extraction window Lo-Gain
    2619
    27     UInt_t  fNumSamplesTot;
    28     Byte_t  fWindowSizeHiGain; // Number of Hi Gain slices in window
    29     Byte_t  fWindowSizeLoGain; // Number of Lo Gain slices in window
     20  static const Byte_t fgHiGainFirst;      // First FADC slice Hi-Gain (currently set to: 3)
     21  static const Byte_t fgHiGainLast;       // Last FADC slice Hi-Gain (currently set to: 14)
     22  static const Byte_t fgLoGainFirst;      // First FADC slice Lo-Gain (currently set to: 3)
     23  static const Byte_t fgLoGainLast;       // Last FADC slice Lo-Gain (currently set to: 14)
     24  static const Byte_t fgHiGainWindowSize; // The extraction window Hi-Gain
     25  static const Byte_t fgLoGainWindowSize; // The extraction window Lo-Gain
     26 
     27  UInt_t  fNumSamplesTot;
     28  Byte_t  fWindowSizeHiGain; // Number of Hi Gain slices in window
     29  Byte_t  fWindowSizeLoGain; // Number of Lo Gain slices in window
     30 
     31  MGeomCam *fGeom;           // Camera geometry
     32 
     33  TArrayD fSumx;             // sum of values
     34  TArrayD fSumx2;            // sum of squared values
     35  TArrayD fSumAB0;           // sum of ABFlag=0 slices
     36  TArrayD fSumAB1;           // sum of ABFlag=1 slices
     37  TArrayD fAreaSumx;         // averaged sum of values per area idx
     38  TArrayD fAreaSumx2;        // averaged sum of squared values per area idx
     39  TArrayD fAreaSumAB0;       // averaged sum of ABFlag=0 slices per area idx
     40  TArrayD fAreaSumAB1;       // averaged sum of ABFlag=1 slices per area idx
     41  TArrayI fAreaValid;        // number of valid pixel with area idx
     42  TArrayD fSectorSumx;       // averaged sum of values per sector
     43  TArrayD fSectorSumx2;      // averaged sum of squared values per sector
     44  TArrayD fSectorSumAB0;     // averaged sum of ABFlag=0 slices per sector
     45  TArrayD fSectorSumAB1;     // averaged sum of ABFlag=1 slices per sector
     46  TArrayI fSectorValid;      // number of valid pixel with sector idx
     47 
     48  Int_t  PreProcess (MParList *pList);
     49  Bool_t ReInit     (MParList *pList);
     50  Int_t  Process    ();
     51  Int_t  PostProcess();
     52  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
     53 
     54public:
    3055
    31     MGeomCam *fGeom;           // Camera geometry
    32 
    33     TArrayD fSumx;             // sum of values
    34     TArrayD fSumx2;            // sum of squared values
    35     TArrayD fAreaSumx;         // averaged sum of values per area idx
    36     TArrayD fAreaSumx2;        // averaged sum of squared values per area idx
    37     TArrayI fAreaValid;        // number of valid pixel with area idx
    38     TArrayD fSectorSumx;       // averaged sum of values per sector
    39     TArrayD fSectorSumx2;      // averaged sum of squared values per sector
    40     TArrayI fSectorValid;      // number of valid pixel with sector idx
    41 
    42     Int_t  PreProcess (MParList *pList);
    43     Bool_t ReInit     (MParList *pList);
    44     Int_t  Process    ();
    45     Int_t  PostProcess();
    46     Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    47 
    48 public:
    49     MPedCalcPedRun(const char *name=NULL, const char *title=NULL);
    50 
    51     void Clear(const Option_t *o="");
    52     void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
    53     void SetWindowSize(Byte_t windowh=0, Byte_t windowl=0);
    54 
    55     ClassDef(MPedCalcPedRun, 0)   // Task to calculate pedestals from pedestal runs raw data
     56  MPedCalcPedRun(const char *name=NULL, const char *title=NULL);
     57 
     58  void Clear(const Option_t *o="");
     59 
     60  void SetRange        ( const Byte_t hifirst=0, const Byte_t hilast=0,
     61                         const Byte_t lofirst=0, const Byte_t lolast=0  );
     62  void SetWindowSize   ( const Byte_t windowh=0, const Byte_t windowl=0 );
     63 
     64  ClassDef(MPedCalcPedRun, 0)   // Task to calculate pedestals from pedestal runs raw data
    5665};
    5766
Note: See TracChangeset for help on using the changeset viewer.