163 typedef std::vector<MyJet> MyCollection;
165 typedef typename Loader::data_type CorrectorSequence;
166 typedef typename CorrectorSequence::result_type CorrectorResult;
169 const unsigned nRecords =
records.size();
170 std::vector<edm::ESHandle<CorrectorSequence>>
handles(nRecords);
171 for (
unsigned irec = 0; irec < nRecords; ++irec)
180 for (
unsigned irec = 0; irec < nRecords; ++irec) {
182 const unsigned nLevels =
handles[irec]->nLevels();
183 for (
unsigned i = 0;
i < nLevels; ++
i) {
189 const int mask = (1 << lev);
190 if (totalMask & mask)
192 <<
"Error in FFTJetCorrectionProducer::applyCorrections:" 193 <<
" jet correction at level " << lev <<
" is applied more than once\n";
200 totalMask = (totalMask << 12);
210 const unsigned nJets = jets->size();
211 auto coll = std::make_unique<MyCollection>();
212 coll->reserve(nJets);
216 double previousPt = DBL_MAX;
217 for (
unsigned ijet = 0; ijet < nJets; ++ijet) {
218 const MyJet&
j((*jets)[ijet]);
221 const int initialStatus =
j.getFFTSpecific().f_status();
222 if (initialStatus & totalMask)
223 throw cms::Exception(
"FFTJetBadConfig") <<
"Error in FFTJetCorrectionProducer::applyCorrections: " 224 <<
"this jet collection is already corrected for some or all " 225 <<
"of the specified levels\n";
232 <<
", eta = " << fj.
f_vec().eta() <<
", R = " << fj.
f_recoScale() <<
", s = 0x" << std::hex
242 throw cms::Exception(
"FFTJetBadConfig") <<
"Error in FFTJetCorrectionProducer::applyCorrections: " 243 <<
"this jet collection is already pileup-subtracted\n";
245 throw cms::Exception(
"FFTJetBadConfig") <<
"Error in FFTJetCorrectionProducer::applyCorrections: " 246 <<
"pileup was not calculated for this jet collection\n";
252 <<
": pt = " << corJ.pt() <<
", eta = " << fj.
f_vec().eta() <<
", R = " << fj.
f_recoScale()
258 double sigmaSquared = 0.0;
259 for (
unsigned irec = 0; irec < nRecords; ++irec) {
260 const CorrectorResult&
corr =
handles[irec]->correct(corJ, isMC);
263 FFTJet<float>& fftJet(
const_cast<FFTJet<float>&
>(corJ.getFFTSpecific()));
264 corJ.setP4(corr.vec());
265 fftJet.setFourVec(corr.vec());
271 const double s = corr.sigma();
272 sigmaSquared += s *
s;
281 corJ.setPileup(
sqrt(sigmaSquared));
286 const double pt = corJ.pt();
294 <<
": pt = " << corJ.pt() <<
", eta = " << fj.
f_vec().eta() <<
", R = " << fj.
f_recoScale()
300 std::sort(
coll->begin(),
coll->end(), LocalSortByPt());
304 auto unc = std::make_unique<std::vector<float>>();
306 for (
unsigned ijet = 0; ijet < nJets; ++ijet) {
307 MyJet&
j((*
coll)[ijet]);
308 unc->push_back(
j.pileup());
edm::EDGetTokenT< std::vector< reco::FFTAnyJet< reco::Jet > > > input_jets_token_
const std::string outputLabel
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void push_back(key_type i, value_type const &j, label_type const &flav="")
std::vector< BaseVolumeHandle * > handles
Implements inheritance relationships for FFTJet jets.
const math::XYZTLorentzVector & f_vec() const
void performPileupSubtraction(Jet &)
#define PILEUP_SUBTRACTION_MASK_ANY
Storage class for jets reconstructed by FFTJet package.
const bool subtractPileup
#define PILEUP_CALCULATION_MASK
const std::vector< std::string > records
const bool writeUncertainties
std::vector< int > sequenceMasks