/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
PulseFitter Class Reference

#include <PulseFitter.h>

Collaboration diagram for PulseFitter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PulseFitter (TProfile **hists, int *sensorFullPackedData, const char *detName)
 ~PulseFitter ()
TTree * Fit ()

Private Member Functions

TProfile * GetHist (Int_t pmtIdx, Int_t adc)
void FitPulse (Int_t pmtIdx, Int_t adc)
void SaveFit (Int_t pmtIdx, Int_t adc)

Private Attributes

TProfile ** hists
int * sensorFullPackedData
PulseParams pulseParams
PulseParamspPulseParams
TTree * tree
TF1 * formula
TFile * outFile

Detailed Description

Definition at line 13 of file PulseFitter.h.


Constructor & Destructor Documentation

PulseFitter::PulseFitter ( TProfile **  hists,
int *  sensorFullPackedData,
const char *  detName 
)

Definition at line 15 of file PulseFitter.cc.

  : hists(hists),
    sensorFullPackedData(sensorFullPackedData)
{
  tree = new TTree("pulseparams", "PMT pulse parameters");
  pPulseParams = &pulseParams;
  tree->Branch("params", &pPulseParams);

  formula = new TF1("fPulse", GausCubicFn, 50, 1000, NUM_PARAMS);
  formula->SetParLimits(0, 0, 500);
  formula->SetParLimits(1, 180, 220);
  formula->SetParLimits(2, 10, 120);
  formula->SetParLimits(3, -0.001, 0.001);
  formula->SetParLimits(4, -0.02, 0.02);
  formula->SetParLimits(5, -7, 2);
  formula->SetParLimits(6, 0, 1200);

  string fname = string("prof_fits_")+detName+".root";
  outFile = new TFile(fname.c_str(), "recreate");
}
PulseFitter::~PulseFitter ( )

Definition at line 38 of file PulseFitter.cc.

{
  delete tree;
  delete formula;
  delete outFile;
}

Member Function Documentation

TTree * PulseFitter::Fit ( )

Definition at line 46 of file PulseFitter.cc.

{
  for (int pmtIdx = 0; pmtIdx < NUM_PMTS; ++pmtIdx)
    for (Int_t adc = ADC_MIN; adc <= ADC_MAX; adc += ADC_INC) {
      cout << pmtIdx << ", " << adc << endl;
      FitPulse(pmtIdx, adc);
      SaveFit(pmtIdx, adc);
    }

  tree->Write();

  return tree;
}
TProfile * PulseFitter::GetHist ( Int_t  pmtIdx,
Int_t  adc 
) [private]

Definition at line 61 of file PulseFitter.cc.

{
  return hists[HIST_IDX(pmtIdx, adc)];
}
void PulseFitter::FitPulse ( Int_t  pmtIdx,
Int_t  adc 
) [private]

Definition at line 67 of file PulseFitter.cc.

{
  TProfile *hist = GetHist(pmtIdx, adc);

  formula->SetParameter(0, adc);
  hist->Fit("fPulse", "RS");

  hist->Write();
}
void PulseFitter::SaveFit ( Int_t  pmtIdx,
Int_t  adc 
) [private]

Definition at line 78 of file PulseFitter.cc.

{
  Double_t *par = formula->GetParameters();
  Double_t *err = formula->GetParErrors();

  copy(par, par+NUM_PARAMS, (Double_t*)&pulseParams.params.amp);
  copy(err, err+NUM_PARAMS, (Double_t*)&pulseParams.err.amp);

  pulseParams.pmtIdx = pmtIdx;
  pulseParams.fullPackedData = sensorFullPackedData[pmtIdx];
  pulseParams.adc = adc;

  tree->Fill();
}

Member Data Documentation

TProfile** PulseFitter::hists [private]

Definition at line 21 of file PulseFitter.h.

Definition at line 22 of file PulseFitter.h.

Definition at line 23 of file PulseFitter.h.

Definition at line 23 of file PulseFitter.h.

TTree* PulseFitter::tree [private]

Definition at line 24 of file PulseFitter.h.

TF1* PulseFitter::formula [private]

Definition at line 25 of file PulseFitter.h.

TFile* PulseFitter::outFile [private]

Definition at line 26 of file PulseFitter.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:03:47 for PulseParamGen by doxygen 1.7.4