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::ProductRegistryHelper

Classes

struct  event
 

Public Member Functions

 WZInterestingEventSelector (const edm::ParameterSet &)
 
 ~WZInterestingEventSelector ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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

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
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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(), and edm::ParameterSet::getUntrackedParameter().

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,
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::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()->trackerExpectedHitsInner().numberOfHits()>missHitCut_) return false;
212 
213  return true;
214 }
bool isEE() const
Definition: GsfElectron.h:335
bool isEB() const
Definition: GsfElectron.h:334
float sigmaIetaIeta() const
Definition: GsfElectron.h:378
float hcalOverEcal() const
Definition: GsfElectron.h:384
float dr03TkSumPt() const
Definition: GsfElectron.h:422
GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:167
virtual double pt() const
transverse momentum
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:423
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:426
void WZInterestingEventSelector::endJob ( void  )
privatevirtual

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 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 217 of file WZInterestingEventSelector.cc.

References DeDxDiscriminatorTools::charge(), reco::LeafCandidate::charge(), eta(), reco::LeafCandidate::eta(), edm::EventAuxiliary::event(), edm::Event::eventAuxiliary(), edm::Event::getByLabel(), edm::Event::getLuminosityBlock(), ALCARECOEcalCalIsolElectron_cff::goodElectrons, gsfElectrons_cfi::gsfElectrons, edm::HandleBase::isValid(), edm::LuminosityBlockBase::luminosityBlock(), python.pfMET_cfi::pfMET, phi, reco::LeafCandidate::phi(), reco::BeamSpot::position(), edm::Handle< T >::product(), reco::LeafCandidate::pt(), ExpressReco_HICollisions_FallBack::pt, ExpressReco_HICollisions_FallBack::ptMax, and edm::Event::run().

Referenced by python.Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), python.Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), python.Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and python.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  event thisEvent;
251  thisEvent.run=iEvent.run();
252  thisEvent.event=iEvent.eventAuxiliary().event();
253  thisEvent.ls=iEvent.getLuminosityBlock().luminosityBlock();
254  thisEvent.nEle=goodElectrons.size();
255 
256  if (ptMaxEle)
257  {
258  thisEvent.maxPt=ptMax;
259  thisEvent.maxPtEleEta=ptMaxEle->eta();
260  thisEvent.maxPtElePhi=ptMaxEle->phi();
261 
262  }
263 
264  if (pfMET.isValid())
265  {
266  thisEvent.met=pfMET->begin()->et();
267  thisEvent.metPhi=pfMET->begin()->phi();
268  }
269 
270 
271  float maxInv=-999.;
272  TLorentzVector v1;
273  if (ptMaxEle)
274  v1.SetPtEtaPhiM(ptMaxEle->pt(),ptMaxEle->eta(),ptMaxEle->phi(),0);
275  if (goodElectrons.size()>1)
276  {
277  for (unsigned int iEle=0; iEle<goodElectrons.size(); ++iEle)
278  if (goodElectrons[iEle]!=ptMaxEle && (goodElectrons[iEle]->charge() * ptMaxEle->charge() == -1) )
279  {
280  TLorentzVector v2;
281  v2.SetPtEtaPhiM(goodElectrons[iEle]->pt(),goodElectrons[iEle]->eta(),goodElectrons[iEle]->phi(),0.);
282  if ( (v1+v2).M() > maxInv )
283  maxInv = (v1+v2).M();
284  }
285  }
286 
287  if (maxInv > invMassCut_)
288  thisEvent.invMass = maxInv;
289 
290  //Z filt: Retain event if more then 1 good ele and invMass above threshold (zee)
291  if (goodElectrons.size()>1 && maxInv > invMassCut_)
292  {
293  //interestingEvents_.push_back(thisEvent);
294  return true;
295  }
296 
297  //W filt: Retain event also event with at least 1 good ele and some met
298  if (goodElectrons.size()>=1 && (pfMET->begin()->et()>metCut_))
299  {
300  //interestingEvents_.push_back(thisEvent);
301  return true;
302  }
303 
304  return false;
305 }
double charge(const std::vector< uint8_t > &Ampls)
T eta() const
virtual double eta() const
momentum pseudorapidity
LuminosityBlockNumber_t luminosityBlock() const
bool electronSelection(const GsfElectron *eleRef, math::XYZPoint bspotPosition)
virtual int charge() const
electric charge
RunNumber_t run() const
Definition: Event.h:66
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:58
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
EventAuxiliary const & eventAuxiliary() const
Definition: Event.h:55
virtual double pt() const
transverse momentum
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
T const * product() const
Definition: Handle.h:74
const Point & position() const
position
Definition: BeamSpot.h:63
virtual double phi() const
momentum azimuthal angle
EventNumber_t event() const
Definition: DDAxes.h:10

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.