CMS 3D CMS Logo

TopInitSubset.cc
Go to the documentation of this file.
7 
8 namespace TopInitID {
9  static constexpr int tID = 6;
10 } // namespace TopInitID
11 
13 public:
14  explicit TopInitSubset(const edm::ParameterSet&);
15 
16  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
18 
19 private:
21 };
22 
24  : srcToken_(consumes<reco::GenParticleCollection>(cfg.getParameter<edm::InputTag>("src"))) {
25  produces<reco::GenParticleCollection>();
26 }
27 
30  evt.getByToken(srcToken_, src);
31 
33  auto sel = std::make_unique<reco::GenParticleCollection>();
34 
35  //fill output collection
36  fillOutput(*src, *sel);
37 
38  evt.put(std::move(sel));
39 }
40 
42  for (auto const& t : src) {
43  if (std::abs(t.pdgId()) == TopInitID::tID) {
44  bool hasTopMother = false;
45  for (unsigned idx = 0; idx < t.numberOfMothers(); ++idx)
46  if (std::abs(t.mother(idx)->pdgId()) == TopInitID::tID)
47  hasTopMother = true;
48  if (hasTopMother)
49  continue;
50  for (unsigned idx = 0; idx < t.numberOfMothers(); ++idx) {
51  sel.emplace_back(t.mother(idx)->threeCharge(),
52  t.mother(idx)->p4(),
53  t.mother(idx)->vertex(),
54  t.mother(idx)->pdgId(),
55  t.mother(idx)->status(),
56  false);
57  }
58  break;
59  }
60  }
61 }
62 
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
TopInitSubset(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static constexpr int tID
Definition: TopInitSubset.cc:9
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
edm::EDGetTokenT< reco::GenParticleCollection > srcToken_
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511
void fillOutput(const reco::GenParticleCollection &, reco::GenParticleCollection &) const