CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTElectronPFMTFilter.cc
Go to the documentation of this file.
1 
9 
10 //
11 // constructors and destructor
12 //
14 {
15  // MHT parameters
16  inputMetTag_ = iConfig.getParameter< edm::InputTag > ("inputMetTag");
17  minMht_ = iConfig.getParameter<double> ("minMht");
18  // Electron parameters
19  inputEleTag_ = iConfig.getParameter< edm::InputTag > ("inputEleTag");
20  lowerMTCut_ = iConfig.getParameter<double> ("lowerMTCut");
21  upperMTCut_ = iConfig.getParameter<double> ("upperMTCut");
22  relaxed_ = iConfig.getParameter<bool> ("relaxed");
23  minN_ = iConfig.getParameter<int>("minN");
24  L1IsoCollTag_= iConfig.getParameter< edm::InputTag > ("L1IsoCand");
25  L1NonIsoCollTag_= iConfig.getParameter< edm::InputTag > ("L1NonIsoCand");
26 }
27 
29 
33  desc.add<edm::InputTag>("inputMetTag",edm::InputTag("hltPFMHT"));
34  desc.add<edm::InputTag>("inputEleTag",edm::InputTag("hltEle25CaloIdVTTrkIdTCaloIsoTTrkIsoTTrackIsolFilter"));
35  desc.add<edm::InputTag>("L1IsoCand",edm::InputTag("hltL1IsoRecoEcalCandidate"));
36  desc.add<edm::InputTag>("L1NonIsoCand",edm::InputTag("hltL1NonIsoRecoEcalCandidate"));
37  desc.add<bool>("relaxed",true);
38  desc.add<int>("minN",0);
39  desc.add<double>("minMht",0.0);
40  desc.add<double>("lowerMTCut",0.0);
41  desc.add<double>("upperMTCut",9999.0);
42  descriptions.add("hltElectronPFMTFilter",desc);
43 }
44 
45 
46 
47 // ------------ method called to produce the data ------------
48 bool
50 {
51  using namespace std;
52  using namespace edm;
53  using namespace reco;
54  using namespace trigger;
55  // The filter object
56  if (saveTags()) {
57  filterproduct.addCollectionTag(inputMetTag_);
58  filterproduct.addCollectionTag(L1IsoCollTag_);
59  if (relaxed_) filterproduct.addCollectionTag(L1NonIsoCollTag_);
60  }
61 
62  // Get the Met collection
64  iEvent.getByLabel(inputMetTag_,pfMHT);
65 
66  // Sanity check:
67  if(!pfMHT.isValid()) {
68 
69  edm::LogError("HLTElectronPFMTFilter") << "missing input Met collection!";
70 
71  }
72 
73  const METCollection *metcol = pfMHT.product();
74  const MET *met;
75  met = &(metcol->front());
76 
78  iEvent.getByLabel (inputEleTag_,PrevFilterOutput);
79 
80  int nW = 0;
81 
83 
84  vector< Ref< ElectronCollection > > electrons;
85  PrevFilterOutput->getObjects(TriggerElectron, electrons);
86 
87  TLorentzVector pMET(met->px(), met->py(),0.0,sqrt(met->px()*met->px() + met->py()*met->py()));
88 
89  for (unsigned int i=0; i<electrons.size(); i++) {
90 
91  refele = electrons[i];
92  TLorentzVector pThisEle(refele->px(), refele->py(),
93  0.0, refele->et() );
94  TLorentzVector pTot = pMET + pThisEle;
95  double mass = pTot.M();
96 
97  if(mass>=lowerMTCut_ && mass<=upperMTCut_ && pMET.E()>= minMht_)
98  {
99  nW++;
100  refele = electrons[i];
101  filterproduct.addObject(TriggerElectron, refele);
102  }
103  }
104 
105  // filter decision
106  const bool accept(nW>=minN_);
107 
108  return accept;
109 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
HLTElectronPFMTFilter(const edm::ParameterSet &)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref&lt;C&gt;)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:243
Definition: MET.h:32
T sqrt(T t)
Definition: SSEVec.h:46
Collection of MET.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:27
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool saveTags() const
Definition: HLTFilter.h:45
tuple mass
Definition: scaleCards.py:27
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)