Fixed calculation of currents (included particle weights)
This commit is contained in:
@@ -37,11 +37,14 @@ class CurrentCollector {
|
||||
|
||||
private:
|
||||
void collectRadialMovement(const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new);
|
||||
const blitz::TinyVector<int, 3>& bin_new,
|
||||
const double weight);
|
||||
void collectLongitudinalMovement(const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new);
|
||||
const blitz::TinyVector<int, 3>& bin_new,
|
||||
const double weight);
|
||||
void collectAzimuthalMovement(const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new);
|
||||
const blitz::TinyVector<int, 3>& bin_new,
|
||||
const double weight);
|
||||
|
||||
blitz::Array<double, 3> createAreaLongitudinal(
|
||||
const CylinderBinning& position_binning);
|
||||
|
||||
@@ -138,40 +138,45 @@ void CurrentCollector::collect(particle::Particle* particle,
|
||||
blitz::TinyVector<int, 3> bin_new =
|
||||
position_binning_.bin(particle->position().cylinderEntries());
|
||||
|
||||
collectRadialMovement(bin_old, bin_new);
|
||||
collectLongitudinalMovement(bin_old, bin_new);
|
||||
collectAzimuthalMovement(bin_old, bin_new);
|
||||
const double weight = particle->weight();
|
||||
|
||||
collectRadialMovement(bin_old, bin_new, weight);
|
||||
collectLongitudinalMovement(bin_old, bin_new, weight);
|
||||
collectAzimuthalMovement(bin_old, bin_new, weight);
|
||||
}
|
||||
|
||||
void CurrentCollector::collectRadialMovement(
|
||||
const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new) {
|
||||
const blitz::TinyVector<int, 3>& bin_new,
|
||||
const double weight) {
|
||||
if (bin_new(0) < bin_old(0)) {
|
||||
r_negative_crossings(bin_new(0), bin_old(1), bin_old(2)) += 1;
|
||||
r_negative_crossings(bin_new(0), bin_old(1), bin_old(2)) += weight;
|
||||
} else if (bin_new(0) > bin_old(0)) {
|
||||
r_positive_crossings(bin_new(0) - 1, bin_old(1), bin_old(2)) += 1;
|
||||
r_positive_crossings(bin_new(0) - 1, bin_old(1), bin_old(2)) += weight;
|
||||
}
|
||||
}
|
||||
void CurrentCollector::collectLongitudinalMovement(
|
||||
const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new) {
|
||||
const blitz::TinyVector<int, 3>& bin_new,
|
||||
const double weight) {
|
||||
if (bin_new(2) < bin_old(2)) {
|
||||
z_negative_crossings(bin_old(0), bin_old(1), bin_new(2) + 1) += 1;
|
||||
z_negative_crossings(bin_old(0), bin_old(1), bin_new(2) + 1) += weight;
|
||||
} else if (bin_new(2) > bin_old(2)) {
|
||||
z_positive_crossings(bin_old(0), bin_old(1), bin_new(2)) += 1;
|
||||
z_positive_crossings(bin_old(0), bin_old(1), bin_new(2)) += weight;
|
||||
}
|
||||
}
|
||||
void CurrentCollector::collectAzimuthalMovement(
|
||||
const blitz::TinyVector<int, 3>& bin_old,
|
||||
const blitz::TinyVector<int, 3>& bin_new) {
|
||||
const blitz::TinyVector<int, 3>& bin_new,
|
||||
const double weight) {
|
||||
if ((bin_new(1) < bin_old(1)) ||
|
||||
((bin_old(1) == 0) &&
|
||||
(bin_new(1) == position_binning_.binIndexMax()(1)))) {
|
||||
phi_negative_crossings(bin_old(0), bin_new(1), bin_old(2)) += 1;
|
||||
phi_negative_crossings(bin_old(0), bin_new(1), bin_old(2)) += weight;
|
||||
} else if ((bin_new(1) > bin_old(1)) ||
|
||||
((bin_old(1) == position_binning_.binIndexMax()(1)) &&
|
||||
(bin_new(1) == 0))) {
|
||||
phi_positive_crossings(bin_old(0), bin_new(1) - 1, bin_old(2)) += 1;
|
||||
phi_positive_crossings(bin_old(0), bin_new(1) - 1, bin_old(2)) += weight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user