179 typedef std::vector<MyJet> MyCollection;
181 typedef typename Loader::data_type CorrectorSequence;
182 typedef typename CorrectorSequence::result_type CorrectorResult;
185 const unsigned nRecords =
records.size();
186 std::vector<edm::ESHandle<CorrectorSequence> > handles(nRecords);
187 for (
unsigned irec=0; irec<nRecords; ++irec)
196 for (
unsigned irec=0; irec<nRecords; ++irec)
199 const unsigned nLevels = handles[irec]->nLevels();
200 for (
unsigned i=0;
i<nLevels; ++
i)
202 const unsigned lev = (*handles[irec])[
i].
level();
208 const int mask = (1 << lev);
209 if (totalMask & mask)
211 <<
"Error in FFTJetCorrectionProducer::applyCorrections:" 212 <<
" jet correction at level " << lev
213 <<
" is applied more than once\n";
220 totalMask = (totalMask << 12);
230 const unsigned nJets = jets->size();
231 auto coll = std::make_unique<MyCollection>();
232 coll->reserve(nJets);
236 double previousPt = DBL_MAX;
237 for (
unsigned ijet=0; ijet<nJets; ++ijet)
239 const MyJet& j((*jets)[ijet]);
242 const int initialStatus = j.getFFTSpecific().f_status();
243 if (initialStatus & totalMask)
245 <<
"Error in FFTJetCorrectionProducer::applyCorrections: " 246 <<
"this jet collection is already corrected for some or all " 247 <<
"of the specified levels\n";
255 <<
": pt = " << corJ.pt()
256 <<
", eta = " << fj.
f_vec().eta()
270 <<
"Error in FFTJetCorrectionProducer::applyCorrections: " 271 <<
"this jet collection is already pileup-subtracted\n";
274 <<
"Error in FFTJetCorrectionProducer::applyCorrections: " 275 <<
"pileup was not calculated for this jet collection\n";
282 <<
": pt = " << corJ.pt()
283 <<
", eta = " << fj.
f_vec().eta()
291 double sigmaSquared = 0.0;
292 for (
unsigned irec=0; irec<nRecords; ++irec)
294 const CorrectorResult&
corr = handles[irec]->correct(corJ, isMC);
297 FFTJet<float>& fftJet(
const_cast<FFTJet<float>&
>(corJ.getFFTSpecific()));
298 corJ.setP4(corr.vec());
299 fftJet.setFourVec(corr.vec());
305 const double s = corr.sigma();
315 corJ.setPileup(
sqrt(sigmaSquared));
320 const double pt = corJ.pt();
329 <<
": pt = " << corJ.pt()
330 <<
", eta = " << fj.
f_vec().eta()
338 std::sort(
coll->begin(),
coll->end(), LocalSortByPt());
343 auto unc = std::make_unique<std::vector<float>>();
345 for (
unsigned ijet=0; ijet<nJets; ++ijet)
347 MyJet& j((*
coll)[ijet]);
348 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="")
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