Skip to content

Commit

Permalink
Take care of code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jul 22, 2019
1 parent 0ac8d17 commit 3f17c16
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Expand Up @@ -370,9 +370,10 @@ HGCalParameters::hgtrap HGCalDDDConstants::getModule(unsigned int indx, bool hex
edm::LogWarning("HGCalGeom") << "Wafer no. out bound for index " << indx << ":" << (hgpar_->waferTypeL_).size()
<< ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size()
<< " ***** ERROR *****";
unsigned int type = ((indx < hgpar_->waferTypeL_.size()) ? hgpar_->waferTypeL_[indx]-1 : HGCSiliconDetId::HGCalCoarseThick);
// if (type > 0)
// --type;
unsigned int type =
((indx < hgpar_->waferTypeL_.size()) ? hgpar_->waferTypeL_[indx] - 1 : HGCSiliconDetId::HGCalCoarseThick);
// if (type > 0)
// --type;
mytr = hgpar_->getModule(type, reco);
} else {
mytr = hgpar_->getModule(indx, reco);
Expand Down Expand Up @@ -457,8 +458,8 @@ bool HGCalDDDConstants::isValidHex(int lay, int mod, int cell, bool reco) const
if (mod >= (int)(hgpar_->waferTypeT_.size()))
edm::LogWarning("HGCalGeom") << "Module no. out of bound for " << mod << " to be compared with "
<< (hgpar_->waferTypeT_).size() << " ***** ERROR *****";
cellmax =
((hgpar_->waferTypeT_[mod]-1 == HGCSiliconDetId::HGCalFine) ? (int)(hgpar_->cellFineX_.size()) : (int)(hgpar_->cellCoarseX_.size()));
cellmax = ((hgpar_->waferTypeT_[mod] - 1 == HGCSiliconDetId::HGCalFine) ? (int)(hgpar_->cellFineX_.size())
: (int)(hgpar_->cellCoarseX_.size()));
result = (cell >= 0 && cell <= cellmax);
} else {
result = isValidCell(lay_idx, mod, cell);
Expand Down Expand Up @@ -554,7 +555,7 @@ std::pair<float, float> HGCalDDDConstants::locateCell(int cell, int lay, int typ
if ((mode_ == HGCalGeometryMode::Hexagon) || (mode_ == HGCalGeometryMode::HexagonFull)) {
x = hgpar_->waferPosX_[type];
y = hgpar_->waferPosY_[type];
if (hgpar_->waferTypeT_[type]-1 == HGCSiliconDetId::HGCalFine) {
if (hgpar_->waferTypeT_[type] - 1 == HGCSiliconDetId::HGCalFine) {
x += hgpar_->cellFineX_[cell];
y += hgpar_->cellFineY_[cell];
} else {
Expand Down Expand Up @@ -641,7 +642,7 @@ std::pair<float, float> HGCalDDDConstants::locateCell(int lay,

std::pair<float, float> HGCalDDDConstants::locateCellHex(int cell, int wafer, bool reco) const {
float x(0), y(0);
if (hgpar_->waferTypeT_[wafer]-1 == HGCSiliconDetId::HGCalFine) {
if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
x = hgpar_->cellFineX_[cell];
y = hgpar_->cellFineY_[cell];
} else {
Expand Down Expand Up @@ -831,7 +832,8 @@ int HGCalDDDConstants::maxCells(int lay, bool reco) const {
unsigned int cells(0);
for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
unsigned int cell = (hgpar_->waferTypeT_[k]-1 == HGCSiliconDetId::HGCalFine) ? (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine) ? (hgpar_->cellFineX_.size())
: (hgpar_->cellCoarseX_.size());
if (cell > cells)
cells = cell;
}
Expand All @@ -843,7 +845,8 @@ int HGCalDDDConstants::maxCells(int lay, bool reco) const {
if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(
lay, HGCalWaferIndex::waferU(hgpar_->waferCopy_[k]), HGCalWaferIndex::waferV(hgpar_->waferCopy_[k])));
int type = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]);
int type = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick
: hgpar_->waferTypeL_[itr->second]);
int N = (type == HGCSiliconDetId::HGCalFine) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
cells = std::max(cells, 3 * N * N);
}
Expand Down Expand Up @@ -926,8 +929,9 @@ std::vector<int> HGCalDDDConstants::numberCells(int lay, bool reco) const {
if ((mode_ == HGCalGeometryMode::Hexagon) || (mode_ == HGCalGeometryMode::HexagonFull)) {
for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
if (waferInLayerTest(k, i, hgpar_->defineFull_)) {
unsigned int cell =
(hgpar_->waferTypeT_[k]-1 == HGCSiliconDetId::HGCalFine) ? (hgpar_->cellFineX_.size()) : (hgpar_->cellCoarseX_.size());
unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine)
? (hgpar_->cellFineX_.size())
: (hgpar_->cellCoarseX_.size());
ncell.emplace_back((int)(cell));
}
}
Expand All @@ -952,7 +956,7 @@ std::vector<int> HGCalDDDConstants::numberCells(int lay, bool reco) const {

int HGCalDDDConstants::numberCellsHexagon(int wafer) const {
if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
if (hgpar_->waferTypeT_[wafer]-1 == HGCSiliconDetId::HGCalFine)
if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine)
return (int)(hgpar_->cellFineX_.size());
else
return (int)(hgpar_->cellCoarseX_.size());
Expand All @@ -963,7 +967,8 @@ int HGCalDDDConstants::numberCellsHexagon(int wafer) const {

int HGCalDDDConstants::numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const {
auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(lay, waferU, waferV));
int type = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]);
int type =
((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]);
int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
if (flag)
return (3 * N * N);
Expand Down Expand Up @@ -1096,12 +1101,9 @@ void HGCalDDDConstants::waferFromPosition(const double x, const double y, int& w
}
}
if (wafer < size_) {
if (celltyp-1 == HGCSiliconDetId::HGCalFine)
icell = cellHex(xx,
yy,
0.5 * HGCalParameters::k_ScaleFromDDD * hgpar_->cellSize_[0],
hgpar_->cellFineX_,
hgpar_->cellFineY_);
if (celltyp - 1 == HGCSiliconDetId::HGCalFine)
icell = cellHex(
xx, yy, 0.5 * HGCalParameters::k_ScaleFromDDD * hgpar_->cellSize_[0], hgpar_->cellFineX_, hgpar_->cellFineY_);
else
icell = cellHex(xx,
yy,
Expand Down Expand Up @@ -1147,7 +1149,8 @@ void HGCalDDDConstants::waferFromPosition(const double x,
waferU = HGCalWaferIndex::waferU(hgpar_->waferCopy_[k]);
waferV = HGCalWaferIndex::waferV(hgpar_->waferCopy_[k]);
auto itr = hgpar_->typesInLayers_.find(HGCalWaferIndex::waferIndex(layer, waferU, waferV));
celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]);
celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick
: hgpar_->waferTypeL_[itr->second]);
#ifdef EDM_ML_DEBUG
if (debug)
edm::LogVerbatim("HGCalGeom") << "WaferFromPosition:: Input " << layer << ":" << ll << ":"
Expand Down Expand Up @@ -1413,7 +1416,7 @@ bool HGCalDDDConstants::isValidCell(int lay, int wafer, int cell) const {
// Works for options HGCalHexagon/HGCalHexagonFull
double x = hgpar_->waferPosX_[wafer];
double y = hgpar_->waferPosY_[wafer];
if (hgpar_->waferTypeT_[wafer]-1 == HGCSiliconDetId::HGCalFine) {
if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
x += hgpar_->cellFineX_[cell];
y += hgpar_->cellFineY_[cell];
} else {
Expand Down

0 comments on commit 3f17c16

Please sign in to comment.