CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
HGCalGeomParameters Class Reference

#include <HGCalGeomParameters.h>

Classes

struct  cellParameters
 
struct  layerParameters
 

Public Member Functions

 HGCalGeomParameters ()
 
void loadCellParsHexagon (const DDCompactView *cpv, HGCalParameters &php)
 
void loadCellParsHexagon (const cms::DDVectorsMap &vmap, HGCalParameters &php)
 
void loadCellParsHexagon (const HGCalParameters &php)
 
void loadCellTrapezoid (HGCalParameters &php)
 
void loadGeometryHexagon (const DDFilteredView &_fv, HGCalParameters &php, const std::string &sdTag1, const DDCompactView *cpv, const std::string &sdTag2, const std::string &sdTag3, HGCalGeometryMode::WaferMode mode)
 
void loadGeometryHexagon (const cms::DDCompactView *cpv, HGCalParameters &php, const std::string &sdTag1, const std::string &sdTag2, const std::string &sdTag3, HGCalGeometryMode::WaferMode mode)
 
void loadGeometryHexagon8 (const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)
 
void loadGeometryHexagon8 (const cms::DDCompactView *cpv, HGCalParameters &php, const std::string &sdTag1, int firstLayer)
 
void loadGeometryHexagonModule (const DDCompactView *cpv, HGCalParameters &php, const std::string &sdTag1, const std::string &sdTag2, int firstLayer)
 
void loadGeometryHexagonModule (const cms::DDCompactView *cpv, HGCalParameters &php, const std::string &sdTag1, const std::string &sdTag2, int firstLayer)
 
void loadSpecParsHexagon (const DDFilteredView &fv, HGCalParameters &php, const DDCompactView *cpv, const std::string &sdTag1, const std::string &sdTag2)
 
void loadSpecParsHexagon (const cms::DDFilteredView &fv, HGCalParameters &php, const std::string &sdTag1, const std::string &sdTag2, const std::string &sdTag3, const std::string &sdTag4)
 
void loadSpecParsHexagon8 (const DDFilteredView &fv, HGCalParameters &php)
 
void loadSpecParsHexagon8 (const cms::DDFilteredView &fv, const cms::DDVectorsMap &vmap, HGCalParameters &php, const std::string &sdTag1)
 
void loadSpecParsTrapezoid (const DDFilteredView &fv, HGCalParameters &php)
 
void loadSpecParsTrapezoid (const cms::DDFilteredView &fv, const cms::DDVectorsMap &vmap, HGCalParameters &php, const std::string &sdTag1)
 
void loadWaferHexagon (HGCalParameters &php)
 
void loadWaferHexagon8 (HGCalParameters &php)
 
 ~HGCalGeomParameters ()
 

Static Public Attributes

static constexpr int scintillatorCassette = 7
 
static constexpr int scintillatorFile = 4
 
static constexpr int siliconCassetteEE = 5
 
static constexpr int siliconCassetteHE = 6
 
static constexpr int siliconFileEE = 2
 
static constexpr int siliconFileHE = 3
 

Private Member Functions

std::pair< double, double > cellPosition (const std::vector< cellParameters > &wafers, std::vector< cellParameters >::const_iterator &itrf, int wafer, double xx, double yy)
 
std::vector< double > getDDDArray (const std::string &str, const DDsvalues_type &sv, const int nmin)
 
void loadGeometryHexagon (const std::map< int, HGCalGeomParameters::layerParameters > &layers, std::vector< HGCalParameters::hgtrform > &trforms, std::vector< bool > &trformUse, const std::unordered_map< int32_t, int32_t > &copies, const HGCalParameters::layer_map &copiesInLayers, const std::vector< int32_t > &wafer2copy, const std::vector< HGCalGeomParameters::cellParameters > &wafers, const std::map< int, int > &wafertype, const std::map< int, HGCalGeomParameters::cellParameters > &cellsf, const std::map< int, HGCalGeomParameters::cellParameters > &cellsc, HGCalParameters &php)
 
void loadGeometryHexagon8 (const std::map< int, HGCalGeomParameters::layerParameters > &layers, std::map< std::pair< int, int >, HGCalParameters::hgtrform > &trforms, const int &firstLayer, HGCalParameters &php)
 
void loadSpecParsHexagon (const HGCalParameters &php)
 
void loadSpecParsHexagon8 (HGCalParameters &php)
 
void loadSpecParsHexagon8 (HGCalParameters &php, const std::vector< int > &layerType, const std::vector< int > &waferIndex, const std::vector< int > &waferProperties)
 
void loadSpecParsTrapezoid (HGCalParameters &php)
 
void loadSpecParsTrapezoid (HGCalParameters &php, const std::vector< int > &tileIndex, const std::vector< int > &tileProperty, const std::vector< int > &tileHEX1, const std::vector< int > &tileHEX2, const std::vector< int > &tileHEX3, const std::vector< int > &tileHEX4, const std::vector< double > &tileRMin, const std::vector< double > &tileRMax, const std::vector< int > &tileRingMin, const std::vector< int > &tileRingMax)
 
void rescale (std::vector< double > &, const double s)
 
void resetZero (std::vector< double > &)
 

Private Attributes

HGCalGeomTools geomTools_
 
const double sqrt3_
 
double waferSize_
 

Static Private Attributes

static constexpr double tan30deg_ = 0.5773502693
 

Detailed Description

this class extracts some geometry constants from CompactView to be used by Reco Geometry/Topology

Date
2015/06/25 00:06:50
Author
Sunanda Banerjee, Fermilab sunan.nosp@m.da.b.nosp@m.anerj.nosp@m.ee@c.nosp@m.ern.c.nosp@m.h
Lindsey Gray, Fermilab lagra.nosp@m.y@fn.nosp@m.al.go.nosp@m.v (for fixes)

Definition at line 29 of file HGCalGeomParameters.h.

Constructor & Destructor Documentation

◆ HGCalGeomParameters()

HGCalGeomParameters::HGCalGeomParameters ( )

Definition at line 32 of file HGCalGeomParameters.cc.

32  : sqrt3_(std::sqrt(3.0)) {
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters::HGCalGeomParameters "
35  << "constructor";
36 #endif
37 }
Log< level::Info, true > LogVerbatim
T sqrt(T t)
Definition: SSEVec.h:19

◆ ~HGCalGeomParameters()

HGCalGeomParameters::~HGCalGeomParameters ( )

Definition at line 39 of file HGCalGeomParameters.cc.

39  {
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters::destructed!!!";
42 #endif
43 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ cellPosition()

std::pair< double, double > HGCalGeomParameters::cellPosition ( const std::vector< cellParameters > &  wafers,
std::vector< cellParameters >::const_iterator &  itrf,
int  wafer,
double  xx,
double  yy 
)
private

Definition at line 2339 of file HGCalGeomParameters.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, tolerance, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

Referenced by loadGeometryHexagon().

2344  {
2345  if (itrf == wafers.end()) {
2346  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin(); itr != wafers.end();
2347  ++itr) {
2348  if (itr->wafer == wafer) {
2349  itrf = itr;
2350  break;
2351  }
2352  }
2353  }
2354  double dx(0), dy(0);
2355  if (itrf != wafers.end()) {
2356  dx = (xx - itrf->xyz.x());
2357  if (std::abs(dx) < tolerance)
2358  dx = 0;
2359  dy = (yy - itrf->xyz.y());
2360  if (std::abs(dy) < tolerance)
2361  dy = 0;
2362  }
2363  return std::make_pair(dx, dy);
2364 }
const double tolerance
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ getDDDArray()

std::vector< double > HGCalGeomParameters::getDDDArray ( const std::string &  str,
const DDsvalues_type sv,
const int  nmin 
)
private

Definition at line 2312 of file HGCalGeomParameters.cc.

References DDfetch(), Exception, nmin, str, pfDeepBoostedJetPreprocessParams_cfi::sv, and relativeConstraints::value.

Referenced by loadSpecParsHexagon(), loadSpecParsHexagon8(), and loadSpecParsTrapezoid().

2312  {
2313  DDValue value(str);
2314  if (DDfetch(&sv, value)) {
2315  const std::vector<double>& fvec = value.doubles();
2316  int nval = fvec.size();
2317  if (nmin > 0) {
2318  if (nval < nmin) {
2319  throw cms::Exception("DDException")
2320  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < " << nmin << " ==> illegal";
2321  }
2322  } else {
2323  if (nval < 1 && nmin == 0) {
2324  throw cms::Exception("DDException")
2325  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < 1 ==> illegal"
2326  << " (nmin=" << nmin << ")";
2327  }
2328  }
2329  return fvec;
2330  } else {
2331  if (nmin >= 0) {
2332  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
2333  }
2334  std::vector<double> fvec;
2335  return fvec;
2336  }
2337 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
Definition: value.py:1
Quality *__restrict__ uint16_t nmin
#define str(s)

◆ loadCellParsHexagon() [1/3]

void HGCalGeomParameters::loadCellParsHexagon ( const DDCompactView cpv,
HGCalParameters php 
)

Definition at line 2105 of file HGCalGeomParameters.cc.

References HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, dbl_to_int(), DDFilteredView::firstChild(), convertSQLiteXML::ok, AlCaHLTBitMon_QueryRunRegistry::string, and DDCompactView::vector().

Referenced by loadCellParsHexagon().

2105  {
2106  // Special parameters for cell parameters
2107  std::string attribute = "OnlyForHGCalNumbering";
2108  DDSpecificsHasNamedValueFilter filter1{attribute};
2109  DDFilteredView fv1(*cpv, filter1);
2110  bool ok = fv1.firstChild();
2111 
2112  if (ok) {
2113  php.cellFine_ = dbl_to_int(cpv->vector("waferFine"));
2114  php.cellCoarse_ = dbl_to_int(cpv->vector("waferCoarse"));
2115  }
2116 
2117  loadCellParsHexagon(php);
2118 }
std::vector< int > cellFine_
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7

◆ loadCellParsHexagon() [2/3]

void HGCalGeomParameters::loadCellParsHexagon ( const cms::DDVectorsMap vmap,
HGCalParameters php 
)

Definition at line 2120 of file HGCalGeomParameters.cc.

References HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, mps_fire::i, and loadCellParsHexagon().

2120  {
2121  for (auto const& it : vmap) {
2122  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferFine")) {
2123  for (const auto& i : it.second)
2124  php.cellFine_.emplace_back(std::round(i));
2125  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferCoarse")) {
2126  for (const auto& i : it.second)
2127  php.cellCoarse_.emplace_back(std::round(i));
2128  }
2129  }
2130 
2131  loadCellParsHexagon(php);
2132 }
std::vector< int > cellFine_
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)

◆ loadCellParsHexagon() [3/3]

void HGCalGeomParameters::loadCellParsHexagon ( const HGCalParameters php)

Definition at line 2134 of file HGCalGeomParameters.cc.

References HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, and dqmdumpme::k.

2134  {
2135 #ifdef EDM_ML_DEBUG
2136  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellFine_.size() << " rows for fine cells";
2137  for (unsigned int k = 0; k < php.cellFine_.size(); ++k)
2138  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
2139  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellCoarse_.size() << " rows for coarse cells";
2140  for (unsigned int k = 0; k < php.cellCoarse_.size(); ++k)
2141  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
2142 #endif
2143 }
Log< level::Info, true > LogVerbatim
std::vector< int > cellFine_
std::vector< int > cellCoarse_

◆ loadCellTrapezoid()

void HGCalGeomParameters::loadCellTrapezoid ( HGCalParameters php)

Definition at line 2145 of file HGCalGeomParameters.cc.

References HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, HGCalParameters::hgtrap::dz, PVValHelper::eta, JetChargeProducer_cfi::exp, HGCalParameters::fillModule(), HGCalParameters::firstLayer_, HGCalParameters::firstModule_, HGCalParameters::hgtrap::h, LaserClient_cfi::high, createfilelist::int, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, GetRecoTauVFromDQM_MC_cff::kk, HGCalParameters::lastModule_, HGCalParameters::hgtrap::lay, HGCalParameters::layerFrontBH_, dqm-mbProfile::log, LaserClient_cfi::low, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, SiStripPI::max, SiStripPI::min, HGCalParameters::minTileSize_, HGCalParameters::mode_, HGCalParameters::nSectors_, HGCalParameters::radiusLayer_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayerBH_, HGCalParameters::rMinLayHex_, HGCalParameters::scintCellSize(), HGCalParameters::scintType(), funct::tan(), HGCalParameters::tileRingR_, HGCalParameters::tileRingRange_, HGCalParameters::hgtrap::tl, HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, HGCalParameters::waferThick_, HGCalParameters::waferUVMax_, HGCalParameters::xLayerHex_, HGCalParameters::yLayerHex_, HGCalParameters::zLayerHex_, and gpuVertexFinder::zv.

2145  {
2146  php.xLayerHex_.resize(php.zLayerHex_.size(), 0);
2147  php.yLayerHex_.resize(php.zLayerHex_.size(), 0);
2148 #ifdef EDM_ML_DEBUG
2149  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: x|y|zLayerHex in array of size " << php.zLayerHex_.size();
2150  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k)
2151  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Shift " << php.xLayerHex_[k] << ":" << php.yLayerHex_[k] << ":"
2152  << php.zLayerHex_[k];
2153 #endif
2154  // Find the radius of each eta-partitions
2155 
2157  //Ring radii for each partition
2158  for (unsigned int k = 0; k < 2; ++k) {
2159  for (unsigned int kk = 0; kk < php.tileRingR_.size(); ++kk) {
2160  php.radiusLayer_[k].emplace_back(php.tileRingR_[kk].first);
2161 #ifdef EDM_ML_DEBUG
2162  double zv = ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
2163  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
2164  double rv = php.radiusLayer_[k].back();
2165  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
2166  edm::LogVerbatim("HGCalGeom") << "New [" << kk << "] new R = " << rv << " Eta = " << eta;
2167 #endif
2168  }
2169  php.radiusLayer_[k].emplace_back(php.tileRingR_[php.tileRingR_.size() - 1].second);
2170  }
2171  // Minimum and maximum radius index for each layer
2172  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2173  php.iradMinBH_.emplace_back(1 + php.tileRingRange_[k].first);
2174  php.iradMaxBH_.emplace_back(1 + php.tileRingRange_[k].second);
2175 #ifdef EDM_ML_DEBUG
2176  int kk = php.scintType(php.firstLayer_ + (int)(k));
2177  edm::LogVerbatim("HGCalGeom") << "New Layer " << k << " Type " << kk << " Low edge " << php.iradMinBH_.back()
2178  << " Top edge " << php.iradMaxBH_.back();
2179 #endif
2180  }
2181  } else {
2182  //Ring radii for each partition
2183  for (unsigned int k = 0; k < 2; ++k) {
2184  double rmax = ((k == 0) ? (php.rMaxLayHex_[php.layerFrontBH_[1] - php.firstLayer_] - 1)
2185  : (php.rMaxLayHex_[php.rMaxLayHex_.size() - 1]));
2186  double rv = php.rMinLayerBH_[k];
2187  double zv = ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
2188  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
2189  php.radiusLayer_[k].emplace_back(rv);
2190 #ifdef EDM_ML_DEBUG
2191  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
2192  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] rmax " << rmax << " Z = " << zv
2193  << " dEta = " << php.cellSize_[k] << "\nOld[0] new R = " << rv << " Eta = " << eta;
2194  int kount(1);
2195 #endif
2196  while (rv < rmax) {
2197  double eta = -(php.cellSize_[k] + std::log(std::tan(0.5 * std::atan(rv / zv))));
2198  rv = zv * std::tan(2.0 * std::atan(std::exp(-eta)));
2199  php.radiusLayer_[k].emplace_back(rv);
2200 #ifdef EDM_ML_DEBUG
2201  edm::LogVerbatim("HGCalGeom") << "Old [" << kount << "] new R = " << rv << " Eta = " << eta;
2202  ++kount;
2203 #endif
2204  }
2205  }
2206  // Find minimum and maximum radius index for each layer
2207  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2208  int kk = php.scintType(php.firstLayer_ + (int)(k));
2209  std::vector<double>::iterator low, high;
2210  low = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMinLayHex_[k]);
2211 #ifdef EDM_ML_DEBUG
2212  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] RLow = " << php.rMinLayHex_[k] << " pos "
2213  << (int)(low - php.radiusLayer_[kk].begin());
2214 #endif
2215  if (low == php.radiusLayer_[kk].begin())
2216  ++low;
2217  int irlow = (int)(low - php.radiusLayer_[kk].begin());
2218  double drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
2219 #ifdef EDM_ML_DEBUG
2220  edm::LogVerbatim("HGCalGeom") << "irlow " << irlow << " dr " << drlow << " min " << php.minTileSize_;
2221 #endif
2222  if (drlow < php.minTileSize_) {
2223  ++irlow;
2224 #ifdef EDM_ML_DEBUG
2225  drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
2226  edm::LogVerbatim("HGCalGeom") << "Modified irlow " << irlow << " dr " << drlow;
2227 #endif
2228  }
2229  high = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMaxLayHex_[k]);
2230 #ifdef EDM_ML_DEBUG
2231  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] RHigh = " << php.rMaxLayHex_[k] << " pos "
2232  << (int)(high - php.radiusLayer_[kk].begin());
2233 #endif
2234  if (high == php.radiusLayer_[kk].end())
2235  --high;
2236  int irhigh = (int)(high - php.radiusLayer_[kk].begin());
2237  double drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
2238 #ifdef EDM_ML_DEBUG
2239  edm::LogVerbatim("HGCalGeom") << "irhigh " << irhigh << " dr " << drhigh << " min " << php.minTileSize_;
2240 #endif
2241  if (drhigh < php.minTileSize_) {
2242  --irhigh;
2243 #ifdef EDM_ML_DEBUG
2244  drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
2245  edm::LogVerbatim("HGCalGeom") << "Modified irhigh " << irhigh << " dr " << drhigh;
2246 #endif
2247  }
2248  php.iradMinBH_.emplace_back(irlow);
2249  php.iradMaxBH_.emplace_back(irhigh);
2250 #ifdef EDM_ML_DEBUG
2251  edm::LogVerbatim("HGCalGeom") << "Old Layer " << k << " Type " << kk << " Low edge " << irlow << ":" << drlow
2252  << " Top edge " << irhigh << ":" << drhigh;
2253 #endif
2254  }
2255  }
2256 #ifdef EDM_ML_DEBUG
2257  for (unsigned int k = 0; k < 2; ++k) {
2258  edm::LogVerbatim("HGCalGeom") << "Type " << k << " with " << php.radiusLayer_[k].size() << " radii";
2259  for (unsigned int kk = 0; kk < php.radiusLayer_[k].size(); ++kk)
2260  edm::LogVerbatim("HGCalGeom") << "Ring[" << kk << "] " << php.radiusLayer_[k][kk];
2261  }
2262 #endif
2263 
2264  // Now define the volumes
2265  int im(0);
2266  php.waferUVMax_ = 0;
2268  mytr.alpha = 0.0;
2269  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2270  if (php.iradMaxBH_[k] > php.waferUVMax_)
2271  php.waferUVMax_ = php.iradMaxBH_[k];
2272  int kk = ((php.firstLayer_ + (int)(k)) < php.layerFrontBH_[1]) ? 0 : 1;
2273  int irm = php.radiusLayer_[kk].size() - 1;
2274 #ifdef EDM_ML_DEBUG
2275  double rmin = php.radiusLayer_[kk][std::max((php.iradMinBH_[k] - 1), 0)];
2276  double rmax = php.radiusLayer_[kk][std::min(php.iradMaxBH_[k], irm)];
2277  edm::LogVerbatim("HGCalGeom") << "Layer " << php.firstLayer_ + k << ":" << kk << " Radius range "
2278  << php.iradMinBH_[k] << ":" << php.iradMaxBH_[k] << ":" << rmin << ":" << rmax;
2279 #endif
2280  mytr.lay = php.firstLayer_ + k;
2281  for (int irad = php.iradMinBH_[k]; irad <= php.iradMaxBH_[k]; ++irad) {
2282  double rmin = php.radiusLayer_[kk][std::max((irad - 1), 0)];
2283  double rmax = php.radiusLayer_[kk][std::min(irad, irm)];
2284  mytr.bl = 0.5 * rmin * php.scintCellSize(mytr.lay);
2285  mytr.tl = 0.5 * rmax * php.scintCellSize(mytr.lay);
2286  mytr.h = 0.5 * (rmax - rmin);
2287  mytr.dz = 0.5 * php.waferThick_;
2288  mytr.cellSize = 0.5 * (rmax + rmin) * php.scintCellSize(mytr.lay);
2289  php.fillModule(mytr, true);
2295  php.fillModule(mytr, false);
2296  if (irad == php.iradMinBH_[k])
2297  php.firstModule_.emplace_back(im);
2298  ++im;
2299  if (irad == php.iradMaxBH_[k] - 1)
2300  php.lastModule_.emplace_back(im);
2301  }
2302  }
2303  php.nSectors_ = php.waferUVMax_;
2304 #ifdef EDM_ML_DEBUG
2305  edm::LogVerbatim("HGCalGeom") << "Maximum radius index " << php.waferUVMax_;
2306  for (unsigned int k = 0; k < php.firstModule_.size(); ++k)
2307  edm::LogVerbatim("HGCalGeom") << "Layer " << k + php.firstLayer_ << " Modules " << php.firstModule_[k] << ":"
2308  << php.lastModule_[k];
2309 #endif
2310 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
int scintType(const int layer) const
float *__restrict__ zv
HGCalGeometryMode::GeometryMode mode_
std::vector< double > rMinLayerBH_
double scintCellSize(const int layer) const
std::vector< std::pair< int, int > > tileRingRange_
std::vector< int > firstModule_
std::vector< double > cellSize_
std::vector< double > yLayerHex_
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > rMinLayHex_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< int > lastModule_
static constexpr double k_ScaleToDDD
std::vector< int > iradMinBH_
static constexpr double k_ScaleFromDDD
std::vector< int > layerFrontBH_
std::vector< double > radiusLayer_[2]
std::vector< std::pair< double, double > > tileRingR_
std::vector< double > xLayerHex_

◆ loadGeometryHexagon() [1/3]

void HGCalGeomParameters::loadGeometryHexagon ( const DDFilteredView _fv,
HGCalParameters php,
const std::string &  sdTag1,
const DDCompactView cpv,
const std::string &  sdTag2,
const std::string &  sdTag3,
HGCalGeometryMode::WaferMode  mode 
)

Definition at line 45 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), CommonMethods::cp(), ddpolyhedra_rrz, ddpolyhedra_rz, ddtubs, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), spr::find(), DDFilteredView::firstChild(), HGCalTypes::getUnpackedCell6(), HGCalTypes::getUnpackedCellType6(), HGCalParameters::hgtrap::h, HGCalParameters::hgtrform::h3v, HGCalParameters::hgtrform::hr, createfilelist::int, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleFromDDDToG4, HGCalParameters::hgtrap::lay, HGCalParameters::hgtrform::lay, phase1PixelTopology::layer, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, DDFilteredView::logicalPart(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), names, DDFilteredView::next(), convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, HGCalGeometryMode::Polyhedra, DDTubs::rIn(), DDPolyhedra::rMaxVec(), DDPolyhedra::rMinVec(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::hgtrform::sec, mkfit::Const::sol, DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrform::subsec, tan30deg_, HGCalParameters::hgtrap::tl, HGCalParameters::tol, tolerance, DDFilteredView::translation(), HGCalParameters::waferR_, HGCalParameters::waferSize_, waferSize_, x, DDExtrudedPolygon::xVec(), geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, gpuVertexFinder::zv, DDPolyhedra::zVec(), DDExtrudedPolygon::zVec(), and geometryCSVtoXML::zz.

Referenced by loadGeometryHexagon().

51  {
52  DDFilteredView fv = _fv;
53  bool dodet(true);
54  std::map<int, HGCalGeomParameters::layerParameters> layers;
55  std::vector<HGCalParameters::hgtrform> trforms;
56  std::vector<bool> trformUse;
57 
58  while (dodet) {
59  const DDSolid& sol = fv.logicalPart().solid();
60  // Layers first
61  std::vector<int> copy = fv.copyNumbers();
62  int nsiz = (int)(copy.size());
63  int lay = (nsiz > 0) ? copy[nsiz - 1] : 0;
64  int zp = (nsiz > 2) ? copy[nsiz - 3] : -1;
65  if (zp != 1)
66  zp = -1;
67  if (lay == 0) {
68  throw cms::Exception("DDException") << "Funny layer # " << lay << " zp " << zp << " in " << nsiz << " components";
69  } else {
70  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
71  php.layer_.emplace_back(lay);
72  auto itr = layers.find(lay);
73  if (itr == layers.end()) {
74  double rin(0), rout(0);
76  if ((sol.shape() == DDSolidShape::ddpolyhedra_rz) || (sol.shape() == DDSolidShape::ddpolyhedra_rrz)) {
77  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
78  const std::vector<double>& rmin = polyhedra.rMinVec();
79  const std::vector<double>& rmax = polyhedra.rMaxVec();
80  rin = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmin[0] + rmin[1]);
81  rout = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmax[0] + rmax[1]);
82  } else if (sol.shape() == DDSolidShape::ddtubs) {
83  const DDTubs& tube = static_cast<DDTubs>(sol);
84  rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
85  rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
86  }
87  HGCalGeomParameters::layerParameters laypar(rin, rout, zz);
88  layers[lay] = laypar;
89  }
90  DD3Vector x, y, z;
91  fv.rotation().GetComponents(x, y, z);
92  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
93  const CLHEP::HepRotation hr(rotation);
95  if (std::abs(xx) < tolerance)
96  xx = 0;
98  if (std::abs(yy) < tolerance)
99  yy = 0;
100  double zz = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
101  const CLHEP::Hep3Vector h3v(xx, yy, zz);
103  mytrf.zp = zp;
104  mytrf.lay = lay;
105  mytrf.sec = 0;
106  mytrf.subsec = 0;
107  mytrf.h3v = h3v;
108  mytrf.hr = hr;
109  trforms.emplace_back(mytrf);
110  trformUse.emplace_back(false);
111  }
112  dodet = fv.next();
113  }
114 
115  // Then wafers
116  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they
117  // were) to ensure that new copy numbers are always added to the end of the
118  // list.
119  std::unordered_map<int32_t, int32_t> copies;
120  HGCalParameters::layer_map copiesInLayers(layers.size() + 1);
121  std::vector<int32_t> wafer2copy;
122  std::vector<HGCalGeomParameters::cellParameters> wafers;
123  std::string attribute = "Volume";
124  DDValue val1(attribute, sdTag2, 0.0);
125  DDSpecificsMatchesValueFilter filter1{val1};
126  DDFilteredView fv1(*cpv, filter1);
127  bool ok = fv1.firstChild();
128  if (!ok) {
129  throw cms::Exception("DDException") << "Attribute " << val1 << " not found but needed.";
130  } else {
131  dodet = true;
132  std::unordered_set<std::string> names;
133  while (dodet) {
134  const DDSolid& sol = fv1.logicalPart().solid();
135  const std::string& name = fv1.logicalPart().name().name();
136  std::vector<int> copy = fv1.copyNumbers();
137  int nsiz = (int)(copy.size());
138  int wafer = (nsiz > 0) ? copy[nsiz - 1] : 0;
139  int layer = (nsiz > 1) ? copy[nsiz - 2] : 0;
140  if (nsiz < 2) {
141  throw cms::Exception("DDException") << "Funny wafer # " << wafer << " in " << nsiz << " components";
142  } else if (layer > (int)(layers.size())) {
143  edm::LogWarning("HGCalGeom") << "Funny wafer # " << wafer << " Layer " << layer << ":" << layers.size()
144  << " among " << nsiz << " components";
145  } else {
146  auto itr = copies.find(wafer);
147  auto cpy = copiesInLayers[layer].find(wafer);
148  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
149  copiesInLayers[layer][wafer] = itr->second;
150  }
151  if (itr == copies.end()) {
152  copies[wafer] = wafer2copy.size();
153  copiesInLayers[layer][wafer] = wafer2copy.size();
154  double xx = HGCalParameters::k_ScaleFromDDD * fv1.translation().X();
155  if (std::abs(xx) < tolerance)
156  xx = 0;
157  double yy = HGCalParameters::k_ScaleFromDDD * fv1.translation().Y();
158  if (std::abs(yy) < tolerance)
159  yy = 0;
160  wafer2copy.emplace_back(wafer);
161  GlobalPoint p(xx, yy, HGCalParameters::k_ScaleFromDDD * fv1.translation().Z());
162  HGCalGeomParameters::cellParameters cell(false, wafer, p);
163  wafers.emplace_back(cell);
164  if (names.count(name) == 0) {
165  std::vector<double> zv, rv;
167  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
168  zv = polyhedra.zVec();
169  rv = polyhedra.rMaxVec();
170  } else {
171  const DDExtrudedPolygon& polygon = static_cast<DDExtrudedPolygon>(sol);
172  zv = polygon.zVec();
173  rv = polygon.xVec();
174  }
177  double dz = 0.5 * HGCalParameters::k_ScaleFromDDDToG4 * (zv[1] - zv[0]);
178 #ifdef EDM_ML_DEBUG
179  edm::LogVerbatim("HGCalGeom")
180  << "Mode " << mode << " R " << php.waferSize_ << ":" << php.waferR_ << " z " << dz;
181 #endif
183  mytr.lay = 1;
184  mytr.bl = php.waferR_;
185  mytr.tl = php.waferR_;
186  mytr.h = php.waferR_;
187  mytr.dz = dz;
188  mytr.alpha = 0.0;
189  mytr.cellSize = waferSize_;
190  php.fillModule(mytr, false);
191  names.insert(name);
192  }
193  }
194  }
195  dodet = fv1.next();
196  }
197  }
198 
199  // Finally the cells
200  std::map<int, int> wafertype;
201  std::map<int, HGCalGeomParameters::cellParameters> cellsf, cellsc;
202  DDValue val2(attribute, sdTag3, 0.0);
203  DDSpecificsMatchesValueFilter filter2{val2};
204  DDFilteredView fv2(*cpv, filter2);
205  ok = fv2.firstChild();
206  if (!ok) {
207  throw cms::Exception("DDException") << "Attribute " << val2 << " not found but needed.";
208  } else {
209  dodet = true;
210  while (dodet) {
211  const DDSolid& sol = fv2.logicalPart().solid();
212  const std::string& name = sol.name().name();
213  std::vector<int> copy = fv2.copyNumbers();
214  int nsiz = (int)(copy.size());
215  int cellx = (nsiz > 0) ? copy[nsiz - 1] : 0;
216  int wafer = (nsiz > 1) ? copy[nsiz - 2] : 0;
217  int cell = HGCalTypes::getUnpackedCell6(cellx);
219  if (type != 1 && type != 2) {
220  throw cms::Exception("DDException")
221  << "Funny cell # " << cell << " type " << type << " in " << nsiz << " components";
222  } else {
223  auto ktr = wafertype.find(wafer);
224  if (ktr == wafertype.end())
225  wafertype[wafer] = type;
226  bool newc(false);
227  std::map<int, HGCalGeomParameters::cellParameters>::iterator itr;
228  double cellsize = php.cellSize_[0];
229  if (type == 1) {
230  itr = cellsf.find(cell);
231  newc = (itr == cellsf.end());
232  } else {
233  itr = cellsc.find(cell);
234  newc = (itr == cellsc.end());
235  cellsize = php.cellSize_[1];
236  }
237  if (newc) {
238  bool half = (name.find("Half") != std::string::npos);
239  double xx = HGCalParameters::k_ScaleFromDDD * fv2.translation().X();
240  double yy = HGCalParameters::k_ScaleFromDDD * fv2.translation().Y();
241  if (half) {
242  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
243  math::XYZPointD p2 = fv2.rotation()(p1);
246 #ifdef EDM_ML_DEBUG
247  if (std::abs(p2.X()) < HGCalParameters::tol)
248  p2.SetX(0.0);
249  if (std::abs(p2.Z()) < HGCalParameters::tol)
250  p2.SetZ(0.0);
251  edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local "
252  << xx << ":" << yy << " new " << p1 << ":" << p2;
253 #endif
254  }
256  if (type == 1) {
257  cellsf[cell] = cp;
258  } else {
259  cellsc[cell] = cp;
260  }
261  }
262  }
263  dodet = fv2.next();
264  }
265  }
266 
268  layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
269 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
nav_type copyNumbers() const
return the stack of copy numbers
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:335
double rIn(void) const
Definition: DDSolid.cc:456
const double tolerance
static int32_t getUnpackedCell6(int id)
Definition: HGCalTypes.cc:40
std::vector< double > xVec(void) const
Definition: DDSolid.cc:378
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
float *__restrict__ zv
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:342
double rOut(void) const
Definition: DDSolid.cc:458
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::string names[nVars_]
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
static constexpr double tol
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< double > zVec(void) const
Definition: DDSolid.cc:387
static int32_t getUnpackedCellType6(int id)
Definition: HGCalTypes.cc:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
std::vector< double > cellSize_
bool next()
set current node to the next node in the filtered tree
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void fillModule(const hgtrap &mytr, bool reco)
static constexpr double tan30deg_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
constexpr float sol
Definition: Config.h:48
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
Definition: Point3D.h:8
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
static constexpr double k_ScaleFromDDDToG4
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
static constexpr double k_ScaleFromDDD
void loadGeometryHexagon(const DDFilteredView &_fv, HGCalParameters &php, const std::string &sdTag1, const DDCompactView *cpv, const std::string &sdTag2, const std::string &sdTag3, HGCalGeometryMode::WaferMode mode)
Log< level::Warning, false > LogWarning
const DDTranslation & translation() const
The absolute translation of the current node.
CLHEP::HepRotation hr
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)

◆ loadGeometryHexagon() [2/3]

void HGCalGeomParameters::loadGeometryHexagon ( const cms::DDCompactView cpv,
HGCalParameters php,
const std::string &  sdTag1,
const std::string &  sdTag2,
const std::string &  sdTag3,
HGCalGeometryMode::WaferMode  mode 
)

Definition at line 271 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), CommonMethods::cp(), HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), ALCARECOTkAlBeamHalo_cff::filter, spr::find(), cms::DDFilteredView::firstChild(), HGCalTypes::getUnpackedCell6(), HGCalTypes::getUnpackedCellType6(), HGCalParameters::hgtrap::h, HGCalParameters::hgtrform::h3v, HGCalParameters::hgtrform::hr, createfilelist::int, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleFromDD4hepToG4, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrap::lay, HGCalParameters::hgtrform::lay, phase1PixelTopology::layer, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, loadGeometryHexagon(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, Skims_PA_cff::name, cms::DDFilteredView::name(), names, convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, cms::DDFilteredView::parameters(), HGCalGeometryMode::Polyhedra, idealTransformation::rotation, cms::DDFilteredView::rotation(), HGCalParameters::hgtrform::sec, cms::DDFilteredView::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrform::subsec, tan30deg_, HGCalParameters::hgtrap::tl, HGCalParameters::tol, tolerance, cms::DDFilteredView::translation(), HGCalParameters::waferR_, HGCalParameters::waferSize_, waferSize_, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, gpuVertexFinder::zv, and geometryCSVtoXML::zz.

276  {
277  const cms::DDFilter filter("Volume", sdTag1);
278  cms::DDFilteredView fv((*cpv), filter);
279  std::map<int, HGCalGeomParameters::layerParameters> layers;
280  std::vector<HGCalParameters::hgtrform> trforms;
281  std::vector<bool> trformUse;
282  std::vector<std::pair<int, int> > trused;
283 
284  while (fv.firstChild()) {
285  const std::vector<double>& pars = fv.parameters();
286  // Layers first
287  std::vector<int> copy = fv.copyNos();
288  int nsiz = (int)(copy.size());
289  int lay = (nsiz > 0) ? copy[0] : 0;
290  int zp = (nsiz > 2) ? copy[2] : -1;
291  if (zp != 1)
292  zp = -1;
293  if (lay == 0) {
294  throw cms::Exception("DDException") << "Funny layer # " << lay << " zp " << zp << " in " << nsiz << " components";
295  } else {
296  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
297  php.layer_.emplace_back(lay);
298  auto itr = layers.find(lay);
299  double zz = HGCalParameters::k_ScaleFromDD4hep * fv.translation().Z();
300  if (itr == layers.end()) {
301  double rin(0), rout(0);
302  if (dd4hep::isA<dd4hep::Polyhedra>(fv.solid())) {
303  rin = 0.5 * HGCalParameters::k_ScaleFromDD4hep * (pars[5] + pars[8]);
304  rout = 0.5 * HGCalParameters::k_ScaleFromDD4hep * (pars[6] + pars[9]);
305  } else if (dd4hep::isA<dd4hep::Tube>(fv.solid())) {
306  dd4hep::Tube tubeSeg(fv.solid());
307  rin = HGCalParameters::k_ScaleFromDD4hep * tubeSeg.rMin();
308  rout = HGCalParameters::k_ScaleFromDD4hep * tubeSeg.rMax();
309  }
310  HGCalGeomParameters::layerParameters laypar(rin, rout, zz);
311  layers[lay] = laypar;
312  }
313  std::pair<int, int> layz(lay, zp);
314  if (std::find(trused.begin(), trused.end(), layz) == trused.end()) {
315  trused.emplace_back(layz);
316  DD3Vector x, y, z;
317  fv.rotation().GetComponents(x, y, z);
318  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
319  const CLHEP::HepRotation hr(rotation);
320  double xx = HGCalParameters::k_ScaleFromDD4hep * fv.translation().X();
321  if (std::abs(xx) < tolerance)
322  xx = 0;
323  double yy = HGCalParameters::k_ScaleFromDD4hep * fv.translation().Y();
324  if (std::abs(yy) < tolerance)
325  yy = 0;
326  double zz = HGCalParameters::k_ScaleFromDD4hep * fv.translation().Z();
327  const CLHEP::Hep3Vector h3v(xx, yy, zz);
329  mytrf.zp = zp;
330  mytrf.lay = lay;
331  mytrf.sec = 0;
332  mytrf.subsec = 0;
333  mytrf.h3v = h3v;
334  mytrf.hr = hr;
335  trforms.emplace_back(mytrf);
336  trformUse.emplace_back(false);
337  }
338  }
339  }
340 
341  // Then wafers
342  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they
343  // were) to ensure that new copy numbers are always added to the end of the
344  // list.
345  std::unordered_map<int32_t, int32_t> copies;
346  HGCalParameters::layer_map copiesInLayers(layers.size() + 1);
347  std::vector<int32_t> wafer2copy;
348  std::vector<HGCalGeomParameters::cellParameters> wafers;
349  const cms::DDFilter filter1("Volume", sdTag2);
350  cms::DDFilteredView fv1((*cpv), filter1);
351  bool ok = fv1.firstChild();
352  if (!ok) {
353  throw cms::Exception("DDException") << "Attribute " << sdTag2 << " not found but needed.";
354  } else {
355  bool dodet = true;
356  std::unordered_set<std::string> names;
357  while (dodet) {
358  const std::string name = static_cast<std::string>(fv1.name());
359  std::vector<int> copy = fv1.copyNos();
360  int nsiz = (int)(copy.size());
361  int wafer = (nsiz > 0) ? copy[0] : 0;
362  int layer = (nsiz > 1) ? copy[1] : 0;
363  if (nsiz < 2) {
364  throw cms::Exception("DDException") << "Funny wafer # " << wafer << " in " << nsiz << " components";
365  } else if (layer > (int)(layers.size())) {
366  edm::LogWarning("HGCalGeom") << "Funny wafer # " << wafer << " Layer " << layer << ":" << layers.size()
367  << " among " << nsiz << " components";
368  } else {
369  auto itr = copies.find(wafer);
370  auto cpy = copiesInLayers[layer].find(wafer);
371  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
372  copiesInLayers[layer][wafer] = itr->second;
373  }
374  if (itr == copies.end()) {
375  copies[wafer] = wafer2copy.size();
376  copiesInLayers[layer][wafer] = wafer2copy.size();
377  double xx = HGCalParameters::k_ScaleFromDD4hep * fv1.translation().X();
378  if (std::abs(xx) < tolerance)
379  xx = 0;
380  double yy = HGCalParameters::k_ScaleFromDD4hep * fv1.translation().Y();
381  if (std::abs(yy) < tolerance)
382  yy = 0;
383  wafer2copy.emplace_back(wafer);
384  GlobalPoint p(xx, yy, HGCalParameters::k_ScaleFromDD4hep * fv1.translation().Z());
385  HGCalGeomParameters::cellParameters cell(false, wafer, p);
386  wafers.emplace_back(cell);
387  if (names.count(name) == 0) {
388  double zv[2], rv;
389  const std::vector<double>& pars = fv1.parameters();
391  zv[0] = pars[4];
392  zv[1] = pars[7];
393  rv = pars[6];
394  } else {
395  zv[0] = pars[3];
396  zv[1] = pars[9];
397  rv = pars[4];
398  }
401  double dz = 0.5 * HGCalParameters::k_ScaleFromDD4hepToG4 * (zv[1] - zv[0]);
402 #ifdef EDM_ML_DEBUG
403  edm::LogVerbatim("HGCalGeom")
404  << "Mode " << mode << " R " << php.waferSize_ << ":" << php.waferR_ << " z " << dz;
405 #endif
407  mytr.lay = 1;
408  mytr.bl = php.waferR_;
409  mytr.tl = php.waferR_;
410  mytr.h = php.waferR_;
411  mytr.dz = dz;
412  mytr.alpha = 0.0;
413  mytr.cellSize = waferSize_;
414  php.fillModule(mytr, false);
415  names.insert(name);
416  }
417  }
418  }
419  dodet = fv1.firstChild();
420  }
421  }
422 
423  // Finally the cells
424  std::map<int, int> wafertype;
425  std::map<int, HGCalGeomParameters::cellParameters> cellsf, cellsc;
426  const cms::DDFilter filter2("Volume", sdTag3);
427  cms::DDFilteredView fv2((*cpv), filter2);
428  ok = fv2.firstChild();
429  if (!ok) {
430  throw cms::Exception("DDException") << "Attribute " << sdTag3 << " not found but needed.";
431  } else {
432  bool dodet = true;
433  while (dodet) {
434  const std::string name = static_cast<std::string>(fv2.name());
435  std::vector<int> copy = fv2.copyNos();
436  int nsiz = (int)(copy.size());
437  int cellx = (nsiz > 0) ? copy[0] : 0;
438  int wafer = (nsiz > 1) ? copy[1] : 0;
439  int cell = HGCalTypes::getUnpackedCell6(cellx);
441  if (type != 1 && type != 2) {
442  throw cms::Exception("DDException")
443  << "Funny cell # " << cell << " type " << type << " in " << nsiz << " components";
444  } else {
445  auto ktr = wafertype.find(wafer);
446  if (ktr == wafertype.end())
447  wafertype[wafer] = type;
448  bool newc(false);
449  std::map<int, HGCalGeomParameters::cellParameters>::iterator itr;
450  double cellsize = php.cellSize_[0];
451  if (type == 1) {
452  itr = cellsf.find(cell);
453  newc = (itr == cellsf.end());
454  } else {
455  itr = cellsc.find(cell);
456  newc = (itr == cellsc.end());
457  cellsize = php.cellSize_[1];
458  }
459  if (newc) {
460  bool half = (name.find("Half") != std::string::npos);
461  double xx = HGCalParameters::k_ScaleFromDD4hep * fv2.translation().X();
462  double yy = HGCalParameters::k_ScaleFromDD4hep * fv2.translation().Y();
463  if (half) {
464  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
465  math::XYZPointD p2 = fv2.rotation()(p1);
468 #ifdef EDM_ML_DEBUG
469  if (std::abs(p2.X()) < HGCalParameters::tol)
470  p2.SetX(0.0);
471  if (std::abs(p2.Z()) < HGCalParameters::tol)
472  p2.SetZ(0.0);
473  edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local "
474  << xx << ":" << yy << " new " << p1 << ":" << p2;
475 #endif
476  }
478  if (type == 1) {
479  cellsf[cell] = cp;
480  } else {
481  cellsc[cell] = cp;
482  }
483  }
484  }
485  dodet = fv2.firstChild();
486  }
487  }
488 
490  layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
491 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
const double tolerance
static int32_t getUnpackedCell6(int id)
Definition: HGCalTypes.cc:40
float *__restrict__ zv
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::string names[nVars_]
static constexpr double tol
constexpr std::array< uint8_t, layerIndexSize > layer
static int32_t getUnpackedCellType6(int id)
Definition: HGCalTypes.cc:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
std::vector< double > cellSize_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr double k_ScaleFromDD4hep
void fillModule(const hgtrap &mytr, bool reco)
static constexpr double tan30deg_
static constexpr double k_ScaleFromDD4hepToG4
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
Definition: Point3D.h:8
static constexpr double k_ScaleFromDDD
void loadGeometryHexagon(const DDFilteredView &_fv, HGCalParameters &php, const std::string &sdTag1, const DDCompactView *cpv, const std::string &sdTag2, const std::string &sdTag3, HGCalGeometryMode::WaferMode mode)
Log< level::Warning, false > LogWarning
CLHEP::HepRotation hr
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)

◆ loadGeometryHexagon() [3/3]

void HGCalGeomParameters::loadGeometryHexagon ( const std::map< int, HGCalGeomParameters::layerParameters > &  layers,
std::vector< HGCalParameters::hgtrform > &  trforms,
std::vector< bool > &  trformUse,
const std::unordered_map< int32_t, int32_t > &  copies,
const HGCalParameters::layer_map copiesInLayers,
const std::vector< int32_t > &  wafer2copy,
const std::vector< HGCalGeomParameters::cellParameters > &  wafers,
const std::map< int, int > &  wafertype,
const std::map< int, HGCalGeomParameters::cellParameters > &  cellsf,
const std::map< int, HGCalGeomParameters::cellParameters > &  cellsc,
HGCalParameters php 
)
private

Definition at line 493 of file HGCalGeomParameters.cc.

References HGCalParameters::addTrForm(), HGCalParameters::hgtrap::bl, HGCalParameters::boundR_, HGCalParameters::cellCoarseHalf_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineHalf_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellPosition(), HGCalParameters::hgtrap::cellSize, HGCalParameters::copiesInLayers_, TauDecayModes::dec, LEDCalibrationChannels::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), first, HGCalParameters::firstLayer_, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, createfilelist::int, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, phase1PixelTopology::layer, HGCalParameters::layer_, HGCalParameters::layerGroup_, HGCalParameters::layerIndex_, hgcalTopologyTester_cfi::layers, HGCalParameters::moduleAlphaR_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleBlS_, HGCalParameters::moduleDzR_, HGCalParameters::moduleDzS_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, HGCalParameters::moduleLayR_, HGCalParameters::moduleLayS_, HGCalParameters::moduleTlR_, HGCalParameters::moduleTlS_, HGCalParameters::nSectors_, alignCSCRings::r, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::scaleTrForm(), HGCalParameters::hgtrap::tl, HGCalParameters::trformIndex_, HGCalParameters::trformRotXX_, HGCalParameters::trformRotXY_, HGCalParameters::trformRotXZ_, HGCalParameters::trformRotYX_, HGCalParameters::trformRotYY_, HGCalParameters::trformRotYZ_, HGCalParameters::trformRotZX_, HGCalParameters::trformRotZY_, HGCalParameters::trformRotZZ_, HGCalParameters::trformTranX_, HGCalParameters::trformTranY_, HGCalParameters::trformTranZ_, HGCalParameters::waferCopy_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::yy, and HGCalParameters::zLayerHex_.

503  {
504  if (((cellsf.size() + cellsc.size()) == 0) || (wafers.empty()) || (layers.empty())) {
505  throw cms::Exception("DDException") << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
506  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
507  << " layers " << layers.size();
508  }
509 
510  for (unsigned int i = 0; i < layers.size(); ++i) {
511  for (auto& layer : layers) {
512  if (layer.first == (int)(i + php.firstLayer_)) {
513  php.layerIndex_.emplace_back(i);
514  php.rMinLayHex_.emplace_back(layer.second.rmin);
515  php.rMaxLayHex_.emplace_back(layer.second.rmax);
516  php.zLayerHex_.emplace_back(layer.second.zpos);
517  break;
518  }
519  }
520  }
521 
522  for (unsigned int i = 0; i < php.layer_.size(); ++i) {
523  for (unsigned int i1 = 0; i1 < trforms.size(); ++i1) {
524  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay - 1] == (int)(i + 1)) {
525  trforms[i1].h3v *= static_cast<double>(HGCalParameters::k_ScaleFromDDD);
526  trforms[i1].lay = (i + 1);
527  trformUse[i1] = true;
528  php.fillTrForm(trforms[i1]);
529  int nz(1);
530  for (unsigned int i2 = i1 + 1; i2 < trforms.size(); ++i2) {
531  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
532  php.layerGroup_[trforms[i2].lay - 1] == (int)(i + 1)) {
533  php.addTrForm(trforms[i2].h3v);
534  nz++;
535  trformUse[i2] = true;
536  }
537  }
538  if (nz > 0) {
539  php.scaleTrForm(double(1.0 / nz));
540  }
541  }
542  }
543  }
544 
545  double rmin = HGCalParameters::k_ScaleFromDDD * php.waferR_;
546  for (unsigned i = 0; i < wafer2copy.size(); ++i) {
547  php.waferCopy_.emplace_back(wafer2copy[i]);
548  php.waferPosX_.emplace_back(wafers[i].xyz.x());
549  php.waferPosY_.emplace_back(wafers[i].xyz.y());
550  auto ktr = wafertype.find(wafer2copy[i]);
551  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
552  php.waferTypeT_.emplace_back(typet);
553  double r = wafers[i].xyz.perp();
554  int type(3);
555  for (int k = 1; k < 4; ++k) {
556  if ((r + rmin) <= php.boundR_[k]) {
557  type = k;
558  break;
559  }
560  }
561  php.waferTypeL_.emplace_back(type);
562  }
563  php.copiesInLayers_ = copiesInLayers;
564  php.nSectors_ = (int)(php.waferCopy_.size());
565 
566  std::vector<HGCalGeomParameters::cellParameters>::const_iterator itrf = wafers.end();
567  for (unsigned int i = 0; i < cellsf.size(); ++i) {
568  auto itr = cellsf.find(i);
569  if (itr == cellsf.end()) {
570  throw cms::Exception("DDException") << "HGCalGeomParameters: missing info for fine cell number " << i;
571  } else {
572  double xx = (itr->second).xyz.x();
573  double yy = (itr->second).xyz.y();
574  int waf = (itr->second).wafer;
575  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
576  php.cellFineX_.emplace_back(xy.first);
577  php.cellFineY_.emplace_back(xy.second);
578  php.cellFineHalf_.emplace_back((itr->second).half);
579  }
580  }
581  itrf = wafers.end();
582  for (unsigned int i = 0; i < cellsc.size(); ++i) {
583  auto itr = cellsc.find(i);
584  if (itr == cellsc.end()) {
585  throw cms::Exception("DDException") << "HGCalGeomParameters: missing info for coarse cell number " << i;
586  } else {
587  double xx = (itr->second).xyz.x();
588  double yy = (itr->second).xyz.y();
589  int waf = (itr->second).wafer;
590  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
591  php.cellCoarseX_.emplace_back(xy.first);
592  php.cellCoarseY_.emplace_back(xy.second);
593  php.cellCoarseHalf_.emplace_back((itr->second).half);
594  }
595  }
596  int depth(0);
597  for (unsigned int i = 0; i < php.layerGroup_.size(); ++i) {
598  bool first(true);
599  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k) {
600  if (php.layerGroup_[k] == (int)(i + 1)) {
601  if (first) {
602  php.depth_.emplace_back(i + 1);
603  php.depthIndex_.emplace_back(depth);
604  php.depthLayerF_.emplace_back(k);
605  ++depth;
606  first = false;
607  }
608  }
609  }
610  }
611  HGCalParameters::hgtrap mytr = php.getModule(0, false);
617  double dz = mytr.dz;
618  php.fillModule(mytr, true);
619  mytr.dz = 2 * dz;
620  php.fillModule(mytr, true);
621  mytr.dz = 3 * dz;
622  php.fillModule(mytr, true);
623 #ifdef EDM_ML_DEBUG
624  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.zLayerHex_.size() << " layers";
625  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
626  int k = php.layerIndex_[i];
627  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":" << php.layer_[k]
628  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
629  << " at z = " << php.zLayerHex_[i];
630  }
631  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters has " << php.depthIndex_.size() << " depths";
632  for (unsigned int i = 0; i < php.depthIndex_.size(); ++i) {
633  int k = php.depthIndex_[i];
634  edm::LogVerbatim("HGCalGeom") << "Reco Layer[" << i << ":" << k << "] First Layer " << php.depthLayerF_[i]
635  << " Depth " << php.depth_[k];
636  }
637  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.nSectors_ << " wafers";
638  for (unsigned int i = 0; i < php.waferCopy_.size(); ++i)
639  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << ": " << php.waferCopy_[i] << "] type " << php.waferTypeL_[i]
640  << ":" << php.waferTypeT_[i] << " at (" << php.waferPosX_[i] << ","
641  << php.waferPosY_[i] << ",0)";
642  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius " << php.waferR_ << " and dimensions of the "
643  << "wafers:";
644  edm::LogVerbatim("HGCalGeom") << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0] << ":"
645  << php.moduleTlS_[0] << " dy " << php.moduleHS_[0] << " dz " << php.moduleDzS_[0]
646  << " alpha " << php.moduleAlphaS_[0];
647  for (unsigned int k = 0; k < php.moduleLayR_.size(); ++k)
648  edm::LogVerbatim("HGCalGeom") << "Rec[" << k << "] " << php.moduleLayR_[k] << " dx " << php.moduleBlR_[k] << ":"
649  << php.moduleTlR_[k] << " dy " << php.moduleHR_[k] << " dz " << php.moduleDzR_[k]
650  << " alpha " << php.moduleAlphaR_[k];
651  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.cellFineX_.size() << " fine cells in a wafer";
652  for (unsigned int i = 0; i < php.cellFineX_.size(); ++i)
653  edm::LogVerbatim("HGCalGeom") << "Fine Cell[" << i << "] at (" << php.cellFineX_[i] << "," << php.cellFineY_[i]
654  << ",0)";
655  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.cellCoarseX_.size()
656  << " coarse cells in a wafer";
657  for (unsigned int i = 0; i < php.cellCoarseX_.size(); ++i)
658  edm::LogVerbatim("HGCalGeom") << "Coarse Cell[" << i << "] at (" << php.cellCoarseX_[i] << ","
659  << php.cellCoarseY_[i] << ",0)";
660  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size() << " transformation matrices";
661  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
662  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k] << std::dec
663  << ") Translation (" << php.trformTranX_[k] << ", " << php.trformTranY_[k] << ", "
664  << php.trformTranZ_[k] << " Rotation (" << php.trformRotXX_[k] << ", "
665  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", " << php.trformRotXY_[k]
666  << ", " << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
667  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k]
668  << ")";
669  }
670  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
671  for (unsigned int k = 0; k < php.copiesInLayers_.size(); ++k) {
672  const auto& theModules = php.copiesInLayers_[k];
673  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
674  int k2(0);
675  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
676  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
677  }
678  }
679 #endif
680 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
std::vector< double > moduleDzR_
std::vector< int > depthLayerF_
std::vector< int > depth_
hgtrap getModule(unsigned int k, bool reco) const
std::vector< double > moduleHR_
layer_map copiesInLayers_
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
std::vector< int > moduleLayR_
std::vector< double > moduleHS_
std::vector< double > trformTranY_
std::vector< double > cellFineY_
std::vector< double > trformRotZY_
std::vector< uint32_t > trformIndex_
std::vector< double > trformRotXX_
void fillTrForm(const hgtrform &mytr)
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< double > trformRotZX_
std::vector< double > cellCoarseX_
std::vector< double > trformRotYZ_
std::pair< double, double > cellPosition(const std::vector< cellParameters > &wafers, std::vector< cellParameters >::const_iterator &itrf, int wafer, double xx, double yy)
std::vector< double > boundR_
std::vector< double > moduleDzS_
std::vector< int > layerIndex_
std::vector< double > moduleAlphaR_
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
std::vector< double > moduleBlR_
std::vector< double > rMinLayHex_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > moduleTlS_
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
void scaleTrForm(double)
std::vector< int > layerGroup_
std::vector< double > trformRotYY_
std::vector< double > cellFineX_
std::vector< double > trformRotZZ_
static constexpr double k_ScaleFromDDD
std::vector< double > moduleAlphaS_
std::vector< double > moduleBlS_
std::vector< int > waferCopy_
std::vector< int > depthIndex_
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_

◆ loadGeometryHexagon8() [1/3]

void HGCalGeomParameters::loadGeometryHexagon8 ( const DDFilteredView _fv,
HGCalParameters php,
int  firstLayer 
)

Definition at line 682 of file HGCalGeomParameters.cc.

References funct::abs(), filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), ddtubs, Exception, spr::find(), if(), createfilelist::int, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::logicalPart(), SiStripPI::max, SiStripPI::min, DDFilteredView::next(), gpuPixelDoublets::ntot, DDTubs::rIn(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), mkfit::Const::sol, DDLogicalPart::solid(), tolerance, DDFilteredView::translation(), x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

Referenced by loadGeometryHexagon8(), and loadGeometryHexagonModule().

682  {
683  DDFilteredView fv = _fv;
684  bool dodet(true);
685  std::map<int, HGCalGeomParameters::layerParameters> layers;
686  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
687  int levelTop = 3 + std::max(php.levelT_[0], php.levelT_[1]);
688 #ifdef EDM_ML_DEBUG
689  int ntot(0);
690 #endif
691  while (dodet) {
692 #ifdef EDM_ML_DEBUG
693  ++ntot;
694 #endif
695  std::vector<int> copy = fv.copyNumbers();
696  int nsiz = (int)(copy.size());
697  if (nsiz < levelTop) {
698  int lay = copy[nsiz - 1];
699  int zside = (nsiz > php.levelZSide_) ? copy[php.levelZSide_] : -1;
700  if (zside != 1)
701  zside = -1;
702  const DDSolid& sol = fv.logicalPart().solid();
703 #ifdef EDM_ML_DEBUG
704  edm::LogVerbatim("HGCalGeom") << sol.name() << " shape " << sol.shape() << " size " << nsiz << ":" << levelTop
705  << " lay " << lay << " z " << zside;
706 #endif
707  if (lay == 0) {
708  throw cms::Exception("DDException")
709  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
710  } else if (sol.shape() == DDSolidShape::ddtubs) {
711  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
712  php.layer_.emplace_back(lay);
713  const DDTubs& tube = static_cast<DDTubs>(sol);
714  double rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
715  double rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
716  auto itr = layers.find(lay);
717  if (itr == layers.end()) {
718  double zp = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
719  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
720  layers[lay] = laypar;
721  } else {
722  (itr->second).rmin = std::min(rin, (itr->second).rmin);
723  (itr->second).rmax = std::max(rout, (itr->second).rmax);
724  }
725  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
726  DD3Vector x, y, z;
727  fv.rotation().GetComponents(x, y, z);
728  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
729  const CLHEP::HepRotation hr(rotation);
730  double xx =
731  ((std::abs(fv.translation().X()) < tolerance) ? 0
733  double yy =
734  ((std::abs(fv.translation().Y()) < tolerance) ? 0
736  const CLHEP::Hep3Vector h3v(xx, yy, HGCalParameters::k_ScaleFromDDD * fv.translation().Z());
738  mytrf.zp = zside;
739  mytrf.lay = lay;
740  mytrf.sec = 0;
741  mytrf.subsec = 0;
742  mytrf.h3v = h3v;
743  mytrf.hr = hr;
744  trforms[std::make_pair(lay, zside)] = mytrf;
745  }
746  }
747  }
748  dodet = fv.next();
749  }
750 #ifdef EDM_ML_DEBUG
751  edm::LogVerbatim("HGCalGeom") << "Total # of views " << ntot;
752 #endif
753  loadGeometryHexagon8(layers, trforms, firstLayer, php);
754 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
nav_type copyNumbers() const
return the stack of copy numbers
double rIn(void) const
Definition: DDSolid.cc:456
const double tolerance
double rOut(void) const
Definition: DDSolid.cc:458
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
bool next()
set current node to the next node in the filtered tree
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
constexpr float sol
Definition: Config.h:48
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
static constexpr double k_ScaleFromDDD
std::vector< int > levelT_
const DDTranslation & translation() const
The absolute translation of the current node.
__shared__ uint32_t ntot
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)

◆ loadGeometryHexagon8() [2/3]

void HGCalGeomParameters::loadGeometryHexagon8 ( const cms::DDCompactView cpv,
HGCalParameters php,
const std::string &  sdTag1,
int  firstLayer 
)

Definition at line 756 of file HGCalGeomParameters.cc.

References funct::abs(), filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), cms::DDSolidShapeMap, cms::ddtubs, Exception, ALCARECOTkAlBeamHalo_cff::filter, spr::find(), cms::DDFilteredView::firstChild(), if(), HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, cms::DDFilteredView::level(), HGCalParameters::levelT_, HGCalParameters::levelZSide_, loadGeometryHexagon8(), SiStripPI::max, SiStripPI::min, cms::dd::name(), cms::DDFilteredView::name(), gpuPixelDoublets::ntot, cms::DDFilteredView::parameters(), idealTransformation::rotation, cms::DDFilteredView::rotation(), cms::DDFilteredView::shape(), tolerance, cms::DDFilteredView::translation(), x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

759  {
760  const cms::DDFilter filter("Volume", sdTag1);
761  cms::DDFilteredView fv((*cpv), filter);
762  std::map<int, HGCalGeomParameters::layerParameters> layers;
763  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
764  int levelTop = 3 + std::max(php.levelT_[0], php.levelT_[1]);
765 #ifdef EDM_ML_DEBUG
766  int ntot(0);
767 #endif
768  while (fv.firstChild()) {
769 #ifdef EDM_ML_DEBUG
770  ++ntot;
771 #endif
772  // Layers first
773  int nsiz = static_cast<int>(fv.level());
774  if (nsiz < levelTop) {
775  std::vector<int> copy = fv.copyNos();
776  int lay = copy[0];
777  int zside = (nsiz > php.levelZSide_) ? copy[nsiz - php.levelZSide_ - 1] : -1;
778  if (zside != 1)
779  zside = -1;
780 #ifdef EDM_ML_DEBUG
781  edm::LogVerbatim("HGCalGeom") << fv.name() << " shape " << cms::dd::name(cms::DDSolidShapeMap, fv.shape())
782  << " size " << nsiz << ":" << levelTop << " lay " << lay << " z " << zside << ":"
783  << php.levelZSide_;
784 #endif
785  if (lay == 0) {
786  throw cms::Exception("DDException")
787  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
788  } else if (fv.shape() == cms::DDSolidShape::ddtubs) {
789  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
790  php.layer_.emplace_back(lay);
791  const std::vector<double>& pars = fv.parameters();
792  double rin = HGCalParameters::k_ScaleFromDD4hep * pars[0];
793  double rout = HGCalParameters::k_ScaleFromDD4hep * pars[1];
794  auto itr = layers.find(lay);
795  if (itr == layers.end()) {
796  double zp = HGCalParameters::k_ScaleFromDD4hep * fv.translation().Z();
797  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
798  layers[lay] = laypar;
799  } else {
800  (itr->second).rmin = std::min(rin, (itr->second).rmin);
801  (itr->second).rmax = std::max(rout, (itr->second).rmax);
802  }
803  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
804  DD3Vector x, y, z;
805  fv.rotation().GetComponents(x, y, z);
806  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
807  const CLHEP::HepRotation hr(rotation);
808  double xx = ((std::abs(fv.translation().X()) < tolerance)
809  ? 0
810  : HGCalParameters::k_ScaleFromDD4hep * fv.translation().X());
811  double yy = ((std::abs(fv.translation().Y()) < tolerance)
812  ? 0
813  : HGCalParameters::k_ScaleFromDD4hep * fv.translation().Y());
814  const CLHEP::Hep3Vector h3v(xx, yy, HGCalParameters::k_ScaleFromDD4hep * fv.translation().Z());
816  mytrf.zp = zside;
817  mytrf.lay = lay;
818  mytrf.sec = 0;
819  mytrf.subsec = 0;
820  mytrf.h3v = h3v;
821  mytrf.hr = hr;
822  trforms[std::make_pair(lay, zside)] = mytrf;
823  }
824  }
825  }
826  }
827 #ifdef EDM_ML_DEBUG
828  edm::LogVerbatim("HGCalGeom") << "Total # of views " << ntot;
829 #endif
830  loadGeometryHexagon8(layers, trforms, firstLayer, php);
831 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
const double tolerance
std::string name(Mapping a, V value)
Definition: DDSolidShapes.h:31
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr double k_ScaleFromDD4hep
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition: DDSolidShapes.h:99
std::vector< int > levelT_
__shared__ uint32_t ntot
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)

◆ loadGeometryHexagon8() [3/3]

void HGCalGeomParameters::loadGeometryHexagon8 ( const std::map< int, HGCalGeomParameters::layerParameters > &  layers,
std::map< std::pair< int, int >, HGCalParameters::hgtrform > &  trforms,
const int &  firstLayer,
HGCalParameters php 
)
private

Definition at line 1098 of file HGCalGeomParameters.cc.

References TauDecayModes::dec, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::fillTrForm(), mps_fire::i, dqmdumpme::k, phase1PixelTopology::layer, HGCalParameters::layer_, HGCalParameters::layerIndex_, hgcalTopologyTester_cfi::layers, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::trformIndex_, HGCalParameters::trformRotXX_, HGCalParameters::trformRotXY_, HGCalParameters::trformRotXZ_, HGCalParameters::trformRotYX_, HGCalParameters::trformRotYY_, HGCalParameters::trformRotYZ_, HGCalParameters::trformRotZX_, HGCalParameters::trformRotZY_, HGCalParameters::trformRotZZ_, HGCalParameters::trformTranX_, HGCalParameters::trformTranY_, HGCalParameters::trformTranZ_, and HGCalParameters::zLayerHex_.

1101  {
1102  double rmin(0), rmax(0);
1103  for (unsigned int i = 0; i < layers.size(); ++i) {
1104  for (auto& layer : layers) {
1105  if (layer.first == (int)(i + firstLayer)) {
1106  php.layerIndex_.emplace_back(i);
1107  php.rMinLayHex_.emplace_back(layer.second.rmin);
1108  php.rMaxLayHex_.emplace_back(layer.second.rmax);
1109  php.zLayerHex_.emplace_back(layer.second.zpos);
1110  if (i == 0) {
1111  rmin = layer.second.rmin;
1112  rmax = layer.second.rmax;
1113  } else {
1114  if (rmin > layer.second.rmin)
1115  rmin = layer.second.rmin;
1116  if (rmax < layer.second.rmax)
1117  rmax = layer.second.rmax;
1118  }
1119  break;
1120  }
1121  }
1122  }
1123  php.rLimit_.emplace_back(rmin);
1124  php.rLimit_.emplace_back(rmax);
1125  php.depth_ = php.layer_;
1126  php.depthIndex_ = php.layerIndex_;
1127  php.depthLayerF_ = php.layerIndex_;
1128 
1129  for (unsigned int i = 0; i < php.layer_.size(); ++i) {
1130  for (auto& trform : trforms) {
1131  if (trform.first.first == (int)(i + firstLayer)) {
1132  php.fillTrForm(trform.second);
1133  }
1134  }
1135  }
1136 
1137 #ifdef EDM_ML_DEBUG
1138  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R " << php.rLimit_[0] << ":" << php.rLimit_[1];
1139  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.zLayerHex_.size() << " layers";
1140  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
1141  int k = php.layerIndex_[i];
1142  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":" << php.layer_[k]
1143  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
1144  << " at z = " << php.zLayerHex_[i];
1145  }
1146  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size() << " transformation matrices";
1147  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
1148  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k] << std::dec
1149  << ") Translation (" << php.trformTranX_[k] << ", " << php.trformTranY_[k] << ", "
1150  << php.trformTranZ_[k] << " Rotation (" << php.trformRotXX_[k] << ", "
1151  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", " << php.trformRotXY_[k]
1152  << ", " << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
1153  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k]
1154  << ")";
1155  }
1156 #endif
1157 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
std::vector< int > depthLayerF_
std::vector< int > depth_
std::vector< double > trformTranY_
std::vector< double > trformRotZY_
std::vector< uint32_t > trformIndex_
std::vector< double > trformRotXX_
void fillTrForm(const hgtrform &mytr)
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< double > trformRotZX_
std::vector< double > trformRotYZ_
std::vector< int > layerIndex_
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
std::vector< double > rMinLayHex_
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
std::vector< double > trformRotYY_
std::vector< double > trformRotZZ_
std::vector< int > depthIndex_
std::vector< double > rLimit_
std::vector< double > trformTranZ_

◆ loadGeometryHexagonModule() [1/2]

void HGCalGeomParameters::loadGeometryHexagonModule ( const DDCompactView cpv,
HGCalParameters php,
const std::string &  sdTag1,
const std::string &  sdTag2,
int  firstLayer 
)

Definition at line 833 of file HGCalGeomParameters.cc.

References funct::abs(), c, filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), ddtubs, Exception, spr::find(), DDFilteredView::firstChild(), HGCalParameters::firstMixedLayer_, HGCalParameters::hgtrform::h3v, HGCalParameters::hgtrform::hr, if(), HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrform::lay, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, HGCalParameters::levelT_, HGCalParameters::levelZSide_, loadGeometryHexagon8(), DDFilteredView::logicalPart(), DDFilteredView::name(), DDFilteredView::next(), HGCalParameters::radiusMixBoundary_, DDTubs::rIn(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::hgtrform::sec, mkfit::Const::sol, DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrform::subsec, tolerance, DDFilteredView::translation(), x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

837  {
838 #ifdef EDM_ML_DEBUG
839  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters (DDD)::loadGeometryHexagonModule called with tags " << sdTag1
840  << ":" << sdTag2 << " firstLayer " << firstLayer << ":" << php.firstMixedLayer_;
841  int ntot1(0), ntot2(0);
842 #endif
843  std::map<int, HGCalGeomParameters::layerParameters> layers;
844  std::map<std::pair<int, int>, double> zvals;
845  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
846  int levelTop = php.levelT_[0];
847 
848  std::string attribute = "Volume";
849  DDValue val1(attribute, sdTag2, 0.0);
850  DDSpecificsMatchesValueFilter filter1{val1};
851  DDFilteredView fv1(*cpv, filter1);
852  bool dodet = fv1.firstChild();
853  while (dodet) {
854 #ifdef EDM_ML_DEBUG
855  ++ntot1;
856 #endif
857  std::vector<int> copy = fv1.copyNumbers();
858  int nsiz = static_cast<int>(copy.size());
859  if (levelTop < nsiz) {
860  int lay = copy[levelTop];
861  int zside = (nsiz > php.levelZSide_) ? copy[php.levelZSide_] : -1;
862  if (zside != 1)
863  zside = -1;
864  if (lay == 0) {
865  throw cms::Exception("DDException")
866  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
867  } else {
868  if (zvals.find(std::make_pair(lay, zside)) == zvals.end()) {
869  zvals[std::make_pair(lay, zside)] = HGCalParameters::k_ScaleFromDDD * fv1.translation().Z();
870 #ifdef EDM_ML_DEBUG
871  std::ostringstream st1;
872  st1 << "Name0 " << fv1.name() << " LTop " << levelTop << ":" << lay << " ZSide " << zside << " # of levels "
873  << nsiz;
874  for (const auto& c : copy)
875  st1 << ":" << c;
876  st1 << " Z " << zvals[std::make_pair(lay, zside)];
877  edm::LogVerbatim("HGCalGeom") << st1.str();
878 #endif
879  }
880  }
881  }
882  dodet = fv1.next();
883  }
884 
885  DDValue val2(attribute, sdTag1, 0.0);
886  DDSpecificsMatchesValueFilter filter2{val2};
887  DDFilteredView fv2(*cpv, filter2);
888  dodet = fv2.firstChild();
889  while (dodet) {
890 #ifdef EDM_ML_DEBUG
891  ++ntot2;
892 #endif
893  std::vector<int> copy = fv2.copyNumbers();
894  int nsiz = static_cast<int>(copy.size());
895  if (levelTop < nsiz) {
896  int lay = copy[levelTop];
897  int zside = (nsiz > php.levelZSide_) ? copy[php.levelZSide_] : -1;
898  if (zside != 1)
899  zside = -1;
900  const DDSolid& sol = fv2.logicalPart().solid();
901 #ifdef EDM_ML_DEBUG
902  std::ostringstream st2;
903  st2 << "Name1 " << sol.name() << " shape " << sol.shape() << " LTop " << levelTop << ":" << lay << " ZSide "
904  << zside << ":" << php.levelZSide_ << " # of levels " << nsiz;
905  for (const auto& c : copy)
906  st2 << ":" << c;
907  edm::LogVerbatim("HGCalGeom") << st2.str();
908 #endif
909  if (lay == 0) {
910  throw cms::Exception("DDException")
911  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
912  } else if (sol.shape() == DDSolidShape::ddtubs) {
913  if (zvals.find(std::make_pair(lay, zside)) != zvals.end()) {
914  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
915  php.layer_.emplace_back(lay);
916  auto itr = layers.find(lay);
917  if (itr == layers.end()) {
918  const DDTubs& tube = static_cast<DDTubs>(sol);
919  double rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
920  double rout = (php.firstMixedLayer_ > 0 && lay >= php.firstMixedLayer_)
921  ? php.radiusMixBoundary_[lay - php.firstMixedLayer_]
923  double zp = zvals[std::make_pair(lay, 1)];
924  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
925  layers[lay] = laypar;
926 #ifdef EDM_ML_DEBUG
927  std::ostringstream st3;
928  st3 << "Name1 " << fv2.name() << " LTop " << levelTop << ":" << lay << " ZSide " << zside << " # of levels "
929  << nsiz;
930  for (const auto& c : copy)
931  st3 << ":" << c;
932  st3 << " R " << rin << ":" << rout;
933  edm::LogVerbatim("HGCalGeom") << st3.str();
934 #endif
935  }
936 
937  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
938  DD3Vector x, y, z;
939  fv2.rotation().GetComponents(x, y, z);
940  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
941  const CLHEP::HepRotation hr(rotation);
942  double xx = ((std::abs(fv2.translation().X()) < tolerance)
943  ? 0
944  : HGCalParameters::k_ScaleFromDDD * fv2.translation().X());
945  double yy = ((std::abs(fv2.translation().Y()) < tolerance)
946  ? 0
947  : HGCalParameters::k_ScaleFromDDD * fv2.translation().Y());
948  const CLHEP::Hep3Vector h3v(xx, yy, zvals[std::make_pair(lay, zside)]);
950  mytrf.zp = zside;
951  mytrf.lay = lay;
952  mytrf.sec = 0;
953  mytrf.subsec = 0;
954  mytrf.h3v = h3v;
955  mytrf.hr = hr;
956  trforms[std::make_pair(lay, zside)] = mytrf;
957  }
958  }
959  }
960  }
961  dodet = fv2.next();
962  }
963 #ifdef EDM_ML_DEBUG
964  edm::LogVerbatim("HGCalGeom") << "Total # of views " << ntot1 << ":" << ntot2;
965 #endif
966  loadGeometryHexagon8(layers, trforms, firstLayer, php);
967 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
double rIn(void) const
Definition: DDSolid.cc:456
const double tolerance
double rOut(void) const
Definition: DDSolid.cc:458
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > radiusMixBoundary_
constexpr float sol
Definition: Config.h:48
static constexpr double k_ScaleFromDDD
std::vector< int > levelT_
CLHEP::HepRotation hr
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)

◆ loadGeometryHexagonModule() [2/2]

void HGCalGeomParameters::loadGeometryHexagonModule ( const cms::DDCompactView cpv,
HGCalParameters php,
const std::string &  sdTag1,
const std::string &  sdTag2,
int  firstLayer 
)

Definition at line 969 of file HGCalGeomParameters.cc.

References funct::abs(), c, filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), cms::DDSolidShapeMap, Exception, spr::find(), cms::DDFilteredView::firstChild(), HGCalParameters::firstMixedLayer_, cms::cuda::for(), HGCalParameters::hgtrform::h3v, HGCalParameters::hgtrform::hr, if(), HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::hgtrform::lay, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, cms::DDFilteredView::level(), HGCalParameters::levelT_, HGCalParameters::levelZSide_, loadGeometryHexagon8(), cms::dd::name(), cms::DDFilteredView::name(), cms::DDFilteredView::parameters(), HGCalParameters::radiusMixBoundary_, idealTransformation::rotation, cms::DDFilteredView::rotation(), HGCalParameters::hgtrform::sec, cms::DDFilteredView::shape(), HGCalParameters::hgtrform::subsec, tolerance, cms::DDFilteredView::translation(), x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

973  {
974 #ifdef EDM_ML_DEBUG
975  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters (DD4hep)::loadGeometryHexagonModule called with tags " << sdTag1
976  << ":" << sdTag2 << " firstLayer " << firstLayer;
977  int ntot1(0), ntot2(0);
978 #endif
979  std::map<int, HGCalGeomParameters::layerParameters> layers;
980  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
981  std::map<std::pair<int, int>, double> zvals;
982  int levelTop = php.levelT_[0];
983 
984  const cms::DDFilter filter1("Volume", sdTag2);
985  cms::DDFilteredView fv1((*cpv), filter1);
986  while (fv1.firstChild()) {
987 #ifdef EDM_ML_DEBUG
988  ++ntot1;
989 #endif
990  int nsiz = static_cast<int>(fv1.level());
991  if (nsiz > levelTop) {
992  std::vector<int> copy = fv1.copyNos();
993  int lay = copy[nsiz - levelTop - 1];
994  int zside = (nsiz > php.levelZSide_) ? copy[nsiz - php.levelZSide_ - 1] : -1;
995  if (zside != 1)
996  zside = -1;
997  if (lay == 0) {
998  throw cms::Exception("DDException")
999  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
1000  } else {
1001  if (zvals.find(std::make_pair(lay, zside)) == zvals.end()) {
1002  zvals[std::make_pair(lay, zside)] = HGCalParameters::k_ScaleFromDD4hep * fv1.translation().Z();
1003 #ifdef EDM_ML_DEBUG
1004  std::ostringstream st1;
1005  st1 << "Name0 " << fv1.name() << " LTop " << levelTop << ":" << lay << " ZSide " << zside << " # of levels "
1006  << nsiz;
1007  for (const auto& c : copy)
1008  st1 << ":" << c;
1009  st1 << " Z " << zvals[std::make_pair(lay, zside)];
1010  edm::LogVerbatim("HGCalGeom") << st1.str();
1011 #endif
1012  }
1013  }
1014  }
1015  }
1016 
1017  const cms::DDFilter filter2("Volume", sdTag1);
1018  cms::DDFilteredView fv2((*cpv), filter2);
1019  while (fv2.firstChild()) {
1020  // Layers first
1021  int nsiz = static_cast<int>(fv2.level());
1022 #ifdef EDM_ML_DEBUG
1023  ++ntot2;
1024 #endif
1025  if (nsiz > levelTop) {
1026  std::vector<int> copy = fv2.copyNos();
1027  int lay = copy[nsiz - levelTop - 1];
1028  int zside = (nsiz > php.levelZSide_) ? copy[nsiz - php.levelZSide_ - 1] : -1;
1029  if (zside != 1)
1030  zside = -1;
1031 #ifdef EDM_ML_DEBUG
1032  std::ostringstream st2;
1033  st2 << "Name1 " << fv2.name() << "Shape " << cms::dd::name(cms::DDSolidShapeMap, fv2.shape()) << " LTop "
1034  << levelTop << ":" << lay << " ZSide " << zside << ":" << php.levelZSide_ << " # of levels " << nsiz;
1035  for (const auto& c : copy)
1036  st2 << ":" << c;
1037  edm::LogVerbatim("HGCalGeom") << st2.str();
1038 #endif
1039  if (lay == 0) {
1040  throw cms::Exception("DDException")
1041  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
1042  } else {
1043  if (zvals.find(std::make_pair(lay, zside)) != zvals.end()) {
1044  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
1045  php.layer_.emplace_back(lay);
1046  auto itr = layers.find(lay);
1047  if (itr == layers.end()) {
1048  const std::vector<double>& pars = fv2.parameters();
1049  double rin = HGCalParameters::k_ScaleFromDD4hep * pars[0];
1050  double rout = (php.firstMixedLayer_ > 0 && lay >= php.firstMixedLayer_)
1051  ? php.radiusMixBoundary_[lay - php.firstMixedLayer_]
1053  double zp = zvals[std::make_pair(lay, 1)];
1054  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
1055  layers[lay] = laypar;
1056 #ifdef EDM_ML_DEBUG
1057  std::ostringstream st3;
1058  st3 << "Name2 " << fv2.name() << " LTop " << levelTop << ":" << lay << " ZSide " << zside << " # of levels "
1059  << nsiz;
1060  for (const auto& c : copy)
1061  st3 << ":" << c;
1062  st3 << " R " << rin << ":" << rout;
1063  edm::LogVerbatim("HGCalGeom") << st3.str();
1064 #endif
1065  }
1066 
1067  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
1068  DD3Vector x, y, z;
1069  fv2.rotation().GetComponents(x, y, z);
1070  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
1071  const CLHEP::HepRotation hr(rotation);
1072  double xx = ((std::abs(fv2.translation().X()) < tolerance)
1073  ? 0
1074  : HGCalParameters::k_ScaleFromDD4hep * fv2.translation().X());
1075  double yy = ((std::abs(fv2.translation().Y()) < tolerance)
1076  ? 0
1077  : HGCalParameters::k_ScaleFromDD4hep * fv2.translation().Y());
1078  const CLHEP::Hep3Vector h3v(xx, yy, zvals[std::make_pair(lay, zside)]);
1080  mytrf.zp = zside;
1081  mytrf.lay = lay;
1082  mytrf.sec = 0;
1083  mytrf.subsec = 0;
1084  mytrf.h3v = h3v;
1085  mytrf.hr = hr;
1086  trforms[std::make_pair(lay, zside)] = mytrf;
1087  }
1088  }
1089  }
1090  }
1091  }
1092 #ifdef EDM_ML_DEBUG
1093  edm::LogVerbatim("HGCalGeom") << "Total # of views " << ntot1 << ":" << ntot2;
1094 #endif
1095  loadGeometryHexagon8(layers, trforms, firstLayer, php);
1096 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
const double tolerance
std::string name(Mapping a, V value)
Definition: DDSolidShapes.h:31
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr double k_ScaleFromDD4hep
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition: DDSolidShapes.h:99
std::vector< double > radiusMixBoundary_
std::vector< int > levelT_
CLHEP::HepRotation hr
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)

◆ loadSpecParsHexagon() [1/3]

void HGCalGeomParameters::loadSpecParsHexagon ( const DDFilteredView fv,
HGCalParameters php,
const DDCompactView cpv,
const std::string &  sdTag1,
const std::string &  sdTag2 
)

Definition at line 1159 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, dbl_to_int(), getDDDArray(), HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::layerOffset_, HGCalParameters::levelT_, DDFilteredView::mergedSpecifics(), rescale(), HGCalParameters::rLimit_, HGCalParameters::slopeMin_, AlCaHLTBitMon_QueryRunRegistry::string, and pfDeepBoostedJetPreprocessParams_cfi::sv.

Referenced by loadSpecParsHexagon().

1163  {
1165  php.boundR_ = getDDDArray("RadiusBound", sv, 4);
1167  php.rLimit_ = getDDDArray("RadiusLimits", sv, 2);
1169  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv, 0));
1170 
1171  // Grouping of layers
1172  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine", sv, 0));
1173  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid", sv, 0));
1174  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut", sv, 0));
1175  php.slopeMin_ = getDDDArray("Slope", sv, 1);
1176  const auto& dummy2 = getDDDArray("LayerOffset", sv, 0);
1177  if (!dummy2.empty())
1178  php.layerOffset_ = dummy2[0];
1179  else
1180  php.layerOffset_ = 0;
1181 
1182  // Wafer size
1183  std::string attribute = "Volume";
1184  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, sdTag1, 0.0)};
1185  DDFilteredView fv1(*cpv, filter1);
1186  if (fv1.firstChild()) {
1187  DDsvalues_type sv(fv1.mergedSpecifics());
1188  const auto& dummy = getDDDArray("WaferSize", sv, 0);
1189  waferSize_ = dummy[0];
1190  }
1191 
1192  // Cell size
1193  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, sdTag2, 0.0)};
1194  DDFilteredView fv2(*cpv, filter2);
1195  if (fv2.firstChild()) {
1196  DDsvalues_type sv(fv2.mergedSpecifics());
1197  php.cellSize_ = getDDDArray("CellSize", sv, 0);
1198  }
1199 
1200  loadSpecParsHexagon(php);
1201 }
void rescale(std::vector< double > &, const double s)
void loadSpecParsHexagon(const DDFilteredView &fv, HGCalParameters &php, const DDCompactView *cpv, const std::string &sdTag1, const std::string &sdTag2)
std::vector< int > layerGroupM_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > boundR_
std::vector< double > cellSize_
std::vector< double > getDDDArray(const std::string &str, const DDsvalues_type &sv, const int nmin)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
DDsvalues_type mergedSpecifics() const
std::vector< double > slopeMin_
std::vector< int > layerGroup_
static constexpr double k_ScaleFromDDD
std::vector< int > layerGroupO_
std::vector< double > rLimit_
std::vector< int > levelT_

◆ loadSpecParsHexagon() [2/3]

void HGCalGeomParameters::loadSpecParsHexagon ( const cms::DDFilteredView fv,
HGCalParameters php,
const std::string &  sdTag1,
const std::string &  sdTag2,
const std::string &  sdTag3,
const std::string &  sdTag4 
)

Definition at line 1203 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::cellSize_, dbl_to_int(), cms::DDFilteredView::get(), HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleFromDD4hepToG4, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::layerOffset_, HGCalParameters::levelT_, loadSpecParsHexagon(), rescale(), HGCalParameters::rLimit_, HGCalParameters::slopeMin_, and waferSize_.

1208  {
1209  php.boundR_ = fv.get<std::vector<double> >(sdTag4, "RadiusBound");
1211  php.rLimit_ = fv.get<std::vector<double> >(sdTag4, "RadiusLimits");
1213  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(sdTag4, "LevelTop"));
1214 
1215  // Grouping of layers
1216  php.layerGroup_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZFine"));
1217  php.layerGroupM_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZMid"));
1218  php.layerGroupO_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZOut"));
1219  php.slopeMin_ = fv.get<std::vector<double> >(sdTag4, "Slope");
1220  if (php.slopeMin_.empty())
1221  php.slopeMin_.emplace_back(0);
1222 
1223  // Wafer size
1224  const auto& dummy = fv.get<std::vector<double> >(sdTag2, "WaferSize");
1226 
1227  // Cell size
1228  php.cellSize_ = fv.get<std::vector<double> >(sdTag3, "CellSize");
1230 
1231  // Layer Offset
1232  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
1233  if (!dummy2.empty()) {
1234  php.layerOffset_ = dummy2[0];
1235  } else {
1236  php.layerOffset_ = 0;
1237  }
1238 
1239  loadSpecParsHexagon(php);
1240 }
void rescale(std::vector< double > &, const double s)
void loadSpecParsHexagon(const DDFilteredView &fv, HGCalParameters &php, const DDCompactView *cpv, const std::string &sdTag1, const std::string &sdTag2)
std::vector< int > layerGroupM_
std::vector< double > boundR_
std::vector< double > cellSize_
static constexpr double k_ScaleFromDD4hep
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
static constexpr double k_ScaleFromDD4hepToG4
std::vector< double > slopeMin_
T get(const std::string &)
extract attribute value
std::vector< int > layerGroup_
std::vector< int > layerGroupO_
std::vector< double > rLimit_
std::vector< int > levelT_

◆ loadSpecParsHexagon() [3/3]

void HGCalGeomParameters::loadSpecParsHexagon ( const HGCalParameters php)
private

Definition at line 1242 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::cellSize_, HGCalParameters::firstLayer_, dqmdumpme::k, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::layerOffset_, HGCalParameters::levelT_, HGCalParameters::rLimit_, HGCalParameters::slopeMin_, and waferSize_.

1242  {
1243 #ifdef EDM_ML_DEBUG
1244  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius ranges"
1245  << " for cell grouping " << php.boundR_[0] << ":" << php.boundR_[1] << ":"
1246  << php.boundR_[2] << ":" << php.boundR_[3];
1247  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R " << php.rLimit_[0] << ":" << php.rLimit_[1];
1248  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: LevelTop " << php.levelT_[0];
1249  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: minimum slope " << php.slopeMin_[0] << " and layer groupings "
1250  << "for the 3 ranges:";
1251  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k)
1252  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerGroup_[k] << ":" << php.layerGroupM_[k] << ":"
1253  << php.layerGroupO_[k];
1254  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Wafer Size: " << waferSize_;
1255  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: " << php.cellSize_.size() << " cells of sizes:";
1256  for (unsigned int k = 0; k < php.cellSize_.size(); ++k)
1257  edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << php.cellSize_[k];
1258  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: First Layer " << php.firstLayer_ << " and layer offset "
1259  << php.layerOffset_;
1260 #endif
1261 }
Log< level::Info, true > LogVerbatim
std::vector< int > layerGroupM_
std::vector< double > boundR_
std::vector< double > cellSize_
std::vector< double > slopeMin_
std::vector< int > layerGroup_
std::vector< int > layerGroupO_
std::vector< double > rLimit_
std::vector< int > levelT_

◆ loadSpecParsHexagon8() [1/4]

void HGCalGeomParameters::loadSpecParsHexagon8 ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 1263 of file HGCalGeomParameters.cc.

References HGCalParameters::cassetteShift_, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, dbl_to_int(), HGCalParameters::fracAreaMin_, getDDDArray(), HGCalGeometryMode::Hexagon8Module, createfilelist::int, dqmdumpme::k, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerCenter_, HGCalParameters::layerOffset_, DDFilteredView::mergedSpecifics(), HGCalParameters::mode_, HGCalParameters::nCornerCut_, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, siliconCassetteEE, siliconCassetteHE, siliconFileEE, siliconFileHE, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, DDFilteredView::vector(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferMaskMode_, HGCalParameters::waferThick_, HGCalParameters::waferThickness_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

Referenced by loadSpecParsHexagon8().

1263  {
1265  php.cellThickness_ = getDDDArray("CellThickness", sv, 3);
1268  php.waferThickness_ = getDDDArray("WaferThickness", sv, 3);
1270  } else {
1271  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1272  php.waferThickness_.emplace_back(php.waferThick_);
1273  }
1274 
1275  php.radius100to200_ = getDDDArray("Radius100to200", sv, 5);
1276  php.radius200to300_ = getDDDArray("Radius200to300", sv, 5);
1277 
1278  const auto& dummy = getDDDArray("RadiusCuts", sv, 4);
1279  php.choiceType_ = (int)(dummy[0]);
1280  php.nCornerCut_ = (int)(dummy[1]);
1281  php.fracAreaMin_ = dummy[2];
1283 
1284  php.radiusMixBoundary_ = fv.vector("RadiusMixBoundary");
1286 
1287  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
1288  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
1290  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
1292 
1293  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
1294  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
1296  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
1298 
1299  php.zRanges_ = fv.vector("ZRanges");
1301 
1302  const auto& dummy2 = getDDDArray("LayerOffset", sv, 1);
1303  php.layerOffset_ = dummy2[0];
1304  php.layerCenter_ = dbl_to_int(fv.vector("LayerCenter"));
1305 
1306  loadSpecParsHexagon8(php);
1307 
1308  // Read in parameters from Philip's file
1309  if (php.waferMaskMode_ > 1) {
1310  std::vector<int> layerType, waferIndex, waferProperties;
1311  std::vector<double> cassetteShift;
1312  if (php.waferMaskMode_ == siliconFileEE) {
1313  waferIndex = dbl_to_int(fv.vector("WaferIndexEE"));
1314  waferProperties = dbl_to_int(fv.vector("WaferPropertiesEE"));
1315  } else if (php.waferMaskMode_ == siliconCassetteEE) {
1316  waferIndex = dbl_to_int(fv.vector("WaferIndexEE"));
1317  waferProperties = dbl_to_int(fv.vector("WaferPropertiesEE"));
1318  cassetteShift = fv.vector("CassetteShiftEE");
1319  } else if (php.waferMaskMode_ == siliconFileHE) {
1320  waferIndex = dbl_to_int(fv.vector("WaferIndexHE"));
1321  waferProperties = dbl_to_int(fv.vector("WaferPropertiesHE"));
1322  } else if (php.waferMaskMode_ == siliconCassetteHE) {
1323  waferIndex = dbl_to_int(fv.vector("WaferIndexHE"));
1324  waferProperties = dbl_to_int(fv.vector("WaferPropertiesHE"));
1325  cassetteShift = fv.vector("CassetteShiftHE");
1326  }
1328  if ((php.waferMaskMode_ == siliconFileEE) || (php.waferMaskMode_ == siliconCassetteEE)) {
1329  layerType = dbl_to_int(fv.vector("LayerTypesEE"));
1330  } else if ((php.waferMaskMode_ == siliconFileHE) || (php.waferMaskMode_ == siliconCassetteHE)) {
1331  layerType = dbl_to_int(fv.vector("LayerTypesHE"));
1332  }
1333  }
1334 
1335  php.cassetteShift_ = cassetteShift;
1337  loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties);
1338  }
1339 }
std::vector< double > zFrontMin_
std::vector< double > const & vector(std::string_view iKey) const
The DDVector information.
static constexpr int siliconFileEE
void rescale(std::vector< double > &, const double s)
HGCalGeometryMode::GeometryMode mode_
void loadSpecParsHexagon8(const DDFilteredView &fv, HGCalParameters &php)
static constexpr int siliconCassetteHE
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > rMaxFront_
static constexpr int siliconCassetteEE
std::vector< double > getDDDArray(const std::string &str, const DDsvalues_type &sv, const int nmin)
std::vector< double > waferThickness_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
static constexpr double k_ScaleFromDD4hep
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
DDsvalues_type mergedSpecifics() const
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
std::vector< double > radius200to300_
std::vector< double > radius100to200_
std::vector< double > rMinFront_
static constexpr double k_ScaleFromDDD
std::vector< double > cassetteShift_
std::vector< double > zFrontTop_
static constexpr int siliconFileHE

◆ loadSpecParsHexagon8() [2/4]

void HGCalGeomParameters::loadSpecParsHexagon8 ( const cms::DDFilteredView fv,
const cms::DDVectorsMap vmap,
HGCalParameters php,
const std::string &  sdTag1 
)

Definition at line 1341 of file HGCalGeomParameters.cc.

References HGCalParameters::cassetteShift_, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, HGCalParameters::fracAreaMin_, cms::DDFilteredView::get(), HGCalGeometryMode::Hexagon8Module, mps_fire::i, dqmdumpme::k, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::layerCenter_, HGCalParameters::layerOffset_, loadSpecParsHexagon8(), HGCalParameters::mode_, HGCalParameters::nCornerCut_, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, siliconCassetteEE, siliconCassetteHE, siliconFileEE, siliconFileHE, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalWaferIndex::waferIndex(), HGCalParameters::waferMaskMode_, HGCalParameters::waferThick_, HGCalParameters::waferThickness_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

1344  {
1345  php.cellThickness_ = fv.get<std::vector<double> >(sdTag1, "CellThickness");
1348  php.waferThickness_ = fv.get<std::vector<double> >(sdTag1, "WaferThickness");
1350  } else {
1351  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1352  php.waferThickness_.emplace_back(php.waferThick_);
1353  }
1354 
1355  php.radius100to200_ = fv.get<std::vector<double> >(sdTag1, "Radius100to200");
1356  php.radius200to300_ = fv.get<std::vector<double> >(sdTag1, "Radius200to300");
1357 
1358  const auto& dummy = fv.get<std::vector<double> >(sdTag1, "RadiusCuts");
1359  if (dummy.size() > 3) {
1360  php.choiceType_ = static_cast<int>(dummy[0]);
1361  php.nCornerCut_ = static_cast<int>(dummy[1]);
1362  php.fracAreaMin_ = dummy[2];
1364  } else {
1365  php.choiceType_ = php.nCornerCut_ = php.fracAreaMin_ = php.zMinForRad_ = 0;
1366  }
1367 
1368  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
1369  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
1371  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
1373 
1374  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
1375  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
1377  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
1379  unsigned int kmax = (php.zFrontTop_.size() - php.slopeTop_.size());
1380  for (unsigned int k = 0; k < kmax; ++k)
1381  php.slopeTop_.emplace_back(0);
1382 
1383  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
1384  if (!dummy2.empty()) {
1385  php.layerOffset_ = dummy2[0];
1386  } else {
1387  php.layerOffset_ = 0;
1388  }
1389 
1390  for (auto const& it : vmap) {
1391  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "RadiusMixBoundary")) {
1392  for (const auto& i : it.second)
1394  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "ZRanges")) {
1395  for (const auto& i : it.second)
1396  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1397  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerCenter")) {
1398  for (const auto& i : it.second)
1399  php.layerCenter_.emplace_back(std::round(i));
1400  }
1401  }
1402 
1403  loadSpecParsHexagon8(php);
1404 
1405  // Read in parameters from Philip's file
1406  if (php.waferMaskMode_ > 1) {
1407  std::vector<int> layerType, waferIndex, waferProperties;
1408  std::vector<double> cassetteShift;
1409  if ((php.waferMaskMode_ == siliconFileEE) || (php.waferMaskMode_ == siliconCassetteEE)) {
1410  for (auto const& it : vmap) {
1411  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexEE")) {
1412  for (const auto& i : it.second)
1413  waferIndex.emplace_back(std::round(i));
1414  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferPropertiesEE")) {
1415  for (const auto& i : it.second)
1416  waferProperties.emplace_back(std::round(i));
1417  }
1418  }
1419  if (php.waferMaskMode_ == siliconCassetteEE) {
1420  for (auto const& it : vmap) {
1421  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CassetteShiftEE")) {
1422  for (const auto& i : it.second)
1423  cassetteShift.emplace_back(i);
1424  }
1425  }
1426  }
1427  } else if ((php.waferMaskMode_ == siliconFileHE) || (php.waferMaskMode_ == siliconCassetteHE)) {
1428  for (auto const& it : vmap) {
1429  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexHE")) {
1430  for (const auto& i : it.second)
1431  waferIndex.emplace_back(std::round(i));
1432  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferPropertiesHE")) {
1433  for (const auto& i : it.second)
1434  waferProperties.emplace_back(std::round(i));
1435  }
1436  }
1437  if (php.waferMaskMode_ == siliconCassetteHE) {
1438  for (auto const& it : vmap) {
1439  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CassetteShiftHE")) {
1440  for (const auto& i : it.second)
1441  cassetteShift.emplace_back(i);
1442  }
1443  }
1444  }
1445  }
1447  if ((php.waferMaskMode_ == siliconFileEE) || (php.waferMaskMode_ == siliconFileHE)) {
1448  for (auto const& it : vmap) {
1449  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypesEE")) {
1450  for (const auto& i : it.second)
1451  layerType.emplace_back(std::round(i));
1452  }
1453  }
1454  } else if (php.waferMaskMode_ == siliconFileHE) {
1455  for (auto const& it : vmap) {
1456  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypesHE")) {
1457  for (const auto& i : it.second)
1458  layerType.emplace_back(std::round(i));
1459  }
1460  }
1461  }
1462  }
1463 
1464  php.cassetteShift_ = cassetteShift;
1466  loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties);
1467  }
1468 }
std::vector< double > zFrontMin_
static constexpr int siliconFileEE
void rescale(std::vector< double > &, const double s)
HGCalGeometryMode::GeometryMode mode_
void loadSpecParsHexagon8(const DDFilteredView &fv, HGCalParameters &php)
static constexpr int siliconCassetteHE
std::vector< double > rMaxFront_
static constexpr int siliconCassetteEE
std::vector< double > waferThickness_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
static constexpr double k_ScaleFromDD4hep
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< double > zRanges_
std::vector< double > slopeMin_
T get(const std::string &)
extract attribute value
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
std::vector< double > radius200to300_
std::vector< double > radius100to200_
std::vector< double > rMinFront_
std::vector< double > cassetteShift_
std::vector< double > zFrontTop_
static constexpr int siliconFileHE

◆ loadSpecParsHexagon8() [3/4]

void HGCalGeomParameters::loadSpecParsHexagon8 ( HGCalParameters php)
private

Definition at line 1470 of file HGCalGeomParameters.cc.

References HGCalParameters::cellThickness_, HGCalParameters::choiceType_, HGCalParameters::fracAreaMin_, dqmdumpme::k, HGCalParameters::layerCenter_, HGCalParameters::layerOffset_, HGCalParameters::nCornerCut_, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalParameters::waferThickness_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

1470  {
1471 #ifdef EDM_ML_DEBUG
1472  for (unsigned int k = 0; k < php.waferThickness_.size(); ++k)
1473  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer[" << k << "] Thickness " << php.waferThickness_[k];
1474  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1475  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: cell[" << k << "] Thickness " << php.cellThickness_[k];
1476  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
1477  << "parameters for 120 to 200 micron "
1478  << "transition with" << php.radius100to200_.size() << " elements";
1479  for (unsigned int k = 0; k < php.radius100to200_.size(); ++k)
1480  edm::LogVerbatim("HGCalGeom") << "Element [" << k << "] " << php.radius100to200_[k];
1481  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
1482  << "parameters for 200 to 300 micron "
1483  << "transition with " << php.radius200to300_.size() << " elements";
1484  for (unsigned int k = 0; k < php.radius200to300_.size(); ++k)
1485  edm::LogVerbatim("HGCalGeom") << "Element [" << k << "] " << php.radius200to300_[k];
1486  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Parameters for the"
1487  << " transition " << php.choiceType_ << ":" << php.nCornerCut_ << ":"
1488  << php.fracAreaMin_ << ":" << php.zMinForRad_;
1489  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k)
1490  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k];
1491  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
1492  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
1493  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
1494  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
1495  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
1496  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
1497  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
1498  << php.zRanges_[2] << ":" << php.zRanges_[3];
1499  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: LayerOffset " << php.layerOffset_ << " in array of size "
1500  << php.layerCenter_.size();
1501  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
1502  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
1503 #endif
1504 }
Log< level::Info, true > LogVerbatim
std::vector< double > zFrontMin_
std::vector< double > rMaxFront_
std::vector< double > waferThickness_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
std::vector< double > radius200to300_
std::vector< double > radius100to200_
std::vector< double > rMinFront_
std::vector< double > zFrontTop_

◆ loadSpecParsHexagon8() [4/4]

void HGCalGeomParameters::loadSpecParsHexagon8 ( HGCalParameters php,
const std::vector< int > &  layerType,
const std::vector< int > &  waferIndex,
const std::vector< int > &  waferProperties 
)
private

Definition at line 1506 of file HGCalGeomParameters.cc.

References HGCalTypes::CornerCenterYm, HGCalTypes::CornerCenterYp, funct::cos(), HGCalWaferMask::getRotation(), dqmdumpme::k, HGCalParameters::layerRotation_, HGCalParameters::layerRotV_, HGCalParameters::layerType_, hgcalPerformanceValidation::orient, funct::sin(), HGCalTypes::WaferCenter, HGCalTypes::WaferCenterB, HGCalTypes::WaferCenterR, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalWaferIndex::waferLayer(), HGCalProperty::waferOrient(), HGCalProperty::waferPartial(), HGCalProperty::waferThick(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and HGCalParameters::waferZSide_.

1509  {
1510  // Store parameters from Philip's file
1511  int types[5] = {HGCalTypes::WaferCenter,
1516  for (unsigned int k = 0; k < layerType.size(); ++k) {
1517  php.layerType_.emplace_back(types[layerType[k]]);
1518 #ifdef EDM_ML_DEBUG
1519  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << layerType[k] << ":" << php.layerType_[k];
1520 #endif
1521  }
1522  for (unsigned int k = 0; k < php.layerType_.size(); ++k) {
1523  double cth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? cos(php.layerRotation_) : 1.0;
1524  double sth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? sin(php.layerRotation_) : 0.0;
1525  php.layerRotV_.emplace_back(std::make_pair(cth, sth));
1526 #ifdef EDM_ML_DEBUG
1527  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << php.layerType_[k] << " cos|sin(Theta) "
1528  << php.layerRotV_[k].first << ":" << php.layerRotV_[k].second;
1529 #endif
1530  }
1531  for (unsigned int k = 0; k < waferIndex.size(); ++k) {
1532  int partial = HGCalProperty::waferPartial(waferProperties[k]);
1533  int orient = HGCalWaferMask::getRotation(php.waferZSide_, partial, HGCalProperty::waferOrient(waferProperties[k]));
1534  php.waferInfoMap_[waferIndex[k]] =
1535  HGCalParameters::waferInfo(HGCalProperty::waferThick(waferProperties[k]), partial, orient);
1536 #ifdef EDM_ML_DEBUG
1537  edm::LogVerbatim("HGCalGeom") << "[" << k << ":" << waferIndex[k] << ":"
1540  << HGCalWaferIndex::waferV(waferIndex[k]) << "] Thickness type "
1541  << HGCalProperty::waferThick(waferProperties[k]) << " Partial type " << partial
1542  << " Orientation " << HGCalProperty::waferOrient(waferProperties[k]) << ":" << orient;
1543 #endif
1544  }
1545 }
Log< level::Info, true > LogVerbatim
static constexpr int32_t WaferCenter
Definition: HGCalTypes.h:20
std::vector< std::pair< double, double > > layerRotV_
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
static constexpr int32_t CornerCenterYm
Definition: HGCalTypes.h:22
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static int getRotation(int zside, int type, int rotn)
int32_t waferOrient(const int32_t property)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int32_t waferThick(const int32_t property)
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
static constexpr int32_t CornerCenterYp
Definition: HGCalTypes.h:21
std::vector< int > layerType_
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:26
int32_t waferPartial(const int32_t property)
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
static constexpr int32_t WaferCenterB
Definition: HGCalTypes.h:25

◆ loadSpecParsTrapezoid() [1/4]

void HGCalGeomParameters::loadSpecParsTrapezoid ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 1547 of file HGCalGeomParameters.cc.

References HGCalParameters::cassetteShift_, HGCalParameters::cellSize_, dbl_to_int(), getDDDArray(), HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerCenter_, HGCalParameters::layerFrontBH_, HGCalParameters::layerOffset_, M_PI, DDFilteredView::mergedSpecifics(), HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::nPhiBinBH_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, scintillatorCassette, scintillatorFile, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalProperty::tileProperty(), DDFilteredView::vector(), HGCalParameters::waferMaskMode_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, and HGCalParameters::zRanges_.

Referenced by loadSpecParsTrapezoid().

1547  {
1549  php.radiusMixBoundary_ = fv.vector("RadiusMixBoundary");
1551 
1552  php.nPhiBinBH_ = dbl_to_int(getDDDArray("NPhiBinBH", sv, 0));
1553  php.layerFrontBH_ = dbl_to_int(getDDDArray("LayerFrontBH", sv, 0));
1554  php.rMinLayerBH_ = getDDDArray("RMinLayerBH", sv, 0);
1556  php.nCellsFine_ = php.nPhiBinBH_[0];
1557  php.nCellsCoarse_ = php.nPhiBinBH_[1];
1558  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
1559  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
1560 
1561  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
1562  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
1564  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
1566 
1567  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
1568  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
1570  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
1572 
1573  php.zRanges_ = fv.vector("ZRanges");
1575 
1576  // Offsets
1577  const auto& dummy2 = getDDDArray("LayerOffset", sv, 1);
1578  php.layerOffset_ = dummy2[0];
1579  php.layerCenter_ = dbl_to_int(fv.vector("LayerCenter"));
1580 
1581  loadSpecParsTrapezoid(php);
1582 
1583  // tile parameters from Katja's file
1585  std::vector<int> tileIndx, tileProperty;
1586  std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1587  std::vector<double> tileRMin, tileRMax;
1588  std::vector<int> tileRingMin, tileRingMax;
1589  std::vector<double> cassetteShift;
1590  tileIndx = dbl_to_int(fv.vector("TileIndex"));
1591  tileProperty = dbl_to_int(fv.vector("TileProperty"));
1592  tileHEX1 = dbl_to_int(fv.vector("TileHEX1"));
1593  tileHEX2 = dbl_to_int(fv.vector("TileHEX2"));
1594  tileHEX3 = dbl_to_int(fv.vector("TileHEX3"));
1595  tileHEX4 = dbl_to_int(fv.vector("TileHEX4"));
1596  tileRMin = fv.vector("TileRMin");
1597  tileRMax = fv.vector("TileRMax");
1600  tileRingMin = dbl_to_int(fv.vector("TileRingMin"));
1601  tileRingMax = dbl_to_int(fv.vector("TileRingMax"));
1602  if (php.waferMaskMode_ == scintillatorCassette) {
1603  cassetteShift = fv.vector("CassetteShiftHE");
1604  rescale(cassetteShift, HGCalParameters::k_ScaleFromDDD);
1605  }
1606 
1607  php.cassetteShift_ = cassetteShift;
1609  tileIndx,
1610  tileProperty,
1611  tileHEX1,
1612  tileHEX2,
1613  tileHEX3,
1614  tileHEX4,
1615  tileRMin,
1616  tileRMax,
1617  tileRingMin,
1618  tileRingMax);
1619  }
1620 }
static constexpr int scintillatorCassette
std::vector< double > zFrontMin_
std::vector< double > const & vector(std::string_view iKey) const
The DDVector information.
void rescale(std::vector< double > &, const double s)
std::vector< int > nPhiBinBH_
std::vector< double > rMinLayerBH_
static constexpr int scintillatorFile
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > cellSize_
std::vector< double > rMaxFront_
std::vector< double > getDDDArray(const std::string &str, const DDsvalues_type &sv, const int nmin)
std::vector< double > slopeTop_
std::vector< int > layerCenter_
#define M_PI
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
DDsvalues_type mergedSpecifics() const
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > rMinFront_
static constexpr double k_ScaleFromDDD
void loadSpecParsTrapezoid(const DDFilteredView &fv, HGCalParameters &php)
std::vector< double > cassetteShift_
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
int32_t tileProperty(const int32_t type, const int32_t sipm)

◆ loadSpecParsTrapezoid() [2/4]

void HGCalGeomParameters::loadSpecParsTrapezoid ( const cms::DDFilteredView fv,
const cms::DDVectorsMap vmap,
HGCalParameters php,
const std::string &  sdTag1 
)

Definition at line 1622 of file HGCalGeomParameters.cc.

References HGCalParameters::cassetteShift_, HGCalParameters::cellSize_, dbl_to_int(), cms::DDFilteredView::get(), mps_fire::i, dqmdumpme::k, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerCenter_, HGCalParameters::layerFrontBH_, HGCalParameters::layerOffset_, loadSpecParsTrapezoid(), M_PI, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::nPhiBinBH_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, scintillatorCassette, scintillatorFile, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalProperty::tileProperty(), HGCalParameters::waferMaskMode_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, and HGCalParameters::zRanges_.

1625  {
1626  for (auto const& it : vmap) {
1627  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "RadiusMixBoundary")) {
1628  for (const auto& i : it.second)
1630  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "ZRanges")) {
1631  for (const auto& i : it.second)
1632  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1633  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerCenter")) {
1634  for (const auto& i : it.second)
1635  php.layerCenter_.emplace_back(std::round(i));
1636  }
1637  }
1638 
1639  php.nPhiBinBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "NPhiBinBH"));
1640  php.layerFrontBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "LayerFrontBH"));
1641  php.rMinLayerBH_ = fv.get<std::vector<double> >(sdTag1, "RMinLayerBH");
1643  php.nCellsFine_ = php.nPhiBinBH_[0];
1644  php.nCellsCoarse_ = php.nPhiBinBH_[1];
1645  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
1646  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
1647 
1648  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
1649  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
1651  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
1653 
1654  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
1655  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
1657  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
1659  unsigned int kmax = (php.zFrontTop_.size() - php.slopeTop_.size());
1660  for (unsigned int k = 0; k < kmax; ++k)
1661  php.slopeTop_.emplace_back(0);
1662 
1663  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
1664  php.layerOffset_ = dummy2[0];
1665 
1666  loadSpecParsTrapezoid(php);
1667 
1668  // tile parameters from Katja's file
1670  std::vector<int> tileIndx, tileProperty;
1671  std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1672  std::vector<double> tileRMin, tileRMax;
1673  std::vector<int> tileRingMin, tileRingMax;
1674  std::vector<double> cassetteShift;
1675  for (auto const& it : vmap) {
1676  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileIndex")) {
1677  for (const auto& i : it.second)
1678  tileIndx.emplace_back(std::round(i));
1679  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileProperty")) {
1680  for (const auto& i : it.second)
1681  tileProperty.emplace_back(std::round(i));
1682  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX1")) {
1683  for (const auto& i : it.second)
1684  tileHEX1.emplace_back(std::round(i));
1685  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX2")) {
1686  for (const auto& i : it.second)
1687  tileHEX2.emplace_back(std::round(i));
1688  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX3")) {
1689  for (const auto& i : it.second)
1690  tileHEX3.emplace_back(std::round(i));
1691  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX4")) {
1692  for (const auto& i : it.second)
1693  tileHEX4.emplace_back(std::round(i));
1694  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRMin")) {
1695  for (const auto& i : it.second)
1696  tileRMin.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1697  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRMax")) {
1698  for (const auto& i : it.second)
1699  tileRMax.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1700  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRingMin")) {
1701  for (const auto& i : it.second)
1702  tileRingMin.emplace_back(std::round(i));
1703  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRingMax")) {
1704  for (const auto& i : it.second)
1705  tileRingMax.emplace_back(std::round(i));
1706  }
1707  }
1708  if (php.waferMaskMode_ == scintillatorCassette) {
1709  for (auto const& it : vmap) {
1710  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CassetteShiftHE")) {
1711  for (const auto& i : it.second)
1712  cassetteShift.emplace_back(i);
1713  }
1714  }
1715  }
1716 
1717  rescale(cassetteShift, HGCalParameters::k_ScaleFromDDD);
1718  php.cassetteShift_ = cassetteShift;
1720  tileIndx,
1721  tileProperty,
1722  tileHEX1,
1723  tileHEX2,
1724  tileHEX3,
1725  tileHEX4,
1726  tileRMin,
1727  tileRMax,
1728  tileRingMin,
1729  tileRingMax);
1730  }
1731 }
static constexpr int scintillatorCassette
std::vector< double > zFrontMin_
void rescale(std::vector< double > &, const double s)
std::vector< int > nPhiBinBH_
std::vector< double > rMinLayerBH_
static constexpr int scintillatorFile
std::vector< double > cellSize_
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
static constexpr double k_ScaleFromDD4hep
#define M_PI
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< double > zRanges_
std::vector< double > slopeMin_
T get(const std::string &)
extract attribute value
std::vector< double > radiusMixBoundary_
std::vector< double > rMinFront_
static constexpr double k_ScaleFromDDD
void loadSpecParsTrapezoid(const DDFilteredView &fv, HGCalParameters &php)
std::vector< double > cassetteShift_
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
int32_t tileProperty(const int32_t type, const int32_t sipm)

◆ loadSpecParsTrapezoid() [3/4]

void HGCalGeomParameters::loadSpecParsTrapezoid ( HGCalParameters php)
private

Definition at line 1733 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, HGCalParameters::firstLayer_, dqmdumpme::k, HGCalParameters::layerCenter_, HGCalParameters::layerFrontBH_, HGCalParameters::layerOffset_, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, HGCalParameters::scintCells(), HGCalParameters::scintCellSize(), HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, and HGCalParameters::zRanges_.

1733  {
1734 #ifdef EDM_ML_DEBUG
1735  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters:nCells " << php.nCellsFine_ << ":" << php.nCellsCoarse_
1736  << " cellSize: " << php.cellSize_[0] << ":" << php.cellSize_[1];
1737  for (unsigned int k = 0; k < php.layerFrontBH_.size(); ++k)
1738  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Type[" << k << "] Front Layer = " << php.layerFrontBH_[k]
1739  << " rMin = " << php.rMinLayerBH_[k];
1740  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k) {
1741  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k]
1742  << " Nphi = " << php.scintCells(k + php.firstLayer_)
1743  << " dPhi = " << php.scintCellSize(k + php.firstLayer_);
1744  }
1745 
1746  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
1747  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
1748  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
1749 
1750  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
1751  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
1752  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
1753 
1754  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
1755  << php.zRanges_[2] << ":" << php.zRanges_[3];
1756 
1757  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: LayerOffset " << php.layerOffset_ << " in array of size "
1758  << php.layerCenter_.size();
1759  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
1760  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
1761 #endif
1762 }
Log< level::Info, true > LogVerbatim
std::vector< double > zFrontMin_
std::vector< double > rMinLayerBH_
double scintCellSize(const int layer) const
std::vector< double > cellSize_
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > rMinFront_
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
int scintCells(const int layer) const

◆ loadSpecParsTrapezoid() [4/4]

void HGCalGeomParameters::loadSpecParsTrapezoid ( HGCalParameters php,
const std::vector< int > &  tileIndex,
const std::vector< int > &  tileProperty,
const std::vector< int > &  tileHEX1,
const std::vector< int > &  tileHEX2,
const std::vector< int > &  tileHEX3,
const std::vector< int > &  tileHEX4,
const std::vector< double > &  tileRMin,
const std::vector< double > &  tileRMax,
const std::vector< int > &  tileRingMin,
const std::vector< int > &  tileRingMax 
)
private

Definition at line 1764 of file HGCalGeomParameters.cc.

References TauDecayModes::dec, dqmdumpme::k, HGCalParameters::tileInfoMap_, HGCalProperty::tileProperty(), HGCalParameters::tileRingR_, HGCalParameters::tileRingRange_, HGCalProperty::tileSiPM(), and HGCalProperty::tileType().

1774  {
1775  // tile parameters from Katja's file
1776  for (unsigned int k = 0; k < tileIndx.size(); ++k) {
1779  tileHEX1[k],
1780  tileHEX2[k],
1781  tileHEX3[k],
1782  tileHEX4[k]);
1783 #ifdef EDM_ML_DEBUG
1784  edm::LogVerbatim("HGCalGeom") << "Tile[" << k << ":" << tileIndx[k] << "] "
1785  << " Type " << HGCalProperty::tileType(tileProperty[k]) << " SiPM "
1786  << HGCalProperty::tileSiPM(tileProperty[k]) << " HEX " << std::hex << tileHEX1[k]
1787  << ":" << tileHEX2[k] << ":" << tileHEX3[k] << ":" << tileHEX4[k] << std::dec;
1788 #endif
1789  }
1790 
1791  for (unsigned int k = 0; k < tileRMin.size(); ++k) {
1792  php.tileRingR_.emplace_back(tileRMin[k], tileRMax[k]);
1793 #ifdef EDM_ML_DEBUG
1794  edm::LogVerbatim("HGCalGeom") << "TileRingR[" << k << "] " << tileRMin[k] << ":" << tileRMax[k];
1795 #endif
1796  }
1797 
1798  for (unsigned k = 0; k < tileRingMin.size(); ++k) {
1799  php.tileRingRange_.emplace_back(tileRingMin[k], tileRingMax[k]);
1800 #ifdef EDM_ML_DEBUG
1801  edm::LogVerbatim("HGCalGeom") << "TileRingRange[" << k << "] " << tileRingMin[k] << ":" << tileRingMax[k];
1802 #endif
1803  }
1804 }
Log< level::Info, true > LogVerbatim
int32_t tileType(const int32_t property)
std::vector< std::pair< int, int > > tileRingRange_
int32_t tileSiPM(const int32_t property)
std::vector< std::pair< double, double > > tileRingR_
tileInfo_map tileInfoMap_
int32_t tileProperty(const int32_t type, const int32_t sipm)

◆ loadWaferHexagon()

void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 1806 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, filterCSVwithJSON::copy, TCMET_cfi::corner, PVValHelper::dx, PVValHelper::dy, createfilelist::int, dqmdumpme::k, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, EgHLTOffHistBins_cfi::nr, HGCalParameters::nSectors_, gpuPixelDoublets::ntot, HGCalTypes::packTypeUV(), HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), funct::tan(), HGCalParameters::waferCopy_, HGCalGeomTools::waferCorner(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypes_, HGCalParameters::waferTypeT_, HGCalParameters::waferUVMax_, and LaserClient_cfi::wl.

1806  {
1808  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
1809 #ifdef EDM_ML_DEBUG
1810  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << rmin << " R Limits: " << rin << ":" << rout
1811  << " Fine " << rMaxFine;
1812 #endif
1813  // Clear the vectors
1814  php.waferCopy_.clear();
1815  php.waferTypeL_.clear();
1816  php.waferTypeT_.clear();
1817  php.waferPosX_.clear();
1818  php.waferPosY_.clear();
1819  double dx = 0.5 * waferW;
1820  double dy = 3.0 * dx * tan(30._deg);
1821  double rr = 2.0 * dx * tan(30._deg);
1822  int ncol = (int)(2.0 * rout / waferW) + 1;
1823  int nrow = (int)(rout / (waferW * tan(30._deg))) + 1;
1824  int ns2 = (2 * ncol + 1) * (2 * nrow + 1) * php.layer_.size();
1825  int incm(0), inrm(0), kount(0), ntot(0);
1826  HGCalParameters::layer_map copiesInLayers(php.layer_.size() + 1);
1827  HGCalParameters::waferT_map waferTypes(ns2 + 1);
1828 #ifdef EDM_ML_DEBUG
1829  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
1830 #endif
1831  for (int nr = -nrow; nr <= nrow; ++nr) {
1832  int inr = (nr >= 0) ? nr : -nr;
1833  for (int nc = -ncol; nc <= ncol; ++nc) {
1834  int inc = (nc >= 0) ? nc : -nc;
1835  if (inr % 2 == inc % 2) {
1836  double xpos = nc * dx;
1837  double ypos = nr * dy;
1838  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
1839  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
1840  int typet = (rpos < rMaxFine) ? 1 : 2;
1841  int typel(3);
1842  for (int k = 1; k < 4; ++k) {
1843  if ((rpos + rmin) <= php.boundR_[k]) {
1844  typel = k;
1845  break;
1846  }
1847  }
1848  ++ntot;
1849  if (corner.first > 0) {
1850  int copy = HGCalTypes::packTypeUV(typel, nc, nr);
1851  if (inc > incm)
1852  incm = inc;
1853  if (inr > inrm)
1854  inrm = inr;
1855  kount++;
1856 #ifdef EDM_ML_DEBUG
1857  edm::LogVerbatim("HGCalGeom") << kount << ":" << ntot << " Copy " << copy << " Type " << typel << ":" << typet
1858  << " Location " << corner.first << " Position " << xpos << ":" << ypos
1859  << " Layers " << php.layer_.size();
1860 #endif
1861  php.waferCopy_.emplace_back(copy);
1862  php.waferTypeL_.emplace_back(typel);
1863  php.waferTypeT_.emplace_back(typet);
1864  php.waferPosX_.emplace_back(xpos);
1865  php.waferPosY_.emplace_back(ypos);
1866  for (unsigned int il = 0; il < php.layer_.size(); ++il) {
1867  std::pair<int, int> corner =
1868  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, php.rMinLayHex_[il], php.rMaxLayHex_[il], true);
1869  if (corner.first > 0) {
1870  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
1871  if (cpy == copiesInLayers[php.layer_[il]].end())
1872  copiesInLayers[php.layer_[il]][copy] =
1873  ((corner.first == (int)(HGCalParameters::k_CornerSize)) ? php.waferCopy_.size() : -1);
1874  }
1875  if ((corner.first > 0) && (corner.first < (int)(HGCalParameters::k_CornerSize))) {
1876  int wl = HGCalWaferIndex::waferIndex(php.layer_[il], copy, 0, true);
1877  waferTypes[wl] = corner;
1878  }
1879  }
1880  }
1881  }
1882  }
1883  }
1884  php.copiesInLayers_ = copiesInLayers;
1885  php.waferTypes_ = waferTypes;
1886  php.nSectors_ = (int)(php.waferCopy_.size());
1887  php.waferUVMax_ = 0;
1888 #ifdef EDM_ML_DEBUG
1889  edm::LogVerbatim("HGCalGeom") << "HGCalWaferHexagon: # of columns " << incm << " # of rows " << inrm << " and "
1890  << kount << ":" << ntot << " wafers; R " << rin << ":" << rout;
1891  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
1892  for (unsigned int k = 0; k < copiesInLayers.size(); ++k) {
1893  const auto& theModules = copiesInLayers[k];
1894  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
1895  int k2(0);
1896  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
1897  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
1898  }
1899  }
1900 #endif
1901 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
layer_map copiesInLayers_
static constexpr uint32_t k_CornerSize
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
std::vector< double > boundR_
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > rMinLayHex_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
std::vector< double > rMaxLayHex_
std::unordered_map< int32_t, std::pair< int32_t, int32_t > > waferT_map
static constexpr double k_ScaleFromDDD
std::vector< int > waferCopy_
static int32_t packTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:3
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
__shared__ uint32_t ntot
std::vector< std::unordered_map< int32_t, int32_t > > layer_map

◆ loadWaferHexagon8()

void HGCalGeomParameters::loadWaferHexagon8 ( HGCalParameters php)

Definition at line 1903 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, filterCSVwithJSON::copy, TCMET_cfi::corner, TauDecayModes::dec, HGCalParameters::defineFull_, PVValHelper::dy, HGCalParameters::hgtrap::dz, PVValHelper::dz, HGCalParameters::fillModule(), HGCalParameters::fracAreaMin_, geomTools_, HGCalParameters::getModule(), HGCalWaferMask::getTypeMode(), HGCalWaferMask::goodTypeMode(), HGCalParameters::hgtrap::h, HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Module, mps_fire::i, triggerObjects_cff::id, createfilelist::int, dqmdumpme::k, HGCalParameters::k_CornerSize, HGCalWaferMask::k_OffsetRotation, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerCenter_, HGCalParameters::layerIndex_, HGCalParameters::layerOffset_, SiStripPI::max, HGCalParameters::mode_, N, HGCalParameters::nCornerCut_, EgHLTOffHistBins_cfi::nr, HGCalParameters::nSectors_, convertSQLiteXML::ok, hgcalPerformanceValidation::orient, dttmaxenums::R, alignCSCRings::r, diffTwoXMLs::r1, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::sensorSeparation_, HGCalGeomTools::shiftXY(), sqrt3_, HGCalParameters::hgtrap::tl, HGCalParameters::typesInLayers_, findQualityFiles::v, HGCalParameters::waferCopy_, HGCalGeomTools::waferCorner(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalWaferIndex::waferLayer(), HGCalParameters::waferMaskMode_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, HGCalParameters::wafersInLayers_, HGCalParameters::waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypes_, HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), HGCalParameters::waferUVMax_, HGCalParameters::waferUVMaxLayer_, HGCalWaferIndex::waferV(), LaserClient_cfi::wl, HGCalParameters::xLayerHex_, HGCalParameters::yLayerHex_, HGCalParameters::zLayerHex_, and HGCalParameters::zMinForRad_.

1903  {
1904  double waferW(php.waferSize_);
1905  double waferS(php.sensorSeparation_);
1906  auto wType = std::make_unique<HGCalWaferType>(php.radius100to200_,
1907  php.radius200to300_,
1908  HGCalParameters::k_ScaleToDDD * (waferW + waferS),
1910  php.choiceType_,
1911  php.nCornerCut_,
1912  php.fracAreaMin_);
1913 
1914  double rout(php.rLimit_[1]);
1915 #ifdef EDM_ML_DEBUG
1916  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << waferS << " R Max: " << rout;
1917 #endif
1918  // Clear the vectors
1919  php.waferCopy_.clear();
1920  php.waferTypeL_.clear();
1921  php.waferTypeT_.clear();
1922  php.waferPosX_.clear();
1923  php.waferPosY_.clear();
1924  double r = 0.5 * (waferW + waferS);
1925  double R = 2.0 * r / sqrt3_;
1926  double dy = 0.75 * R;
1927  double r1 = 0.5 * waferW;
1928  double R1 = 2.0 * r1 / sqrt3_;
1929  int N = (r == 0) ? 3 : ((int)(0.5 * rout / r) + 3);
1930  int ns1 = (2 * N + 1) * (2 * N + 1);
1931  int ns2 = ns1 * php.zLayerHex_.size();
1932 #ifdef EDM_ML_DEBUG
1933  edm::LogVerbatim("HGCalGeom") << "wafer " << waferW << ":" << waferS << " r " << r << " dy " << dy << " N " << N
1934  << " sizes " << ns1 << ":" << ns2;
1935  std::vector<int> indtypes(ns1 + 1);
1936  indtypes.clear();
1937 #endif
1938  HGCalParameters::wafer_map wafersInLayers(ns1 + 1);
1939  HGCalParameters::wafer_map typesInLayers(ns2 + 1);
1940  HGCalParameters::waferT_map waferTypes(ns2 + 1);
1941  int ipos(0), lpos(0), uvmax(0), nwarn(0);
1942  std::vector<int> uvmx(php.zLayerHex_.size(), 0);
1943  for (int v = -N; v <= N; ++v) {
1944  for (int u = -N; u <= N; ++u) {
1945  int nr = 2 * v;
1946  int nc = -2 * u + v;
1947  double xpos = nc * r;
1948  double ypos = nr * dy;
1949  int indx = HGCalWaferIndex::waferIndex(0, u, v);
1950  php.waferCopy_.emplace_back(indx);
1951  php.waferPosX_.emplace_back(xpos);
1952  php.waferPosY_.emplace_back(ypos);
1953  wafersInLayers[indx] = ipos;
1954  ++ipos;
1955  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, r1, R1, 0, rout, false);
1956  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) || ((corner.first > 0) && php.defineFull_)) {
1957  uvmax = std::max(uvmax, std::max(std::abs(u), std::abs(v)));
1958  }
1959  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
1960  int copy = i + php.layerOffset_;
1961  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], (waferW + waferS));
1962  int lay = php.layer_[php.layerIndex_[i]];
1963  double xpos0 = xpos + xyoff.first;
1964  double ypos0 = ypos + xyoff.second;
1965  double zpos = php.zLayerHex_[i];
1966  int kndx = HGCalWaferIndex::waferIndex(lay, u, v);
1967  int type(-1);
1969  type = wType->getType(kndx, php.waferInfoMap_);
1970  if (type < 0)
1971  type = wType->getType(HGCalParameters::k_ScaleToDDD * xpos0,
1974  php.waferTypeL_.emplace_back(type);
1975  typesInLayers[kndx] = lpos;
1976  ++lpos;
1977 #ifdef EDM_ML_DEBUG
1978  indtypes.emplace_back(kndx);
1979 #endif
1980  std::pair<int, int> corner =
1981  HGCalGeomTools::waferCorner(xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], false);
1982 #ifdef EDM_ML_DEBUG
1983  if (((corner.first == 0) && std::abs(u) < 5 && std::abs(v) < 5) || (std::abs(u) < 2 && std::abs(v) < 2)) {
1984  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " R " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
1985  << " u " << u << " v " << v << " with " << corner.first << " corners";
1986  }
1987 #endif
1988  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) || ((corner.first > 0) && php.defineFull_)) {
1989  uvmx[i] = std::max(uvmx[i], std::max(std::abs(u), std::abs(v)));
1990  }
1991  if ((corner.first < (int)(HGCalParameters::k_CornerSize)) && (corner.first > 0)) {
1992 #ifdef EDM_ML_DEBUG
1993  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u << ":" << v << " with corner "
1994  << corner.first << ":" << corner.second;
1995 #endif
1996  int wl = HGCalWaferIndex::waferIndex(lay, u, v);
1997  if (php.waferMaskMode_ > 0) {
1998  std::pair<int, int> corner0 = HGCalWaferMask::getTypeMode(
1999  xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], type, php.waferMaskMode_);
2001  auto itr = php.waferInfoMap_.find(wl);
2002  if (itr != php.waferInfoMap_.end()) {
2003  int part = (itr->second).part;
2004  int orient = (itr->second).orient;
2006  xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], part, orient, false);
2007  if (ok)
2008  corner0 = std::make_pair(part, (HGCalWaferMask::k_OffsetRotation + orient));
2009 #ifdef EDM_ML_DEBUG
2010  edm::LogVerbatim("HGCalGeom")
2011  << "Layer:u:v " << i << ":" << lay << ":" << u << ":" << v << " Part " << corner0.first << ":"
2012  << part << " Orient " << corner0.second << ":" << orient << " Position " << xpos0 << ":" << ypos0
2013  << " delta " << r1 << ":" << R1 << " Limit " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
2014  << " Compatibiliety Flag " << ok;
2015 #endif
2016  if (!ok)
2017  ++nwarn;
2018  }
2019  }
2020  waferTypes[wl] = corner0;
2021 #ifdef EDM_ML_DEBUG
2022  edm::LogVerbatim("HGCalGeom")
2023  << "Layer " << lay << " u|v " << u << ":" << v << " Index " << std::hex << wl << std::dec << " pos "
2024  << xpos0 << ":" << ypos0 << " R " << r1 << ":" << R1 << " Range " << php.rMinLayHex_[i] << ":"
2025  << php.rMaxLayHex_[i] << type << ":" << php.waferMaskMode_ << " corner " << corner.first << ":"
2026  << corner.second << " croner0 " << corner0.first << ":" << corner0.second;
2027 #endif
2028  } else {
2029  waferTypes[wl] = corner;
2030 #ifdef EDM_ML_DEBUG
2031  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u << ":" << v << " with corner "
2032  << corner.first << ":" << corner.second;
2033 #endif
2034  }
2035  }
2036  }
2037  }
2038  }
2039  if (nwarn > 0)
2040  edm::LogWarning("HGCalGeom") << "HGCalGeomParameters::loadWafer8: there are " << nwarn
2041  << " wafers with non-matching partial- orientation types";
2042  php.waferUVMax_ = uvmax;
2043  php.waferUVMaxLayer_ = uvmx;
2044  php.wafersInLayers_ = wafersInLayers;
2045  php.typesInLayers_ = typesInLayers;
2046  php.waferTypes_ = waferTypes;
2047  php.nSectors_ = (int)(php.waferCopy_.size());
2049  mytr.lay = 1;
2050  mytr.bl = php.waferR_;
2051  mytr.tl = php.waferR_;
2052  mytr.h = php.waferR_;
2053  mytr.alpha = 0.0;
2055  for (auto const& dz : php.cellThickness_) {
2056  mytr.dz = 0.5 * HGCalParameters::k_ScaleToDDD * dz;
2057  php.fillModule(mytr, false);
2058  }
2059  for (unsigned k = 0; k < php.cellThickness_.size(); ++k) {
2060  HGCalParameters::hgtrap mytr = php.getModule(k, false);
2066  php.fillModule(mytr, true);
2067  }
2068 #ifdef EDM_ML_DEBUG
2069  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Total of " << php.waferCopy_.size() << " wafers";
2070  for (unsigned int k = 0; k < php.waferCopy_.size(); ++k) {
2071  int id = php.waferCopy_[k];
2072  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << std::hex << id << std::dec << ":"
2073  << HGCalWaferIndex::waferLayer(id) << ":" << HGCalWaferIndex::waferU(id) << ":"
2074  << HGCalWaferIndex::waferV(id) << " x " << php.waferPosX_[k] << " y "
2075  << php.waferPosY_[k] << " index " << php.wafersInLayers_[id];
2076  }
2077  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Total of " << php.waferTypeL_.size() << " wafer types";
2078  for (unsigned int k = 0; k < php.waferTypeL_.size(); ++k) {
2079  int id = indtypes[k];
2080  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.typesInLayers_[id] << ":" << php.waferTypeL_[k] << " ID "
2081  << std::hex << id << std::dec << ":" << HGCalWaferIndex::waferLayer(id) << ":"
2082  << HGCalWaferIndex::waferU(id) << ":" << HGCalWaferIndex::waferV(id);
2083  }
2084 #endif
2085 
2086  //Wafer offset
2087  php.xLayerHex_.clear();
2088  php.yLayerHex_.clear();
2089  double waferSize = php.waferSize_ + php.sensorSeparation_;
2090 #ifdef EDM_ML_DEBUG
2091  edm::LogVerbatim("HGCalGeom") << "WaferSize " << waferSize;
2092 #endif
2093  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2094  int copy = k + php.layerOffset_;
2095  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], waferSize);
2096  php.xLayerHex_.emplace_back(xyoff.first);
2097  php.yLayerHex_.emplace_back(xyoff.second);
2098 #ifdef EDM_ML_DEBUG
2099  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Off " << copy << ":" << php.layerCenter_[copy] << " Shift "
2100  << xyoff.first << ":" << xyoff.second;
2101 #endif
2102  }
2103 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
hgtrap getModule(unsigned int k, bool reco) const
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
HGCalGeometryMode::GeometryMode mode_
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
static constexpr uint32_t k_CornerSize
static bool goodTypeMode(double xpos, double ypos, double delX, double delY, double rin, double rout, int part, int rotn, bool debug=false)
wafer_map wafersInLayers_
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
std::vector< int > waferUVMaxLayer_
std::vector< int > layerIndex_
std::vector< double > yLayerHex_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > layerCenter_
std::vector< double > rMinLayHex_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > zLayerHex_
waferT_map waferTypes_
std::vector< double > rMaxLayHex_
std::unordered_map< int32_t, std::pair< int32_t, int32_t > > waferT_map
static constexpr double k_ScaleToDDD
#define N
Definition: blowfish.cc:9
std::vector< double > cellThickness_
std::unordered_map< int32_t, int32_t > wafer_map
part
Definition: HCALResponse.h:20
static std::pair< int, int > getTypeMode(const double &xpos, const double &ypos, const double &delX, const double &delY, const double &rin, const double &rout, const int &waferType, const int &mode, bool debug=false)
std::vector< double > radius200to300_
std::vector< double > radius100to200_
wafer_map typesInLayers_
static constexpr double k_ScaleFromDDD
static constexpr int k_OffsetRotation
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
std::vector< double > rLimit_
std::vector< int > waferTypeT_
Log< level::Warning, false > LogWarning
waferInfo_map waferInfoMap_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
std::vector< double > xLayerHex_

◆ rescale()

void HGCalGeomParameters::rescale ( std::vector< double > &  v,
const double  s 
)
private

Definition at line 2366 of file HGCalGeomParameters.cc.

References dqmiodumpmetadata::n, alignCSCRings::s, and findQualityFiles::v.

Referenced by loadSpecParsHexagon(), loadSpecParsHexagon8(), and loadSpecParsTrapezoid().

2366  {
2367  std::for_each(v.begin(), v.end(), [s](double& n) { n *= s; });
2368 }

◆ resetZero()

void HGCalGeomParameters::resetZero ( std::vector< double > &  v)
private

Definition at line 2370 of file HGCalGeomParameters.cc.

References funct::abs(), dqmiodumpmetadata::n, tolmin, and findQualityFiles::v.

2370  {
2371  for (auto& n : v) {
2372  if (std::abs(n) < tolmin)
2373  n = 0;
2374  }
2375 }
const double tolmin
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ geomTools_

HGCalGeomTools HGCalGeomParameters::geomTools_
private

Definition at line 153 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

◆ scintillatorCassette

constexpr int HGCalGeomParameters::scintillatorCassette = 7
static

◆ scintillatorFile

constexpr int HGCalGeomParameters::scintillatorFile = 4
static

Definition at line 104 of file HGCalGeomParameters.h.

Referenced by loadSpecParsTrapezoid(), and HGCalDDDConstants::numberCells().

◆ siliconCassetteEE

constexpr int HGCalGeomParameters::siliconCassetteEE = 5
static

Definition at line 105 of file HGCalGeomParameters.h.

Referenced by HGCalParametersFromDD::build(), and loadSpecParsHexagon8().

◆ siliconCassetteHE

constexpr int HGCalGeomParameters::siliconCassetteHE = 6
static

Definition at line 106 of file HGCalGeomParameters.h.

Referenced by HGCalParametersFromDD::build(), and loadSpecParsHexagon8().

◆ siliconFileEE

constexpr int HGCalGeomParameters::siliconFileEE = 2
static

Definition at line 102 of file HGCalGeomParameters.h.

Referenced by loadSpecParsHexagon8().

◆ siliconFileHE

constexpr int HGCalGeomParameters::siliconFileHE = 3
static

Definition at line 103 of file HGCalGeomParameters.h.

Referenced by loadSpecParsHexagon8().

◆ sqrt3_

const double HGCalGeomParameters::sqrt3_
private

Definition at line 154 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

◆ tan30deg_

constexpr double HGCalGeomParameters::tan30deg_ = 0.5773502693
staticprivate

Definition at line 152 of file HGCalGeomParameters.h.

Referenced by loadGeometryHexagon().

◆ waferSize_

double HGCalGeomParameters::waferSize_
private