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::one::EDFilter<> edm::one::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  event
 

Public Member Functions

 WZInterestingEventSelector (const edm::ParameterSet &)
 
 ~WZInterestingEventSelector () override
 
- Public Member Functions inherited from edm::one::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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::one::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::one::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 44 of file WZInterestingEventSelector.cc.

Constructor & Destructor Documentation

◆ WZInterestingEventSelector()

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

Definition at line 102 of file WZInterestingEventSelector.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and ProducerED_cfi::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
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const

◆ ~WZInterestingEventSelector()

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

◆ electronSelection()

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 }
double pt() const final
transverse momentum
float sigmaIetaIeta() const
Definition: GsfElectron.h:419
bool isEB() const
Definition: GsfElectron.h:328
float dr03TkSumPt() const
Definition: GsfElectron.h:557
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
float hcalOverEcal(const ShowerShape &ss, int depth) const
Definition: GsfElectron.h:425
bool isEE() const
Definition: GsfElectron.h:329
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:559
float dr03HcalTowerSumEt(int depth=0) const
Definition: GsfElectron.h:576

◆ endJob()

void WZInterestingEventSelector::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDFilterBase.

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 }

◆ filter()

bool WZInterestingEventSelector::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDFilterBase.

Definition at line 212 of file WZInterestingEventSelector.cc.

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

212  {
213  // using namespace edm;
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 pt() const final
transverse momentum
const Point & position() const
position
Definition: BeamSpot.h:59
goodElectrons
/ ___|___ / _| ____| | ___ ___| |_ _ __ ___ _ __ | | _/ __| |_| _| | |/ _ \/ __| __| &#39;__/ _ | &#39;_ \...
T const * product() const
Definition: Handle.h:70
int iEvent
Definition: GenABIO.cc:224
bool electronSelection(const GsfElectron *eleRef, const math::XYZPoint &bspotPosition)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double phi() const final
momentum azimuthal angle
int charge() const final
electric charge
double eta() const final
momentum pseudorapidity

Member Data Documentation

◆ eb_ecalIsoCut_

float WZInterestingEventSelector::eb_ecalIsoCut_
private

Definition at line 76 of file WZInterestingEventSelector.cc.

◆ eb_hcalIsoCut_

float WZInterestingEventSelector::eb_hcalIsoCut_
private

Definition at line 77 of file WZInterestingEventSelector.cc.

◆ eb_hoeCut_

float WZInterestingEventSelector::eb_hoeCut_
private

Definition at line 78 of file WZInterestingEventSelector.cc.

◆ eb_seeCut_

float WZInterestingEventSelector::eb_seeCut_
private

Definition at line 79 of file WZInterestingEventSelector.cc.

◆ eb_trIsoCut_

float WZInterestingEventSelector::eb_trIsoCut_
private

Definition at line 75 of file WZInterestingEventSelector.cc.

◆ ee_ecalIsoCut_

float WZInterestingEventSelector::ee_ecalIsoCut_
private

Definition at line 83 of file WZInterestingEventSelector.cc.

◆ ee_hcalIsoCut_

float WZInterestingEventSelector::ee_hcalIsoCut_
private

Definition at line 84 of file WZInterestingEventSelector.cc.

◆ ee_hoeCut_

float WZInterestingEventSelector::ee_hoeCut_
private

Definition at line 85 of file WZInterestingEventSelector.cc.

◆ ee_seeCut_

float WZInterestingEventSelector::ee_seeCut_
private

Definition at line 86 of file WZInterestingEventSelector.cc.

◆ ee_trIsoCut_

float WZInterestingEventSelector::ee_trIsoCut_
private

Definition at line 82 of file WZInterestingEventSelector.cc.

◆ electronCollection_

edm::InputTag WZInterestingEventSelector::electronCollection_
private

Definition at line 94 of file WZInterestingEventSelector.cc.

◆ invMassCut_

float WZInterestingEventSelector::invMassCut_
private

Definition at line 92 of file WZInterestingEventSelector.cc.

◆ metCut_

float WZInterestingEventSelector::metCut_
private

Definition at line 89 of file WZInterestingEventSelector.cc.

◆ missHitCut_

int WZInterestingEventSelector::missHitCut_
private

Definition at line 72 of file WZInterestingEventSelector.cc.

◆ offlineBSCollection_

edm::InputTag WZInterestingEventSelector::offlineBSCollection_
private

Definition at line 96 of file WZInterestingEventSelector.cc.

◆ pfMetCollection_

edm::InputTag WZInterestingEventSelector::pfMetCollection_
private

Definition at line 95 of file WZInterestingEventSelector.cc.

◆ ptCut_

float WZInterestingEventSelector::ptCut_
private