// // electron_drift.h // mc_electron // // Created by Christian Reiling on 16.05.19. // Copyright © 2019 Christian Reiling. All rights reserved. // #ifndef electron_drift_h #define electron_drift_h #include "drift_base.h" class E_Mover_Drift : public Drift_Base { public: E_Mover_Drift(Particle_Logger_Base *Logger, Population_Base *Population) : Drift_Base(electron, Logger, Population) {}; protected: void doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m); }; void E_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) { if (*znew_m >= Katrin_Geo::get_z_WGTSend_m()) { // Moveing into Spectrometer and reversing Speed. vec3 reverseLoc_m = *oldLoc_m; // Log Movement before Reflection reverseLoc_m[2] = Katrin_Geo::get_z_WGTSend_m(); Logger->log(*movePart, *oldLoc_m); Population->increase_density(*movePart, *oldLoc_m); // Final Movement *oldLoc_m = reverseLoc_m; *znew_m = Katrin_Geo::get_z_WGTSend_m() - (*znew_m - Katrin_Geo::get_z_WGTSend_m()); movePart->set_Speed_ms( -1*(movePart->get_Speed_ms()) ); } if (*znew_m <= Katrin_Geo::get_z_RW_m()) { *znew_m = Katrin_Geo::get_z_RW_m(); } } #endif /* electron_drift_h */