Skip to content

Commit

Permalink
Additional setters and getters
Browse files Browse the repository at this point in the history
  • Loading branch information
austinschneider committed Sep 12, 2024
1 parent fd2bd6a commit 9094ed8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions projects/injection/private/Injector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ void Injector::AddSecondaryProcess(std::shared_ptr<siren::injection::SecondaryIn
secondary_position_distribution_map.insert({secondary->GetPrimaryType(), vtx_dist});
}

void Injector::SetSecondaryProcesses(std::vector<std::shared_ptr<siren::injection::SecondaryInjectionProcess>> secondaries) {
secondary_processes.clear();
secondary_position_distributions.clear();
secondary_process_map.clear();
secondary_position_distribution_map.clear();
for(auto secondary : secondaries) {
AddSecondaryProcess(secondary);
}
}

siren::dataclasses::InteractionRecord Injector::NewRecord() const {
siren::dataclasses::InteractionRecord record;
record.signature.primary_type = primary_process->GetPrimaryType();
Expand Down
2 changes: 2 additions & 0 deletions projects/injection/private/pybindings/injection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ PYBIND11_MODULE(injection,m) {
.def(init<unsigned int, std::shared_ptr<siren::detector::DetectorModel>, std::shared_ptr<PrimaryInjectionProcess>, std::shared_ptr<siren::utilities::SIREN_random>>())
.def(init<unsigned int, std::shared_ptr<siren::detector::DetectorModel>, std::shared_ptr<PrimaryInjectionProcess>, std::vector<std::shared_ptr<SecondaryInjectionProcess>>, std::shared_ptr<siren::utilities::SIREN_random>>())
.def("SetStoppingCondition",&Injector::SetStoppingCondition)
.def("GetStoppingCondition",&Injector::GetStoppingCondition)
.def("SetPrimaryProcess",&Injector::SetPrimaryProcess)
.def("AddSecondaryProcess",&Injector::AddSecondaryProcess)
.def("GetPrimaryProcess",&Injector::GetPrimaryProcess)
Expand All @@ -83,6 +84,7 @@ PYBIND11_MODULE(injection,m) {
.def("Name",&Injector::Name)
.def("GetPrimaryInjectionDistributions",&Injector::GetPrimaryInjectionDistributions)
.def("GetDetectorModel",&Injector::GetDetectorModel)
.def("SetDetectorModel",&Injector::SetDetectorModel)
.def("GetInteractions",&Injector::GetInteractions)
.def("InjectedEvents",&Injector::InjectedEvents)
.def("EventsToInject",&Injector::EventsToInject)
Expand Down
2 changes: 2 additions & 0 deletions projects/injection/public/SIREN/injection/Injector.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ friend cereal::access;
Injector(unsigned int events_to_inject, std::shared_ptr<siren::detector::DetectorModel> detector_model, std::shared_ptr<injection::PrimaryInjectionProcess> primary_process, std::vector<std::shared_ptr<injection::SecondaryInjectionProcess>> secondary_processes, std::shared_ptr<siren::utilities::SIREN_random> random);

void SetStoppingCondition(std::function<bool(std::shared_ptr<siren::dataclasses::InteractionTreeDatum>, size_t)> f_in) {stopping_condition = f_in;}
std::function<bool(std::shared_ptr<siren::dataclasses::InteractionTreeDatum>, size_t)> GetStoppingCondition() {return stopping_condition;}
std::shared_ptr<distributions::VertexPositionDistribution> FindPrimaryVertexDistribution(std::shared_ptr<siren::injection::PrimaryInjectionProcess> process);
std::shared_ptr<distributions::SecondaryVertexPositionDistribution> FindSecondaryVertexDistribution(std::shared_ptr<siren::injection::SecondaryInjectionProcess> process);
void SetPrimaryProcess(std::shared_ptr<siren::injection::PrimaryInjectionProcess> primary);
std::shared_ptr<siren::injection::PrimaryInjectionProcess> GetPrimaryProcess() {return primary_process;}
std::vector<std::shared_ptr<siren::injection::SecondaryInjectionProcess>> GetSecondaryProcesses() {return secondary_processes;}
std::map<siren::dataclasses::ParticleType,std::shared_ptr<siren::injection::SecondaryInjectionProcess>> GetSecondaryProcessMap() {return secondary_process_map;}
void AddSecondaryProcess(std::shared_ptr<siren::injection::SecondaryInjectionProcess> secondary);
void SetSecondaryProcesses(std::vector<std::shared_ptr<siren::injection::SecondaryInjectionProcess>> secondary_processes);
virtual siren::dataclasses::InteractionRecord NewRecord() const; // set primary type from primary process;
void SetRandom(std::shared_ptr<siren::utilities::SIREN_random> random);
virtual void SampleCrossSection(siren::dataclasses::InteractionRecord & record) const;
Expand Down

0 comments on commit 9094ed8

Please sign in to comment.