CMS 3D CMS Logo

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

#include <HLTJetCollForElePlusJets.h>

Inheritance diagram for HLTJetCollForElePlusJets< T >:
edm::stream::EDProducer<>

Public Member Functions

 HLTJetCollForElePlusJets (const edm::ParameterSet &)
 
 ~HLTJetCollForElePlusJets () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

edm::InputTag hltElectronTag
 
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefsm_theElectronToken
 
edm::EDGetTokenT< std::vector< T > > m_theJetToken
 
double maxAbsJetEta_
 
double minDeltaEta_
 
double minDeltaR_
 
double minJetPt_
 
unsigned int minNJets_
 
double minSoftJetPt_
 
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
 

Detailed Description

template<typename T>
class HLTJetCollForElePlusJets< T >

This class is an EDProducer implementing an HLT trigger for electron and jet objects, cutting on variables relating to the jet 4-momentum representation. The producer checks for overlaps between electrons and jets and if a combination of one electron + jets cleaned against this electrons 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 41 of file HLTJetCollForElePlusJets.h.

Constructor & Destructor Documentation

template<typename T >
HLTJetCollForElePlusJets< T >::HLTJetCollForElePlusJets ( const edm::ParameterSet iConfig)
explicit

Definition at line 15 of file HLTJetCollForElePlusJets.cc.

References HLTJetCollForElePlusJets< T >::hltElectronTag, HLTJetCollForElePlusJets< T >::m_theElectronToken, HLTJetCollForElePlusJets< T >::m_theJetToken, and HLTJetCollForElePlusJets< T >::sourceJetTag.

15  :
16  hltElectronTag(iConfig.getParameter< edm::InputTag > ("HltElectronTag")),
17  sourceJetTag(iConfig.getParameter< edm::InputTag > ("SourceJetTag")),
18  minJetPt_(iConfig.getParameter<double> ("MinJetPt")),
19  maxAbsJetEta_(iConfig.getParameter<double> ("MaxAbsJetEta")),
20  minNJets_(iConfig.getParameter<unsigned int> ("MinNJets")),
21  minDeltaR_(iConfig.getParameter< double > ("minDeltaR")),
22  //Only for VBF
23  minSoftJetPt_(iConfig.getParameter< double > ("MinSoftJetPt")),
24  minDeltaEta_(iConfig.getParameter< double > ("MinDeltaEta"))
25 {
26  typedef std::vector<T> TCollection;
27  m_theElectronToken = consumes<trigger::TriggerFilterObjectWithRefs>(hltElectronTag);
28  m_theJetToken = consumes<TCollection>(sourceJetTag);
29  produces<TCollection>();
30 }
T getParameter(std::string const &) const
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theElectronToken
edm::EDGetTokenT< std::vector< T > > m_theJetToken
template<typename T >
HLTJetCollForElePlusJets< T >::~HLTJetCollForElePlusJets ( )
override

Definition at line 34 of file HLTJetCollForElePlusJets.cc.

35 {
36  // do anything here that needs to be done at desctruction time
37  // (e.g. close files, deallocate resources etc.)
38 
39 }

Member Function Documentation

template<typename T >
void HLTJetCollForElePlusJets< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 42 of file HLTJetCollForElePlusJets.cc.

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

42  {
44  desc.add<edm::InputTag> ("HltElectronTag", edm::InputTag("triggerFilterObjectWithRefs"));
45  desc.add<edm::InputTag> ("SourceJetTag", edm::InputTag("jetCollection"));
46  desc.add<double> ("MinJetPt", 30.);
47  desc.add<double> ("MaxAbsJetEta", 2.6);
48  desc.add<unsigned int> ("MinNJets", 1);
49  desc.add<double> ("minDeltaR", 0.5);
50  //Only for VBF
51  desc.add<double> ("MinSoftJetPt", 25.);
52  desc.add<double> ("MinDeltaEta", -1.);
53  descriptions.add(defaultModuleLabel<HLTJetCollForElePlusJets<T>>(), desc);
54 }
std::string defaultModuleLabel()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename T >
void HLTJetCollForElePlusJets< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 64 of file HLTJetCollForElePlusJets.cc.

References funct::abs(), edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), gen::k, HLTJetCollForElePlusJets< T >::m_theElectronToken, HLTJetCollForElePlusJets< T >::m_theJetToken, HLTJetCollForElePlusJets< T >::maxAbsJetEta_, HLTJetCollForElePlusJets< T >::minDeltaEta_, HLTJetCollForElePlusJets< T >::minDeltaR_, HLTJetCollForElePlusJets< T >::minJetPt_, HLTJetCollForElePlusJets< T >::minNJets_, HLTJetCollForElePlusJets< T >::minSoftJetPt_, eostools::move(), edm::Event::put(), trigger::TriggerCluster, trigger::TriggerElectron, trigger::TriggerPhoton, and tier0::unique().

65 {
66  using namespace edm;
67  using namespace std;
68 
69  typedef vector<T> TCollection;
70  typedef Ref<TCollection> TRef;
71  typedef edm::RefVector<TCollection> TRefVector;
72  typedef std::vector<edm::RefVector<std::vector<T>,T,edm::refhelper::FindUsingAdvance<std::vector<T>,T> > > TCollectionVector;
73 
75  iEvent.getByToken(m_theElectronToken,PrevFilterOutput);
76 
77  //its easier on the if statement flow if I try everything at once, shouldnt add to timing
78  // Electrons can be stored as objects of types TriggerCluster, TriggerElectron, or TriggerPhoton
79  std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
80  PrevFilterOutput->getObjects(trigger::TriggerCluster,clusCands);
81 
82  std::vector<edm::Ref<reco::ElectronCollection> > eleCands;
83  PrevFilterOutput->getObjects(trigger::TriggerElectron,eleCands);
84 
85  trigger::VRphoton photonCands;
86  PrevFilterOutput->getObjects(trigger::TriggerPhoton, photonCands);
87 
88  //prepare the collection of 3-D vector for electron momenta
89  std::vector<TVector3> ElePs;
90 
91  if(!clusCands.empty()){ //try trigger cluster
92  for(auto & clusCand : clusCands){
93  TVector3 positionVector(
94  clusCand->superCluster()->position().x(),
95  clusCand->superCluster()->position().y(),
96  clusCand->superCluster()->position().z());
97  ElePs.push_back(positionVector);
98  }
99  }else if(!eleCands.empty()){ // try trigger electrons
100  for(auto & eleCand : eleCands){
101  TVector3 positionVector(
102  eleCand->superCluster()->position().x(),
103  eleCand->superCluster()->position().y(),
104  eleCand->superCluster()->position().z());
105  ElePs.push_back(positionVector);
106  }
107  }
108  else if(!photonCands.empty()){ // try trigger photons
109  for(auto & photonCand : photonCands){
110  TVector3 positionVector(
111  photonCand->superCluster()->position().x(),
112  photonCand->superCluster()->position().y(),
113  photonCand->superCluster()->position().z());
114  ElePs.push_back(positionVector);
115  }
116  }
117 
118  edm::Handle<TCollection> theJetCollectionHandle;
119  iEvent.getByToken(m_theJetToken, theJetCollectionHandle);
120 
121  const TCollection & theJetCollection = *theJetCollectionHandle;
122 
123  std::unique_ptr< TCollection > theFilteredJetCollection(new TCollection);
124 
125  std::unique_ptr < TCollectionVector > allSelections(new TCollectionVector());
126 
127  bool foundSolution(false);
128 
129  for (auto & EleP : ElePs) {
130 
131  bool VBFJetPair = false;
132  std::vector<int> store_jet;
133  TRefVector refVector;
134 
135  for (unsigned int j = 0; j < theJetCollection.size(); j++) {
136  TVector3 JetP(theJetCollection[j].px(), theJetCollection[j].py(),
137  theJetCollection[j].pz());
138  double DR = EleP.DeltaR(JetP);
139 
140  if (JetP.Pt() > minJetPt_ && std::abs(JetP.Eta()) < maxAbsJetEta_ && DR > minDeltaR_) {
141  store_jet.push_back(j);
142  // The VBF part of the filter
143  if ( minDeltaEta_ > 0 ) {
144  for ( unsigned int k = j+1; k < theJetCollection.size(); k++ ) {
145  TVector3 SoftJetP(theJetCollection[k].px(), theJetCollection[k].py(),
146  theJetCollection[k].pz());
147  double softDR = EleP.DeltaR(SoftJetP);
148 
149  if (SoftJetP.Pt() > minSoftJetPt_ && std::abs(SoftJetP.Eta()) < maxAbsJetEta_ && softDR > minDeltaR_)
150  if ( std::abs(SoftJetP.Eta() - JetP.Eta()) > minDeltaEta_ ) {
151  store_jet.push_back(k);
152  VBFJetPair = true;
153  }
154  }
155  }
156  }
157 
158  }
159 
160  // Now remove duplicates from the jet collection to store
161  std::sort( store_jet.begin(), store_jet.end() );
162  store_jet.erase( unique( store_jet.begin(), store_jet.end() ), store_jet.end() );
163 
164  // Now save the cleaned jets
165  for (int & ijet : store_jet)
166  {
167  //store all selections
168  refVector.push_back(TRef(theJetCollectionHandle, ijet));
169  //store first selection which matches the criteria
170  if(!foundSolution)
171  theFilteredJetCollection->push_back(theJetCollection[ijet]);
172  }
173  //store all selections
174  allSelections->push_back(refVector);
175 
176  if (theFilteredJetCollection->size() >= minNJets_ && minDeltaEta_ < 0)
177  foundSolution = true;
178  else if (VBFJetPair && minDeltaEta_ > 0)
179  foundSolution = true;
180  else if (!foundSolution)
181  theFilteredJetCollection->clear();
182 
183 
184  }
185 
186  iEvent.put(std::move(theFilteredJetCollection));
187 
188  return;
189 
190 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theElectronToken
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< std::vector< T > > m_theJetToken
def unique(seq, keepstr=True)
Definition: tier0.py:24
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
HLT enums.
long double T
std::vector< reco::RecoEcalCandidateRef > VRphoton
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<typename T >
edm::InputTag HLTJetCollForElePlusJets< T >::hltElectronTag
private
template<typename T >
edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> HLTJetCollForElePlusJets< T >::m_theElectronToken
private
template<typename T >
edm::EDGetTokenT<std::vector<T> > HLTJetCollForElePlusJets< T >::m_theJetToken
private
template<typename T >
double HLTJetCollForElePlusJets< T >::maxAbsJetEta_
private

Definition at line 56 of file HLTJetCollForElePlusJets.h.

Referenced by HLTJetCollForElePlusJets< T >::produce().

template<typename T >
double HLTJetCollForElePlusJets< T >::minDeltaEta_
private

Definition at line 62 of file HLTJetCollForElePlusJets.h.

Referenced by HLTJetCollForElePlusJets< T >::produce().

template<typename T >
double HLTJetCollForElePlusJets< T >::minDeltaR_
private

Definition at line 59 of file HLTJetCollForElePlusJets.h.

Referenced by HLTJetCollForElePlusJets< T >::produce().

template<typename T >
double HLTJetCollForElePlusJets< T >::minJetPt_
private

Definition at line 55 of file HLTJetCollForElePlusJets.h.

Referenced by HLTJetCollForElePlusJets< T >::produce().

template<typename T >
unsigned int HLTJetCollForElePlusJets< T >::minNJets_
private

Definition at line 57 of file HLTJetCollForElePlusJets.h.

Referenced by HLTJetCollForElePlusJets< T >::produce().

template<typename T >
double HLTJetCollForElePlusJets< T >::minSoftJetPt_
private

Definition at line 61 of file HLTJetCollForElePlusJets.h.

Referenced by HLTJetCollForElePlusJets< T >::produce().

template<typename T >
edm::InputTag HLTJetCollForElePlusJets< T >::sourceJetTag
private