37 #include "HepMC/GenParticle.h" 38 #include "HepMC/GenVertex.h" 77 std::unique_ptr<L1Analysis::L1AnalysisGeneratorDataFormat>
l1GenData_;
95 l1GenData_ = std::make_unique<L1Analysis::L1AnalysisGeneratorDataFormat>();
99 tree_->Branch(
"Generator",
"L1Analysis::L1AnalysisGeneratorDataFormat", &
l1GenData_, 32000, 3);
129 reco::GenJetCollection::const_iterator jetItr = genJets->begin();
130 reco::GenJetCollection::const_iterator jetEnd = genJets->end();
131 for( ; jetItr != jetEnd ; ++jetItr) {
133 l1GenData_->jetEta.push_back( jetItr->eta() );
134 l1GenData_->jetPhi.push_back( jetItr->phi() );
139 edm::LogWarning(
"MissingProduct") <<
"Gen jets not found. Branch will not be filled" << std::endl;
149 for(
size_t i = 0;
i < genParticles->size(); ++
i) {
154 int parentID = -10000;
156 for(
unsigned int i=0;
i<nMo;++
i){
157 int thisParentID = dynamic_cast
161 int hundredsIndex =
abs(thisParentID)/100;
162 int thousandsIndex =
abs(thisParentID)/1000;
163 if ( ((
abs(thisParentID) >= 23) &&
164 (
abs(thisParentID) <= 25)) ||
165 (
abs(thisParentID) == 6) ||
166 (hundredsIndex == 5) ||
167 (hundredsIndex == 4) ||
168 (thousandsIndex == 5) ||
169 (thousandsIndex == 4)
171 parentID = thisParentID;
173 if ((parentID == -10000) && (nMo > 0))
174 parentID = dynamic_cast
178 if ((parentID != p.
pdgId()) &&
208 if (!puInfoCollection.
isValid()) {
209 throw cms::Exception(
"ProductNotValid") <<
"pileupInfoSource not valid";
213 std::vector<PileupSummaryInfo>::const_iterator puItr = puInfoCollection->begin();
214 std::vector<PileupSummaryInfo>::const_iterator puEnd = puInfoCollection->end();
215 for( ; puItr != puEnd; ++puItr) {
216 int bx = puItr->getBunchCrossing();
218 l1GenData_->nMeanPU = puItr->getTrueNumInteractions();
219 l1GenData_->nVtx = puItr->getPU_NumInteractions();
virtual double pt() const final
transverse momentum
T getUntrackedParameter(std::string const &, T const &) const
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
#define DEFINE_FWK_MODULE(type)
T * make(const Args &...args) const
make new ROOT object
virtual int status() const final
status word
virtual double phi() const final
momentum azimuthal angle
virtual int charge() const final
electric charge
edm::Service< TFileService > fs_
virtual size_t numberOfMothers() const
number of mothers
edm::EDGetTokenT< reco::GenJetCollection > genJetToken_
edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
virtual int pdgId() const final
PDG identifier.
virtual 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 &)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
virtual void beginJob(void)
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...