From 6147bb4461c242a27163ec7ad2a466be43b8cbc6 Mon Sep 17 00:00:00 2001
From: Susumu Oda <susumu.oda@cern.ch>
Date: Mon, 26 Mar 2018 21:11:39 +0000
Subject: [PATCH] Fix SCT related Coverity defects

---
 .../InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx     | 2 +-
 .../SiLorentzAngleSvc/src/SiLorentzAngleCHSvc.cxx             | 4 ++--
 .../SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx              | 4 ++--
 .../SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx           | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
index 9a5189379468..a9abb7a5944d 100644
--- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
+++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteSvc.cxx
@@ -85,7 +85,7 @@ SCTCalibWriteSvc::SCTCalibWriteSvc(const std::string& name, ISvcLocator* pSvcLoc
 
   m_regSvc(0),
   //m_streamer(0),
-  m_streamer(((m_version == 0) ? "AthenaOutputStreamTool" : "AthenaOutputStreamTool"), this),
+  m_streamer("AthenaOutputStreamTool", this),
   m_badIds(),
   
   m_defectRecorded(false),
diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleCHSvc.cxx b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleCHSvc.cxx
index 74f9e3dc6407..dfa59a65f633 100644
--- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleCHSvc.cxx
+++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleCHSvc.cxx
@@ -210,7 +210,7 @@ double SiLorentzAngleCHSvc::getValue(const IdentifierHash& elementHash, const Am
   // gives a more physical sign of the angle (ie dosen't flip sign when the detector is flipped).
   // The hit depth axis is pointing from the readout side to the backside if  m_design->readoutSide() < 0
   // The hit depth axis is pointing from the backside to the readout side if  m_design->readoutSide() > 0
-  if (variable==TanLorentzAngle and variable==LorentzShift) {
+  if (variable==TanLorentzAngle or variable==LorentzShift) {
     double tanLorentzAnglePhi{element->design().readoutSide()*mobility*element->hitDepthDirection()*element->hitPhiDirection()*(element->normal().cross(magneticField)).dot(element->phiAxis())};
     if (variable==TanLorentzAngle) {
       return correctionFactor*tanLorentzAnglePhi;
@@ -224,7 +224,7 @@ double SiLorentzAngleCHSvc::getValue(const IdentifierHash& elementHash, const Am
   // The Lorentz eta shift very small and so can be ignored, but we include it for completeness.
   // It is < ~0.1 um in the pixel.
   // In the SCT its largest in the stereo side of the barrel modules where it is about 0.3 micron along the strip. 
-  if (variable==TanLorentzAngleEta and variable==LorentzShiftEta) {
+  if (variable==TanLorentzAngleEta or variable==LorentzShiftEta) {
     double tanLorentzAngleEta{element->design().readoutSide()*mobility*element->hitDepthDirection()*element->hitEtaDirection()*(element->normal().cross(magneticField)).dot(element->etaAxis())};
     if (variable==TanLorentzAngleEta) {
       return correctionFactor*tanLorentzAngleEta;
diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx
index 9f79d79fa5b1..d5f025c241fb 100644
--- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx
+++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/src/SiLorentzAngleTool.cxx
@@ -183,7 +183,7 @@ double SiLorentzAngleTool::getValue(const IdentifierHash& elementHash, const Amg
   // gives a more physical sign of the angle (ie dosen't flip sign when the detector is flipped).
   // The hit depth axis is pointing from the readout side to the backside if  m_design->readoutSide() < 0
   // The hit depth axis is pointing from the backside to the readout side if  m_design->readoutSide() > 0
-  if (variable==TanLorentzAngle and variable==LorentzShift) {
+  if (variable==TanLorentzAngle or variable==LorentzShift) {
     double tanLorentzAnglePhi{element->design().readoutSide()*mobility*element->hitDepthDirection()*element->hitPhiDirection()*(element->normal().cross(magneticField)).dot(element->phiAxis())};
     if (variable==TanLorentzAngle) {
       return correctionFactor*tanLorentzAnglePhi;
@@ -197,7 +197,7 @@ double SiLorentzAngleTool::getValue(const IdentifierHash& elementHash, const Amg
   // The Lorentz eta shift very small and so can be ignored, but we include it for completeness.
   // It is < ~0.1 um in the pixel.
   // In the SCT its largest in the stereo side of the barrel modules where it is about 0.3 micron along the strip. 
-  if (variable==TanLorentzAngleEta and variable==LorentzShiftEta) {
+  if (variable==TanLorentzAngleEta or variable==LorentzShiftEta) {
     double tanLorentzAngleEta{element->design().readoutSide()*mobility*element->hitDepthDirection()*element->hitEtaDirection()*(element->normal().cross(magneticField)).dot(element->etaAxis())};
     if (variable==TanLorentzAngleEta) {
       return correctionFactor*tanLorentzAngleEta;
diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx
index c297171896e1..a2b568c4c37e 100644
--- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx
+++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx
@@ -150,7 +150,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r
   uint32_t robid{robFrag.rod_source_id()};
   /**determine whether this data was generated using the ROD simulator */
   uint32_t rod_datatype{robFrag.rod_detev_type()};
-  const bool rodSimulatedData{(rod_datatype >> 20) & 1};
+  const bool rodSimulatedData{static_cast<bool>((rod_datatype >> 20) & 1)};
 
   if (rodSimulatedData) m_byteStreamErrSvc->setRODSimulatedData();
   if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::SimulatedData, robid, rodSimulatedData);
-- 
GitLab