Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Mar 23, 2024
1 parent 18287d7 commit 352c20c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
8 changes: 6 additions & 2 deletions Geometry/HGCalCommonData/src/HGCalTileIndex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ bool HGCalTileIndex::tileExist(const int32_t* hex, int32_t zside, int32_t iphi)
int32_t ibit = HGCalProperty::kHGCalTilePhisWord - (jj % HGCalProperty::kHGCalTilePhisWord) - 1;
bool ok = (hex[iw] & (1 << ibit));
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "tileExist::Phi " << iphi << " " << phi << " zside " << zside << " jj|iw|ibit " << jj << "|" << iw << "|" << ibit << " hex " << std::hex << hex[iw] << std::dec << " OK " << ok;
edm::LogVerbatim("HGCalGeom") << "tileExist::Phi " << iphi << " " << phi << " zside " << zside << " jj|iw|ibit " << jj
<< "|" << iw << "|" << ibit << " hex " << std::hex << hex[iw] << std::dec << " OK "
<< ok;
#endif
return ok;
}
Expand All @@ -93,7 +95,9 @@ bool HGCalTileIndex::tileFineExist(const int32_t* hex, int32_t zside, int32_t ip
int32_t ibit = HGCalProperty::kHGCalTilePhisWord - (jj % HGCalProperty::kHGCalTilePhisWord) - 1;
bool ok = (hex[iw] & (1 << ibit));
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "tileFineexist::Phi " << iphi << " " << phi << " zside " << zside << " jj|iw|ibit " << jj << "|" << iw << "|" << ibit << " hex " << std::hex << hex[iw] << std::dec << " OK " << ok;
edm::LogVerbatim("HGCalGeom") << "tileFineexist::Phi " << iphi << " " << phi << " zside " << zside << " jj|iw|ibit "
<< jj << "|" << iw << "|" << ibit << " hex " << std::hex << hex[iw] << std::dec
<< " OK " << ok;
#endif
return ok;
}
32 changes: 18 additions & 14 deletions Geometry/HGCalCommonData/test/HGCalConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,12 +1359,12 @@ void ConvertScintillatorV1::convert(const char* infile, const char* outfile1, co
++good;
int ring, hex1, hex2, hex3, hex4, hex5, hex6;
float rstart, rend, sipm;
std::string typest;
std::string typest;
if (nPhiS[layer] == 4) {
sscanf(
buffer, "%d %d %f %f %f %X %X %X %X", &layer, &ring, &rstart, &rend, &sipm, &hex1, &hex2, &hex3, &hex4);
hex5 = hex6 = 0;
typest = items[9];
typest = items[9];
} else {
sscanf(buffer,
"%d %d %f %f %f %X %X %X %X %X %X",
Expand All @@ -1379,12 +1379,14 @@ void ConvertScintillatorV1::convert(const char* infile, const char* outfile1, co
&hex4,
&hex5,
&hex6);
typest = items[11];
typest = items[11];
}
int type = static_cast<int>(std::find(types, types + 1, typest) - types);
int nphi = layPhiS[layer].first;
if (((debug / 100) % 10) > 0)
std::cout << "Input Layer " << layer << " Ring " << ring << " R " << rstart << ":" << rend << " sipm " << sipm << " type " << typest << ":" << type << " HEX " << std::hex << hex1 << " " << hex2 << " " << hex3 << " " << hex4 << " " << hex5 << " " << hex6 << std::dec << std::endl;
if (((debug / 100) % 10) > 0)
std::cout << "Input Layer " << layer << " Ring " << ring << " R " << rstart << ":" << rend << " sipm "
<< sipm << " type " << typest << ":" << type << " HEX " << std::hex << hex1 << " " << hex2 << " "
<< hex3 << " " << hex4 << " " << hex5 << " " << hex6 << std::dec << std::endl;
if (layer > layMin_) {
tile tl(sipm, type, nphi, hex1, hex2, hex3, hex4, hex5, hex6);
int index = HGCalTileIndex::tileIndex(layer - layMin_, ring + 1, 0);
Expand Down Expand Up @@ -1723,21 +1725,23 @@ void ConvertScintillatorV1::makeTitle(std::ofstream& fout,
const int zside = 1;
std::vector<tileZone> zones;
if ((debug % 10) > 0)
std::cout << "makeTile called with Layer:" << lmin << ":" << lmax << " nphi " << nphis << " mode " << mode << " nmodules " << module.size() <<std::endl;
std::cout << "makeTile called with Layer:" << lmin << ":" << lmax << " nphi " << nphis << " mode " << mode
<< " nmodules " << module.size() << std::endl;
for (int layer = lmin; layer <= lmax; ++layer) {
tileZone tile0;
int kk, irmin, irmax;
for (int phi = 1; phi <= nphis; ++phi) {
kk = irmin = irmax = 0;
for (std::map<int, tile>::const_iterator itr = module.begin(); itr != module.end(); ++itr) {
bool ok(false);
if (((debug / 100) % 10) > 0)
std::cout << " Layer " << HGCalTileIndex::tileLayer(itr->first) << " Ring " << HGCalTileIndex::tileRing(itr->first) << std::endl;
if (mode == 0)
ok = HGCalTileIndex::tileExist((itr->second).hex, zside, phi);
else
ok = HGCalTileIndex::tileFineExist((itr->second).hex, zside, phi);
if ((HGCalTileIndex::tileLayer(itr->first) == layer) && ok) {
bool ok(false);
if (((debug / 100) % 10) > 0)
std::cout << " Layer " << HGCalTileIndex::tileLayer(itr->first) << " Ring "
<< HGCalTileIndex::tileRing(itr->first) << std::endl;
if (mode == 0)
ok = HGCalTileIndex::tileExist((itr->second).hex, zside, phi);
else
ok = HGCalTileIndex::tileFineExist((itr->second).hex, zside, phi);
if ((HGCalTileIndex::tileLayer(itr->first) == layer) && ok) {
int ir = HGCalTileIndex::tileRing(itr->first);
if (kk == 0) {
irmin = irmax = ir;
Expand Down

0 comments on commit 352c20c

Please sign in to comment.