Changeset 2715 for trunk/MagicSoft


Ignore:
Timestamp:
12/18/03 17:23:50 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2714 r2715  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6 2003/12/18: Markus Gaug
     7
     8   * manalysis/MExtractSignal.[h,cc]
     9     - introduced a third argument in the constructor: Byte_t logainshift
     10
     11   * manalysis/MCalibrationCam.cc
     12   * manalysis/MCalibrationPix.cc
     13     - introduced error calculation for the F-Factor method
     14
     15
    616 2003/12/18: Abelardo Moralejo
    717
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc

    r2699 r2715  
    173173MCalibrationPix &MCalibrationCam::operator[](Int_t i) const
    174174{
    175     return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
    176 }
    177 
    178 // --------------------------------------------------------------------------
    179 //
    180 // Return a pointer to the pixel with the requested idx.
    181 // NULL if it doesn't exist.
    182 //
    183 MCalibrationPix *MCalibrationCam::GetCalibrationPix(Int_t idx) const
    184 {
    185    if (idx<0)
    186      return NULL;
    187 
     175
     176  if (!CheckBounds(i))
     177    return *static_cast<MCalibrationPix*>(NULL);
     178
     179  return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
     180}
     181
     182
     183// --------------------------------------------------------------------------
     184//
     185// Return true if pixel is inside bounds of the TClonesArray fPixels
     186//
     187Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const
     188{
    188189  if (!CheckBounds(idx))
    189     return NULL;
    190  
    191   return (MCalibrationPix*)fPixels->At(idx);
    192 }
    193 
    194 
    195 
    196 
    197 Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const
    198 {
     190    return kFALSE;
     191
     192  return kTRUE;
     193}
     194
     195// --------------------------------------------------------------------------
     196//
     197// Return true if pixel has already been fitted once (independent of the result)
     198//
     199Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const
     200{
     201
    199202  if (!CheckBounds(idx))
    200203    return kFALSE;
    201204
    202   return kTRUE;
    203 }
    204 
    205 Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const
    206 {
    207   return ((*this)[idx].GetCharge() > 0. && (*this)[idx].GetErrCharge() > 0.);
    208 }
    209 
    210 
    211 
     205  return (*this)[idx].IsFitted();
     206}
     207
     208// --------------------------------------------------------------------------
     209//
     210// Return TRUE if:
     211//
     212// 1) Pixel is inside the range of the TClonesArray
     213// 2) Pixel has a fitted charge greater than 3*PedRMS
     214// 3) Pixel has a charge sigma bigger than its Pedestal RMS
     215// 4) Pixel has a fit error greater than 0.
     216// 5) Pixel has a fit Probability greater than 0.0001
     217// 6) If FitTimes is used,
     218//    the mean arrival time is at least 1.5 slices from the edge
     219//
     220Bool_t MCalibrationCam::IsPixelFitValid(Int_t idx) const
     221{
     222
     223  if (!CheckBounds(idx))
     224    return kFALSE;
     225
     226  return (*this)[idx].IsFitValid();
     227}
     228
     229// --------------------------------------
     230//
    212231void MCalibrationCam::Clear(Option_t *o)
    213232{
     
    215234}
    216235
     236// --------------------------------------------------------------------------
     237//
     238// Sets the user ranges of all histograms such that
     239// empty bins at the edges are not used. Additionally, it rebins the
     240// histograms such that in total, 50 bins are used.
     241//
    217242void MCalibrationCam::CutEdges()
    218243{
    219244
    220245  fBlindPixel->GetHist()->CutAllEdges();
     246  fPINDiode->GetHist()->CutAllEdges();
    221247
    222248  TIter Next(fPixels);
     
    230256}
    231257 
     258// --------------------------------------------------------------------------
     259//
     260//
     261//
     262//
     263//
    232264void MCalibrationCam::Print(Option_t *o) const
    233265{
    234266
    235     *fLog << all << GetDescriptor() << ":" << endl;
    236     int id = 0;
    237 
    238     *fLog << "Succesfully calibrated pixels:" << endl;
    239     *fLog << endl;
    240 
    241     TIter Next(fPixels);
    242     MCalibrationPix *pix;
    243     while ((pix=(MCalibrationPix*)Next()))
    244     {
    245 
    246       if (pix->GetCharge() >= 0.)
     267  *fLog << all << GetDescriptor() << ":" << endl;
     268  int id = 0;
     269 
     270  *fLog << "Succesfully calibrated pixels:" << endl;
     271  *fLog << endl;
     272
     273  TIter Next(fPixels);
     274  MCalibrationPix *pix;
     275  while ((pix=(MCalibrationPix*)Next()))
     276    {
     277     
     278      if (pix->IsFitValid())
    247279        {
    248280          *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms()
     
    252284        }
    253285    }
    254 
    255     *fLog << id << " succesful pixels :-))" << endl;
    256     id = 0;
    257 
    258     *fLog << endl;
    259     *fLog << "Pixels with errors:" << endl;
    260     *fLog << endl;
    261 
    262     TIter Next2(fPixels);
     286 
     287  *fLog << id << " succesful pixels :-))" << endl;
     288  id = 0;
     289 
     290  *fLog << endl;
     291  *fLog << "Pixels with errors:" << endl;
     292  *fLog << endl;
     293 
     294  TIter Next2(fPixels);
    263295    while ((pix=(MCalibrationPix*)Next2()))
    264     {
    265 
    266       if (pix->GetCharge() == -1.)
    267         {
    268           *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms()
    269                 << " Reduced Charge: " << pix->GetCharge() << " +- "
     296      {
     297       
     298        if (!pix->IsFitValid())
     299          {
     300            *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms()
     301                  << " Reduced Charge: " << pix->GetCharge() << " +- "
    270302                << pix->GetSigmaCharge() << " Reduced Sigma: " << TMath::Sqrt(pix->GetRSigmaSquare()) << endl;
    271           id++;
    272         }
    273     }
     303            id++;
     304          }
     305      }
    274306    *fLog << id << " pixels with errors :-((" << endl;
    275 
     307   
    276308}
    277309
     
    321353        val = -1.;
    322354      break;
     355    case 11:
     356      val = (*this)[idx].GetPheFFactorMethod();
     357      break;
     358    case 12:
     359      val = (*this)[idx].GetPheFFactorMethodError();
     360      break;
     361    case 13:
     362      val = (*this)[idx].GetMeanConversionFFactorMethod();
     363      break;
     364    case 14:
     365      val = (*this)[idx].GetErrorConversionFFactorMethod();
     366      break;
    323367    case 15:
     368      if (idx < 397)
     369        val = (double)fMeanPhotInsidePlexiglass;
     370      else
     371        val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
     372      break;
     373    case 16:
     374      if (idx < 397)
     375        val = (*this)[idx].GetMeanConversionBlindPixelMethod();
     376      else
     377        val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea;
     378      break;
     379    case 17:
    324380      if ((*this)[idx].GetCharge() != 0.)
    325381        val = ((*this)[idx].GetSigmaCharge()/(*this)[idx].GetCharge())*
     
    327383      else
    328384        val = -1.;
    329       break;
    330     case 11:
    331       val = (*this)[idx].GetPheFFactorMethod();
    332       break;
    333     case 12:
    334       val = (*this)[idx].GetMeanConversionFFactorMethod();
    335       break;
    336     case 13:
    337       if (idx < 397)
    338         val = (double)fMeanPhotInsidePlexiglass;
    339       else
    340         val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
    341       break;
    342     case 14:
    343       if (idx < 397)
    344         val = (*this)[idx].GetMeanConversionBlindPixelMethod();
    345       else
    346         val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea;
    347385      break;
    348386    default:
  • trunk/MagicSoft/Mars/manalysis/MExtractSignal.cc

    r2699 r2715  
    5656// Default constructor.
    5757//
    58 MExtractSignal::MExtractSignal(const Byte_t first, const Byte_t last, const char *name, const char *title)
     58MExtractSignal::MExtractSignal(const Byte_t first, const Byte_t last, const Byte_t logainshift,
     59                    const char *name, const char *title)
    5960  : fNumHiGainSamples(last-first+1), fNumLoGainSamples(last-first+1),
    6061    fSaturationLimit(254), fConversionHiLo(10.)
     
    6667    AddToBranchList("MRawEvtData.*");
    6768
    68     fFirst = first;
     69    fFirst       = first;
     70    fLoGainFirst = first+logainshift;
    6971
    7072    fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples);
     
    186188
    187189        ptr   = pixel.GetLoGainSamples();
    188         first = ptr + fFirst + 1;
    189         last  = ptr + fFirst + fNumLoGainSamples +1;
     190        first = ptr + fLoGainFirst + 1;
     191        last  = ptr + fLoGainFirst + fNumLoGainSamples +1;
    190192        Byte_t maxlo  = 0;
    191193        Byte_t midlo  = 0;
     
    222224          pix.SetArrivalTimes((Float_t)(midlo+fFirst),0.,0.);
    223225        else
    224           pix.SetArrivalTimes((Float_t)(midhi+fFirst),0.,0.);
     226          pix.SetArrivalTimes((Float_t)(midhi+fLoGainFirst),0.,0.);
    225227
    226228      } /* while (pixel.Next()) */
  • trunk/MagicSoft/Mars/manalysis/MExtractSignal.h

    r2666 r2715  
    3232
    3333  Byte_t fFirst;
     34  Byte_t fLoGainFirst;
    3435
    3536  Byte_t fNumHiGainSamples;
     
    4950public:
    5051
    51   MExtractSignal(const Byte_t first=4, const Byte_t last=9, const char *name=NULL, const char *title=NULL);
     52  MExtractSignal(const Byte_t first=4, const Byte_t last=9, const Byte_t logainshift=1, const char *name=NULL, const char *title=NULL);
    5253 
    5354  void SetSaturationLimit(Byte_t lim)      { fSaturationLimit = lim; }
Note: See TracChangeset for help on using the changeset viewer.