CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

JetCorrectorParametersCollection Class Reference

#include <JetCorrectorParameters.h>

List of all members.

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, N_LEVELS = 11
}
typedef std::pair< key_type,
value_type
pair_type
typedef JetCorrectorParameters value_type

Public Member Functions

 JetCorrectorParametersCollection ()
JetCorrectorParameters const & operator[] (std::string const &label) const
JetCorrectorParameters const & operator[] (key_type k) 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 126 of file JetCorrectorParameters.h.

Definition at line 122 of file JetCorrectorParameters.h.

Definition at line 123 of file JetCorrectorParameters.h.

Definition at line 125 of file JetCorrectorParameters.h.

Definition at line 124 of file JetCorrectorParameters.h.


Member Enumeration Documentation

Enumerator:
L5_bJ 
L5_cJ 
L5_qJ 
L5_gJ 
L5_bT 
L5_cT 
L5_qT 
L5_gT 
N_L5_SPECIES 

Definition at line 120 of file JetCorrectorParameters.h.

Enumerator:
L7_gJ 
L7_qJ 
L7_cJ 
L7_bJ 
L7_jJ 
L7_qT 
L7_cT 
L7_bT 
L7_jT 
N_L7_SPECIES 

Definition at line 121 of file JetCorrectorParameters.h.

Enumerator:
L1Offset 
L1JPTOffset 
L1FastJet 
L2Relative 
L3Absolute 
L2L3Residual 
L4EMF 
L5Flavor 
L6UE 
L7Parton 
Uncertainty 
N_LEVELS 

Definition at line 105 of file JetCorrectorParameters.h.


Constructor & Destructor Documentation

JetCorrectorParametersCollection::JetCorrectorParametersCollection ( ) [inline]

Definition at line 130 of file JetCorrectorParameters.h.

References corrections_, correctionsL5_, and correctionsL7_.

{ corrections_.clear(); correctionsL5_.clear(); correctionsL7_.clear(); }

Member Function Documentation

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

Definition at line 506 of file JetCorrectorParameters.cc.

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

Referenced by operator[]().

                                                                         {

  // First check L5 corrections
  std::vector<std::string>::const_iterator found1 =
    find( l5Flavors_.begin(), l5Flavors_.end(), label );
  if ( found1 != l5Flavors_.end() ) {
    return getL5Bin(label);
  } 

  // Next check L7 corrections
  std::vector<std::string>::const_iterator found2 =
    find( l7Partons_.begin(), l7Partons_.end(), label );
  if ( found2 != l7Partons_.end() ) {
    return getL7Bin(label);
  } 

  // Finally check the default corrections
  std::vector<std::string>::const_iterator found3 =
    find( labels_.begin(), labels_.end(), label );
  if ( found3 != labels_.end() ) {
    return static_cast<key_type>(found3 - labels_.begin());
  } 

  // Didn't find default corrections, throw exception
  throw cms::Exception("InvalidInput") << " Cannot find label " << label << std::endl;

}
static std::string JetCorrectorParametersCollection::findL5Flavor ( key_type  k) [inline, static]

Definition at line 172 of file JetCorrectorParameters.h.

References L5Flavor, l5Flavors_, and labels_.

Referenced by findLabel().

                                             {
    if ( k == L5Flavor ) return labels_[L5Flavor];
    else 
      return l5Flavors_[k / 100 - 1];
  }  
static std::string JetCorrectorParametersCollection::findL7Parton ( key_type  k) [inline, static]

Definition at line 178 of file JetCorrectorParameters.h.

References L7Parton, l7Partons_, and labels_.

Referenced by findLabel().

                                             {
    if ( k == L7Parton ) return labels_[L7Parton];
    else 
      return l7Partons_[k / 1000 - 1];
  }
static std::string JetCorrectorParametersCollection::findLabel ( key_type  k) [inline, static]

Definition at line 166 of file JetCorrectorParameters.h.

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

Referenced by JetCorrectorDBWriter::beginJob().

                                          {
    if      ( isL5(k) ) return findL5Flavor(k);
    else if ( isL7(k) ) return findL7Parton(k);
    else                return labels_[k];
  }
JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL5Bin ( std::string const &  flav) [static]

Definition at line 473 of file JetCorrectorParameters.cc.

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

                                                                  {
  std::vector<std::string>::const_iterator found = 
    find( l5Flavors_.begin(), l5Flavors_.end(), flav );
  if ( found != l5Flavors_.end() ) {
    return (found - l5Flavors_.begin() + 1) * 100;
  }
  else return L5Flavor;
}
JetCorrectorParametersCollection::key_type JetCorrectorParametersCollection::getL7Bin ( std::string const &  flav) [static]

Definition at line 483 of file JetCorrectorParameters.cc.

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

                                                                  {
  std::vector<std::string>::const_iterator found = 
    find( l7Partons_.begin(), l7Partons_.end(), flav );
  if ( found != l7Partons_.end() ) {
    return (found - l7Partons_.begin() + 1) * 1000;
  }
  else return L7Parton;
}
void JetCorrectorParametersCollection::getSections ( std::string  inputFile,
std::vector< std::string > &  outputs 
) [static]

Definition at line 388 of file JetCorrectorParameters.cc.

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

Referenced by JetCorrectorDBWriter::beginJob().

{
  outputs.clear();
  std::ifstream input( inputFile.c_str() );
  while( !input.eof() ) {
    char buff[10000];
    input.getline(buff,10000);
    std::string in(buff); 
    if ( in[0] == '[' ) {
      std::string tok = getSection(in);
      if ( tok != "" ) {
        outputs.push_back( tok );
      }
    }
  }
  std::cout << "Found these sections for file: " << std::endl;
  copy(outputs.begin(),outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n") );
} 
bool JetCorrectorParametersCollection::isL5 ( key_type  k) [static]

Definition at line 493 of file JetCorrectorParameters.cc.

Referenced by findLabel().

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

Definition at line 498 of file JetCorrectorParameters.cc.

Referenced by findLabel().

                                                        {
  return k == L7Parton ||
    ( k / 1000 > 0 );
}
JetCorrectorParameters const & JetCorrectorParametersCollection::operator[] ( key_type  k) const

Definition at line 431 of file JetCorrectorParameters.cc.

References Exception, i, and gen::k.

Referenced by operator[]().

                                                                                              {
  collection_type::const_iterator ibegin, iend, i;
  if ( isL5(k) ) {
    ibegin = correctionsL5_.begin();
    iend = correctionsL5_.end();
    i = ibegin;
  } else if ( isL7(k) ) {
    ibegin = correctionsL7_.begin();
    iend = correctionsL7_.end();
    i = ibegin;      
  } else { 
    ibegin = corrections_.begin();
    iend = corrections_.end();
    i = ibegin;
  }
  for ( ; i != iend; ++i ) {
    if ( k == i->first ) return i->second;
  }
  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k) << std::endl;
}
JetCorrectorParameters const& JetCorrectorParametersCollection::operator[] ( std::string const &  label) const [inline]

Definition at line 142 of file JetCorrectorParameters.h.

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

                                                                             {
    return operator[]( findKey(label) );
  }
void JetCorrectorParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  flav = "" 
)

Definition at line 410 of file JetCorrectorParameters.cc.

References gather_cfg::cout, and pair_type.

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

                                                                                                           { 
  std::cout << "i    = " << i << std::endl;  
  std::cout << "flav = " << flav << std::endl;
  if ( isL5(i) ) {
    std::cout << "This is L5, getL5Bin = " << getL5Bin(flav) << std::endl;
    correctionsL5_.push_back( pair_type(getL5Bin(flav),j) ); 
  }
  else if ( isL7(i) ) {
    std::cout << "This is L7, getL7Bin = " << getL7Bin(flav) << std::endl;
    correctionsL7_.push_back( pair_type(getL7Bin(flav),j) );
  }
  else if ( flav == "" ) {
    corrections_.push_back( pair_type(i,j) );
  } else {
    std::cout << "***** NOT ADDING " << flav << ", corresponding position in JetCorrectorParameters is not found." << std::endl;
  }
}
void JetCorrectorParametersCollection::validKeys ( std::vector< key_type > &  keys) const

Definition at line 454 of file JetCorrectorParameters.cc.

References i.

                                                                                  {
  keys.clear();
  for ( collection_type::const_iterator ibegin = corrections_.begin(),
          iend = corrections_.end(), i = ibegin; i != iend; ++i ) {
    keys.push_back( i->first );
  }
  for ( collection_type::const_iterator ibegin = correctionsL5_.begin(),
          iend = correctionsL5_.end(), i = ibegin; i != iend; ++i ) {
    keys.push_back( i->first );
  }
  for ( collection_type::const_iterator ibegin = correctionsL7_.begin(),
          iend = correctionsL7_.end(), i = ibegin; i != iend; ++i ) {
    keys.push_back( i->first );
  }
}

Member Data Documentation

Definition at line 189 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

Definition at line 190 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

Definition at line 191 of file JetCorrectorParameters.h.

Referenced by JetCorrectorParametersCollection().

const char * JetCorrectorParametersCollection::l5FlavorArray_ [static, protected]
Initial value:
 
  {
    "L5Flavor_bJ",
    "L5Flavor_cJ",
    "L5Flavor_qJ",
    "L5Flavor_gJ",
    "L5Flavor_bT",
    "L5Flavor_cT",
    "L5Flavor_qT",
    "L5Flavor_gT"
  }

Definition at line 195 of file JetCorrectorParameters.h.

std::vector< std::string > JetCorrectorParametersCollection::l5Flavors_ [static, protected]

Definition at line 196 of file JetCorrectorParameters.h.

Referenced by findL5Flavor().

const char * JetCorrectorParametersCollection::l7PartonArray_ [static, protected]
Initial value:
 
  {
    "L7Parton_gJ",
    "L7Parton_qJ",
    "L7Parton_cJ",
    "L7Parton_bJ",
    "L7Parton_jJ",
    "L7Parton_qT",
    "L7Parton_cT",
    "L7Parton_bT",
    "L7Parton_tT"
  }

Definition at line 198 of file JetCorrectorParameters.h.

std::vector< std::string > JetCorrectorParametersCollection::l7Partons_ [static, protected]

Definition at line 199 of file JetCorrectorParameters.h.

Referenced by findL7Parton().

std::vector< std::string > JetCorrectorParametersCollection::labels_ [static, protected]

Definition at line 193 of file JetCorrectorParameters.h.

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

const char * JetCorrectorParametersCollection::labelsArray_ [static, protected]
Initial value:
 
  {
    "L1Offset",
    "L2Relative",
    "L3Absolute",
    "L4EMF",
    "L5Flavor",
    "L6UE",
    "L7Parton",
    "L1JPTOffset",
    "L2L3Residual",
    "Uncertainty",
    "L1FastJet" 
  }

Definition at line 192 of file JetCorrectorParameters.h.