CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PackedCandidatesTrackLiteModifier.cc
Go to the documentation of this file.
8 
10 
11 #include <vector>
12 
14 public:
16  ~PackedCandidatesTrackLiteModifier() override = default;
17 
18  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
19  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
20 
21 private:
24  const unsigned int covSchema_;
25  const unsigned int covVersion_;
26  const unsigned int nHits_;
27  const unsigned int nPixelHits_;
28 };
29 
30 //____________________________________________________________________________||
32  : inputCandidates_(
33  consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("inputCandidates"))),
34  outputCandidates_(produces<pat::PackedCandidateCollection>("")),
35  covSchema_(iConfig.getParameter<unsigned int>("covSchema")),
36  covVersion_(iConfig.getParameter<unsigned int>("covVersion")),
37  nHits_(iConfig.getParameter<unsigned int>("nHits")),
38  nPixelHits_(iConfig.getParameter<unsigned int>("nPixelHits")) {}
39 
42  const edm::EventSetup &iSetup) const {
43  auto const &packedCandidates = iEvent.get(inputCandidates_);
44 
46  output.reserve(packedCandidates.size());
47  for (auto const &cand : packedCandidates) {
48  output.push_back(pat::PackedCandidate(cand));
49 
50  if (!output.back().hasTrackDetails() && output.back().fromTrackCandidate())
51  output.back().setTrackPropertiesLite(covSchema_, covVersion_, nHits_, nPixelHits_);
52  }
53 
54  iEvent.emplace(outputCandidates_, std::move(output));
55 };
56 
59 
60  desc.add<edm::InputTag>("inputCandidates", edm::InputTag("packedPFCandidates"));
61  desc.add<unsigned int>("covSchema", 1025);
62  desc.add<unsigned int>("covVersion", 1);
63  desc.add<unsigned int>("nHits", 8);
64  desc.add<unsigned int>("nPixelHits", 3);
65 
66  descriptions.addWithDefaultLabel(desc);
67 }
68 
69 //____________________________________________________________________________||
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< pat::PackedCandidateCollection > inputCandidates_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< pat::PackedCandidate > PackedCandidateCollection
const edm::EDPutTokenT< pat::PackedCandidateCollection > outputCandidates_
~PackedCandidatesTrackLiteModifier() override=default
int iEvent
Definition: GenABIO.cc:224
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def move
Definition: eostools.py:511
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
ParameterDescriptionBase * add(U const &iLabel, T const &value)
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
PackedCandidatesTrackLiteModifier(const edm::ParameterSet &)