38 #include "HepMC/GenParticle.h" 39 #include "HepMC/GenVertex.h" 78 std::unique_ptr<L1Analysis::L1AnalysisGeneratorDataFormat>
l1GenData_;
98 l1GenData_ = std::make_unique<L1Analysis::L1AnalysisGeneratorDataFormat>();
102 tree_->Branch(
"Generator",
"L1Analysis::L1AnalysisGeneratorDataFormat",
l1GenData_.get(), 32000, 3);
139 reco::GenJetCollection::const_iterator jetItr = genJets->begin();
140 reco::GenJetCollection::const_iterator jetEnd = genJets->end();
141 for( ; jetItr != jetEnd ; ++jetItr) {
143 l1GenData_->jetEta.push_back( jetItr->eta() );
144 l1GenData_->jetPhi.push_back( jetItr->phi() );
149 edm::LogWarning(
"MissingProduct") <<
"Gen jets not found. Branch will not be filled" << std::endl;
159 for(
size_t i = 0;
i < genParticles->size(); ++
i) {
164 int parentID = -10000;
166 for(
unsigned int i=0;
i<nMo;++
i){
167 int thisParentID = dynamic_cast
171 int hundredsIndex =
abs(thisParentID)/100;
172 int thousandsIndex =
abs(thisParentID)/1000;
173 if ( ((
abs(thisParentID) >= 23) &&
174 (
abs(thisParentID) <= 25)) ||
175 (
abs(thisParentID) == 6) ||
176 (hundredsIndex == 5) ||
177 (hundredsIndex == 4) ||
178 (thousandsIndex == 5) ||
179 (thousandsIndex == 4)
181 parentID = thisParentID;
183 if ((parentID == -10000) && (nMo > 0))
184 parentID = dynamic_cast
188 if ((parentID != p.
pdgId()) &&
218 if (!puInfoCollection.
isValid()) {
219 throw cms::Exception(
"ProductNotValid") <<
"pileupInfoSource not valid";
223 std::vector<PileupSummaryInfo>::const_iterator puItr = puInfoCollection->begin();
224 std::vector<PileupSummaryInfo>::const_iterator puEnd = puInfoCollection->end();
225 for( ; puItr != puEnd; ++puItr) {
226 int bx = puItr->getBunchCrossing();
228 l1GenData_->nMeanPU = puItr->getTrueNumInteractions();
229 l1GenData_->nVtx = puItr->getPU_NumInteractions();
T getParameter(std::string const &) const
int pdgId() const final
PDG identifier.
T getUntrackedParameter(std::string const &, T const &) const
double eta() const final
momentum pseudorapidity
const std::vector< double > & binningValues() const
bool hasBinningValues() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
size_t numberOfMothers() const override
number of mothers
void analyze(const edm::Event &, const edm::EventSetup &) override
double pt() const final
transverse momentum
T * make(const Args &...args) const
make new ROOT object
edm::EDGetTokenT< GenEventInfoProduct > genInfoToken_
int charge() const final
electric charge
~L1GenTreeProducer() override
edm::Service< TFileService > fs_
#define DEFINE_FWK_MODULE(type)
void beginJob(void) override
edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
double energy() const final
energy
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 &)
int status() const final
status word
double phi() const final
momentum azimuthal angle
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...