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);
116 l1GenData_->pthat = genInfo->hasBinningValues() ? (genInfo->binningValues())[0] : 0.0;
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;
142 for (
size_t i = 0;
i < genParticles->size(); ++
i) {
147 int parentID = -10000;
149 for (
unsigned int i = 0;
i < nMo; ++
i) {
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))
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();
T getUntrackedParameter(std::string const &, T const &) const
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
double pt() const final
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
int status() const final
status word
T * make(const Args &...args) const
make new ROOT object
edm::EDGetTokenT< GenEventInfoProduct > genInfoToken_
size_t numberOfMothers() const override
number of mothers
int pdgId() const final
PDG identifier.
~L1GenTreeProducer() override
edm::Service< TFileService > fs_
void beginJob(void) override
edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
Abs< T >::type abs(const T &t)
TString nPart(Int_t part, TString string, TString delimit=";", Bool_t removerest=true)
T getParameter(std::string const &) const
std::unique_ptr< L1Analysis::L1AnalysisGeneratorDataFormat > l1GenData_
L1GenTreeProducer(const edm::ParameterSet &)
Log< level::Warning, false > LogWarning
double phi() const final
momentum azimuthal angle
int charge() const final
electric charge
double energy() const final
energy
double eta() const final
momentum pseudorapidity