CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
JetCorrectorParametersCollection Class Reference

#include <JetCorrectorParameters.h>

Public Types

typedef std::vector< pair_typecollection_type
 
typedef int key_type
 
enum  L5_Species_t {
  L5_bJ = 0, L5_cJ, L5_qJ, L5_gJ,
  L5_bT, L5_cT, L5_qT, L5_gT,
  N_L5_SPECIES
}
 
enum  L7_Species_t {
  L7_gJ = 0, L7_qJ, L7_cJ, L7_bJ,
  L7_jJ, L7_qT, L7_cT, L7_bT,
  L7_jT, N_L7_SPECIES
}
 
typedef std::string label_type
 
enum  Level_t {
  L1Offset = 0, L1JPTOffset = 7, L1FastJet = 10, L2Relative = 1,
  L3Absolute = 2, L2L3Residual = 8, L4EMF = 3, L5Flavor = 4,
  L6UE = 5, L7Parton = 6, Uncertainty = 9, UncertaintyAbsolute = 11,
  UncertaintyHighPtExtra = 12, UncertaintySinglePionECAL = 13, UncertaintySinglePionHCAL = 27, UncertaintyFlavor = 14,
  UncertaintyTime = 15, UncertaintyRelativeJEREC1 = 16, UncertaintyRelativeJEREC2 = 17, UncertaintyRelativeJERHF = 18,
  UncertaintyRelativePtEC1 = 28, UncertaintyRelativePtEC2 = 29, UncertaintyRelativePtHF = 30, UncertaintyRelativeStatEC2 = 19,
  UncertaintyRelativeStatHF = 20, UncertaintyRelativeFSR = 21, UncertaintyRelativeSample = 31, UncertaintyPileUpDataMC = 22,
  UncertaintyPileUpOOT = 23, UncertaintyPileUpPtBB = 24, UncertaintyPileUpPtEC = 32, UncertaintyPileUpPtHF = 33,
  UncertaintyPileUpBias = 25, UncertaintyPileUpJetRate = 26, L1RC = 34, L1Residual = 35,
  UncertaintyAux3 = 36, UncertaintyAux4 = 37, N_LEVELS = 38
}
 
typedef std::pair< key_type, value_typepair_type
 
typedef JetCorrectorParameters value_type
 

Public Member Functions

 JetCorrectorParametersCollection ()
 
JetCorrectorParameters const & operator[] (key_type k) const
 
JetCorrectorParameters const & operator[] (std::string const &label) const
 
void push_back (key_type i, value_type const &j, label_type const &flav="")
 
void validKeys (std::vector< key_type > &keys) const
 

Static Public Member Functions

static std::string findL5Flavor (key_type k)
 
static std::string findL7Parton (key_type k)
 
static std::string findLabel (key_type k)
 
static key_type getL5Bin (std::string const &flav)
 
static key_type getL7Bin (std::string const &flav)
 
static void getSections (std::string inputFile, std::vector< std::string > &outputs)
 
static bool isL5 (key_type k)
 
static bool isL7 (key_type k)
 

Protected Member Functions

key_type findKey (std::string const &label) const
 
collection_typegetCorrections ()
 
collection_typegetCorrectionsL5 ()
 
collection_typegetCorrectionsL7 ()
 

Protected Attributes

collection_type corrections_
 
collection_type correctionsL5_
 
collection_type correctionsL7_
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 
struct JetCorrectorParametersInitializeTransients
 

Detailed Description

Definition at line 139 of file JetCorrectorParameters.h.

Member Typedef Documentation

Definition at line 194 of file JetCorrectorParameters.h.

Definition at line 190 of file JetCorrectorParameters.h.

Definition at line 191 of file JetCorrectorParameters.h.

Definition at line 193 of file JetCorrectorParameters.h.

Definition at line 192 of file JetCorrectorParameters.h.

Member Enumeration Documentation

Enumerator
L1Offset 
L1JPTOffset 
L1FastJet 
L2Relative 
L3Absolute 
L2L3Residual 
L4EMF 
L5Flavor 
L6UE 
L7Parton 
Uncertainty 
UncertaintyAbsolute 
UncertaintyHighPtExtra 
UncertaintySinglePionECAL 
UncertaintySinglePionHCAL 
UncertaintyFlavor 
UncertaintyTime 
UncertaintyRelativeJEREC1 
UncertaintyRelativeJEREC2 
UncertaintyRelativeJERHF 
UncertaintyRelativePtEC1 
UncertaintyRelativePtEC2 
UncertaintyRelativePtHF 
UncertaintyRelativeStatEC2 
UncertaintyRelativeStatHF 
UncertaintyRelativeFSR 
UncertaintyRelativeSample 
UncertaintyPileUpDataMC 
UncertaintyPileUpOOT 
UncertaintyPileUpPtBB 
UncertaintyPileUpPtEC 
UncertaintyPileUpPtHF 
UncertaintyPileUpBias 
UncertaintyPileUpJetRate 
L1RC 
L1Residual 
UncertaintyAux3 
UncertaintyAux4 
N_LEVELS 

Definition at line 146 of file JetCorrectorParameters.h.

146  {
147  L1Offset = 0,
148  L1JPTOffset = 7,
149  L1FastJet = 10,
150  L2Relative = 1,
151  L3Absolute = 2,
152  L2L3Residual = 8,
153  L4EMF = 3,
154  L5Flavor = 4,
155  L6UE = 5,
156  L7Parton = 6,
157  Uncertainty = 9,
158  UncertaintyAbsolute = 11,
162  UncertaintyFlavor = 14,
163  UncertaintyTime = 15,
181  L1RC = 34,
182  L1Residual = 35,
183  UncertaintyAux3 = 36,
184  UncertaintyAux4 = 37,
185  N_LEVELS = 38
186  };

Constructor & Destructor Documentation

JetCorrectorParametersCollection::JetCorrectorParametersCollection ( )
inline

Definition at line 197 of file JetCorrectorParameters.h.

References mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, and operator[]().

197  {
198  corrections_.clear();
199  correctionsL5_.clear();
200  correctionsL7_.clear();
201  }

Member Function Documentation

JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::findKey ( std::string const &  label) const
protected

Definition at line 531 of file JetCorrectorParameters.cc.

References Exception, spr::find(), and label.

531  {
532  // First check L5 corrections
533  std::vector<std::string>::const_iterator found1 = find(l5Flavors_.begin(), l5Flavors_.end(), label);
534  if (found1 != l5Flavors_.end()) {
535  return getL5Bin(label);
536  }
537 
538  // Next check L7 corrections
539  std::vector<std::string>::const_iterator found2 = find(l7Partons_.begin(), l7Partons_.end(), label);
540  if (found2 != l7Partons_.end()) {
541  return getL7Bin(label);
542  }
543 
544  // Finally check the default corrections
545  std::vector<std::string>::const_iterator found3 = find(labels_.begin(), labels_.end(), label);
546  if (found3 != labels_.end()) {
547  return static_cast<key_type>(found3 - labels_.begin());
548  }
549 
550  // Didn't find default corrections, throw exception
551  throw cms::Exception("InvalidInput") << " Cannot find label " << label << std::endl;
552 }
static key_type getL5Bin(std::string const &flav)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
char const * label
static key_type getL7Bin(std::string const &flav)
std::string JetCorrectorParametersCollection::findL5Flavor ( key_type  k)
static

Definition at line 412 of file JetCorrectorParameters.cc.

412  {
413  if (k == L5Flavor)
414  return labels_[L5Flavor];
415  else
416  return l5Flavors_[k / 100 - 1];
417 }
std::string JetCorrectorParametersCollection::findL7Parton ( key_type  k)
static

Definition at line 419 of file JetCorrectorParameters.cc.

419  {
420  if (k == L7Parton)
421  return labels_[L7Parton];
422  else
423  return l7Partons_[k / 1000 - 1];
424 }
std::string JetCorrectorParametersCollection::findLabel ( key_type  k)
static

Definition at line 403 of file JetCorrectorParameters.cc.

References dqmdumpme::k.

Referenced by JetCorrectorDBReader::analyze(), and JetCorrectorDBWriter::beginJob().

403  {
404  if (isL5(k))
405  return findL5Flavor(k);
406  else if (isL7(k))
407  return findL7Parton(k);
408  else
409  return labels_[k];
410 }
static std::string findL5Flavor(key_type k)
static std::string findL7Parton(key_type k)
collection_type& JetCorrectorParametersCollection::getCorrections ( )
inlineprotected
collection_type& JetCorrectorParametersCollection::getCorrectionsL5 ( )
inlineprotected
collection_type& JetCorrectorParametersCollection::getCorrectionsL7 ( )
inlineprotected
JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL5Bin ( std::string const &  flav)
static

Definition at line 509 of file JetCorrectorParameters.cc.

References spr::find(), and newFWLiteAna::found.

509  {
510  std::vector<std::string>::const_iterator found = find(l5Flavors_.begin(), l5Flavors_.end(), flav);
511  if (found != l5Flavors_.end()) {
512  return (found - l5Flavors_.begin() + 1) * 100;
513  } else
514  return L5Flavor;
515 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL7Bin ( std::string const &  flav)
static

Definition at line 517 of file JetCorrectorParameters.cc.

References spr::find(), and newFWLiteAna::found.

517  {
518  std::vector<std::string>::const_iterator found = find(l7Partons_.begin(), l7Partons_.end(), flav);
519  if (found != l7Partons_.end()) {
520  return (found - l7Partons_.begin() + 1) * 1000;
521  } else
522  return L7Parton;
523 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void JetCorrectorParametersCollection::getSections ( std::string  inputFile,
std::vector< std::string > &  outputs 
)
static

Definition at line 426 of file JetCorrectorParameters.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, recoMuon::in, input, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by JetCorrectorDBWriter::beginJob().

426  {
427  outputs.clear();
428  std::ifstream input(inputFile.c_str());
429  while (!input.eof()) {
430  char buff[10000];
431  input.getline(buff, 10000);
432  std::string in(buff);
433  if (in[0] == '[') {
434  std::string tok = getSection(in);
435  if (!tok.empty()) {
436  outputs.push_back(tok);
437  }
438  }
439  }
440  std::cout << "Found these sections for file: " << std::endl;
441  copy(outputs.begin(), outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
442 }
static std::string const input
Definition: EdmProvDump.cc:48
bool JetCorrectorParametersCollection::isL5 ( key_type  k)
static

Definition at line 526 of file JetCorrectorParameters.cc.

526 { return k == L5Flavor || (k / 100 > 0 && k / 1000 == 0); }
bool JetCorrectorParametersCollection::isL7 ( key_type  k)
static

Definition at line 528 of file JetCorrectorParameters.cc.

JetCorrectorParameters const & JetCorrectorParametersCollection::operator[] ( key_type  k) const

Definition at line 464 of file JetCorrectorParameters.cc.

References Exception, mps_fire::i, and dqmdumpme::k.

464  {
465  collection_type::const_iterator ibegin, iend, i;
466  if (isL5(k)) {
467  ibegin = correctionsL5_.begin();
468  iend = correctionsL5_.end();
469  i = ibegin;
470  } else if (isL7(k)) {
471  ibegin = correctionsL7_.begin();
472  iend = correctionsL7_.end();
473  i = ibegin;
474  } else {
475  ibegin = corrections_.begin();
476  iend = corrections_.end();
477  i = ibegin;
478  }
479  for (; i != iend; ++i) {
480  if (k == i->first)
481  return i->second;
482  }
483  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
484  << " in the JEC payload, this usually means you have to change the global tag"
485  << std::endl;
486 }
JetCorrectorParameters const& JetCorrectorParametersCollection::operator[] ( std::string const &  label) const
inline
void JetCorrectorParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  flav = "" 
)

Definition at line 445 of file JetCorrectorParameters.cc.

References gather_cfg::cout, and pair_type.

Referenced by FFTJetCorrectionProducer::applyCorrections(), JetCorrectorDBWriter::beginJob(), pat::TauJetCorrFactorsProducer::params(), and pat::JetCorrFactorsProducer::params().

445  {
446  std::cout << "i = " << i << std::endl;
447  std::cout << "flav = " << flav << std::endl;
448  if (isL5(i)) {
449  std::cout << "This is L5, getL5Bin = " << getL5Bin(flav) << std::endl;
450  correctionsL5_.push_back(pair_type(getL5Bin(flav), j));
451  } else if (isL7(i)) {
452  std::cout << "This is L7, getL7Bin = " << getL7Bin(flav) << std::endl;
453  correctionsL7_.push_back(pair_type(getL7Bin(flav), j));
454  } else if (flav.empty()) {
455  corrections_.push_back(pair_type(i, j));
456  } else {
457  std::cout << "***** NOT ADDING " << flav << ", corresponding position in JetCorrectorParameters is not found."
458  << std::endl;
459  }
460 }
static key_type getL5Bin(std::string const &flav)
std::pair< key_type, value_type > pair_type
static key_type getL7Bin(std::string const &flav)
template<class Archive >
void JetCorrectorParametersCollection::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void JetCorrectorParametersCollection::validKeys ( std::vector< key_type > &  keys) const

Definition at line 490 of file JetCorrectorParameters.cc.

References mps_fire::i.

Referenced by JetCorrectorDBReader::analyze().

490  {
491  keys.clear();
492  for (collection_type::const_iterator ibegin = corrections_.begin(), iend = corrections_.end(), i = ibegin; i != iend;
493  ++i) {
494  keys.push_back(i->first);
495  }
496  for (collection_type::const_iterator ibegin = correctionsL5_.begin(), iend = correctionsL5_.end(), i = ibegin;
497  i != iend;
498  ++i) {
499  keys.push_back(i->first);
500  }
501  for (collection_type::const_iterator ibegin = correctionsL7_.begin(), iend = correctionsL7_.end(), i = ibegin;
502  i != iend;
503  ++i) {
504  keys.push_back(i->first);
505  }
506 }

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 250 of file JetCorrectorParameters.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 250 of file JetCorrectorParameters.h.

Definition at line 248 of file JetCorrectorParameters.h.

Member Data Documentation

collection_type JetCorrectorParametersCollection::corrections_
protected

Definition at line 240 of file JetCorrectorParameters.h.

collection_type JetCorrectorParametersCollection::correctionsL5_
protected

Definition at line 241 of file JetCorrectorParameters.h.

collection_type JetCorrectorParametersCollection::correctionsL7_
protected

Definition at line 242 of file JetCorrectorParameters.h.