CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::PATJetSlimmer Class Reference

Matcher of reconstructed objects to L1 Muons. More...

Inheritance diagram for pat::PATJetSlimmer:
edm::stream::EDProducer<>

Public Member Functions

 PATJetSlimmer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATJetSlimmer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

const StringCutObjectSelector< pat::JetdropDaughters_
 
const StringCutObjectSelector< pat::JetdropJetVars_
 
const StringCutObjectSelector< pat::JetdropSpecific_
 
const StringCutObjectSelector< pat::JetdropTagInfos_
 
const StringCutObjectSelector< pat::JetdropTrackRefs_
 
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
 
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
 
const bool mayNeedDaughterMap_
 
const bool mixedDaughters_
 
const bool modifyJet_
 
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
 
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > pf2pcAny_
 
const StringCutObjectSelector< pat::JetrekeyDaughters_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Matcher of reconstructed objects to L1 Muons.

Author
Giovanni Petrucciani

Definition at line 26 of file PATJetSlimmer.cc.

Constructor & Destructor Documentation

◆ PATJetSlimmer()

pat::PATJetSlimmer::PATJetSlimmer ( const edm::ParameterSet iConfig)
explicit

Definition at line 45 of file PATJetSlimmer.cc.

References edm::ParameterSet::getParameter(), jetModifier_, mayNeedDaughterMap_, mixedDaughters_, modifyJet_, pf2pc_, and pf2pcAny_.

46  : jets_(consumes<edm::View<pat::Jet>>(iConfig.getParameter<edm::InputTag>("src"))),
47  dropJetVars_(iConfig.getParameter<std::string>("dropJetVars")),
48  dropDaughters_(iConfig.getParameter<std::string>("dropDaughters")),
49  rekeyDaughters_(iConfig.getParameter<std::string>("rekeyDaughters")),
50  dropTrackRefs_(iConfig.getParameter<std::string>("dropTrackRefs")),
51  dropSpecific_(iConfig.getParameter<std::string>("dropSpecific")),
52  dropTagInfos_(iConfig.getParameter<std::string>("dropTagInfos")),
53  modifyJet_(iConfig.getParameter<bool>("modifyJets")),
54  mayNeedDaughterMap_(iConfig.getParameter<std::string>("dropDaughters") != "1" &&
55  iConfig.getParameter<std::string>("rekeyDaughters") != "0"),
56  mixedDaughters_(iConfig.getParameter<bool>("mixedDaughters")) {
57  if (mayNeedDaughterMap_) {
58  if (mixedDaughters_) {
59  pf2pcAny_ =
60  consumes<edm::ValueMap<reco::CandidatePtr>>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
61  } else {
62  pf2pc_ = consumes<edm::Association<pat::PackedCandidateCollection>>(
63  iConfig.getParameter<edm::InputTag>("packedPFCandidates"));
64  }
65  }
66  if (modifyJet_) {
67  const edm::ParameterSet& mod_config = iConfig.getParameter<edm::ParameterSet>("modifierConfig");
68  jetModifier_ = std::make_unique<pat::ObjectModifier<pat::Jet>>(mod_config, consumesCollector());
69  }
70  produces<std::vector<pat::Jet>>();
71 }
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
const StringCutObjectSelector< pat::Jet > dropDaughters_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
const StringCutObjectSelector< pat::Jet > dropTrackRefs_
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > pf2pcAny_
const bool mayNeedDaughterMap_
const bool modifyJet_
const StringCutObjectSelector< pat::Jet > dropSpecific_
const StringCutObjectSelector< pat::Jet > dropTagInfos_
const StringCutObjectSelector< pat::Jet > rekeyDaughters_
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
const StringCutObjectSelector< pat::Jet > dropJetVars_
const bool mixedDaughters_

◆ ~PATJetSlimmer()

pat::PATJetSlimmer::~PATJetSlimmer ( )
inlineoverride

Definition at line 29 of file PATJetSlimmer.cc.

29 {}

Member Function Documentation

◆ produce()

void pat::PATJetSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 73 of file PATJetSlimmer.cc.

References mps_fire::i, iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, metsig::jet, submitPVResolutionJobs::key, eostools::move(), MillePedeFileConverter_cfg::out, edm::refToPtr(), jetUpdater_cfi::sort, and TrackRefitter_38T_cff::src.

73  {
74  using namespace edm;
75  using namespace std;
76 
77  if (modifyJet_)
78  jetModifier_->setEventContent(iSetup);
79 
81  iEvent.getByToken(jets_, src);
84  if (mayNeedDaughterMap_) {
85  if (mixedDaughters_) {
86  iEvent.getByToken(pf2pcAny_, pf2pcAny);
87  } else {
88  iEvent.getByToken(pf2pc_, pf2pc);
89  }
90  }
91 
92  auto out = std::make_unique<std::vector<pat::Jet>>();
93  out->reserve(src->size());
94 
95  if (modifyJet_) {
96  jetModifier_->setEvent(iEvent);
97  }
98 
99  for (edm::View<pat::Jet>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
100  out->push_back(*it);
101  pat::Jet& jet = out->back();
102 
103  if (modifyJet_) {
104  jetModifier_->modify(jet);
105  }
106 
107  if (dropTagInfos_(*it)) {
108  jet.tagInfoLabels_.clear();
109  jet.tagInfos_.clear();
110  jet.tagInfosFwdPtr_.clear();
111  }
112  if (dropJetVars_(*it)) {
113  // jet.setJetArea(0);
114  jet.setNPasses(0);
115  // jet.setPileup(0);
116  }
117  if (dropTrackRefs_(*it)) {
118  jet.setAssociatedTracks(reco::TrackRefVector());
119  }
120  if (dropDaughters_(*it)) {
121  jet.clearDaughters();
122  jet.pfCandidatesFwdPtr_.clear();
123  jet.caloTowersFwdPtr_.clear();
124  } else if (rekeyDaughters_(*it)) { //rekey
125  //copy old
126  reco::CompositePtrCandidate::daughters old = jet.daughterPtrVector();
127  jet.clearDaughters();
128  if (mixedDaughters_) {
129  std::vector<reco::CandidatePtr> ptrs;
130  for (const reco::CandidatePtr& oldptr : old) {
131  ptrs.push_back((*pf2pcAny)[oldptr]);
132  }
133  std::sort(ptrs.begin(), ptrs.end());
134  for (const reco::CandidatePtr& newptr : ptrs) {
135  jet.addDaughter(newptr);
136  }
137  } else {
138  std::map<unsigned int, reco::CandidatePtr> ptrs;
139  for (unsigned int i = 0; i < old.size(); i++) {
140  // jet.addDaughter(refToPtr((*pf2pc)[old[i]]));
141  ptrs[((*pf2pc)[old[i]]).key()] = refToPtr((*pf2pc)[old[i]]);
142  }
143  for (std::map<unsigned int, reco::CandidatePtr>::iterator itp = ptrs.begin(); itp != ptrs.end();
144  itp++) //iterate on sorted items
145  {
146  jet.addDaughter(itp->second);
147  }
148  }
149  }
150  if (dropSpecific_(*it)) {
151  // FIXME add method in pat::Jet
152  jet.specificCalo_.clear();
153  jet.specificPF_.clear();
154  }
155  // if (dropJetCorrFactors_(*it)) {
156  // // FIXME add method in pat::Jet
157  // jet.jetEnergyCorrections_.clear();
158  // }
159  }
160 
161  iEvent.put(std::move(out));
162 }
std::unique_ptr< pat::ObjectModifier< pat::Jet > > jetModifier_
const StringCutObjectSelector< pat::Jet > dropDaughters_
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
const StringCutObjectSelector< pat::Jet > dropTrackRefs_
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > pf2pcAny_
const bool mayNeedDaughterMap_
const bool modifyJet_
int iEvent
Definition: GenABIO.cc:224
const StringCutObjectSelector< pat::Jet > dropSpecific_
const StringCutObjectSelector< pat::Jet > dropTagInfos_
key
prepare the HTCondor submission files and eventually submit them
std::vector< CandidatePtr > daughters
collection of references to daughters
const StringCutObjectSelector< pat::Jet > rekeyDaughters_
Analysis-level calorimeter jet class.
Definition: Jet.h:77
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
const StringCutObjectSelector< pat::Jet > dropJetVars_
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
const bool mixedDaughters_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ dropDaughters_

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropDaughters_
private

Definition at line 37 of file PATJetSlimmer.cc.

◆ dropJetVars_

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropJetVars_
private

Definition at line 37 of file PATJetSlimmer.cc.

◆ dropSpecific_

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropSpecific_
private

Definition at line 37 of file PATJetSlimmer.cc.

◆ dropTagInfos_

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropTagInfos_
private

Definition at line 37 of file PATJetSlimmer.cc.

◆ dropTrackRefs_

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::dropTrackRefs_
private

Definition at line 37 of file PATJetSlimmer.cc.

◆ jetModifier_

std::unique_ptr<pat::ObjectModifier<pat::Jet> > pat::PATJetSlimmer::jetModifier_
private

Definition at line 40 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ jets_

const edm::EDGetTokenT<edm::View<pat::Jet> > pat::PATJetSlimmer::jets_
private

Definition at line 36 of file PATJetSlimmer.cc.

◆ mayNeedDaughterMap_

const bool pat::PATJetSlimmer::mayNeedDaughterMap_
private

Definition at line 39 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ mixedDaughters_

const bool pat::PATJetSlimmer::mixedDaughters_
private

Definition at line 39 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ modifyJet_

const bool pat::PATJetSlimmer::modifyJet_
private

Definition at line 39 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ pf2pc_

edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > pat::PATJetSlimmer::pf2pc_
private

Definition at line 34 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ pf2pcAny_

edm::EDGetTokenT<edm::ValueMap<reco::CandidatePtr> > pat::PATJetSlimmer::pf2pcAny_
private

Definition at line 35 of file PATJetSlimmer.cc.

Referenced by PATJetSlimmer().

◆ rekeyDaughters_

const StringCutObjectSelector<pat::Jet> pat::PATJetSlimmer::rekeyDaughters_
private

Definition at line 37 of file PATJetSlimmer.cc.