CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 scintillatorFile = 4
 
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 ( )

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 ( )

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

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 2292 of file HGCalGeomParameters.cc.

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

Referenced by loadGeometryHexagon().

2297  {
2298  if (itrf == wafers.end()) {
2299  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin(); itr != wafers.end();
2300  ++itr) {
2301  if (itr->wafer == wafer) {
2302  itrf = itr;
2303  break;
2304  }
2305  }
2306  }
2307  double dx(0), dy(0);
2308  if (itrf != wafers.end()) {
2309  dx = (xx - itrf->xyz.x());
2310  if (std::abs(dx) < tolerance)
2311  dx = 0;
2312  dy = (yy - itrf->xyz.y());
2313  if (std::abs(dy) < tolerance)
2314  dy = 0;
2315  }
2316  return std::make_pair(dx, dy);
2317 }
const double tolerance
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > HGCalGeomParameters::getDDDArray ( const std::string &  str,
const DDsvalues_type sv,
const int  nmin 
)
private

Definition at line 2265 of file HGCalGeomParameters.cc.

References DDfetch(), DDValue::doubles(), Exception, str, and relativeConstraints::value.

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

2265  {
2266  DDValue value(str);
2267  if (DDfetch(&sv, value)) {
2268  const std::vector<double>& fvec = value.doubles();
2269  int nval = fvec.size();
2270  if (nmin > 0) {
2271  if (nval < nmin) {
2272  throw cms::Exception("DDException")
2273  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < " << nmin << " ==> illegal";
2274  }
2275  } else {
2276  if (nval < 1 && nmin == 0) {
2277  throw cms::Exception("DDException")
2278  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < 1 ==> illegal"
2279  << " (nmin=" << nmin << ")";
2280  }
2281  }
2282  return fvec;
2283  } else {
2284  if (nmin >= 0) {
2285  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
2286  }
2287  std::vector<double> fvec;
2288  return fvec;
2289  }
2290 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
Quality *__restrict__ uint16_t nmin
#define str(s)
void HGCalGeomParameters::loadCellParsHexagon ( const DDCompactView cpv,
HGCalParameters php 
)

Definition at line 2058 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().

2058  {
2059  // Special parameters for cell parameters
2060  std::string attribute = "OnlyForHGCalNumbering";
2061  DDSpecificsHasNamedValueFilter filter1{attribute};
2062  DDFilteredView fv1(*cpv, filter1);
2063  bool ok = fv1.firstChild();
2064 
2065  if (ok) {
2066  php.cellFine_ = dbl_to_int(cpv->vector("waferFine"));
2067  php.cellCoarse_ = dbl_to_int(cpv->vector("waferCoarse"));
2068  }
2069 
2070  loadCellParsHexagon(php);
2071 }
std::vector< int > cellFine_
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
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
void HGCalGeomParameters::loadCellParsHexagon ( const cms::DDVectorsMap vmap,
HGCalParameters php 
)

Definition at line 2073 of file HGCalGeomParameters.cc.

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

2073  {
2074  for (auto const& it : vmap) {
2075  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferFine")) {
2076  for (const auto& i : it.second)
2077  php.cellFine_.emplace_back(std::round(i));
2078  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferCoarse")) {
2079  for (const auto& i : it.second)
2080  php.cellCoarse_.emplace_back(std::round(i));
2081  }
2082  }
2083 
2084  loadCellParsHexagon(php);
2085 }
std::vector< int > cellFine_
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)
void HGCalGeomParameters::loadCellParsHexagon ( const HGCalParameters php)

Definition at line 2087 of file HGCalGeomParameters.cc.

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

2087  {
2088 #ifdef EDM_ML_DEBUG
2089  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellFine_.size() << " rows for fine cells";
2090  for (unsigned int k = 0; k < php.cellFine_.size(); ++k)
2091  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
2092  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellCoarse_.size() << " rows for coarse cells";
2093  for (unsigned int k = 0; k < php.cellCoarse_.size(); ++k)
2094  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
2095 #endif
2096 }
Log< level::Info, true > LogVerbatim
std::vector< int > cellFine_
std::vector< int > cellCoarse_
void HGCalGeomParameters::loadCellTrapezoid ( HGCalParameters php)

Definition at line 2098 of file HGCalGeomParameters.cc.

References HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, HGCalParameters::hgtrap::dz, PVValHelper::eta, funct::exp(), HGCalParameters::fillModule(), HGCalParameters::firstLayer_, HGCalParameters::firstModule_, HGCalParameters::hgtrap::h, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, isotrackApplyRegressor::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, GetRecoTauVFromDQM_MC_cff::kk, HGCalParameters::lastModule_, HGCalParameters::hgtrap::lay, HGCalParameters::layerFrontBH_, log, cuda_std::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.

2098  {
2099  php.xLayerHex_.resize(php.zLayerHex_.size(), 0);
2100  php.yLayerHex_.resize(php.zLayerHex_.size(), 0);
2101 #ifdef EDM_ML_DEBUG
2102  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: x|y|zLayerHex in array of size " << php.zLayerHex_.size();
2103  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k)
2104  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Shift " << php.xLayerHex_[k] << ":" << php.yLayerHex_[k] << ":"
2105  << php.zLayerHex_[k];
2106 #endif
2107  // Find the radius of each eta-partitions
2108 
2110  //Ring radii for each partition
2111  for (unsigned int k = 0; k < 2; ++k) {
2112  for (unsigned int kk = 0; kk < php.tileRingR_.size(); ++kk) {
2113  php.radiusLayer_[k].emplace_back(php.tileRingR_[kk].first);
2114 #ifdef EDM_ML_DEBUG
2115  double zv = ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
2116  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
2117  double rv = php.radiusLayer_[k].back();
2118  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
2119  edm::LogVerbatim("HGCalGeom") << "New [" << kk << "] new R = " << rv << " Eta = " << eta;
2120 #endif
2121  }
2122  php.radiusLayer_[k].emplace_back(php.tileRingR_[php.tileRingR_.size() - 1].second);
2123  }
2124  // Minimum and maximum radius index for each layer
2125  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2126  php.iradMinBH_.emplace_back(1 + php.tileRingRange_[k].first);
2127  php.iradMaxBH_.emplace_back(1 + php.tileRingRange_[k].second);
2128 #ifdef EDM_ML_DEBUG
2129  int kk = php.scintType(php.firstLayer_ + (int)(k));
2130  edm::LogVerbatim("HGCalGeom") << "New Layer " << k << " Type " << kk << " Low edge " << php.iradMinBH_.back()
2131  << " Top edge " << php.iradMaxBH_.back();
2132 #endif
2133  }
2134  } else {
2135  //Ring radii for each partition
2136  for (unsigned int k = 0; k < 2; ++k) {
2137  double rmax = ((k == 0) ? (php.rMaxLayHex_[php.layerFrontBH_[1] - php.firstLayer_] - 1)
2138  : (php.rMaxLayHex_[php.rMaxLayHex_.size() - 1]));
2139  double rv = php.rMinLayerBH_[k];
2140  double zv = ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
2141  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
2142  php.radiusLayer_[k].emplace_back(rv);
2143 #ifdef EDM_ML_DEBUG
2144  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
2145  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] rmax " << rmax << " Z = " << zv
2146  << " dEta = " << php.cellSize_[k] << "\nOld[0] new R = " << rv << " Eta = " << eta;
2147  int kount(1);
2148 #endif
2149  while (rv < rmax) {
2150  double eta = -(php.cellSize_[k] + std::log(std::tan(0.5 * std::atan(rv / zv))));
2151  rv = zv * std::tan(2.0 * std::atan(std::exp(-eta)));
2152  php.radiusLayer_[k].emplace_back(rv);
2153 #ifdef EDM_ML_DEBUG
2154  edm::LogVerbatim("HGCalGeom") << "Old [" << kount << "] new R = " << rv << " Eta = " << eta;
2155  ++kount;
2156 #endif
2157  }
2158  }
2159  // Find minimum and maximum radius index for each layer
2160  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2161  int kk = php.scintType(php.firstLayer_ + (int)(k));
2162  std::vector<double>::iterator low, high;
2163  low = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMinLayHex_[k]);
2164 #ifdef EDM_ML_DEBUG
2165  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] RLow = " << php.rMinLayHex_[k] << " pos "
2166  << (int)(low - php.radiusLayer_[kk].begin());
2167 #endif
2168  if (low == php.radiusLayer_[kk].begin())
2169  ++low;
2170  int irlow = (int)(low - php.radiusLayer_[kk].begin());
2171  double drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
2172 #ifdef EDM_ML_DEBUG
2173  edm::LogVerbatim("HGCalGeom") << "irlow " << irlow << " dr " << drlow << " min " << php.minTileSize_;
2174 #endif
2175  if (drlow < php.minTileSize_) {
2176  ++irlow;
2177 #ifdef EDM_ML_DEBUG
2178  drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
2179  edm::LogVerbatim("HGCalGeom") << "Modified irlow " << irlow << " dr " << drlow;
2180 #endif
2181  }
2182  high = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMaxLayHex_[k]);
2183 #ifdef EDM_ML_DEBUG
2184  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] RHigh = " << php.rMaxLayHex_[k] << " pos "
2185  << (int)(high - php.radiusLayer_[kk].begin());
2186 #endif
2187  if (high == php.radiusLayer_[kk].end())
2188  --high;
2189  int irhigh = (int)(high - php.radiusLayer_[kk].begin());
2190  double drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
2191 #ifdef EDM_ML_DEBUG
2192  edm::LogVerbatim("HGCalGeom") << "irhigh " << irhigh << " dr " << drhigh << " min " << php.minTileSize_;
2193 #endif
2194  if (drhigh < php.minTileSize_) {
2195  --irhigh;
2196 #ifdef EDM_ML_DEBUG
2197  drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
2198  edm::LogVerbatim("HGCalGeom") << "Modified irhigh " << irhigh << " dr " << drhigh;
2199 #endif
2200  }
2201  php.iradMinBH_.emplace_back(irlow);
2202  php.iradMaxBH_.emplace_back(irhigh);
2203 #ifdef EDM_ML_DEBUG
2204  edm::LogVerbatim("HGCalGeom") << "Old Layer " << k << " Type " << kk << " Low edge " << irlow << ":" << drlow
2205  << " Top edge " << irhigh << ":" << drhigh;
2206 #endif
2207  }
2208  }
2209 #ifdef EDM_ML_DEBUG
2210  for (unsigned int k = 0; k < 2; ++k) {
2211  edm::LogVerbatim("HGCalGeom") << "Type " << k << " with " << php.radiusLayer_[k].size() << " radii";
2212  for (unsigned int kk = 0; kk < php.radiusLayer_[k].size(); ++kk)
2213  edm::LogVerbatim("HGCalGeom") << "Ring[" << kk << "] " << php.radiusLayer_[k][kk];
2214  }
2215 #endif
2216 
2217  // Now define the volumes
2218  int im(0);
2219  php.waferUVMax_ = 0;
2221  mytr.alpha = 0.0;
2222  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2223  if (php.iradMaxBH_[k] > php.waferUVMax_)
2224  php.waferUVMax_ = php.iradMaxBH_[k];
2225  int kk = ((php.firstLayer_ + (int)(k)) < php.layerFrontBH_[1]) ? 0 : 1;
2226  int irm = php.radiusLayer_[kk].size() - 1;
2227 #ifdef EDM_ML_DEBUG
2228  double rmin = php.radiusLayer_[kk][std::max((php.iradMinBH_[k] - 1), 0)];
2229  double rmax = php.radiusLayer_[kk][std::min(php.iradMaxBH_[k], irm)];
2230  edm::LogVerbatim("HGCalGeom") << "Layer " << php.firstLayer_ + k << ":" << kk << " Radius range "
2231  << php.iradMinBH_[k] << ":" << php.iradMaxBH_[k] << ":" << rmin << ":" << rmax;
2232 #endif
2233  mytr.lay = php.firstLayer_ + k;
2234  for (int irad = php.iradMinBH_[k]; irad <= php.iradMaxBH_[k]; ++irad) {
2235  double rmin = php.radiusLayer_[kk][std::max((irad - 1), 0)];
2236  double rmax = php.radiusLayer_[kk][std::min(irad, irm)];
2237  mytr.bl = 0.5 * rmin * php.scintCellSize(mytr.lay);
2238  mytr.tl = 0.5 * rmax * php.scintCellSize(mytr.lay);
2239  mytr.h = 0.5 * (rmax - rmin);
2240  mytr.dz = 0.5 * php.waferThick_;
2241  mytr.cellSize = 0.5 * (rmax + rmin) * php.scintCellSize(mytr.lay);
2242  php.fillModule(mytr, true);
2248  php.fillModule(mytr, false);
2249  if (irad == php.iradMinBH_[k])
2250  php.firstModule_.emplace_back(im);
2251  ++im;
2252  if (irad == php.iradMaxBH_[k] - 1)
2253  php.lastModule_.emplace_back(im);
2254  }
2255  }
2256  php.nSectors_ = php.waferUVMax_;
2257 #ifdef EDM_ML_DEBUG
2258  edm::LogVerbatim("HGCalGeom") << "Maximum radius index " << php.waferUVMax_;
2259  for (unsigned int k = 0; k < php.firstModule_.size(); ++k)
2260  edm::LogVerbatim("HGCalGeom") << "Layer " << k + php.firstLayer_ << " Modules " << php.firstModule_[k] << ":"
2261  << php.lastModule_[k];
2262 #endif
2263 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
static std::vector< std::string > checklist log
int scintType(const int layer) const
float *__restrict__ zv
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
HGCalGeometryMode::GeometryMode mode_
double scintCellSize(const int layer) const
std::vector< double > rMinLayerBH_
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
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
std::vector< int > layerFrontBH_
std::vector< double > radiusLayer_[2]
std::vector< std::pair< double, double > > tileRingR_
std::vector< double > xLayerHex_
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, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleFromDDDToG4, HGCalParameters::hgtrap::lay, HGCalParameters::hgtrform::lay, phase1PixelTopology::layer, HGCalParameters::layer_, LayerTriplets::layers(), DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), mergeVDriftHistosByStation::name, names, DDFilteredView::next(), convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, fireworks::p1, fireworks::p2, HGCalGeometryMode::Polyhedra, DDTubs::rIn(), DDPolyhedra::rMaxVec(), DDPolyhedra::rMinVec(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::hgtrform::sec, DDSolid::shape(), 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(), y, z, HGCalParameters::hgtrform::zp, gpuVertexFinder::zv, DDPolyhedra::zVec(), and DDExtrudedPolygon::zVec().

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);
75  double zz = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
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);
94  double xx = HGCalParameters::k_ScaleFromDDD * fv.translation().X();
95  if (std::abs(xx) < tolerance)
96  xx = 0;
97  double yy = HGCalParameters::k_ScaleFromDDD * fv.translation().Y();
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);
244  xx += (HGCalParameters::k_ScaleFromDDD * (p2.X()));
245  yy += (HGCalParameters::k_ScaleFromDDD * (p2.Y()));
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  }
255  HGCalGeomParameters::cellParameters cp(half, wafer, GlobalPoint(xx, yy, 0));
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_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const N & name() const
Definition: DDBase.h:59
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:342
const TString p2
Definition: fwPaths.cc:13
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
static int32_t getUnpackedCell6(int id)
Definition: HGCalTypes.cc:40
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
float *__restrict__ zv
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
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
static int32_t getUnpackedCellType6(int id)
Definition: HGCalTypes.cc:38
std::vector< double > xVec(void) const
Definition: DDSolid.cc:378
std::vector< double > cellSize_
bool next()
set current node to the next node in the filtered tree
const TString p1
Definition: fwPaths.cc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:335
double rOut(void) const
Definition: DDSolid.cc:458
static constexpr double tan30deg_
std::vector< double > zVec(void) const
Definition: DDSolid.cc:387
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
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
static constexpr double k_ScaleFromDDDToG4
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)
const DDTranslation & translation() const
The absolute translation of the current node.
Log< level::Warning, false > LogWarning
double rIn(void) const
Definition: DDSolid.cc:456
CLHEP::HepRotation hr
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
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(), alcazmumu_cfi::filter, spr::find(), cms::DDFilteredView::firstChild(), HGCalTypes::getUnpackedCell6(), HGCalTypes::getUnpackedCellType6(), HGCalParameters::hgtrap::h, HGCalParameters::hgtrform::h3v, HGCalParameters::hgtrform::hr, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleFromDD4hepToG4, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrap::lay, HGCalParameters::hgtrform::lay, phase1PixelTopology::layer, HGCalParameters::layer_, LayerTriplets::layers(), loadGeometryHexagon(), mergeVDriftHistosByStation::name, cms::DDFilteredView::name(), names, convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, fireworks::p1, fireworks::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, y, z, HGCalParameters::hgtrform::zp, and gpuVertexFinder::zv.

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);
466  xx += (HGCalParameters::k_ScaleFromDDD * (p2.X()));
467  yy += (HGCalParameters::k_ScaleFromDDD * (p2.Y()));
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  }
477  HGCalGeomParameters::cellParameters cp(half, wafer, GlobalPoint(xx, yy, 0));
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_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const TString p2
Definition: fwPaths.cc:13
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
std::vector< double > cellSize_
const TString p1
Definition: fwPaths.cc:12
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
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, HLT_FULL_cff::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, isotrackApplyRegressor::k, relval_steps::k2, HGCalParameters::k_ScaleFromDDD, phase1PixelTopology::layer, HGCalParameters::layer_, HGCalParameters::layerGroup_, HGCalParameters::layerIndex_, 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_, xy(), 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_
std::vector< double > moduleHR_
layer_map copiesInLayers_
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
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_
hgtrap getModule(unsigned int k, bool reco) const
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_
Basic2DVector< T > xy() const
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_
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(), HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, LayerTriplets::layers(), HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::logicalPart(), SiStripPI::max, SiStripPI::min, DDBase< N, C >::name(), DDFilteredView::next(), gpuPixelDoublets::ntot, DDTubs::rIn(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), DDSolid::shape(), mkfit::Const::sol, DDLogicalPart::solid(), tolerance, DDFilteredView::translation(), x, y, 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_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const N & name() const
Definition: DDBase.h:59
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
int zside(DetId const &)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
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
bool next()
set current node to the next node in the filtered tree
if(conf_.getParameter< bool >("UseStripCablingDB"))
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
double rOut(void) const
Definition: DDSolid.cc:458
constexpr float sol
Definition: Config.h:48
static constexpr double k_ScaleFromDDD
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< int > levelT_
double rIn(void) const
Definition: DDSolid.cc:456
__shared__ uint32_t ntot
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)
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, alcazmumu_cfi::filter, spr::find(), cms::DDFilteredView::firstChild(), if(), HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::layer_, LayerTriplets::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, y, 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_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
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
if(conf_.getParameter< bool >("UseStripCablingDB"))
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)
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, isotrackApplyRegressor::k, phase1PixelTopology::layer, HGCalParameters::layer_, HGCalParameters::layerIndex_, 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< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
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_
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_, LayerTriplets::layers(), HGCalParameters::levelT_, HGCalParameters::levelZSide_, loadGeometryHexagon8(), DDFilteredView::logicalPart(), DDFilteredView::name(), DDBase< N, C >::name(), DDFilteredView::next(), HGCalParameters::radiusMixBoundary_, DDTubs::rIn(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::hgtrform::sec, DDSolid::shape(), mkfit::Const::sol, DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrform::subsec, tolerance, DDFilteredView::translation(), x, y, 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_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
const edm::EventSetup & c
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const N & name() const
Definition: DDBase.h:59
const double tolerance
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
if(conf_.getParameter< bool >("UseStripCablingDB"))
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
double rOut(void) const
Definition: DDSolid.cc:458
std::vector< double > radiusMixBoundary_
constexpr float sol
Definition: Config.h:48
static constexpr double k_ScaleFromDDD
std::vector< int > levelT_
double rIn(void) const
Definition: DDSolid.cc:456
CLHEP::HepRotation hr
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)
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_, for(), HGCalParameters::hgtrform::h3v, HGCalParameters::hgtrform::hr, if(), HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::hgtrform::lay, HGCalParameters::layer_, LayerTriplets::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, y, 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_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
const edm::EventSetup & c
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
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
if(conf_.getParameter< bool >("UseStripCablingDB"))
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
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)
std::vector< double > radiusMixBoundary_
std::vector< int > levelT_
CLHEP::HepRotation hr
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)
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_, and AlCaHLTBitMon_QueryRunRegistry::string.

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
std::vector< double > slopeMin_
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
static constexpr double k_ScaleFromDDD
std::vector< int > layerGroupO_
std::vector< double > rLimit_
std::vector< int > levelT_
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");
1229  rescale(php.cellSize_, HGCalParameters::k_ScaleFromDD4hepToG4);
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_
void HGCalGeomParameters::loadSpecParsHexagon ( const HGCalParameters php)
private

Definition at line 1242 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::cellSize_, HGCalParameters::firstLayer_, isotrackApplyRegressor::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_
void HGCalGeomParameters::loadSpecParsHexagon8 ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 1263 of file HGCalGeomParameters.cc.

References HGCalParameters::cellThickness_, HGCalParameters::choiceType_, dbl_to_int(), HGCalParameters::fracAreaMin_, getDDDArray(), HGCalGeometryMode::Hexagon8Module, isotrackApplyRegressor::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerCenter_, HGCalParameters::layerOffset_, DDFilteredView::mergedSpecifics(), HGCalParameters::mode_, HGCalParameters::nCornerCut_, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, siliconFileEE, siliconFileHE, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, 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  if (php.waferMaskMode_ == siliconFileEE) {
1312  waferIndex = dbl_to_int(fv.vector("WaferIndexEE"));
1313  waferProperties = dbl_to_int(fv.vector("WaferPropertiesEE"));
1314  } else if (php.waferMaskMode_ == siliconFileHE) {
1315  waferIndex = dbl_to_int(fv.vector("WaferIndexHE"));
1316  waferProperties = dbl_to_int(fv.vector("WaferPropertiesHE"));
1317  }
1319  if (php.waferMaskMode_ == siliconFileEE) {
1320  layerType = dbl_to_int(fv.vector("LayerTypesEE"));
1321  } else if (php.waferMaskMode_ == siliconFileHE) {
1322  layerType = dbl_to_int(fv.vector("LayerTypesHE"));
1323  }
1324  }
1325 
1326  loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties);
1327  }
1328 }
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)
std::vector< double > const & vector(std::string_view iKey) const
The DDVector information.
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > rMaxFront_
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_
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
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
std::vector< double > radius200to300_
std::vector< double > radius100to200_
DDsvalues_type mergedSpecifics() const
std::vector< double > rMinFront_
static constexpr double k_ScaleFromDDD
std::vector< double > zFrontTop_
static constexpr int siliconFileHE
void HGCalGeomParameters::loadSpecParsHexagon8 ( const cms::DDFilteredView fv,
const cms::DDVectorsMap vmap,
HGCalParameters php,
const std::string &  sdTag1 
)

Definition at line 1330 of file HGCalGeomParameters.cc.

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

1333  {
1334  php.cellThickness_ = fv.get<std::vector<double> >(sdTag1, "CellThickness");
1337  php.waferThickness_ = fv.get<std::vector<double> >(sdTag1, "WaferThickness");
1339  } else {
1340  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1341  php.waferThickness_.emplace_back(php.waferThick_);
1342  }
1343 
1344  php.radius100to200_ = fv.get<std::vector<double> >(sdTag1, "Radius100to200");
1345  php.radius200to300_ = fv.get<std::vector<double> >(sdTag1, "Radius200to300");
1346 
1347  const auto& dummy = fv.get<std::vector<double> >(sdTag1, "RadiusCuts");
1348  if (dummy.size() > 3) {
1349  php.choiceType_ = static_cast<int>(dummy[0]);
1350  php.nCornerCut_ = static_cast<int>(dummy[1]);
1351  php.fracAreaMin_ = dummy[2];
1353  } else {
1354  php.choiceType_ = php.nCornerCut_ = php.fracAreaMin_ = php.zMinForRad_ = 0;
1355  }
1356 
1357  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
1358  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
1360  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
1362 
1363  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
1364  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
1366  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
1368  unsigned int kmax = (php.zFrontTop_.size() - php.slopeTop_.size());
1369  for (unsigned int k = 0; k < kmax; ++k)
1370  php.slopeTop_.emplace_back(0);
1371 
1372  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
1373  if (!dummy2.empty()) {
1374  php.layerOffset_ = dummy2[0];
1375  } else {
1376  php.layerOffset_ = 0;
1377  }
1378 
1379  for (auto const& it : vmap) {
1380  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "RadiusMixBoundary")) {
1381  for (const auto& i : it.second)
1383  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "ZRanges")) {
1384  for (const auto& i : it.second)
1385  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1386  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerCenter")) {
1387  for (const auto& i : it.second)
1388  php.layerCenter_.emplace_back(std::round(i));
1389  }
1390  }
1391 
1392  loadSpecParsHexagon8(php);
1393 
1394  // Read in parameters from Philip's file
1395  if (php.waferMaskMode_ > 1) {
1396  std::vector<int> layerType, waferIndex, waferProperties;
1397  if (php.waferMaskMode_ == siliconFileEE) {
1398  for (auto const& it : vmap) {
1399  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexEE")) {
1400  for (const auto& i : it.second)
1401  waferIndex.emplace_back(std::round(i));
1402  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferPropertiesEE")) {
1403  for (const auto& i : it.second)
1404  waferProperties.emplace_back(std::round(i));
1405  }
1406  }
1407  } else if (php.waferMaskMode_ == siliconFileHE) {
1408  for (auto const& it : vmap) {
1409  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexHE")) {
1410  for (const auto& i : it.second)
1411  waferIndex.emplace_back(std::round(i));
1412  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferPropertiesHE")) {
1413  for (const auto& i : it.second)
1414  waferProperties.emplace_back(std::round(i));
1415  }
1416  }
1417  }
1419  if (php.waferMaskMode_ == siliconFileEE) {
1420  for (auto const& it : vmap) {
1421  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypesEE")) {
1422  for (const auto& i : it.second)
1423  layerType.emplace_back(std::round(i));
1424  }
1425  }
1426  } else if (php.waferMaskMode_ == siliconFileHE) {
1427  for (auto const& it : vmap) {
1428  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypesHE")) {
1429  for (const auto& i : it.second)
1430  layerType.emplace_back(std::round(i));
1431  }
1432  }
1433  }
1434  }
1435 
1436  loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties);
1437  }
1438 }
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)
std::vector< double > rMaxFront_
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 > zFrontTop_
static constexpr int siliconFileHE
void HGCalGeomParameters::loadSpecParsHexagon8 ( HGCalParameters php)
private

Definition at line 1440 of file HGCalGeomParameters.cc.

References HGCalParameters::cellThickness_, HGCalParameters::choiceType_, HGCalParameters::fracAreaMin_, isotrackApplyRegressor::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_.

1440  {
1441 #ifdef EDM_ML_DEBUG
1442  for (unsigned int k = 0; k < php.waferThickness_.size(); ++k)
1443  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer[" << k << "] Thickness " << php.waferThickness_[k];
1444  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1445  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: cell[" << k << "] Thickness " << php.cellThickness_[k];
1446  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
1447  << "parameters for 120 to 200 micron "
1448  << "transition with" << php.radius100to200_.size() << " elements";
1449  for (unsigned int k = 0; k < php.radius100to200_.size(); ++k)
1450  edm::LogVerbatim("HGCalGeom") << "Element [" << k << "] " << php.radius100to200_[k];
1451  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
1452  << "parameters for 200 to 300 micron "
1453  << "transition with " << php.radius200to300_.size() << " elements";
1454  for (unsigned int k = 0; k < php.radius200to300_.size(); ++k)
1455  edm::LogVerbatim("HGCalGeom") << "Element [" << k << "] " << php.radius200to300_[k];
1456  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Parameters for the"
1457  << " transition " << php.choiceType_ << ":" << php.nCornerCut_ << ":"
1458  << php.fracAreaMin_ << ":" << php.zMinForRad_;
1459  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k)
1460  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k];
1461  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
1462  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
1463  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
1464  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
1465  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
1466  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
1467  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
1468  << php.zRanges_[2] << ":" << php.zRanges_[3];
1469  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: LayerOffset " << php.layerOffset_ << " in array of size "
1470  << php.layerCenter_.size();
1471  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
1472  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
1473 #endif
1474 }
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_
void HGCalGeomParameters::loadSpecParsHexagon8 ( HGCalParameters php,
const std::vector< int > &  layerType,
const std::vector< int > &  waferIndex,
const std::vector< int > &  waferProperties 
)
private

Definition at line 1476 of file HGCalGeomParameters.cc.

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

1479  {
1480  // Store parameters from Philip's file
1481  int types[5] = {HGCalTypes::WaferCenter,
1486  for (unsigned int k = 0; k < layerType.size(); ++k) {
1487  php.layerType_.emplace_back(types[layerType[k]]);
1488 #ifdef EDM_ML_DEBUG
1489  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << layerType[k] << ":" << php.layerType_[k];
1490 #endif
1491  }
1492  for (unsigned int k = 0; k < php.layerType_.size(); ++k) {
1493  double cth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? cos(php.layerRotation_) : 1.0;
1494  double sth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? sin(php.layerRotation_) : 0.0;
1495  php.layerRotV_.emplace_back(std::make_pair(cth, sth));
1496 #ifdef EDM_ML_DEBUG
1497  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << php.layerType_[k] << " cos|sin(Theta) "
1498  << php.layerRotV_[k].first << ":" << php.layerRotV_[k].second;
1499 #endif
1500  }
1501  for (unsigned int k = 0; k < waferIndex.size(); ++k) {
1502  int partial = HGCalProperty::waferPartial(waferProperties[k]);
1503  int orient = HGCalWaferMask::getRotation(php.waferZSide_, partial, HGCalProperty::waferOrient(waferProperties[k]));
1504  php.waferInfoMap_[waferIndex[k]] =
1505  HGCalParameters::waferInfo(HGCalProperty::waferThick(waferProperties[k]), partial, orient);
1506 #ifdef EDM_ML_DEBUG
1507  edm::LogVerbatim("HGCalGeom") << "[" << k << ":" << waferIndex[k] << ":"
1510  << HGCalWaferIndex::waferV(waferIndex[k]) << "] Thickness type "
1511  << HGCalProperty::waferThick(waferProperties[k]) << " Partial type " << partial
1512  << " Orientation " << HGCalProperty::waferOrient(waferProperties[k]) << ":" << orient;
1513 #endif
1514  }
1515 }
Log< level::Info, true > LogVerbatim
std::vector< std::pair< double, double > > layerRotV_
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
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)
Definition: HGCalProperty.cc:9
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< int > layerType_
int32_t waferPartial(const int32_t property)
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
void HGCalGeomParameters::loadSpecParsTrapezoid ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 1517 of file HGCalGeomParameters.cc.

References 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_, scintillatorFile, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalProperty::tileProperty(), DDFilteredView::vector(), HGCalParameters::waferMaskMode_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, and HGCalParameters::zRanges_.

Referenced by loadSpecParsTrapezoid().

1517  {
1519  php.radiusMixBoundary_ = fv.vector("RadiusMixBoundary");
1521 
1522  php.nPhiBinBH_ = dbl_to_int(getDDDArray("NPhiBinBH", sv, 0));
1523  php.layerFrontBH_ = dbl_to_int(getDDDArray("LayerFrontBH", sv, 0));
1524  php.rMinLayerBH_ = getDDDArray("RMinLayerBH", sv, 0);
1526  php.nCellsFine_ = php.nPhiBinBH_[0];
1527  php.nCellsCoarse_ = php.nPhiBinBH_[1];
1528  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
1529  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
1530 
1531  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
1532  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
1534  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
1536 
1537  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
1538  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
1540  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
1542 
1543  php.zRanges_ = fv.vector("ZRanges");
1545 
1546  // Offsets
1547  const auto& dummy2 = getDDDArray("LayerOffset", sv, 1);
1548  php.layerOffset_ = dummy2[0];
1549  php.layerCenter_ = dbl_to_int(fv.vector("LayerCenter"));
1550 
1551  loadSpecParsTrapezoid(php);
1552 
1553  // tile parameters from Katja's file
1554  if (php.waferMaskMode_ == scintillatorFile) {
1555  std::vector<int> tileIndx, tileProperty;
1556  std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1557  std::vector<double> tileRMin, tileRMax;
1558  std::vector<int> tileRingMin, tileRingMax;
1559  tileIndx = dbl_to_int(fv.vector("TileIndex"));
1560  tileProperty = dbl_to_int(fv.vector("TileProperty"));
1561  tileHEX1 = dbl_to_int(fv.vector("TileHEX1"));
1562  tileHEX2 = dbl_to_int(fv.vector("TileHEX2"));
1563  tileHEX3 = dbl_to_int(fv.vector("TileHEX3"));
1564  tileHEX4 = dbl_to_int(fv.vector("TileHEX4"));
1565  tileRMin = fv.vector("TileRMin");
1566  tileRMax = fv.vector("TileRMax");
1569  tileRingMin = dbl_to_int(fv.vector("TileRingMin"));
1570  tileRingMax = dbl_to_int(fv.vector("TileRingMax"));
1571 
1573  tileIndx,
1574  tileProperty,
1575  tileHEX1,
1576  tileHEX2,
1577  tileHEX3,
1578  tileHEX4,
1579  tileRMin,
1580  tileRMax,
1581  tileRingMin,
1582  tileRingMax);
1583  }
1584 }
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 > const & vector(std::string_view iKey) const
The DDVector information.
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
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
DDsvalues_type mergedSpecifics() const
std::vector< double > rMinFront_
static constexpr double k_ScaleFromDDD
void loadSpecParsTrapezoid(const DDFilteredView &fv, HGCalParameters &php)
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
int32_t tileProperty(const int32_t type, const int32_t sipm)
void HGCalGeomParameters::loadSpecParsTrapezoid ( const cms::DDFilteredView fv,
const cms::DDVectorsMap vmap,
HGCalParameters php,
const std::string &  sdTag1 
)

Definition at line 1586 of file HGCalGeomParameters.cc.

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

1589  {
1590  for (auto const& it : vmap) {
1591  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "RadiusMixBoundary")) {
1592  for (const auto& i : it.second)
1594  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "ZRanges")) {
1595  for (const auto& i : it.second)
1596  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1597  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerCenter")) {
1598  for (const auto& i : it.second)
1599  php.layerCenter_.emplace_back(std::round(i));
1600  }
1601  }
1602 
1603  php.nPhiBinBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "NPhiBinBH"));
1604  php.layerFrontBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "LayerFrontBH"));
1605  php.rMinLayerBH_ = fv.get<std::vector<double> >(sdTag1, "RMinLayerBH");
1607  php.nCellsFine_ = php.nPhiBinBH_[0];
1608  php.nCellsCoarse_ = php.nPhiBinBH_[1];
1609  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
1610  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
1611 
1612  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
1613  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
1615  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
1617 
1618  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
1619  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
1621  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
1623  unsigned int kmax = (php.zFrontTop_.size() - php.slopeTop_.size());
1624  for (unsigned int k = 0; k < kmax; ++k)
1625  php.slopeTop_.emplace_back(0);
1626 
1627  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
1628  php.layerOffset_ = dummy2[0];
1629 
1630  loadSpecParsTrapezoid(php);
1631 
1632  // tile parameters from Katja's file
1633  if (php.waferMaskMode_ == scintillatorFile) {
1634  std::vector<int> tileIndx, tileProperty;
1635  std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1636  std::vector<double> tileRMin, tileRMax;
1637  std::vector<int> tileRingMin, tileRingMax;
1638  for (auto const& it : vmap) {
1639  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileIndex")) {
1640  for (const auto& i : it.second)
1641  tileIndx.emplace_back(std::round(i));
1642  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileProperty")) {
1643  for (const auto& i : it.second)
1644  tileProperty.emplace_back(std::round(i));
1645  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX1")) {
1646  for (const auto& i : it.second)
1647  tileHEX1.emplace_back(std::round(i));
1648  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX2")) {
1649  for (const auto& i : it.second)
1650  tileHEX2.emplace_back(std::round(i));
1651  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX3")) {
1652  for (const auto& i : it.second)
1653  tileHEX3.emplace_back(std::round(i));
1654  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX4")) {
1655  for (const auto& i : it.second)
1656  tileHEX4.emplace_back(std::round(i));
1657  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRMin")) {
1658  for (const auto& i : it.second)
1659  tileRMin.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1660  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRMax")) {
1661  for (const auto& i : it.second)
1662  tileRMax.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1663  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRingMin")) {
1664  for (const auto& i : it.second)
1665  tileRingMin.emplace_back(std::round(i));
1666  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRingMax")) {
1667  for (const auto& i : it.second)
1668  tileRingMax.emplace_back(std::round(i));
1669  }
1670  }
1671 
1673  tileIndx,
1674  tileProperty,
1675  tileHEX1,
1676  tileHEX2,
1677  tileHEX3,
1678  tileHEX4,
1679  tileRMin,
1680  tileRMax,
1681  tileRingMin,
1682  tileRingMax);
1683  }
1684 }
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_
void loadSpecParsTrapezoid(const DDFilteredView &fv, HGCalParameters &php)
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
int32_t tileProperty(const int32_t type, const int32_t sipm)
void HGCalGeomParameters::loadSpecParsTrapezoid ( HGCalParameters php)
private

Definition at line 1686 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, HGCalParameters::firstLayer_, isotrackApplyRegressor::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_.

1686  {
1687 #ifdef EDM_ML_DEBUG
1688  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters:nCells " << php.nCellsFine_ << ":" << php.nCellsCoarse_
1689  << " cellSize: " << php.cellSize_[0] << ":" << php.cellSize_[1];
1690  for (unsigned int k = 0; k < php.layerFrontBH_.size(); ++k)
1691  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Type[" << k << "] Front Layer = " << php.layerFrontBH_[k]
1692  << " rMin = " << php.rMinLayerBH_[k];
1693  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k) {
1694  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k]
1695  << " Nphi = " << php.scintCells(k + php.firstLayer_)
1696  << " dPhi = " << php.scintCellSize(k + php.firstLayer_);
1697  }
1698 
1699  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
1700  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
1701  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
1702 
1703  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
1704  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
1705  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
1706 
1707  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
1708  << php.zRanges_[2] << ":" << php.zRanges_[3];
1709 
1710  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: LayerOffset " << php.layerOffset_ << " in array of size "
1711  << php.layerCenter_.size();
1712  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
1713  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
1714 #endif
1715 }
Log< level::Info, true > LogVerbatim
std::vector< double > zFrontMin_
double scintCellSize(const int layer) const
std::vector< double > rMinLayerBH_
std::vector< double > cellSize_
std::vector< double > rMaxFront_
int scintCells(const int layer) const
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_
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 1717 of file HGCalGeomParameters.cc.

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

1727  {
1728  // tile parameters from Katja's file
1729  for (unsigned int k = 0; k < tileIndx.size(); ++k) {
1732  tileHEX1[k],
1733  tileHEX2[k],
1734  tileHEX3[k],
1735  tileHEX4[k]);
1736 #ifdef EDM_ML_DEBUG
1737  edm::LogVerbatim("HGCalGeom") << "Tile[" << k << ":" << tileIndx[k] << "] "
1738  << " Type " << HGCalProperty::tileType(tileProperty[k]) << " SiPM "
1739  << HGCalProperty::tileSiPM(tileProperty[k]) << " HEX " << std::hex << tileHEX1[k]
1740  << ":" << tileHEX2[k] << ":" << tileHEX3[k] << ":" << tileHEX4[k] << std::dec;
1741 #endif
1742  }
1743 
1744  for (unsigned int k = 0; k < tileRMin.size(); ++k) {
1745  php.tileRingR_.emplace_back(tileRMin[k], tileRMax[k]);
1746 #ifdef EDM_ML_DEBUG
1747  edm::LogVerbatim("HGCalGeom") << "TileRingR[" << k << "] " << tileRMin[k] << ":" << tileRMax[k];
1748 #endif
1749  }
1750 
1751  for (unsigned k = 0; k < tileRingMin.size(); ++k) {
1752  php.tileRingRange_.emplace_back(tileRingMin[k], tileRingMax[k]);
1753 #ifdef EDM_ML_DEBUG
1754  edm::LogVerbatim("HGCalGeom") << "TileRingRange[" << k << "] " << tileRingMin[k] << ":" << tileRingMax[k];
1755 #endif
1756  }
1757 }
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)
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 1759 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, filterCSVwithJSON::copy, PVValHelper::dx, PVValHelper::dy, isotrackApplyRegressor::k, relval_steps::k2, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, 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_, and HGCalParameters::waferUVMax_.

1759  {
1761  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
1762 #ifdef EDM_ML_DEBUG
1763  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << rmin << " R Limits: " << rin << ":" << rout
1764  << " Fine " << rMaxFine;
1765 #endif
1766  // Clear the vectors
1767  php.waferCopy_.clear();
1768  php.waferTypeL_.clear();
1769  php.waferTypeT_.clear();
1770  php.waferPosX_.clear();
1771  php.waferPosY_.clear();
1772  double dx = 0.5 * waferW;
1773  double dy = 3.0 * dx * tan(30._deg);
1774  double rr = 2.0 * dx * tan(30._deg);
1775  int ncol = (int)(2.0 * rout / waferW) + 1;
1776  int nrow = (int)(rout / (waferW * tan(30._deg))) + 1;
1777  int ns2 = (2 * ncol + 1) * (2 * nrow + 1) * php.layer_.size();
1778  int incm(0), inrm(0), kount(0), ntot(0);
1779  HGCalParameters::layer_map copiesInLayers(php.layer_.size() + 1);
1780  HGCalParameters::waferT_map waferTypes(ns2 + 1);
1781 #ifdef EDM_ML_DEBUG
1782  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
1783 #endif
1784  for (int nr = -nrow; nr <= nrow; ++nr) {
1785  int inr = (nr >= 0) ? nr : -nr;
1786  for (int nc = -ncol; nc <= ncol; ++nc) {
1787  int inc = (nc >= 0) ? nc : -nc;
1788  if (inr % 2 == inc % 2) {
1789  double xpos = nc * dx;
1790  double ypos = nr * dy;
1791  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
1792  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
1793  int typet = (rpos < rMaxFine) ? 1 : 2;
1794  int typel(3);
1795  for (int k = 1; k < 4; ++k) {
1796  if ((rpos + rmin) <= php.boundR_[k]) {
1797  typel = k;
1798  break;
1799  }
1800  }
1801  ++ntot;
1802  if (corner.first > 0) {
1803  int copy = HGCalTypes::packTypeUV(typel, nc, nr);
1804  if (inc > incm)
1805  incm = inc;
1806  if (inr > inrm)
1807  inrm = inr;
1808  kount++;
1809 #ifdef EDM_ML_DEBUG
1810  edm::LogVerbatim("HGCalGeom") << kount << ":" << ntot << " Copy " << copy << " Type " << typel << ":" << typet
1811  << " Location " << corner.first << " Position " << xpos << ":" << ypos
1812  << " Layers " << php.layer_.size();
1813 #endif
1814  php.waferCopy_.emplace_back(copy);
1815  php.waferTypeL_.emplace_back(typel);
1816  php.waferTypeT_.emplace_back(typet);
1817  php.waferPosX_.emplace_back(xpos);
1818  php.waferPosY_.emplace_back(ypos);
1819  for (unsigned int il = 0; il < php.layer_.size(); ++il) {
1820  std::pair<int, int> corner =
1821  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, php.rMinLayHex_[il], php.rMaxLayHex_[il], true);
1822  if (corner.first > 0) {
1823  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
1824  if (cpy == copiesInLayers[php.layer_[il]].end())
1825  copiesInLayers[php.layer_[il]][copy] =
1826  ((corner.first == (int)(HGCalParameters::k_CornerSize)) ? php.waferCopy_.size() : -1);
1827  }
1828  if ((corner.first > 0) && (corner.first < (int)(HGCalParameters::k_CornerSize))) {
1829  int wl = HGCalWaferIndex::waferIndex(php.layer_[il], copy, 0, true);
1830  waferTypes[wl] = corner;
1831  }
1832  }
1833  }
1834  }
1835  }
1836  }
1837  php.copiesInLayers_ = copiesInLayers;
1838  php.waferTypes_ = waferTypes;
1839  php.nSectors_ = (int)(php.waferCopy_.size());
1840  php.waferUVMax_ = 0;
1841 #ifdef EDM_ML_DEBUG
1842  edm::LogVerbatim("HGCalGeom") << "HGCalWaferHexagon: # of columns " << incm << " # of rows " << inrm << " and "
1843  << kount << ":" << ntot << " wafers; R " << rin << ":" << rout;
1844  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
1845  for (unsigned int k = 0; k < copiesInLayers.size(); ++k) {
1846  const auto& theModules = copiesInLayers[k];
1847  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
1848  int k2(0);
1849  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
1850  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
1851  }
1852  }
1853 #endif
1854 }
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
void HGCalGeomParameters::loadWaferHexagon8 ( HGCalParameters php)

Definition at line 1856 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, filterCSVwithJSON::copy, 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, gpuClustering::id, isotrackApplyRegressor::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_, HGCalParameters::nSectors_, convertSQLiteXML::ok, 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(), HGCalParameters::xLayerHex_, HGCalParameters::yLayerHex_, HGCalParameters::zLayerHex_, and HGCalParameters::zMinForRad_.

1856  {
1857  double waferW(php.waferSize_);
1858  double waferS(php.sensorSeparation_);
1859  auto wType = std::make_unique<HGCalWaferType>(php.radius100to200_,
1860  php.radius200to300_,
1861  HGCalParameters::k_ScaleToDDD * (waferW + waferS),
1863  php.choiceType_,
1864  php.nCornerCut_,
1865  php.fracAreaMin_);
1866 
1867  double rout(php.rLimit_[1]);
1868 #ifdef EDM_ML_DEBUG
1869  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << waferS << " R Max: " << rout;
1870 #endif
1871  // Clear the vectors
1872  php.waferCopy_.clear();
1873  php.waferTypeL_.clear();
1874  php.waferTypeT_.clear();
1875  php.waferPosX_.clear();
1876  php.waferPosY_.clear();
1877  double r = 0.5 * (waferW + waferS);
1878  double R = 2.0 * r / sqrt3_;
1879  double dy = 0.75 * R;
1880  double r1 = 0.5 * waferW;
1881  double R1 = 2.0 * r1 / sqrt3_;
1882  int N = (r == 0) ? 3 : ((int)(0.5 * rout / r) + 3);
1883  int ns1 = (2 * N + 1) * (2 * N + 1);
1884  int ns2 = ns1 * php.zLayerHex_.size();
1885 #ifdef EDM_ML_DEBUG
1886  edm::LogVerbatim("HGCalGeom") << "wafer " << waferW << ":" << waferS << " r " << r << " dy " << dy << " N " << N
1887  << " sizes " << ns1 << ":" << ns2;
1888  std::vector<int> indtypes(ns1 + 1);
1889  indtypes.clear();
1890 #endif
1891  HGCalParameters::wafer_map wafersInLayers(ns1 + 1);
1892  HGCalParameters::wafer_map typesInLayers(ns2 + 1);
1893  HGCalParameters::waferT_map waferTypes(ns2 + 1);
1894  int ipos(0), lpos(0), uvmax(0), nwarn(0);
1895  std::vector<int> uvmx(php.zLayerHex_.size(), 0);
1896  for (int v = -N; v <= N; ++v) {
1897  for (int u = -N; u <= N; ++u) {
1898  int nr = 2 * v;
1899  int nc = -2 * u + v;
1900  double xpos = nc * r;
1901  double ypos = nr * dy;
1902  int indx = HGCalWaferIndex::waferIndex(0, u, v);
1903  php.waferCopy_.emplace_back(indx);
1904  php.waferPosX_.emplace_back(xpos);
1905  php.waferPosY_.emplace_back(ypos);
1906  wafersInLayers[indx] = ipos;
1907  ++ipos;
1908  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, r1, R1, 0, rout, false);
1909  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) || ((corner.first > 0) && php.defineFull_)) {
1910  uvmax = std::max(uvmax, std::max(std::abs(u), std::abs(v)));
1911  }
1912  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
1913  int copy = i + php.layerOffset_;
1914  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], (waferW + waferS));
1915  int lay = php.layer_[php.layerIndex_[i]];
1916  double xpos0 = xpos + xyoff.first;
1917  double ypos0 = ypos + xyoff.second;
1918  double zpos = php.zLayerHex_[i];
1919  int kndx = HGCalWaferIndex::waferIndex(lay, u, v);
1920  int type(-1);
1922  type = wType->getType(kndx, php.waferInfoMap_);
1923  if (type < 0)
1924  type = wType->getType(HGCalParameters::k_ScaleToDDD * xpos0,
1927  php.waferTypeL_.emplace_back(type);
1928  typesInLayers[kndx] = lpos;
1929  ++lpos;
1930 #ifdef EDM_ML_DEBUG
1931  indtypes.emplace_back(kndx);
1932 #endif
1933  std::pair<int, int> corner =
1934  HGCalGeomTools::waferCorner(xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], false);
1935 #ifdef EDM_ML_DEBUG
1936  if (((corner.first == 0) && std::abs(u) < 5 && std::abs(v) < 5) || (std::abs(u) < 2 && std::abs(v) < 2)) {
1937  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " R " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
1938  << " u " << u << " v " << v << " with " << corner.first << " corners";
1939  }
1940 #endif
1941  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) || ((corner.first > 0) && php.defineFull_)) {
1942  uvmx[i] = std::max(uvmx[i], std::max(std::abs(u), std::abs(v)));
1943  }
1944  if ((corner.first < (int)(HGCalParameters::k_CornerSize)) && (corner.first > 0)) {
1945 #ifdef EDM_ML_DEBUG
1946  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u << ":" << v << " with corner "
1947  << corner.first << ":" << corner.second;
1948 #endif
1949  int wl = HGCalWaferIndex::waferIndex(lay, u, v);
1950  if (php.waferMaskMode_ > 0) {
1951  std::pair<int, int> corner0 = HGCalWaferMask::getTypeMode(
1952  xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], type, php.waferMaskMode_);
1954  auto itr = php.waferInfoMap_.find(wl);
1955  if (itr != php.waferInfoMap_.end()) {
1956  int part = (itr->second).part;
1957  int orient = (itr->second).orient;
1959  xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], part, orient, false);
1960  if (ok)
1961  corner0 = std::make_pair(part, (HGCalWaferMask::k_OffsetRotation + orient));
1962 #ifdef EDM_ML_DEBUG
1963  edm::LogVerbatim("HGCalGeom")
1964  << "Layer:u:v " << i << ":" << lay << ":" << u << ":" << v << " Part " << corner0.first << ":"
1965  << part << " Orient " << corner0.second << ":" << orient << " Position " << xpos0 << ":" << ypos0
1966  << " delta " << r1 << ":" << R1 << " Limit " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
1967  << " Compatibiliety Flag " << ok;
1968 #endif
1969  if (!ok)
1970  ++nwarn;
1971  }
1972  }
1973  waferTypes[wl] = corner0;
1974 #ifdef EDM_ML_DEBUG
1975  edm::LogVerbatim("HGCalGeom")
1976  << "Layer " << lay << " u|v " << u << ":" << v << " Index " << std::hex << wl << std::dec << " pos "
1977  << xpos0 << ":" << ypos0 << " R " << r1 << ":" << R1 << " Range " << php.rMinLayHex_[i] << ":"
1978  << php.rMaxLayHex_[i] << type << ":" << php.waferMaskMode_ << " corner " << corner.first << ":"
1979  << corner.second << " croner0 " << corner0.first << ":" << corner0.second;
1980 #endif
1981  } else {
1982  waferTypes[wl] = corner;
1983 #ifdef EDM_ML_DEBUG
1984  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u << ":" << v << " with corner "
1985  << corner.first << ":" << corner.second;
1986 #endif
1987  }
1988  }
1989  }
1990  }
1991  }
1992  if (nwarn > 0)
1993  edm::LogWarning("HGCalGeom") << "HGCalGeomParameters::loadWafer8: there are " << nwarn
1994  << " wafers with non-matching partial- orientation types";
1995  php.waferUVMax_ = uvmax;
1996  php.waferUVMaxLayer_ = uvmx;
1997  php.wafersInLayers_ = wafersInLayers;
1998  php.typesInLayers_ = typesInLayers;
1999  php.waferTypes_ = waferTypes;
2000  php.nSectors_ = (int)(php.waferCopy_.size());
2002  mytr.lay = 1;
2003  mytr.bl = php.waferR_;
2004  mytr.tl = php.waferR_;
2005  mytr.h = php.waferR_;
2006  mytr.alpha = 0.0;
2008  for (auto const& dz : php.cellThickness_) {
2009  mytr.dz = 0.5 * HGCalParameters::k_ScaleToDDD * dz;
2010  php.fillModule(mytr, false);
2011  }
2012  for (unsigned k = 0; k < php.cellThickness_.size(); ++k) {
2013  HGCalParameters::hgtrap mytr = php.getModule(k, false);
2019  php.fillModule(mytr, true);
2020  }
2021 #ifdef EDM_ML_DEBUG
2022  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Total of " << php.waferCopy_.size() << " wafers";
2023  for (unsigned int k = 0; k < php.waferCopy_.size(); ++k) {
2024  int id = php.waferCopy_[k];
2025  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << std::hex << id << std::dec << ":"
2026  << HGCalWaferIndex::waferLayer(id) << ":" << HGCalWaferIndex::waferU(id) << ":"
2027  << HGCalWaferIndex::waferV(id) << " x " << php.waferPosX_[k] << " y "
2028  << php.waferPosY_[k] << " index " << php.wafersInLayers_[id];
2029  }
2030  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Total of " << php.waferTypeL_.size() << " wafer types";
2031  for (unsigned int k = 0; k < php.waferTypeL_.size(); ++k) {
2032  int id = indtypes[k];
2033  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.typesInLayers_[id] << ":" << php.waferTypeL_[k] << " ID "
2034  << std::hex << id << std::dec << ":" << HGCalWaferIndex::waferLayer(id) << ":"
2035  << HGCalWaferIndex::waferU(id) << ":" << HGCalWaferIndex::waferV(id);
2036  }
2037 #endif
2038 
2039  //Wafer offset
2040  php.xLayerHex_.clear();
2041  php.yLayerHex_.clear();
2042  double waferSize = php.waferSize_ + php.sensorSeparation_;
2043 #ifdef EDM_ML_DEBUG
2044  edm::LogVerbatim("HGCalGeom") << "WaferSize " << waferSize;
2045 #endif
2046  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2047  int copy = k + php.layerOffset_;
2048  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], waferSize);
2049  php.xLayerHex_.emplace_back(xyoff.first);
2050  php.yLayerHex_.emplace_back(xyoff.second);
2051 #ifdef EDM_ML_DEBUG
2052  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Off " << copy << ":" << php.layerCenter_[copy] << " Shift "
2053  << xyoff.first << ":" << xyoff.second;
2054 #endif
2055  }
2056 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
uint16_t *__restrict__ id
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
static bool goodTypeMode(double xpos, double ypos, double delX, double delY, double rin, double rout, int part, int rotn, bool debug)
HGCalGeometryMode::GeometryMode mode_
static constexpr uint32_t k_CornerSize
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_
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
hgtrap getModule(unsigned int k, bool reco) const
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
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 deug=false)
part
Definition: HCALResponse.h:20
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_
void HGCalGeomParameters::rescale ( std::vector< double > &  v,
const double  s 
)
private

Definition at line 2319 of file HGCalGeomParameters.cc.

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

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

2319  {
2320  std::for_each(v.begin(), v.end(), [s](double& n) { n *= s; });
2321 }
void HGCalGeomParameters::resetZero ( std::vector< double > &  v)
private

Definition at line 2323 of file HGCalGeomParameters.cc.

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

2323  {
2324  for (auto& n : v) {
2325  if (std::abs(n) < tolmin)
2326  n = 0;
2327  }
2328 }
const double tolmin
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

HGCalGeomTools HGCalGeomParameters::geomTools_
private

Definition at line 150 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

constexpr int HGCalGeomParameters::scintillatorFile = 4
static

Definition at line 104 of file HGCalGeomParameters.h.

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

constexpr int HGCalGeomParameters::siliconFileEE = 2
static

Definition at line 102 of file HGCalGeomParameters.h.

Referenced by loadSpecParsHexagon8().

constexpr int HGCalGeomParameters::siliconFileHE = 3
static

Definition at line 103 of file HGCalGeomParameters.h.

Referenced by loadSpecParsHexagon8().

const double HGCalGeomParameters::sqrt3_
private

Definition at line 151 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

constexpr double HGCalGeomParameters::tan30deg_ = 0.5773502693
staticprivate

Definition at line 149 of file HGCalGeomParameters.h.

Referenced by loadGeometryHexagon().

double HGCalGeomParameters::waferSize_
private