Changeset 3123 for trunk/MagicSoft


Ignore:
Timestamp:
02/12/04 19:44:24 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/NEWS

    r3122 r3123  
    11                                                               -*-*- END -*-*-
    22 *** Version <cvs>
     3
     4   - added filter against cosmics: MFCosmics:
     5     To be used together with MContinue
    36
    47   - added new class MArrivalTimeCalc2:
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc

    r3121 r3123  
    115115const UInt_t MCalibrationCalc::fPINDiodeId   = 9999;
    116116const Byte_t MCalibrationCalc::fgSaturationLimit = 254;
    117 const Byte_t MCalibrationCalc::fgBlindPixelFirst = 10;
    118 const Byte_t MCalibrationCalc::fgBlindPixelLast  = 20;
    119 const Int_t  MCalibrationCalc::fgBlindPixelSinglePheCut = 200;
     117const Int_t MCalibrationCalc::fgBlindPixelFirst = 10;
     118const Int_t MCalibrationCalc::fgBlindPixelLast  = 20;
     119const Int_t  MCalibrationCalc::fgBlindPixelSinglePheCut = 400;
    120120
    121121// --------------------------------------------------------------------------
     
    155155    fBlindPixelLast    = 0;
    156156
     157    fNumBlindPixelSinglePhe = 0;
     158    fNumBlindPixelPedestal  = 0; 
     159
    157160    fNumHiGainSamples  = 0;
    158161    fNumLoGainSamples  = 0;
     
    163166}
    164167
    165 void MCalibrationCalc::SetBlindPixelRange(Byte_t first, Byte_t last)
     168void MCalibrationCalc::SetBlindPixelRange(Int_t first, Int_t last)
    166169{
    167170 
    168171  fBlindPixelFirst = first;
    169172  fBlindPixelLast  = last;
     173
    170174}
    171175
     
    396400 
    397401  //
    398   // Create a (second) loop to do fill the calibration histograms
     402  // Create a loop to fill the calibration histograms
    399403  // Search for: a signal in MExtractedSignalCam
    400404  // Fill histograms with:
    401405  //             charge
    402406  //             charge vs. event nr.
    403   //             relative arrival time w.r.t. pixel 1
    404407  //
    405408  while (pixel.Next())
     
    466469              // We need a dedicated signal extractor for the blind pixel
    467470              //
    468               Int_t diff = 0;
    469 
    470               if (fBlindPixelLast > 15)
     471              Int_t diff  = 0;
     472              Int_t last  = fBlindPixelLast;
     473              Int_t first = fBlindPixelFirst;
     474
     475              if (last > 15)
    471476                {
    472                   diff = fBlindPixelLast - 15;
    473                   fBlindPixelLast = 15;
     477                  diff = last - 15;
     478                  last = 15;
    474479                }
    475480
    476               Byte_t *start   = ptr   + fBlindPixelFirst - 1;
    477               Byte_t *end     = start + fBlindPixelLast - fBlindPixelFirst + 1;
     481              Byte_t *start   = ptr + first - 1;
     482              Byte_t *end     = ptr + last  - 1;
    478483
    479484              ptr = start;
     
    481486              Int_t sum = 0;
    482487             
    483               while (ptr<end)
     488              while (ptr<=end)
    484489                {
    485490                  sum += *ptr;
     
    490495                {
    491496                  ptr = pixel.GetLoGainSamples();
     497                  end = ptr + diff - 1;
    492498                 
    493                   end     = ptr + diff + 1;
    494                  
    495                   while (ptr<end)
     499                  while (ptr<=end)
    496500                    {
    497501                      sum += *ptr;
     
    531535
    532536              if (blindpixelsumhi > fBlindPixelSinglePheCut)
    533                 hist = (blindpixel.GetHist())->GetHSinglePheFADCSlices();
     537                {
     538                  hist = (blindpixel.GetHist())->GetHSinglePheFADCSlices();
     539                  fNumBlindPixelSinglePhe++;
     540                }
    534541              else
    535                 hist = (blindpixel.GetHist())->GetHPedestalFADCSlices();
    536 
     542                {
     543                  hist = (blindpixel.GetHist())->GetHPedestalFADCSlices();
     544                  fNumBlindPixelPedestal++;
     545                }
     546             
    537547              ptr = pixel.GetHiGainSamples();
    538548              for (Int_t i=1;i<16;i++)
    539549                hist->Fill(i,*ptr++);
     550
    540551              ptr = pixel.GetLoGainSamples();
    541552              for (Int_t i=16;i<31;i++)
     
    544555            } /* if use blind pixel */
    545556         
    546           //          break;
     557          break;
    547558        case fPINDiodeId:
    548559
     
    643654      // so that we can use it for the fit
    644655      //
     656      Float_t pedestal;
     657      Float_t pederr;
     658      Float_t pedsigma;
     659      Float_t pedsigmaerr;
     660     
     661      const ULong_t nentries    = fPedestals->GetTotalEntries();
     662      const Int_t   nslices     = fBlindPixelLast-fBlindPixelFirst+1;
     663      const Float_t sqrslice    = TMath::Sqrt((Float_t)nslices);
     664      //
     665      // retrieve the pedestal pix of the blind pixel
     666      //
    645667      if (fPedestals->GetHistSize() > fBlindPixelId)
    646668        {
    647 
    648           Float_t pedestal;
    649           Float_t pederr;
    650           Float_t pedsigma;
    651           Float_t pedsigmaerr;
    652 
    653           const ULong_t nentries    = fPedestals->GetTotalEntries();
    654           const Float_t nslices     = (Float_t)(fgBlindPixelLast-fgBlindPixelFirst+1);
    655           const Float_t sqrslice    = TMath::Sqrt(nslices);
     669          MHPedestalPixel &pedhist = (*fPedestals)(fBlindPixelId);
     670          pedestal    = pedhist.GetChargeMean()*nslices;
     671          pederr      = pedhist.GetChargeMeanErr()*nslices;
    656672          //
    657           // retrieve the pedestal pix of the blind pixel
    658           //
    659           if (fPedestals->GetHistSize() != 0)
    660             {
    661               MHPedestalPixel &pedhist = (*fPedestals)(fBlindPixelId);
    662               pedestal    = pedhist.GetChargeMean()*nslices;
    663               pederr      = pedhist.GetChargeMeanErr()*nslices;
    664               //
    665               // Fitted sigma: 1. one sqrt(Nr. slices) for the division which is not
    666               //                  not appropriate: sigma(real)/slice = GetSigma*sqrt(nslices)
    667               //               2. another sqrt(Nr. slices) to calculate back to number
    668               //                  of slices
    669               //
    670               pedsigma    = pedhist.GetChargeSigma()*nslices;
    671               pedsigmaerr = pedhist.GetChargeSigmaErr()*nslices;
    672             }
    673           else
    674             {
    675               MPedestalPix    &pedpix  = (*fPedestals)[fBlindPixelId];
    676               pedestal    = pedpix.GetPedestal()*nslices;
    677               pederr      = pedpix.GetPedestalRms()*nslices/nentries;
    678               pedsigma    = pedpix.GetPedestalRms()*sqrslice;
    679               pedsigmaerr = pederr/2.;
    680             }
    681           //
    682           // retrieve the histogram containers
    683           //
    684           MHCalibrationBlindPixel *hist = blindpixel.GetHist();
    685 
    686           hist->SetMeanPedestal(pedestal);
    687           hist->SetMeanPedestalErr(pederr);
    688           hist->SetSigmaPedestal(pedsigma);
    689           hist->SetSigmaPedestalErr(pedsigmaerr);
     673          // Fitted sigma: 1. one sqrt(Nr. slices) for the division which is not
     674          //                  not appropriate: sigma(real)/slice = GetSigma*sqrt(nslices)
     675          //               2. another sqrt(Nr. slices) to calculate back to number
     676          //                  of slices
     677          //
     678          pedsigma    = pedhist.GetChargeSigma()*nslices;
     679          pedsigmaerr = pedhist.GetChargeSigmaErr()*nslices;
    690680        }
    691      
     681      else
     682        {
     683          MPedestalPix    &pedpix  = (*fPedestals)[fBlindPixelId];
     684          pedestal    = pedpix.GetPedestal()*nslices;
     685          pederr      = pedpix.GetPedestalRms()*nslices/nentries;
     686          pedsigma    = pedpix.GetPedestalRms()*sqrslice;
     687          pedsigmaerr = pederr/2.;
     688        }
     689      //
     690      // retrieve the histogram containers
     691      //
     692      MHCalibrationBlindPixel *hist = blindpixel.GetHist();
     693     
     694      hist->SetMeanPedestal(pedestal);
     695      hist->SetMeanPedestalErr(pederr);
     696      hist->SetSigmaPedestal(pedsigma);
     697      hist->SetSigmaPedestalErr(pedsigmaerr);
     698 
    692699      if (!blindpixel.FitCharge())
    693700        {
     
    702709        fCalibrations->SetBlindPixelMethodValid(kFALSE);
    703710
     711      TH1I *sphehist = hist->GetHSinglePheFADCSlices();
     712      TH1I *pedhist  = hist->GetHPedestalFADCSlices();
     713
     714      if (fNumBlindPixelSinglePhe > 1)
     715        sphehist->Scale(1./fNumBlindPixelSinglePhe);
     716      if (fNumBlindPixelPedestal > 1)
     717        pedhist->Scale(1./fNumBlindPixelPedestal);
     718     
    704719      blindpixel.DrawClone();
    705720    }
    706721  else
    707722    *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Fit " << endl;
     723
     724  *fLog << err << "total: " << GetNumExecutions() << " sphe: " << fNumBlindPixelSinglePhe << " ped: " << fNumBlindPixelPedestal << endl;
    708725
    709726 
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h

    r3120 r3123  
    3838private:
    3939
    40   static const UInt_t fBlindPixelId;        // ID of the blind pixel
    41   static const UInt_t fPINDiodeId;          // ID of the PIN Diode
    42   static const Byte_t fgSaturationLimit;    // Saturation of Hi Gain
    43   static const Byte_t fgBlindPixelFirst;    // First FADC slice blind pixel
    44   static const Byte_t fgBlindPixelLast;     // Last FADC slice blind pixel
    45 
     40  static const UInt_t fBlindPixelId;            // ID of the blind pixel
     41  static const UInt_t fPINDiodeId;              // ID of the PIN Diode
     42  static const Byte_t fgSaturationLimit;        // Saturation of Hi Gain
     43  static const Int_t  fgBlindPixelFirst;        // First FADC slice blind pixel
     44  static const Int_t  fgBlindPixelLast;         // Last FADC slice blind pixel
    4645  static const Int_t  fgBlindPixelSinglePheCut; // FADC sum from which on an event is considered as a S.ph. one.
    4746 
    48   MPedestalCam             *fPedestals;    // Pedestals of all pixels in the camera
    49   MCalibrationCam          *fCalibrations; // Calibration events of all pixels in the camera
    50   MExtractedSignalCam      *fSignals;      // Calibration events of all pixels in the camera
     47  MPedestalCam             *fPedestals;         // Pedestals of all pixels in the camera
     48  MCalibrationCam          *fCalibrations;      // Calibration events of all pixels in the camera
     49  MExtractedSignalCam      *fSignals;           // Calibration events of all pixels in the camera
    5150
    52   MRawEvtData              *fRawEvt;       // raw event data (time slices)
    53   MRawRunHeader            *fRunHeader;    // RunHeader information
     51  MRawEvtData              *fRawEvt;            // raw event data (time slices)
     52  MRawRunHeader            *fRunHeader;         // RunHeader information
    5453
    55   MTime                    *fEvtTime;      // Time of the event
     54  MTime                    *fEvtTime;           // Time of the event
    5655
    57   Byte_t fNumHiGainSamples;
    58   Byte_t fNumLoGainSamples;
     56  Byte_t  fNumHiGainSamples;
     57  Byte_t  fNumLoGainSamples;
    5958  Float_t fSqrtHiGainSamples;
    6059 
    61   Byte_t fBlindPixelFirst;
    62   Byte_t fBlindPixelLast;
     60  Int_t   fBlindPixelFirst;
     61  Int_t   fBlindPixelLast;
     62  Int_t   fBlindPixelSinglePheCut;
    6363
    64   Int_t  fBlindPixelSinglePheCut;
     64  Int_t   fNumBlindPixelSinglePhe;
     65  Int_t   fNumBlindPixelPedestal; 
    6566 
    6667  Float_t fConversionHiLo;
    67   Int_t   fFlags;                           // Flag for the fits used
     68  Int_t   fFlags;                                // Flag for the fits used
    6869
    6970  TString fExcludedPixelsFile;
    7071  UInt_t  fNumExcludedPixels;
    7172
    72   enum  { kUseBlindPixelFit, kUsePinDiodeFit,
     73  enum  { kUseBlindPixelFit,
     74          kUsePinDiodeFit,
    7375          kUseQualityChecks,
    7476          kHiLoGainCalibration,
    75           kHiGainOverFlow, kLoGainOverFlow  };
     77          kHiGainOverFlow,
     78          kLoGainOverFlow  };
    7679 
    7780public:
     
    97100 
    98101  void SkipBlindPixelFit(Bool_t b=kTRUE)
    99       {b ? CLRBIT(fFlags, kUseBlindPixelFit) : SETBIT(fFlags, kUseBlindPixelFit);}
     102      {b ? CLRBIT(fFlags, kUseBlindPixelFit)    : SETBIT(fFlags, kUseBlindPixelFit);}
    100103  void SkipPinDiodeFit(Bool_t b=kTRUE)
    101       {b ? CLRBIT(fFlags, kUsePinDiodeFit) : SETBIT(fFlags, kUsePinDiodeFit);}
     104      {b ? CLRBIT(fFlags, kUsePinDiodeFit)      : SETBIT(fFlags, kUsePinDiodeFit);}
    102105  void SkipQualityChecks(Bool_t b=kTRUE)
    103       {b ? CLRBIT(fFlags, kUseQualityChecks) : SETBIT(fFlags, kUseQualityChecks);}
     106      {b ? CLRBIT(fFlags, kUseQualityChecks)    : SETBIT(fFlags, kUseQualityChecks);}
    104107  void SkipHiLoGainCalibration(Bool_t b=kTRUE)
    105108      {b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration);}
     
    107110
    108111  // Setters
    109   void SetPulserColor(PulserColor_t color)    { fColor = color; }
     112  void SetPulserColor(PulserColor_t color)     { fColor          = color; }
    110113  void SetConversionHiLo(Float_t conv)         { fConversionHiLo = conv; }
    111114
    112   void SetBlindPixelRange(Byte_t first=fgBlindPixelFirst, Byte_t last=fgBlindPixelLast);
    113   void SetBlindPixelSinglePheCut(Int_t cut=fgBlindPixelSinglePheCut)    { fBlindPixelSinglePheCut = cut;  }
     115  void SetBlindPixelRange(Int_t first=fgBlindPixelFirst, Int_t last=fgBlindPixelLast);
     116  void SetBlindPixelSinglePheCut(Int_t cut=fgBlindPixelSinglePheCut)   
     117                                               { fBlindPixelSinglePheCut = cut;  }
    114118 
    115119  // Getters
Note: See TracChangeset for help on using the changeset viewer.