CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQMOffline/RecoB/src/TaggingVariablePlotter.cc

Go to the documentation of this file.
00001 #include "DQMOffline/RecoB/interface/TaggingVariablePlotter.h"
00002 
00003 using namespace std;
00004 using namespace edm;
00005 using namespace reco;
00006 
00007 TaggingVariablePlotter::VariableConfig::VariableConfig(
00008                 const string &name, const ParameterSet &pSet, const bool& update,
00009                 const string &category, const string& label, const bool& mc) :
00010         var(getTaggingVariableName(name)),
00011         nBins(pSet.getParameter<unsigned int>("nBins")),
00012         min(pSet.getParameter<double>("min")),
00013         max(pSet.getParameter<double>("max"))
00014 {
00015         if (var == btau::lastTaggingVariable)
00016                 throw cms::Exception("Configuration")
00017                         << "Tagging variable \"" << name
00018                         << "\" does not exist." << endl;
00019 
00020         if (pSet.exists("logScale"))
00021                 logScale = pSet.getParameter<bool>("logScale");
00022         else
00023                 logScale = false;
00024 
00025         std::vector<unsigned int> indices;
00026         if (pSet.exists("indices"))
00027                 indices = pSet.getParameter< vector<unsigned int> >("indices");
00028         else
00029                 indices.push_back(0);
00030 
00031         for(std::vector<unsigned int>::const_iterator iter = indices.begin();
00032             iter != indices.end(); ++iter) {
00033                 Plot plot;
00034                 plot.histo.reset(new FlavourHistograms<double>(
00035                                                                name + (*iter ? Form("%d", *iter) : "")
00036                                                                + (category.empty() ? ""
00037                                                                   : ("_" + category)),
00038                         TaggingVariableDescription[var], nBins, min, max,
00039                         false, logScale, true, "b", update,label,mc));
00040                 plot.index = *iter;
00041                 plots.push_back(plot);
00042         }
00043 }
00044 
00045 TaggingVariablePlotter::TaggingVariablePlotter(const std::string &tagName,
00046                                                const EtaPtBin &etaPtBin, const ParameterSet &pSet, const bool& update,
00047                                                const bool& mc,
00048                                                const string &category) : BaseTagInfoPlotter(tagName, etaPtBin), mcPlots_(mc)
00049 {
00050   const std::string tagVarDir(theExtensionString.substr(1));
00051 
00052         const vector<string>& pSets = pSet.getParameterNames();
00053         for(vector<string>::const_iterator iter = pSets.begin();
00054             iter != pSets.end(); ++iter) {
00055                 VariableConfig var(*iter,
00056                                    pSet.getParameter<ParameterSet>(*iter),
00057                                    update, category,tagVarDir, mcPlots_);
00058                 variables.push_back(var);
00059         }
00060 }
00061 
00062 
00063 TaggingVariablePlotter::~TaggingVariablePlotter ()
00064 {
00065 }
00066 
00067 
00068 void TaggingVariablePlotter::analyzeTag (const BaseTagInfo *baseTagInfo,
00069         const int &jetFlavour)
00070 {
00071         analyzeTag(baseTagInfo->taggingVariables(), jetFlavour);
00072 }
00073 
00074 void TaggingVariablePlotter::analyzeTag (const TaggingVariableList &vars,
00075         const int &jetFlavour)
00076 {
00077         for(vector<VariableConfig>::const_iterator iter = variables.begin();
00078             iter != variables.end(); ++iter) {
00079                 const std::vector<TaggingValue> values(vars.getList(iter->var, false));
00080                 if (values.empty())
00081                         continue;
00082 
00083                 const unsigned int& size = values.size();
00084                 for(std::vector<VariableConfig::Plot>::const_iterator plot =
00085                                                 iter->plots.begin();
00086                     plot != iter->plots.end(); plot++) {
00087                         if (plot->index == 0) {
00088                                 for(std::vector<TaggingValue>::const_iterator iter = values.begin();
00089                                     iter != values.end(); ++iter)
00090                                         plot->histo->fill(jetFlavour, *iter);
00091                         } else if (plot->index - 1 < size)
00092                                 plot->histo->fill(jetFlavour,
00093                                                   values[plot->index - 1]);
00094                 }
00095         }
00096 }
00097 
00098 void TaggingVariablePlotter::finalize()
00099 {
00100 }
00101 
00102 void TaggingVariablePlotter::psPlot(const std::string &name)
00103 {
00104 }
00105 
00106 
00107 
00108 
00109 void TaggingVariablePlotter::epsPlot(const std::string &name)
00110 {
00111 }