CMS 3D CMS Logo

Classes | Functions
FFTJetCorrectionESProducer.h File Reference
#include <sstream>
#include <memory>
#include "Alignment/Geners/interface/CompressedIO.hh"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESProductHost.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/Utilities/interface/ReusableObjectHolder.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 void buildCorrectorSequence (const FFTJetCorrectorParameters &tablePars, const std::vector< edm::ParameterSet > &sequence, const bool isArchiveCompressed, const bool verbose, CorrectorSequence *ptr)
 

Function Documentation

◆ buildCorrectorSequence()

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

Definition at line 54 of file FFTJetCorrectionESProducer.h.

References Exception, personalPlayback::level, FFTJetCorrectorParameters::str(), and verbose.

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  ptr->clear();
73 
74  // Go over the parameter sets in the VPSet and
75  // configure all correction levels. Add each new
76  // level to the sequence.
77  const unsigned nLevels = sequence.size();
78  for (unsigned lev = 0; lev < nLevels; ++lev)
79  ptr->addCorrector(parseFFTJetCorrector<Corrector>(sequence[lev], *ar, verbose));
80 
81  // Check for proper level order.
82  // Assume that level 0 is special and can happen anywhere.
83  unsigned previousLevel = 0;
84  for (unsigned lev = 0; lev < nLevels; ++lev) {
85  const unsigned level = (*ptr)[lev].level();
86  if (level) {
87  if (level <= previousLevel)
88  throw cms::Exception("FFTJetBadConfig") << "Error in buildCorrectorSequence: "
89  << "correction levels are out of order\n";
90  previousLevel = level;
91  }
92  }
93 }
bool verbose
const std::string & str() const