1 #ifndef JetMETCorrections_FFTJetModules_plugins_FFTJetCorrectionESProducer_h
2 #define JetMETCorrections_FFTJetModules_plugins_FFTJetCorrectionESProducer_h
26 #include "boost/shared_ptr.hpp"
28 #include "Alignment/Geners/interface/CompressedIO.hh"
52 template<
class CorrectorSequence>
53 static boost::shared_ptr<CorrectorSequence>
56 const std::vector<edm::ParameterSet>&
sequence,
57 const bool isArchiveCompressed,
const bool verbose)
59 typedef typename CorrectorSequence::Corrector Corrector;
60 typedef typename CorrectorSequence::jet_type jet_type;
63 CPP11_auto_ptr<gs::StringArchive> ar;
65 std::istringstream is(tablePars.
str());
66 if (isArchiveCompressed)
67 ar = gs::read_compressed_item<gs::StringArchive>(is);
69 ar = gs::read_item<gs::StringArchive>(is);
73 boost::shared_ptr<CorrectorSequence> ptr(
new CorrectorSequence());
78 const unsigned nLevels = sequence.size();
79 for (
unsigned lev=0; lev<nLevels; ++lev)
80 ptr->addCorrector(parseFFTJetCorrector<Corrector>(
81 sequence[lev], *ar, verbose));
85 unsigned previousLevel = 0;
86 for (
unsigned lev=0; lev<nLevels; ++lev)
88 const unsigned level = (*ptr)[lev].level();
91 if (level <= previousLevel)
93 <<
"Error in buildCorrectorSequence: "
94 <<
"correction levels are out of order\n";
95 previousLevel =
level;
105 template<
typename CT>
142 template<
typename CT>
146 isArchiveCompressed(psIn.getParameter<bool>(
"isArchiveCompressed")),
147 verbose(psIn.getUntrackedParameter<bool>(
"verbose",
false)),
156 template<
typename CT>
170 const ParentRecord& rec = iRecord.template getRecord<ParentRecord>();
173 product = buildCorrectorSequence<CorrectorSequence>(
175 remakeProduct =
false;
180 #endif // JetMETCorrections_FFTJetModules_plugins_FFTJetCorrectionESProducer_h
boost::shared_ptr< CorrectorSequence > ReturnType
depends_on::OneHolder< T, TDependsOnRecord > dependsOn(void(T::*iT)(const TDependsOnRecord &))
void doWhenChanged(const ParentRecord &)
const std::string & str() const
virtual ~FFTJetCorrectionESProducer()
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
FFTJetCorrectorParametersRcd< CT > ParentRecord
FFTJetCorrectionESProducer(const edm::ParameterSet &)
void get(HolderT &iHolder) const
FFTJetCorrectionsTypemap< CT >::jet_type jet_type
ReturnType produce(const MyRecord &)
FFTJetCorrectorSequenceRcd< CT > MyRecord
static boost::shared_ptr< CorrectorSequence > buildCorrectorSequence(const FFTJetCorrectorParameters &tablePars, const std::vector< edm::ParameterSet > &sequence, const bool isArchiveCompressed, const bool verbose)
volatile std::atomic< bool > shutdown_flag false
FFTJetCorrectorSequence< jet_type, FFTJetCorrectorTransientFromJet, FFTJetCorrectorResultFromTransient > CorrectorSequence
std::vector< edm::ParameterSet > sequence