Changeset 5135 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
09/25/04 13:51:15 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5134 r5135  
    4545       back the fPreProcessed flag which otherwise impedes the linearity
    4646       calibration to be performed
     47
     48   * mhcalib/MHGausEvents.[h,cc]
     49     - added function SimulateGausEvents()
    4750
    4851
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc

    r5115 r5135  
    8888#include <TCanvas.h>
    8989#include <TStyle.h>
     90#include <TRandom.h>
    9091
    9192#include "MFFT.h"
     
    151152  fHGausHist.UseCurrentStyle();
    152153  fHGausHist.SetDirectory(NULL);
    153   fHGausHist.GetYaxis()->CenterTitle();
     154  //  TAxis *xaxe = fHGausHist.GetXaxis();
     155  //  xaxe->Set(100,0.,100.);
     156  TAxis *yaxe = fHGausHist.GetYaxis();
     157  //  yaxe->SetDefaults();
     158  yaxe->CenterTitle();
    154159}
    155160
     
    173178{
    174179
    175   // delete histograms
    176   if (fHPowerProbability)
    177     delete fHPowerProbability;
    178 
    179180  //
    180181  // The next two lines are important for the case that
     
    193194      delete fFExpFit;
    194195 
     196  // delete histograms
     197  if (fHPowerProbability)
     198    delete fHPowerProbability;
     199
    195200  // delete arrays
    196201  if (fPowerSpectrum) 
     
    203208  if (fGraphPowerSpectrum)
    204209    delete fGraphPowerSpectrum;
     210
    205211
    206212}
     
    522528    {
    523529      pad->cd(cwin++);
    524       DrawPowerSpectrum(*pad,cwin);
    525     }
    526 }
    527 
     530      DrawPowerSpectrum();
     531      pad->cd(cwin);
     532      DrawPowerProjection();
     533    }
     534}
     535
     536// -----------------------------------------------------------------------------
     537//
     538// DrawEvents:
     539//
     540// Will draw the graph with the option "A", unless the option:
     541// "SAME" has been chosen
     542//
    528543void MHGausEvents::DrawEvents(Option_t *opt)
    529544{
     
    551566
    552567
    553 void MHGausEvents::DrawPowerSpectrum(TVirtualPad &pad, Int_t i)
    554 {
    555  
     568// -----------------------------------------------------------------------------
     569//
     570// DrawPowerSpectrum
     571//
     572// Will draw the fourier spectrum of the events sequence with the option "A", unless the option:
     573// "SAME" has been chosen
     574//
     575void MHGausEvents::DrawPowerSpectrum(Option_t *option)
     576{
     577
     578  TString opt(option);
     579 
     580  if (!fPowerSpectrum)
     581    CreateFourierSpectrum();
     582
    556583  if (fPowerSpectrum)
    557584    {
    558585      if (!fGraphPowerSpectrum)
    559586        CreateGraphPowerSpectrum();
     587
     588      if (!fGraphPowerSpectrum)
     589        return;
    560590     
    561       fGraphPowerSpectrum->Draw("AL");         
    562       fGraphPowerSpectrum->SetBit(kCanDelete);
    563     }
    564  
    565   pad.cd(i);
     591      if (opt.Contains("same"))
     592        {
     593          opt.ReplaceAll("same","");     
     594          fGraphPowerSpectrum->Draw(opt+"L");
     595        }
     596      else
     597        {
     598          fGraphPowerSpectrum->Draw(opt+"AL"); 
     599          fGraphPowerSpectrum->SetBit(kCanDelete);
     600        }
     601    }
     602}
     603
     604// -----------------------------------------------------------------------------
     605//
     606// DrawPowerProjection
     607//
     608// Will draw the projection of the fourier spectrum onto the power probability axis
     609// with the possible options of TH1D
     610//
     611void MHGausEvents::DrawPowerProjection(Option_t *option)
     612{
     613 
     614  TString opt(option);
     615
     616  if (!fHPowerProbability)
     617    CreateFourierSpectrum();
    566618
    567619  if (fHPowerProbability && fHPowerProbability->GetEntries() > 0)
    568620    {
    569621      gPad->SetLogy();
    570       fHPowerProbability->Draw();
     622      fHPowerProbability->Draw(opt.Data());
    571623      if (fFExpFit)
    572624        {
     
    772824void MHGausEvents::InitBins()
    773825{
     826  //  const TAttAxis att(fHGausHist.GetXaxis());
    774827  fHGausHist.SetBins(fNbins,fFirst,fLast);
     828  //  att.Copy(fHGausHist.GetXaxis());
    775829}
    776830
     
    904958}
    905959
     960// ----------------------------------------------------------------------------
     961//
     962// Simulates Gaussian events and fills them  into the histogram and the array
     963// In order to do a fourier analysis, call CreateFourierSpectrum()
     964//
     965void  MHGausEvents::SimulateGausEvents(const Float_t mean, const Float_t sigma, const Int_t nevts)
     966{
     967
     968  if (!IsEmpty())
     969    *fLog << warn << "The histogram is already filled, will superimpose simulated events on it..." << endl;
     970 
     971  for (Int_t i=0;i<nevts;i++) {
     972    const Double_t ran = gRandom->Gaus(mean,sigma);
     973    FillHistAndArray(ran);
     974  }
     975 
     976}
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h

    r5098 r5135  
    3333protected:
    3434
    35   Float_t  fEventFrequency;              // Event frequency in Hertz (to be set)
     35  Float_t  fEventFrequency;            // Event frequency in Hertz (to be set)
    3636
    3737  Int_t    fBinsAfterStripping;        // Bins for the Gauss Histogram after stripping off the zeros at both ends
     
    6565  Float_t  fProbLimit;                 // Probability limit for judgement if fit is OK
    6666
    67   void DrawPowerSpectrum(TVirtualPad &pad, Int_t i);  // Draw graph of fPowerSpectrum and fHPowerProbability
    68 
    6967  // Setters
    7068  void  SetBinsAfterStripping   ( const Int_t nbins=0   )                    { fBinsAfterStripping  =nbins; }
     
    7977  void Reset(); 
    8078
     79  void CreateFourierSpectrum();   
     80  void CreateGraphEvents();       
     81  void CreateGraphPowerSpectrum();
     82
    8183  // Draws
    82   void Draw(Option_t *option="");       // Default Draw
    83   void DrawEvents(Option_t *option="");   // Draw graph of fEvents
     84  void Draw(Option_t *option="");       
     85  void DrawEvents(Option_t *option="");
     86  void DrawPowerSpectrum(Option_t *option="");   
     87  void DrawPowerProjection(Option_t *option="");
    8488
     89  // Fill
     90  void   FillArray       ( const Float_t f );
     91  Bool_t FillHist        ( const Float_t f );
     92  Bool_t FillHistAndArray( const Float_t f );
     93 
     94  // Fits
     95  Bool_t FitGaus(  Option_t *option="RQ0",
     96                   const Double_t xmin=0.,
     97                   const Double_t xmax=0.);   
     98 
    8599  // Inits
    86100  virtual void InitBins();
     
    128142  const Bool_t IsOnlyUnderflow()         const; 
    129143
    130   // Fill
    131   void   FillArray       ( const Float_t f );     // Fill only the array fEvents
    132   Bool_t FillHist        ( const Float_t f );     // Fill only the histogram HGausHist
    133   Bool_t FillHistAndArray( const Float_t f );     // Fill bothe the array fEvents and the histogram HGausHist
    134  
    135   // Fits
    136   Bool_t FitGaus(  Option_t *option="RQ0",
    137                    const Double_t xmin=0.,
    138                    const Double_t xmax=0.);       // Fit the histogram HGausHist with a Gaussian
    139  
    140144  // Prints
    141   virtual void Print(const Option_t *o="") const; // Default Print
     145  void Print(const Option_t *o="") const;     
    142146 
    143147  // Setters
     
    158162  void  SetSigmaErr         ( const Double_t d                   ) { fSigmaErr       = d;   }
    159163
    160   void CreateFourierSpectrum();                   // Create the fourier spectrum out of fEvents
    161   void CreateGraphEvents();        // Create the TGraph fGraphEvents of fEvents
    162   void CreateGraphPowerSpectrum(); // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum
     164  // Simulates
     165  void  SimulateGausEvents(const Float_t mean, const Float_t sigma, const Int_t nevts=4096);
    163166
    164   ClassDef(MHGausEvents, 1) // Base class for events with Gaussian distributed values
     167  ClassDef(MHGausEvents, 2) // Base class for events with Gaussian distributed values
    165168};
    166169
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r5111 r5135  
    167167const Int_t MJCalibration::gkIFAEBoxInaugurationRun       = 20113;
    168168const Int_t MJCalibration::gkSecondBlindPixelInstallation = 31693;
    169 const Int_t MJCalibration::gkThirdBlindPixelInstallation  = 99999;
     169const Int_t MJCalibration::gkSpecialPixelsContInstallation = 34057;
     170const Int_t MJCalibration::gkThirdBlindPixelInstallation   = 99999;
    170171
    171172const Double_t MJCalibration::fgConvFADC2PheMin           = 0.;
     
    321322    MCalibrationQECam      *qecam  = NULL;
    322323    MCalibrationRelTimeCam *relcam = NULL;
     324    MBadPixelsCam          *badcam = NULL;
    323325
    324326    if (IsIntensity())
     
    327329        qecam  = (MCalibrationQECam*)     fIntensQECam.GetCam();
    328330        relcam = (MCalibrationRelTimeCam*)fIntensRelTimeCam.GetCam();
     331        badcam = (MBadPixelsCam*)         fIntensBadCam.GetCam();
    329332      }
    330333    else
     
    333336        qecam  = &fQECam;
    334337        relcam = &fRelTimeCam;
     338        badcam = &fBadPixels;
    335339      }
    336340   
     
    386390    // Pixels with defects
    387391    disp23.SetCamContent(*cam, 20);
    388     disp24.SetCamContent(fBadPixels, 6);
    389     disp25.SetCamContent(fBadPixels, 7);
     392    disp24.SetCamContent(*badcam, 6);
     393    disp25.SetCamContent(*badcam, 7);
    390394
    391395    // Oscillations
    392     disp26.SetCamContent(fBadPixels, 10);
    393     disp27.SetCamContent(fBadPixels, 11);
     396    disp26.SetCamContent(*badcam, 10);
     397    disp27.SetCamContent(*badcam, 11);
    394398
    395399    // Arrival Times
     
    610614      // CONVERSION FACTORS
    611615      //
    612 
    613616      TCanvas &c2 = fDisplay->AddTab("Conversion");
    614617      c2.Divide(3,3);
     
    13861389  else if (run < gkThirdBlindPixelInstallation)
    13871390    {
     1391
    13881392      MCalibrationBlindCamTwoNewStyle blindresults;
    13891393
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.h

    r5111 r5135  
    5858  static const Int_t gkIFAEBoxInaugurationRun;          //! Run number of first IFAE box calibration
    5959  static const Int_t gkSecondBlindPixelInstallation;    //! Run number upon which second blind pixel was installed
    60   static const Int_t gkThirdBlindPixelInstallation;     //! Run number upon which third blind pixel was installed
     60  static const Int_t gkSpecialPixelsContInstallation;   //! Run number upon which third blind pixel was installed
     61  static const Int_t gkThirdBlindPixelInstallation;     //! Run number upon which third blind pixel was installed 
    6162
    6263  static const Double_t fgConvFADC2PheMin;              //! Histogram minimum for conversion factor to phes
  • trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h

    r4669 r5135  
    3737
    3838  Byte_t  fExtractionType;                 // What extraction type has been chosen?
     39  Byte_t  fDataType;                       // What data container type is needed? 
    3940  Int_t   fNumBlindPixels;                 // Current number of blind pixels
    40  
     41
    4142public:
    4243  enum ExtractionType_t { kAmplitude, kIntegral, kFilter };
    43 
     44  enum DataType_t       { kRawEvt, kRawEvt2 };
    4445
    4546private:
     
    6162  // Getters
    6263  Bool_t IsExtractionType ( const ExtractionType_t typ );
     64  Bool_t IsDataType       ( const DataType_t       typ );
    6365
    6466  // Setters
     
    6870    fBlindPixelIdx.AddAt(idx,nr); }
    6971  void SetExtractionType( const ExtractionType_t typ=kAmplitude );
     72  void SetDataType    ( const DataType_t       typ=kRawEvt    ); 
    7073  void SetNSBFilterLimit( const Int_t   lim=fgNSBFilterLimit )  { fNSBFilterLimit = lim;   }     
    7174 
Note: See TracChangeset for help on using the changeset viewer.