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

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

References Exception, hcalDigis_cfi::level, and FFTJetCorrectorParameters::str().

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