44 useUserData_(iConfig.exists(
"userData"))
49 if ( iConfig.
exists(
"embedCaloTowers") ) {
50 embedCaloTowers_ = iConfig.
getParameter<
bool>(
"embedCaloTowers" );
78 if (addEfficiencies_) {
86 if (discriminatorTags_.empty()) {
87 addDiscriminators_ =
false;
89 for (std::vector<edm::InputTag>::const_iterator it = discriminatorTags_.begin(), ed = discriminatorTags_.end(); it != ed; ++it) {
92 if ((pos != std::string::npos) && (pos != label.length() - 7)) {
98 if (tagInfoTags_.empty()) {
101 for (std::vector<edm::InputTag>::const_iterator it = tagInfoTags_.begin(), ed = tagInfoTags_.end(); it != ed; ++it) {
104 if ((pos != std::string::npos) && (pos != label.length() - 8)) {
110 if (!addBTagInfo_) { addDiscriminators_ =
false; addTagInfos_ =
false; }
116 produces<std::vector<Jet> >();
117 produces<reco::GenJetCollection> (
"genJets");
118 produces<std::vector<CaloTower> > (
"caloTowers");
119 produces<reco::PFCandidateCollection > (
"pfCandidates");
120 produces<edm::OwnVector<reco::BaseTagInfo> > (
"tagInfos");
163 std::vector<edm::ValueMap<JetCorrFactors> > jetCorrs;
168 jetCorrs.push_back( *jetCorr );
173 std::vector<edm::Handle<reco::JetFloatAssociation::Container> > jetDiscriminators;
180 std::vector<edm::Handle<edm::View<reco::BaseTagInfo> > > jetTagInfos;
199 std::auto_ptr< std::vector<Jet> >
patJets (
new std::vector<Jet>() );
202 std::auto_ptr<std::vector<CaloTower> > caloTowersOut(
new std::vector<CaloTower> () );
216 unsigned int idx = itJet - jets->begin();
225 if ( ajet.
isCaloJet()) cj = dynamic_cast<const reco::CaloJet *>(jetRef.
get());
232 for ( std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(), towEnd = itowers.end(), itow = towBegin; itow != towEnd; ++itow ) {
233 if( itow->isAvailable() && itow->isNonnull() ){
234 caloTowersOut->push_back( **itow );
237 edm::Ptr<CaloTower> caloForwardRef ( h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter() );
252 for ( std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
253 partEnd = iparticles.end(), ipart = partBegin;
254 ipart != partEnd; ++ipart ) {
255 pfCandidatesOut->push_back( **ipart );
275 std::vector<std::string> levels = jetCorrs[0][jetRef].correctionLabels();
276 if(
std::find(levels.begin(), levels.end(),
"L2L3Residual")!=levels.end()){
277 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L2L3Residual"));
279 else if(
std::find(levels.begin(), levels.end(),
"L3Absolute")!=levels.end()){
280 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L3Absolute"));
283 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"Uncorrected"));
285 edm::LogWarning(
"L3Absolute not found") <<
"L2L3Residual and L3Absolute are not part of the correction applied jetCorrFactors \n"
286 <<
"of module " << jetCorrs[0][jetRef].jecSet() <<
" jets will remain"
287 <<
" uncorrected."; first=
false;
307 genJetsOut->push_back( *genjet );
334 for (
size_t k=0;
k<jetDiscriminators.size(); ++
k) {
335 float value = (*jetDiscriminators[
k])[jetRef];
340 for (
size_t k=0;
k<jetTagInfos.size(); ++
k) {
345 if ((idx < taginfos.
size()) && (taginfos[idx].
jet() == jetRef)) {
346 match = taginfos.
ptrAt(idx);
350 if (itTI->jet() == jetRef) { match = taginfos.
ptrAt( itTI - taginfos.
begin() );
break; }
354 tagInfosOut->push_back( match->clone() );
385 patJets->push_back(ajet);
394 iEvent.
put( genJetsOut,
"genJets" );
395 iEvent.
put( caloTowersOut,
"caloTowers" );
396 iEvent.
put( pfCandidatesOut,
"pfCandidates" );
397 iEvent.
put( tagInfosOut,
"tagInfos" );
412 iDesc.
addOptional<
bool>(
"embedCaloTowers",
false)->setComment(
"embed external CaloTowers (not to be used on AOD input)");
413 iDesc.
add<
bool>(
"embedPFCandidates",
true)->setComment(
"embed external PFCandidates");
416 iDesc.
add<
bool>(
"addGenPartonMatch",
true)->setComment(
"add MC matching");
417 iDesc.
add<
bool>(
"embedGenPartonMatch",
false)->setComment(
"embed MC matched MC information");
420 iDesc.
add<
bool>(
"addGenJetMatch",
true)->setComment(
"add MC matching");
421 iDesc.
add<
bool>(
"embedGenJetMatch",
false)->setComment(
"embed MC matched MC information");
424 iDesc.
add<
bool>(
"addJetCharge",
true);
428 iDesc.
add<
bool>(
"addJetID",
true)->setComment(
"Add jet ID information");
431 iDesc.
add<
bool>(
"addPartonJetMatch",
false);
435 iDesc.
add<
bool>(
"addAssociatedTracks",
true);
439 iDesc.
add<
bool>(
"addTagInfos",
true);
440 std::vector<edm::InputTag> emptyVInputTags;
441 iDesc.
add<std::vector<edm::InputTag> >(
"tagInfoSources", emptyVInputTags);
444 iDesc.
add<
bool>(
"addJetCorrFactors",
true);
445 iDesc.
add<std::vector<edm::InputTag> >(
"jetCorrFactorsSource", emptyVInputTags);
448 iDesc.
add<
bool>(
"addBTagInfo",
true);
449 iDesc.
add<
bool>(
"addDiscriminators",
true);
450 iDesc.
add<std::vector<edm::InputTag> >(
"discriminatorSources", emptyVInputTags);
453 iDesc.
add<
bool>(
"getJetMCFlavour",
true);
461 iDesc.
add(
"efficiencies", efficienciesPSet);
462 iDesc.
add<
bool>(
"addEfficiencies",
false);
469 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_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::InputTag jetIDMapLabel_
const edm::RefToBase< reco::Jet > & getCaloJetRef() const
void setCaloTowers(const CaloTowerFwdPtrCollection &caloTowers)
method to store the CaloJet constituents internally
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.
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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)
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
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.