-
Notifications
You must be signed in to change notification settings - Fork 69
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
Reworking of the ObserverTimeEvolution #511
base: master
Are you sure you want to change the base?
Changes from all commits
37cde69
05134f1
18eb0a5
5cfc6bf
0896f73
a46d27b
f0f3d24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,12 +241,21 @@ class ObserverParticleIdVeto: public ObserverFeature { | |
*/ | ||
class ObserverTimeEvolution: public ObserverFeature { | ||
private: | ||
std::vector<double> detList; | ||
int numb; | ||
bool islog = false, useCustomGetTime = false; | ||
double min, max; | ||
public: | ||
// List containing all used times, is constructed in constructor or by user manually | ||
// (leave empty if you want to rather use functions) | ||
std::vector<double> detList; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. detList is here defined public since it is necessary that the user has full control over it |
||
|
||
// Pointer to user defined version of getTime (should return time for corresponding index) | ||
double (*customGetTime)(int index, double min, double max, int numb); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the same goes for the customGetTime pointer |
||
|
||
/** Default constructor | ||
*/ | ||
ObserverTimeEvolution(); | ||
/** Constructor | ||
/** Constructor (calculates the maximum from min + dist * numb) | ||
@param min minimum time | ||
@param dist time interval for detection | ||
@param numb number of time intervals | ||
|
@@ -259,12 +268,23 @@ class ObserverTimeEvolution: public ObserverFeature { | |
@param log log (input: true) or lin (input: false) scaling between min and max with numb steps | ||
*/ | ||
ObserverTimeEvolution(double min, double max, double numb, bool log); | ||
// Add a new time step to the detection time list of the observer | ||
void addTime(const double &position); | ||
// Using log or lin spacing of times in the range between min and | ||
// max for observing particles | ||
void addTimeRange(double min, double max, double numb, bool log = false); | ||
const std::vector<double>& getTimes() const; | ||
/** Constructor | ||
@param detList user defined vector<double> with times to check | ||
*/ | ||
ObserverTimeEvolution(const std::vector<double> &detList); | ||
// Destructor | ||
~ObserverTimeEvolution(){} | ||
|
||
/** Function to set a user defined function, which takes index, min, max and numb to calculate the time at index | ||
@param userDefinedFunction function which will be called instead of getTime, should return time for corresponding index | ||
min time, max time, and number of times | ||
*/ | ||
void setUserDefinedGetTime(double (*userDefinedFunction)(int index, double min, double max, int numb)); | ||
// Get time at specified index, either with log or lin spacing of times | ||
// in the range between min and max for obeserving particles. | ||
double getTime(std::size_t index) const; | ||
// Return a vector containing all times between min and max generated by getTime | ||
const std::vector<double>& getTimes(); | ||
DetectionState checkDetection(Candidate *candidate) const; | ||
std::string getDescription() const; | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,6 +236,7 @@ TEST(ObserverFeature, TimeEvolution) { | |
Observer obs; | ||
obs.setDeactivateOnDetection(false); | ||
obs.setFlag("Detected", "Detected"); | ||
//min = 5, max = min + numb*dist = 5 + 2*5 = 15, detection can happen at [5, 15] | ||
obs.add(new ObserverTimeEvolution(5, 5, 2)); | ||
Candidate c; | ||
c.setNextStep(10); | ||
|
@@ -261,7 +262,7 @@ TEST(ObserverFeature, TimeEvolution) { | |
|
||
// detection two | ||
c.setCurrentStep(0.1); | ||
c.setTrajectoryLength(10.05); | ||
c.setTrajectoryLength(15.05); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I changed the trajectory length of the candidate to a length larger then the last |
||
obs.process(&c); | ||
EXPECT_TRUE(c.isActive()); | ||
EXPECT_TRUE(c.hasProperty("Detected")); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file I changed the
Run_MomentumDiffusion
function in cell 12:maxD = N_obs * deltaD
->maxD = (N_obs + 1) * deltaD
since the minimum is set to
D_min = deltaD