Skip to content

Commit 730f5d2

Browse files
committed
Add print options in genbb::primary_particle and mctools::simulated_data
1 parent b929891 commit 730f5d2

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

source/bxgenbb_help/src/primary_event.cc

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ namespace genbb {
395395
base_print_options popts;
396396
popts.configure_from(options_);
397397
std::ostringstream outs;
398+
bool list_particles = options_.get<bool>("list_particles", true);
398399
if (! popts.title.empty ()) {
399400
outs << popts.indent << popts.title << std::endl;
400401
}
@@ -422,29 +423,30 @@ namespace genbb {
422423
outs << std::endl;
423424

424425
outs << popts.indent << tag << "Particles: [" << _particles_.size() << "]" << std::endl;
425-
426-
int particle_counter = 0;
427-
for (particles_col_type::const_iterator it = _particles_.begin();
428-
it != _particles_.end();
429-
it++) {
430-
std::ostringstream indent_oss;
431-
indent_oss << popts.indent << skip_tag;
432-
particles_col_type::const_iterator jt = it;
433-
jt++;
434-
outs << popts.indent << skip_tag;
435-
if (jt == _particles_.end()) {
436-
outs << last_tag;
437-
indent_oss << last_skip_tag;
438-
} else {
439-
outs << tag;
440-
indent_oss << skip_tag;
426+
if (list_particles) {
427+
int particle_counter = 0;
428+
for (particles_col_type::const_iterator it = _particles_.begin();
429+
it != _particles_.end();
430+
it++) {
431+
std::ostringstream indent_oss;
432+
indent_oss << popts.indent << skip_tag;
433+
particles_col_type::const_iterator jt = it;
434+
jt++;
435+
outs << popts.indent << skip_tag;
436+
if (jt == _particles_.end()) {
437+
outs << last_tag;
438+
indent_oss << last_skip_tag;
439+
} else {
440+
outs << tag;
441+
indent_oss << skip_tag;
442+
}
443+
outs << "Particle #" << particle_counter << " : " << std::endl;
444+
boost::property_tree::ptree popts2;
445+
popts2.put("indent", indent_oss.str());
446+
it->print_tree(outs, popts2);
447+
// it->tree_dump(outs, "", indent_oss.str());
448+
particle_counter++;
441449
}
442-
outs << "Particle #" << particle_counter << " : " << std::endl;
443-
boost::property_tree::ptree popts2;
444-
popts2.put("indent", indent_oss.str());
445-
it->print_tree(outs, popts2);
446-
// it->tree_dump(outs, "", indent_oss.str());
447-
particle_counter++;
448450
}
449451
outs << popts.indent << tag
450452
<< "GENBB weight : " << get_genbb_weight()

source/bxmctools/src/simulated_data.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ namespace mctools {
581581
datatools::i_tree_dumpable::base_print_options popts;
582582
popts.configure_from(options_);
583583
bool hit_list = options_.get<bool>("list_hits", false);
584+
bool primary_particle_list = options_.get<bool>("list_primary_particles", false);
584585
if (! popts.title.empty ()) {
585586
out_ << popts.indent << popts.title << std::endl;
586587
}
@@ -699,12 +700,16 @@ namespace mctools {
699700
// Primary event:
700701
{
701702
out_ << popts.indent << datatools::i_tree_dumpable::tag
702-
<< "Primary event : " << std::endl;
703+
<< "Primary event : "
704+
<< std::endl;
703705
{
704706
std::ostringstream indent_oss;
705707
indent_oss << popts.indent;
706708
indent_oss << datatools::i_tree_dumpable::skip_tag;
707-
_primary_event_.tree_dump(out_, "", indent_oss.str());
709+
boost::property_tree::ptree pe_options;
710+
pe_options.put("indent", indent_oss.str());
711+
pe_options.put("list_particles", primary_particle_list);
712+
_primary_event_.print_tree(out_, pe_options);
708713
}
709714
}
710715

0 commit comments

Comments
 (0)