CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EmptyEventsFilter Class Reference

#include <z2tautau/EmptyEventsFilter/src/EmptyEventsFilter.cc>

Inheritance diagram for EmptyEventsFilter:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EmptyEventsFilter (const edm::ParameterSet &)
 
 ~EmptyEventsFilter ()
 
- 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

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Private Attributes

int evSelected_
 
int evTotal_
 
edm::InputTag src_
 
int target_
 

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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 44 of file EmptyEventsFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 73 of file EmptyEventsFilter.cc.

References evSelected_, evTotal_, edm::ParameterSet::getUntrackedParameter(), src_, and target_.

74 {
75  //now do what ever initialization is needed
76  src_ = iConfig.getUntrackedParameter<edm::InputTag>("src",edm::InputTag("generator"));
77  target_ = iConfig.getUntrackedParameter<int>("target",0);
78  evTotal_ = 0;
79  evSelected_ = 0;
80 }
T getUntrackedParameter(std::string const &, T const &) const
EmptyEventsFilter::~EmptyEventsFilter ( )

Definition at line 83 of file EmptyEventsFilter.cc.

84 {
85 
86  // do anything here that needs to be done at desctruction time
87  // (e.g. close files, deallocate resources etc.)
88 
89 }

Member Function Documentation

void EmptyEventsFilter::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 144 of file EmptyEventsFilter.cc.

145 {
146 }
void EmptyEventsFilter::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 150 of file EmptyEventsFilter.cc.

References gather_cfg::cout, evSelected_, and evTotal_.

150  {
151  std::cout << "EmptyEventsFilter:: "
152  << double(evSelected_)/evTotal_
153  << " " << evSelected_
154  << " " << evTotal_
155  << std::endl;
156 
157 }
tuple cout
Definition: gather_cfg.py:121
bool EmptyEventsFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 98 of file EmptyEventsFilter.cc.

References evSelected_, evTotal_, newFWLiteAna::found, edm::Event::getByLabel(), edm::HandleBase::isValid(), src_, and target_.

99 {
100  ++evTotal_;
101  using namespace edm;
102  using namespace std;
103 // using namespace HepMC;
104 
105  bool found = false;
106  switch (target_)
107  {
108  case 1:
109  {
110  Handle<edm::HepMCProduct> dataHandle ;
111  iEvent.getByLabel(src_, dataHandle ) ;
112  if (dataHandle.isValid())
113  found = true;
114  break;
115  }
116  case 0:
117  default:
118  {
119  Handle<std::vector<reco::Muon> > dataHandle;
120  iEvent.getByLabel(src_, dataHandle ) ;
121  if (dataHandle.isValid())
122  found = true;
123  }
124  }
125 
126 // Handle<edm::HepMCProduct> HepMCHandle;
127 // iEvent.getByLabel("newSource",HepMCHandle);
128 //
129 // HepMC::GenEvent * evt = new HepMC::GenEvent(*(HepMCHandle->GetEvent()));
130 // evt->print(std::cout);
131 
132  if (!found) {
133  return false;
134  }
135  else {
136  ++evSelected_;
137  return true;
138  }
139 
140 }
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356

Member Data Documentation

int EmptyEventsFilter::evSelected_
private

Definition at line 58 of file EmptyEventsFilter.cc.

Referenced by EmptyEventsFilter(), endJob(), and filter().

int EmptyEventsFilter::evTotal_
private

Definition at line 57 of file EmptyEventsFilter.cc.

Referenced by EmptyEventsFilter(), endJob(), and filter().

edm::InputTag EmptyEventsFilter::src_
private

Definition at line 54 of file EmptyEventsFilter.cc.

Referenced by EmptyEventsFilter(), and filter().

int EmptyEventsFilter::target_
private

Definition at line 55 of file EmptyEventsFilter.cc.

Referenced by EmptyEventsFilter(), and filter().