CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
FFTJetCorrectionESProducer.h File Reference
#include <sstream>
#include "boost/shared_ptr.hpp"
#include "Alignment/Geners/interface/CompressedIO.hh"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "CondFormats/JetMETObjects/interface/FFTJetCorrectorParameters.h"
#include "CondFormats/JetMETObjects/interface/FFTJetCorrTypes.h"
#include "JetMETCorrections/FFTJetObjects/interface/FFTJetCorrectorSequenceRcd.h"
#include "JetMETCorrections/FFTJetObjects/interface/FFTJetCorrectorTransientFromJet.h"
#include "JetMETCorrections/FFTJetObjects/interface/FFTJetCorrectorResultFromTransient.h"
#include "JetMETCorrections/FFTJetObjects/interface/FFTJetCorrectorSequence.h"
#include "JetMETCorrections/FFTJetModules/interface/FFTJetESParameterParser.h"

Go to the source code of this file.

Classes

class  FFTJetCorrectionESProducer< CT >
 

Functions

template<class CorrectorSequence >
static boost::shared_ptr
< CorrectorSequence > 
buildCorrectorSequence (const FFTJetCorrectorParameters &tablePars, const std::vector< edm::ParameterSet > &sequence, const bool isArchiveCompressed, const bool verbose)
 

Function Documentation

template<class CorrectorSequence >
static boost::shared_ptr<CorrectorSequence> buildCorrectorSequence ( const FFTJetCorrectorParameters tablePars,
const std::vector< edm::ParameterSet > &  sequence,
const bool  isArchiveCompressed,
const bool  verbose 
)
static

Definition at line 55 of file FFTJetCorrectionESProducer.h.

References edm::hlt::Exception, testEve_cfg::level, and FFTJetCorrectorParameters::str().

59 {
60  typedef typename CorrectorSequence::Corrector Corrector;
61  typedef typename CorrectorSequence::jet_type jet_type;
62 
63  // Load the archive stored in the FFTJetCorrectorParameters object
64  CPP11_auto_ptr<gs::StringArchive> ar;
65  {
66  std::istringstream is(tablePars.str());
67  if (isArchiveCompressed)
68  ar = gs::read_compressed_item<gs::StringArchive>(is);
69  else
70  ar = gs::read_item<gs::StringArchive>(is);
71  }
72 
73  // Create an empty corrector sequence
74  boost::shared_ptr<CorrectorSequence> ptr(new CorrectorSequence());
75 
76  // Go over the parameter sets in the VPSet and
77  // configure all correction levels. Add each new
78  // level to the sequence.
79  const unsigned nLevels = sequence.size();
80  for (unsigned lev=0; lev<nLevels; ++lev)
81  ptr->addCorrector(parseFFTJetCorrector<Corrector>(
82  sequence[lev], *ar, verbose));
83 
84  // Check for proper level order.
85  // Assume that level 0 is special and can happen anywhere.
86  unsigned previousLevel = 0;
87  for (unsigned lev=0; lev<nLevels; ++lev)
88  {
89  const unsigned level = (*ptr)[lev].level();
90  if (level)
91  {
92  if (level <= previousLevel)
93  throw cms::Exception("FFTJetBadConfig")
94  << "Error in buildCorrectorSequence: "
95  << "correction levels are out of order\n";
96  previousLevel = level;
97  }
98  }
99 
100  return ptr;
101 }
const std::string & str() const
tuple level
Definition: testEve_cfg.py:34