CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CentralityFilter.cc
Go to the documentation of this file.
1 //
2 // Original Author: Yetkin Yilmaz,32 4-A08,+41227673039,
3 // Created: Tue Jun 29 12:19:49 CEST 2010
4 //
5 //
6 
7 
8 // system include files
9 #include <memory>
10 #include <vector>
11 #include <string>
12 
13 // user include files
21 
22 //
23 // class declaration
24 //
25 
27  public:
28  explicit CentralityFilter(const edm::ParameterSet&);
30 
31  private:
32  virtual void beginJob() ;
33  virtual bool filter(edm::Event&, const edm::EventSetup&);
34  virtual void endJob() ;
35 
36  // ----------member data ---------------------------
38  std::vector<int> selectedBins_;
39 };
40 
41 //
42 // constants, enums and typedefs
43 //
44 
45 //
46 // static data member definitions
47 //
48 
49 //
50 // constructors and destructor
51 //
53  centrality_(0),
54  selectedBins_(iConfig.getParameter<std::vector<int> >("selectedBins"))
55 {
56  //now do what ever initialization is needed
57 
58 }
59 
60 
62 {
63 
64  // do anything here that needs to be done at desctruction time
65  // (e.g. close files, deallocate resources etc.)
66 
67 }
68 
69 
70 //
71 // member functions
72 //
73 
74 // ------------ method called on each new Event ------------
75 bool
77 {
78  bool result = false;
79 
80  using namespace edm;
81  if(!centrality_) centrality_ = new CentralityProvider(iSetup);
82  centrality_->newEvent(iEvent,iSetup);
83  int bin = centrality_->getBin();
84 
85  for(unsigned int i = 0; i < selectedBins_.size(); ++i){
86  if(bin == selectedBins_[i]) result = true;
87  }
88 
89  return result;
90 }
91 
92 // ------------ method called once each job just before starting event loop ------------
93 void
95 {
96 }
97 
98 // ------------ method called once each job just after ending the event loop ------------
99 void
101 }
102 
103 //define this as a plug-in
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:243
void newEvent(const edm::Event &ev, const edm::EventSetup &iSetup)
tuple result
Definition: query.py:137
CentralityFilter(const edm::ParameterSet &)
virtual bool filter(edm::Event &, const edm::EventSetup &)
std::vector< int > selectedBins_
virtual void beginJob()
CentralityProvider * centrality_
virtual void endJob()