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
MEtXYcorrectParametersCollection Class Reference

#include <MEtXYcorrectParameters.h>

Public Types

typedef std::vector< pair_typecollection_type
 
typedef int key_type
 
typedef std::string label_type
 
enum  Level_t {
  shiftMC =0, shiftDY =1, shiftTTJets =2, shiftWJets =3,
  shiftData =4, N_LEVELS =5
}
 
typedef std::pair< key_type, value_typepair_type
 
typedef MEtXYcorrectParameters value_type
 

Public Member Functions

void getSections (std::string inputFile, std::vector< std::string > &outputs)
 
key_type getShiftDataFlavBin (std::string const &Flav)
 
key_type getShiftDyFlavBin (std::string const &Flav)
 
key_type getShiftMcFlavBin (std::string const &Flav)
 
key_type getShiftTTJetsFlavBin (std::string const &Flav)
 
key_type getShiftWJetsFlavBin (std::string const &Flav)
 
 MEtXYcorrectParametersCollection ()
 
MEtXYcorrectParameters const & operator[] (key_type k) const
 
MEtXYcorrectParameters 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 findLabel (key_type k)
 
static std::string findShiftDataFlavor (key_type k)
 
static std::string findShiftDYflavor (key_type k)
 
static std::string findShiftMCflavor (key_type k)
 
static std::string findShiftTTJetsFlavor (key_type k)
 
static std::string findShiftWJetsFlavor (key_type k)
 
static bool isShiftData (key_type k)
 
static bool isShiftDY (key_type k)
 
static bool isShiftMC (key_type k)
 
static bool isShiftTTJets (key_type k)
 
static bool isShiftWJets (key_type k)
 
static std::string levelName (key_type k)
 

Protected Member Functions

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

Protected Attributes

collection_type correctionsShift_
 

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 105 of file MEtXYcorrectParameters.h.

Member Typedef Documentation

Definition at line 119 of file MEtXYcorrectParameters.h.

Definition at line 115 of file MEtXYcorrectParameters.h.

Definition at line 116 of file MEtXYcorrectParameters.h.

Definition at line 118 of file MEtXYcorrectParameters.h.

Definition at line 117 of file MEtXYcorrectParameters.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

MEtXYcorrectParametersCollection::MEtXYcorrectParametersCollection ( )
inline

Definition at line 122 of file MEtXYcorrectParameters.h.

References mps_fire::i, gen::k, and operator[]().

122  {
123  correctionsShift_.clear();
124  }

Member Function Documentation

key_type MEtXYcorrectParametersCollection::findKey ( std::string const &  label) const
protected
std::string MEtXYcorrectParametersCollection::findLabel ( key_type  k)
static

Definition at line 308 of file MEtXYcorrectParameters.cc.

References isShiftData(), isShiftDY(), isShiftTTJets(), isShiftWJets(), gen::k, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MultShiftMETcorrDBInputProducer::produce().

308  {
309  if( isShiftMC(k) ){
310  return findShiftMCflavor(k);
312  return findShiftDYflavor(k);
314  return findShiftTTJetsFlavor(k);
316  return findShiftWJetsFlavor(k);
318  return findShiftDataFlavor(k);
319  }
320  return labels_[k];
321 }
static std::string findShiftWJetsFlavor(key_type k)
static std::string findShiftDataFlavor(key_type k)
static std::string findShiftMCflavor(key_type k)
static std::string findShiftDYflavor(key_type k)
int k[5][pyjets_maxn]
static std::string findShiftTTJetsFlavor(key_type k)
std::string MEtXYcorrectParametersCollection::findShiftDataFlavor ( key_type  k)
static

Definition at line 368 of file MEtXYcorrectParameters.cc.

369 {
370  if( k == shiftData) return labels_[shiftData];
371  else
372  return shiftFlavors_[k - (shiftData+1)*100 -1];
373 }
int k[5][pyjets_maxn]
std::string MEtXYcorrectParametersCollection::findShiftDYflavor ( key_type  k)
static

Definition at line 347 of file MEtXYcorrectParameters.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

348 {
349  if( k == shiftDY) return labels_[shiftDY];
350  else
351  return shiftFlavors_[k - (shiftDY+1)*100 -1];
352 }
int k[5][pyjets_maxn]
std::string MEtXYcorrectParametersCollection::findShiftMCflavor ( key_type  k)
static

Definition at line 340 of file MEtXYcorrectParameters.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

341 {
342  if( k == shiftMC) return labels_[shiftMC];
343  else
344  return shiftFlavors_[k - (shiftMC+1)*100 -1];
345 }
int k[5][pyjets_maxn]
std::string MEtXYcorrectParametersCollection::findShiftTTJetsFlavor ( key_type  k)
static

Definition at line 354 of file MEtXYcorrectParameters.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

355 {
356  if( k == shiftTTJets) return labels_[shiftTTJets];
357  else
358  return shiftFlavors_[k - (shiftTTJets+1)*100 -1];
359 }
int k[5][pyjets_maxn]
std::string MEtXYcorrectParametersCollection::findShiftWJetsFlavor ( key_type  k)
static

Definition at line 361 of file MEtXYcorrectParameters.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

362 {
363  if( k == shiftWJets) return labels_[shiftWJets];
364  else
365  return shiftFlavors_[k - (shiftWJets+1)*100 -1];
366 }
int k[5][pyjets_maxn]
void MEtXYcorrectParametersCollection::getSections ( std::string  inputFile,
std::vector< std::string > &  outputs 
)

Definition at line 375 of file MEtXYcorrectParameters.cc.

References insertMaterial::getSection(), recoMuon::in, input, and AlCaHLTBitMon_QueryRunRegistry::string.

377 {
378  outputs.clear();
379  std::ifstream input( inputFile.c_str() );
380  while( !input.eof() ) {
381  char buff[10000];
382  input.getline(buff,10000);
383  std::string in(buff);
384  if ( in[0] == '[' ) {
385  std::string tok = getSection(in);
386  if ( tok != "" ) {
387  outputs.push_back( tok );
388  }
389  }
390  }
391  //copy(outputs.begin(),outputs.end(), std::ostream_iterator<std::string>(std::cout, "\n") );
392 
393  std::string sectionNames;
394  for(std::vector<std::string>::const_iterator it=outputs.begin(); it!=outputs.end();it++){
395  sectionNames+=*it;
396  sectionNames+="\n";
397  }
398  edm::LogInfo ("getSections")<<"Sections read from file: "<<"\n"<<sectionNames;
399 }
static std::string const input
Definition: EdmProvDump.cc:48
def getSection(rootNode, name)
MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftDataFlavBin ( std::string const &  Flav)

Definition at line 509 of file MEtXYcorrectParameters.cc.

References Exception, spr::find(), and runEdmFileComparison::found.

509  {
510  std::vector<std::string>::const_iterator found =
511  find( shiftFlavors_.begin(), shiftFlavors_.end(), flav );
512  if ( found != shiftFlavors_.end() ) {
513  return (found - shiftFlavors_.begin() + 1)+ (shiftData+1) * 100;
514  }
515  else{
516  throw cms::Exception("InvalidInput") <<
517  "************** Can't find shiftSection: "<<flav<<std::endl;
518  }
519  return 0;
520 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftDyFlavBin ( std::string const &  Flav)

Definition at line 470 of file MEtXYcorrectParameters.cc.

References Exception, spr::find(), and runEdmFileComparison::found.

470  {
471  std::vector<std::string>::const_iterator found =
472  find( shiftFlavors_.begin(), shiftFlavors_.end(), flav );
473  if ( found != shiftFlavors_.end() ) {
474  return (found - shiftFlavors_.begin() + 1)+ (shiftDY+1) * 100;
475  }
476  else{
477  throw cms::Exception("InvalidInput") <<
478  "************** Can't find ShiftSection: "<<flav<<std::endl;
479  }
480  return 0;
481 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftMcFlavBin ( std::string const &  Flav)

Definition at line 456 of file MEtXYcorrectParameters.cc.

References Exception, spr::find(), and runEdmFileComparison::found.

456  {
457  std::vector<std::string>::const_iterator found =
458  find( shiftFlavors_.begin(), shiftFlavors_.end(), flav );
459  if ( found != shiftFlavors_.end() ) {
460  return (found - shiftFlavors_.begin() + 1)+ (shiftMC+1) * 100;
461  }
462  else{
463  throw cms::Exception("InvalidInput") <<
464  "************** Can't find ShiftSection: "<<flav<<std::endl;
465  }
466  return 0;
467 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftTTJetsFlavBin ( std::string const &  Flav)

Definition at line 483 of file MEtXYcorrectParameters.cc.

References Exception, spr::find(), and runEdmFileComparison::found.

483  {
484  std::vector<std::string>::const_iterator found =
485  find( shiftFlavors_.begin(), shiftFlavors_.end(), flav );
486  if ( found != shiftFlavors_.end() ) {
487  return (found - shiftFlavors_.begin() + 1)+ (shiftTTJets+1) * 100;
488  }
489  else{
490  throw cms::Exception("InvalidInput") <<
491  "************** Can't find shiftSection: "<<flav<<std::endl;
492  }
493  return 0;
494 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MEtXYcorrectParametersCollection::key_type MEtXYcorrectParametersCollection::getShiftWJetsFlavBin ( std::string const &  Flav)

Definition at line 496 of file MEtXYcorrectParameters.cc.

References Exception, spr::find(), and runEdmFileComparison::found.

496  {
497  std::vector<std::string>::const_iterator found =
498  find( shiftFlavors_.begin(), shiftFlavors_.end(), flav );
499  if ( found != shiftFlavors_.end() ) {
500  return (found - shiftFlavors_.begin() + 1)+ (shiftWJets+1) * 100;
501  }
502  else{
503  throw cms::Exception("InvalidInput") <<
504  "************** Can't find shiftSection: "<<flav<<std::endl;
505  }
506  return 0;
507 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool MEtXYcorrectParametersCollection::isShiftData ( key_type  k)
static

Definition at line 538 of file MEtXYcorrectParameters.cc.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

538  {
539  return k == shiftData ||
540  (k > (shiftData+1)*100 && k < (shiftData + 2)*100 );
541 }
int k[5][pyjets_maxn]
bool MEtXYcorrectParametersCollection::isShiftDY ( key_type  k)
static

Definition at line 526 of file MEtXYcorrectParameters.cc.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

526  {
527  return k == shiftDY ||
528  (k > (shiftDY+1)*100 && k < (shiftDY + 2)*100 );
529 }
int k[5][pyjets_maxn]
bool MEtXYcorrectParametersCollection::isShiftMC ( key_type  k)
static

Definition at line 522 of file MEtXYcorrectParameters.cc.

Referenced by MultShiftMETcorrDBInputProducer::produce().

522  {
523  return k == shiftMC ||
524  (k > (shiftMC+1)*100 && k < (shiftMC + 2)*100 );
525 }
int k[5][pyjets_maxn]
bool MEtXYcorrectParametersCollection::isShiftTTJets ( key_type  k)
static

Definition at line 530 of file MEtXYcorrectParameters.cc.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

530  {
531  return k == shiftTTJets ||
532  (k > (shiftTTJets+1)*100 && k < (shiftTTJets + 2)*100 );
533 }
int k[5][pyjets_maxn]
bool MEtXYcorrectParametersCollection::isShiftWJets ( key_type  k)
static

Definition at line 534 of file MEtXYcorrectParameters.cc.

Referenced by findLabel(), and MultShiftMETcorrDBInputProducer::produce().

534  {
535  return k == shiftWJets ||
536  (k > (shiftWJets+1)*100 && k < (shiftWJets + 2)*100 );
537 }
int k[5][pyjets_maxn]
std::string MEtXYcorrectParametersCollection::levelName ( key_type  k)
static

Definition at line 324 of file MEtXYcorrectParameters.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

324  {
325  if( isShiftMC(k) ){
326  return labels_[shiftMC];
327  }else if( isShiftDY(k) ){
328  return labels_[shiftDY];
329  }else if( isShiftTTJets(k) ){
330  return labels_[shiftTTJets];
331  }else if( isShiftWJets(k) ){
332  return labels_[shiftWJets];
333  }else if( isShiftData(k) ){
334  return labels_[shiftData];
335  }else{ return "Can't find the level name !!!!";}
336 
337 }
int k[5][pyjets_maxn]
MEtXYcorrectParameters const & MEtXYcorrectParametersCollection::operator[] ( key_type  k) const

Definition at line 429 of file MEtXYcorrectParameters.cc.

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

429  {
430  collection_type::const_iterator ibegin, iend, i;
431  if ( isShiftMC(k) || isShiftDY(k) || isShiftTTJets(k) || isShiftWJets(k) || isShiftData(k) ) {
432  ibegin = correctionsShift_.begin();
433  iend = correctionsShift_.end();
434  i = ibegin;
435  }
436  for ( ; i != iend; ++i ) {
437  if ( k == i->first ) return i->second;
438  }
439  throw cms::Exception("InvalidInput") << " cannot find key " << static_cast<int>(k)
440  << " in the METC payload, this usually means you have to change the global tag" << std::endl;
441 }
int k[5][pyjets_maxn]
MEtXYcorrectParameters const& MEtXYcorrectParametersCollection::operator[] ( std::string const &  label) const
inline

Definition at line 136 of file MEtXYcorrectParameters.h.

References analyzePatCleaning_cfg::inputFile, relativeConstraints::keys, label, fwlog::levelName(), operator[](), PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, and AlCaHLTBitMon_QueryRunRegistry::string.

136  {
137  return operator[]( findKey(label) );
138  }
char const * label
MEtXYcorrectParameters const & operator[](key_type k) const
key_type findKey(std::string const &label) const
void MEtXYcorrectParametersCollection::push_back ( key_type  i,
value_type const &  j,
label_type const &  flav = "" 
)

Definition at line 402 of file MEtXYcorrectParameters.cc.

References pair_type.

403 {
404  if( isShiftMC(i))
405  {
406  correctionsShift_.push_back( pair_type(getShiftMcFlavBin(flav),j) );
407  }else if( isShiftDY(i))
408  {
409  correctionsShift_.push_back( pair_type(getShiftDyFlavBin(flav),j) );
410  }else if( isShiftTTJets(i))
411  {
412  correctionsShift_.push_back( pair_type(getShiftTTJetsFlavBin(flav),j) );
413  }else if( isShiftWJets(i))
414  {
415  correctionsShift_.push_back( pair_type(getShiftWJetsFlavBin(flav),j) );
416  }else if( isShiftData(i))
417  {
418  correctionsShift_.push_back( pair_type(getShiftDataFlavBin(flav),j) );
419  }else{
420  std::stringstream sserr;
421  sserr<<"The level type: "<<i<<" is not in the level list";
422  handleError("MEtXYcorrectParameters::Definitions",sserr.str());
423  }
424 
425 }
key_type getShiftDataFlavBin(std::string const &Flav)
std::pair< key_type, value_type > pair_type
key_type getShiftTTJetsFlavBin(std::string const &Flav)
key_type getShiftMcFlavBin(std::string const &Flav)
key_type getShiftDyFlavBin(std::string const &Flav)
key_type getShiftWJetsFlavBin(std::string const &Flav)
template<class Archive >
void MEtXYcorrectParametersCollection::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void MEtXYcorrectParametersCollection::validKeys ( std::vector< key_type > &  keys) const

Definition at line 445 of file MEtXYcorrectParameters.cc.

References mps_fire::i.

Referenced by MultShiftMETcorrDBInputProducer::produce().

445  {
446  keys.clear();
447  for ( collection_type::const_iterator ibegin = correctionsShift_.begin(),
448  iend = correctionsShift_.end(), i = ibegin; i != iend; ++i ) {
449  keys.push_back( i->first );
450  }
451 }

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 179 of file MEtXYcorrectParameters.h.

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

Definition at line 179 of file MEtXYcorrectParameters.h.

Member Data Documentation

collection_type MEtXYcorrectParametersCollection::correctionsShift_
protected

Definition at line 177 of file MEtXYcorrectParameters.h.