CMS 3D CMS Logo

Public Member Functions | Private Attributes

FitSlicesYTool Class Reference

#include <FitSlicesYTool.h>

List of all members.

Public Member Functions

 FitSlicesYTool (MonitorElement *)
void getFittedMean (MonitorElement *)
 Fill the ME with the mean value of the gaussian fit in each slice.
void getFittedMeanWithError (MonitorElement *)
 Fill the ME with the mean value (with error) of the gaussian fit in each slice.
void getFittedSigma (MonitorElement *)
 Fill the ME with the sigma value of the gaussian fit in each slice.
void getFittedSigmaWithError (MonitorElement *)
 Fill the ME with the sigma value (with error) of the gaussian fit in each slice.
 ~FitSlicesYTool ()
 Constructor: needs a TH2F.

Private Attributes

TH1 * h0
TH1 * h1
TH1 * h2
TH1 * h3

Detailed Description

Class to fill Monitor Elements using the ROOT FitSlicesY tool

Date:
2009/03/27 00:16:49
Revision:
1.1
Author:
cerati

Definition at line 17 of file FitSlicesYTool.h.


Constructor & Destructor Documentation

FitSlicesYTool::FitSlicesYTool ( MonitorElement me)

Definition at line 8 of file FitSlicesYTool.cc.

References MonitorElement::getTH2F(), h, and mergeVDriftHistosByStation::name.

{ 
  const bool oldAddDir = TH1::AddDirectoryStatus();
  TH1::AddDirectory(true);
  // ... create your hists
  TH2F * h = me->getTH2F();
  h->FitSlicesY();
  string name(h->GetName());
  h0 = (TH1*)gDirectory->Get((name+"_0").c_str());
  h1 = (TH1*)gDirectory->Get((name+"_1").c_str());
  h2 = (TH1*)gDirectory->Get((name+"_2").c_str());
  h3 = (TH1*)gDirectory->Get((name+"_chi2").c_str());
  TH1::AddDirectory(oldAddDir);
}
FitSlicesYTool::~FitSlicesYTool ( )

Constructor: needs a TH2F.

Destructor

Definition at line 31 of file FitSlicesYTool.cc.

                               {
  delete h0;  
  delete h1;  
  delete h2;  
  delete h3;  
}

Member Function Documentation

void FitSlicesYTool::getFittedMean ( MonitorElement me)

Fill the ME with the mean value of the gaussian fit in each slice.

Definition at line 37 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and MonitorElement::setBinContent().

                                                     {
  if (!(h1&&me)) throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
  if (h1->GetNbinsX()==me->getNbinsX()){
    for (int bin=0;bin!=h1->GetNbinsX();bin++){
      me->setBinContent(bin+1,h1->GetBinContent(bin+1));
//       me->setBinEntries(bin+1, 1.);
    }
  } else {
    throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
  }
}
void FitSlicesYTool::getFittedMeanWithError ( MonitorElement me)

Fill the ME with the mean value (with error) of the gaussian fit in each slice.

Definition at line 59 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and MonitorElement::setBinContent().

Referenced by MuonTrackResidualAnalyzer::computeResolution(), and MTVHistoProducerAlgoForTracker::finalHistoFits().

                                                              {
  if (!(h1&&me)) throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
  if (h1->GetNbinsX()==me->getNbinsX()){
    for (int bin=0;bin!=h1->GetNbinsX();bin++){
      me->setBinContent(bin+1,h1->GetBinContent(bin+1));
//       me->setBinEntries(bin+1, 1.);
      me->setBinError(bin+1,h1->GetBinError(bin+1));
    }
  } else {
    throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
  }
}
void FitSlicesYTool::getFittedSigma ( MonitorElement me)

Fill the ME with the sigma value of the gaussian fit in each slice.

Definition at line 48 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and MonitorElement::setBinContent().

                                                      {
  if (!(h2&&me)) throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
  if (h2->GetNbinsX()==me->getNbinsX()){
    for (int bin=0;bin!=h2->GetNbinsX();bin++){
      me->setBinContent(bin+1,h2->GetBinContent(bin+1));
//       me->setBinEntries(bin+1, 1.);
    }
  } else {
    throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
  }
}
void FitSlicesYTool::getFittedSigmaWithError ( MonitorElement me)

Fill the ME with the sigma value (with error) of the gaussian fit in each slice.

Definition at line 71 of file FitSlicesYTool.cc.

References newFWLiteAna::bin, Exception, and MonitorElement::setBinContent().

Referenced by MuonTrackResidualAnalyzer::computeResolution(), and MTVHistoProducerAlgoForTracker::finalHistoFits().

                                                               {
  if (!(h2&&me)) throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
  if (h2->GetNbinsX()==me->getNbinsX()){
    for (int bin=0;bin!=h2->GetNbinsX();bin++){
      me->setBinContent(bin+1,h2->GetBinContent(bin+1));
//       me->setBinEntries(bin+1, 1.);
      me->setBinError(bin+1,h2->GetBinError(bin+1));
    }
  } else {
    throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
  }
}

Member Data Documentation

TH1* FitSlicesYTool::h0 [private]

Definition at line 33 of file FitSlicesYTool.h.

TH1* FitSlicesYTool::h1 [private]

Definition at line 34 of file FitSlicesYTool.h.

TH1* FitSlicesYTool::h2 [private]

Definition at line 35 of file FitSlicesYTool.h.

TH1* FitSlicesYTool::h3 [private]

Definition at line 36 of file FitSlicesYTool.h.