Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to squash the event vertices at the end to (0,0,0,0). #6

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cpp/abconv/ArgumentProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ UserArguments ArgumentProcessor::Process(int argc, char **argv)
std::vector<std::string> optAllFiles;
std::string preset="0";
bool ab_off = false;
bool squash_vtx = false;
bool plot_off = false;
bool check_ca = false;
unsigned long process_limit = 0;
Expand All @@ -34,6 +35,7 @@ UserArguments ArgumentProcessor::Process(int argc, char **argv)
app.add_option("-l, --limit", process_limit, "Limit number of events to process. (Shutdown after this number of parsed events).");

app.add_flag("--ab-off", ab_off, "No afterburner is applied");
app.add_flag("--squash-vtx", squash_vtx, "Squash all event vertices at the end to (0,0,0,0).");
app.add_flag("--plot-off", plot_off, "Don't produce validation plots");
app.add_flag("--exit-ca", check_ca, "Check existing crossing angle and exit if CA>1mrad");
app.set_version_flag("-v, --version", "0.1.1");
Expand Down Expand Up @@ -73,6 +75,7 @@ UserArguments ArgumentProcessor::Process(int argc, char **argv)

// Does afterburner off at all?
result.AfterburnerEnabled = !ab_off;
result.SquashVertex = squash_vtx;

// Limit on number of processed events
result.EventProcessLimit = process_limit;
Expand Down
3 changes: 2 additions & 1 deletion cpp/abconv/ArgumentProcessor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ struct UserArguments
std::string OutputHistFileName; /// Exact file name for histograms file
bool PlottingEnabled; /// Don't produce validation plots
bool AfterburnerEnabled; /// Switch off afterburner
unsigned long EventProcessLimit; /// Limit on processed events. Will shut down after this number of events processed
bool SquashVertex; /// Squash event vertices to (0,0,0,0)
unsigned long EventProcessLimit; /// Limit on processed events. Will shut down after this number of events processed

long StartEventIndex; /// Start event index (all skipped before that)
long EndEventIndex; /// End event index (stop after that)
Expand Down
4 changes: 3 additions & 1 deletion cpp/abconv/Converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ void ab::abconv::Converter::convert() {

// Translate
auto vtx = ab_result.vertex;
evt.shift_position_to(FourVector(vtx.x(), vtx.y(), vtx.z(), vtx.t()));
if( ! _afterburner->config().squash_vertex ) {
veprbl marked this conversation as resolved.
Show resolved Hide resolved
evt.shift_position_to(FourVector(vtx.x(), vtx.y(), vtx.z(), vtx.t()));
}
if(_verbose) {
std::cout << "************\nAFTER TRANSLATION\n************\n";
Print::content(evt);
Expand Down
2 changes: 2 additions & 0 deletions cpp/abconv/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ int main(int argc, char** argv)

// Check how to configure the afterburner
auto ab_config = ab::convert::ConfigProvider::from_user_args(arg);
ab_config.squash_vertex = arg.SquashVertex; // squash config option

afterburner->set_config(ab_config);
} else {
std::cout<<"Afterburner is DISABLED\n";
Expand Down
1 change: 1 addition & 0 deletions cpp/afterburner/Afterburner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ void ab::Afterburner::print() const {

cout << "Vertex distribution function: " << smear_func_to_str(_cfg.vertex_smear_func) << endl;
cout << "Vertex simulation is: " << (_cfg.use_beam_bunch_sim ? string("on") : std::string("off")) << endl;
cout << "Vertex squashing at end is: " << (_cfg.squash_vertex ? string("on") : string("off")) << endl;
cout << "Hadron beam:\n";
cout << " rms emittance : hor = " << _cfg.hadron_beam.rms_emittance_hor << ", ver = " << _cfg.hadron_beam.rms_emittance_ver << endl;
cout << " beta star : hor = " << _cfg.hadron_beam.beta_star_hor << ", ver = " << _cfg.hadron_beam.beta_star_ver << endl;
Expand Down
1 change: 1 addition & 0 deletions cpp/afterburner/AfterburnerConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace ab {
* */
SmearFuncs vertex_smear_func = SmearFuncs::Gauss;

bool squash_vertex = false;
/** Smearing width (be it Gauss or Flat)
* (!) These fields relevant only if use_beam_bunch_sim = FALSE
* */
Expand Down