CMS 3D CMS Logo

TopInitSubset.cc
Go to the documentation of this file.
2 
4  : srcToken_(consumes<reco::GenParticleCollection>(cfg.getParameter<edm::InputTag>("src"))) {
5  produces<reco::GenParticleCollection>();
6 }
7 
9 
12  evt.getByToken(srcToken_, src);
13 
15  std::unique_ptr<reco::GenParticleCollection> sel(new reco::GenParticleCollection);
16 
17  //fill output collection
18  fillOutput(*src, *sel);
19 
20  evt.put(std::move(sel));
21 }
22 
24  for (reco::GenParticleCollection::const_iterator t = src.begin(); t != src.end(); ++t) {
25  if (std::abs(t->pdgId()) == TopInitID::tID) {
26  bool hasTopMother = false;
27  for (unsigned idx = 0; idx < t->numberOfMothers(); ++idx)
28  if (std::abs(t->mother(idx)->pdgId()) == TopInitID::tID)
29  hasTopMother = true;
30  if (hasTopMother)
31  continue;
32  for (unsigned idx = 0; idx < t->numberOfMothers(); ++idx) {
33  reco::GenParticle* cand = new reco::GenParticle(t->mother(idx)->threeCharge(),
34  t->mother(idx)->p4(),
35  t->mother(idx)->vertex(),
36  t->mother(idx)->pdgId(),
37  t->mother(idx)->status(),
38  false);
39  std::unique_ptr<reco::GenParticle> ptr(cand);
40  sel.push_back(*ptr);
41  }
42  break;
43  }
44  }
45 }
edm::RefProd< GenParticleCollection >
edm::Event::getRefBeforePut
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
TopInitSubset::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: TopInitSubset.cc:10
reco::GenParticle
Definition: GenParticle.h:21
TopInitSubset::srcToken_
edm::EDGetTokenT< reco::GenParticleCollection > srcToken_
Definition: TopInitSubset.h:22
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition: GenParticleFwd.h:13
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle< reco::GenParticleCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
TopInitSubset.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
edm::ParameterSet
Definition: ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
cand
Definition: decayParser.h:32
TopInitSubset::TopInitSubset
TopInitSubset(const edm::ParameterSet &)
Definition: TopInitSubset.cc:3
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup
Definition: EventSetup.h:58
looper.cfg
cfg
Definition: looper.py:297
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
TopInitID::tID
static const int tID
Definition: TopInitSubset.h:10
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
TopInitSubset::fillOutput
void fillOutput(const reco::GenParticleCollection &, reco::GenParticleCollection &)
Definition: TopInitSubset.cc:23
edm::Event
Definition: Event.h:73
TopInitSubset::~TopInitSubset
~TopInitSubset() override
Definition: TopInitSubset.cc:8
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644