1+ #include " DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
12#include " DataFormats/ForwardDetId/interface/HFNoseDetId.h"
23#include " DataFormats/ForwardDetId/interface/HGCalDetId.h"
34#include " DataFormats/ForwardDetId/interface/HGCSiliconDetId.h"
@@ -25,7 +26,7 @@ HGCalTopology::HGCalTopology(const HGCalDDDConstants& hdcons, int det) : hdcons_
2526 subdet_ = (ForwardSubdetector)(det);
2627 kHGeomHalf_ = sectors_ * layers_;
2728 types_ = 2 ;
28- } else if (det == ( int ) (DetId::Forward)) {
29+ } else if (det == static_cast < int > (DetId::Forward)) {
2930 det_ = DetId::Forward;
3031 subdet_ = HFNose;
3132 kHGeomHalf_ = sectors_ * layers_;
@@ -389,8 +390,8 @@ uint32_t HGCalTopology::detId2denseId(const DetId& idin) const {
389390DetId HGCalTopology::denseId2detId (uint32_t hi) const {
390391 HGCalTopology::DecodedDetId id;
391392 if (validHashIndex (hi)) {
392- id.zSide = (( int ) (hi) < kHGhalfType_ ? -1 : 1 );
393- int di = (( int ) (hi) % kHGhalfType_ );
393+ id.zSide = (static_cast < int > (hi) < kHGhalfType_ ? -1 : 1 );
394+ int di = (static_cast < int > (hi) % kHGhalfType_ );
394395 if (waferHexagon6 ()) {
395396 int type = (di % types_);
396397 id.iType = (type == 0 ? -1 : 1 );
@@ -466,8 +467,8 @@ bool HGCalTopology::valid(const DetId& idin) const {
466467 HGCalTopology::DecodedDetId id = decode (idin);
467468 bool flag;
468469 if (waferHexagon6 ()) {
469- flag = (idin.det () == det_ && idin.subdetId () == ( int ) (subdet_) && id.iCell1 >= 0 && id. iCell1 < cells_ &&
470- id.iLay > 0 && id.iLay <= layers_ && id.iSec1 >= 0 && id.iSec1 <= sectors_);
470+ flag = (idin.det () == det_ && idin.subdetId () == static_cast < int > (subdet_) && id.iCell1 >= 0 &&
471+ id.iCell1 < cells_ && id. iLay > 0 && id.iLay <= layers_ && id.iSec1 >= 0 && id.iSec1 <= sectors_);
471472 if (flag)
472473 flag = hdcons_.isValidHex (id.iLay , id.iSec1 , id.iCell1 , true );
473474 } else if (tileTrapezoid ()) {
@@ -503,7 +504,7 @@ bool HGCalTopology::validModule(const DetId& idin, int cornerMin) const {
503504}
504505
505506DetId HGCalTopology::offsetBy (const DetId startId, int nrStepsX, int nrStepsY) const {
506- if (startId.det () == DetId::Forward && startId.subdetId () == ( int ) (subdet_)) {
507+ if (startId.det () == DetId::Forward && startId.subdetId () == static_cast < int > (subdet_)) {
507508 DetId id = changeXY (startId, nrStepsX, nrStepsY);
508509 if (valid (id))
509510 return id;
@@ -524,8 +525,8 @@ DetId HGCalTopology::switchZSide(const DetId startId) const {
524525HGCalTopology::DecodedDetId HGCalTopology::geomDenseId2decId (const uint32_t & hi) const {
525526 HGCalTopology::DecodedDetId id;
526527 if (hi < totalGeomModules ()) {
527- id.zSide = (( int ) (hi) < kHGeomHalf_ ? -1 : 1 );
528- int di = (( int ) (hi) % kHGeomHalf_ );
528+ id.zSide = (static_cast < int > (hi) < kHGeomHalf_ ? -1 : 1 );
529+ int di = (static_cast < int > (hi) % kHGeomHalf_ );
529530 if (waferHexagon6 ()) {
530531 id.iSec1 = (di % sectors_);
531532 di = (di - id.iSec1 ) / sectors_;
@@ -582,8 +583,13 @@ void HGCalTopology::addHGCSiliconId(
582583 << hdcons_.isValidHex8 (lay, waferU, waferV, cellU, cellV, false );
583584#endif
584585 if (hdcons_.isValidHex8 (lay, waferU, waferV, cellU, cellV, false )) {
585- HGCSiliconDetId id ((DetId::Detector)(det), zside, type, lay, waferU, waferV, cellU, cellV);
586- ids.emplace_back (DetId (id));
586+ if (det == static_cast <int >(ForwardSubdetector::HFNose)) {
587+ HFNoseDetId id (DetId::Forward, zside, type, lay, waferU, waferV, cellU, cellV);
588+ ids.emplace_back (DetId (id));
589+ } else {
590+ HGCSiliconDetId id ((DetId::Detector)(det), zside, type, lay, waferU, waferV, cellU, cellV);
591+ ids.emplace_back (DetId (id));
592+ }
587593 }
588594}
589595
@@ -608,7 +614,7 @@ HGCalTopology::DecodedDetId HGCalTopology::decode(const DetId& startId) const {
608614 idx.iSec2 = 0 ;
609615 idx.iType = id.type ();
610616 idx.zSide = id.zside ();
611- idx.det = ( int ) (id.subdet ());
617+ idx.det = static_cast < int > (id.subdet ());
612618 } else if (det_ == DetId::Forward && subdet_ == ForwardSubdetector::HFNose) {
613619 HFNoseDetId id (startId);
614620 idx.iCell1 = id.cellU ();
@@ -618,7 +624,7 @@ HGCalTopology::DecodedDetId HGCalTopology::decode(const DetId& startId) const {
618624 idx.iSec2 = id.waferV ();
619625 idx.iType = id.type ();
620626 idx.zSide = id.zside ();
621- idx.det = ( int ) (id.subdet ());
627+ idx.det = static_cast < int > (id.subdet ());
622628 } else {
623629 HGCSiliconDetId id (startId);
624630 idx.iCell1 = id.cellU ();
@@ -628,7 +634,7 @@ HGCalTopology::DecodedDetId HGCalTopology::decode(const DetId& startId) const {
628634 idx.iSec2 = id.waferV ();
629635 idx.iType = id.type ();
630636 idx.zSide = id.zside ();
631- idx.det = ( int ) (id.subdet ());
637+ idx.det = static_cast < int > (id.subdet ());
632638 }
633639 return idx;
634640}
0 commit comments