63 src_(pset.getParameter<
InputTag>(
"src")),
65 maxEventsToPrint_ (pset.getUntrackedParameter<
int>(
"maxEventsToPrint",1)),
67 printOnlyHardInteraction_(pset.getUntrackedParameter<
bool>(
"printOnlyHardInteraction",
false)),
68 printVertex_(pset.getUntrackedParameter<
bool>(
"printVertex",
false)),
69 printFlags_(pset.getUntrackedParameter<
bool>(
"printFlags",
false)),
70 useMessageLogger_(pset.getUntrackedParameter<
bool>(
"useMessageLogger",
false)) {
77 std::ostringstream ss;
94 <<
"[ParticleListDrawer] analysing particle collection " <<
src_.
label() << endl;
96 snprintf(buf,
sizeof(buf),
" idx | ID - Name |Stat| Mo1 Mo2 Da1 Da2 |nMo nDa| pt eta phi | px py pz m |");
99 snprintf(buf,
sizeof(buf),
" vx vy vz |");
109 vector<const reco::Candidate *> cands;
110 vector<const Candidate *>::const_iterator
found = cands.begin();
112 p != particles->
end(); ++
p) {
113 cands.push_back(&*
p);
117 p != particles->
end();
126 idx =
p - particles->
begin();
133 int nMo =
p->numberOfMothers();
134 int nDa =
p->numberOfDaughters();
136 found =
find(cands.begin(), cands.end(),
p->mother(0));
137 if(found != cands.end()) iMo1 = found - cands.begin() ;
139 found =
find(cands.begin(), cands.end(),
p->mother(nMo-1));
140 if(found != cands.end()) iMo2 = found - cands.begin() ;
142 found =
find(cands.begin(), cands.end(),
p->daughter(0));
143 if(found != cands.end()) iDa1 = found - cands.begin() ;
145 found =
find(cands.begin(), cands.end(),
p->daughter(nDa-1));
146 if(found != cands.end()) iDa2 = found - cands.begin() ;
149 snprintf(buf,
sizeof(buf),
150 " %4d | %5d - %10s | %2d | %4d %4d %4d %4d | %2d %2d | %7.3f %10.3f %6.3f | %10.3f %10.3f %10.3f %8.3f |",
153 particleName.c_str(),
155 iMo1,iMo2,iDa1,iDa2,nMo,nDa,
167 snprintf(buf,
sizeof(buf),
" %10.3f %10.3f %10.3f |",
176 if (!gp)
throw cms::Exception(
"Unsupported",
"Status flags can be printed only for reco::GenParticle objects\n");
bool isPromptFinalState() const
bool isLastCopyBeforeFSR() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
def analyze(function, filename, filter=None)
#define DEFINE_FWK_MODULE(type)
bool isHardProcess() const
bool fromHardProcessBeforeFSR() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void getData(T &iHolder) const
edm::EDGetTokenT< reco::CandidateView > srcToken_
const_iterator begin() const
bool printOnlyHardInteraction_
ParticleListDrawer(const edm::ParameterSet &)
unsigned int nEventAnalyzed_
HepPDT::ParticleData ParticleData
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
const GenStatusFlags & statusFlags() const
bool fromHardProcessFinalState() const
edm::ESHandle< ParticleDataTable > pdt_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::string getParticleName(int id) const
bool isDirectPromptTauDecayProductFinalState() const
~ParticleListDrawer() override
const_iterator end() const
Module to analyze the particle listing as provided by common event generators.