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 54 of file FFTJetCorrectionESProducer.h.

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

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