Ignore:
Timestamp:
01/22/04 20:54:16 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
2 edited

Legend:

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

    r2885 r2886  
    7171  fEvents = 0;
    7272
    73   fHistRatio = new TH1F("HistRatio", "Ratio fPassPhotCone/fSize", 1000., 0., 10.);
     73  fHistRatio = new TH1F("HistRatio", "log10(fPassPhotCone/fSize)", 1500., -3., 3.);
     74  fHistRatio->GetXaxis()->SetTitle("log_{10}(fPassPhotCone / fSize) (in photons/ADC count)");
    7475}
    7576
     
    165166    }
    166167
     168  for (UInt_t ipix = 0; ipix < fGeom->GetNumPixels(); ipix++)
     169    {
     170      if (fHeaderFadc->GetPedestalRmsHigh(ipix) > 0 ||
     171          fHeaderFadc->GetPedestalRmsLow(ipix) > 0 )
     172        {
     173          *fLog << err << endl << endl << dbginf << "You are trying to calibrate the data using a Camera file produced with added noise. Please use a noiseless file for calibration. Aborting..." << endl << endl;
     174          return kFALSE;
     175        }
     176    }
     177
    167178  //
    168179  // FIXME: Check that the relevant parameters in the FADC header are the
    169   // same for all the analyzed data!
     180  // same for all the analyzed data, both Calibration and Analyzed data!
    170181  //
    171182
     
    181192{
    182193
     194  //
     195  // Exclude events with some saturated pixel
     196  //
    183197  if ( fNew->GetNumSaturatedPixels() > 0 )
    184198    return kTRUE;
    185199
     200  //
     201  // Exclude events with low Size (larger fluctuations)
     202  // FIXME? The present cut (1000 "inner-pixel-counts") is somehow arbitrary.
     203  // Might it be optimized?
     204  //
     205  if ( fHillas->GetSize() < 1000 )
     206    return kTRUE;
     207
    186208  fADC2Phot += fMcEvt->GetPassPhotCone() / fHillas->GetSize();
    187209  fEvents ++;
    188210
    189   fHistRatio->Fill(fMcEvt->GetPassPhotCone()/fHillas->GetSize());
     211  fHistRatio->Fill(log10(fMcEvt->GetPassPhotCone()/fHillas->GetSize()));
    190212
    191213  return kTRUE;
     
    207229    }
    208230
     231  //
     232  // For the calibration we no longer use the mean, but thepeak of the distribution:
     233  //
     234
     235  Float_t summax = 0.;
     236  Int_t mode = 0;
     237  Int_t reach = 2;
     238  for (Int_t ibin = 1+reach; ibin <= fHistRatio->GetNbinsX()-reach; ibin++)
     239    {
     240      Float_t sum = 0;
     241      for(Int_t k = ibin-reach; k <= ibin+reach; k++)
     242        sum += fHistRatio->GetBinContent(k);
     243      if (sum > summax)
     244        {
     245          summax = sum;
     246          mode = ibin;
     247        }
     248    }
     249
     250  fADC2Phot = pow(10., fHistRatio->GetXaxis()->GetBinCenter(mode));
     251
    209252  const int num = fCalCam->GetSize();
    210253 
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h

    r2885 r2886  
    2828    Long_t  fEvents;
    2929
    30     TH1F*   fHistRatio;
     30    TH1F*   fHistRatio; // Histogram for monitoring the calibration.
    3131
    3232    Bool_t CheckRunType(MParList *pList) const;
     
    3939    MMcCalibrationCalc(const char *name=NULL, const char *title=NULL);
    4040
     41    TH1F*   GetHist() { return fHistRatio; }
     42
    4143    ClassDef(MMcCalibrationCalc, 0)   // Task which obtains, for MC files, the calibration factor from ADC counts to photons.
    4244};
Note: See TracChangeset for help on using the changeset viewer.