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 148 of file JetCorrectorParameters.h.

Member Typedef Documentation

◆ collection_type

Definition at line 203 of file JetCorrectorParameters.h.

◆ key_type

Definition at line 199 of file JetCorrectorParameters.h.

◆ label_type

Definition at line 200 of file JetCorrectorParameters.h.

◆ pair_type

Definition at line 202 of file JetCorrectorParameters.h.

◆ value_type

Definition at line 201 of file JetCorrectorParameters.h.

Member Enumeration Documentation

◆ L5_Species_t

◆ L7_Species_t

◆ Level_t

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 155 of file JetCorrectorParameters.h.

155  {
156  L1Offset = 0,
157  L1JPTOffset = 7,
158  L1FastJet = 10,
159  L2Relative = 1,
160  L3Absolute = 2,
161  L2L3Residual = 8,
162  L4EMF = 3,
163  L5Flavor = 4,
164  L6UE = 5,
165  L7Parton = 6,
166  Uncertainty = 9,
167  UncertaintyAbsolute = 11,
171  UncertaintyFlavor = 14,
172  UncertaintyTime = 15,
190  L1RC = 34,
191  L1Residual = 35,
192  UncertaintyAux3 = 36,
193  UncertaintyAux4 = 37,
194  N_LEVELS = 38
195  };

Constructor & Destructor Documentation

◆ JetCorrectorParametersCollection()

JetCorrectorParametersCollection::JetCorrectorParametersCollection ( )
inline

Definition at line 206 of file JetCorrectorParameters.h.

References corrections_, correctionsL5_, and correctionsL7_.

206  {
207  corrections_.clear();
208  correctionsL5_.clear();
209  correctionsL7_.clear();
210  }

Member Function Documentation

◆ findKey()

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

Definition at line 533 of file JetCorrectorParameters.cc.

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

Referenced by operator[]().

533  {
534  // First check L5 corrections
535  std::vector<std::string>::const_iterator found1 = find(l5Flavors_.begin(), l5Flavors_.end(), label);
536  if (found1 != l5Flavors_.end()) {
537  return getL5Bin(label);
538  }
539 
540  // Next check L7 corrections
541  std::vector<std::string>::const_iterator found2 = find(l7Partons_.begin(), l7Partons_.end(), label);
542  if (found2 != l7Partons_.end()) {
543  return getL7Bin(label);
544  }
545 
546  // Finally check the default corrections
547  std::vector<std::string>::const_iterator found3 = find(labels_.begin(), labels_.end(), label);
548  if (found3 != labels_.end()) {
549  return static_cast<key_type>(found3 - labels_.begin());
550  }
551 
552  // Didn't find default corrections, throw exception
553  throw cms::Exception("InvalidInput") << " Cannot find label " << label << std::endl;
554 }
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)

◆ findL5Flavor()

std::string JetCorrectorParametersCollection::findL5Flavor ( key_type  k)
static

Definition at line 414 of file JetCorrectorParameters.cc.

References dqmdumpme::k.

414  {
415  if (k == L5Flavor)
416  return labels_[L5Flavor];
417  else
418  return l5Flavors_[k / 100 - 1];
419 }

◆ findL7Parton()

std::string JetCorrectorParametersCollection::findL7Parton ( key_type  k)
static

Definition at line 421 of file JetCorrectorParameters.cc.

References dqmdumpme::k.

421  {
422  if (k == L7Parton)
423  return labels_[L7Parton];
424  else
425  return l7Partons_[k / 1000 - 1];
426 }

◆ findLabel()

std::string JetCorrectorParametersCollection::findLabel ( key_type  k)
static

Definition at line 405 of file JetCorrectorParameters.cc.

References dqmdumpme::k.

Referenced by JetCorrectorDBWriter::beginJob().

405  {
406  if (isL5(k))
407  return findL5Flavor(k);
408  else if (isL7(k))
409  return findL7Parton(k);
410  else
411  return labels_[k];
412 }
static std::string findL5Flavor(key_type k)
static std::string findL7Parton(key_type k)

◆ getCorrections()

collection_type& JetCorrectorParametersCollection::getCorrections ( )
inlineprotected

◆ getCorrectionsL5()

collection_type& JetCorrectorParametersCollection::getCorrectionsL5 ( )
inlineprotected

◆ getCorrectionsL7()

collection_type& JetCorrectorParametersCollection::getCorrectionsL7 ( )
inlineprotected

◆ getL5Bin()

JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL5Bin ( std::string const &  flav)
static

Definition at line 511 of file JetCorrectorParameters.cc.

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

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

◆ getL7Bin()

JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL7Bin ( std::string const &  flav)
static

Definition at line 519 of file JetCorrectorParameters.cc.

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

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

◆ getSections()

void JetCorrectorParametersCollection::getSections ( std::string  inputFile,
std::vector< std::string > &  outputs 
)
static

Definition at line 428 of file JetCorrectorParameters.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, recoMuon::in, input, dtResolutionTest_cfi::inputFile, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by JetCorrectorDBWriter::beginJob().

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

◆ isL5()

bool JetCorrectorParametersCollection::isL5 ( key_type  k)
static

Definition at line 528 of file JetCorrectorParameters.cc.

References dqmdumpme::k.

528 { return k == L5Flavor || (k / 100 > 0 && k / 1000 == 0); }

◆ isL7()

bool JetCorrectorParametersCollection::isL7 ( key_type  k)
static

Definition at line 530 of file JetCorrectorParameters.cc.

References dqmdumpme::k.

◆ operator[]() [1/2]

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

Definition at line 466 of file JetCorrectorParameters.cc.

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

466  {
467  collection_type::const_iterator ibegin, iend, i;
468  if (isL5(k)) {
469  ibegin = correctionsL5_.begin();
470  iend = correctionsL5_.end();
471  i = ibegin;
472  } else if (isL7(k)) {
473  ibegin = correctionsL7_.begin();
474  iend = correctionsL7_.end();
475  i = ibegin;
476  } else {
477  ibegin = corrections_.begin();
478  iend = corrections_.end();
479  i = ibegin;
480  }
481  for (; i != iend; ++i) {
482  if (k == i->first)
483  return i->second;
484  }
485  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
486  << " in the JEC payload, this usually means you have to change the global tag"
487  << std::endl;
488 }

◆ operator[]() [2/2]

JetCorrectorParameters const& JetCorrectorParametersCollection::operator[] ( std::string const &  label) const
inline

Definition at line 222 of file JetCorrectorParameters.h.

References findKey(), label, and operator[]().

Referenced by operator[]().

222 { return operator[](findKey(label)); }
JetCorrectorParameters const & operator[](key_type k) const
char const * label
key_type findKey(std::string const &label) const

◆ push_back()

void JetCorrectorParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  flav = "" 
)

Definition at line 447 of file JetCorrectorParameters.cc.

References gather_cfg::cout, mps_fire::i, and dqmiolumiharvest::j.

Referenced by pat::TauJetCorrFactorsProducer::params().

447  {
448  std::cout << "i = " << i << std::endl;
449  std::cout << "flav = " << flav << std::endl;
450  if (isL5(i)) {
451  std::cout << "This is L5, getL5Bin = " << getL5Bin(flav) << std::endl;
452  correctionsL5_.push_back(pair_type(getL5Bin(flav), j));
453  } else if (isL7(i)) {
454  std::cout << "This is L7, getL7Bin = " << getL7Bin(flav) << std::endl;
455  correctionsL7_.push_back(pair_type(getL7Bin(flav), j));
456  } else if (flav.empty()) {
457  corrections_.push_back(pair_type(i, j));
458  } else {
459  std::cout << "***** NOT ADDING " << flav << ", corresponding position in JetCorrectorParameters is not found."
460  << std::endl;
461  }
462 }
static key_type getL5Bin(std::string const &flav)
std::pair< key_type, value_type > pair_type
static key_type getL7Bin(std::string const &flav)

◆ serialize()

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

◆ validKeys()

void JetCorrectorParametersCollection::validKeys ( std::vector< key_type > &  keys) const

Definition at line 492 of file JetCorrectorParameters.cc.

References mps_fire::i, and relativeConstraints::keys.

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

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 259 of file JetCorrectorParameters.h.

◆ cond::serialization::access

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

Definition at line 259 of file JetCorrectorParameters.h.

◆ JetCorrectorParametersInitializeTransients

Definition at line 257 of file JetCorrectorParameters.h.

Member Data Documentation

◆ corrections_

collection_type JetCorrectorParametersCollection::corrections_
protected

Definition at line 249 of file JetCorrectorParameters.h.

Referenced by getCorrections(), and JetCorrectorParametersCollection().

◆ correctionsL5_

collection_type JetCorrectorParametersCollection::correctionsL5_
protected

Definition at line 250 of file JetCorrectorParameters.h.

Referenced by getCorrectionsL5(), and JetCorrectorParametersCollection().

◆ correctionsL7_

collection_type JetCorrectorParametersCollection::correctionsL7_
protected

Definition at line 251 of file JetCorrectorParameters.h.

Referenced by getCorrectionsL7(), and JetCorrectorParametersCollection().