CMS 3D CMS Logo

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

#include <HGCalGeomParameters.h>

Classes

struct  cellParameters
 
struct  layerParameters
 

Public Member Functions

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

Static Public Attributes

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

Private Member Functions

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

Private Attributes

HGCalGeomTools geomTools_
 
const double sqrt3_
 
double waferSize_
 

Static Private Attributes

static constexpr double tan30deg_ = 0.5773502693
 

Detailed Description

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

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

Definition at line 29 of file HGCalGeomParameters.h.

Constructor & Destructor Documentation

◆ HGCalGeomParameters()

HGCalGeomParameters::HGCalGeomParameters ( )

Definition at line 32 of file HGCalGeomParameters.cc.

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

◆ ~HGCalGeomParameters()

HGCalGeomParameters::~HGCalGeomParameters ( )

Definition at line 39 of file HGCalGeomParameters.cc.

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

Member Function Documentation

◆ cellPosition()

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

Definition at line 2354 of file HGCalGeomParameters.cc.

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

Referenced by loadGeometryHexagon().

2359  {
2360  if (itrf == wafers.end()) {
2361  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin(); itr != wafers.end();
2362  ++itr) {
2363  if (itr->wafer == wafer) {
2364  itrf = itr;
2365  break;
2366  }
2367  }
2368  }
2369  double dx(0), dy(0);
2370  if (itrf != wafers.end()) {
2371  dx = (xx - itrf->xyz.x());
2372  if (std::abs(dx) < tolerance)
2373  dx = 0;
2374  dy = (yy - itrf->xyz.y());
2375  if (std::abs(dy) < tolerance)
2376  dy = 0;
2377  }
2378  return std::make_pair(dx, dy);
2379 }
const double tolerance
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ getDDDArray()

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

Definition at line 2327 of file HGCalGeomParameters.cc.

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

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

2327  {
2328  DDValue value(str);
2329  if (DDfetch(&sv, value)) {
2330  const std::vector<double>& fvec = value.doubles();
2331  int nval = fvec.size();
2332  if (nmin > 0) {
2333  if (nval < nmin) {
2334  throw cms::Exception("DDException")
2335  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < " << nmin << " ==> illegal";
2336  }
2337  } else {
2338  if (nval < 1 && nmin == 0) {
2339  throw cms::Exception("DDException")
2340  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < 1 ==> illegal"
2341  << " (nmin=" << nmin << ")";
2342  }
2343  }
2344  return fvec;
2345  } else {
2346  if (nmin >= 0) {
2347  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
2348  }
2349  std::vector<double> fvec;
2350  return fvec;
2351  }
2352 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
Definition: value.py:1
Quality *__restrict__ uint16_t nmin
#define str(s)

◆ loadCellParsHexagon() [1/3]

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

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

2119  {
2120  // Special parameters for cell parameters
2121  std::string attribute = "OnlyForHGCalNumbering";
2122  DDSpecificsHasNamedValueFilter filter1{attribute};
2123  DDFilteredView fv1(*cpv, filter1);
2124  bool ok = fv1.firstChild();
2125 
2126  if (ok) {
2127  php.cellFine_ = dbl_to_int(cpv->vector("waferFine"));
2128  php.cellCoarse_ = dbl_to_int(cpv->vector("waferCoarse"));
2129  }
2130 
2131  loadCellParsHexagon(php);
2132 }
std::vector< int > cellFine_
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7

◆ loadCellParsHexagon() [2/3]

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

Definition at line 2134 of file HGCalGeomParameters.cc.

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

2134  {
2135  for (auto const& it : vmap) {
2136  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferFine")) {
2137  for (const auto& i : it.second)
2138  php.cellFine_.emplace_back(std::round(i));
2139  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferCoarse")) {
2140  for (const auto& i : it.second)
2141  php.cellCoarse_.emplace_back(std::round(i));
2142  }
2143  }
2144 
2145  loadCellParsHexagon(php);
2146 }
std::vector< int > cellFine_
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)

◆ loadCellParsHexagon() [3/3]

void HGCalGeomParameters::loadCellParsHexagon ( const HGCalParameters php)

Definition at line 2148 of file HGCalGeomParameters.cc.

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

2148  {
2149 #ifdef EDM_ML_DEBUG
2150  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellFine_.size() << " rows for fine cells";
2151  for (unsigned int k = 0; k < php.cellFine_.size(); ++k)
2152  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
2153  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellCoarse_.size() << " rows for coarse cells";
2154  for (unsigned int k = 0; k < php.cellCoarse_.size(); ++k)
2155  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
2156 #endif
2157 }
Log< level::Info, true > LogVerbatim
std::vector< int > cellFine_
std::vector< int > cellCoarse_

◆ loadCellTrapezoid()

void HGCalGeomParameters::loadCellTrapezoid ( HGCalParameters php)

Definition at line 2159 of file HGCalGeomParameters.cc.

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

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

◆ loadGeometryHexagon() [1/3]

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

Definition at line 45 of file HGCalGeomParameters.cc.

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

Referenced by loadGeometryHexagon().

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

◆ loadGeometryHexagon() [2/3]

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

Definition at line 271 of file HGCalGeomParameters.cc.

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

276  {
277  const cms::DDFilter filter("Volume", sdTag1);
278  cms::DDFilteredView fv((*cpv), filter);
279  std::map<int, HGCalGeomParameters::layerParameters> layers;
280  std::vector<HGCalParameters::hgtrform> trforms;
281  std::vector<bool> trformUse;
282  std::vector<std::pair<int, int> > trused;
283 
284  while (fv.firstChild()) {
285  const std::vector<double>& pars = fv.parameters();
286  // Layers first
287  std::vector<int> copy = fv.copyNos();
288  int nsiz = static_cast<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 = static_cast<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 > static_cast<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 = static_cast<int>(copy.size());
437  int cellx = (nsiz > 0) ? copy[0] : 0;
438  int wafer = (nsiz > 1) ? copy[1] : 0;
439  int cell = HGCalTypes::getUnpackedCell6(cellx);
441  if (type != 1 && type != 2) {
442  throw cms::Exception("DDException")
443  << "Funny cell # " << cell << " type " << type << " in " << nsiz << " components";
444  } else {
445  auto ktr = wafertype.find(wafer);
446  if (ktr == wafertype.end())
447  wafertype[wafer] = type;
448  bool newc(false);
449  std::map<int, HGCalGeomParameters::cellParameters>::iterator itr;
450  double cellsize = php.cellSize_[0];
451  if (type == 1) {
452  itr = cellsf.find(cell);
453  newc = (itr == cellsf.end());
454  } else {
455  itr = cellsc.find(cell);
456  newc = (itr == cellsc.end());
457  cellsize = php.cellSize_[1];
458  }
459  if (newc) {
460  bool half = (name.find("Half") != std::string::npos);
461  double xx = HGCalParameters::k_ScaleFromDD4hep * fv2.translation().X();
462  double yy = HGCalParameters::k_ScaleFromDD4hep * fv2.translation().Y();
463  if (half) {
464  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
465  math::XYZPointD p2 = fv2.rotation()(p1);
468 #ifdef EDM_ML_DEBUG
469  if (std::abs(p2.X()) < HGCalParameters::tol)
470  p2.SetX(0.0);
471  if (std::abs(p2.Z()) < HGCalParameters::tol)
472  p2.SetZ(0.0);
473  edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local "
474  << xx << ":" << yy << " new " << p1 << ":" << p2;
475 #endif
476  }
478  if (type == 1) {
479  cellsf[cell] = cp;
480  } else {
481  cellsc[cell] = cp;
482  }
483  }
484  }
485  dodet = fv2.firstChild();
486  }
487  }
488 
490  layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
491 }
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
const double tolerance
static int32_t getUnpackedCell6(int id)
Definition: HGCalTypes.cc:40
float *__restrict__ zv
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::string names[nVars_]
static constexpr double tol
constexpr std::array< uint8_t, layerIndexSize > layer
static int32_t getUnpackedCellType6(int id)
Definition: HGCalTypes.cc:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
std::vector< double > cellSize_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr double k_ScaleFromDD4hep
void fillModule(const hgtrap &mytr, bool reco)
static constexpr double tan30deg_
static constexpr double k_ScaleFromDD4hepToG4
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
Definition: Point3D.h:8
static constexpr double k_ScaleFromDDD
void loadGeometryHexagon(const DDFilteredView &_fv, HGCalParameters &php, const std::string &sdTag1, const DDCompactView *cpv, const std::string &sdTag2, const std::string &sdTag3, HGCalGeometryMode::WaferMode mode)
Log< level::Warning, false > LogWarning
CLHEP::HepRotation hr
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)

◆ loadGeometryHexagon() [3/3]

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

Definition at line 493 of file HGCalGeomParameters.cc.

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

503  {
504  if (((cellsf.size() + cellsc.size()) == 0) || (wafers.empty()) || (layers.empty())) {
505  throw cms::Exception("DDException") << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
506  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
507  << " layers " << layers.size();
508  }
509 
510  for (unsigned int i = 0; i < layers.size(); ++i) {
511  for (auto& layer : layers) {
512  if (layer.first == static_cast<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] == static_cast<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] == static_cast<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_ = static_cast<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] == static_cast<int>(i + 1)) {
601  if (first) {
602  php.depth_.emplace_back(i + 1);
603  php.depthIndex_.emplace_back(depth);
604  php.depthLayerF_.emplace_back(k);
605  ++depth;
606  first = false;
607  }
608  }
609  }
610  }
611  HGCalParameters::hgtrap mytr = php.getModule(0, false);
617  double dz = mytr.dz;
618  php.fillModule(mytr, true);
619  mytr.dz = 2 * dz;
620  php.fillModule(mytr, true);
621  mytr.dz = 3 * dz;
622  php.fillModule(mytr, true);
623 #ifdef EDM_ML_DEBUG
624  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.zLayerHex_.size() << " layers";
625  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
626  int k = php.layerIndex_[i];
627  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":" << php.layer_[k]
628  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
629  << " at z = " << php.zLayerHex_[i];
630  }
631  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters has " << php.depthIndex_.size() << " depths";
632  for (unsigned int i = 0; i < php.depthIndex_.size(); ++i) {
633  int k = php.depthIndex_[i];
634  edm::LogVerbatim("HGCalGeom") << "Reco Layer[" << i << ":" << k << "] First Layer " << php.depthLayerF_[i]
635  << " Depth " << php.depth_[k];
636  }
637  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.nSectors_ << " wafers";
638  for (unsigned int i = 0; i < php.waferCopy_.size(); ++i)
639  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << ": " << php.waferCopy_[i] << "] type " << php.waferTypeL_[i]
640  << ":" << php.waferTypeT_[i] << " at (" << php.waferPosX_[i] << ","
641  << php.waferPosY_[i] << ",0)";
642  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius " << php.waferR_ << " and dimensions of the "
643  << "wafers:";
644  edm::LogVerbatim("HGCalGeom") << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0] << ":"
645  << php.moduleTlS_[0] << " dy " << php.moduleHS_[0] << " dz " << php.moduleDzS_[0]
646  << " alpha " << php.moduleAlphaS_[0];
647  for (unsigned int k = 0; k < php.moduleLayR_.size(); ++k)
648  edm::LogVerbatim("HGCalGeom") << "Rec[" << k << "] " << php.moduleLayR_[k] << " dx " << php.moduleBlR_[k] << ":"
649  << php.moduleTlR_[k] << " dy " << php.moduleHR_[k] << " dz " << php.moduleDzR_[k]
650  << " alpha " << php.moduleAlphaR_[k];
651  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.cellFineX_.size() << " fine cells in a wafer";
652  for (unsigned int i = 0; i < php.cellFineX_.size(); ++i)
653  edm::LogVerbatim("HGCalGeom") << "Fine Cell[" << i << "] at (" << php.cellFineX_[i] << "," << php.cellFineY_[i]
654  << ",0)";
655  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.cellCoarseX_.size()
656  << " coarse cells in a wafer";
657  for (unsigned int i = 0; i < php.cellCoarseX_.size(); ++i)
658  edm::LogVerbatim("HGCalGeom") << "Coarse Cell[" << i << "] at (" << php.cellCoarseX_[i] << ","
659  << php.cellCoarseY_[i] << ",0)";
660  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size() << " transformation matrices";
661  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
662  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k] << std::dec
663  << ") Translation (" << php.trformTranX_[k] << ", " << php.trformTranY_[k] << ", "
664  << php.trformTranZ_[k] << " Rotation (" << php.trformRotXX_[k] << ", "
665  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", " << php.trformRotXY_[k]
666  << ", " << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
667  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k]
668  << ")";
669  }
670  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
671  for (unsigned int k = 0; k < php.copiesInLayers_.size(); ++k) {
672  const auto& theModules = php.copiesInLayers_[k];
673  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
674  int k2(0);
675  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
676  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
677  }
678  }
679 #endif
680 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
std::vector< double > moduleDzR_
std::vector< int > depthLayerF_
std::vector< int > depth_
hgtrap getModule(unsigned int k, bool reco) const
std::vector< double > moduleHR_
layer_map copiesInLayers_
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
std::vector< int > moduleLayR_
std::vector< double > moduleHS_
std::vector< double > trformTranY_
std::vector< double > cellFineY_
std::vector< double > trformRotZY_
std::vector< uint32_t > trformIndex_
std::vector< double > trformRotXX_
void fillTrForm(const hgtrform &mytr)
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< double > trformRotZX_
std::vector< double > cellCoarseX_
std::vector< double > trformRotYZ_
std::pair< double, double > cellPosition(const std::vector< cellParameters > &wafers, std::vector< cellParameters >::const_iterator &itrf, int wafer, double xx, double yy)
std::vector< double > boundR_
std::vector< double > moduleDzS_
std::vector< int > layerIndex_
std::vector< double > moduleAlphaR_
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
std::vector< double > moduleBlR_
std::vector< double > rMinLayHex_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > moduleTlS_
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
void scaleTrForm(double)
std::vector< int > layerGroup_
std::vector< double > trformRotYY_
std::vector< double > cellFineX_
std::vector< double > trformRotZZ_
static constexpr double k_ScaleFromDDD
std::vector< double > moduleAlphaS_
std::vector< double > moduleBlS_
std::vector< int > waferCopy_
std::vector< int > depthIndex_
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_

◆ loadGeometryHexagon8() [1/3]

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

Definition at line 682 of file HGCalGeomParameters.cc.

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

Referenced by loadGeometryHexagon8(), and loadGeometryHexagonModule().

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

◆ loadGeometryHexagon8() [2/3]

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

Definition at line 756 of file HGCalGeomParameters.cc.

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

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

◆ loadGeometryHexagon8() [3/3]

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

Definition at line 1104 of file HGCalGeomParameters.cc.

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

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

◆ loadGeometryHexagonModule() [1/2]

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

Definition at line 833 of file HGCalGeomParameters.cc.

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

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

◆ loadGeometryHexagonModule() [2/2]

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

Definition at line 972 of file HGCalGeomParameters.cc.

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

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

◆ loadSpecParsHexagon() [1/3]

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

Definition at line 1165 of file HGCalGeomParameters.cc.

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

Referenced by loadSpecParsHexagon().

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

◆ loadSpecParsHexagon() [2/3]

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

Definition at line 1209 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_.

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

◆ loadSpecParsHexagon() [3/3]

void HGCalGeomParameters::loadSpecParsHexagon ( const HGCalParameters php)
private

Definition at line 1248 of file HGCalGeomParameters.cc.

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

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

◆ loadSpecParsHexagon8() [1/4]

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

Definition at line 1269 of file HGCalGeomParameters.cc.

References HGCalParameters::cassetteShift_, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, dbl_to_int(), HGCalParameters::fracAreaMin_, getDDDArray(), HGCalGeometryMode::Hexagon8Cassette, HGCalGeometryMode::Hexagon8Module, dqmdumpme::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_, siliconCassetteEE, siliconCassetteHE, siliconFileEE, siliconFileHE, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, DDFilteredView::vector(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferMaskMode_, HGCalParameters::waferThick_, HGCalParameters::waferThickness_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

Referenced by loadSpecParsHexagon8().

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

◆ loadSpecParsHexagon8() [2/4]

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

Definition at line 1347 of file HGCalGeomParameters.cc.

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

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

◆ loadSpecParsHexagon8() [3/4]

void HGCalGeomParameters::loadSpecParsHexagon8 ( HGCalParameters php)
private

Definition at line 1476 of file HGCalGeomParameters.cc.

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

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

◆ loadSpecParsHexagon8() [4/4]

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

Definition at line 1512 of file HGCalGeomParameters.cc.

References funct::cos(), HGCalWaferMask::getRotation(), HGCalGeometryMode::Hexagon8Cassette, dqmdumpme::k, HGCalParameters::layerRotation_, HGCalParameters::layerRotV_, HGCalTypes::layerType(), HGCalParameters::layerType_, HGCalParameters::mode_, hgcalPerformanceValidation::orient, funct::sin(), HGCalProperty::waferCassette(), HGCalTypes::WaferCenterR, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalWaferIndex::waferLayer(), HGCalProperty::waferOrient(), HGCalProperty::waferPartial(), HGCalProperty::waferThick(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and HGCalParameters::waferZSide_.

1515  {
1516  // Store parameters from Philip's file
1517  for (unsigned int k = 0; k < layerType.size(); ++k) {
1518  php.layerType_.emplace_back(HGCalTypes::layerType(layerType[k]));
1519 #ifdef EDM_ML_DEBUG
1520  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << layerType[k] << ":" << php.layerType_[k];
1521 #endif
1522  }
1523  for (unsigned int k = 0; k < php.layerType_.size(); ++k) {
1524  double cth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? cos(php.layerRotation_) : 1.0;
1525  double sth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? sin(php.layerRotation_) : 0.0;
1526  php.layerRotV_.emplace_back(std::make_pair(cth, sth));
1527 #ifdef EDM_ML_DEBUG
1528  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << php.layerType_[k] << " cos|sin(Theta) "
1529  << php.layerRotV_[k].first << ":" << php.layerRotV_[k].second;
1530 #endif
1531  }
1532  for (unsigned int k = 0; k < waferIndex.size(); ++k) {
1533  int partial = HGCalProperty::waferPartial(waferProperties[k]);
1534  int orient =
1536  ? HGCalProperty::waferOrient(waferProperties[k])
1537  : HGCalWaferMask::getRotation(php.waferZSide_, partial, HGCalProperty::waferOrient(waferProperties[k]));
1539  partial,
1540  orient,
1541  HGCalProperty::waferCassette(waferProperties[k]));
1542 #ifdef EDM_ML_DEBUG
1543  edm::LogVerbatim("HGCalGeom") << "[" << k << ":" << waferIndex[k] << ":"
1546  << HGCalWaferIndex::waferV(waferIndex[k]) << "] Thickness type "
1547  << HGCalProperty::waferThick(waferProperties[k]) << " Partial type " << partial
1548  << " Orientation " << HGCalProperty::waferOrient(waferProperties[k]) << ":" << orient;
1549 #endif
1550  }
1551 }
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)
HGCalGeometryMode::GeometryMode mode_
int32_t waferOrient(const int32_t property)
int32_t waferCassette(const int32_t property)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int32_t waferThick(const int32_t property)
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< int > layerType_
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:27
int32_t waferPartial(const int32_t property)
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
static int32_t layerType(int type)
Definition: HGCalTypes.cc:42

◆ loadSpecParsTrapezoid() [1/4]

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

Definition at line 1553 of file HGCalGeomParameters.cc.

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

Referenced by loadSpecParsTrapezoid().

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

◆ loadSpecParsTrapezoid() [2/4]

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

Definition at line 1630 of file HGCalGeomParameters.cc.

References HGCalParameters::cassetteShift_, HGCalParameters::cellSize_, dbl_to_int(), cms::DDFilteredView::get(), mps_fire::i, dqmdumpme::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_, scintillatorCassette, scintillatorFile, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalProperty::tileProperty(), HGCalParameters::waferMaskMode_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, and HGCalParameters::zRanges_.

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

◆ loadSpecParsTrapezoid() [3/4]

void HGCalGeomParameters::loadSpecParsTrapezoid ( HGCalParameters php)
private

Definition at line 1741 of file HGCalGeomParameters.cc.

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

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

◆ loadSpecParsTrapezoid() [4/4]

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

Definition at line 1772 of file HGCalGeomParameters.cc.

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

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

◆ loadWaferHexagon()

void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 1814 of file HGCalGeomParameters.cc.

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

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

◆ loadWaferHexagon8()

void HGCalGeomParameters::loadWaferHexagon8 ( HGCalParameters php)

Definition at line 1911 of file HGCalGeomParameters.cc.

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

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

◆ rescale()

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

Definition at line 2381 of file HGCalGeomParameters.cc.

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

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

2381  {
2382  std::for_each(v.begin(), v.end(), [s](double& n) { n *= s; });
2383 }

◆ resetZero()

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

Definition at line 2385 of file HGCalGeomParameters.cc.

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

2385  {
2386  for (auto& n : v) {
2387  if (std::abs(n) < tolmin)
2388  n = 0;
2389  }
2390 }
const double tolmin
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ geomTools_

HGCalGeomTools HGCalGeomParameters::geomTools_
private

Definition at line 153 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

◆ scintillatorCassette

constexpr int HGCalGeomParameters::scintillatorCassette = 7
static

◆ scintillatorFile

constexpr int HGCalGeomParameters::scintillatorFile = 4
static

Definition at line 104 of file HGCalGeomParameters.h.

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

◆ siliconCassetteEE

constexpr int HGCalGeomParameters::siliconCassetteEE = 5
static

Definition at line 105 of file HGCalGeomParameters.h.

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

◆ siliconCassetteHE

constexpr int HGCalGeomParameters::siliconCassetteHE = 6
static

Definition at line 106 of file HGCalGeomParameters.h.

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

◆ siliconFileEE

constexpr int HGCalGeomParameters::siliconFileEE = 2
static

Definition at line 102 of file HGCalGeomParameters.h.

Referenced by loadSpecParsHexagon8().

◆ siliconFileHE

constexpr int HGCalGeomParameters::siliconFileHE = 3
static

Definition at line 103 of file HGCalGeomParameters.h.

Referenced by loadSpecParsHexagon8().

◆ sqrt3_

const double HGCalGeomParameters::sqrt3_
private

Definition at line 154 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

◆ tan30deg_

constexpr double HGCalGeomParameters::tan30deg_ = 0.5773502693
staticprivate

Definition at line 152 of file HGCalGeomParameters.h.

Referenced by loadGeometryHexagon().

◆ waferSize_

double HGCalGeomParameters::waferSize_
private