[no commit message]

This commit is contained in:
darksnake 2016-06-30 13:09:30 +03:00
parent c86891a8c8
commit 6b269625c9
3 changed files with 6 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import static java.lang.Math.max;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static java.lang.Math.max;
/**
* Utility class for pile-up simulation

View File

@ -122,10 +122,10 @@ public class NMEventGenerator {
chanel = 1600;
}
return new NMEvent(chanel, prev == null ? 0 : prev.getTime() + nextExp(1 / cr));
return new NMEvent(chanel, prev == null ? 0 : prev.getTime() + nextExpDecay(1 / cr));
}
public double nextExp(double mean) {
public double nextExpDecay(double mean) {
double rand = this.nextUniform();
return -mean * Math.log(1 - rand);
}

View File

@ -118,7 +118,7 @@ public class PileUpSimulator {
//flag that shows that previous event was pileup
//not counting double pileups
if (current != null) {
double delay = (next.getTime() - current.getTime()) / us;
double delay = (next.getTime() - current.getTime()) / us; //time between events in microseconds
if (nextEventRegistered(delay)) {
//just register new event
registred.add(next.clone());
@ -131,9 +131,10 @@ public class PileUpSimulator {
registred.remove(registred.size() - 1);
registred.add(newEvent.clone());
pileup.add(newEvent.clone());
pileupFlag = true;
pileupFlag = true; // up the flag to avoid secondary pileup
} else {
// second event not registered
pileupFlag = false;
}
} else {
//register first event