20 #include "fastjet/PseudoJet.hh"
21 #include "AthLinks/ElementLinkVector.h"
63 typedef std::vector<const xAOD::IParticle*>
APVector;
66 typedef std::vector<const xAOD::MuonSegment*>
MSVector;
78 int dump_object(
const T* pjet,
const std::string& objtypename=
"Unknown")
const;
82 template<
typename TList>
83 int dump_collection(
const TList* pjets,
const std::string& objtypename=
"Unknown")
const;
105 template<
typename TObj,
typename TMom>
107 template<
typename TObj>
109 template<
typename TObj>
111 template<
typename TObj>
112 void get_moment(TObj* pobj, std::string
name, std::vector<int>&)
const;
113 template<
typename TObj>
114 void get_moment(TObj* pobj, std::string
name, std::vector<float>&)
const;
115 template<
typename TMom>
121 template<
typename TObj>
125 template<
typename TObj>
128 template<
typename TObj>
131 template<
typename TObj>
134 template<
typename TObj>
143 void extra_info(
const fastjet::PseudoJet* ppsj, std::ostream&
out,
int linedetail)
const;
167 template<
typename T,
typename TMom>
178 msg() << MSG::INFO << objtypename <<
" ";
184 const double mevtogev = 0.001;
185 const int wname = 30;
192 std::ostringstream ssjetline;
194 ssjetline <<
"pT =" << std::setw(6) << std::fixed << std::setprecision(1) << mevtogev*pjet->pt() <<
" GeV";
195 ssjetline <<
", m =" << std::setw(6) << std::fixed << std::setprecision(1) << mevtogev*pjet->m() <<
" GeV";
196 ssjetline <<
", eta =" << std::setw(5) << std::fixed << std::setprecision(2) << pjet->eta();
197 ssjetline <<
", phi =" << std::setw(5) << std::fixed << std::setprecision(2) << pjet->phi();
213 if ( fnames.size() == 0 ) fnames = get_moment_keys<T,float>(pjet);
214 ATH_MSG_INFO(
" " << objtypename <<
" has " << fnames.size() <<
" float attributes:");
215 for ( NameList::const_iterator inam=fnames.begin(); inam!=fnames.end(); ++inam ) {
220 ATH_MSG_INFO(std::setw(wname) <<
name <<
":" << std::setw(16) << std::scientific << std::setprecision(3) <<
val);
222 ATH_MSG_INFO(std::setw(wname) <<
name <<
":" << std::setw(12) << std::fixed << std::setprecision(3) <<
val);
225 if ( inames.size() == 0 ) inames = get_moment_keys<T,int>(pjet);
226 ATH_MSG_INFO(
" " << objtypename <<
" has " << inames.size() <<
" int attributes:");
227 for ( NameList::const_iterator inam=inames.begin(); inam!=inames.end(); ++inam ) {
231 ATH_MSG_INFO(std::setw(wname) <<
name <<
":" << std::setw(12) << std::fixed << std::setprecision(3) <<
ival);
233 if ( bnames.size() == 0 ) bnames = get_moment_keys<T,int>(pjet);
234 ATH_MSG_INFO(
" " << objtypename <<
" has " << bnames.size() <<
" bool attributes:");
235 for ( NameList::const_iterator inam=bnames.begin(); inam!=bnames.end(); ++inam ) {
239 std::string sval =
val ?
"true" :
"false";
242 if ( cbnames.size() == 0 ) cbnames = get_moment_keys<T,int>(pjet);
243 ATH_MSG_INFO(
" " << objtypename <<
" has " << cbnames.size() <<
" cbool attributes:");
244 for ( NameList::const_iterator inam=cbnames.begin(); inam!=cbnames.end(); ++inam ) {
248 std::string sval =
val ?
"true" :
"false";
251 ATH_MSG_INFO(
" " << objtypename <<
" has " << snames.size() <<
" string attributes:");
252 for ( NameList::const_iterator inam=snames.begin(); inam!=snames.end(); ++inam ) {
258 ATH_MSG_INFO(
" " << objtypename <<
" has " << vinames.size() <<
" vector<int> attributes:");
259 for ( NameList::const_iterator inam=vinames.begin(); inam!=vinames.end(); ++inam ) {
261 std::vector<int>
vals;
263 if (
vals.size() == 0 ) {
267 if (
vals.size() > 10 ) widx = 2;
274 ATH_MSG_INFO(
" " << objtypename <<
" has " << vfnames.size() <<
" vector<float> attributes:");
275 for ( NameList::const_iterator inam=vfnames.begin(); inam!=vfnames.end(); ++inam ) {
277 std::vector<float>
vals;
279 if (
vals.size() == 0 ) {
283 if (
vals.size() > 10 ) widx = 2;
286 << std::setw(12) << std::fixed << std::setprecision(3) <<
vals[
ival]);
290 ATH_MSG_INFO(
" " << objtypename <<
" has " << apnames.size() <<
" associated particle vectors:");
291 for ( NameList::const_iterator inam=apnames.begin(); inam!=apnames.end(); ++inam ) {
293 if (
name.find(
"MuonSegment") != std::string::npos ) {
298 std::string slab =
"entries";
299 if (
vals.size() == 1 ) slab =
"entry";
300 if (
vals.size() > 0 ) slab +=
":";
302 if ( els.size() ==
vals.size() ) {
303 for (
const MSEL&
el : els) {
304 ATH_MSG_INFO(std::setw(wname+2) <<
"" <<
el.dataID() <<
"[" <<
el.index() <<
"]");
307 for (
auto ppar :
vals) {
308 ATH_MSG_INFO(std::setw(wname+2) <<
"" << ppar->container() <<
"[" << ppar->index() <<
"]");
316 std::string slab =
"entries";
317 if (
vals.size() == 1 ) slab =
"entry";
318 if (
vals.size() > 0 ) slab +=
":";
321 if ( els.size() ==
vals.size() ) {
322 for (
const APEL&
el : els) {
323 ATH_MSG_INFO(std::setw(wname+2) <<
"" <<
el.dataID() <<
"[" <<
el.index() <<
"]");
326 for (
auto ppar :
vals) {
327 ATH_MSG_INFO(std::setw(wname+2) <<
"" << ppar->container() <<
"[" << ppar->index() <<
"]");
332 if ( fvnames.size() == 0 ) fvnames = get_moment_keys<T,float>(pjet);
333 ATH_MSG_INFO(
" " << objtypename <<
" has " << fvnames.size() <<
" four-vector attributes (pT m eta phi):");
334 for ( NameList::const_iterator inam=fvnames.begin(); inam!=fvnames.end(); ++inam ) {
339 << std::setw(12) << std::fixed << std::setprecision(3) <<
val.Pt()
340 << std::setw(12) << std::fixed << std::setprecision(3) <<
val.M()
341 << std::setw(12) << std::fixed << std::setprecision(3) <<
val.Eta()
342 << std::setw(12) << std::fixed << std::setprecision(3) <<
val.Phi()
345 ATH_MSG_INFO(
" " << objtypename <<
" has " << elnames.size() <<
" element-link attributes:");
346 for ( NameList::const_iterator inam=elnames.begin(); inam!=elnames.end(); ++inam ) {
347 std::string
name = *inam;
368 template<
typename TList>
370 int njet = pjets->size();
372 std::string
line =
"-------------------------------------------------------------------------";
375 unsigned int njetshow = njet;
377 typename TList::const_iterator itjet = pjets->begin();
379 std::vector<std::string> labs;
380 unsigned int wlab = 0;
381 for (
unsigned int ijet=0; ijet<njetshow; ++ijet ) {
382 TValue pjet = *itjet++;
385 if ( lab.size() > wlab ) wlab = lab.size();
387 itjet = pjets->begin();
389 if ( njetshow > 10 ) widx = 2;
390 if ( njetshow > 100 ) widx = 3;
391 if ( njetshow > 1000 ) widx = 4;
392 for (
unsigned int ijet=0; ijet<njetshow; ++ijet ) {
393 TValue pjet = *itjet++;
396 msg() << MSG::INFO <<
" ";
398 msg() << std::setw(wlab) << labs[ijet] <<
" ";
401 msg() << std::setw(widx) << ijet;
404 msg() <<
"[" << std::setw(widx) << ijet <<
"]";
416 template<
typename TObj,
typename TMom>
421 template<
typename TObj>
426 template<
typename TObj>
431 template<
typename TObj>
433 static const std::vector<int>
empty;
437 template<
typename TObj>
439 static const std::vector<float>
empty;
443 template<
typename TMom>
448 template<
typename TObj>
451 template<
typename TObj>
454 template<
typename TObj>
457 template<
typename TObj>
460 template<
typename TObj>
463 return " Not a jet.";
468 template<
typename T,
typename TMom>
477 out <<
", Unknown type: " <<
typeid(
T).
name();