CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
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, UncertaintySinglePion =13, UncertaintyFlavor =14, UncertaintyTime =15,
  UncertaintyRelativeJEREC1 =16, UncertaintyRelativeJEREC2 =17, UncertaintyRelativeJERHF =18, UncertaintyRelativeStatEC2 =19,
  UncertaintyRelativeStatHF =20, UncertaintyRelativeFSR =21, UncertaintyPileUpDataMC =22, UncertaintyPileUpOOT =23,
  UncertaintyPileUpPt =24, UncertaintyPileUpBias =25, UncertaintyPileUpJetRate =26, N_LEVELS =27
}
 
typedef std::pair< key_type,
value_type
pair_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
 

Protected Attributes

collection_type corrections_
 
collection_type correctionsL5_
 
collection_type correctionsL7_
 

Static Protected Attributes

static const char * l5FlavorArray_ [N_L5_SPECIES]
 
static std::vector< std::string > l5Flavors_
 
static const char * l7PartonArray_ [N_L7_SPECIES]
 
static std::vector< std::string > l7Partons_
 
static std::vector< std::string > labels_
 
static const char * labelsArray_ [N_LEVELS]
 

Detailed Description

Definition at line 100 of file JetCorrectorParameters.h.

Member Typedef Documentation

Definition at line 142 of file JetCorrectorParameters.h.

Definition at line 138 of file JetCorrectorParameters.h.

Definition at line 139 of file JetCorrectorParameters.h.

Definition at line 141 of file JetCorrectorParameters.h.

Definition at line 140 of file JetCorrectorParameters.h.

Member Enumeration Documentation

Enumerator
L1Offset 
L1JPTOffset 
L1FastJet 
L2Relative 
L3Absolute 
L2L3Residual 
L4EMF 
L5Flavor 
L6UE 
L7Parton 
Uncertainty 
UncertaintyAbsolute 
UncertaintyHighPtExtra 
UncertaintySinglePion 
UncertaintyFlavor 
UncertaintyTime 
UncertaintyRelativeJEREC1 
UncertaintyRelativeJEREC2 
UncertaintyRelativeJERHF 
UncertaintyRelativeStatEC2 
UncertaintyRelativeStatHF 
UncertaintyRelativeFSR 
UncertaintyPileUpDataMC 
UncertaintyPileUpOOT 
UncertaintyPileUpPt 
UncertaintyPileUpBias 
UncertaintyPileUpJetRate 
N_LEVELS 

Definition at line 105 of file JetCorrectorParameters.h.

105  { L1Offset=0,
106  L1JPTOffset=7,
107  L1FastJet = 10,
108  L2Relative=1,
109  L3Absolute=2,
110  L2L3Residual=8,
111  L4EMF=3,
112  L5Flavor=4,
113  L6UE=5,
114  L7Parton=6,
115  Uncertainty=9,
119  UncertaintyFlavor=14,
120  UncertaintyTime=15,
132  N_LEVELS=27
133  };

Constructor & Destructor Documentation

JetCorrectorParametersCollection::JetCorrectorParametersCollection ( )
inline

Member Function Documentation

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

Definition at line 523 of file JetCorrectorParameters.cc.

References edm::hlt::Exception, spr::find(), and diffTwoXMLs::label.

Referenced by operator[]().

523  {
524 
525  // First check L5 corrections
526  std::vector<std::string>::const_iterator found1 =
527  find( l5Flavors_.begin(), l5Flavors_.end(), label );
528  if ( found1 != l5Flavors_.end() ) {
529  return getL5Bin(label);
530  }
531 
532  // Next check L7 corrections
533  std::vector<std::string>::const_iterator found2 =
534  find( l7Partons_.begin(), l7Partons_.end(), label );
535  if ( found2 != l7Partons_.end() ) {
536  return getL7Bin(label);
537  }
538 
539  // Finally check the default corrections
540  std::vector<std::string>::const_iterator found3 =
541  find( labels_.begin(), labels_.end(), label );
542  if ( found3 != labels_.end() ) {
543  return static_cast<key_type>(found3 - labels_.begin());
544  }
545 
546  // Didn't find default corrections, throw exception
547  throw cms::Exception("InvalidInput") << " Cannot find label " << label << std::endl;
548 
549 }
static std::vector< std::string > labels_
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:7
static std::vector< std::string > l7Partons_
static key_type getL7Bin(std::string const &flav)
static std::vector< std::string > l5Flavors_
static std::string JetCorrectorParametersCollection::findL5Flavor ( key_type  k)
inlinestatic

Definition at line 188 of file JetCorrectorParameters.h.

References L5Flavor, l5Flavors_, and labels_.

Referenced by findLabel().

188  {
189  if ( k == L5Flavor ) return labels_[L5Flavor];
190  else
191  return l5Flavors_[k / 100 - 1];
192  }
static std::vector< std::string > labels_
int k[5][pyjets_maxn]
static std::vector< std::string > l5Flavors_
static std::string JetCorrectorParametersCollection::findL7Parton ( key_type  k)
inlinestatic

Definition at line 194 of file JetCorrectorParameters.h.

References L7Parton, l7Partons_, and labels_.

Referenced by findLabel().

194  {
195  if ( k == L7Parton ) return labels_[L7Parton];
196  else
197  return l7Partons_[k / 1000 - 1];
198  }
static std::vector< std::string > labels_
static std::vector< std::string > l7Partons_
int k[5][pyjets_maxn]
static std::string JetCorrectorParametersCollection::findLabel ( key_type  k)
inlinestatic

Definition at line 182 of file JetCorrectorParameters.h.

References findL5Flavor(), findL7Parton(), isL5(), isL7(), gen::k, and labels_.

Referenced by JetCorrectorDBWriter::beginJob().

182  {
183  if ( isL5(k) ) return findL5Flavor(k);
184  else if ( isL7(k) ) return findL7Parton(k);
185  else return labels_[k];
186  }
static std::vector< std::string > labels_
static std::string findL7Parton(key_type k)
static std::string findL5Flavor(key_type k)
int k[5][pyjets_maxn]
JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL5Bin ( std::string const &  flav)
static

Definition at line 490 of file JetCorrectorParameters.cc.

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

490  {
491  std::vector<std::string>::const_iterator found =
492  find( l5Flavors_.begin(), l5Flavors_.end(), flav );
493  if ( found != l5Flavors_.end() ) {
494  return (found - l5Flavors_.begin() + 1) * 100;
495  }
496  else return L5Flavor;
497 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static std::vector< std::string > l5Flavors_
JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL7Bin ( std::string const &  flav)
static

Definition at line 500 of file JetCorrectorParameters.cc.

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

500  {
501  std::vector<std::string>::const_iterator found =
502  find( l7Partons_.begin(), l7Partons_.end(), flav );
503  if ( found != l7Partons_.end() ) {
504  return (found - l7Partons_.begin() + 1) * 1000;
505  }
506  else return L7Parton;
507 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static std::vector< std::string > l7Partons_
void JetCorrectorParametersCollection::getSections ( std::string  inputFile,
std::vector< std::string > &  outputs 
)
static

Definition at line 404 of file JetCorrectorParameters.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, insertMaterial::getSection(), recoMuon::in, LaserDQM_cfg::input, and results_mgr::tok.

Referenced by JetCorrectorDBWriter::beginJob().

406 {
407  outputs.clear();
408  std::ifstream input( inputFile.c_str() );
409  while( !input.eof() ) {
410  char buff[10000];
411  input.getline(buff,10000);
412  std::string in(buff);
413  if ( in[0] == '[' ) {
414  std::string tok = getSection(in);
415  if ( tok != "" ) {
416  outputs.push_back( tok );
417  }
418  }
419  }
420  std::cout << "Found these sections for file: " << std::endl;
421  copy(outputs.begin(),outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n") );
422 }
tuple cout
Definition: gather_cfg.py:121
bool JetCorrectorParametersCollection::isL5 ( key_type  k)
static

Definition at line 510 of file JetCorrectorParameters.cc.

Referenced by findLabel().

510  {
511  return k == L5Flavor ||
512  ( k / 100 > 0 && k / 1000 == 0 );
513 }
int k[5][pyjets_maxn]
bool JetCorrectorParametersCollection::isL7 ( key_type  k)
static

Definition at line 515 of file JetCorrectorParameters.cc.

Referenced by findLabel().

515  {
516  return k == L7Parton ||
517  ( k / 1000 > 0 );
518 }
int k[5][pyjets_maxn]
JetCorrectorParameters const & JetCorrectorParametersCollection::operator[] ( key_type  k) const

Definition at line 447 of file JetCorrectorParameters.cc.

References edm::hlt::Exception, i, and gen::k.

Referenced by operator[]().

447  {
448  collection_type::const_iterator ibegin, iend, i;
449  if ( isL5(k) ) {
450  ibegin = correctionsL5_.begin();
451  iend = correctionsL5_.end();
452  i = ibegin;
453  } else if ( isL7(k) ) {
454  ibegin = correctionsL7_.begin();
455  iend = correctionsL7_.end();
456  i = ibegin;
457  } else {
458  ibegin = corrections_.begin();
459  iend = corrections_.end();
460  i = ibegin;
461  }
462  for ( ; i != iend; ++i ) {
463  if ( k == i->first ) return i->second;
464  }
465  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
466  << " in the JEC payload, this usually means you have to change the global tag" << std::endl;
467 }
int i
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
JetCorrectorParameters const& JetCorrectorParametersCollection::operator[] ( std::string const &  label) const
inline

Definition at line 158 of file JetCorrectorParameters.h.

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

158  {
159  return operator[]( findKey(label) );
160  }
key_type findKey(std::string const &label) const
JetCorrectorParameters const & operator[](key_type k) const
void JetCorrectorParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  flav = "" 
)

Definition at line 426 of file JetCorrectorParameters.cc.

References gather_cfg::cout, and pair_type.

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

426  {
427  std::cout << "i = " << i << std::endl;
428  std::cout << "flav = " << flav << std::endl;
429  if ( isL5(i) ) {
430  std::cout << "This is L5, getL5Bin = " << getL5Bin(flav) << std::endl;
431  correctionsL5_.push_back( pair_type(getL5Bin(flav),j) );
432  }
433  else if ( isL7(i) ) {
434  std::cout << "This is L7, getL7Bin = " << getL7Bin(flav) << std::endl;
435  correctionsL7_.push_back( pair_type(getL7Bin(flav),j) );
436  }
437  else if ( flav == "" ) {
438  corrections_.push_back( pair_type(i,j) );
439  } else {
440  std::cout << "***** NOT ADDING " << flav << ", corresponding position in JetCorrectorParameters is not found." << std::endl;
441  }
442 }
int i
Definition: DBlmapReader.cc:9
std::pair< key_type, value_type > pair_type
static key_type getL5Bin(std::string const &flav)
int j
Definition: DBlmapReader.cc:9
static key_type getL7Bin(std::string const &flav)
tuple cout
Definition: gather_cfg.py:121
void JetCorrectorParametersCollection::validKeys ( std::vector< key_type > &  keys) const

Definition at line 471 of file JetCorrectorParameters.cc.

References i.

471  {
472  keys.clear();
473  for ( collection_type::const_iterator ibegin = corrections_.begin(),
474  iend = corrections_.end(), i = ibegin; i != iend; ++i ) {
475  keys.push_back( i->first );
476  }
477  for ( collection_type::const_iterator ibegin = correctionsL5_.begin(),
478  iend = correctionsL5_.end(), i = ibegin; i != iend; ++i ) {
479  keys.push_back( i->first );
480  }
481  for ( collection_type::const_iterator ibegin = correctionsL7_.begin(),
482  iend = correctionsL7_.end(), i = ibegin; i != iend; ++i ) {
483  keys.push_back( i->first );
484  }
485 }
int i
Definition: DBlmapReader.cc:9

Member Data Documentation

collection_type JetCorrectorParametersCollection::corrections_
protected

Definition at line 205 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

collection_type JetCorrectorParametersCollection::correctionsL5_
protected

Definition at line 206 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

collection_type JetCorrectorParametersCollection::correctionsL7_
protected

Definition at line 207 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

const char * JetCorrectorParametersCollection::l5FlavorArray_
staticprotected
Initial value:
=
{
"L5Flavor_bJ",
"L5Flavor_cJ",
"L5Flavor_qJ",
"L5Flavor_gJ",
"L5Flavor_bT",
"L5Flavor_cT",
"L5Flavor_qT",
"L5Flavor_gT"
}

Definition at line 211 of file JetCorrectorParameters.h.

std::vector< std::string > JetCorrectorParametersCollection::l5Flavors_
staticprotected

Definition at line 212 of file JetCorrectorParameters.h.

Referenced by findL5Flavor().

const char * JetCorrectorParametersCollection::l7PartonArray_
staticprotected
Initial value:
=
{
"L7Parton_gJ",
"L7Parton_qJ",
"L7Parton_cJ",
"L7Parton_bJ",
"L7Parton_jJ",
"L7Parton_qT",
"L7Parton_cT",
"L7Parton_bT",
"L7Parton_tT"
}

Definition at line 214 of file JetCorrectorParameters.h.

std::vector< std::string > JetCorrectorParametersCollection::l7Partons_
staticprotected

Definition at line 215 of file JetCorrectorParameters.h.

Referenced by findL7Parton().

std::vector< std::string > JetCorrectorParametersCollection::labels_
staticprotected

Definition at line 209 of file JetCorrectorParameters.h.

Referenced by findL5Flavor(), findL7Parton(), and findLabel().

const char * JetCorrectorParametersCollection::labelsArray_
staticprotected
Initial value:
=
{
"L1Offset",
"L2Relative",
"L3Absolute",
"L4EMF",
"L5Flavor",
"L6UE",
"L7Parton",
"L1JPTOffset",
"L2L3Residual",
"Uncertainty",
"L1FastJet",
"UncertaintyAbsolute",
"UncertaintyHighPtExtra",
"UncertaintySinglePion",
"UncertaintyFlavor",
"UncertaintyTime",
"UncertaintyRelativeJEREC1",
"UncertaintyRelativeJEREC2",
"UncertaintyRelativeJERHF",
"UncertaintyRelativeStatEC2",
"UncertaintyRelativeStatHF",
"UncertaintyRelativeFSR",
"UncertaintyPileUpDataMC",
"UncertaintyPileUpOOT",
"UncertaintyPileUpPt",
"UncertaintyPileUpBias",
"UncertaintyPileUpJetRate"
}

Definition at line 208 of file JetCorrectorParameters.h.