Skip to content

Commit

Permalink
Simplify if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
dudarboh authored and tmadlener committed May 3, 2024
1 parent 331051c commit e24f05c
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions src/cpp/src/EXAMPLE/dumpmctree-dot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -664,35 +664,9 @@ void drawMcTree(LCEvent* event, bool drawSimulated, bool drawParton, bool drawOv
std::stringstream labels;

auto isRejected = [&](MCParticle* mc) -> bool {
bool rejected = false;
bool isParton = isBeforeHadronisation(mc);
if ( !drawSimulated && !drawOverlay && !drawParton ){
//Ignore simulated and overlay particles or particles above hadronisation (excluding hadronisation string/cluster itself)
rejected = mc->isCreatedInSimulation() || mc->isOverlay() || (isParton && (!(mc->getPDG() == 91 || mc->getPDG() == 92)) );
}
else if( drawSimulated && !drawOverlay && !drawParton ){
rejected = mc->isOverlay() || (isParton && (!(mc->getPDG() == 91 || mc->getPDG() == 92)) );
}
else if( !drawSimulated && drawOverlay && !drawParton ){
rejected = mc->isCreatedInSimulation() || (isParton && (!(mc->getPDG() == 91 || mc->getPDG() == 92)) );
}
else if ( !drawSimulated && !drawOverlay && drawParton ){
rejected = mc->isCreatedInSimulation() || mc->isOverlay();
}
else if ( drawSimulated && drawOverlay && !drawParton ){
rejected = isParton && (!(mc->getPDG() == 91 || mc->getPDG() == 92)) ;
}
else if ( drawSimulated && !drawOverlay && drawParton ){
rejected = mc->isOverlay();
}
else if ( !drawSimulated && drawOverlay && drawParton ){
rejected = mc->isCreatedInSimulation();
}
else{
// identical to: if else ( drawSimulated && drawOverlay && drawParton ){
rejected = false;
}
return rejected;
return (!drawSimulated && mc->isCreatedInSimulation()) ||
(!drawOverlay && mc->isOverlay()) ||
(!drawParton && (isBeforeHadronisation(mc) && (!(mc->getPDG() == 91 || mc->getPDG() == 92))) );
};


Expand Down

0 comments on commit e24f05c

Please sign in to comment.