46 useUserData_(iConfig.exists(
"userData"))
77 if (addEfficiencies_) {
85 if (discriminatorTags_.empty()) {
86 addDiscriminators_ =
false;
88 for (std::vector<edm::InputTag>::const_iterator it = discriminatorTags_.begin(), ed = discriminatorTags_.end(); it != ed; ++it) {
89 std::string
label = it->label();
91 if ((pos != std::string::npos) && (pos != label.length() - 7)) {
97 if (tagInfoTags_.empty()) {
100 for (std::vector<edm::InputTag>::const_iterator it = tagInfoTags_.begin(), ed = tagInfoTags_.end(); it != ed; ++it) {
101 std::string
label = it->label();
103 if ((pos != std::string::npos) && (pos != label.length() - 8)) {
109 if (!addBTagInfo_) { addDiscriminators_ =
false; addTagInfos_ =
false; }
115 produces<std::vector<Jet> >();
116 produces<reco::GenJetCollection> (
"genJets");
117 produces<std::vector<CaloTower> > (
"caloTowers");
118 produces<reco::PFCandidateCollection > (
"pfCandidates");
119 produces<edm::OwnVector<reco::BaseTagInfo> > (
"tagInfos");
162 std::vector<edm::ValueMap<JetCorrFactors> > jetCorrs;
167 jetCorrs.push_back( *jetCorr );
172 std::vector<edm::Handle<reco::JetFloatAssociation::Container> > jetDiscriminators;
179 std::vector<edm::Handle<edm::View<reco::BaseTagInfo> > > jetTagInfos;
198 std::auto_ptr< std::vector<Jet> >
patJets (
new std::vector<Jet>() );
201 std::auto_ptr<std::vector<CaloTower> > caloTowersOut(
new std::vector<CaloTower> () );
218 unsigned int idx = itJet - jets->begin();
227 if ( ajet.
isCaloJet()) cj = dynamic_cast<const reco::CaloJet *>(jetRef.
get());
234 for ( std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(),
235 towEnd = itowers.end(), itow = towBegin;
236 itow != towEnd; ++itow ) {
237 caloTowersOut->push_back( **itow );
240 edm::Ptr<CaloTower> caloForwardRef ( h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter() );
255 for ( std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
256 partEnd = iparticles.end(), ipart = partBegin;
257 ipart != partEnd; ++ipart ) {
258 pfCandidatesOut->push_back( **ipart );
278 std::vector<std::string> levels = jetCorrs[0][jetRef].correctionLabels();
279 if(
std::find(levels.begin(), levels.end(),
"L2L3Residual")!=levels.end()){
280 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L2L3Residual"));
282 else if(
std::find(levels.begin(), levels.end(),
"L3Absolute")!=levels.end()){
283 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L3Absolute"));
286 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"Uncorrected"));
288 edm::LogWarning(
"L3Absolute not found") <<
"L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
289 <<
"of module " << jetCorrs[0][jetRef].jecSet() <<
" jets will remain"
290 <<
" uncorrected."; first=
false;
310 genJetsOut->push_back( *genjet );
337 for (
size_t k=0;
k<jetDiscriminators.size(); ++
k) {
338 float value = (*jetDiscriminators[
k])[jetRef];
343 for (
size_t k=0;
k<jetTagInfos.size(); ++
k) {
348 if ((idx < taginfos.
size()) && (taginfos[idx].
jet() == jetRef)) {
349 match = taginfos.
ptrAt(idx);
353 if (itTI->jet() == jetRef) { match = taginfos.
ptrAt( itTI - taginfos.
begin() );
break; }
357 tagInfosOut->push_back( match->clone() );
388 patJets->push_back(ajet);
397 iEvent.
put( genJetsOut,
"genJets" );
398 iEvent.
put( caloTowersOut,
"caloTowers" );
399 iEvent.
put( pfCandidatesOut,
"pfCandidates" );
400 iEvent.
put( tagInfosOut,
"tagInfos" );
415 iDesc.
add<
bool>(
"embedCaloTowers",
true)->setComment(
"embed external calo towers");
416 iDesc.
add<
bool>(
"embedPFCandidates",
true)->setComment(
"embed external PFCandidates");
419 iDesc.
add<
bool>(
"addGenPartonMatch",
true)->setComment(
"add MC matching");
420 iDesc.
add<
bool>(
"embedGenPartonMatch",
false)->setComment(
"embed MC matched MC information");
423 iDesc.
add<
bool>(
"addGenJetMatch",
true)->setComment(
"add MC matching");
424 iDesc.
add<
bool>(
"embedGenJetMatch",
false)->setComment(
"embed MC matched MC information");
427 iDesc.
add<
bool>(
"addJetCharge",
true);
431 iDesc.
add<
bool>(
"addJetID",
true)->setComment(
"Add jet ID information");
434 iDesc.
add<
bool>(
"addPartonJetMatch",
false);
438 iDesc.
add<
bool>(
"addAssociatedTracks",
true);
442 iDesc.
add<
bool>(
"addTagInfos",
true);
443 std::vector<edm::InputTag> emptyVInputTags;
444 iDesc.
add<std::vector<edm::InputTag> >(
"tagInfoSources", emptyVInputTags);
447 iDesc.
add<
bool>(
"addJetCorrFactors",
true);
448 iDesc.
add<std::vector<edm::InputTag> >(
"jetCorrFactorsSource", emptyVInputTags);
451 iDesc.
add<
bool>(
"addBTagInfo",
true);
452 iDesc.
add<
bool>(
"addDiscriminators",
true);
453 iDesc.
add<std::vector<edm::InputTag> >(
"discriminatorSources", emptyVInputTags);
456 iDesc.
add<
bool>(
"getJetMCFlavour",
true);
464 iDesc.
add(
"efficiencies", efficienciesPSet);
465 iDesc.
add<
bool>(
"addEfficiencies",
false);
472 descriptions.
add(
"PATJetProducer", iDesc);
bool enabled() const
'true' if this there is at least one efficiency configured
void setJetID(reco::JetID const &id)
methods for jet ID
T getParameter(std::string const &) const
pat::helper::EfficiencyLoader efficiencyLoader_
Assists in assimilating all pat::UserData into pat objects.
void setGenParton(const reco::GenParticleRef &gp, bool embed=false)
method to set the matched parton
void setGenJetRef(const edm::FwdRef< reco::GenJetCollection > &gj)
method to set the matched generated jet reference, embedding if requested
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void addJECFactors(const JetCorrFactors &jec)
add more sets of energy correction factors
Jets made from CaloTowers.
std::vector< std::string > tagInfoLabels_
edm::InputTag trackAssociation_
bool addAssociatedTracks_
std::vector< edm::InputTag > tagInfoTags_
void setAllowAnything()
allow any parameter label/value pairs
pat::helper::KinResolutionsLoader resolutionLoader_
#define DEFINE_FWK_MODULE(type)
std::vector< GenJet > GenJetCollection
collection of GenJet objects
std::vector< std::string > discriminatorLabels_
edm::InputTag jetIDMapLabel_
const edm::RefToBase< reco::Jet > & getCaloJetRef() const
void setCaloTowers(const CaloTowerFwdPtrCollection &caloTowers)
method to store the CaloJet constituents internally
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
Jets made from PFObjects.
GreaterByPt< Jet > pTComparator_
void addTagInfo(const std::string &label, const TagInfoFwdPtrCollection::value_type &info)
edm::InputTag partonJetSrc_
bool enabled() const
'true' if this there is at least one efficiency configured
static void fillDescription(edm::ParameterSetDescription &iDesc)
PATJetProducer(const edm::ParameterSet &iConfig)
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
bool isNonnull() const
Checks for non-null.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< edm::InputTag > jetCorrFactorsSrc_
void setComment(std::string const &value)
Ptr< value_type > ptrAt(size_type i) const
void setAssociatedTracks(const reco::TrackRefVector &tracks)
method to set the vector of refs to the tracks associated to this jet
bool isNonnull() const
Checks for non-null.
void initializeJEC(unsigned int level, const JetCorrFactors::Flavor &flavor=JetCorrFactors::NONE, unsigned int set=0)
initialize the jet to a given JEC level during creation starting from Uncorrected ...
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Jets made from CaloJets corrected for ZSP and tracks.
Class for the storage of jet correction factors.
std::vector< edm::InputTag > discriminatorTags_
void setPartonFlavour(int partonFl)
method to set the flavour of the parton underlying the jet
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
RefProd< PROD > getRefBeforePut()
bool isPFJet() const
check to see if the jet is a reco::PFJet
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
pat::PATUserDataHelper< pat::Jet > userDataHelper_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
void setJetCharge(float jetCharge)
method to set the jet charge
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
std::vector< edm::FwdPtr< CaloTower > > CaloTowerFwdPtrCollection
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
void addBDiscriminatorPair(const std::pair< std::string, float > &thePair)
method to add a algolabel-discriminator pair
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
Analysis-level calorimeter jet class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void setPFCandidates(const PFCandidateFwdPtrCollection &pfCandidates)
method to store the PFCandidate constituents internally
edm::InputTag genPartonSrc_
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
const_iterator begin() const
bool embedGenPartonMatch_
const_iterator end() const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::InputTag jetPartonMapSource_
void newEvent(const edm::Event &event, const edm::EventSetup &setup) const
To be called for each new event, reads in the EventSetup object.
value_type const * get() const
void newEvent(const edm::Event &event) const
To be called for each new event, reads in the ValueMaps for efficiencies.