#include <TagProbeFitter.h>
Public Member Functions | |
bool | addCategory (std::string categoryName, std::string title, std::string expression) |
adds a new category variable to the set of variables describing the data in the tree; "expression" is parsed by factory() More... | |
bool | addExpression (std::string expressionName, std::string title, std::string expression, const std::vector< std::string > &arguments) |
adds a new category based on a cut More... | |
void | addFixedVariavles (const std::vector< std::string > &) |
set a list of variables to fix during first fit iteration. If the list is empty, do one iteration. More... | |
void | addPdf (std::string pdfName, std::vector< std::string > &pdfCommands) |
bool | addThresholdCategory (std::string categoryName, std::string title, std::string varName, double cutValue) |
adds a new category based on a cut More... | |
bool | addVariable (std::string variableName, std::string title, double low, double hi, std::string units) |
adds a new real variable to the set of variables describing the data in the tree More... | |
std::string | calculateEfficiency (std::string dirName, std::string efficiencyCategory, std::string efficiencyState, std::vector< std::string > &unbinnedVariables, std::map< std::string, std::vector< double > > &binnedReals, std::map< std::string, std::vector< std::string > > &binnedCategories, std::vector< std::string > &binToPDFmap) |
calculate the efficiency for a particular binning of the data; it saves everything in the directory "dirName", uses the previously defined PDF with name "pdfName" More... | |
std::string | calculateEfficiency (std::string dirName, const std::vector< std::string > &efficiencyCategories, const std::vector< std::string > &efficiencyStates, std::vector< std::string > &unbinnedVariables, std::map< std::string, std::vector< double > > &binnedReals, std::map< std::string, std::vector< std::string > > &binnedCategories, std::vector< std::string > &binToPDFmap) |
void | setBinnedFit (bool binned, int bins=0) |
set if to do a binned fit More... | |
void | setBinsForMassPlots (int bins) |
set number of bins to use when making the plots; 0 = automatic More... | |
void | setQuiet (bool quiet_=true) |
suppress most of the output from RooFit and Minuit More... | |
void | setSaveDistributionsPlot (bool saveDistributionsPlot_) |
void | setWeightVar (const std::string &weight) |
set a variable to be used as weight for a dataset. empty string means no weights. More... | |
TagProbeFitter (const std::vector< std::string > &inputFileNames, std::string inputDirectoryName, std::string inputTreeName, std::string outputFileName, int numCPU=1, bool saveWorkspace_=false, bool floatShapeParameters=true, const std::vector< std::string > &fixVars_=std::vector< std::string >()) | |
construct the fitter with the inputFileName, inputDirectoryName, inputTreeName, outputFileName and specify wether to save the workspace with data for each bin More... | |
~TagProbeFitter () | |
destructor closes the files More... | |
Protected Member Functions | |
void | createPdf (RooWorkspace *w, std::vector< std::string > &pdfCommands) |
creates the simultaneous PDF in the workspace according to the "pdfCommands" More... | |
void | doCntEfficiency (RooWorkspace *w, RooRealVar &efficiency) |
calculate the efficiecny by counting in the dataset found in the workspace More... | |
void | doFitEfficiency (RooWorkspace *w, std::string pdfName, RooRealVar &efficiency) |
calculate the efficiecny with a simulataneous maximum likelihood fit in the dataset found in the workspace with PDF pdfName More... | |
void | doSBSEfficiency (RooWorkspace *w, RooRealVar &efficiency) |
calculate the efficiecny with side band substraction in the dataset found in the workspace More... | |
void | makeEfficiencyPlot1D (RooDataSet &eff, RooRealVar &v, const TString &plotName, const TString &plotTitle, const TString &effName, const char *catName=0, int catIndex=-1) |
makes the 1D plot More... | |
void | makeEfficiencyPlot2D (RooDataSet &eff, RooRealVar &v1, RooRealVar &v2, const TString &plotName, const TString &plotTitle, const TString &effName, const char *catName=0, int catIndex=-1) |
makes the 2D plot More... | |
void | saveDistributionsPlot (RooWorkspace *w) |
saves the distributions canvas More... | |
void | saveEfficiencyPlots (RooDataSet &eff, const TString &effName, RooArgSet &binnedVariables, RooArgSet &mappedCategories) |
saves the efficiency plots More... | |
void | saveFitPlot (RooWorkspace *w) |
saves the fit canvas More... | |
void | setInitialValues (RooWorkspace *w) |
sets initial values of the PDF parameters based on the data available in the workspace More... | |
void | varFixer (RooWorkspace *w, bool fix) |
fix or release variables selected by user More... | |
void | varRestorer (RooWorkspace *w) |
restore variables's values for fit starting point More... | |
void | varSaver (RooWorkspace *w) |
store values in the vector More... | |
Protected Attributes | |
int | binnedFit |
do binned fit; 0 = automatic, 1 = yes, -1 = no. d More... | |
bool | doSaveDistributionsPlot |
save distribution plots More... | |
std::vector< std::pair < std::pair< std::string, std::string >, std::pair < std::string, std::vector < std::string > > > > | expressionVars |
expressions computed almost on the fly More... | |
std::vector< std::string > | fixVars |
list of variables fo fix (see below) More... | |
std::vector< double > | fixVarValues |
bool | floatShapeParameters |
TChain * | inputTree |
pointer to the input TTree Chain of data More... | |
int | massBins |
number of bins to use in mass shape plots; 0 = automatic More... | |
int | numCPU |
number of CPUs to use for the fit More... | |
TDirectory * | outputDirectory |
pointer to the TDirectory in the output file that is the root directory for this fitter More... | |
TFile * | outputFile |
pointer to the output file More... | |
RooWorkspace | parameterParser |
a RooWorkspace object to parse input parameters with ".factory()" More... | |
std::map< std::string, std::vector< std::string > > | pdfs |
the map of pdf names to the vector of commands to build the pdf More... | |
bool | quiet |
suppress most printout More... | |
bool | saveWorkspace |
the default option wether to save the workspace for each bin More... | |
std::vector< std::pair < std::pair< std::string, std::string >, std::pair < std::string, double > > > | thresholdCategories |
RooArgSet | variables |
the set of variables describing the data in the input TTree More... | |
std::string | weightVar |
weight variable (or empy string for no weights) More... | |
Definition at line 11 of file TagProbeFitter.h.
TagProbeFitter::TagProbeFitter | ( | const std::vector< std::string > & | inputFileNames, |
std::string | inputDirectoryName, | ||
std::string | inputTreeName, | ||
std::string | outputFileName, | ||
int | numCPU = 1 , |
||
bool | saveWorkspace_ = false , |
||
bool | floatShapeParameters = true , |
||
const std::vector< std::string > & | fixVars_ = std::vector<std::string>() |
||
) |
construct the fitter with the inputFileName, inputDirectoryName, inputTreeName, outputFileName and specify wether to save the workspace with data for each bin
Definition at line 51 of file TagProbeFitter.cc.
References gather_cfg::cout, alignCSCRings::e, i, and download_sqlite_cfg::outputFile.
TagProbeFitter::~TagProbeFitter | ( | ) |
destructor closes the files
Definition at line 83 of file TagProbeFitter.cc.
References download_sqlite_cfg::outputFile.
bool TagProbeFitter::addCategory | ( | std::string | categoryName, |
std::string | title, | ||
std::string | expression | ||
) |
adds a new category variable to the set of variables describing the data in the tree; "expression" is parsed by factory()
Definition at line 105 of file TagProbeFitter.cc.
References EnergyCorrector::c, and makeLayoutFileForGui::variables.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
bool TagProbeFitter::addExpression | ( | std::string | expressionName, |
std::string | title, | ||
std::string | expression, | ||
const std::vector< std::string > & | arguments | ||
) |
adds a new category based on a cut
Definition at line 116 of file TagProbeFitter.cc.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
void TagProbeFitter::addFixedVariavles | ( | const std::vector< std::string > & | ) |
set a list of variables to fix during first fit iteration. If the list is empty, do one iteration.
void TagProbeFitter::addPdf | ( | std::string | pdfName, |
std::vector< std::string > & | pdfCommands | ||
) |
add a new PDF to the list of available PDFs; "pdfCommands" are parsed by factory(). the user needs to define efficiency[0.9,0,1] for the initial value, "signal" PDF, "backgroundPass" PDF and "backgroundFail" PDF
Definition at line 128 of file TagProbeFitter.cc.
References mergeVDriftHistosByStation::name.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
bool TagProbeFitter::addThresholdCategory | ( | std::string | categoryName, |
std::string | title, | ||
std::string | varName, | ||
double | cutValue | ||
) |
adds a new category based on a cut
Definition at line 122 of file TagProbeFitter.cc.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
bool TagProbeFitter::addVariable | ( | std::string | variableName, |
std::string | title, | ||
double | low, | ||
double | hi, | ||
std::string | units | ||
) |
adds a new real variable to the set of variables describing the data in the tree
Definition at line 98 of file TagProbeFitter.cc.
References groupFilesInBlocks::temp, and makeLayoutFileForGui::variables.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
|
inline |
calculate the efficiency for a particular binning of the data; it saves everything in the directory "dirName", uses the previously defined PDF with name "pdfName"
Definition at line 39 of file TagProbeFitter.h.
Referenced by TagProbeFitTreeAnalyzer::calculateEfficiency().
std::string TagProbeFitter::calculateEfficiency | ( | std::string | dirName, |
const std::vector< std::string > & | efficiencyCategories, | ||
const std::vector< std::string > & | efficiencyStates, | ||
std::vector< std::string > & | unbinnedVariables, | ||
std::map< std::string, std::vector< double > > & | binnedReals, | ||
std::map< std::string, std::vector< std::string > > & | binnedCategories, | ||
std::vector< std::string > & | binToPDFmap | ||
) |
|
protected |
creates the simultaneous PDF in the workspace according to the "pdfCommands"
Definition at line 535 of file TagProbeFitter.cc.
References edmPickEvents::command, i, and AlCaHLTBitMon_QueryRunRegistry::string.
|
protected |
calculate the efficiecny by counting in the dataset found in the workspace
Definition at line 828 of file TagProbeFitter.cc.
References alpha, alignCSCRings::e, and cmsPerfPublish::fail().
|
protected |
calculate the efficiecny with a simulataneous maximum likelihood fit in the dataset found in the workspace with PDF pdfName
—> if "floatShapeParameters==false" && "fixVars is NOT empty" : Perform a global fit to the whole sample, save the fitted values of the user specified parameters, and fix them for bin-by-bin fit.
Definition at line 375 of file TagProbeFitter.cc.
References ecal_dqm_sourceclient-live_cfg::cerr, data, and alignCSCRings::e.
|
protected |
calculate the efficiecny with side band substraction in the dataset found in the workspace
Definition at line 825 of file TagProbeFitter.cc.
|
protected |
makes the 1D plot
Definition at line 771 of file TagProbeFitter.cc.
References svgfig::canvas(), i, j, gen::n, and AlCaHLTBitMon_ParallelJobs::p.
|
protected |
makes the 2D plot
Definition at line 799 of file TagProbeFitter.cc.
References svgfig::canvas(), Data::Data(), alignCSCRings::e, h, and i.
|
protected |
saves the distributions canvas
Definition at line 676 of file TagProbeFitter.cc.
References svgfig::canvas(), i, and findQualityFiles::v.
|
protected |
saves the efficiency plots
Definition at line 721 of file TagProbeFitter.cc.
References lumiQTWidget::t.
|
protected |
saves the fit canvas
Definition at line 613 of file TagProbeFitter.cc.
References svgfig::canvas(), i, and findQualityFiles::v.
|
inline |
set if to do a binned fit
Definition at line 48 of file TagProbeFitter.h.
References binnedFit, and massBins.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
void TagProbeFitter::setBinsForMassPlots | ( | int | bins | ) |
set number of bins to use when making the plots; 0 = automatic
Definition at line 132 of file TagProbeFitter.cc.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
|
protected |
sets initial values of the PDF parameters based on the data available in the workspace
Definition at line 576 of file TagProbeFitter.cc.
void TagProbeFitter::setQuiet | ( | bool | quiet_ = true | ) |
suppress most of the output from RooFit and Minuit
Definition at line 90 of file TagProbeFitter.cc.
References cond::ERROR, instance, and dqm::qstatus::WARNING.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
|
inline |
Definition at line 54 of file TagProbeFitter.h.
References doSaveDistributionsPlot.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
void TagProbeFitter::setWeightVar | ( | const std::string & | weight | ) |
set a variable to be used as weight for a dataset. empty string means no weights.
Definition at line 136 of file TagProbeFitter.cc.
References MetTreeProducer::var().
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
|
protected |
fix or release variables selected by user
Definition at line 844 of file TagProbeFitter.cc.
References gather_cfg::cout.
|
protected |
restore variables's values for fit starting point
Definition at line 867 of file TagProbeFitter.cc.
References gather_cfg::cout, and i.
|
protected |
store values in the vector
Definition at line 855 of file TagProbeFitter.cc.
References gather_cfg::cout.
|
protected |
do binned fit; 0 = automatic, 1 = yes, -1 = no. d
Definition at line 82 of file TagProbeFitter.h.
Referenced by setBinnedFit().
|
protected |
save distribution plots
Definition at line 76 of file TagProbeFitter.h.
Referenced by setSaveDistributionsPlot().
|
protected |
expressions computed almost on the fly
Definition at line 98 of file TagProbeFitter.h.
|
protected |
list of variables fo fix (see below)
Definition at line 105 of file TagProbeFitter.h.
|
protected |
Definition at line 106 of file TagProbeFitter.h.
|
protected |
release some variables before the fit in each bin if set to "false" will fit all dataset to get values of specified variables and then fit all bins having them fixed if set to "true" (default) will not fit all dataset, just each bin with fixed and then released variables
Definition at line 111 of file TagProbeFitter.h.
|
protected |
pointer to the input TTree Chain of data
Definition at line 64 of file TagProbeFitter.h.
|
protected |
number of bins to use in mass shape plots; 0 = automatic
Definition at line 85 of file TagProbeFitter.h.
Referenced by setBinnedFit().
|
protected |
number of CPUs to use for the fit
Definition at line 73 of file TagProbeFitter.h.
|
protected |
pointer to the TDirectory in the output file that is the root directory for this fitter
Definition at line 70 of file TagProbeFitter.h.
|
protected |
pointer to the output file
Definition at line 67 of file TagProbeFitter.h.
|
protected |
a RooWorkspace object to parse input parameters with ".factory()"
Definition at line 114 of file TagProbeFitter.h.
|
protected |
the map of pdf names to the vector of commands to build the pdf
Definition at line 88 of file TagProbeFitter.h.
|
protected |
suppress most printout
Definition at line 117 of file TagProbeFitter.h.
|
protected |
the default option wether to save the workspace for each bin
Definition at line 79 of file TagProbeFitter.h.
|
protected |
Definition at line 102 of file TagProbeFitter.h.
|
protected |
the set of variables describing the data in the input TTree
Definition at line 91 of file TagProbeFitter.h.
|
protected |
weight variable (or empy string for no weights)
Definition at line 94 of file TagProbeFitter.h.