Ignore:
Timestamp:
12/09/03 18:25:21 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r2581 r2627  
    6969#pragma link C++ class MCalibrationCalc+;
    7070
     71#pragma link C++ class MExtractedSignalCam+;
     72#pragma link C++ class MExtractedSignalPix+;
     73#pragma link C++ class MExtractSignal+;
     74
    7175
    7276#endif
  • trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h

    r2603 r2627  
    4848  Float_t GetErrSigma1() const    { return fErrSigma1;  }
    4949
    50   Float_t GetTime()         const    { return fTime;         }
    51   Float_t GetErrTime()      const    { return fErrTime;      }
     50  Float_t GetTime()      const    { return fTime;         }
     51  Float_t GetErrTime()   const    { return fErrTime;      }
    5252 
    53   Bool_t FillCharge(Int_t q)            { return fHist->FillBlindPixelCharge(q); }
    54   Bool_t FillTime(Int_t t)            { return fHist->FillBlindPixelTime(t); } 
     53  Bool_t FillCharge(Float_t q)    { return fHist->FillBlindPixelCharge(q); }
     54  Bool_t FillTime(Int_t t)        { return fHist->FillBlindPixelTime(t); } 
    5555  Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillBlindPixelChargevsN(rq,t); }   
    5656 
    57   Bool_t IsValid()                 { return fLambda > 0. || fErrLambda > 0.; }
     57  Bool_t IsValid()                { return fLambda > 0. || fErrLambda > 0.; }
    5858 
    5959  Bool_t FitCharge();
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc

    r2603 r2627  
    5353//               Every MCalibrationPix holds a histogram class,             //
    5454//               MHCalibrationPixel which itself hold histograms of type:   //
    55 //               HCharge(npix) (distribution of summed FADC time slice entries)  //
    56 //               HTime(npix) (distribution of position of maximum)             //
    57 //               HChargevsN(npix) (distribution of charges vs. event number.     //
    58 //                                                                          //
    59 // PostProcess:  All histograms HCharge(npix) are fitted to a Gaussian           //
    60 //               All histograms HTime(npix) are fitted to a Gaussian           //
    61 //               The histogram HBlindPixelCharge (blind pixel) is fitted to a single     //
    62 //                   PhE fit                                                //
    63 //               The histogram HBlindPixelTime (blind pixel) is fitted to a Gaussian   //
    64 //               The histograms of the PIN Diode are fitted to Gaussians    //
    65 //                                                                          //
    66 //               Fits can be excluded via the commands:                     //
    67 //               MalibrationCam::SetSkipTimeFits()   (skip all time fits)      //
    68 //               MalibrationCam::SetSkipBlindPixelFits()  (skip all blind pixel fits) //
    69 //               MalibrationCam::SetSkipPinDiodeFits()  (skip all PIN Diode fits) //
    70 //                                                                          //
     55//               HCharge(npix) (distribution of summed FADC time slice entries)
     56//               HTime(npix) (distribution of position of maximum)              
     57//               HChargevsN(npix) (distribution of charges vs. event number.
     58//                                                                         
     59// PostProcess:  All histograms HCharge(npix) are fitted to a Gaussian     
     60//               All histograms HTime(npix) are fitted to a Gaussian       
     61//               The histogram HBlindPixelCharge (blind pixel) is fitted to a single     
     62//                   PhE fit                                               
     63//               The histogram HBlindPixelTime (blind pixel) is fitted to a Gaussian   
     64//               The histograms of the PIN Diode are fitted to Gaussians   
     65//                                                                         
     66//               Fits can be excluded via the commands:                     
     67//               MalibrationCam::SetSkipTimeFits()   (skip all time fits)   
     68//               MalibrationCam::SetSkipBlindPixelFits()  (skip all blind pixel fits)
     69//               MalibrationCam::SetSkipPinDiodeFits()  (skip all PIN Diode fits)
     70//                                                                         
    7171//////////////////////////////////////////////////////////////////////////////
    7272
     
    169169      case kEBlue:
    170170        fCalibrations->SetColor(MCalibrationCam::kECBlue);
    171       break;       
     171        break;       
    172172      case kEGreen:
    173173        fCalibrations->SetColor(MCalibrationCam::kECGreen);     
    174       break;
     174        break;
    175175      case kEUV:
    176176        fCalibrations->SetColor(MCalibrationCam::kECUV);           
     177        break;
     178      case kECT1:
     179        fCalibrations->SetColor(MCalibrationCam::kECCT1);           
     180        break;
     181      default:
     182        fCalibrations->SetColor(MCalibrationCam::kECCT1);
    177183      }
    178 
    179 
    180184
    181185    fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
     
    185189        return kFALSE;
    186190      }
    187    
    188191   
    189192    return kTRUE;
     
    245248    MRawEvtPixelIter pixel(fRawEvt);
    246249
     250    //
    247251    // Create a first loop to sort out the cosmics ...
    248252    //
     
    266270        Float_t pedrms = ped.GetPedestalRms();
    267271       
    268         if ((float)sum < (pedes*fNumHiGainSamples)+(1.5*pedrms) )
     272        if ((float)sum < ((pedes*fNumHiGainSamples)+(30.*pedrms)) )
    269273           cosmicpix++;
    270274     }
     
    274278      {
    275279        fCosmics++;
    276         return kTRUE;
     280        return kCONTINUE;
    277281      }
    278282
    279283    pixel.Reset();
    280284
     285    //
     286    // Create a second loop to do fill the calibration histograms
     287    //
     288
    281289    while (pixel.Next())
    282290      {
    283291
    284292        UShort_t sat = 0;
    285         UShort_t lowgainoverflow = 0;
    286293
    287294        const Int_t pixid = pixel.GetPixelId();
    288295
    289         Byte_t *ptr = pixel.GetHiGainSamples();
    290296        Byte_t mid  = pixel.GetIdxMaxHiGainSample();
    291297        UInt_t max  = pixel.GetMaxHiGainSample();
    292298
    293         Int_t sum = (max > gkSaturationLimit              // overflow ?
    294                      ? sat++, pixel.GetSumLoGainSamples() // take Low Gain
    295                      : pixel.GetSumHiGainSamples());      // no overflow
    296 
    297         if (sat)
    298           {
    299 
    300             ptr = pixel.GetLoGainSamples();
    301             max = pixel.GetMaxLoGainSample();
    302             mid = pixel.GetIdxMaxLoGainSample();
    303 
    304             //
    305             //  FIXME: It seems the conversion HiGain LoGain is already
    306             //         performed in the data?!?
    307             //
    308             sum = (max > gkSaturationLimit                // overflow of LoGain ??? -> GimmeABreak!!!
    309                    ? lowgainoverflow++, gkLoGainOverFlow  // OUCH (Florian was maybe right)
    310                    : sum*gkConversionHiLo    );          // OUFF (Florian was wrong) !!
    311                    //                   : sum  );
    312 
    313             if (lowgainoverflow)
    314                 {
    315                   *fLog << err << dbginf << "Warning: Saturation of LoGain reached in pixel: " << pixid << " "
    316                         << "   sum = " << sum << endl;
    317                     fHistOverFlow++;
    318                 }
    319           }
    320 
    321         MPedestalPix    &ped = (*fPedestals)[pixid];
    322         MCalibrationPix &pix = (*fCalibrations)[pixid];
    323        
     299        MPedestalPix    &ped = (*fPedestals)[pixid];
     300        MCalibrationPix &pix = (*fCalibrations)[pixid];
     301
    324302        Float_t pedes  = ped.GetPedestal();
    325         Float_t pedrms = ped.GetPedestalRms();
    326        
     303        Float_t sum;
     304
    327305        //
    328306        // FIXME: This is preliminary, we will change to pedestals per slice!!!
    329307        // Assume pedestals per time slice ==> multiply with number of slices
    330308        //
    331         pedes  *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
    332         pedrms *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
    333 
    334         Float_t rsum      = (float)sum - pedes;
    335        
     309
     310        if (max < gkSaturationLimit)  // take Hi Gain
     311          {
     312            sum = (float)pixel.GetSumHiGainSamples() - pedes*fNumHiGainSamples; 
     313          }
     314        else                          // Lo Gain
     315          {
     316
     317            sat++;
     318            pix.SetHiGainSaturation();
     319
     320            sum = (float)pixel.GetSumLoGainSamples() - pedes*fNumLoGainSamples ;
     321            sum *= gkConversionHiLo;
     322
     323            max = pixel.GetMaxLoGainSample();
     324            mid = pixel.GetIdxMaxLoGainSample();
     325
     326            if (max > gkSaturationLimit)
     327              {
     328                *fLog << err << dbginf
     329                      << "Warning: Saturation of Lo Gain reached in pixel: "
     330                      << pixid << " " << "   sum = " << sum << endl;
     331                fHistOverFlow++;
     332              }
     333
     334          }
     335
    336336        switch(pixid)
    337337          {
     
    339339          case gkCalibrationBlindPixelId:
    340340
    341             //
    342             // FIXME: This works only when the blind pixel ID is much larger than
    343             //        the rest of the pixels (which is the case right now)
    344             //
    345341            if (!blindpixel.FillCharge(sum))
    346342              *fLog << warn <<
     
    351347                "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl;
    352348           
    353             if (!blindpixel.FillRChargevsTime(rsum,fEvents))
     349            if (!blindpixel.FillRChargevsTime(sum,fEvents))
    354350              *fLog << warn <<
    355351                "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl;
     
    362358              *fLog << warn <<
    363359                "Overflow or Underflow occurred filling HTime: time = " << (int)mid << endl;
    364             if (!pindiode.FillRChargevsTime(rsum,fEvents))
     360            if (!pindiode.FillRChargevsTime(sum,fEvents))
    365361              *fLog << warn <<
    366362                "Overflow or Underflow occurred filling HChargevsN: eventnr = " << fEvents << endl;
     
    368364          default:
    369365
    370             if (!pix.FillCharge(sum))
    371               *fLog << warn << "Could not fill Charge of pixel: " << pixid
    372                     << " signal = " << sum << endl;
    373 
    374             //
    375             // Fill the reduced charge into the control histo for better visibility
    376             //
    377             if (!pix.FillRChargevsTime(rsum,fEvents))
    378               *fLog << warn << "Could not fill red. Charge vs. EvtNr of pixel: " << pixid
    379                     << " signal = " << rsum  << " event Nr: " << fEvents << endl;
    380 
    381 
    382             if (!pix.FillTime((int)mid))
    383             *fLog << warn << "Could not fill Time of pixel: " << pixid << " time = " << (int)mid << endl;
    384 
    385 
     366            if (sat)
     367              {
     368               
     369                if (!pix.FillChargeLoGain(sum))
     370                  *fLog << warn << "Could not fill Lo Gain Charge of pixel: " << pixid
     371                        << " signal = " << sum << endl;
     372
     373                if (!pix.FillTimeLoGain((int)mid))
     374                  *fLog << warn << "Could not fill Lo Gain Time of pixel: "
     375                        << pixid << " time = " << (int)mid << endl;
     376               
     377                //
     378                // Fill the reduced charge into the control histo for better visibility
     379                //
     380                if (!pix.FillRChargevsTimeLoGain(sum,fEvents))
     381                  *fLog << warn << "Could not fill Lo Gain Charge vs. EvtNr of pixel: "
     382                        << pixid << " signal = " << sum  << " event Nr: " << fEvents << endl;
     383               
     384              }
     385            else
     386              {
     387                if (!pix.FillChargeHiGain(sum))
     388                  *fLog << warn << "Could not fill Hi Gain Charge of pixel: " << pixid
     389                        << " signal = " << sum << endl;
     390               
     391                if (!pix.FillTimeHiGain((int)mid))
     392                  *fLog << warn << "Could not fill Hi Gain Time of pixel: "
     393                        << pixid << " time = " << (int)mid << endl;
     394               
     395                if (!pix.FillRChargevsTimeHiGain(sum,fEvents))
     396                  *fLog << warn << "Could not fill Hi Gain Charge vs. EvtNr of pixel: "
     397                        << pixid << " signal = " << sum  << " event Nr: " << fEvents << endl;
     398              }
     399           
    386400          } /* switch(pixid) */
    387401
     
    396410  *fLog << inf << endl;
    397411  *fLog << GetDescriptor() << " Cut Histogram Edges" << endl;
     412
    398413  //
    399414  // Cut edges to make fits and viewing of the hists easier 
     
    414429    {
    415430      if (blindpixel.FitCharge())
    416         if (!fCalibrations->CalcNrPhotInnerPixel())
    417           *fLog << err << dbginf << "Could not calculate Number of photons from the blind pixel " << endl;
     431        {
     432          if (!fCalibrations->CalcNrPhotInnerPixel())
     433            *fLog << err << dbginf << "Could not calculate Number of photons from the blind pixel " << endl;
     434        }
    418435      else
    419         *fLog << err << dbginf << "Could not fit the blind pixel " << endl;
    420      
     436        {
     437          *fLog << err << dbginf << "Could not fit the blind pixel " << endl;
     438        }
     439
    421440      if (!blindpixel.FitTime())
    422441        *fLog << warn << "Could not the Times of the blind pixel " << endl;
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h

    r2603 r2627  
    5454public:
    5555 
    56   enum PulserColor_t  { kEGreen, kEBlue, kEUV };
     56  enum PulserColor_t  { kEGreen, kEBlue, kEUV, kECT1 };
    5757
    5858private:
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc

    r2603 r2627  
    5757MCalibrationCam::MCalibrationCam(const char *name, const char *title)
    5858    : fMeanNrPhotAvailable(kFALSE),
    59       fMeanNrPhotInnerPix(-1.)
     59      fMeanNrPhotInnerPix(-1.),
     60      fMeanNrPhotInnerPixErr(-1.)
    6061{
    6162    fName  = name  ? name  : "MCalibrationCam";
     
    153154Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const
    154155{
    155   return ((*this)[idx].GetRCharge() > 0. && (*this)[idx].GetErrRCharge() > 0.);
     156  return ((*this)[idx].GetCharge() > 0. && (*this)[idx].GetErrCharge() > 0.);
    156157}
    157158
     
    359360    int id = 0;
    360361
     362    *fLog << "Succesfully calibrated pixels:" << endl;
     363    *fLog << endl;
     364
    361365    TIter Next(fPixels);
    362366    MCalibrationPix *pix;
     
    364368    {
    365369
    366         *fLog << id << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms() << " Charge: "
    367               << pix->GetCharge() << " Reduced Charge: " << pix->GetRCharge() << " +- "
    368               << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigma() << endl;
    369 
    370         id++;
    371     }
     370      if (pix->GetCharge() >= 0.)
     371        {
     372          *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms()
     373                << " Reduced Charge: " << pix->GetCharge() << " +- "
     374                << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigma() << endl;
     375          id++;
     376        }
     377    }
     378
     379    *fLog << id << " succesful pixels :-))" << endl;
     380    id = 0;
     381
     382    *fLog << endl;
     383    *fLog << "Pixels with errors:" << endl;
     384    *fLog << endl;
     385
     386    TIter Next2(fPixels);
     387    while ((pix=(MCalibrationPix*)Next2()))
     388    {
     389
     390      if (pix->GetCharge() == -1.)
     391        {
     392          *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms()
     393                << " Reduced Charge: " << pix->GetCharge() << " +- "
     394                << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigma() << endl;
     395          id++;
     396        }
     397    }
     398    *fLog << id << " pixels with errors :-((" << endl;
     399
    372400}
    373401
     
    379407    {
    380408    case 0:
    381        val = (*this)[idx].GetCharge();
    382         break;
     409      val = (*this)[idx].GetCharge();
     410      break;
    383411    case 1:
    384        val = (*this)[idx].GetErrCharge();
    385         break;
     412      val = (*this)[idx].GetErrCharge();
     413      break;
    386414    case 2:
    387        val = (*this)[idx].GetSigmaCharge();
    388         break;
     415      val = (*this)[idx].GetSigmaCharge();
     416      break;
    389417    case 3:
    390        val = (*this)[idx].GetErrSigmaCharge();
    391         break;
     418      val = (*this)[idx].GetErrSigmaCharge();
     419      break;
    392420    case 4:
    393        val = (*this)[idx].GetChargeProb();
    394         break;
     421      val = (*this)[idx].GetChargeProb();
     422      break;
    395423    case 5:
    396        val = (*this)[idx].GetTime();
    397         break;
     424      val = (*this)[idx].GetTime();
     425      break;
    398426    case 6:
    399        val = (*this)[idx].GetSigmaTime();
    400         break;
     427      val = (*this)[idx].GetSigmaTime();
     428      break;
    401429    case 7:
    402        val = (*this)[idx].GetTimeProb();
    403         break;
     430      val = (*this)[idx].GetTimeProb();
     431      break;
    404432    case 8:
    405        val = (*this)[idx].GetPed();
    406         break;
     433      val = (*this)[idx].GetPed();
     434      break;
    407435    case 9:
    408        val = (*this)[idx].GetPedRms();
    409         break;
     436      val = (*this)[idx].GetPedRms();
     437      break;
    410438    case 10:
    411       val = (*this)[idx].GetRCharge();
     439      val = (*this)[idx].GetRSigma();
    412440      break;
    413441    case 11:
    414       val = (*this)[idx].GetRSigma();
     442      val = (*this)[idx].GetPheFFactorMethod();
    415443      break;
    416444    case 12:
    417       val = (*this)[idx].GetPheFFactorMethod();
     445      val = (*this)[idx].GetConversionFFactorMethod();
    418446      break;
    419447    case 13:
    420       val = (*this)[idx].GetConversionFFactorMethod();
     448      if (idx < 397)
     449        val = (double)fMeanNrPhotInnerPix;
     450      else
     451        val = (double)fMeanNrPhotInnerPix*gkCalibrationOuterPixelArea;
    421452      break;
    422453    case 14:
    423       val = (double)fMeanNrPhotInnerPix;
    424       break;
    425     case 15:
    426       if ((fMeanNrPhotInnerPix > 0. ) && ((*this)[idx].GetRCharge() > 100.))
    427         val = fMeanNrPhotInnerPix / (*this)[idx].GetRCharge();
    428       else
    429         val = -1.;
     454      if ((fMeanNrPhotInnerPix > 0. ) && ((*this)[idx].GetCharge() != -1.))
     455        {
     456          if (idx < 397)
     457            val = fMeanNrPhotInnerPix / (*this)[idx].GetCharge();
     458          else
     459            val = fMeanNrPhotInnerPix*gkCalibrationOuterPixelArea / (*this)[idx].GetCharge();
     460        }
     461      else
     462        {
     463          val = -1.;
     464        }
    430465      break;
    431466    default:
     
    467502                            / gkCalibrationBlindPixelArea;
    468503      break;
     504    case kECCT1:
     505    default:
     506      fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQECT1 )
     507                            *TMath::Power(10,gkCalibrationBlindPixelAttCT1)
     508                            / gkCalibrationBlindPixelArea;
     509      break;
    469510    }
    470511
     
    474515
    475516
    476 
    477 Bool_t MCalibrationCam::GetConversionFactor(Int_t ipx, Float_t &mean, Float_t &err)
     517Bool_t MCalibrationCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
    478518{
    479519 
     
    485525      return kFALSE;
    486526
    487   mean = fMeanNrPhotInnerPix / (*this)[ipx].GetRCharge();
     527  mean = fMeanNrPhotInnerPix / (*this)[ipx].GetCharge();
    488528
    489529  //
    490530  // Not yet ready , sorry
    491531  //
    492   err  = 100000000000.;
     532  err  = -1.;
     533  sigma = -1.;
    493534
    494535  return kTRUE;
    495536}
     537
     538
     539Bool_t MCalibrationCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
     540{
     541 
     542  if (ipx < 0 || !IsPixelFitted(ipx))
     543    return kFALSE;
     544
     545  Float_t conv = (*this)[ipx].GetConversionFFactorMethod();
     546
     547  if (conv < 0.)
     548    return kFALSE;
     549
     550  mean = conv;
     551
     552  //
     553  // Not yet ready , sorry
     554  //
     555  err  = -1.;
     556  sigma = -1.;
     557
     558  return kTRUE;
     559}
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h

    r2603 r2627  
    3838  MCalibrationPINDiode *fPINDiode;   //! containing PIN Diode data with fit results   
    3939
     40  Bool_t  fMeanNrPhotAvailable;
    4041  Float_t fMeanNrPhotInnerPix;       // The mean number of photons in an inner pixel 
    4142  Float_t fMeanNrPhotInnerPixErr;    // The uncertainty about the number of photons in an inner pixel 
    42   Bool_t  fMeanNrPhotAvailable;
    4343
    4444public:
    4545 
    46   enum CalibrationColor_t { kECGreen, kECBlue, kECUV };
     46  enum CalibrationColor_t { kECGreen, kECBlue, kECUV, kECCT1 };
    4747
    4848private:
     
    8989  void SetColor(CalibrationColor_t color)    { fColor = color; }
    9090
    91   Bool_t GetConversionFactor(Int_t ipx, Float_t &mean, Float_t &err);
     91  Bool_t GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
     92  Bool_t GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
    9293 
    9394  ClassDef(MCalibrationCam, 1)  // Storage Container for all calibration information of the camera
  • trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h

    r2603 r2627  
    1515
    1616// The conversion factor between High Gain and Low Gain
    17 const UShort_t gkConversionHiLo = 10.;
     17const Float_t gkConversionHiLo = 10.;
    1818
    1919// The penalty constant to produce overflow in the histogram
     
    2929const Float_t gkCalibrationBlindPixelQEBlue  = 0.226;
    3030const Float_t gkCalibrationBlindPixelQEUV    = 0.247;
     31const Float_t gkCalibrationBlindPixelQECT1   = 0.247;
    3132
    3233// Attenuation factor Blind Pixel (three colours)
     
    3435const Float_t gkCalibrationBlindPixelAttBlue  = 1.96;
    3536const Float_t gkCalibrationBlindPixelAttUV    = 1.95;
     37const Float_t gkCalibrationBlindPixelAttCT1   = 1.95;
    3638
    3739// Area of Blind Pixel w.r.t. Inner Pixel
    3840const Float_t gkCalibrationBlindPixelArea     = 0.25;
     41
     42// Area of Outer Pixel w.r.t. Inner Pixel
     43const Float_t gkCalibrationOuterPixelArea     = 4.00;
    3944
    4045// ----- PIN DIODE ------------------------//
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.cc

    r2603 r2627  
    7979Bool_t MCalibrationPINDiode::FitCharge()
    8080{
    81   if(!fHist->FitCharge())
     81  if(!fHist->FitChargeHiGain())
    8282    return kFALSE;
    8383
     
    9494{
    9595
    96   if(!fHist->FitTime())
     96  if(!fHist->FitTimeHiGain())
    9797    return kFALSE;
    9898
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h

    r2603 r2627  
    3333  void Clear(Option_t *o="");
    3434 
    35   void SetPed(Float_t ped)         { fPed      = ped;      }
     35  void SetPed(Float_t ped)          { fPed      = ped;      }
    3636  void SetPedRms(Float_t pedrms)    { fPedRms   = pedrms; }
    3737
    3838  Bool_t IsValid() const { return fRCharge >=0 || fErrRCharge >= 0; }
    3939
    40   Bool_t FillCharge(Int_t q)            { return fHist->FillCharge(q); }
    41   Bool_t FillTime(Int_t t)            { return fHist->FillTime(t); } 
    42   Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsN(rq,t); }   
     40  Bool_t FillCharge(Float_t q)      { return fHist->FillChargeHiGain(q); }
     41  Bool_t FillTime(Int_t t)          { return fHist->FillTimeHiGain(t); } 
     42  Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); }   
    4343 
    4444  Bool_t FitCharge();
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc

    r2603 r2627  
    5050      fSigmaCharge(-1.),
    5151      fErrSigmaCharge(-1.),
     52      fRSigma(-1.),
    5253      fChargeProb(-1.),
    5354      fPed(-1.),
     
    5657      fSigmaTime(-1.),
    5758      fTimeProb(-1.),
    58       fRCharge(-1.),
    59       fErrRCharge(-1.),
    60       fRSigma(-1.),
    6159      fFactor(1.3),
    6260      fPheFFactorMethod(-1.),
    63       fConversionFFactorMethod(-1.)
     61      fConversionFFactorMethod(-1.),
     62      fHiGainSaturation(kFALSE)
    6463{
    6564
     
    102101
    103102  if (fPed && fPedRms)
    104     fHist->SetLowerFitRange(fPed + 1.5*fPedRms);
     103    fHist->SetLowerFitRange(3.5*fPedRms);
     104  //    fHist->SetLowerFitRange(fPed + 3.5*fPedRms);
    105105  else
    106106    *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl;
    107107
    108   if(!fHist->FitCharge())
     108
     109  if (fHiGainSaturation)
    109110    {
    110       *fLog << warn << "Could not fit charges of pixel " << fPixId << endl;
    111       fHist->PrintChargeFitResult();
    112       return kFALSE;
     111      if(!fHist->FitChargeLoGain())
     112        {
     113          *fLog << warn << "Could not fit Lo Gain charges of pixel " << fPixId << endl;
     114          fHist->PrintChargeFitResult();
     115          return kFALSE;
     116        }
     117    }
     118  else
     119    {
     120      if(!fHist->FitChargeHiGain())
     121        {
     122          *fLog << warn << "Could not fit Hi Gain charges of pixel " << fPixId << endl;
     123          fHist->PrintChargeFitResult();
     124          return kFALSE;
     125        }
    113126    }
    114127 
     128
    115129  fCharge         = fHist->GetChargeMean();
    116130  fErrCharge      = fHist->GetChargeMeanErr();
     
    122136    {
    123137     
    124     fRCharge      = fCharge - fPed;
    125     fErrRCharge   = TMath::Sqrt(fErrCharge*fErrCharge + fPedRms*fPedRms);
    126 
    127138    fRSigma       = (fSigmaCharge*fSigmaCharge) - (fPedRms*fPedRms);
    128139
    129140    if (fRSigma > 0. )
    130141      {
    131        fPheFFactorMethod =  fFactor * fRCharge*fRCharge / fRSigma;
    132        fConversionFFactorMethod = fPheFFactorMethod / fRCharge ;
     142       fPheFFactorMethod =  fFactor * fCharge*fCharge / fRSigma;
     143       fConversionFFactorMethod = fPheFFactorMethod /   fCharge ;
    133144      }
    134145    else
     
    144155}
    145156
     157
    146158void MCalibrationPix::SetPedestal(Float_t ped, Float_t pedrms)
    147159{
     
    150162  fPedRms = pedrms;
    151163 
    152   if ((fRCharge == -1.) && (fCharge > 0.))
    153     fRCharge = fCharge - fPed;
    154   if ((fErrRCharge == -1.) && (fErrCharge > 0.))
    155     fErrRCharge   = TMath::Sqrt(fErrCharge*fErrCharge + fPedRms*fPedRms);
    156 
    157164}
    158165
     
    160167{
    161168
    162   if(!fHist->FitTime())
     169  if (fHiGainSaturation)
    163170    {
    164       *fLog << warn << "Could not fit times of pixel " << fPixId << endl;
    165       fHist->PrintTimeFitResult();
    166       return kFALSE;
     171      if(!fHist->FitTimeLoGain())
     172        {
     173          *fLog << warn << "Could not fit Lo Gain times of pixel " << fPixId << endl;
     174          fHist->PrintTimeFitResult();
     175          return kFALSE;
     176        }
    167177    }
    168 
     178  else
     179    {
     180      if(!fHist->FitTimeHiGain())
     181        {
     182          *fLog << warn << "Could not fit Hi Gain times of pixel " << fPixId << endl;
     183          fHist->PrintTimeFitResult();
     184          return kFALSE;
     185        }
     186    }
     187   
    169188  fTime       = fHist->GetTimeMean();
    170189  fSigmaTime  = fHist->GetTimeSigma();
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h

    r2603 r2627  
    1414  Int_t   fPixId;           // the pixel Id
    1515 
    16   Float_t fCharge;              // The mean charge after the fit
    17   Float_t fErrCharge;           // The error of mean charge after the fit
     16  Float_t fCharge;              // The mean reduced charge after the fit
     17  Float_t fErrCharge;           // The error of reduced mean charge after the fit
    1818  Float_t fSigmaCharge;         // The sigma of the mean charge after the fit
    1919  Float_t fErrSigmaCharge;      // The error of the sigma of the mean charge after the fit
     20  Float_t fRSigma;              // The reduced squares of sigmas after the fit
    2021  Float_t fChargeProb;          // The probability of the fit function
    2122
     
    2728  Float_t fTimeProb;            // The probability of the fit function
    2829 
    29   Float_t fRCharge;             // The reduced mean charge after the fit
    30   Float_t fErrRCharge;          // The error of the reduced mean charge after the fit 
    31   Float_t fRSigma;              // The reduced squares of sigmas after the fit
    32  
    3330  Float_t fFactor;                  // The laboratory F-factor
    3431  Float_t fPheFFactorMethod;        // The number of Phe's calculated after the F-factor method
    3532  Float_t fConversionFFactorMethod; // The conversion factor to Phe's calculated after the F-factor method
     33
     34  Bool_t fHiGainSaturation;     // Is Lo-Gain used at all?
    3635
    3736  MHCalibrationPixel *fHist;    //! Pointer to the histograms performing the fits, etc. 
     
    4544
    4645  Float_t GetCharge()         const    { return fCharge;         }
    47   Float_t GetRCharge()        const    { return fRCharge;        }
    4846  Float_t GetRSigma()         const    { return fRSigma;         }
    4947   
    5048  Float_t GetErrCharge()      const    { return fErrCharge;      }
    51   Float_t GetErrRCharge()     const    { return fErrRCharge;     }   
    5249  Float_t GetChargeProb()     const    { return fChargeProb;     }   
    5350 
    5451  Float_t GetSigmaCharge()    const    { return fSigmaCharge;    }
    5552  Float_t GetErrSigmaCharge() const    { return fErrSigmaCharge; }
    56   Float_t GetTime()         const    { return fTime;         }
    57   Float_t GetSigmaTime()    const    { return fSigmaTime;    }
    58   Float_t GetTimeProb()     const    { return fTimeProb;     }   
     53  Float_t GetTime()           const    { return fTime;         }
     54  Float_t GetSigmaTime()      const    { return fSigmaTime;    }
     55  Float_t GetTimeProb()       const    { return fTimeProb;     }   
    5956 
    60   Float_t GetPed()          const    { return fPed;       }
    61   Float_t GetPedRms()       const    { return fPedRms;    }   
     57  Float_t GetPed()            const    { return fPed;       }
     58  Float_t GetPedRms()         const    { return fPedRms;    }   
    6259
    6360  void SetPedestal(Float_t ped, Float_t pedrms);
     61  void SetHiGainSaturation()                 { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); }
    6462
    65   Bool_t FillCharge(Int_t q)           { return fHist->FillCharge(q); }
    66   Bool_t FillTime(Int_t t)             { return fHist->FillTime(t); } 
    67   Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsN(rq,t); }   
     63  Bool_t FillChargeHiGain(Float_t q)   { return fHist->FillChargeHiGain(q); }
     64  Bool_t FillTimeHiGain(Int_t t)       { return fHist->FillTimeHiGain(t); } 
     65  Bool_t FillRChargevsTimeHiGain(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); }   
     66
     67  Bool_t FillChargeLoGain(Float_t q)   { return fHist->FillChargeLoGain(q); }
     68  Bool_t FillTimeLoGain(Int_t t)       { return fHist->FillTimeLoGain(t); } 
     69  Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) { return fHist->FillChargevsNLoGain(rq,t); }   
    6870 
    69   Bool_t IsValid()          const    { return fRCharge >=0 || fErrRCharge >= 0; }
    70   Int_t  GetPixId()         const    { return fPixId;   }
     71  Bool_t IsValid()            const    { return fCharge >=0 || fErrCharge >= 0; }
     72  Int_t  GetPixId()           const    { return fPixId;   }
    7173  void   DefinePixId(Int_t i);
    7274 
     
    7476  Bool_t FitTime();
    7577 
    76   MHCalibrationPixel *GetHist() const  { return fHist;  }
    77   virtual void Draw(Option_t *opt="")   { fHist->Draw(opt); }
     78  MHCalibrationPixel *GetHist() const   { return fHist;     }
     79  void Draw(Option_t *opt="")           { fHist->Draw(opt); }
    7880 
    7981  Float_t GetPheFFactorMethod()           const { return fPheFFactorMethod;           } 
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r2581 r2627  
    7575           MCalibrationBlindPix.cc  \
    7676           MCalibrationPINDiode.cc  \
    77            MCalibrationCam.cc
     77           MCalibrationCam.cc \
     78           MExtractedSignalCam.cc \
     79           MExtractedSignalPix.cc \
     80           MExtractSignal.cc
    7881
    7982SRCS    = $(SRCFILES)
Note: See TracChangeset for help on using the changeset viewer.