1 |
auterman |
1.1 |
|
2 |
|
|
#include "RA2/Selection/interface/Selection.h"
|
3 |
|
|
|
4 |
|
|
Selection::Selection(const edm::ParameterSet& iConfig) :
|
5 |
|
|
sequence_( iConfig.getParameter<edm::ParameterSet>("selections") ),
|
6 |
|
|
filterSelection_( iConfig.getParameter<std::vector<std::string> >("filterSelection") )
|
7 |
|
|
{
|
8 |
|
|
|
9 |
|
|
// Translate filterSelection strings into selector indices
|
10 |
|
|
filterSelectionIndices_.reserve(filterSelection_.size());
|
11 |
|
|
for ( size_t i=0; i<filterSelection_.size(); ++i )
|
12 |
|
|
filterSelectionIndices_.push_back(sequence_.selectorIndex(filterSelection_[i]));
|
13 |
|
|
|
14 |
|
|
// List all selectors and selection variables
|
15 |
|
|
edm::LogVerbatim("Selection") << "Selectors are:" << std::endl;
|
16 |
|
|
for ( std::vector<const SusyEventSelector*>::const_iterator it = sequence_.selectors().begin();
|
17 |
|
|
it != sequence_.selectors().end(); ++it )
|
18 |
|
|
{
|
19 |
|
|
edm::LogVerbatim("Selection") << " * " << (*it)->name()
|
20 |
|
|
<< " selects on following "
|
21 |
|
|
<< (*it)->numberOfVariables() << " variable(s):";
|
22 |
|
|
for ( unsigned int i=0; i<(*it)->numberOfVariables(); ++i )
|
23 |
|
|
edm::LogVerbatim("Selection") << " - " << (*it)->variableNames()[i];
|
24 |
|
|
edm::LogVerbatim("Selection") << std::endl;
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
//________________________________________________________________________________________
|
32 |
|
|
Selection::~Selection() { }
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
// ------------ method called on each new Event ------------
|
36 |
|
|
bool
|
37 |
|
|
Selection::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
|
38 |
|
|
{
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
// Retrieve the decision of each selector module
|
42 |
|
|
SelectorDecisions decisions = sequence_.decisions(iEvent);
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
bool dec(true);
|
46 |
|
|
for ( size_t i=0; i<filterSelectionIndices_.size(); ++i ) // only "filter selection"
|
47 |
|
|
dec = dec && decisions.decision(filterSelectionIndices_[i]);
|
48 |
|
|
|
49 |
|
|
// // Get all variables from sequence
|
50 |
|
|
// std::vector<double> values = sequence_.values();
|
51 |
|
|
// edm::LogInfo("SusyRa2Variables") <<"values.size() "<<values.size();
|
52 |
|
|
// for ( size_t i=0; i<values.size(); ++i ) {
|
53 |
|
|
// edm::LogInfo("SusyRa2Variables") << values[i];
|
54 |
|
|
// }
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
return dec;
|
58 |
|
|
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
//________________________________________________________________________________________
|
62 |
|
|
// Called once per job, at start
|
63 |
|
|
void
|
64 |
|
|
Selection::beginJob(const edm::EventSetup&) {}
|
65 |
|
|
|
66 |
|
|
//________________________________________________________________________________________
|
67 |
|
|
// Called once per job, at end
|
68 |
|
|
|
69 |
|
|
void
|
70 |
|
|
Selection::endJob()
|
71 |
|
|
{
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
//define this as a plug-in
|
76 |
|
|
DEFINE_FWK_MODULE(Selection);
|