CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
WZInterestingEventSelector Class Reference
Inheritance diagram for WZInterestingEventSelector:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  event
 

Public Member Functions

 WZInterestingEventSelector (const edm::ParameterSet &)
 
 ~WZInterestingEventSelector () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () 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)
 

Private Member Functions

bool electronSelection (const GsfElectron *eleRef, const math::XYZPoint &bspotPosition)
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

float eb_ecalIsoCut_
 
float eb_hcalIsoCut_
 
float eb_hoeCut_
 
float eb_seeCut_
 
float eb_trIsoCut_
 
float ee_ecalIsoCut_
 
float ee_hcalIsoCut_
 
float ee_hoeCut_
 
float ee_seeCut_
 
float ee_trIsoCut_
 
edm::InputTag electronCollection_
 
float invMassCut_
 
float metCut_
 
int missHitCut_
 
edm::InputTag offlineBSCollection_
 
edm::InputTag pfMetCollection_
 
float ptCut_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter 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
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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

Definition at line 44 of file WZInterestingEventSelector.cc.

Constructor & Destructor Documentation

WZInterestingEventSelector::WZInterestingEventSelector ( const edm::ParameterSet iConfig)
explicit

Definition at line 102 of file WZInterestingEventSelector.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and HLT_2018_cff::InputTag.

102  {
103  ptCut_ = iConfig.getParameter<double>("ptCut");
104  missHitCut_ = iConfig.getParameter<int>("missHitsCut");
105 
106  eb_trIsoCut_ = iConfig.getParameter<double>("eb_trIsoCut");
107  eb_ecalIsoCut_ = iConfig.getParameter<double>("eb_ecalIsoCut");
108  eb_hcalIsoCut_ = iConfig.getParameter<double>("eb_hcalIsoCut");
109  eb_hoeCut_ = iConfig.getParameter<double>("eb_hoeCut");
110  eb_seeCut_ = iConfig.getParameter<double>("eb_seeCut");
111 
112  ee_trIsoCut_ = iConfig.getParameter<double>("ee_trIsoCut");
113  ee_ecalIsoCut_ = iConfig.getParameter<double>("ee_ecalIsoCut");
114  ee_hcalIsoCut_ = iConfig.getParameter<double>("ee_hcalIsoCut");
115  ee_hoeCut_ = iConfig.getParameter<double>("ee_hoeCut");
116  ee_seeCut_ = iConfig.getParameter<double>("ee_seeCut");
117 
118  metCut_ = iConfig.getParameter<double>("metCut");
119  invMassCut_ = iConfig.getParameter<double>("invMassCut");
120 
122  iConfig.getUntrackedParameter<edm::InputTag>("electronCollection", edm::InputTag("gsfElectrons"));
123  pfMetCollection_ = iConfig.getUntrackedParameter<edm::InputTag>("pfMetCollection", edm::InputTag("pfMet"));
125  iConfig.getUntrackedParameter<edm::InputTag>("offlineBSCollection", edm::InputTag("offlineBeamSpot"));
126 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
WZInterestingEventSelector::~WZInterestingEventSelector ( )
override

Definition at line 128 of file WZInterestingEventSelector.cc.

128  {
129  // do anything here that needs to be done at desctruction time
130  // (e.g. close files, deallocate resources etc.)
131 }

Member Function Documentation

bool WZInterestingEventSelector::electronSelection ( const GsfElectron eleRef,
const math::XYZPoint bspotPosition 
)
private

Definition at line 172 of file WZInterestingEventSelector.cc.

References reco::GsfElectron::dr03EcalRecHitSumEt(), reco::GsfElectron::dr03HcalTowerSumEt(), reco::GsfElectron::dr03TkSumPt(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hcalOverEcal(), reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), reco::HitPattern::MISSING_INNER_HITS, reco::LeafCandidate::pt(), and reco::GsfElectron::sigmaIetaIeta().

172  {
173  // if (eleRef->trackerDrivenSeed() && !eleRef->ecalDrivenSeed())
174  // return false;
175 
176  // if (eleRef->ecalDrivenSeed())
177  // {
178 
179  if (eleRef->pt() < ptCut_)
180  return false;
181 
182  if (eleRef->isEB()) {
183  if (eleRef->dr03TkSumPt() / eleRef->pt() > eb_trIsoCut_)
184  return false;
185  if (eleRef->dr03EcalRecHitSumEt() / eleRef->pt() > eb_ecalIsoCut_)
186  return false;
187  if (eleRef->dr03HcalTowerSumEt() / eleRef->pt() > eb_hcalIsoCut_)
188  return false;
189  if (eleRef->sigmaIetaIeta() > eb_seeCut_)
190  return false;
191  if (eleRef->hcalOverEcal() > eb_hoeCut_)
192  return false;
193  } else if (eleRef->isEE()) {
194  if (eleRef->dr03TkSumPt() / eleRef->pt() > ee_trIsoCut_)
195  return false;
196  if (eleRef->dr03EcalRecHitSumEt() / eleRef->pt() > ee_ecalIsoCut_)
197  return false;
198  if (eleRef->dr03HcalTowerSumEt() / eleRef->pt() > ee_hcalIsoCut_)
199  return false;
200  if (eleRef->sigmaIetaIeta() > ee_seeCut_)
201  return false;
202  if (eleRef->hcalOverEcal() > ee_hoeCut_)
203  return false;
204  }
205 
206  if (eleRef->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) > missHitCut_)
207  return false;
208 
209  return true;
210 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
double pt() const final
transverse momentum
bool isEE() const
Definition: GsfElectron.h:329
bool isEB() const
Definition: GsfElectron.h:328
float sigmaIetaIeta() const
Definition: GsfElectron.h:411
float hcalOverEcal() const
Definition: GsfElectron.h:419
float dr03TkSumPt() const
Definition: GsfElectron.h:521
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:523
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:526
void WZInterestingEventSelector::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 139 of file WZInterestingEventSelector.cc.

139  {
140  // if (interestingEvents_.size()<1)
141  // return;
142 
143  // std::ostringstream oss;
144  // for (unsigned int iEvent=0;iEvent<interestingEvents_.size();++iEvent)
145  // {
146  // oss << "==================================" << std::endl;
147  // oss << "Run: " << interestingEvents_[iEvent].run << " Event: " << interestingEvents_[iEvent].event << " LS: " << interestingEvents_[iEvent].ls << std::endl;
148  // oss << "nGoodEle: " << interestingEvents_[iEvent].nEle << " maxPt " << interestingEvents_[iEvent].maxPt << " maxPtEta " << interestingEvents_[iEvent].maxPtEleEta << " maxPtPhi " << interestingEvents_[iEvent].maxPtElePhi << std::endl;
149  // oss << "invMass " << interestingEvents_[iEvent].invMass << " met " << interestingEvents_[iEvent].met << " metPhi " << interestingEvents_[iEvent].metPhi << std::endl;
150  // }
151  // std::string mailText;
152  // mailText = oss.str();
153 
154  // std::ofstream outputTxt;
155  // outputTxt.open("interestingEvents.txt");
156  // outputTxt << mailText;
157  // outputTxt.close();
158 
159  //Sending email
160  // std::ostringstream subject;
161  // subject << "Interesting events in Run#" << interestingEvents_[0].run;
162 
163  // std::ostringstream command;
164  // command << "cat interestingEvents.txt | mail -s \"" << subject.str() << "\" Paolo.Meridiani@cern.ch";
165 
166  // std::string commandStr = command.str();
167  // char* pch = (char*)malloc( sizeof( char ) *(commandStr.length() +1) );
168  // string::traits_type::copy( pch, commandStr.c_str(), commandStr.length() +1 );
169  // int i=system(pch);
170 }
bool WZInterestingEventSelector::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 212 of file WZInterestingEventSelector.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, reco::LeafCandidate::charge(), DEFINE_FWK_MODULE, PVValHelper::eta, reco::LeafCandidate::eta(), edm::Event::getByLabel(), WElectronSkim_cff::goodElectrons, electronIsolatorFromEffectiveArea_cfi::gsfElectrons, pfMETBenchmark_cfi::pfMET, reco::LeafCandidate::phi(), reco::BeamSpot::position(), edm::Handle< T >::product(), DiDispStaMuonMonitor_cfi::pt, reco::LeafCandidate::pt(), and AlignmentTrackSelector_cfi::ptMax.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

212  {
213  // using namespace edm;
215  iEvent.getByLabel(electronCollection_, gsfElectrons);
216 
217  // edm::Handle<reco::CaloMETCollection> caloMET;
218  // iEvent.getByLabel(edm::InputTag("met"), caloMET);
219 
221  iEvent.getByLabel(pfMetCollection_, pfMET);
222 
223  edm::Handle<reco::BeamSpot> pBeamSpot;
224  iEvent.getByLabel(offlineBSCollection_, pBeamSpot);
225 
226  const reco::BeamSpot* bspot = pBeamSpot.product();
227  const math::XYZPoint& bspotPosition = bspot->position();
228 
229  std::vector<const GsfElectron*> goodElectrons;
230  float ptMax = -999.;
231  const GsfElectron* ptMaxEle = nullptr;
232  for (reco::GsfElectronCollection::const_iterator myEle = gsfElectrons->begin(); myEle != gsfElectrons->end();
233  ++myEle) {
234  //Apply a minimal isolated electron selection
235  if (!electronSelection(&(*myEle), bspotPosition))
236  continue;
237  goodElectrons.push_back(&(*myEle));
238  if (myEle->pt() > ptMax) {
239  ptMax = myEle->pt();
240  ptMaxEle = &(*myEle);
241  }
242  }
243 
244  float maxInv = -999.;
245  TLorentzVector v1;
246  if (ptMaxEle)
247  v1.SetPtEtaPhiM(ptMaxEle->pt(), ptMaxEle->eta(), ptMaxEle->phi(), 0);
248  if (goodElectrons.size() > 1) {
249  for (unsigned int iEle = 0; iEle < goodElectrons.size(); ++iEle)
250  if (goodElectrons[iEle] != ptMaxEle && (goodElectrons[iEle]->charge() * ptMaxEle->charge() == -1)) {
251  TLorentzVector v2;
252  v2.SetPtEtaPhiM(goodElectrons[iEle]->pt(), goodElectrons[iEle]->eta(), goodElectrons[iEle]->phi(), 0.);
253  if ((v1 + v2).M() > maxInv)
254  maxInv = (v1 + v2).M();
255  }
256  }
257 
258  //Z filt: Retain event if more then 1 good ele and invMass above threshold (zee)
259  if (goodElectrons.size() > 1 && maxInv > invMassCut_) {
260  //interestingEvents_.push_back(thisEvent);
261  return true;
262  }
263 
264  //W filt: Retain event also event with at least 1 good ele and some met
265  if (!goodElectrons.empty() && (pfMET->begin()->et() > metCut_)) {
266  //interestingEvents_.push_back(thisEvent);
267  return true;
268  }
269 
270  return false;
271 }
double eta() const final
momentum pseudorapidity
goodElectrons
/ ___|___ / _| ____| | ___ ___| |_ _ __ ___ _ __ | | _/ __| |_| _| | |/ _ \/ __| __| &#39;__/ _ | &#39;_ \ |...
double pt() const final
transverse momentum
int charge() const final
electric charge
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
T const * product() const
Definition: Handle.h:69
bool electronSelection(const GsfElectron *eleRef, const math::XYZPoint &bspotPosition)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const Point & position() const
position
Definition: BeamSpot.h:59
double phi() const final
momentum azimuthal angle

Member Data Documentation

float WZInterestingEventSelector::eb_ecalIsoCut_
private

Definition at line 76 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_hcalIsoCut_
private

Definition at line 77 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_hoeCut_
private

Definition at line 78 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_seeCut_
private

Definition at line 79 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_trIsoCut_
private

Definition at line 75 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_ecalIsoCut_
private

Definition at line 83 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_hcalIsoCut_
private

Definition at line 84 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_hoeCut_
private

Definition at line 85 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_seeCut_
private

Definition at line 86 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_trIsoCut_
private

Definition at line 82 of file WZInterestingEventSelector.cc.

edm::InputTag WZInterestingEventSelector::electronCollection_
private

Definition at line 94 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::invMassCut_
private

Definition at line 92 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::metCut_
private

Definition at line 89 of file WZInterestingEventSelector.cc.

int WZInterestingEventSelector::missHitCut_
private

Definition at line 72 of file WZInterestingEventSelector.cc.

edm::InputTag WZInterestingEventSelector::offlineBSCollection_
private

Definition at line 96 of file WZInterestingEventSelector.cc.

edm::InputTag WZInterestingEventSelector::pfMetCollection_
private

Definition at line 95 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ptCut_
private