[no commit message]
This commit is contained in:
parent
c86891a8c8
commit
6b269625c9
@ -21,6 +21,7 @@ import static java.lang.Math.max;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import static java.lang.Math.max;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for pile-up simulation
|
* Utility class for pile-up simulation
|
||||||
|
@ -122,10 +122,10 @@ public class NMEventGenerator {
|
|||||||
chanel = 1600;
|
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();
|
double rand = this.nextUniform();
|
||||||
return -mean * Math.log(1 - rand);
|
return -mean * Math.log(1 - rand);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class PileUpSimulator {
|
|||||||
//flag that shows that previous event was pileup
|
//flag that shows that previous event was pileup
|
||||||
//not counting double pileups
|
//not counting double pileups
|
||||||
if (current != null) {
|
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)) {
|
if (nextEventRegistered(delay)) {
|
||||||
//just register new event
|
//just register new event
|
||||||
registred.add(next.clone());
|
registred.add(next.clone());
|
||||||
@ -131,9 +131,10 @@ public class PileUpSimulator {
|
|||||||
registred.remove(registred.size() - 1);
|
registred.remove(registred.size() - 1);
|
||||||
registred.add(newEvent.clone());
|
registred.add(newEvent.clone());
|
||||||
pileup.add(newEvent.clone());
|
pileup.add(newEvent.clone());
|
||||||
pileupFlag = true;
|
pileupFlag = true; // up the flag to avoid secondary pileup
|
||||||
} else {
|
} else {
|
||||||
// second event not registered
|
// second event not registered
|
||||||
|
pileupFlag = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//register first event
|
//register first event
|
||||||
|
Loading…
Reference in New Issue
Block a user