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
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_typepair_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 106 of file METCorrectorParameters.h.

Member Typedef Documentation

◆ collection_type

Definition at line 114 of file METCorrectorParameters.h.

◆ key_type

Definition at line 110 of file METCorrectorParameters.h.

◆ label_type

Definition at line 111 of file METCorrectorParameters.h.

◆ pair_type

Definition at line 113 of file METCorrectorParameters.h.

◆ value_type

Definition at line 112 of file METCorrectorParameters.h.

Member Enumeration Documentation

◆ Level_t

Constructor & Destructor Documentation

◆ METCorrectorParametersCollection()

METCorrectorParametersCollection::METCorrectorParametersCollection ( )
inline

Definition at line 117 of file METCorrectorParameters.h.

References correctionsMiniAod_.

117 { correctionsMiniAod_.clear(); }

Member Function Documentation

◆ findKey()

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

Referenced by operator[]().

◆ findLabel()

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

Definition at line 321 of file METCorrectorParameters.cc.

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

321  {
322  std::cout << "findLabel with key_type: " << k << std::endl;
323  if (isMiniAod(k)) {
324  std::cout << "is MiniAod" << std::endl;
325  return findMiniAodSource(k);
326  }
327  return labels_[k];
328 }
static std::string findMiniAodSource(key_type k)

◆ findMiniAodSource()

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

Definition at line 329 of file METCorrectorParameters.cc.

References dqmdumpme::k.

329  {
330  if (k == MiniAod)
331  return labels_[MiniAod];
332  else
333  return MiniAodSource_[k - MiniAod * 100 - 1];
334 }

◆ getMiniAodBin()

METCorrectorParametersCollection::key_type METCorrectorParametersCollection::getMiniAodBin ( std::string const &  source)
static

Definition at line 397 of file METCorrectorParameters.cc.

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

397  {
398  std::vector<std::string>::const_iterator found = find(MiniAodSource_.begin(), MiniAodSource_.end(), source);
399  if (found != MiniAodSource_.end()) {
400  return (found - MiniAodSource_.begin() + 1) + MiniAod * 100;
401  } else
402  return MiniAod;
403 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static std::string const source
Definition: EdmProvDump.cc:49

◆ getSections()

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

Definition at line 335 of file METCorrectorParameters.cc.

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

335  {
336  outputs.clear();
337  std::ifstream input(inputFile.c_str());
338  while (!input.eof()) {
339  char buff[10000];
340  input.getline(buff, 10000);
341  std::string in(buff);
342  if (in[0] == '[') {
343  std::string tok = getSection(in);
344  if (!tok.empty()) {
345  outputs.push_back(tok);
346  }
347  }
348  }
349  std::cout << "Found these sections for file: " << std::endl;
350  copy(outputs.begin(), outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
351 }
static std::string const input
Definition: EdmProvDump.cc:50

◆ isMiniAod()

bool METCorrectorParametersCollection::isMiniAod ( key_type  k)
static

Definition at line 405 of file METCorrectorParameters.cc.

References dqmdumpme::k.

405  {
406  return k == MiniAod || (k > MiniAod * 100 && k < MiniAod * 100 + 100);
407 }

◆ operator[]() [1/2]

METCorrectorParameters const & METCorrectorParametersCollection::operator[] ( key_type  k) const

Definition at line 368 of file METCorrectorParameters.cc.

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

368  {
369  collection_type::const_iterator ibegin, iend, i;
370  if (isMiniAod(k)) {
371  ibegin = correctionsMiniAod_.begin();
372  iend = correctionsMiniAod_.end();
373  i = ibegin;
374  }
375  for (; i != iend; ++i) {
376  if (k == i->first)
377  return i->second;
378  }
379  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
380  << " in the METC payload, this usually means you have to change the global tag"
381  << std::endl;
382 }

◆ operator[]() [2/2]

METCorrectorParameters const& METCorrectorParametersCollection::operator[] ( std::string const &  label) const
inline

Definition at line 129 of file METCorrectorParameters.h.

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

Referenced by operator[]().

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

◆ push_back()

void METCorrectorParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  source = "" 
)

Definition at line 354 of file METCorrectorParameters.cc.

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

354  {
355  std::cout << "i = " << i << std::endl;
356  std::cout << "source = " << source << std::endl;
357  if (isMiniAod(i)) {
358  std::cout << "This is MiniAod, getMiniAodBin = " << getMiniAodBin(source) << std::endl;
360  } else {
361  std::cout << "***** NOT ADDING " << source << ", corresponding position in METCorrectorParameters is not found."
362  << std::endl;
363  }
364 }
std::pair< key_type, value_type > pair_type
static key_type getMiniAodBin(std::string const &source)
static std::string const source
Definition: EdmProvDump.cc:49

◆ serialize()

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

◆ validKeys()

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

Definition at line 386 of file METCorrectorParameters.cc.

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

386  {
387  keys.clear();
388  for (collection_type::const_iterator ibegin = correctionsMiniAod_.begin(),
389  iend = correctionsMiniAod_.end(),
390  i = ibegin;
391  i != iend;
392  ++i) {
393  keys.push_back(i->first);
394  }
395 }

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 152 of file METCorrectorParameters.h.

◆ cond::serialization::access

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

Definition at line 152 of file METCorrectorParameters.h.

Member Data Documentation

◆ correctionsMiniAod_

collection_type METCorrectorParametersCollection::correctionsMiniAod_
protected

Definition at line 150 of file METCorrectorParameters.h.

Referenced by METCorrectorParametersCollection().