16 for(std::vector<CorrectionFactor>::const_iterator corrFactor=jec.begin(); corrFactor!=jec.end(); ++corrFactor){
18 throw cms::Exception(
"InvalidRequest") <<
"You try to create a CorrectionFactor which is neither flavor dependent nor \n"
19 <<
"flavor independent. The CorrectionFactor should obey the following rules: \n"
21 <<
" * CorrectionFactor is a std::pair<std::string, std::vector<float> >. \n"
22 <<
" * The std::string holds the label of the correction level (following the \n"
23 <<
" conventions of JetMET. \n"
24 <<
" * The std::vector<float> holds the correction factors, these factors are \n"
25 <<
" up to the given level. They include all previous correction steps. \n"
26 <<
" * The vector has the length *1* for flavor independent correction factors \n"
27 <<
" or *5* for flavor dependent correction factors. \n"
28 <<
" * The expected order of flavor dependent correction factors is: NONE, \n"
29 <<
" GLUON, UDS, CHARM, BOTTOM. If follows the JetMET conventions and is \n"
30 <<
" in the Flavor enumerator of the JetCorrFactos class. \n"
31 <<
" * For flavor depdendent correction factors the first entry in the vector \n"
32 <<
" (corresponding to NONE) is invalid and should be set to -1. It will not \n"
33 <<
" be considered by the class structure though. \n"
35 <<
"Make sure that all elements of the argument vector to this contructor are \n"
36 <<
"in accordance with these rules.\n";
44 std::map<Flavor, std::string> flavors;
45 flavors[
UDS]=
"uds"; flavors[
CHARM]=
"charm"; flavors[
BOTTOM]=
"bottom"; flavors[
GLUON]=
"gluon"; flavors[
NONE]=
"none";
46 return flavors.find(flavor)->second;
52 std::map<std::string, Flavor> flavors;
53 std::transform(flavor.begin(), flavor.end(), flavor.begin(), std::ptr_fun<int,int>(std::tolower));
54 flavors[
"uds"]=
UDS; flavors[
"charm"]=
CHARM; flavors[
"bottom"]=
BOTTOM; flavors[
"gluon"]=
GLUON; flavors[
"none"]=
NONE;
55 if(flavors.find(flavor)==flavors.end()){
56 throw cms::Exception(
"InvalidRequest") <<
"You ask for a flavor, which does not exist. Available flavors are: \n"
57 <<
"'uds', 'charm', 'bottom', 'gluon', 'none', (not case sensitive). \n";
59 return flavors.find(flavor)->second;
65 for(std::vector<CorrectionFactor>::const_iterator corrFactor=
jec_.begin(); corrFactor!=
jec_.end(); ++corrFactor){
66 if(corrFactor->first==level)
return (corrFactor-
jec_.begin());
74 if(!(level<
jec_.size())){
75 throw cms::Exception(
"InvalidRequest") <<
"You try to call a jet energy correction level wich does not exist. \n"
76 <<
"Available jet energy correction levels are: \n"
80 throw cms::Exception(
"InvalidRequest") <<
"You try to call a flavor dependent jet energy correction level: \n"
81 <<
"level : " << level <<
" label: " <<
jec_.at(level).first <<
" \n"
82 <<
"You need to specify one of the following flavors: GLUON, UDS, \n"
83 <<
"CHARM, BOTTOM. \n";
92 for(std::vector<CorrectionFactor>::const_iterator corrFactor=
jec_.begin(); corrFactor!=
jec_.end(); ++corrFactor){
93 std::stringstream idx; idx << (corrFactor-
jec_.begin());
94 labels.append(idx.str()).
append(
" ").append(corrFactor->first).append(
"\n");
99 std::vector<std::string>
102 std::vector<std::string>
labels;
103 for(std::vector<CorrectionFactor>::const_iterator corrFactor=
jec_.begin(); corrFactor!=
jec_.end(); ++corrFactor){
104 labels.push_back(corrFactor->first);
113 for(std::vector<CorrectionFactor>::const_iterator corrFactor=
jec_.begin(); corrFactor!=
jec_.end(); ++corrFactor){
114 unsigned int corrFactorIdx=corrFactor-
jec_.begin();
115 std::stringstream idx; idx << corrFactorIdx;
116 message << std::setw(3) << idx <<
" " << corrFactor->first;
118 for(std::vector<float>::const_iterator flavor=corrFactor->second.begin(); flavor!=corrFactor->second.end(); ++flavor){
119 unsigned int flavorIdx=flavor-corrFactor->second.begin();
float correction(unsigned int level, Flavor flavor=NONE) const
std::vector< std::string > correctionLabels() const
std::string jecLevel(const unsigned int &level) const
std::vector< CorrectionFactor > jec_
std::string correctionLabelString() const
bool isValid(const CorrectionFactor &jec) const
std::string jecFlavor(const Flavor &flavor) const
bool flavorDependent(unsigned int level) const