// // terminator_base.h // mc_electron // // Created by Christian Reiling on 19.05.19. // Copyright © 2019 Christian Reiling. All rights reserved. // #ifndef terminator_base_h #define terminator_base_h #include "process_base.h" #include "particle.hpp" #include "katrin_geo.h" class Terminator_Base : public Process_Base { public: Terminator_Base(species this_species) : Process_Base(this_species) {}; virtual bool checkTermination (const Particle &movePart) = 0; }; class MaxInteractions_Terminator_Base { int maxInteractions; int interactionsCount = 0; int curId = 0; public: MaxInteractions_Terminator_Base(const int &maxInteractions) { this->maxInteractions = maxInteractions; } protected: bool check_MaxInteractions(const Particle &movePart) { int Id = movePart.get_Id(); if (Id != curId) { curId = Id; interactionsCount = 0; } interactionsCount +=1; if (interactionsCount >= maxInteractions) { return true; } return false; } }; class Energy_Terminator_Base { double cutoffEnergy_eV; public: Energy_Terminator_Base(const double &cutoffEnergy_eV) { this->cutoffEnergy_eV = cutoffEnergy_eV; } protected: bool check_Energy(const Particle &movePart) { double E_eV = movePart.get_E_eV(); if (E_eV<=cutoffEnergy_eV) { return true; } return false; } }; #endif /* terminator_base_h */