CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool electronSelection (const GsfElectron *eleRef, const math::XYZPoint &bspotPosition)
 
virtual void endJob () override
 
virtual 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
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 &)
 
- 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 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 45 of file WZInterestingEventSelector.cc.

Constructor & Destructor Documentation

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

Definition at line 105 of file WZInterestingEventSelector.cc.

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

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

Definition at line 132 of file WZInterestingEventSelector.cc.

133 {
134 
135  // do anything here that needs to be done at desctruction time
136  // (e.g. close files, deallocate resources etc.)
137 
138 }

Member Function Documentation

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

Definition at line 182 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().

183 {
184 
185 
186 // if (eleRef->trackerDrivenSeed() && !eleRef->ecalDrivenSeed())
187 // return false;
188 
189 // if (eleRef->ecalDrivenSeed())
190 // {
191 
192  if (eleRef->pt()<ptCut_) return false;
193 
194  if (eleRef->isEB())
195  {
196  if (eleRef->dr03TkSumPt()/eleRef->pt()>eb_trIsoCut_) return false;
197  if (eleRef->dr03EcalRecHitSumEt()/eleRef->pt()>eb_ecalIsoCut_) return false;
198  if (eleRef->dr03HcalTowerSumEt()/eleRef->pt()>eb_hcalIsoCut_) return false;
199  if (eleRef->sigmaIetaIeta()>eb_seeCut_) return false;
200  if (eleRef->hcalOverEcal()>eb_hoeCut_) return false;
201  }
202  else if (eleRef->isEE())
203  {
204  if (eleRef->dr03TkSumPt()/eleRef->pt()>ee_trIsoCut_) return false;
205  if (eleRef->dr03EcalRecHitSumEt()/eleRef->pt()>ee_ecalIsoCut_) return false;
206  if (eleRef->dr03HcalTowerSumEt()/eleRef->pt()>ee_hcalIsoCut_) return false;
207  if (eleRef->sigmaIetaIeta()>ee_seeCut_) return false;
208  if (eleRef->hcalOverEcal()>ee_hoeCut_) return false;
209  }
210 
211  if (eleRef->gsfTrack()->hitPattern().numberOfHits(reco::HitPattern::MISSING_INNER_HITS) > missHitCut_) return false;
212 
213  return true;
214 }
virtual double pt() const
transverse momentum
bool isEE() const
Definition: GsfElectron.h:351
bool isEB() const
Definition: GsfElectron.h:350
float sigmaIetaIeta() const
Definition: GsfElectron.h:416
float hcalOverEcal() const
Definition: GsfElectron.h:424
float dr03TkSumPt() const
Definition: GsfElectron.h:491
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:492
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:495
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:183
void WZInterestingEventSelector::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 147 of file WZInterestingEventSelector.cc.

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

Implements edm::EDFilter.

Definition at line 217 of file WZInterestingEventSelector.cc.

References RecoTauCleanerPlugins::charge, reco::LeafCandidate::charge(), eta, reco::LeafCandidate::eta(), edm::Event::getByLabel(), WElectronSkim_cff::goodElectrons, gsfElectrons_cfi::gsfElectrons, pfMET_cfi::pfMET, reco::LeafCandidate::phi(), phi(), reco::BeamSpot::position(), edm::Handle< T >::product(), EnergyCorrector::pt, and reco::LeafCandidate::pt().

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().

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

Member Data Documentation

float WZInterestingEventSelector::eb_ecalIsoCut_
private

Definition at line 78 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_hcalIsoCut_
private

Definition at line 79 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_hoeCut_
private

Definition at line 80 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_seeCut_
private

Definition at line 81 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::eb_trIsoCut_
private

Definition at line 77 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_ecalIsoCut_
private

Definition at line 85 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_hcalIsoCut_
private

Definition at line 86 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_hoeCut_
private

Definition at line 87 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_seeCut_
private

Definition at line 88 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ee_trIsoCut_
private

Definition at line 84 of file WZInterestingEventSelector.cc.

edm::InputTag WZInterestingEventSelector::electronCollection_
private

Definition at line 96 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::invMassCut_
private

Definition at line 94 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::metCut_
private

Definition at line 91 of file WZInterestingEventSelector.cc.

int WZInterestingEventSelector::missHitCut_
private

Definition at line 74 of file WZInterestingEventSelector.cc.

edm::InputTag WZInterestingEventSelector::offlineBSCollection_
private

Definition at line 98 of file WZInterestingEventSelector.cc.

edm::InputTag WZInterestingEventSelector::pfMetCollection_
private

Definition at line 97 of file WZInterestingEventSelector.cc.

float WZInterestingEventSelector::ptCut_
private

Definition at line 73 of file WZInterestingEventSelector.cc.