25 fitter( pset.getParameter<vector<string> >(
"InputFileNames"),
26 pset.getParameter<string>(
"InputDirectoryName"),
27 pset.getParameter<string>(
"InputTreeName"),
28 pset.getParameter<string>(
"OutputFileName"),
29 pset.existsAs<unsigned int>(
"NumCPU")?pset.getParameter<unsigned int>(
"NumCPU"):1,
30 pset.existsAs<bool>(
"SaveWorkspace")?pset.getParameter<bool>(
"SaveWorkspace"):
false,
31 pset.existsAs<bool>(
"floatShapeParameters")?pset.getParameter<bool>(
"floatShapeParameters"):
true,
32 pset.existsAs<vector<string> >(
"fixVars")?pset.getParameter<vector<string> >(
"fixVars"):vector<string>()
37 if (pset.
existsAs<
bool>(
"binnedFit")) {
40 }
else if (pset.
existsAs<uint32_t>(
"binsForMassPlots")) {
44 if (pset.
existsAs<std::string>(
"WeightVariable")) {
49 for (vector<string>::const_iterator
name = variableNames.begin();
name != variableNames.end();
name++) {
50 vector<string> var = variables.
getParameter<vector<string> >(*name);
52 if(var.size()>=4 && !(istringstream(var[1])>>lo).
fail() && !(istringstream(var[2])>>hi).
fail()){
55 LogError(
"TagProbeFitTreeAnalyzer")<<
"Could not create variable: "<<*name<<
56 ". Example: pt = cms.vstring(\"Probe pT\", \"1.0\", \"100.0\", \"GeV/c\") ";
62 for (vector<string>::const_iterator
name = categoryNames.begin();
name != categoryNames.end();
name++) {
63 vector<string> cat = categories.
getParameter<vector<string> >(*name);
67 LogError(
"TagProbeFitTreeAnalyzer")<<
"Could not create category: "<<*name<<
68 ". Example: mcTrue = cms.vstring(\"MC True\", \"dummy[true=1,false=0]\") ";
75 for (vector<string>::const_iterator
name = exprNames.begin();
name != exprNames.end();
name++) {
76 vector<string> expr = exprs.
getParameter<vector<string> >(*name);
78 vector<string>
args(expr.begin()+2,expr.end());
81 LogError(
"TagProbeFitTreeAnalyzer")<<
"Could not create expr: "<<*name<<
82 ". Example: qop = cms.vstring(\"qOverP\", \"charge/p\", \"charge\", \"p\") ";
91 for (vector<string>::const_iterator
name = cutNames.begin();
name != cutNames.end();
name++) {
92 vector<string> cat = cuts.
getParameter<vector<string> >(*name);
96 LogError(
"TagProbeFitTreeAnalyzer")<<
"Could not create cut: "<<*name<<
97 ". Example: matched = cms.vstring(\"Matched\", \"deltaR\", \"0.5\") ";
105 for (vector<string>::const_iterator
name = pdfNames.begin();
name != pdfNames.end();
name++) {
106 vector<string> pdf = pdfs.
getParameter<vector<string> >(*name);
113 for (vector<string>::const_iterator
name = efficiencyNames.begin();
name != efficiencyNames.end();
name++) {
123 vector<string> effCatState = pset.
getParameter<vector<string> >(
"EfficiencyCategoryAndState");
124 if(effCatState.empty() || (effCatState.size() % 2 == 1)){
125 cout<<
"EfficiencyCategoryAndState must be a even-sized list of category names and states of that category (cat1, state1, cat2, state2, ...)."<<endl;
129 vector<string> unbinnedVariables;
130 if(pset.
existsAs<vector<string> >(
"UnbinnedVariables")){
131 unbinnedVariables = pset.
getParameter<vector<string> >(
"UnbinnedVariables");
135 map<string, vector<double> >binnedVariables;
137 for (vector<string>::const_iterator var = variableNames.begin(); var != variableNames.end(); var++) {
139 binnedVariables[*var] =
binning;
141 map<string, vector<string> >mappedCategories;
143 for (vector<string>::const_iterator var = categoryNames.begin(); var != categoryNames.end(); var++) {
145 mappedCategories[*var] =
map;
148 vector<string> binToPDFmap;
149 if(pset.
existsAs<vector<string> >(
"BinToPDFmap")){
150 binToPDFmap = pset.
getParameter<vector<string> >(
"BinToPDFmap");
152 if((binToPDFmap.size() > 0) && (binToPDFmap.size()%2 == 0)){
153 cout<<
"BinToPDFmap must have odd size, first string is the default, followed by binRegExp - PDFname pairs!"<<endl;
157 vector<string> effCats, effStates;
158 for (
size_t i = 0,
n = effCatState.size()/2;
i <
n; ++
i) {
159 effCats.push_back(effCatState[2*
i]);
160 effStates.push_back(effCatState[2*i+1]);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool addExpression(std::string expressionName, std::string title, std::string expression, std::vector< std::string > arguments)
adds a new category based on a cut
tuple TagProbeFitTreeAnalyzer
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void addPdf(std::string pdfName, std::vector< std::string > &pdfCommands)
virtual ~TagProbeFitTreeAnalyzer()
#define DEFINE_FWK_MODULE(type)
void setWeightVar(const std::string &weight)
set a variable to be used as weight for a dataset. empty string means no weights. ...
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 "...
void calculateEfficiency(string name, const edm::ParameterSet &pset)
bool addThresholdCategory(std::string categoryName, std::string title, std::string varName, double cutValue)
adds a new category based on a cut
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
void setQuiet(bool quiet_=true)
suppress most of the output from RooFit and Minuit
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
TagProbeFitTreeAnalyzer(const edm::ParameterSet &pset)
void setBinnedFit(bool binned, int bins=0)
set if to do a binned fit
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual void endRun(const edm::Run &run, const edm::EventSetup &setup)
void setBinsForMassPlots(int bins)
set number of bins to use when making the plots; 0 = automatic
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...
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
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")