37 #include "HepMC/GenParticle.h"
38 #include "HepMC/GenVertex.h"
74 std::unique_ptr<L1Analysis::L1AnalysisGeneratorDataFormat>
l1GenData_;
91 l1GenData_ = std::make_unique<L1Analysis::L1AnalysisGeneratorDataFormat>();
95 tree_->Branch(
"Generator",
"L1Analysis::L1AnalysisGeneratorDataFormat",
l1GenData_.get(), 32000, 3);
123 reco::GenJetCollection::const_iterator jetItr =
genJets->begin();
124 reco::GenJetCollection::const_iterator jetEnd =
genJets->end();
125 for (; jetItr != jetEnd; ++jetItr) {
133 edm::LogWarning(
"MissingProduct") <<
"Gen jets not found. Branch will not be filled" << std::endl;
147 int parentID = -10000;
148 unsigned int nMo =
p.numberOfMothers();
149 for (
unsigned int i = 0;
i < nMo; ++
i) {
150 int thisParentID = dynamic_cast<const reco::GenParticle*>(
p.mother(
i))->
pdgId();
153 int hundredsIndex =
abs(thisParentID) / 100;
154 int thousandsIndex =
abs(thisParentID) / 1000;
155 if (((
abs(thisParentID) >= 23) && (
abs(thisParentID) <= 25)) || (
abs(thisParentID) == 6) ||
156 (hundredsIndex == 5) || (hundredsIndex == 4) || (thousandsIndex == 5) || (thousandsIndex == 4))
157 parentID = thisParentID;
159 if ((parentID == -10000) && (nMo > 0))
160 parentID = dynamic_cast<const reco::GenParticle*>(
p.mother(0))->
pdgId();
163 if ((parentID !=
p.pdgId()) &&
164 ((parentID > -9999) || (
abs(
id) == 11) || (
abs(
id) == 13) || (
abs(
id) == 23) || (
abs(
id) == 24) ||
165 (
abs(
id) == 25) || (
abs(
id) == 4) || (
abs(
id) == 5) || (
abs(
id) == 6))) {
183 if (!puInfoCollection.
isValid()) {
184 throw cms::Exception(
"ProductNotValid") <<
"pileupInfoSource not valid";
188 std::vector<PileupSummaryInfo>::const_iterator puItr = puInfoCollection->begin();
189 std::vector<PileupSummaryInfo>::const_iterator puEnd = puInfoCollection->end();
190 for (; puItr != puEnd; ++puItr) {
191 int bx = puItr->getBunchCrossing();
193 l1GenData_->nMeanPU = puItr->getTrueNumInteractions();
194 l1GenData_->nVtx = puItr->getPU_NumInteractions();