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 | Private Member Functions | Friends
METCorrectorParametersCollection Class Reference

#include <METCorrectorParameters.h>

Public Types

typedef std::vector< pair_typecollection_type
 
typedef int key_type
 
typedef std::string label_type
 
enum  Level_t { MiniAod =0, N_LEVELS =1 }
 
typedef std::pair< key_type,
value_type
pair_type
 
typedef METCorrectorParameters value_type
 

Public Member Functions

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

Static Public Member Functions

static std::string findLabel (key_type k)
 
static std::string findMiniAodSource (key_type k)
 
static key_type getMiniAodBin (std::string const &source)
 
static void getSections (std::string inputFile, std::vector< std::string > &outputs)
 
static bool isMiniAod (key_type k)
 

Protected Member Functions

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

Protected Attributes

collection_type correctionsMiniAod_
 

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
 

Detailed Description

Definition at line 100 of file METCorrectorParameters.h.

Member Typedef Documentation

Definition at line 110 of file METCorrectorParameters.h.

Definition at line 106 of file METCorrectorParameters.h.

Definition at line 107 of file METCorrectorParameters.h.

Definition at line 109 of file METCorrectorParameters.h.

Definition at line 108 of file METCorrectorParameters.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

METCorrectorParametersCollection::METCorrectorParametersCollection ( )
inline

Definition at line 113 of file METCorrectorParameters.h.

References correctionsMiniAod_.

113 { correctionsMiniAod_.clear();}

Member Function Documentation

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

Referenced by operator[]().

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

Definition at line 343 of file METCorrectorParameters.cc.

References gather_cfg::cout, and relval_2017::k.

Referenced by METCorrectorDBWriter::beginJob().

343  {
344  std::cout<<"findLabel with key_type: "<<k<<std::endl;
345  if( isMiniAod(k) )
346  {
347  std::cout<<"is MiniAod"<<std::endl;
348  return findMiniAodSource(k);
349  }
350  return labels_[k];
351 }
static std::string findMiniAodSource(key_type k)
tuple cout
Definition: gather_cfg.py:145
std::string METCorrectorParametersCollection::findMiniAodSource ( key_type  k)
static

Definition at line 353 of file METCorrectorParameters.cc.

354 {
355  if( k == MiniAod) return labels_[MiniAod];
356  else
357  return MiniAodSource_[k - MiniAod*100 -1];
358 }
METCorrectorParametersCollection::key_type METCorrectorParametersCollection::getMiniAodBin ( std::string const &  source)
static

Definition at line 421 of file METCorrectorParameters.cc.

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

421  {
422  std::vector<std::string>::const_iterator found =
423  find( MiniAodSource_.begin(), MiniAodSource_.end(), source );
424  if ( found != MiniAodSource_.end() ) {
425  return (found - MiniAodSource_.begin() + 1)+ MiniAod * 100;
426  }
427  else return MiniAod;
428 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static std::string const source
Definition: EdmProvDump.cc:43
void METCorrectorParametersCollection::getSections ( std::string  inputFile,
std::vector< std::string > &  outputs 
)
static

Definition at line 359 of file METCorrectorParameters.cc.

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

Referenced by METCorrectorDBWriter::beginJob().

361 {
362  outputs.clear();
363  std::ifstream input( inputFile.c_str() );
364  while( !input.eof() ) {
365  char buff[10000];
366  input.getline(buff,10000);
367  std::string in(buff);
368  if ( in[0] == '[' ) {
369  std::string tok = getSection(in);
370  if ( tok != "" ) {
371  outputs.push_back( tok );
372  }
373  }
374  }
375  std::cout << "Found these sections for file: " << std::endl;
376  copy(outputs.begin(),outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n") );
377 }
static std::string const input
Definition: EdmProvDump.cc:44
tuple cout
Definition: gather_cfg.py:145
bool METCorrectorParametersCollection::isMiniAod ( key_type  k)
static

Definition at line 430 of file METCorrectorParameters.cc.

430  {
431  return k == MiniAod ||
432  (k > MiniAod*100 && k < MiniAod*100 + 100);
433 }
METCorrectorParameters const & METCorrectorParametersCollection::operator[] ( key_type  k) const

Definition at line 395 of file METCorrectorParameters.cc.

References Exception, i, and relval_2017::k.

Referenced by operator[]().

395  {
396  collection_type::const_iterator ibegin, iend, i;
397  if ( isMiniAod(k) ) {
398  ibegin = correctionsMiniAod_.begin();
399  iend = correctionsMiniAod_.end();
400  i = ibegin;
401  }
402  for ( ; i != iend; ++i ) {
403  if ( k == i->first ) return i->second;
404  }
405  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
406  << " in the METC payload, this usually means you have to change the global tag" << std::endl;
407 }
int i
Definition: DBlmapReader.cc:9
METCorrectorParameters const& METCorrectorParametersCollection::operator[] ( std::string const &  label) const
inline

Definition at line 125 of file METCorrectorParameters.h.

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

125  {
126  return operator[]( findKey(label) );
127  }
METCorrectorParameters const & operator[](key_type k) const
key_type findKey(std::string const &label) const
void METCorrectorParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  source = "" 
)

Definition at line 380 of file METCorrectorParameters.cc.

References gather_cfg::cout, and pair_type.

Referenced by METCorrectorDBWriter::beginJob().

381 {
382  std::cout << "i = " << i << std::endl;
383  std::cout << "source = " << source << std::endl;
384  if( isMiniAod(i))
385  {
386  std::cout << "This is MiniAod, getMiniAodBin = " << getMiniAodBin(source) << std::endl;
388  }else{
389  std::cout << "***** NOT ADDING " << source << ", corresponding position in METCorrectorParameters is not found." << std::endl;
390  }
391 }
int i
Definition: DBlmapReader.cc:9
static key_type getMiniAodBin(std::string const &source)
int j
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:145
std::pair< key_type, value_type > pair_type
static std::string const source
Definition: EdmProvDump.cc:43
template<class Archive >
void METCorrectorParametersCollection::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void METCorrectorParametersCollection::validKeys ( std::vector< key_type > &  keys) const

Definition at line 411 of file METCorrectorParameters.cc.

References i.

411  {
412  keys.clear();
413  for ( collection_type::const_iterator ibegin = correctionsMiniAod_.begin(),
414  iend = correctionsMiniAod_.end(), i = ibegin; i != iend; ++i ) {
415  keys.push_back( i->first );
416  }
417 }
int i
Definition: DBlmapReader.cc:9

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 153 of file METCorrectorParameters.h.

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

Definition at line 153 of file METCorrectorParameters.h.

Member Data Documentation

collection_type METCorrectorParametersCollection::correctionsMiniAod_
protected

Definition at line 151 of file METCorrectorParameters.h.

Referenced by METCorrectorParametersCollection().