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) {
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 getParameter(std::string const &) const
const std::vector< double > & binningValues() const
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< GenEventInfoProduct > genInfoToken_
T getUntrackedParameter(std::string const &, T const &) const
~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)
std::unique_ptr< L1Analysis::L1AnalysisGeneratorDataFormat > l1GenData_
L1GenTreeProducer(const edm::ParameterSet &)
T * make(const Args &...args) const
make new ROOT object
bool hasBinningValues() const
Log< level::Warning, false > LogWarning