#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, std::vector< std::string > arguments) |
adds a new category based on a cut More... | |
void | addFixedVariavles (std::vector< 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, std::vector< std::string > efficiencyCategories, 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 | setWeightVar (const std::string &weight) |
set a variable to be used as weight for a dataset. empty string means no weights. More... | |
TagProbeFitter (std::vector< std::string > inputFileNames, std::string inputDirectoryName, std::string inputTreeName, std::string outputFileName, int numCPU=1, bool saveWorkspace_=false, bool floatShapeParameters=true, 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, TString plotName, TString plotTitle, TString effName) |
makes the 1D plot More... | |
void | makeEfficiencyPlot2D (RooDataSet &eff, RooRealVar &v1, RooRealVar &v2, TString plotName, TString plotTitle, TString effName) |
makes the 2D plot More... | |
void | saveDistributionsPlot (RooWorkspace *w) |
saves the distributions canvas More... | |
void | saveEfficiencyPlots (RooDataSet &eff, 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... | |
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 | ( | std::vector< std::string > | inputFileNames, |
std::string | inputDirectoryName, | ||
std::string | inputTreeName, | ||
std::string | outputFileName, | ||
int | numCPU = 1 , |
||
bool | saveWorkspace_ = false , |
||
bool | floatShapeParameters = true , |
||
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 44 of file TagProbeFitter.cc.
References gather_cfg::cout, i, jptDQMConfig_cff::massBins, and download_sqlite_cfg::outputFile.
TagProbeFitter::~TagProbeFitter | ( | ) |
destructor closes the files
Definition at line 70 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 90 of file TagProbeFitter.cc.
References trackerHits::c, and makeLayoutFileForGui::variables.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
bool TagProbeFitter::addExpression | ( | std::string | expressionName, |
std::string | title, | ||
std::string | expression, | ||
std::vector< std::string > | arguments | ||
) |
adds a new category based on a cut
Definition at line 101 of file TagProbeFitter.cc.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
void TagProbeFitter::addFixedVariavles | ( | std::vector< 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 113 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 107 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 85 of file TagProbeFitter.cc.
References 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, |
std::vector< std::string > | efficiencyCategories, | ||
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 484 of file TagProbeFitter.cc.
References edmPickEvents::command, and i.
|
protected |
calculate the efficiecny by counting in the dataset found in the workspace
Definition at line 761 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 359 of file TagProbeFitter.cc.
References dtNoiseDBValidation_cfg::cerr, data, and alignCSCRings::e.
|
protected |
calculate the efficiecny with side band substraction in the dataset found in the workspace
Definition at line 758 of file TagProbeFitter.cc.
|
protected |
makes the 1D plot
Definition at line 721 of file TagProbeFitter.cc.
References svgfig::canvas(), alignCSCRings::e, AlCaHLTBitMon_ParallelJobs::p, and runtimedef::set().
|
protected |
makes the 2D plot
Definition at line 734 of file TagProbeFitter.cc.
References svgfig::canvas(), Data::Data(), alignCSCRings::e, h, i, and runtimedef::set().
|
protected |
saves the distributions canvas
Definition at line 626 of file TagProbeFitter.cc.
References svgfig::canvas(), i, and v.
|
protected |
saves the efficiency plots
Definition at line 670 of file TagProbeFitter.cc.
References lumiQTWidget::t.
|
protected |
saves the fit canvas
Definition at line 564 of file TagProbeFitter.cc.
References svgfig::canvas(), i, scaleCards::mass, jptDQMConfig_cff::massBins, and v.
|
inline |
set if to do a binned fit
Definition at line 48 of file TagProbeFitter.h.
References binnedFit, combineCards::bins, 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 117 of file TagProbeFitter.cc.
References combineCards::bins, and jptDQMConfig_cff::massBins.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
|
protected |
sets initial values of the PDF parameters based on the data available in the workspace
Definition at line 521 of file TagProbeFitter.cc.
void TagProbeFitter::setQuiet | ( | bool | quiet_ = true | ) |
suppress most of the output from RooFit and Minuit
Definition at line 77 of file TagProbeFitter.cc.
References dqm::qstatus::ERROR, instance, and dqm::qstatus::WARNING.
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 121 of file TagProbeFitter.cc.
Referenced by TagProbeFitTreeAnalyzer::TagProbeFitTreeAnalyzer().
|
protected |
fix or release variables selected by user
Definition at line 777 of file TagProbeFitter.cc.
References gather_cfg::cout.
|
protected |
restore variables's values for fit starting point
Definition at line 800 of file TagProbeFitter.cc.
References gather_cfg::cout, and i.
|
protected |
store values in the vector
Definition at line 788 of file TagProbeFitter.cc.
References gather_cfg::cout.
|
protected |
do binned fit; 0 = automatic, 1 = yes, -1 = no. d
Definition at line 76 of file TagProbeFitter.h.
Referenced by setBinnedFit().
|
protected |
expressions computed almost on the fly
Definition at line 92 of file TagProbeFitter.h.
|
protected |
list of variables fo fix (see below)
Definition at line 99 of file TagProbeFitter.h.
|
protected |
Definition at line 100 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 105 of file TagProbeFitter.h.
|
protected |
pointer to the input TTree Chain of data
Definition at line 61 of file TagProbeFitter.h.
|
protected |
number of bins to use in mass shape plots; 0 = automatic
Definition at line 79 of file TagProbeFitter.h.
Referenced by setBinnedFit().
|
protected |
number of CPUs to use for the fit
Definition at line 70 of file TagProbeFitter.h.
|
protected |
pointer to the TDirectory in the output file that is the root directory for this fitter
Definition at line 67 of file TagProbeFitter.h.
|
protected |
pointer to the output file
Definition at line 64 of file TagProbeFitter.h.
|
protected |
a RooWorkspace object to parse input parameters with ".factory()"
Definition at line 108 of file TagProbeFitter.h.
|
protected |
the map of pdf names to the vector of commands to build the pdf
Definition at line 82 of file TagProbeFitter.h.
|
protected |
suppress most printout
Definition at line 111 of file TagProbeFitter.h.
|
protected |
the default option wether to save the workspace for each bin
Definition at line 73 of file TagProbeFitter.h.
|
protected |
Definition at line 96 of file TagProbeFitter.h.
|
protected |
the set of variables describing the data in the input TTree
Definition at line 85 of file TagProbeFitter.h.
|
protected |
weight variable (or empy string for no weights)
Definition at line 88 of file TagProbeFitter.h.