Skip to content

Commit efd54e8

Browse files
author
Sunanda
committed
Code check
1 parent a4037e6 commit efd54e8

File tree

8 files changed

+59
-41
lines changed

8 files changed

+59
-41
lines changed

DataFormats/HcalDetId/interface/HcalElectronicsId.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class HcalElectronicsId {
4242
/** VME Constructor from slb channel,slb site,spigot,dccid */
4343
constexpr HcalElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb)
4444
: hcalElectronicsId_(
45-
(uint32_t)((slbChan & 0x3) | (((slbSite)&0x7) << 2) | ((spigot & 0xF) << 5) | ((dccid & 0x1F) << 9))) {
45+
(uint32_t)((slbChan & 0x3) | (((slbSite) & 0x7) << 2) | ((spigot & 0xF) << 5) | ((dccid & 0x1F) << 9))) {
4646
hcalElectronicsId_ |= ((tb & 0x1) << 19) | ((slot & 0x1f) << 14) | ((crate & 0x3f) << 20);
4747
hcalElectronicsId_ |= 0x02000000;
4848
}
4949
/** uTCA constructor */
5050
constexpr HcalElectronicsId(int crate, int slot, int fiber, int fc, bool isTrigger)
51-
: hcalElectronicsId_((int)((fc & 0xF) | (((fiber)&0x1F) << 4) | ((slot & 0xF) << 9) | ((crate & 0x3F) << 13))) {
51+
: hcalElectronicsId_((int)((fc & 0xF) | (((fiber) & 0x1F) << 4) | ((slot & 0xF) << 9) | ((crate & 0x3F) << 13))) {
5252
if (isTrigger)
5353
hcalElectronicsId_ |= 0x02000000;
5454
hcalElectronicsId_ |= 0x04000000;
@@ -71,9 +71,13 @@ class HcalElectronicsId {
7171
}
7272

7373
/// get subtype for this channel (valid for uTCA only)
74-
constexpr int32_t subtype() const { return (isUTCAid()) ? static_cast<int32_t>((hcalElectronicsId_ >> 21) & 0x1F) : (-1); }
74+
constexpr int32_t subtype() const {
75+
return (isUTCAid()) ? static_cast<int32_t>((hcalElectronicsId_ >> 21) & 0x1F) : (-1);
76+
}
7577
/// get the fiber channel id (which of channels on a fiber)
76-
constexpr int32_t fiberChanId() const { return (isVMEid()) ? static_cast<int32_t>(hcalElectronicsId_ & 0x3) : (hcalElectronicsId_ & 0xF); }
78+
constexpr int32_t fiberChanId() const {
79+
return (isVMEid()) ? static_cast<int32_t>(hcalElectronicsId_ & 0x3) : (hcalElectronicsId_ & 0xF);
80+
}
7781
/// get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zero-based
7882
constexpr int32_t fiberIndex() const {
7983
return (isVMEid()) ? (((hcalElectronicsId_ >> 2) & 0x7) + 1) : ((hcalElectronicsId_ >> 4) & 0x1F);
@@ -100,7 +104,9 @@ class HcalElectronicsId {
100104
return (isVMEid()) ? ((hcalElectronicsId_ >> 14) & 0x1F) : ((hcalElectronicsId_ >> 9) & 0xF);
101105
}
102106
/// get the htr top/bottom (1=top/0=bottom), valid for VME
103-
constexpr int32_t htrTopBottom() const { return (isVMEid()) ? static_cast<int32_t>((hcalElectronicsId_ >> 19) & 0x1) : (-1); }
107+
constexpr int32_t htrTopBottom() const {
108+
return (isVMEid()) ? static_cast<int32_t>((hcalElectronicsId_ >> 19) & 0x1) : (-1);
109+
}
104110
/// get the readout VME crate number
105111
constexpr int32_t readoutVMECrateId() const { return crateId(); }
106112
/// get the readout VME crate number
@@ -109,7 +115,7 @@ class HcalElectronicsId {
109115
}
110116
/// get a fast, compact, unique index for linear lookups
111117
constexpr int32_t linearIndex() const {
112-
return (isVMEid()) ? ((hcalElectronicsId_)&0x3FFF) : ((hcalElectronicsId_)&0x7FFFF);
118+
return (isVMEid()) ? ((hcalElectronicsId_) & 0x3FFF) : ((hcalElectronicsId_) & 0x7FFFF);
113119
}
114120

115121
static const int maxLinearIndex = 0x7FFFF; //

Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ class CaloSubdetectorGeometry {
100100

101101
virtual void initializeParms() { return; }
102102

103-
virtual bool valid(const DetId& id) const { return (std::find(m_validIds.begin(), m_validIds.end(), id) != m_validIds.end()); }
103+
virtual bool valid(const DetId& id) const {
104+
return (std::find(m_validIds.begin(), m_validIds.end(), id) != m_validIds.end());
105+
}
104106

105107
protected:
106108
virtual unsigned int indexFor(const DetId& id) const;

Geometry/ForwardGeometry/interface/ZdcGeometry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ class ZdcGeometry : public CaloSubdetectorGeometry {
5858
const DetId& detId) override;
5959

6060
void getSummary(CaloSubdetectorGeometry::TrVec& tVec,
61-
CaloSubdetectorGeometry::IVec& iVec,
62-
CaloSubdetectorGeometry::DimVec& dVec,
63-
CaloSubdetectorGeometry::IVec& dins) const override;
61+
CaloSubdetectorGeometry::IVec& iVec,
62+
CaloSubdetectorGeometry::DimVec& dVec,
63+
CaloSubdetectorGeometry::IVec& dins) const override;
6464

6565
protected:
6666
unsigned int indexFor(const DetId& id) const override { return HcalZDCDetId(id).denseIndex(); }

Geometry/ForwardGeometry/plugins/ZdcHardcodeGeometryEP.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
#include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
2020
#include "FWCore/MessageLogger/interface/MessageLogger.h"
2121

22-
ZdcHardcodeGeometryEP::ZdcHardcodeGeometryEP(const edm::ParameterSet& ps) : m_loader(nullptr), m_topology(), m_applyAlignment(ps.getParameter<bool>("applyAlignment")), m_zdcAddRPD(ps.getParameter<bool>("zdcAddRPD")) {
22+
ZdcHardcodeGeometryEP::ZdcHardcodeGeometryEP(const edm::ParameterSet& ps)
23+
: m_loader(nullptr),
24+
m_topology(),
25+
m_applyAlignment(ps.getParameter<bool>("applyAlignment")),
26+
m_zdcAddRPD(ps.getParameter<bool>("zdcAddRPD")) {
2327
//the following line is needed to tell the framework what
2428
// data is being produced
2529
setWhatProduced(this, ZdcGeometry::producerTag());
@@ -30,7 +34,7 @@ ZdcHardcodeGeometryEP::ZdcHardcodeGeometryEP(const edm::ParameterSet& ps) : m_lo
3034
// edm::es::Label( "ZDC" ) );
3135
}
3236

33-
ZdcHardcodeGeometryEP::~ZdcHardcodeGeometryEP() { }
37+
ZdcHardcodeGeometryEP::~ZdcHardcodeGeometryEP() {}
3438

3539
//
3640
// member functions

Geometry/ForwardGeometry/plugins/ZdcHardcodeGeometryEP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ZdcHardcodeGeometryEP : public edm::ESProducer {
2121
~ZdcHardcodeGeometryEP() override;
2222

2323
using ReturnType = std::unique_ptr<CaloSubdetectorGeometry>;
24-
24+
2525
ReturnType produce(const ZDCGeometryRecord&);
2626

2727
static void fillDescriptions(edm::ConfigurationDescriptions&);

Geometry/ForwardGeometry/src/ZdcGeometry.cc

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void ZdcGeometry::newCell(const GlobalPoint& f1,
7676
const DetId& detId) {
7777
const CaloGenericDetId cgid(detId);
7878
#ifdef EDM_ML_DEBUG
79-
edm::LogVerbatim("ZDCGeom") << "ZDCGeometry " << HcalZDCDetId(detId) << " Generic ID " << std::hex << cgid.rawId() << std::dec << " ZDC? " << cgid.isZDC();
79+
edm::LogVerbatim("ZDCGeom") << "ZDCGeometry " << HcalZDCDetId(detId) << " Generic ID " << std::hex << cgid.rawId()
80+
<< std::dec << " ZDC? " << cgid.isZDC();
8081
#endif
8182
assert(cgid.isZDC());
8283

@@ -95,9 +96,9 @@ const CaloCellGeometry* ZdcGeometry::getGeometryRawPtr(uint32_t index) const {
9596
}
9697

9798
void ZdcGeometry::getSummary(CaloSubdetectorGeometry::TrVec& tVec,
98-
CaloSubdetectorGeometry::IVec& iVec,
99-
CaloSubdetectorGeometry::DimVec& dVec,
100-
CaloSubdetectorGeometry::IVec& /*dins*/) const {
99+
CaloSubdetectorGeometry::IVec& iVec,
100+
CaloSubdetectorGeometry::DimVec& dVec,
101+
CaloSubdetectorGeometry::IVec& /*dins*/) const {
101102
tVec.reserve(m_validIds.size() * numberOfTransformParms());
102103
iVec.reserve(numberOfShapes() == 1 ? 1 : m_validIds.size());
103104
dVec.reserve(numberOfShapes() * numberOfParametersPerShape());
@@ -112,51 +113,53 @@ void ZdcGeometry::getSummary(CaloSubdetectorGeometry::TrVec& tVec,
112113
Tr3D tr;
113114
std::shared_ptr<const CaloCellGeometry> ptr(cellGeomPtr(i));
114115
#ifdef EDM_ML_DEBUG
115-
edm::LogVerbatim("ZDCGeom") << "ZDCGeometry:Summary " << i << ":" << HcalZDCDetId::kSizeForDenseIndexingRun1 << " Pointer " << ptr << ":" << (nullptr != ptr);
116+
edm::LogVerbatim("ZDCGeom") << "ZDCGeometry:Summary " << i << ":" << HcalZDCDetId::kSizeForDenseIndexingRun1
117+
<< " Pointer " << ptr << ":" << (nullptr != ptr);
116118
#endif
117119
if (i < static_cast<int32_t>(HcalZDCDetId::kSizeForDenseIndexingRun1))
118120
assert(nullptr != ptr);
119121
if (ptr != nullptr) {
120122
ptr->getTransform(tr, (Pt3DVec*)nullptr);
121123

122124
if (Tr3D() == tr) { // for preshower there is no rotation
123-
const GlobalPoint& gp(ptr->getPosition());
124-
tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
125+
const GlobalPoint& gp(ptr->getPosition());
126+
tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
125127
}
126128

127129
const CLHEP::Hep3Vector tt(tr.getTranslation());
128130
tVec.emplace_back(tt.x());
129131
tVec.emplace_back(tt.y());
130132
tVec.emplace_back(tt.z());
131133
if (6 == numberOfTransformParms()) {
132-
const CLHEP::HepRotation rr(tr.getRotation());
133-
const ROOT::Math::Transform3D rtr(rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
134-
ROOT::Math::EulerAngles ea;
135-
rtr.GetRotation(ea);
136-
tVec.emplace_back(ea.Phi());
137-
tVec.emplace_back(ea.Theta());
138-
tVec.emplace_back(ea.Psi());
134+
const CLHEP::HepRotation rr(tr.getRotation());
135+
const ROOT::Math::Transform3D rtr(
136+
rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
137+
ROOT::Math::EulerAngles ea;
138+
rtr.GetRotation(ea);
139+
tVec.emplace_back(ea.Phi());
140+
tVec.emplace_back(ea.Theta());
141+
tVec.emplace_back(ea.Psi());
139142
}
140143

141144
const CCGFloat* par(ptr->param());
142145

143146
unsigned int ishape(9999);
144147
for (unsigned int ivv(0); ivv != parVecVec().size(); ++ivv) {
145-
bool ok(true);
146-
const CCGFloat* pv(&(*parVecVec()[ivv].begin()));
147-
for (unsigned int k(0); k != numberOfParametersPerShape(); ++k) {
148-
ok = ok && (fabs(par[k] - pv[k]) < 1.e-6);
149-
}
150-
if (ok) {
151-
ishape = ivv;
152-
break;
153-
}
148+
bool ok(true);
149+
const CCGFloat* pv(&(*parVecVec()[ivv].begin()));
150+
for (unsigned int k(0); k != numberOfParametersPerShape(); ++k) {
151+
ok = ok && (fabs(par[k] - pv[k]) < 1.e-6);
152+
}
153+
if (ok) {
154+
ishape = ivv;
155+
break;
156+
}
154157
}
155158
assert(9999 != ishape);
156159

157160
const unsigned int nn((numberOfShapes() == 1) ? (unsigned int)1 : m_validIds.size());
158161
if (iVec.size() < nn)
159-
iVec.emplace_back(ishape);
162+
iVec.emplace_back(ishape);
160163
}
161164
}
162165
}

Geometry/ForwardGeometry/src/ZdcHardcodeGeometryLoader.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ ZdcHardcodeGeometryLoader::ReturnType ZdcHardcodeGeometryLoader::load(DetId::Det
2424
fill(HcalZDCDetId::LUM, hg);
2525
fill(HcalZDCDetId::HAD, hg);
2626
if (m_zdcAddRPD)
27-
fill(HcalZDCDetId::RPD ,hg ); // line will be needed in next version of code, but is commented out for now in order to ensure run1 compatability.
27+
fill(
28+
HcalZDCDetId::RPD,
29+
hg); // line will be needed in next version of code, but is commented out for now in order to ensure run1 compatability.
2830
}
2931
return hg;
3032
}
@@ -35,7 +37,7 @@ ZdcHardcodeGeometryLoader::ReturnType ZdcHardcodeGeometryLoader::load() {
3537
fill(HcalZDCDetId::LUM, hg);
3638
fill(HcalZDCDetId::HAD, hg);
3739
if (m_zdcAddRPD)
38-
fill(HcalZDCDetId::RPD ,hg );
40+
fill(HcalZDCDetId::RPD, hg);
3941
return hg;
4042
}
4143

Geometry/ForwardGeometry/src/ZdcTopology.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ bool ZdcTopology::validRaw(const HcalZDCDetId& id) const {
161161
ok = false;
162162
else if (id.channel() <= 0)
163163
ok = false;
164-
else if (!(id.section() == HcalZDCDetId::EM || id.section() == HcalZDCDetId::HAD || id.section()== HcalZDCDetId::LUM))
165-
//else if (!(id.section() == HcalZDCDetId::EM || id.section() == HcalZDCDetId::HAD || id.section()== HcalZDCDetId::LUM || id.section()== HcalZDCDetId::RPD))
164+
else if (!(id.section() == HcalZDCDetId::EM || id.section() == HcalZDCDetId::HAD ||
165+
id.section() == HcalZDCDetId::LUM))
166+
//else if (!(id.section() == HcalZDCDetId::EM || id.section() == HcalZDCDetId::HAD || id.section()== HcalZDCDetId::LUM || id.section()== HcalZDCDetId::RPD))
166167
ok = false;
167168
else if (id.section() == HcalZDCDetId::EM && id.channel() > HcalZDCDetId::kDepEM)
168169
ok = false;

0 commit comments

Comments
 (0)