CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTJetCollectionsForBoostedLeptonPlusJets< jetType > Class Template Reference

#include <HLTJetCollectionsForBoostedLeptonPlusJets.h>

Inheritance diagram for HLTJetCollectionsForBoostedLeptonPlusJets< jetType >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTJetCollectionsForBoostedLeptonPlusJets (const edm::ParameterSet &)
 
 ~HLTJetCollectionsForBoostedLeptonPlusJets ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag hltLeptonTag
 
edm::EDGetTokenT< std::vector< jetType > > m_theJetToken
 
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefsm_theLeptonToken
 
double minDeltaR_
 
edm::InputTag sourceJetTag
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<typename jetType>
class HLTJetCollectionsForBoostedLeptonPlusJets< jetType >

This class is an EDProducer implementing an HLT trigger for lepton and jet objects, cutting on variables relating to the jet 4-momentum representation. The producer checks for overlaps between leptons and jets and if a combination of one lepton + jets cleaned against this leptons satisfy the cuts. These jets are then added to a cleaned jet collection which is put into the event.

Author
Lukasz Kreczko

Definition at line 40 of file HLTJetCollectionsForBoostedLeptonPlusJets.h.

Constructor & Destructor Documentation

template<typename jetType >
HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::HLTJetCollectionsForBoostedLeptonPlusJets ( const edm::ParameterSet iConfig)
explicit

Definition at line 25 of file HLTJetCollectionsForBoostedLeptonPlusJets.cc.

References HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::hltLeptonTag, objects.autophobj::jetType, HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::m_theJetToken, HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::m_theLeptonToken, and HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::sourceJetTag.

25  :
26  hltLeptonTag(iConfig.getParameter< edm::InputTag > ("HltLeptonTag")),
27  sourceJetTag(iConfig.getParameter< edm::InputTag > ("SourceJetTag")),
28  minDeltaR_(iConfig.getParameter< double > ("minDeltaR"))
29 {
30  using namespace edm;
31  using namespace std;
32 
33  typedef vector<RefVector<vector<jetType>,jetType,refhelper::FindUsingAdvance<vector<jetType>,jetType> > > JetCollectionVector;
34  typedef vector<jetType> JetCollection;
35 
36  m_theLeptonToken = consumes<trigger::TriggerFilterObjectWithRefs>(hltLeptonTag);
37  m_theJetToken = consumes<std::vector<jetType>>(sourceJetTag);
38  produces<JetCollectionVector>();
39  produces<JetCollection>();
40 }
T getParameter(std::string const &) const
std::vector< Jet > JetCollection
Definition: Jet.h:53
edm::EDGetTokenT< std::vector< jetType > > m_theJetToken
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theLeptonToken
HLT enums.

Definition at line 43 of file HLTJetCollectionsForBoostedLeptonPlusJets.cc.

44 {
45  // do anything here that needs to be done at desctruction time
46  // (e.g. close files, deallocate resources etc.)
47 
48 }

Member Function Documentation

template<typename jetType >
void HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 52 of file HLTJetCollectionsForBoostedLeptonPlusJets.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and defaultModuleLabel().

52  {
54  desc.add<edm::InputTag> ("HltLeptonTag", edm::InputTag("triggerFilterObjectWithRefs"));
55  //(2)
56  desc.add<edm::InputTag> ("SourceJetTag", edm::InputTag("jetCollection"));
57  //(2)
58  desc.add<double> ("minDeltaR", 0.5);
60 }
std::string defaultModuleLabel()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename jetType >
void HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 71 of file HLTJetCollectionsForBoostedLeptonPlusJets.cc.

References deltaR(), spr::find(), edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), metsig::jet, fwrapper::jets, objects.autophobj::jetType, HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::m_theJetToken, HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::m_theLeptonToken, HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::minDeltaR_, eostools::move(), edm::Event::put(), trigger::TriggerCluster, trigger::TriggerElectron, trigger::TriggerMuon, and trigger::TriggerPhoton.

72 {
73  using namespace edm;
74  using namespace std;
75  //(3)
76  using namespace reco;
77  //(3)
78  typedef vector<RefVector<vector<jetType>,jetType,refhelper::FindUsingAdvance<vector<jetType>,jetType> > > JetCollectionVector;
79  typedef vector<jetType> JetCollection;
82 
84  iEvent.getByToken(m_theLeptonToken,PrevFilterOutput);
85 
86  //its easier on the if statement flow if I try everything at once, shouldnt add to timing
87  // Electrons can be stored as objects of types TriggerCluster, TriggerElectron, or TriggerPhoton
88  vector<reco::RecoChargedCandidateRef> muonCands;
89  PrevFilterOutput->getObjects(trigger::TriggerMuon,muonCands);
90 
91  vector<Ref<reco::ElectronCollection> > eleCands;
92  PrevFilterOutput->getObjects(trigger::TriggerElectron,eleCands);
93 
94  trigger::VRphoton photonCands;
95  PrevFilterOutput->getObjects(trigger::TriggerPhoton, photonCands);
96 
97  vector<Ref<reco::RecoEcalCandidateCollection> > clusCands;
98  PrevFilterOutput->getObjects(trigger::TriggerCluster,clusCands);
99 
100  Handle<JetCollection> theJetCollectionHandle;
101  iEvent.getByToken(m_theJetToken, theJetCollectionHandle);
102 
103  typename JetCollection::const_iterator jet;
104 
105  unique_ptr<JetCollection> allSelections(new JetCollection);
106  unique_ptr<JetCollectionVector> product(new JetCollectionVector);
107 
108  std::vector<size_t> usedCands;
109 
110  if(!muonCands.empty()){ // muons
111  for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
112  //const jetType* referenceJet = &*jet;
113  jetType cleanedJet = *jet; //copy original jet
114  for(size_t candNr=0;candNr<muonCands.size();candNr++){
115  if (std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end()) continue;
116  if (deltaR((*muonCands[candNr]),cleanedJet) <= minDeltaR_) {
117  std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
118  for(std::vector<edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
119  if (deltaR((*muonCands[candNr]),(**i_candidate))<0.001) {
120  cleanedJet.setP4( cleanedJet.p4() - muonCands[candNr]->p4());
121  usedCands.push_back(candNr);
122  break;
123  }//if constituent matched
124  }//for constituents
125  }//if dR<min
126  }//for cands
127  allSelections->push_back(cleanedJet);
128  }//for jets
129  }//if cands
130 
131  if(!eleCands.empty()){ // electrons
132  for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
133  //const jetType* referenceJet = &*jet;
134  jetType cleanedJet = *jet; //copy original jet
135  for(size_t candNr=0;candNr<eleCands.size();candNr++){
136  if (std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end()) continue;
137  if (deltaR((*eleCands[candNr]),cleanedJet) <= minDeltaR_) {
138  std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
139  for(std::vector<edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
140  if (deltaR((*eleCands[candNr]),(**i_candidate))<0.001) {
141  cleanedJet.setP4( cleanedJet.p4() - eleCands[candNr]->p4());
142  usedCands.push_back(candNr);
143  break;
144  }//if constituent matched
145  }//for constituents
146  }//if dR<min
147  }//for cands
148  allSelections->push_back(cleanedJet);
149  }//for jets
150  }//if cands
151 
152  if(!photonCands.empty()){ // photons
153  for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
154  //const jetType* referenceJet = &*jet;
155  jetType cleanedJet = *jet; //copy original jet
156  for(size_t candNr=0;candNr<photonCands.size();candNr++){
157  if (std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end()) continue;
158  if (deltaR((*photonCands[candNr]),cleanedJet) <= minDeltaR_) {
159  std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
160  for(std::vector<edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
161  if (deltaR((*photonCands[candNr]),(**i_candidate))<0.001) {
162  cleanedJet.setP4( cleanedJet.p4() - photonCands[candNr]->p4());
163  usedCands.push_back(candNr);
164  break;
165  }//if constituent matched
166  }//for constituents
167  }//if dR<min
168  }//for cands
169  allSelections->push_back(cleanedJet);
170  }//for jets
171  }//if cands
172 
173  if(!clusCands.empty()){ // trigger clusters
174  for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
175  //const jetType* referenceJet = &*jet;
176  jetType cleanedJet = *jet; //copy original jet
177  for(size_t candNr=0;candNr<clusCands.size();candNr++){
178  if (std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end()) continue;
179  if (deltaR((*clusCands[candNr]),cleanedJet) <= minDeltaR_) {
180  std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
181  for(std::vector<edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
182  if (deltaR((*clusCands[candNr]),(**i_candidate))<0.001) {
183  cleanedJet.setP4( cleanedJet.p4() - clusCands[candNr]->p4());
184  usedCands.push_back(candNr);
185  break;
186  }//if constituent matched
187  }//for constituents
188  }//if dR<min
189  }//for cands
190  allSelections->push_back(cleanedJet);
191  }//for jets
192  }//if cands
193 
195  // reorder cleaned jets
196  std::sort (allSelections->begin(), allSelections->end(), compJets);
197  edm::OrphanHandle<JetCollection> cleanedJetHandle = iEvent.put(std::move(allSelections));
198 
199  JetCollection const & jets = *cleanedJetHandle;
200 
201  JetRefVector cleanedJetRefs;
202 
203  for (unsigned iJet = 0; iJet < jets.size(); ++iJet) {
204  cleanedJetRefs.push_back(JetRef(cleanedJetHandle, iJet));
205  }
206 
207  product->emplace_back(cleanedJetRefs);
208  iEvent.put(std::move(product));
209 
210  return;
211 
212 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
std::vector< Jet > JetCollection
Definition: Jet.h:53
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< std::vector< jetType > > m_theJetToken
edm::RefVector< JetBxCollection > JetRefVector
Definition: Jet.h:13
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
edm::Ref< JetBxCollection > JetRef
Definition: Jet.h:12
vector< PseudoJet > jets
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theLeptonToken
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
fixed size matrix
HLT enums.
std::vector< reco::RecoEcalCandidateRef > VRphoton
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<typename jetType >
edm::InputTag HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::hltLeptonTag
private
template<typename jetType >
edm::EDGetTokenT<std::vector<jetType> > HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::m_theJetToken
private
template<typename jetType >
edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::m_theLeptonToken
private
template<typename jetType >
double HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::minDeltaR_
private
template<typename jetType >
edm::InputTag HLTJetCollectionsForBoostedLeptonPlusJets< jetType >::sourceJetTag
private