Changeset 4379 for trunk


Ignore:
Timestamp:
07/14/04 19:28:57 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc

    r4249 r4379  
    6868//////////////////////////////////////////////////////////////////////////////
    6969#include "MHCalibrationChargeBlindPix.h"
     70#include "MExtractBlindPixel.h"
    7071
    7172#include <TStyle.h>
     
    9596const Double_t MHCalibrationChargeBlindPix::gkElectronicAmp      = 0.008;
    9697const Double_t MHCalibrationChargeBlindPix::gkElectronicAmpErr   = 0.002;
    97 
    98 const Int_t    MHCalibrationChargeBlindPix::fgChargeNbins        = 1000;
     98const Float_t  MHCalibrationChargeBlindPix::gkSignalInitializer  = -9999.;
     99
     100const Int_t    MHCalibrationChargeBlindPix::fgChargeNbins        = 512;
    99101const Axis_t   MHCalibrationChargeBlindPix::fgChargeFirst        = -0.5;
    100 const Axis_t   MHCalibrationChargeBlindPix::fgChargeLast         = 5999.5;
    101 const Float_t  MHCalibrationChargeBlindPix::fgSinglePheCut       = 600.;
     102const Axis_t   MHCalibrationChargeBlindPix::fgChargeLast         = 255.5;
     103const Float_t  MHCalibrationChargeBlindPix::fgSinglePheCut       =  60.;
    102104const Float_t  MHCalibrationChargeBlindPix::fgNumSinglePheLimit  =  50.;
    103105// --------------------------------------------------------------------------
     
    122124// - fASinglePheFADCSlices(0);
    123125// - fAPedestalFADCSlices(0);
     126// - fPixId to 0
    124127//
    125128// Calls:
     
    145148    SetSinglePheCut();
    146149    SetNumSinglePheLimit();
    147     SetProbLimit(0.00001);
    148     SetBinsAfterStripping(50);
     150    SetProbLimit(0.001);
     151    SetBinsAfterStripping(64);
    149152
    150153    fHGausHist.SetName("HCalibrationChargeBlindPix");
     
    152155    fHGausHist.SetXTitle("Sum FADC Slices");
    153156    fHGausHist.SetYTitle("Nr. of events");
    154  
     157
     158    fPixId     = 0;
     159
    155160    Clear();
    156161}
     
    187192//
    188193// Sets:
    189 // - all variables to 0., except the fit result variables to -999.
     194// - all variables to 0., except the fit result variables to gkSignalInitializer
    190195// - all flags to kFALSE
    191196// - all pointers to NULL
     
    201206{
    202207
    203   fLambda    = -999.;
    204   fMu0       = -999.;
    205   fMu1       = -999.;
    206   fSigma0    = -999.;
    207   fSigma1    = -999.;
    208  
    209   fLambdaErr = -999.;
    210   fMu0Err    = -999.;
    211   fMu1Err    = -999.;
    212   fSigma0Err = -999.;
    213   fSigma1Err = -999.;
    214 
    215   fLambdaCheck    = -999.;
    216   fLambdaCheckErr = -999.;
    217  
    218   fFitFunc = kEMichele;
    219   //  fFitFunc = kEPoisson4;
     208  fLambda    = gkSignalInitializer;
     209  fMu0       = gkSignalInitializer;
     210  fMu1       = gkSignalInitializer;
     211  fSigma0    = gkSignalInitializer;
     212  fSigma1    = gkSignalInitializer;
     213  fLambdaErr = gkSignalInitializer;
     214  fMu0Err    = gkSignalInitializer;
     215  fMu1Err    = gkSignalInitializer;
     216  fSigma0Err = gkSignalInitializer;
     217  fSigma1Err = gkSignalInitializer;
     218
     219  fLambdaCheck    = gkSignalInitializer;
     220  fLambdaCheckErr = gkSignalInitializer;
     221 
     222  //  fFitFunc = kEMichele;
     223  fFitFunc = kEPoisson4;
    220224
    221225  fNumSinglePhes    = 0;
     
    258262}
    259263
     264/*
     265// --------------------------------------------------------------------------
     266//
     267// Our own clone function is necessary since root 3.01/06 or Mars 0.4
     268// I don't know the reason.
     269//
     270// Creates new MHCalibrationCam
     271//
     272TObject *MHCalibrationChargeBlindPix::Clone(const char *) const
     273{
     274
     275    MHCalibrationChargeBlindPix *pix = new MHCalibrationChargeBlindPix();
     276    this->Copy(*pix);
     277
     278    this->fHGausHist.Copy(pix->fHGausHist);
     279    this->fSinglePheFit->Copy(*(pix->fSinglePheFit));
     280    this->fHSinglePheFADCSlices->Copy(*(pix->fHSinglePheFADCSlices));
     281    this->fHPedestalFADCSlices->Copy(*(pix->fHPedestalFADCSlices));
     282   
     283
     284    return pix;
     285}
     286*/
     287
    260288// --------------------------------------------------------------------------
    261289//
    262290// Set bit kSinglePheFitOK from outside
    263291//
    264 void MHCalibrationChargeBlindPix::SetSinglePheFitOK (const Bool_t b)
     292void MHCalibrationChargeBlindPix::SetSinglePheFitOK (const Bool_t b )
    265293{
    266294    b ? SETBIT(fFlags,kSinglePheFitOK) : CLRBIT(fFlags,kSinglePheFitOK);
     
    320348    }
    321349 
    322   InitBins();
    323  
    324350  return kTRUE;
    325351}
     
    337363      return kFALSE;
    338364
     365  fExtractor  = (MExtractBlindPixel*)pList->FindObject("MExtractBlindPixel");
     366  if (!fExtractor)
     367    {
     368      *fLog << err << "MExtractBlindPixel not found... aborting " << endl;
     369      return kFALSE;
     370    }
     371 
     372  const Int_t samples = fSignal->GetNumFADCSamples();
     373  const Int_t integ   = fExtractor->IsExtractionType( MExtractBlindPixel::kIntegral );
     374
     375  //
     376  // Modify the histogram size in case, integrals have been used
     377  //
     378  if ( fLast < samples*integ*fgChargeLast )
     379    {
     380      SetLast        ( samples * 256. - 0.5     );
     381      SetSinglePheCut( samples * fgSinglePheCut );
     382    }
     383
     384  MHGausEvents::InitBins();
     385 
    339386  return kTRUE;
    340387}
     
    384431    }
    385432 
    386   //
     433//
    387434  // Signal extraction and histogram filling
    388435  //
    389   const Float_t signal = (Float_t)fSignal->GetExtractedSignal();
     436  const Float_t signal = fSignal->GetExtractedSignal(fPixId);
    390437  if (signal > -0.5)
    391438    FillHistAndArray(signal);
     
    394441
    395442  //
    396   // IN order to study the single-phe posistion, we extract the slices
    397   //
    398   const Int_t blindpixIdx = fSignal->GetBlindPixelIdx();
     443  // In order to study the single-phe posistion, we extract the slices
     444  //
     445  const Int_t blindpixIdx = fSignal->GetBlindPixelIdx(fPixId);
    399446
    400447  MRawEvtPixelIter pixel(fRawEvt);
     
    579626  //
    580627  const Stat_t   entries      = fHGausHist.Integral("width");
    581   const Double_t lambda_guess = 0.1;
     628  const Double_t lambda_guess = 0.05;
    582629  const Double_t maximum_bin  = fHGausHist.GetBinCenter(fHGausHist.GetMaximumBin());
    583630  const Double_t norm         = entries/TMath::Sqrt(TMath::TwoPi());
     
    642689    case kEPoisson4:
    643690        fSinglePheFit->SetParNames(  "#lambda",   "#mu_{0}",    "#mu_{1}", "#sigma_{0}",  "#sigma_{1}","Area");
    644         fSinglePheFit->SetParameters(lambda_guess,fMeanPedestal,mu_1_guess,fSigmaPedestal,si_1_guess,norm);
     691        //        fSinglePheFit->SetParameters(lambda_guess,fMeanPedestal,mu_1_guess,fSigmaPedestal,si_1_guess,norm);
     692        fSinglePheFit->SetParameters(0.05,10.,75.,20.,70.,norm);
    645693
    646694        fSinglePheFit->SetParLimits(0,0.,0.5);
    647         fSinglePheFit->SetParLimits(1,
    648                                     fMeanPedestal-5.*fMeanPedestalErr,
    649                                     fMeanPedestal+5.*fMeanPedestalErr);
    650         fSinglePheFit->SetParLimits(2,rmin,rmax);
    651         fSinglePheFit->SetParLimits(3,
    652                                     fSigmaPedestal-5.*fSigmaPedestalErr,
    653                                     fSigmaPedestal+5.*fSigmaPedestalErr);
    654         fSinglePheFit->SetParLimits(4,0.,(rmax-rmin));
     695        //        fSinglePheFit->SetParLimits(1,
     696        //                                    fMeanPedestal-5.*fMeanPedestalErr,
     697        //                                    fMeanPedestal+5.*fMeanPedestalErr);
     698        fSinglePheFit->SetParLimits(1,0.,30.);
     699        //      fSinglePheFit->SetParLimits(2,rmin,rmax);
     700        fSinglePheFit->SetParLimits(2,50.,150.);
     701        //        fSinglePheFit->SetParLimits(3,
     702        //                                    fSigmaPedestal-5.*fSigmaPedestalErr,
     703        //                                    fSigmaPedestal+5.*fSigmaPedestalErr);
     704        fSinglePheFit->SetParLimits(3,0.,50.);
     705        //      fSinglePheFit->SetParLimits(4,0.,(rmax-rmin));
     706        fSinglePheFit->SetParLimits(4,0.,100.);
    655707        fSinglePheFit->SetParLimits(5,norm-(0.5*norm),norm+(0.5*norm));
    656708        break;
     
    10041056
    10051057  if (!IsEmpty())
    1006       gPad->SetLogy();
     1058    gPad->SetLogy();
    10071059
    10081060  gPad->SetTicks();
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h

    r4376 r4379  
    2222class MRawEvtPixelIter;
    2323class MCalibrationChargeBlindPix;
     24class MExtractBlindPixel;
    2425class MExtractedSignalBlindPixel;
    2526class MHCalibrationChargeBlindPix : public MHCalibrationChargePix
     
    3233  static const Float_t  fgSinglePheCut;      //! Default for fSinglePheCut (now set to: 200    )
    3334  static const Float_t  fgNumSinglePheLimit; //! Default for fNumSinglePheLimit (now set to: 50)
     35  static const Float_t  gkSignalInitializer; //! Signal initializer (-9999.)
    3436 
    3537  static const Double_t gkElectronicAmp;     // Electronic Amplification after the PMT (in FADC counts/N_e)
     
    4143  MCalibrationChargeBlindPix *fBlindPix;     //! Storage container results 
    4244  MExtractedSignalBlindPixel *fSignal;       //! Storage container extracted signal
     45  MExtractBlindPixel         *fExtractor;    //! Extractor blind pixel
    4346  MRawEvtData                *fRawEvt;       //! Storage container raw data
    4447 
  • trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h

    r4376 r4379  
    4444  Byte_t  fExtractionType;                   
    4545
    46   enum ExtractionType_t { kAmplitude, kIntegral, kFilter };
     46public:
     47  enum ExtractionType_t { kAmplitude, kIntegral };
    4748
     49
     50private:
    4851  void FindAmplitude   (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat);
    4952  void FindIntegral    (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat);
Note: See TracChangeset for help on using the changeset viewer.