Skip to content

Commit de2523e

Browse files
authored
Merge pull request #45646 from mmusich/mm_dev_fix_for_45639
`MultiTrajectoryStateAssembler`: protect `removeWrongPz` when average pZ sign is identically 0
2 parents 5e1e380 + 24d4fd2 commit de2523e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

TrackingTools/GsfTools/src/MultiTrajectoryStateAssembler.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,23 @@ void MultiTrajectoryStateAssembler::removeWrongPz() {
190190
for (auto const &is : theStates)
191191
meanPz += is.weight() * is.localParameters().pzSign();
192192
meanPz /= theValidWeightSum;
193+
194+
// When meanPz=0 it is not possible to check which are the states non agreeing with the average pZ sign
195+
if (meanPz == 0.) {
196+
edm::LogError("MultiTrajectoryStateAssembler")
197+
<< " input multistate has average pZ sign == 0. Rejecting!" << std::endl;
198+
theStates.clear();
199+
return;
200+
}
201+
193202
//
194203
// Now keep only states compatible with the average pz
195204
//
196205
theValidWeightSum = 0.;
197206
MultiTSOS oldStates(theStates);
198207
theStates.clear();
199208
for (auto const &is : oldStates) {
200-
if (meanPz * is.localParameters().pzSign() >= 0.) {
209+
if (meanPz * is.localParameters().pzSign() > 0.) {
201210
theValidWeightSum += is.weight();
202211
theStates.push_back(is);
203212
} else {

0 commit comments

Comments
 (0)