From e7400a0f589eedd5c0be6461eae80c3bba4046e2 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Wed, 26 Jun 2024 12:03:58 +0200 Subject: [PATCH] Use bit field utilities in MCParticle --- edm4hep.yaml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/edm4hep.yaml b/edm4hep.yaml index eb823226c..d9b3daadc 100644 --- a/edm4hep.yaml +++ b/edm4hep.yaml @@ -280,18 +280,18 @@ datatypes: MutableExtraCode: includes: "#include " declaration: " - int32_t set_bit(int32_t val, int num, bool bitval){ return (val & ~(1<\n" declaration: " // define the bit positions for the simulation flag\n static const int BITCreatedInSimulation = 30;\n @@ -307,21 +307,21 @@ datatypes: getMomentum()[2]*getMomentum()[2] + getMass()*getMass() ) ;} \n /// True if the particle has been created by the simulation program (rather than the generator). \n - bool isCreatedInSimulation() const { return ( getSimulatorStatus() & ( 0x1 << BITCreatedInSimulation )) ; } \n + bool isCreatedInSimulation() const { return utils::checkBit(getSimulatorStatus(), BITCreatedInSimulation); } \n /// True if the particle is the result of a backscatter from a calorimeter shower. \n - bool isBackscatter() const { return ( getSimulatorStatus() & ( 0x1 << BITBackscatter )) ; } \n + bool isBackscatter() const { return utils::checkBit(getSimulatorStatus(), BITBackscatter); } \n /// True if the particle's vertex is not the endpoint of the parent particle. \n - bool vertexIsNotEndpointOfParent() const { return ( getSimulatorStatus() & ( 0x1 << BITVertexIsNotEndpointOfParent )) ; } \n + bool vertexIsNotEndpointOfParent() const { return utils::checkBit(getSimulatorStatus(), BITVertexIsNotEndpointOfParent); } \n /// True if the particle has interacted in a tracking region. \n - bool isDecayedInTracker() const { return ( getSimulatorStatus() & ( 0x1 << BITDecayedInTracker )) ; } \n + bool isDecayedInTracker() const { return utils::checkBit(getSimulatorStatus(), BITDecayedInTracker); } \n /// True if the particle has interacted in a calorimeter region. \n - bool isDecayedInCalorimeter() const { return ( getSimulatorStatus() & ( 0x1 << BITDecayedInCalorimeter )) ; } \n + bool isDecayedInCalorimeter() const { return utils::checkBit(getSimulatorStatus(), BITDecayedInCalorimeter); } \n /// True if the particle has left the world volume undecayed. \n - bool hasLeftDetector() const { return ( getSimulatorStatus() & ( 0x1 << BITLeftDetector )) ; }\n + bool hasLeftDetector() const { return utils::checkBit(getSimulatorStatus(), BITLeftDetector); }\n /// True if the particle has been stopped by the simulation program. \n - bool isStopped() const { return ( getSimulatorStatus() & ( 0x1 << BITStopped )) ; } \n + bool isStopped() const { return utils::checkBit(getSimulatorStatus(), BITStopped); } \n /// True if the particle has been overlayed by the simulation (or digitization) program.\n - bool isOverlay() const { return ( getSimulatorStatus() & ( 0x1 << BITOverlay )) ; } \n + bool isOverlay() const { return utils::checkBit(getSimulatorStatus(), BITOverlay); } \n "