CMS 3D CMS Logo

L1GTSingleObjectCond.cc
Go to the documentation of this file.
6 
12 
15 
16 #include <cmath>
17 #include <cinttypes>
18 
19 #include <ap_int.h>
20 
21 using namespace l1t;
22 
24 public:
25  explicit L1GTSingleObjectCond(const edm::ParameterSet&);
26  ~L1GTSingleObjectCond() override = default;
27 
29 
30 private:
31  bool filter(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
32 
35 
38 };
39 
41  : scales_(config.getParameter<edm::ParameterSet>("scales")),
42  collection(config, config, scales_),
43  token_(consumes<P2GTCandidateCollection>(collection.tag())),
44  primVertToken_(consumes<P2GTCandidateCollection>(config.getParameter<edm::InputTag>("primVertTag"))) {
45  produces<P2GTCandidateVectorRef>(collection.tag().instance());
46 }
47 
51 
52  desc.add<edm::InputTag>("primVertTag");
53 
56  desc.add<edm::ParameterSetDescription>("scales", scalesDesc);
57 
58  descriptions.addWithDefaultLabel(desc);
59 }
60 
63  edm::Handle<P2GTCandidateCollection> primVertCol = event.getHandle(primVertToken_);
64 
65  bool condition_result = false;
66 
67  std::unique_ptr<P2GTCandidateVectorRef> triggerCol = std::make_unique<P2GTCandidateVectorRef>();
68 
69  for (std::size_t idx = 0; idx < col->size(); ++idx) {
70  bool pass{collection.checkObject(col->at(idx))};
71  pass &= collection.checkPrimaryVertices(col->at(idx), *primVertCol);
72 
73  condition_result |= pass;
74 
75  if (pass) {
76  triggerCol->push_back(P2GTCandidateRef(col, idx));
77  }
78  }
79 
80  if (condition_result) {
81  event.put(std::move(triggerCol), collection.tag().instance());
82  }
83 
84  return condition_result;
85 }
86 
const L1GTSingleCollectionCut collection
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
bool checkObject(const P2GTCandidate &obj) const
std::vector< P2GTCandidate > P2GTCandidateCollection
Definition: P2GTCandidate.h:16
std::string const & instance() const
Definition: InputTag.h:37
const edm::InputTag & tag() const
edm::Ref< P2GTCandidateCollection > P2GTCandidateRef
Definition: P2GTCandidate.h:18
bool checkPrimaryVertices(const P2GTCandidate &obj, const P2GTCandidateCollection &primVertCol) const
delete x;
Definition: CaloConfig.h:22
Definition: config.py:1
L1GTSingleObjectCond(const edm::ParameterSet &)
const edm::EDGetTokenT< P2GTCandidateCollection > token_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void fillPSetDescription(edm::ParameterSetDescription &desc)
HLT enums.
bool filter(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
col
Definition: cuy.py:1009
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
const edm::EDGetTokenT< P2GTCandidateCollection > primVertToken_