Changeset 4963 for trunk/MagicSoft


Ignore:
Timestamp:
09/12/04 22:56:39 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4962 r4963  
    4949   * mhcalib/MHCalibrationPix.[h,cc]
    5050     - changed function name SetSaturated to AddSaturated
     51
     52   * mhcalib/MHCalibrationChargeCam.cc
     53   * mhcalib/MHCalibrationRelTimeCam.cc
     54     - take cloning of averaged sectors out of the Clone() function
    5155
    5256   * mbadpixels/MBadPixelsIntensityCam.[h,cc]
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.cc

    r4943 r4963  
    7575#include <TPaveText.h>
    7676#include <TPaveStats.h>
     77#include <TGraph.h>
    7778
    7879#include <TVector.h>
     
    264265}
    265266
    266 // --------------------------------------------------------------------------
    267 //
    268 // Empty function to overload MHCalibrationChargePix::Reset()
    269 //
    270 void MHCalibrationChargeBlindPix::Reset()
    271 {
    272 }
    273 
    274 
    275 // --------------------------------------------------------------------------
    276 //
    277 // Use the MHGausEvents::Clone function and clone additionally the rest of the
    278 // data members.
    279 //
     267#if 0
     268// --------------------------------------------------------------------------
     269//
     270// ATTENTION: This nasty Clone function is necessary since the ROOT cloning
     271//            lead to crashes on SOME machines (unfortunately not mine...).
     272//            This function is a workaround in order to achieve the correct
     273//            DrawClone() behaviour.
     274//
    280275TObject *MHCalibrationChargeBlindPix::Clone(const char *name) const
    281276{
    282277
    283   MHCalibrationChargeBlindPix &pix = (MHCalibrationChargeBlindPix&)*MHCalibrationPix::Clone(name);
     278  MHCalibrationChargeBlindPix &pix =
     279    *new MHCalibrationChargeBlindPix(name ? name : fName.Data(),fTitle.Data());
     280
    284281  //
    285   // Copy data members
     282  // Copy MHGausEvents data members
     283  //
     284  pix.fBinsAfterStripping   = fBinsAfterStripping;
     285  pix.fCurrentSize          = fCurrentSize;
     286  pix.fFlags                = fFlags;
     287  pix.fPowerProbabilityBins = fPowerProbabilityBins;
     288
     289  if (fHPowerProbability)
     290    pix.fHPowerProbability=(TH1I*)fHPowerProbability->Clone();
     291 
     292  if (fPowerSpectrum)
     293    pix.fPowerSpectrum = new TArrayF(*fPowerSpectrum);
     294
     295  pix.fEvents = fEvents;
     296
     297  if (fFGausFit)
     298    pix.fFGausFit=(TF1*)fFGausFit->Clone();
     299  if (fFExpFit)
     300    pix.fFExpFit=(TF1*)fFExpFit->Clone();
     301
     302  pix.fFirst = fFirst;
     303
     304  if (fGraphEvents)
     305    pix.fGraphEvents=(TGraph*)fGraphEvents->Clone();
     306  if (fGraphPowerSpectrum)
     307    pix.fGraphPowerSpectrum=(TGraph*)fGraphPowerSpectrum->Clone();
     308
     309  pix.fHGausHist = fHGausHist;
     310
     311  pix.fLast      = fLast;
     312  pix.fMean      = fMean;
     313  pix.fMeanErr   = fMeanErr;
     314  pix.fNbins     = fNbins;
     315  pix.fNDFLimit  = fNDFLimit;
     316  pix.fSigma     = fSigma;
     317  pix.fSigmaErr  = fSigmaErr;
     318  pix.fProb      = fProb;
     319  pix.fProbLimit = fProbLimit;
     320
     321  //
     322  // Copy MHCalibrationPix data members
     323  //
     324  pix.fEventFrequency       = fEventFrequency;
     325  pix.fBlackoutLimit        = fBlackoutLimit;
     326  pix.fSaturated            = fSaturated;     
     327  pix.fPickupLimit          = fPickupLimit;   
     328  pix.fPixId                = fPixId;       
     329
     330  //
     331  // Copy MHCalibrationChargeBlindPix data members
    286332  //
    287333  pix.fSinglePheCut         =  fSinglePheCut;
    288334  pix.fNumSinglePheLimit    =  fNumSinglePheLimit;   
    289335
    290   pix.fASinglePheFADCSlices =  fASinglePheFADCSlices;
    291   pix.fAPedestalFADCSlices  =  fAPedestalFADCSlices
     336  fASinglePheFADCSlices.Copy(pix.fASinglePheFADCSlices);
     337  fAPedestalFADCSlices.Copy( pix.fAPedestalFADCSlices)
    292338 
    293   pix.fSinglePheFit = (TF1*)fSinglePheFit->Clone();
     339  pix.fSinglePheFit   = (TF1*)fSinglePheFit->Clone();
    294340
    295341  pix.fNumSinglePhes  = fNumSinglePhes; 
     
    314360  pix.fMeanPedestalErr  = fMeanPedestalErr; 
    315361  pix.fSigmaPedestalErr = fSigmaPedestalErr;
    316   pix.fFlags            = fFlags;           
    317362
    318363  return &pix;
    319364}
     365#endif
    320366
    321367/*
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindPix.h

    r4943 r4963  
    9494
    9595  void Clear(Option_t *o=""); 
    96   void Reset();
    97  
    98   TObject *Clone(const char *) const;
     96  void Reset() {}
     97 
     98  //  TObject *Clone(const char *) const;
    9999
    100100  Bool_t SetupFill(const MParList *pList);
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc

    r4962 r4963  
    14681468{
    14691469
    1470   TLine *green1 = new TLine(refline[0],0.1,refline[0],0.9*hist->GetMaximum());
     1470  TLine *green1 = new TLine(refline[0],0.,refline[0],0.9*hist->GetMaximum());
    14711471  green1->SetBit(kCanDelete);
    14721472  green1->SetLineColor(kGreen);
     
    14751475  green1->Draw();
    14761476
    1477   TLine *green5 = new TLine(refline[6],0.1,refline[6],0.9*hist->GetMaximum());
     1477  TLine *green5 = new TLine(refline[6],0.,refline[6],0.9*hist->GetMaximum());
    14781478  green5->SetBit(kCanDelete);
    14791479  green5->SetLineColor(8);
     
    14821482  green5->Draw();
    14831483
    1484   TLine *blue1   = new TLine(refline[1],0.1,refline[1],0.9*hist->GetMaximum());
     1484  TLine *blue1   = new TLine(refline[1],0.,refline[1],0.9*hist->GetMaximum());
    14851485  blue1->SetBit(kCanDelete);
    14861486  blue1->SetLineColor(227);
     
    14891489  blue1->Draw();
    14901490
    1491   TLine *blue5   = new TLine(refline[2],0.1,refline[2],0.9*hist->GetMaximum());
     1491  TLine *blue5   = new TLine(refline[2],0.,refline[2],0.9*hist->GetMaximum());
    14921492  blue5->SetBit(kCanDelete);
    14931493  blue5->SetLineColor(68);
     
    14961496  blue5->Draw();
    14971497
    1498   TLine *blue10   = new TLine(refline[3],0.1,refline[3],0.9*hist->GetMaximum());
     1498  TLine *blue10   = new TLine(refline[3],0.,refline[3],0.9*hist->GetMaximum());
    14991499  blue10->SetBit(kCanDelete);
    15001500  blue10->SetLineColor(4);
     
    15031503  blue10->Draw();
    15041504
    1505   TLine *uv10    = new TLine(refline[4],0.1,refline[4],0.9*hist->GetMaximum());
     1505  TLine *uv10    = new TLine(refline[4],0.,refline[4],0.9*hist->GetMaximum());
    15061506  uv10->SetBit(kCanDelete);
    15071507  uv10->SetLineColor(106);
     
    15101510  uv10->Draw();
    15111511
    1512   TLine *ct1    = new TLine(refline[5],0.1,refline[5],0.9*hist->GetMaximum());
     1512  TLine *ct1    = new TLine(refline[5],0.,refline[5],0.9*hist->GetMaximum());
    15131513  ct1->SetBit(kCanDelete);
    15141514  ct1->SetLineColor(6);
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc

    r4949 r4963  
    108108#include "MBadPixelsPix.h"
    109109
     110#include <TPad.h>
     111#include <TVirtualPad.h>
     112#include <TCanvas.h>
     113#include <TStyle.h>
     114#include <TF1.h>
     115#include <TLine.h>
     116#include <TLatex.h>
     117#include <TLegend.h>
     118#include <TGraph.h>
     119
    110120ClassImp(MHCalibrationRelTimeCam);
    111121
     
    154164  SetHistXTitle(gsHistXTitle.Data());
    155165  SetHistYTitle(gsHistYTitle.Data());
     166
     167}
     168
     169// --------------------------------------------------------------------------
     170//
     171// Our own clone function is necessary since root 3.01/06 or Mars 0.4
     172// I don't know the reason.
     173//
     174// Creates new MHCalibrationRelTimeCam
     175//
     176TObject *MHCalibrationRelTimeCam::Clone(const char *name) const
     177{
     178
     179  const Int_t navhi = fAverageHiGainAreas->GetEntries();
     180  const Int_t navlo = fAverageLoGainAreas->GetEntries();
     181  const Int_t nsehi = fAverageHiGainSectors->GetEntries();
     182  const Int_t nselo = fAverageLoGainSectors->GetEntries();
     183 
     184  //
     185  // FIXME, this might be done faster and more elegant, by direct copy.
     186  //
     187  MHCalibrationRelTimeCam *cam = new MHCalibrationRelTimeCam();
     188
     189  cam->fAverageHiGainAreas->Expand(navhi);
     190  cam->fAverageHiGainSectors->Expand(nsehi);
     191
     192  for (int i=0; i<navhi; i++)
     193    (*cam->fAverageHiGainAreas)  [i] = (*fAverageHiGainAreas)  [i]->Clone();
     194  for (int i=0; i<nsehi; i++)
     195    (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone();
     196
     197  if (IsLoGain())
     198    {
     199      cam->fAverageLoGainAreas->Expand(navlo);
     200      cam->fAverageLoGainSectors->Expand(nselo);
     201     
     202      for (int i=0; i<navlo; i++)
     203        (*cam->fAverageLoGainAreas)  [i] = (*fAverageLoGainAreas)  [i]->Clone();
     204      for (int i=0; i<nselo; i++)
     205        (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone();
     206    }
     207
     208  cam->fAverageAreaNum         = fAverageAreaNum;
     209  cam->fAverageAreaSat         = fAverageAreaSat;
     210  cam->fAverageAreaSigma       = fAverageAreaSigma;     
     211  cam->fAverageAreaSigmaVar    = fAverageAreaSigmaVar;   
     212  cam->fAverageAreaRelSigma    = fAverageAreaRelSigma;
     213  cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar;   
     214  cam->fAverageSectorNum       = fAverageSectorNum;     
     215  cam->fRunNumbers             = fRunNumbers;
     216
     217  *fLog << err << "COLOR: " << fColor << endl;
     218
     219  cam->fColor                  = fColor;
     220  cam->fPulserFrequency        = fPulserFrequency;
     221  cam->fFlags                  = fFlags;
     222
     223  return cam;
    156224
    157225}
     
    284352        {
    285353          const Float_t reltime = pix.GetArrivalTimeLoGain() - reftime;
    286           histhi.SetSaturated(1);
     354          histhi.AddSaturated(1);
    287355          histlo.FillHistAndArray(reltime);
    288356          fSumarealo  [aidx]   += reltime;
     
    524592 (*this)[idx].DrawClone();
    525593}
     594
     595// -----------------------------------------------------------------------------
     596//
     597// Default draw:
     598//
     599// Displays the averaged areas, both High Gain and Low Gain
     600//
     601// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
     602//
     603void MHCalibrationRelTimeCam::Draw(const Option_t *opt)
     604{
     605
     606  const Int_t nareas = fAverageHiGainAreas->GetEntries();
     607  if (nareas == 0)
     608    return;
     609
     610  TString option(opt);
     611  option.ToLower();
     612
     613  if (!option.Contains("datacheck"))
     614    {
     615      MHCalibrationCam::Draw(opt);
     616      return;
     617    }
     618
     619  //
     620  // From here on , the datacheck - Draw
     621  //
     622  TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this); 
     623  pad->SetBorderMode(0);
     624  pad->Divide(1,nareas);
     625
     626  //
     627  // Loop over inner and outer pixels
     628  // 
     629  for (Int_t i=0; i<nareas;i++)
     630     {
     631       
     632       pad->cd(i+1);
     633       
     634       MHCalibrationPix &hipix = GetAverageHiGainArea(i);
     635       //
     636       // Ask for Hi-Gain saturation
     637       //
     638       if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() && IsLoGain())
     639         {
     640           MHCalibrationPix &lopix = GetAverageLoGainArea(i);
     641           DrawDataCheckPixel(lopix,0.);
     642         }
     643       else
     644         DrawDataCheckPixel(hipix,0.);
     645    }     
     646}
     647
     648// -----------------------------------------------------------------------------
     649//
     650// Draw the average pixel for the datacheck:
     651//
     652// Displays the averaged areas, both High Gain and Low Gain
     653//
     654// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
     655//
     656void MHCalibrationRelTimeCam::DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline)
     657{
     658 
     659  TVirtualPad *newpad = gPad;
     660  newpad->Divide(1,2);
     661  newpad->cd(1);
     662 
     663  gPad->SetTicks();
     664  if (!pix.IsEmpty() && !pix.IsOnlyOverflow() && !pix.IsOnlyUnderflow())
     665    gPad->SetLogy();
     666
     667  TH1F *hist = pix.GetHGausHist();
     668 
     669  TH1F *null = new TH1F("Null",hist->GetTitle(),100,pix.GetFirst() < -3.0 ? -3.0 : pix.GetFirst(),
     670                        pix.GetLast() > 3.0 ? 3.0 : pix.GetLast());
     671
     672  null->SetMaximum(1.1*hist->GetMaximum());
     673  null->SetDirectory(NULL);
     674  null->SetBit(kCanDelete);
     675  null->SetStats(kFALSE);
     676  //
     677  // set the labels bigger
     678  //
     679  TAxis *xaxe = null->GetXaxis();
     680  TAxis *yaxe = null->GetYaxis();
     681  xaxe->CenterTitle();
     682  yaxe->CenterTitle();   
     683  xaxe->SetTitleSize(0.07);
     684  yaxe->SetTitleSize(0.07);   
     685  xaxe->SetTitleOffset(0.7);
     686  yaxe->SetTitleOffset(0.55);   
     687  xaxe->SetLabelSize(0.06);
     688  yaxe->SetLabelSize(0.06);   
     689
     690  xaxe->SetTitle(hist->GetXaxis()->GetTitle());
     691  yaxe->SetTitle(hist->GetYaxis()->GetTitle()); 
     692
     693  null->Draw();
     694  hist->Draw("same");
     695
     696  gStyle->SetOptFit();
     697
     698  TF1 *fit = pix.GetFGausFit();
     699
     700  if (fit)
     701  {
     702    switch ( fColor )
     703      {
     704      case MCalibrationCam::kGREEN:
     705        fit->SetLineColor(kGreen);
     706        break;
     707      case MCalibrationCam::kBLUE:
     708        fit->SetLineColor(kBlue);
     709        break;
     710      case MCalibrationCam::kUV: 
     711        fit->SetLineColor(106);
     712        break;
     713      case MCalibrationCam::kCT1:
     714        fit->SetLineColor(006);
     715        break;
     716      default:
     717        fit->SetLineColor(kRed);
     718      }
     719    fit->Draw("same");
     720  }
     721
     722  //  DisplayRefLines(null,refline);
     723
     724  gPad->Modified();
     725  gPad->Update();
     726
     727  newpad->cd(2);
     728  gPad->SetTicks();
     729
     730  TH1F *null2 = new TH1F("Null2",hist->GetTitle(),100,0.,pix.GetEvents()->GetSize()/pix.GetEventFrequency());
     731
     732  null2->SetMinimum(pix.GetMean()-10.*pix.GetSigma());
     733  null2->SetMaximum(pix.GetMean()+10.*pix.GetSigma());
     734  null2->SetDirectory(NULL);
     735  null2->SetBit(kCanDelete);
     736  null2->SetStats(kFALSE);
     737  //
     738  // set the labels bigger
     739  //
     740  TAxis *xaxe2 = null2->GetXaxis();
     741  TAxis *yaxe2 = null2->GetYaxis();
     742  xaxe2->CenterTitle();
     743  yaxe2->CenterTitle();   
     744  xaxe2->SetTitleSize(0.07);
     745  yaxe2->SetTitleSize(0.07);   
     746  xaxe2->SetTitleOffset(0.7);
     747  yaxe2->SetTitleOffset(0.55);   
     748  xaxe2->SetLabelSize(0.06);
     749  yaxe2->SetLabelSize(0.06);   
     750
     751  pix.CreateGraphEvents();
     752  TGraph *gr = pix.GetGraphEvents();
     753
     754  xaxe2->SetTitle(gr->GetXaxis()->GetTitle());
     755  yaxe2->SetTitle(gr->GetYaxis()->GetTitle()); 
     756
     757  null2->Draw();
     758
     759  pix.DrawEvents("same");
     760
     761  return;
     762}
     763
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.h

    r4949 r4963  
    1414#endif
    1515
     16class TH1F;
    1617class MGeomCam;
    1718class MHCalibrationRelTimeCam : public MHCalibrationCam
     
    4647  Bool_t FinalizeHists();
    4748  void   FinalizeBadPixels();
     49
     50  void   DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline);
    4851 
    4952public:
     
    5154  MHCalibrationRelTimeCam(const char *name=NULL, const char *title=NULL);
    5255  ~MHCalibrationRelTimeCam() {}
     56
     57  TObject *Clone(const char *name="") const;
    5358
    5459  UInt_t GetReferencePixel() const { return fReferencePixel; }
     
    5964  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    6065  void DrawPixelContent(Int_t idx) const;
    61  
     66
     67  // Draw
     68  void Draw(const Option_t *opt);
     69
    6270  ClassDef(MHCalibrationRelTimeCam, 1)  // Histogram class for Relative Time Camera Calibration
    6371};
Note: See TracChangeset for help on using the changeset viewer.