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, 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, UncertaintyAux1 =34, UncertaintyAux2 =35,
  UncertaintyAux3 =36, UncertaintyAux4 =37, N_LEVELS =38
}
 
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 155 of file JetCorrectorParameters.h.

Definition at line 151 of file JetCorrectorParameters.h.

Definition at line 152 of file JetCorrectorParameters.h.

Definition at line 154 of file JetCorrectorParameters.h.

Definition at line 153 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 
UncertaintyAux1 
UncertaintyAux2 
UncertaintyAux3 
UncertaintyAux4 
N_LEVELS 

Definition at line 107 of file JetCorrectorParameters.h.

107  { L1Offset=0,
108  L1JPTOffset=7,
109  L1FastJet = 10,
110  L2Relative=1,
111  L3Absolute=2,
112  L2L3Residual=8,
113  L4EMF=3,
114  L5Flavor=4,
115  L6UE=5,
116  L7Parton=6,
117  Uncertainty=9,
122  UncertaintyFlavor=14,
123  UncertaintyTime=15,
141  UncertaintyAux1=34,
142  UncertaintyAux2=35,
143  UncertaintyAux3=36,
144  UncertaintyAux4=37,
145  N_LEVELS=38
146  };

Constructor & Destructor Documentation

JetCorrectorParametersCollection::JetCorrectorParametersCollection ( )
inline

Member Function Documentation

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

Definition at line 534 of file JetCorrectorParameters.cc.

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

Referenced by operator[]().

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

References L5Flavor, l5Flavors_, and labels_.

Referenced by findLabel().

201  {
202  if ( k == L5Flavor ) return labels_[L5Flavor];
203  else
204  return l5Flavors_[k / 100 - 1];
205  }
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 207 of file JetCorrectorParameters.h.

References L7Parton, l7Partons_, and labels_.

Referenced by findLabel().

207  {
208  if ( k == L7Parton ) return labels_[L7Parton];
209  else
210  return l7Partons_[k / 1000 - 1];
211  }
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 195 of file JetCorrectorParameters.h.

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

Referenced by JetCorrectorDBWriter::beginJob().

195  {
196  if ( isL5(k) ) return findL5Flavor(k);
197  else if ( isL7(k) ) return findL7Parton(k);
198  else return labels_[k];
199  }
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 501 of file JetCorrectorParameters.cc.

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

501  {
502  std::vector<std::string>::const_iterator found =
503  find( l5Flavors_.begin(), l5Flavors_.end(), flav );
504  if ( found != l5Flavors_.end() ) {
505  return (found - l5Flavors_.begin() + 1) * 100;
506  }
507  else return L5Flavor;
508 }
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 511 of file JetCorrectorParameters.cc.

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

511  {
512  std::vector<std::string>::const_iterator found =
513  find( l7Partons_.begin(), l7Partons_.end(), flav );
514  if ( found != l7Partons_.end() ) {
515  return (found - l7Partons_.begin() + 1) * 1000;
516  }
517  else return L7Parton;
518 }
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 415 of file JetCorrectorParameters.cc.

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

Referenced by JetCorrectorDBWriter::beginJob().

417 {
418  outputs.clear();
419  std::ifstream input( inputFile.c_str() );
420  while( !input.eof() ) {
421  char buff[10000];
422  input.getline(buff,10000);
423  std::string in(buff);
424  if ( in[0] == '[' ) {
426  if ( tok != "" ) {
427  outputs.push_back( tok );
428  }
429  }
430  }
431  std::cout << "Found these sections for file: " << std::endl;
432  copy(outputs.begin(),outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n") );
433 }
tuple cout
Definition: gather_cfg.py:121
bool JetCorrectorParametersCollection::isL5 ( key_type  k)
static

Definition at line 521 of file JetCorrectorParameters.cc.

Referenced by findLabel().

521  {
522  return k == L5Flavor ||
523  ( k / 100 > 0 && k / 1000 == 0 );
524 }
int k[5][pyjets_maxn]
bool JetCorrectorParametersCollection::isL7 ( key_type  k)
static

Definition at line 526 of file JetCorrectorParameters.cc.

Referenced by findLabel().

526  {
527  return k == L7Parton ||
528  ( k / 1000 > 0 );
529 }
int k[5][pyjets_maxn]
JetCorrectorParameters const & JetCorrectorParametersCollection::operator[] ( key_type  k) const

Definition at line 458 of file JetCorrectorParameters.cc.

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

Referenced by operator[]().

458  {
459  collection_type::const_iterator ibegin, iend, i;
460  if ( isL5(k) ) {
461  ibegin = correctionsL5_.begin();
462  iend = correctionsL5_.end();
463  i = ibegin;
464  } else if ( isL7(k) ) {
465  ibegin = correctionsL7_.begin();
466  iend = correctionsL7_.end();
467  i = ibegin;
468  } else {
469  ibegin = corrections_.begin();
470  iend = corrections_.end();
471  i = ibegin;
472  }
473  for ( ; i != iend; ++i ) {
474  if ( k == i->first ) return i->second;
475  }
476  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
477  << " in the JEC payload, this usually means you have to change the global tag" << std::endl;
478 }
int i
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
JetCorrectorParameters const& JetCorrectorParametersCollection::operator[] ( std::string const &  label) const
inline

Definition at line 171 of file JetCorrectorParameters.h.

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

171  {
172  return operator[]( findKey(label) );
173  }
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 437 of file JetCorrectorParameters.cc.

References gather_cfg::cout, and pair_type.

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

437  {
438  std::cout << "i = " << i << std::endl;
439  std::cout << "flav = " << flav << std::endl;
440  if ( isL5(i) ) {
441  std::cout << "This is L5, getL5Bin = " << getL5Bin(flav) << std::endl;
442  correctionsL5_.push_back( pair_type(getL5Bin(flav),j) );
443  }
444  else if ( isL7(i) ) {
445  std::cout << "This is L7, getL7Bin = " << getL7Bin(flav) << std::endl;
446  correctionsL7_.push_back( pair_type(getL7Bin(flav),j) );
447  }
448  else if ( flav == "" ) {
449  corrections_.push_back( pair_type(i,j) );
450  } else {
451  std::cout << "***** NOT ADDING " << flav << ", corresponding position in JetCorrectorParameters is not found." << std::endl;
452  }
453 }
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 482 of file JetCorrectorParameters.cc.

References i.

482  {
483  keys.clear();
484  for ( collection_type::const_iterator ibegin = corrections_.begin(),
485  iend = corrections_.end(), i = ibegin; i != iend; ++i ) {
486  keys.push_back( i->first );
487  }
488  for ( collection_type::const_iterator ibegin = correctionsL5_.begin(),
489  iend = correctionsL5_.end(), i = ibegin; i != iend; ++i ) {
490  keys.push_back( i->first );
491  }
492  for ( collection_type::const_iterator ibegin = correctionsL7_.begin(),
493  iend = correctionsL7_.end(), i = ibegin; i != iend; ++i ) {
494  keys.push_back( i->first );
495  }
496 }
int i
Definition: DBlmapReader.cc:9

Member Data Documentation

collection_type JetCorrectorParametersCollection::corrections_
protected

Definition at line 218 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

collection_type JetCorrectorParametersCollection::correctionsL5_
protected

Definition at line 219 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

collection_type JetCorrectorParametersCollection::correctionsL7_
protected

Definition at line 220 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 224 of file JetCorrectorParameters.h.

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

Definition at line 225 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 227 of file JetCorrectorParameters.h.

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

Definition at line 228 of file JetCorrectorParameters.h.

Referenced by findL7Parton().

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

Definition at line 222 of file JetCorrectorParameters.h.

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

const char * JetCorrectorParametersCollection::labelsArray_
staticprotected

Definition at line 221 of file JetCorrectorParameters.h.