CMS 3D CMS Logo

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

#include <HLTAlphaTFilter.h>

Inheritance diagram for HLTAlphaTFilter< T >:
HLTFilter edm::global::EDFilter<> edm::global::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTAlphaTFilter (const edm::ParameterSet &)
 
bool hltFilter (edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
 
 ~HLTAlphaTFilter () override
 
- Public Member Functions inherited from HLTFilter
 HLTFilter (const edm::ParameterSet &config)
 
int module (edm::Event const &) const
 
const std::string * moduleLabel () const
 
int path (edm::Event const &) const
 
const std::string * pathName (edm::Event const &) const
 
std::pair< int, int > pmid (edm::Event const &) const
 
bool saveTags () const
 
 ~HLTFilter () override
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from HLTFilter
static void makeHLTFilterDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::global::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool dynamicAlphaT_
 
std::vector< double > etaJet_
 
edm::InputTag inputJetTag_
 
edm::InputTag inputJetTagFastJet_
 
edm::EDGetTokenT< std::vector< T > > m_theFastJetToken
 
edm::EDGetTokenT< std::vector< T > > m_theRecoJetToken
 
unsigned int maxNJets_
 
double minAlphaT_
 
double minHt_
 
std::vector< double > minPtJet_
 
bool setDHtZero_
 
int triggerType_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 T>
class HLTAlphaTFilter< T >

Author
Bryn Mathias Adam Elwood
Bryn Mathias Mark Baber, Adam Elwood

Filter for the AlphaT SUSY analysis Makes a trigger decision based on the event HT and the AlphaT value. AlphaT cut is chosen to reject all the QCD background

Definition at line 27 of file HLTAlphaTFilter.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file HLTAlphaTFilter.cc.

References HLTAlphaTFilter< T >::dynamicAlphaT_, HLTAlphaTFilter< T >::etaJet_, edm::ParameterSet::getParameter(), HLTAlphaTFilter< T >::inputJetTag_, HLTAlphaTFilter< T >::inputJetTagFastJet_, HLTAlphaTFilter< T >::m_theFastJetToken, HLTAlphaTFilter< T >::m_theRecoJetToken, HLTAlphaTFilter< T >::maxNJets_, HLTAlphaTFilter< T >::minAlphaT_, HLTAlphaTFilter< T >::minHt_, HLTAlphaTFilter< T >::minPtJet_, HLTAlphaTFilter< T >::setDHtZero_, HLTAlphaTFilter< T >::triggerType_, and HLTAlphaTFilter< T >::~HLTAlphaTFilter().

34  : HLTFilter(iConfig)
35 {
36  inputJetTag_ = iConfig.getParameter< edm::InputTag > ("inputJetTag");
37  inputJetTagFastJet_ = iConfig.getParameter< edm::InputTag > ("inputJetTagFastJet");
38  minPtJet_ = iConfig.getParameter<std::vector<double> > ("minPtJet");
39  etaJet_ = iConfig.getParameter<std::vector<double> > ("etaJet");
40  maxNJets_ = iConfig.getParameter<unsigned int> ("maxNJets");
41  minHt_ = iConfig.getParameter<double> ("minHt");
42  minAlphaT_ = iConfig.getParameter<double> ("minAlphaT");
43  triggerType_ = iConfig.getParameter<int>("triggerType");
44  dynamicAlphaT_ = iConfig.getParameter<bool>("dynamicAlphaT");
45  setDHtZero_ = iConfig.getParameter<bool>("setDHtZero");
46  // sanity checks
47 
48  if ( (minPtJet_.size() != etaJet_.size())
49  || ( (minPtJet_.empty()) || (etaJet_.empty()) )
50  || ( ((minPtJet_.size()<2) || (etaJet_.size()<2))))
51  {
52  edm::LogError("HLTAlphaTFilter") << "inconsistent module configuration!";
53  }
54 
55  //register your products
56  m_theRecoJetToken = consumes<std::vector<T>>(inputJetTag_);
57  m_theFastJetToken = consumes<std::vector<T>>(inputJetTagFastJet_);
58 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< T > > m_theRecoJetToken
edm::InputTag inputJetTagFastJet_
edm::InputTag inputJetTag_
edm::EDGetTokenT< std::vector< T > > m_theFastJetToken
HLTFilter(const edm::ParameterSet &config)
Definition: HLTFilter.cc:20
std::vector< double > minPtJet_
std::vector< double > etaJet_
unsigned int maxNJets_
template<typename T >
HLTAlphaTFilter< T >::~HLTAlphaTFilter ( )
overridedefault

Member Function Documentation

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

Definition at line 64 of file HLTAlphaTFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), defaultModuleLabel(), HLTFilter::makeHLTFilterDescription(), and trigger::TriggerJet.

64  {
67  desc.add<edm::InputTag>("inputJetTag",edm::InputTag("hltMCJetCorJetIcone5HF07"));
68  desc.add<edm::InputTag>("inputJetTagFastJet",edm::InputTag("hltMCJetCorJetIcone5HF07"));
69 
70  {
71  std::vector<double> temp1;
72  temp1.reserve(2);
73  temp1.push_back(20.0);
74  temp1.push_back(20.0);
75  desc.add<std::vector<double> >("minPtJet",temp1);
76  }
77  desc.add<int>("minNJet",0);
78  {
79  std::vector<double> temp1;
80  temp1.reserve(2);
81  temp1.push_back(9999.0);
82  temp1.push_back(9999.0);
83  desc.add<std::vector<double> >("etaJet",temp1);
84  }
85  desc.add<unsigned int>("maxNJets",32);
86  desc.add<double>("minHt",0.0);
87  desc.add<double>("minAlphaT",0.0);
88  desc.add<int>("triggerType",trigger::TriggerJet);
89  desc.add<bool>("dynamicAlphaT",true); //Set to reproduce old behaviour
90  desc.add<bool>("setDHtZero",false); //Set to reproduce old behaviour
91  descriptions.add(defaultModuleLabel<HLTAlphaTFilter<T>>(), desc);
92 }
std::string defaultModuleLabel()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename T >
bool HLTAlphaTFilter< T >::hltFilter ( edm::Event iEvent,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) const
overridevirtual

Implements HLTFilter.

Definition at line 98 of file HLTAlphaTFilter.cc.

References funct::abs(), accept(), trigger::TriggerFilterObjectWithRefs::addCollectionTag(), trigger::TriggerRefsCollections::addObject(), SoftLeptonByDistance_cfi::distance, HLTAlphaTFilter< T >::dynamicAlphaT_, HLTAlphaTFilter< T >::etaJet_, RemoveAddSevLevel::flag, edm::Event::getByToken(), HLTAlphaTFilter< T >::inputJetTag_, fwrapper::jets, HLTAlphaTFilter< T >::m_theFastJetToken, HLTAlphaTFilter< T >::m_theRecoJetToken, HLTAlphaTFilter< T >::maxNJets_, HLTAlphaTFilter< T >::minAlphaT_, HLTAlphaTFilter< T >::minHt_, HLTAlphaTFilter< T >::minPtJet_, gen::n, HLTFilter::saveTags(), HLTAlphaTFilter< T >::setDHtZero_, and HLTAlphaTFilter< T >::triggerType_.

99 {
100 
101  using namespace std;
102  using namespace edm;
103  using namespace reco;
104  using namespace trigger;
105 
106  typedef vector<T> TCollection;
107  typedef Ref<TCollection> TRef;
108 
109  // The filter object
110  if (saveTags()) filterproduct.addCollectionTag(inputJetTag_);
111 
112  TRef ref;
113  // Get the Candidates
114  Handle<TCollection> recojets;
115  iEvent.getByToken(m_theRecoJetToken,recojets);
116 
117  // We have to also look at the L1 FastJet Corrections, at the same time we look at our other jets.
118  // We calcualte our HT from the FastJet collection and AlphaT from the standard collection.
119  CaloJetRef ref_FastJet;
120  // Get the Candidates
121  Handle<TCollection> recojetsFastJet;
122  iEvent.getByToken(m_theFastJetToken,recojetsFastJet);
123 
124 
125  int n(0);
126 
127  //OLD - DYNAMIC ALPHAT BEHAVIOUR
128  //Produce AlphaT dynamically, first on two jets, then three etc until it does
129  //or doesn't pass
130  if (dynamicAlphaT_){
131  // look at all candidates, check cuts and add to filter object
132  int flag(0);
133  double htFast = 0.;
134  double aT =0.;
135  unsigned int njets(0);
136 
137  if(recojets->size() > 1){
138  // events with at least two jets, needed for alphaT
139  // Make a vector of Lorentz Jets for the AlphaT calcualtion
140  std::vector<LorentzV> jets;
141  typename TCollection::const_iterator ijet = recojets->begin();
142  typename TCollection::const_iterator ijetFast = recojetsFastJet->begin();
143  typename TCollection::const_iterator jjet = recojets->end();
144 
145 
146 
147  for( ; ijet != jjet; ijet++, ijetFast++ ) {
148  if( flag == 1) break;
149  // Do Some Jet selection!
150  if( std::abs(ijet->eta()) > etaJet_.at(0) ) continue;
151  if( ijet->et() < minPtJet_.at(0) ) continue;
152  njets++;
153 
154  if (njets > maxNJets_) //to keep timing reasonable - if too many jets passing pt / eta cuts, just accept the event
155  flag = 1;
156 
157  else {
158 
159  if( std::abs(ijetFast->eta()) < etaJet_.at(1) ){
160  if( ijetFast->et() > minPtJet_.at(1) ) {
161  // Add to HT
162  htFast += ijetFast->et();
163  }
164  }
165 
166  // Add to JetVector
167  LorentzV JetLVec(ijet->pt(),ijet->eta(),ijet->phi(),ijet->mass());
168  jets.push_back( JetLVec );
169  aT = AlphaT(jets,setDHtZero_).value();
170  if(htFast > minHt_ && aT > minAlphaT_){
171  // set flat to one so that we don't carry on looping though the jets
172  flag = 1;
173  }
174  }
175 
176  }
177 
178  //If passed, add jets to the filter product for the DQM
179  if (flag==1) {
180  for (typename TCollection::const_iterator recojet = recojets->begin(); recojet!=jjet; recojet++) {
181  if (recojet->et() > minPtJet_.at(0)) {
182  ref = TRef(recojets,distance(recojets->begin(),recojet));
183  filterproduct.addObject(triggerType_,ref);
184  n++;
185  }
186  }
187  }
188  }// events with at least two jet
189 
190  // filter decision
191  bool accept(n>0);
192 
193  return accept;
194  }
195  // NEW - STATIC ALPHAT BEHAVIOUR
196  // just reproduce
197  else{
198  // look at all candidates, check cuts and add to filter object
199  int flag(0);
200  typename TCollection::const_iterator ijet = recojets->begin();
201  typename TCollection::const_iterator jjet = recojets->end();
202 
203 
204  if( (recojets->size() > 1) && (recojetsFastJet->size() > 1) ){
205 
206  // events with at least two jets, needed for alphaT
207  double htFast = 0.;
208  typename TCollection::const_iterator ijetFast = recojetsFastJet->begin();
209  typename TCollection::const_iterator jjetFast = recojetsFastJet->end();
210  for( ; ijetFast != jjetFast; ijetFast++ ) {
211  if( std::abs(ijetFast->eta()) < etaJet_.at(1) ){
212  if( ijetFast->et() > minPtJet_.at(1) ) {
213  // Add to HT
214  htFast += ijetFast->et();
215  }
216  }
217  }
218 
219  if(htFast > minHt_){
220 
221  unsigned int njets(0);
222  // Make a vector of Lorentz Jets for the AlphaT calcualtion
223  std::vector<LorentzV> jets;
224  for( ; ijet != jjet; ijet++ ) {
225  if( std::abs(ijet->eta()) > etaJet_.at(0) ) continue;
226  if( ijet->et() < minPtJet_.at(0) ) continue;
227  njets++;
228 
229  if (njets > maxNJets_) { //to keep timing reasonable - if too many jets passing pt / eta cuts, just accept the event
230  flag = 1;
231  break; //Added for efficiency
232  }
233 
234  // Add to JetVector
235  LorentzV JetLVec(ijet->pt(),ijet->eta(),ijet->phi(),ijet->mass());
236  jets.push_back( JetLVec );
237 
238  }
239 
240  if(flag!=1){ //Added for efficiency
241  //Calculate the value for alphaT
242  float aT = AlphaT(jets,setDHtZero_).value();
243 
244  // Trigger decision!
245  if(aT > minAlphaT_){
246  flag = 1;
247  }
248  }
249 
250  //If passed, add the jets to the filterproduct for DQM
251  if (flag==1) {
252  for (typename TCollection::const_iterator recojet = recojets->begin(); recojet!=jjet; recojet++) {
253  if (recojet->et() > minPtJet_.at(0)) {
254  ref = TRef(recojets,distance(recojets->begin(),recojet));
255  filterproduct.addObject(triggerType_,ref);
256  n++;
257  }
258  }
259  }
260  }
261  }// events with at least two jet
262 
263  // filter decision
264  bool accept(n>0);
265 
266  return accept;
267  }
268 
269  // THIS WILL NEVER HAPPEN
270  return true;
271 }
edm::EDGetTokenT< std::vector< T > > m_theRecoJetToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
edm::InputTag inputJetTag_
vector< PseudoJet > jets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > LorentzV
edm::EDGetTokenT< std::vector< T > > m_theFastJetToken
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
std::vector< double > minPtJet_
std::vector< double > etaJet_
fixed size matrix
bool saveTags() const
Definition: HLTFilter.h:45
HLT enums.
unsigned int maxNJets_

Member Data Documentation

template<typename T >
bool HLTAlphaTFilter< T >::dynamicAlphaT_
private
template<typename T >
std::vector<double> HLTAlphaTFilter< T >::etaJet_
private
template<typename T >
edm::InputTag HLTAlphaTFilter< T >::inputJetTag_
private
template<typename T >
edm::InputTag HLTAlphaTFilter< T >::inputJetTagFastJet_
private

Definition at line 41 of file HLTAlphaTFilter.h.

Referenced by HLTAlphaTFilter< T >::HLTAlphaTFilter().

template<typename T >
edm::EDGetTokenT<std::vector<T> > HLTAlphaTFilter< T >::m_theFastJetToken
private
template<typename T >
edm::EDGetTokenT<std::vector<T> > HLTAlphaTFilter< T >::m_theRecoJetToken
private
template<typename T >
unsigned int HLTAlphaTFilter< T >::maxNJets_
private
template<typename T >
double HLTAlphaTFilter< T >::minAlphaT_
private
template<typename T >
double HLTAlphaTFilter< T >::minHt_
private
template<typename T >
std::vector<double> HLTAlphaTFilter< T >::minPtJet_
private
template<typename T >
bool HLTAlphaTFilter< T >::setDHtZero_
private
template<typename T >
int HLTAlphaTFilter< T >::triggerType_
private