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

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

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

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

Referenced by loadGeometryHexagon().

2409  {
2410  if (itrf == wafers.end()) {
2411  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin(); itr != wafers.end();
2412  ++itr) {
2413  if (itr->wafer == wafer) {
2414  itrf = itr;
2415  break;
2416  }
2417  }
2418  }
2419  double dx(0), dy(0);
2420  if (itrf != wafers.end()) {
2421  dx = (xx - itrf->xyz.x());
2422  if (std::abs(dx) < tolerance)
2423  dx = 0;
2424  dy = (yy - itrf->xyz.y());
2425  if (std::abs(dy) < tolerance)
2426  dy = 0;
2427  }
2428  return std::make_pair(dx, dy);
2429 }
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 2377 of file HGCalGeomParameters.cc.

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

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

2377  {
2378  DDValue value(str);
2379  if (DDfetch(&sv, value)) {
2380  const std::vector<double>& fvec = value.doubles();
2381  int nval = fvec.size();
2382  if (nmin > 0) {
2383  if (nval < nmin) {
2384  throw cms::Exception("DDException")
2385  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < " << nmin << " ==> illegal";
2386  }
2387  } else {
2388  if (nval < 1 && nmin == 0) {
2389  throw cms::Exception("DDException")
2390  << "HGCalGeomParameters: # of " << str << " bins " << nval << " < 1 ==> illegal"
2391  << " (nmin=" << nmin << ")";
2392  }
2393  }
2394  return fvec;
2395  } else {
2396  if (nmin >= 0) {
2397  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
2398  }
2399  std::vector<double> fvec;
2400  return fvec;
2401  }
2402 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
Definition: value.py:1
#define str(s)

◆ loadCellParsHexagon() [1/3]

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

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

2169  {
2170  // Special parameters for cell parameters
2171  std::string attribute = "OnlyForHGCalNumbering";
2172  DDSpecificsHasNamedValueFilter filter1{attribute};
2173  DDFilteredView fv1(*cpv, filter1);
2174  bool ok = fv1.firstChild();
2175 
2176  if (ok) {
2177  php.cellFine_ = dbl_to_int(cpv->vector("waferFine"));
2178  php.cellCoarse_ = dbl_to_int(cpv->vector("waferCoarse"));
2179  }
2180 
2181  loadCellParsHexagon(php);
2182 }
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 2184 of file HGCalGeomParameters.cc.

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

2184  {
2185  for (auto const& it : vmap) {
2186  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferFine")) {
2187  for (const auto& i : it.second)
2188  php.cellFine_.emplace_back(std::round(i));
2189  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferCoarse")) {
2190  for (const auto& i : it.second)
2191  php.cellCoarse_.emplace_back(std::round(i));
2192  }
2193  }
2194 
2195  loadCellParsHexagon(php);
2196 }
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 2198 of file HGCalGeomParameters.cc.

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

2198  {
2199 #ifdef EDM_ML_DEBUG
2200  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellFine_.size() << " rows for fine cells";
2201  for (unsigned int k = 0; k < php.cellFine_.size(); ++k)
2202  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
2203  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellCoarse_.size() << " rows for coarse cells";
2204  for (unsigned int k = 0; k < php.cellCoarse_.size(); ++k)
2205  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
2206 #endif
2207 }
Log< level::Info, true > LogVerbatim
std::vector< int > cellFine_
std::vector< int > cellCoarse_

◆ loadCellTrapezoid()

void HGCalGeomParameters::loadCellTrapezoid ( HGCalParameters php)

Definition at line 2209 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 ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::zv.

2209  {
2210  php.xLayerHex_.resize(php.zLayerHex_.size(), 0);
2211  php.yLayerHex_.resize(php.zLayerHex_.size(), 0);
2212 #ifdef EDM_ML_DEBUG
2213  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: x|y|zLayerHex in array of size " << php.zLayerHex_.size();
2214  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k)
2215  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Shift " << php.xLayerHex_[k] << ":" << php.yLayerHex_[k] << ":"
2216  << php.zLayerHex_[k];
2217 #endif
2218  // Find the radius of each eta-partitions
2219 
2222  //Ring radii for each partition
2223  for (unsigned int k = 0; k < 2; ++k) {
2224  for (unsigned int kk = 0; kk < php.tileRingR_.size(); ++kk) {
2225  php.radiusLayer_[k].emplace_back(php.tileRingR_[kk].first);
2226 #ifdef EDM_ML_DEBUG
2227  double zv = ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
2228  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
2229  double rv = php.radiusLayer_[k].back();
2230  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
2231  edm::LogVerbatim("HGCalGeom") << "New [" << kk << "] new R = " << rv << " Eta = " << eta;
2232 #endif
2233  }
2234  php.radiusLayer_[k].emplace_back(php.tileRingR_[php.tileRingR_.size() - 1].second);
2235  }
2236  // Minimum and maximum radius index for each layer
2237  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2238  php.iradMinBH_.emplace_back(1 + php.tileRingRange_[k].first);
2239  php.iradMaxBH_.emplace_back(1 + php.tileRingRange_[k].second);
2240 #ifdef EDM_ML_DEBUG
2241  int kk = php.scintType(php.firstLayer_ + static_cast<int>(k));
2242  edm::LogVerbatim("HGCalGeom") << "New Layer " << k << " Type " << kk << " Low edge " << php.iradMinBH_.back()
2243  << " Top edge " << php.iradMaxBH_.back();
2244 #endif
2245  }
2246  } else {
2247  //Ring radii for each partition
2248  for (unsigned int k = 0; k < 2; ++k) {
2249  double rmax = ((k == 0) ? (php.rMaxLayHex_[php.layerFrontBH_[1] - php.firstLayer_] - 1)
2250  : (php.rMaxLayHex_[php.rMaxLayHex_.size() - 1]));
2251  double rv = php.rMinLayerBH_[k];
2252  double zv = ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
2253  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
2254  php.radiusLayer_[k].emplace_back(rv);
2255 #ifdef EDM_ML_DEBUG
2256  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
2257  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] rmax " << rmax << " Z = " << zv
2258  << " dEta = " << php.cellSize_[k] << "\nOld[0] new R = " << rv << " Eta = " << eta;
2259  int kount(1);
2260 #endif
2261  while (rv < rmax) {
2262  double eta = -(php.cellSize_[k] + std::log(std::tan(0.5 * std::atan(rv / zv))));
2263  rv = zv * std::tan(2.0 * std::atan(std::exp(-eta)));
2264  php.radiusLayer_[k].emplace_back(rv);
2265 #ifdef EDM_ML_DEBUG
2266  edm::LogVerbatim("HGCalGeom") << "Old [" << kount << "] new R = " << rv << " Eta = " << eta;
2267  ++kount;
2268 #endif
2269  }
2270  }
2271  // Find minimum and maximum radius index for each layer
2272  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2273  int kk = php.scintType(php.firstLayer_ + static_cast<int>(k));
2274  std::vector<double>::iterator low, high;
2275  low = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMinLayHex_[k]);
2276 #ifdef EDM_ML_DEBUG
2277  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] RLow = " << php.rMinLayHex_[k] << " pos "
2278  << static_cast<int>(low - php.radiusLayer_[kk].begin());
2279 #endif
2280  if (low == php.radiusLayer_[kk].begin())
2281  ++low;
2282  int irlow = static_cast<int>(low - php.radiusLayer_[kk].begin());
2283  double drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
2284 #ifdef EDM_ML_DEBUG
2285  edm::LogVerbatim("HGCalGeom") << "irlow " << irlow << " dr " << drlow << " min " << php.minTileSize_;
2286 #endif
2287  if (drlow < php.minTileSize_) {
2288  ++irlow;
2289 #ifdef EDM_ML_DEBUG
2290  drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
2291  edm::LogVerbatim("HGCalGeom") << "Modified irlow " << irlow << " dr " << drlow;
2292 #endif
2293  }
2294  high = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMaxLayHex_[k]);
2295 #ifdef EDM_ML_DEBUG
2296  edm::LogVerbatim("HGCalGeom") << "Old [" << k << "] RHigh = " << php.rMaxLayHex_[k] << " pos "
2297  << static_cast<int>(high - php.radiusLayer_[kk].begin());
2298 #endif
2299  if (high == php.radiusLayer_[kk].end())
2300  --high;
2301  int irhigh = static_cast<int>(high - php.radiusLayer_[kk].begin());
2302  double drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
2303 #ifdef EDM_ML_DEBUG
2304  edm::LogVerbatim("HGCalGeom") << "irhigh " << irhigh << " dr " << drhigh << " min " << php.minTileSize_;
2305 #endif
2306  if (drhigh < php.minTileSize_) {
2307  --irhigh;
2308 #ifdef EDM_ML_DEBUG
2309  drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
2310  edm::LogVerbatim("HGCalGeom") << "Modified irhigh " << irhigh << " dr " << drhigh;
2311 #endif
2312  }
2313  php.iradMinBH_.emplace_back(irlow);
2314  php.iradMaxBH_.emplace_back(irhigh);
2315 #ifdef EDM_ML_DEBUG
2316  edm::LogVerbatim("HGCalGeom") << "Old Layer " << k << " Type " << kk << " Low edge " << irlow << ":" << drlow
2317  << " Top edge " << irhigh << ":" << drhigh;
2318 #endif
2319  }
2320  }
2321 #ifdef EDM_ML_DEBUG
2322  for (unsigned int k = 0; k < 2; ++k) {
2323  edm::LogVerbatim("HGCalGeom") << "Type " << k << " with " << php.radiusLayer_[k].size() << " radii";
2324  for (unsigned int kk = 0; kk < php.radiusLayer_[k].size(); ++kk)
2325  edm::LogVerbatim("HGCalGeom") << "Ring[" << kk << "] " << php.radiusLayer_[k][kk];
2326  }
2327 #endif
2328 
2329  // Now define the volumes
2330  int im(0);
2331  php.waferUVMax_ = 0;
2333  mytr.alpha = 0.0;
2334  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2335  if (php.iradMaxBH_[k] > php.waferUVMax_)
2336  php.waferUVMax_ = php.iradMaxBH_[k];
2337  int kk = ((php.firstLayer_ + static_cast<int>(k)) < php.layerFrontBH_[1]) ? 0 : 1;
2338  int irm = php.radiusLayer_[kk].size() - 1;
2339 #ifdef EDM_ML_DEBUG
2340  double rmin = php.radiusLayer_[kk][std::max((php.iradMinBH_[k] - 1), 0)];
2341  double rmax = php.radiusLayer_[kk][std::min(php.iradMaxBH_[k], irm)];
2342  edm::LogVerbatim("HGCalGeom") << "Layer " << php.firstLayer_ + k << ":" << kk << " Radius range "
2343  << php.iradMinBH_[k] << ":" << php.iradMaxBH_[k] << ":" << rmin << ":" << rmax;
2344 #endif
2345  mytr.lay = php.firstLayer_ + k;
2346  for (int irad = php.iradMinBH_[k]; irad <= php.iradMaxBH_[k]; ++irad) {
2347  double rmin = php.radiusLayer_[kk][std::max((irad - 1), 0)];
2348  double rmax = php.radiusLayer_[kk][std::min(irad, irm)];
2349  mytr.bl = 0.5 * rmin * php.scintCellSize(mytr.lay);
2350  mytr.tl = 0.5 * rmax * php.scintCellSize(mytr.lay);
2351  mytr.h = 0.5 * (rmax - rmin);
2352  mytr.dz = 0.5 * php.waferThick_;
2353  mytr.cellSize = 0.5 * (rmax + rmin) * php.scintCellSize(mytr.lay);
2354  php.fillModule(mytr, true);
2360  php.fillModule(mytr, false);
2361  if (irad == php.iradMinBH_[k])
2362  php.firstModule_.emplace_back(im);
2363  ++im;
2364  if (irad == php.iradMaxBH_[k] - 1)
2365  php.lastModule_.emplace_back(im);
2366  }
2367  }
2368  php.nSectors_ = php.waferUVMax_;
2369 #ifdef EDM_ML_DEBUG
2370  edm::LogVerbatim("HGCalGeom") << "Maximum radius index " << php.waferUVMax_;
2371  for (unsigned int k = 0; k < php.firstModule_.size(); ++k)
2372  edm::LogVerbatim("HGCalGeom") << "Layer " << k + php.firstLayer_ << " Modules " << php.firstModule_[k] << ":"
2373  << php.lastModule_[k];
2374 #endif
2375 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
int scintType(const int layer) const
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 39 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, PVValHelper::dz, HGCalParameters::hgtrap::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, nano_mu_digi_cff::layer, HGCalParameters::layer_, hgcalTBTopologyTester_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_, waferSize_, HGCalParameters::waferSize_, x, DDExtrudedPolygon::xVec(), geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::zv, DDPolyhedra::zVec(), DDExtrudedPolygon::zVec(), and geometryCSVtoXML::zz.

Referenced by loadGeometryHexagon().

45  {
46  DDFilteredView fv = _fv;
47  bool dodet(true);
48  std::map<int, HGCalGeomParameters::layerParameters> layers;
49  std::vector<HGCalParameters::hgtrform> trforms;
50  std::vector<bool> trformUse;
51 
52  while (dodet) {
53  const DDSolid& sol = fv.logicalPart().solid();
54  // Layers first
55  std::vector<int> copy = fv.copyNumbers();
56  int nsiz = static_cast<int>(copy.size());
57  int lay = (nsiz > 0) ? copy[nsiz - 1] : 0;
58  int zp = (nsiz > 2) ? copy[nsiz - 3] : -1;
59  if (zp != 1)
60  zp = -1;
61  if (lay == 0) {
62  throw cms::Exception("DDException") << "Funny layer # " << lay << " zp " << zp << " in " << nsiz << " components";
63  } else {
64  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
65  php.layer_.emplace_back(lay);
66  auto itr = layers.find(lay);
67  if (itr == layers.end()) {
68  double rin(0), rout(0);
70  if ((sol.shape() == DDSolidShape::ddpolyhedra_rz) || (sol.shape() == DDSolidShape::ddpolyhedra_rrz)) {
71  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
72  const std::vector<double>& rmin = polyhedra.rMinVec();
73  const std::vector<double>& rmax = polyhedra.rMaxVec();
74  rin = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmin[0] + rmin[1]);
75  rout = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmax[0] + rmax[1]);
76  } else if (sol.shape() == DDSolidShape::ddtubs) {
77  const DDTubs& tube = static_cast<DDTubs>(sol);
78  rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
79  rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
80  }
81  HGCalGeomParameters::layerParameters laypar(rin, rout, zz);
82  layers[lay] = laypar;
83  }
84  DD3Vector x, y, z;
85  fv.rotation().GetComponents(x, y, z);
86  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
87  const CLHEP::HepRotation hr(rotation);
89  if (std::abs(xx) < tolerance)
90  xx = 0;
92  if (std::abs(yy) < tolerance)
93  yy = 0;
95  const CLHEP::Hep3Vector h3v(xx, yy, zz);
97  mytrf.zp = zp;
98  mytrf.lay = lay;
99  mytrf.sec = 0;
100  mytrf.subsec = 0;
101  mytrf.h3v = h3v;
102  mytrf.hr = hr;
103  trforms.emplace_back(mytrf);
104  trformUse.emplace_back(false);
105  }
106  dodet = fv.next();
107  }
108 
109  // Then wafers
110  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they
111  // were) to ensure that new copy numbers are always added to the end of the
112  // list.
113  std::unordered_map<int32_t, int32_t> copies;
114  HGCalParameters::layer_map copiesInLayers(layers.size() + 1);
115  std::vector<int32_t> wafer2copy;
116  std::vector<HGCalGeomParameters::cellParameters> wafers;
117  std::string attribute = "Volume";
118  DDValue val1(attribute, sdTag2, 0.0);
119  DDSpecificsMatchesValueFilter filter1{val1};
120  DDFilteredView fv1(*cpv, filter1);
121  bool ok = fv1.firstChild();
122  if (!ok) {
123  throw cms::Exception("DDException") << "Attribute " << val1 << " not found but needed.";
124  } else {
125  dodet = true;
126  std::unordered_set<std::string> names;
127  while (dodet) {
128  const DDSolid& sol = fv1.logicalPart().solid();
129  const std::string& name = fv1.logicalPart().name().name();
130  std::vector<int> copy = fv1.copyNumbers();
131  int nsiz = static_cast<int>(copy.size());
132  int wafer = (nsiz > 0) ? copy[nsiz - 1] : 0;
133  int layer = (nsiz > 1) ? copy[nsiz - 2] : 0;
134  if (nsiz < 2) {
135  throw cms::Exception("DDException") << "Funny wafer # " << wafer << " in " << nsiz << " components";
136  } else if (layer > static_cast<int>(layers.size())) {
137  edm::LogWarning("HGCalGeom") << "Funny wafer # " << wafer << " Layer " << layer << ":" << layers.size()
138  << " among " << nsiz << " components";
139  } else {
140  auto itr = copies.find(wafer);
141  auto cpy = copiesInLayers[layer].find(wafer);
142  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
143  copiesInLayers[layer][wafer] = itr->second;
144  }
145  if (itr == copies.end()) {
146  copies[wafer] = wafer2copy.size();
147  copiesInLayers[layer][wafer] = wafer2copy.size();
148  double xx = HGCalParameters::k_ScaleFromDDD * fv1.translation().X();
149  if (std::abs(xx) < tolerance)
150  xx = 0;
151  double yy = HGCalParameters::k_ScaleFromDDD * fv1.translation().Y();
152  if (std::abs(yy) < tolerance)
153  yy = 0;
154  wafer2copy.emplace_back(wafer);
155  GlobalPoint p(xx, yy, HGCalParameters::k_ScaleFromDDD * fv1.translation().Z());
156  HGCalGeomParameters::cellParameters cell(false, wafer, p);
157  wafers.emplace_back(cell);
158  if (names.count(name) == 0) {
159  std::vector<double> zv, rv;
161  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
162  zv = polyhedra.zVec();
163  rv = polyhedra.rMaxVec();
164  } else {
165  const DDExtrudedPolygon& polygon = static_cast<DDExtrudedPolygon>(sol);
166  zv = polygon.zVec();
167  rv = polygon.xVec();
168  }
171  double dz = 0.5 * HGCalParameters::k_ScaleFromDDDToG4 * (zv[1] - zv[0]);
172 #ifdef EDM_ML_DEBUG
173  edm::LogVerbatim("HGCalGeom")
174  << "Mode " << mode << " R " << php.waferSize_ << ":" << php.waferR_ << " z " << dz;
175 #endif
177  mytr.lay = 1;
178  mytr.bl = php.waferR_;
179  mytr.tl = php.waferR_;
180  mytr.h = php.waferR_;
181  mytr.dz = dz;
182  mytr.alpha = 0.0;
183  mytr.cellSize = waferSize_;
184  php.fillModule(mytr, false);
185  names.insert(name);
186  }
187  }
188  }
189  dodet = fv1.next();
190  }
191  }
192 
193  // Finally the cells
194  std::map<int, int> wafertype;
195  std::map<int, HGCalGeomParameters::cellParameters> cellsf, cellsc;
196  DDValue val2(attribute, sdTag3, 0.0);
197  DDSpecificsMatchesValueFilter filter2{val2};
198  DDFilteredView fv2(*cpv, filter2);
199  ok = fv2.firstChild();
200  if (!ok) {
201  throw cms::Exception("DDException") << "Attribute " << val2 << " not found but needed.";
202  } else {
203  dodet = true;
204  while (dodet) {
205  const DDSolid& sol = fv2.logicalPart().solid();
206  const std::string& name = sol.name().name();
207  std::vector<int> copy = fv2.copyNumbers();
208  int nsiz = static_cast<int>(copy.size());
209  int cellx = (nsiz > 0) ? copy[nsiz - 1] : 0;
210  int wafer = (nsiz > 1) ? copy[nsiz - 2] : 0;
211  int cell = HGCalTypes::getUnpackedCell6(cellx);
213  if (type != 1 && type != 2) {
214  throw cms::Exception("DDException")
215  << "Funny cell # " << cell << " type " << type << " in " << nsiz << " components";
216  } else {
217  auto ktr = wafertype.find(wafer);
218  if (ktr == wafertype.end())
219  wafertype[wafer] = type;
220  bool newc(false);
221  std::map<int, HGCalGeomParameters::cellParameters>::iterator itr;
222  double cellsize = php.cellSize_[0];
223  if (type == 1) {
224  itr = cellsf.find(cell);
225  newc = (itr == cellsf.end());
226  } else {
227  itr = cellsc.find(cell);
228  newc = (itr == cellsc.end());
229  cellsize = php.cellSize_[1];
230  }
231  if (newc) {
232  bool half = (name.find("Half") != std::string::npos);
233  double xx = HGCalParameters::k_ScaleFromDDD * fv2.translation().X();
234  double yy = HGCalParameters::k_ScaleFromDDD * fv2.translation().Y();
235  if (half) {
236  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
237  math::XYZPointD p2 = fv2.rotation()(p1);
240 #ifdef EDM_ML_DEBUG
241  if (std::abs(p2.X()) < HGCalParameters::tol)
242  p2.SetX(0.0);
243  if (std::abs(p2.Z()) < HGCalParameters::tol)
244  p2.SetZ(0.0);
245  edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local "
246  << xx << ":" << yy << " new " << p1 << ":" << p2;
247 #endif
248  }
250  if (type == 1) {
251  cellsf[cell] = cp;
252  } else {
253  cellsc[cell] = cp;
254  }
255  }
256  }
257  dodet = fv2.next();
258  }
259  }
260 
262  layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
263 }
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
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
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:13
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 265 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(), PVValHelper::dz, HGCalParameters::hgtrap::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, nano_mu_digi_cff::layer, HGCalParameters::layer_, hgcalTBTopologyTester_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, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::zv, and geometryCSVtoXML::zz.

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

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

References funct::abs(), filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), ddtubs, Exception, spr::find(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, hgcalTBTopologyTester_cfi::layers, HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::logicalPart(), SiStripPI::max, SiStripPI::min, DDFilteredView::next(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::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().

676  {
677  DDFilteredView fv = _fv;
678  bool dodet(true);
679  std::map<int, HGCalGeomParameters::layerParameters> layers;
680  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
681  int levelTop = 3 + std::max(php.levelT_[0], php.levelT_[1]);
682 #ifdef EDM_ML_DEBUG
683  int ntot(0);
684 #endif
685  while (dodet) {
686 #ifdef EDM_ML_DEBUG
687  ++ntot;
688 #endif
689  std::vector<int> copy = fv.copyNumbers();
690  int nsiz = static_cast<int>(copy.size());
691  if (nsiz < levelTop) {
692  int lay = copy[nsiz - 1];
693  int zside = (nsiz > php.levelZSide_) ? copy[php.levelZSide_] : -1;
694  if (zside != 1)
695  zside = -1;
696  const DDSolid& sol = fv.logicalPart().solid();
697 #ifdef EDM_ML_DEBUG
698  edm::LogVerbatim("HGCalGeom") << sol.name() << " shape " << sol.shape() << " size " << nsiz << ":" << levelTop
699  << " lay " << lay << " z " << zside;
700 #endif
701  if (lay == 0) {
702  throw cms::Exception("DDException")
703  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
704  } else if (sol.shape() == DDSolidShape::ddtubs) {
705  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
706  php.layer_.emplace_back(lay);
707  const DDTubs& tube = static_cast<DDTubs>(sol);
708  double rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
709  double rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
710  auto itr = layers.find(lay);
711  if (itr == layers.end()) {
712  double zp = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
713  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
714  layers[lay] = laypar;
715  } else {
716  (itr->second).rmin = std::min(rin, (itr->second).rmin);
717  (itr->second).rmax = std::max(rout, (itr->second).rmax);
718  }
719  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
720  DD3Vector x, y, z;
721  fv.rotation().GetComponents(x, y, z);
722  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
723  const CLHEP::HepRotation hr(rotation);
724  double xx =
725  ((std::abs(fv.translation().X()) < tolerance) ? 0
727  double yy =
728  ((std::abs(fv.translation().Y()) < tolerance) ? 0
730  const CLHEP::Hep3Vector h3v(xx, yy, HGCalParameters::k_ScaleFromDDD * fv.translation().Z());
732  mytrf.zp = zside;
733  mytrf.lay = lay;
734  mytrf.sec = 0;
735  mytrf.subsec = 0;
736  mytrf.h3v = h3v;
737  mytrf.hr = hr;
738  trforms[std::make_pair(lay, zside)] = mytrf;
739  }
740  }
741  }
742  dodet = fv.next();
743  }
744 #ifdef EDM_ML_DEBUG
745  edm::LogVerbatim("HGCalGeom") << "Total # of views " << ntot;
746 #endif
747  loadGeometryHexagon8(layers, trforms, firstLayer, php);
748 }
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:13
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.
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
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 750 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(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::layer_, hgcalTBTopologyTester_cfi::layers, cms::DDFilteredView::level(), HGCalParameters::levelT_, HGCalParameters::levelZSide_, loadGeometryHexagon8(), SiStripPI::max, SiStripPI::min, cms::dd::name(), cms::DDFilteredView::name(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::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().

753  {
754  const cms::DDFilter filter("Volume", sdTag1);
755  cms::DDFilteredView fv((*cpv), filter);
756  std::map<int, HGCalGeomParameters::layerParameters> layers;
757  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
758  int levelTop = 3 + std::max(php.levelT_[0], php.levelT_[1]);
759 #ifdef EDM_ML_DEBUG
760  int ntot(0);
761 #endif
762  while (fv.firstChild()) {
763 #ifdef EDM_ML_DEBUG
764  ++ntot;
765 #endif
766  // Layers first
767  int nsiz = static_cast<int>(fv.level());
768  if (nsiz < levelTop) {
769  std::vector<int> copy = fv.copyNos();
770  int lay = copy[0];
771  int zside = (nsiz > php.levelZSide_) ? copy[nsiz - php.levelZSide_ - 1] : -1;
772  if (zside != 1)
773  zside = -1;
774 #ifdef EDM_ML_DEBUG
775  edm::LogVerbatim("HGCalGeom") << fv.name() << " shape " << cms::dd::name(cms::DDSolidShapeMap, fv.shape())
776  << " size " << nsiz << ":" << levelTop << " lay " << lay << " z " << zside << ":"
777  << php.levelZSide_;
778 #endif
779  if (lay == 0) {
780  throw cms::Exception("DDException")
781  << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
782  } else if (fv.shape() == cms::DDSolidShape::ddtubs) {
783  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
784  php.layer_.emplace_back(lay);
785  const std::vector<double>& pars = fv.parameters();
786  double rin = HGCalParameters::k_ScaleFromDD4hep * pars[0];
787  double rout = HGCalParameters::k_ScaleFromDD4hep * pars[1];
788  auto itr = layers.find(lay);
789  if (itr == layers.end()) {
790  double zp = HGCalParameters::k_ScaleFromDD4hep * fv.translation().Z();
791  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
792  layers[lay] = laypar;
793  } else {
794  (itr->second).rmin = std::min(rin, (itr->second).rmin);
795  (itr->second).rmax = std::max(rout, (itr->second).rmax);
796  }
797  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
798  DD3Vector x, y, z;
799  fv.rotation().GetComponents(x, y, z);
800  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
801  const CLHEP::HepRotation hr(rotation);
802  double xx = ((std::abs(fv.translation().X()) < tolerance)
803  ? 0
804  : HGCalParameters::k_ScaleFromDD4hep * fv.translation().X());
805  double yy = ((std::abs(fv.translation().Y()) < tolerance)
806  ? 0
807  : HGCalParameters::k_ScaleFromDD4hep * fv.translation().Y());
808  const CLHEP::Hep3Vector h3v(xx, yy, HGCalParameters::k_ScaleFromDD4hep * fv.translation().Z());
810  mytrf.zp = zside;
811  mytrf.lay = lay;
812  mytrf.sec = 0;
813  mytrf.subsec = 0;
814  mytrf.h3v = h3v;
815  mytrf.hr = hr;
816  trforms[std::make_pair(lay, zside)] = mytrf;
817  }
818  }
819  }
820  }
821 #ifdef EDM_ML_DEBUG
822  edm::LogVerbatim("HGCalGeom") << "Total # of views " << ntot;
823 #endif
824  loadGeometryHexagon8(layers, trforms, firstLayer, php);
825 }
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_
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
void loadGeometryHexagon8(const DDFilteredView &_fv, HGCalParameters &php, int firstLayer)

◆ loadGeometryHexagon8() [3/3]

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

Definition at line 1098 of file HGCalGeomParameters.cc.

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

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

References funct::abs(), HltBtagPostValidation_cff::c, filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), ddtubs, Exception, spr::find(), DDFilteredView::firstChild(), HGCalParameters::firstMixedLayer_, HGCalParameters::hgtrform::h3v, HGCalParameters::hgtrform::hr, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrform::lay, HGCalParameters::layer_, hgcalTBTopologyTester_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().

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

References funct::abs(), HltBtagPostValidation_cff::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, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::hgtrform::lay, HGCalParameters::layer_, hgcalTBTopologyTester_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().

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

◆ loadSpecParsHexagon() [1/3]

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

Definition at line 1159 of file HGCalGeomParameters.cc.

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

Referenced by loadSpecParsHexagon().

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

◆ loadSpecParsHexagon() [2/3]

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

Definition at line 1203 of file HGCalGeomParameters.cc.

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

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

◆ loadSpecParsHexagon() [3/3]

void HGCalGeomParameters::loadSpecParsHexagon ( const HGCalParameters php)
private

Definition at line 1242 of file HGCalGeomParameters.cc.

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

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

◆ loadSpecParsHexagon8() [1/4]

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

Definition at line 1263 of file HGCalGeomParameters.cc.

References HGCalParameters::calibCellFullHD_, HGCalParameters::calibCellFullLD_, HGCalParameters::calibCellPartHD_, HGCalParameters::calibCellPartLD_, HGCalParameters::calibCellRHD_, HGCalParameters::calibCellRLD_, HGCalParameters::cassetteShift_, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, dbl_to_int(), HGCalParameters::fracAreaMin_, getDDDArray(), HGCalGeometryMode::Hexagon8CalibCell, 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().

1263  {
1265  php.cellThickness_ = getDDDArray("CellThickness", sv, 3);
1269  php.waferThickness_ = getDDDArray("WaferThickness", sv, 3);
1271  } else {
1272  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1273  php.waferThickness_.emplace_back(php.waferThick_);
1274  }
1275 
1276  php.radius100to200_ = getDDDArray("Radius100to200", sv, 5);
1277  php.radius200to300_ = getDDDArray("Radius200to300", sv, 5);
1278 
1279  const auto& dummy = getDDDArray("RadiusCuts", sv, 4);
1280  php.choiceType_ = static_cast<int>(dummy[0]);
1281  php.nCornerCut_ = static_cast<int>(dummy[1]);
1282  php.fracAreaMin_ = dummy[2];
1284 
1285  php.radiusMixBoundary_ = fv.vector("RadiusMixBoundary");
1287 
1288  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
1289  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
1291  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
1293 
1294  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
1295  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
1297  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
1299 
1300  php.zRanges_ = fv.vector("ZRanges");
1302 
1303  const auto& dummy2 = getDDDArray("LayerOffset", sv, 1);
1304  php.layerOffset_ = dummy2[0];
1305  php.layerCenter_ = dbl_to_int(fv.vector("LayerCenter"));
1306 
1308  const auto& dummy3 = fv.vector("CalibCellRadius");
1310  php.calibCellFullHD_ = dbl_to_int(fv.vector("CalibCellFullHD"));
1311  php.calibCellPartHD_ = dbl_to_int(fv.vector("CalibCellPartHD"));
1313  php.calibCellFullLD_ = dbl_to_int(fv.vector("CalibCellFullLD"));
1314  php.calibCellPartLD_ = dbl_to_int(fv.vector("CalibCellPartLD"));
1315  } else {
1316  php.calibCellRHD_ = php.calibCellRLD_ = 0;
1317  php.calibCellFullHD_.clear();
1318  php.calibCellPartHD_.clear();
1319  php.calibCellFullLD_.clear();
1320  php.calibCellPartLD_.clear();
1321  }
1322 
1323  loadSpecParsHexagon8(php);
1324 
1325  // Read in parameters from Philip's file
1326  if (php.waferMaskMode_ > 1) {
1327  std::vector<int> layerType, waferIndex, waferProperties;
1328  std::vector<double> cassetteShift;
1329  if (php.waferMaskMode_ == siliconFileEE) {
1330  waferIndex = dbl_to_int(fv.vector("WaferIndexEE"));
1331  waferProperties = dbl_to_int(fv.vector("WaferPropertiesEE"));
1332  } else if (php.waferMaskMode_ == siliconCassetteEE) {
1333  waferIndex = dbl_to_int(fv.vector("WaferIndexEE"));
1334  waferProperties = dbl_to_int(fv.vector("WaferPropertiesEE"));
1335  cassetteShift = fv.vector("CassetteShiftEE");
1336  } else if (php.waferMaskMode_ == siliconFileHE) {
1337  waferIndex = dbl_to_int(fv.vector("WaferIndexHE"));
1338  waferProperties = dbl_to_int(fv.vector("WaferPropertiesHE"));
1339  } else if (php.waferMaskMode_ == siliconCassetteHE) {
1340  waferIndex = dbl_to_int(fv.vector("WaferIndexHE"));
1341  waferProperties = dbl_to_int(fv.vector("WaferPropertiesHE"));
1342  cassetteShift = fv.vector("CassetteShiftHE");
1343  }
1346  if ((php.waferMaskMode_ == siliconFileEE) || (php.waferMaskMode_ == siliconCassetteEE)) {
1347  layerType = dbl_to_int(fv.vector("LayerTypesEE"));
1348  } else if ((php.waferMaskMode_ == siliconFileHE) || (php.waferMaskMode_ == siliconCassetteHE)) {
1349  layerType = dbl_to_int(fv.vector("LayerTypesHE"));
1350  }
1351  }
1352 
1353  php.cassetteShift_ = cassetteShift;
1355  loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties);
1356  }
1357 }
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 > calibCellPartHD_
std::vector< int > layerCenter_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< int > calibCellFullHD_
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< int > calibCellPartLD_
std::vector< double > zFrontTop_
static constexpr int siliconFileHE
std::vector< int > calibCellFullLD_

◆ loadSpecParsHexagon8() [2/4]

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

Definition at line 1359 of file HGCalGeomParameters.cc.

References HGCalParameters::calibCellFullHD_, HGCalParameters::calibCellFullLD_, HGCalParameters::calibCellPartHD_, HGCalParameters::calibCellPartLD_, HGCalParameters::calibCellRHD_, HGCalParameters::calibCellRLD_, HGCalParameters::cassetteShift_, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, HGCalParameters::fracAreaMin_, cms::DDFilteredView::get(), HGCalGeometryMode::Hexagon8CalibCell, HGCalGeometryMode::Hexagon8Cassette, HGCalGeometryMode::Hexagon8Module, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmdumpme::k, HGCalParameters::k_ScaleFromDD4hep, HGCalParameters::k_ScaleFromDDD, 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_.

1362  {
1363  php.cellThickness_ = fv.get<std::vector<double> >(sdTag1, "CellThickness");
1367  php.waferThickness_ = fv.get<std::vector<double> >(sdTag1, "WaferThickness");
1369  } else {
1370  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1371  php.waferThickness_.emplace_back(php.waferThick_);
1372  }
1373 
1374  php.radius100to200_ = fv.get<std::vector<double> >(sdTag1, "Radius100to200");
1375  php.radius200to300_ = fv.get<std::vector<double> >(sdTag1, "Radius200to300");
1376 
1377  const auto& dummy = fv.get<std::vector<double> >(sdTag1, "RadiusCuts");
1378  if (dummy.size() > 3) {
1379  php.choiceType_ = static_cast<int>(dummy[0]);
1380  php.nCornerCut_ = static_cast<int>(dummy[1]);
1381  php.fracAreaMin_ = dummy[2];
1383  } else {
1384  php.choiceType_ = php.nCornerCut_ = php.fracAreaMin_ = php.zMinForRad_ = 0;
1385  }
1386 
1387  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
1388  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
1390  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
1392 
1393  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
1394  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
1396  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
1398  unsigned int kmax = (php.zFrontTop_.size() - php.slopeTop_.size());
1399  for (unsigned int k = 0; k < kmax; ++k)
1400  php.slopeTop_.emplace_back(0);
1401 
1402  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
1403  if (!dummy2.empty()) {
1404  php.layerOffset_ = dummy2[0];
1405  } else {
1406  php.layerOffset_ = 0;
1407  }
1408 
1409  php.calibCellRHD_ = php.calibCellRLD_ = 0;
1410  php.calibCellFullHD_.clear();
1411  php.calibCellPartHD_.clear();
1412  php.calibCellFullLD_.clear();
1413  php.calibCellPartLD_.clear();
1414  for (auto const& it : vmap) {
1415  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "RadiusMixBoundary")) {
1416  for (const auto& i : it.second)
1418  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "ZRanges")) {
1419  for (const auto& i : it.second)
1420  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1421  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerCenter")) {
1422  for (const auto& i : it.second)
1423  php.layerCenter_.emplace_back(std::round(i));
1424  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CalibCellRadius")) {
1427  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CalibCellFullHD")) {
1428  for (const auto& i : it.second)
1429  php.calibCellFullHD_.emplace_back(std::round(i));
1430  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CalibCellPartHD")) {
1431  for (const auto& i : it.second)
1432  php.calibCellPartHD_.emplace_back(std::round(i));
1433  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CalibCellFullLD")) {
1434  for (const auto& i : it.second)
1435  php.calibCellFullLD_.emplace_back(std::round(i));
1436  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CalibCellPartLD")) {
1437  for (const auto& i : it.second)
1438  php.calibCellPartLD_.emplace_back(std::round(i));
1439  }
1440  }
1441 
1442  loadSpecParsHexagon8(php);
1443 
1444  // Read in parameters from Philip's file
1445  if (php.waferMaskMode_ > 1) {
1446  std::vector<int> layerType, waferIndex, waferProperties;
1447  std::vector<double> cassetteShift;
1448  if ((php.waferMaskMode_ == siliconFileEE) || (php.waferMaskMode_ == siliconCassetteEE)) {
1449  for (auto const& it : vmap) {
1450  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexEE")) {
1451  for (const auto& i : it.second)
1452  waferIndex.emplace_back(std::round(i));
1453  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferPropertiesEE")) {
1454  for (const auto& i : it.second)
1455  waferProperties.emplace_back(std::round(i));
1456  }
1457  }
1458  if (php.waferMaskMode_ == siliconCassetteEE) {
1459  for (auto const& it : vmap) {
1460  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CassetteShiftEE")) {
1461  for (const auto& i : it.second)
1462  cassetteShift.emplace_back(i);
1463  }
1464  }
1465  }
1466  } else if ((php.waferMaskMode_ == siliconFileHE) || (php.waferMaskMode_ == siliconCassetteHE)) {
1467  for (auto const& it : vmap) {
1468  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferIndexHE")) {
1469  for (const auto& i : it.second)
1470  waferIndex.emplace_back(std::round(i));
1471  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "WaferPropertiesHE")) {
1472  for (const auto& i : it.second)
1473  waferProperties.emplace_back(std::round(i));
1474  }
1475  }
1476  if (php.waferMaskMode_ == siliconCassetteHE) {
1477  for (auto const& it : vmap) {
1478  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CassetteShiftHE")) {
1479  for (const auto& i : it.second)
1480  cassetteShift.emplace_back(i);
1481  }
1482  }
1483  }
1484  }
1487  if ((php.waferMaskMode_ == siliconFileEE) || (php.waferMaskMode_ == siliconCassetteEE)) {
1488  for (auto const& it : vmap) {
1489  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypesEE")) {
1490  for (const auto& i : it.second)
1491  layerType.emplace_back(std::round(i));
1492  }
1493  }
1494  } else if ((php.waferMaskMode_ == siliconFileHE) || (php.waferMaskMode_ == siliconCassetteHE)) {
1495  for (auto const& it : vmap) {
1496  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerTypesHE")) {
1497  for (const auto& i : it.second)
1498  layerType.emplace_back(std::round(i));
1499  }
1500  }
1501  }
1502  }
1503 
1504  php.cassetteShift_ = cassetteShift;
1506  loadSpecParsHexagon8(php, layerType, waferIndex, waferProperties);
1507  }
1508 }
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 > calibCellPartHD_
std::vector< int > layerCenter_
static constexpr double k_ScaleFromDD4hep
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< int > calibCellFullHD_
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_
static constexpr double k_ScaleFromDDD
std::vector< double > cassetteShift_
std::vector< int > calibCellPartLD_
std::vector< double > zFrontTop_
static constexpr int siliconFileHE
std::vector< int > calibCellFullLD_

◆ loadSpecParsHexagon8() [3/4]

void HGCalGeomParameters::loadSpecParsHexagon8 ( HGCalParameters php)
private

Definition at line 1510 of file HGCalGeomParameters.cc.

References HGCalParameters::calibCellFullHD_, HGCalParameters::calibCellFullLD_, HGCalParameters::calibCellPartHD_, HGCalParameters::calibCellPartLD_, HGCalParameters::calibCellRHD_, HGCalParameters::calibCellRLD_, 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_.

1510  {
1511 #ifdef EDM_ML_DEBUG
1512  for (unsigned int k = 0; k < php.waferThickness_.size(); ++k)
1513  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer[" << k << "] Thickness " << php.waferThickness_[k];
1514  for (unsigned int k = 0; k < php.cellThickness_.size(); ++k)
1515  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: cell[" << k << "] Thickness " << php.cellThickness_[k];
1516  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
1517  << "parameters for 120 to 200 micron "
1518  << "transition with" << php.radius100to200_.size() << " elements";
1519  for (unsigned int k = 0; k < php.radius100to200_.size(); ++k)
1520  edm::LogVerbatim("HGCalGeom") << "Element [" << k << "] " << php.radius100to200_[k];
1521  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
1522  << "parameters for 200 to 300 micron "
1523  << "transition with " << php.radius200to300_.size() << " elements";
1524  for (unsigned int k = 0; k < php.radius200to300_.size(); ++k)
1525  edm::LogVerbatim("HGCalGeom") << "Element [" << k << "] " << php.radius200to300_[k];
1526  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Parameters for the"
1527  << " transition " << php.choiceType_ << ":" << php.nCornerCut_ << ":"
1528  << php.fracAreaMin_ << ":" << php.zMinForRad_;
1529  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k)
1530  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k];
1531  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
1532  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
1533  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
1534  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
1535  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
1536  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
1537  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
1538  << php.zRanges_[2] << ":" << php.zRanges_[3];
1539  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: LayerOffset " << php.layerOffset_ << " in array of size "
1540  << php.layerCenter_.size();
1541  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
1542  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
1543  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Calibration cells in HD having radius " << php.calibCellRHD_
1544  << " in arrays of size " << php.calibCellFullHD_.size() << ":"
1545  << php.calibCellPartHD_.size();
1546  for (unsigned int k = 0; k < php.calibCellFullHD_.size(); ++k)
1547  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.calibCellFullHD_[k] << ":" << php.calibCellPartHD_[k];
1548  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Calibration cells in LD having radius " << php.calibCellRLD_
1549  << " in arrays of size " << php.calibCellFullLD_.size() << ":"
1550  << php.calibCellPartLD_.size();
1551  for (unsigned int k = 0; k < php.calibCellFullLD_.size(); ++k)
1552  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.calibCellFullLD_[k] << ":" << php.calibCellPartLD_[k];
1553 #endif
1554 }
Log< level::Info, true > LogVerbatim
std::vector< double > zFrontMin_
std::vector< double > rMaxFront_
std::vector< double > waferThickness_
std::vector< double > slopeTop_
std::vector< int > calibCellPartHD_
std::vector< int > layerCenter_
std::vector< int > calibCellFullHD_
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< int > calibCellPartLD_
std::vector< double > zFrontTop_
std::vector< int > calibCellFullLD_

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

References funct::cos(), HGCalWaferMask::getRotation(), HGCalGeometryMode::Hexagon8CalibCell, 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_.

1559  {
1560  // Store parameters from Philip's file
1561  for (unsigned int k = 0; k < layerType.size(); ++k) {
1562  php.layerType_.emplace_back(HGCalTypes::layerType(layerType[k]));
1563 #ifdef EDM_ML_DEBUG
1564  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << layerType[k] << ":" << php.layerType_.back();
1565 #endif
1566  }
1567  for (unsigned int k = 0; k < php.layerType_.size(); ++k) {
1568  double cth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? cos(php.layerRotation_) : 1.0;
1569  double sth = (php.layerType_[k] == HGCalTypes::WaferCenterR) ? sin(php.layerRotation_) : 0.0;
1570  php.layerRotV_.emplace_back(std::make_pair(cth, sth));
1571 #ifdef EDM_ML_DEBUG
1572  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Type " << php.layerType_[k] << " cos|sin(Theta) "
1573  << php.layerRotV_.back().first << ":" << php.layerRotV_.back().second;
1574 #endif
1575  }
1576  for (unsigned int k = 0; k < waferIndex.size(); ++k) {
1577  int partial = HGCalProperty::waferPartial(waferProperties[k]);
1578  int orient =
1580  ? HGCalProperty::waferOrient(waferProperties[k])
1581  : HGCalWaferMask::getRotation(php.waferZSide_, partial, HGCalProperty::waferOrient(waferProperties[k]));
1583  partial,
1584  orient,
1585  HGCalProperty::waferCassette(waferProperties[k]));
1586 #ifdef EDM_ML_DEBUG
1587  edm::LogVerbatim("HGCalGeom") << "[" << k << ":" << waferIndex[k] << ":"
1590  << HGCalWaferIndex::waferV(waferIndex[k]) << "] Thickness type "
1591  << HGCalProperty::waferThick(waferProperties[k]) << " Partial type " << partial
1592  << " Orientation " << HGCalProperty::waferOrient(waferProperties[k]) << ":" << orient;
1593 #endif
1594  }
1595 }
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 1597 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().

1597  {
1599  php.radiusMixBoundary_ = fv.vector("RadiusMixBoundary");
1601 
1602  php.nPhiBinBH_ = dbl_to_int(getDDDArray("NPhiBinBH", sv, 0));
1603  php.layerFrontBH_ = dbl_to_int(getDDDArray("LayerFrontBH", sv, 0));
1604  php.rMinLayerBH_ = getDDDArray("RMinLayerBH", sv, 0);
1606  php.nCellsFine_ = php.nPhiBinBH_[0];
1607  php.nCellsCoarse_ = php.nPhiBinBH_[1];
1608  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
1609  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
1610 
1611  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
1612  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
1614  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
1616 
1617  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
1618  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
1620  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
1622 
1623  php.zRanges_ = fv.vector("ZRanges");
1625 
1626  // Offsets
1627  const auto& dummy2 = getDDDArray("LayerOffset", sv, 1);
1628  php.layerOffset_ = dummy2[0];
1629  php.layerCenter_ = dbl_to_int(fv.vector("LayerCenter"));
1630 
1631  loadSpecParsTrapezoid(php);
1632 
1633  // tile parameters from Katja's file
1635  std::vector<int> tileIndx, tileProperty;
1636  std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1637  std::vector<double> tileRMin, tileRMax;
1638  std::vector<int> tileRingMin, tileRingMax;
1639  std::vector<double> cassetteShift;
1640  tileIndx = dbl_to_int(fv.vector("TileIndex"));
1641  tileProperty = dbl_to_int(fv.vector("TileProperty"));
1642  tileHEX1 = dbl_to_int(fv.vector("TileHEX1"));
1643  tileHEX2 = dbl_to_int(fv.vector("TileHEX2"));
1644  tileHEX3 = dbl_to_int(fv.vector("TileHEX3"));
1645  tileHEX4 = dbl_to_int(fv.vector("TileHEX4"));
1646  tileRMin = fv.vector("TileRMin");
1647  tileRMax = fv.vector("TileRMax");
1650  tileRingMin = dbl_to_int(fv.vector("TileRingMin"));
1651  tileRingMax = dbl_to_int(fv.vector("TileRingMax"));
1652  if (php.waferMaskMode_ == scintillatorCassette) {
1653  if (php.cassettes_ > 0)
1654  php.nphiCassette_ = php.nCellsCoarse_ / php.cassettes_;
1655  cassetteShift = fv.vector("CassetteShiftHE");
1656  rescale(cassetteShift, HGCalParameters::k_ScaleFromDDD);
1657  }
1658 
1659  php.cassetteShift_ = cassetteShift;
1661  tileIndx,
1662  tileProperty,
1663  tileHEX1,
1664  tileHEX2,
1665  tileHEX3,
1666  tileHEX4,
1667  tileRMin,
1668  tileRMax,
1669  tileRingMin,
1670  tileRingMax);
1671  }
1672 }
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 1674 of file HGCalGeomParameters.cc.

References HGCalParameters::cassetteShift_, HGCalParameters::cellSize_, dbl_to_int(), cms::DDFilteredView::get(), mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, 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_.

1677  {
1678  for (auto const& it : vmap) {
1679  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "RadiusMixBoundary")) {
1680  for (const auto& i : it.second)
1682  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "ZRanges")) {
1683  for (const auto& i : it.second)
1684  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1685  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "LayerCenter")) {
1686  for (const auto& i : it.second)
1687  php.layerCenter_.emplace_back(std::round(i));
1688  }
1689  }
1690 
1691  php.nPhiBinBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "NPhiBinBH"));
1692  php.layerFrontBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "LayerFrontBH"));
1693  php.rMinLayerBH_ = fv.get<std::vector<double> >(sdTag1, "RMinLayerBH");
1695  php.nCellsFine_ = php.nPhiBinBH_[0];
1696  php.nCellsCoarse_ = php.nPhiBinBH_[1];
1697  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
1698  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
1699 
1700  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
1701  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
1703  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
1705 
1706  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
1707  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
1709  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
1711  unsigned int kmax = (php.zFrontTop_.size() - php.slopeTop_.size());
1712  for (unsigned int k = 0; k < kmax; ++k)
1713  php.slopeTop_.emplace_back(0);
1714 
1715  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
1716  php.layerOffset_ = dummy2[0];
1717 
1718  loadSpecParsTrapezoid(php);
1719 
1720  // tile parameters from Katja's file
1722  std::vector<int> tileIndx, tileProperty;
1723  std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1724  std::vector<double> tileRMin, tileRMax;
1725  std::vector<int> tileRingMin, tileRingMax;
1726  std::vector<double> cassetteShift;
1727  for (auto const& it : vmap) {
1728  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileIndex")) {
1729  for (const auto& i : it.second)
1730  tileIndx.emplace_back(std::round(i));
1731  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileProperty")) {
1732  for (const auto& i : it.second)
1733  tileProperty.emplace_back(std::round(i));
1734  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX1")) {
1735  for (const auto& i : it.second)
1736  tileHEX1.emplace_back(std::round(i));
1737  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX2")) {
1738  for (const auto& i : it.second)
1739  tileHEX2.emplace_back(std::round(i));
1740  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX3")) {
1741  for (const auto& i : it.second)
1742  tileHEX3.emplace_back(std::round(i));
1743  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileHEX4")) {
1744  for (const auto& i : it.second)
1745  tileHEX4.emplace_back(std::round(i));
1746  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRMin")) {
1747  for (const auto& i : it.second)
1748  tileRMin.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1749  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRMax")) {
1750  for (const auto& i : it.second)
1751  tileRMax.emplace_back(HGCalParameters::k_ScaleFromDD4hep * i);
1752  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRingMin")) {
1753  for (const auto& i : it.second)
1754  tileRingMin.emplace_back(std::round(i));
1755  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "TileRingMax")) {
1756  for (const auto& i : it.second)
1757  tileRingMax.emplace_back(std::round(i));
1758  }
1759  }
1760  if (php.waferMaskMode_ == scintillatorCassette) {
1761  for (auto const& it : vmap) {
1762  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "CassetteShiftHE")) {
1763  for (const auto& i : it.second)
1764  cassetteShift.emplace_back(i);
1765  }
1766  }
1767  }
1768 
1770  php.cassetteShift_ = cassetteShift;
1772  tileIndx,
1773  tileProperty,
1774  tileHEX1,
1775  tileHEX2,
1776  tileHEX3,
1777  tileHEX4,
1778  tileRMin,
1779  tileRMax,
1780  tileRingMin,
1781  tileRingMax);
1782  }
1783 }
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 1785 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_.

1785  {
1786 #ifdef EDM_ML_DEBUG
1787  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters:nCells " << php.nCellsFine_ << ":" << php.nCellsCoarse_
1788  << " cellSize: " << php.cellSize_[0] << ":" << php.cellSize_[1];
1789  for (unsigned int k = 0; k < php.layerFrontBH_.size(); ++k)
1790  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Type[" << k << "] Front Layer = " << php.layerFrontBH_[k]
1791  << " rMin = " << php.rMinLayerBH_[k];
1792  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k) {
1793  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k]
1794  << " Nphi = " << php.scintCells(k + php.firstLayer_)
1795  << " dPhi = " << php.scintCellSize(k + php.firstLayer_);
1796  }
1797 
1798  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
1799  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
1800  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
1801 
1802  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
1803  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
1804  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
1805 
1806  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
1807  << php.zRanges_[2] << ":" << php.zRanges_[3];
1808 
1809  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: LayerOffset " << php.layerOffset_ << " in array of size "
1810  << php.layerCenter_.size();
1811  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
1812  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
1813 #endif
1814 }
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 1816 of file HGCalGeomParameters.cc.

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

1826  {
1827  // tile parameters from Katja's file
1828  for (unsigned int k = 0; k < tileIndx.size(); ++k) {
1831  tileHEX1[k],
1832  tileHEX2[k],
1833  tileHEX3[k],
1834  tileHEX4[k]);
1835 #ifdef EDM_ML_DEBUG
1836  edm::LogVerbatim("HGCalGeom") << "Tile[" << k << ":" << tileIndx[k] << "] "
1837  << " Type " << HGCalProperty::tileType(tileProperty[k]) << " SiPM "
1838  << HGCalProperty::tileSiPM(tileProperty[k]) << " HEX " << std::hex << tileHEX1[k]
1839  << ":" << tileHEX2[k] << ":" << tileHEX3[k] << ":" << tileHEX4[k] << std::dec;
1840 #endif
1841  }
1842 
1843  for (unsigned int k = 0; k < tileRMin.size(); ++k) {
1844  php.tileRingR_.emplace_back(tileRMin[k], tileRMax[k]);
1845 #ifdef EDM_ML_DEBUG
1846  edm::LogVerbatim("HGCalGeom") << "TileRingR[" << k << "] " << tileRMin[k] << ":" << tileRMax[k];
1847 #endif
1848  }
1849 
1850  for (unsigned k = 0; k < tileRingMin.size(); ++k) {
1851  php.tileRingRange_.emplace_back(tileRingMin[k], tileRingMax[k]);
1852 #ifdef EDM_ML_DEBUG
1853  edm::LogVerbatim("HGCalGeom") << "TileRingRange[" << k << "] " << tileRingMin[k] << ":" << tileRingMax[k];
1854 #endif
1855  }
1856 }
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 1858 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_, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::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.

1858  {
1860  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
1861 #ifdef EDM_ML_DEBUG
1862  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << rmin << " R Limits: " << rin << ":" << rout
1863  << " Fine " << rMaxFine;
1864 #endif
1865  // Clear the vectors
1866  php.waferCopy_.clear();
1867  php.waferTypeL_.clear();
1868  php.waferTypeT_.clear();
1869  php.waferPosX_.clear();
1870  php.waferPosY_.clear();
1871  double dx = 0.5 * waferW;
1872  double dy = 3.0 * dx * tan(30._deg);
1873  double rr = 2.0 * dx * tan(30._deg);
1874  int ncol = static_cast<int>(2.0 * rout / waferW) + 1;
1875  int nrow = static_cast<int>(rout / (waferW * tan(30._deg))) + 1;
1876  int ns2 = (2 * ncol + 1) * (2 * nrow + 1) * php.layer_.size();
1877  int incm(0), inrm(0);
1878  HGCalParameters::layer_map copiesInLayers(php.layer_.size() + 1);
1879  HGCalParameters::waferT_map waferTypes(ns2 + 1);
1880 #ifdef EDM_ML_DEBUG
1881  int kount(0), ntot(0);
1882  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
1883 #endif
1884  for (int nr = -nrow; nr <= nrow; ++nr) {
1885  int inr = (nr >= 0) ? nr : -nr;
1886  for (int nc = -ncol; nc <= ncol; ++nc) {
1887  int inc = (nc >= 0) ? nc : -nc;
1888  if (inr % 2 == inc % 2) {
1889  double xpos = nc * dx;
1890  double ypos = nr * dy;
1891  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
1892  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
1893  int typet = (rpos < rMaxFine) ? 1 : 2;
1894  int typel(3);
1895  for (int k = 1; k < 4; ++k) {
1896  if ((rpos + rmin) <= php.boundR_[k]) {
1897  typel = k;
1898  break;
1899  }
1900  }
1901 #ifdef EDM_ML_DEBUG
1902  ++ntot;
1903 #endif
1904  if (corner.first > 0) {
1905  int copy = HGCalTypes::packTypeUV(typel, nc, nr);
1906  if (inc > incm)
1907  incm = inc;
1908  if (inr > inrm)
1909  inrm = inr;
1910 #ifdef EDM_ML_DEBUG
1911  kount++;
1912  edm::LogVerbatim("HGCalGeom") << kount << ":" << ntot << " Copy " << copy << " Type " << typel << ":" << typet
1913  << " Location " << corner.first << " Position " << xpos << ":" << ypos
1914  << " Layers " << php.layer_.size();
1915 #endif
1916  php.waferCopy_.emplace_back(copy);
1917  php.waferTypeL_.emplace_back(typel);
1918  php.waferTypeT_.emplace_back(typet);
1919  php.waferPosX_.emplace_back(xpos);
1920  php.waferPosY_.emplace_back(ypos);
1921  for (unsigned int il = 0; il < php.layer_.size(); ++il) {
1922  std::pair<int, int> corner =
1923  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, php.rMinLayHex_[il], php.rMaxLayHex_[il], true);
1924  if (corner.first > 0) {
1925  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
1926  if (cpy == copiesInLayers[php.layer_[il]].end())
1927  copiesInLayers[php.layer_[il]][copy] =
1928  ((corner.first == static_cast<int>(HGCalParameters::k_CornerSize)) ? php.waferCopy_.size() : -1);
1929  }
1930  if ((corner.first > 0) && (corner.first < static_cast<int>(HGCalParameters::k_CornerSize))) {
1931  int wl = HGCalWaferIndex::waferIndex(php.layer_[il], copy, 0, true);
1932  waferTypes[wl] = corner;
1933  }
1934  }
1935  }
1936  }
1937  }
1938  }
1939  php.copiesInLayers_ = copiesInLayers;
1940  php.waferTypes_ = waferTypes;
1941  php.nSectors_ = static_cast<int>(php.waferCopy_.size());
1942  php.waferUVMax_ = 0;
1943 #ifdef EDM_ML_DEBUG
1944  edm::LogVerbatim("HGCalGeom") << "HGCalWaferHexagon: # of columns " << incm << " # of rows " << inrm << " and "
1945  << kount << ":" << ntot << " wafers; R " << rin << ":" << rout;
1946  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
1947  for (unsigned int k = 0; k < copiesInLayers.size(); ++k) {
1948  const auto& theModules = copiesInLayers[k];
1949  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
1950  int k2(0);
1951  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
1952  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
1953  }
1954  }
1955 #endif
1956 }
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_
std::vector< std::unordered_map< int32_t, int32_t > > layer_map

◆ loadWaferHexagon8()

void HGCalGeomParameters::loadWaferHexagon8 ( HGCalParameters php)

Definition at line 1958 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, PVValHelper::dz, HGCalParameters::hgtrap::dz, HGCalParameters::fillModule(), HGCalParameters::fracAreaMin_, geomTools_, HGCalParameters::getModule(), HGCalWaferMask::getTypeMode(), HGCalWaferMask::goodTypeMode(), HGCalParameters::hgtrap::h, HGCalGeometryMode::Hexagon8CalibCell, 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_.

1958  {
1959  double waferW(php.waferSize_);
1960  double waferS(php.sensorSeparation_);
1961  auto wType = std::make_unique<HGCalWaferType>(php.radius100to200_,
1962  php.radius200to300_,
1963  HGCalParameters::k_ScaleToDDD * (waferW + waferS),
1965  php.choiceType_,
1966  php.nCornerCut_,
1967  php.fracAreaMin_);
1968 
1969  double rout(php.rLimit_[1]);
1970 #ifdef EDM_ML_DEBUG
1971  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << waferS << " R Max: " << rout;
1972 #endif
1973  // Clear the vectors
1974  php.waferCopy_.clear();
1975  php.waferTypeL_.clear();
1976  php.waferTypeT_.clear();
1977  php.waferPosX_.clear();
1978  php.waferPosY_.clear();
1979  double r = 0.5 * (waferW + waferS);
1980  double R = 2.0 * r / sqrt3_;
1981  double dy = 0.75 * R;
1982  double r1 = 0.5 * waferW;
1983  double R1 = 2.0 * r1 / sqrt3_;
1984  int N = (r == 0) ? 3 : (static_cast<int>(0.5 * rout / r) + 3);
1985  int ns1 = (2 * N + 1) * (2 * N + 1);
1986  int ns2 = ns1 * php.zLayerHex_.size();
1987 #ifdef EDM_ML_DEBUG
1988  edm::LogVerbatim("HGCalGeom") << "wafer " << waferW << ":" << waferS << " r " << r << " dy " << dy << " N " << N
1989  << " sizes " << ns1 << ":" << ns2;
1990  std::vector<int> indtypes(ns1 + 1);
1991  indtypes.clear();
1992 #endif
1993  HGCalParameters::wafer_map wafersInLayers(ns1 + 1);
1994  HGCalParameters::wafer_map typesInLayers(ns2 + 1);
1995  HGCalParameters::waferT_map waferTypes(ns2 + 1);
1996  int ipos(0), lpos(0), uvmax(0), nwarn(0);
1997  std::vector<int> uvmx(php.zLayerHex_.size(), 0);
1998  for (int v = -N; v <= N; ++v) {
1999  for (int u = -N; u <= N; ++u) {
2000  int nr = 2 * v;
2001  int nc = -2 * u + v;
2002  double xpos = nc * r;
2003  double ypos = nr * dy;
2004  int indx = HGCalWaferIndex::waferIndex(0, u, v);
2005  php.waferCopy_.emplace_back(indx);
2006  php.waferPosX_.emplace_back(xpos);
2007  php.waferPosY_.emplace_back(ypos);
2008  wafersInLayers[indx] = ipos;
2009  ++ipos;
2010  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, r1, R1, 0, rout, false);
2011  if ((corner.first == static_cast<int>(HGCalParameters::k_CornerSize)) ||
2012  ((corner.first > 0) && php.defineFull_)) {
2013  uvmax = std::max(uvmax, std::max(std::abs(u), std::abs(v)));
2014  }
2015  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
2016  int copy = i + php.layerOffset_;
2017  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], (waferW + waferS));
2018  int lay = php.layer_[php.layerIndex_[i]];
2019  double xpos0 = xpos + xyoff.first;
2020  double ypos0 = ypos + xyoff.second;
2021  double zpos = php.zLayerHex_[i];
2022  int kndx = HGCalWaferIndex::waferIndex(lay, u, v);
2023  int type(-1);
2026  type = wType->getType(kndx, php.waferInfoMap_);
2027  if (type < 0)
2028  type = wType->getType(HGCalParameters::k_ScaleToDDD * xpos0,
2031  php.waferTypeL_.emplace_back(type);
2032  typesInLayers[kndx] = lpos;
2033  ++lpos;
2034 #ifdef EDM_ML_DEBUG
2035  indtypes.emplace_back(kndx);
2036 #endif
2037  std::pair<int, int> corner =
2038  HGCalGeomTools::waferCorner(xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], false);
2039 #ifdef EDM_ML_DEBUG
2040  if (((corner.first == 0) && std::abs(u) < 5 && std::abs(v) < 5) || (std::abs(u) < 2 && std::abs(v) < 2)) {
2041  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " R " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
2042  << " u " << u << " v " << v << " with " << corner.first << " corners";
2043  }
2044 #endif
2045  if ((corner.first == static_cast<int>(HGCalParameters::k_CornerSize)) ||
2046  ((corner.first > 0) && php.defineFull_)) {
2047  uvmx[i] = std::max(uvmx[i], std::max(std::abs(u), std::abs(v)));
2048  }
2049  if ((corner.first < static_cast<int>(HGCalParameters::k_CornerSize)) && (corner.first > 0)) {
2050 #ifdef EDM_ML_DEBUG
2051  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u << ":" << v << " with corner "
2052  << corner.first << ":" << corner.second;
2053 #endif
2054  int wl = HGCalWaferIndex::waferIndex(lay, u, v);
2055  if (php.waferMaskMode_ > 0) {
2056  bool v17OrLess = (php.mode_ < HGCalGeometryMode::Hexagon8CalibCell);
2057  std::pair<int, int> corner0 = HGCalWaferMask::getTypeMode(
2058  xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], type, php.waferMaskMode_, v17OrLess);
2062  auto itr = php.waferInfoMap_.find(wl);
2063  if (itr != php.waferInfoMap_.end()) {
2064  int part = (itr->second).part;
2065  int orient = (itr->second).orient;
2066  bool ok = ((php.mode_ == HGCalGeometryMode::Hexagon8Cassette) ||
2068  ? true
2070  xpos0, ypos0, r1, R1, php.rMinLayHex_[i], php.rMaxLayHex_[i], part, orient, false);
2071  if (ok)
2072  corner0 = std::make_pair(part, (HGCalTypes::k_OffsetRotation + orient));
2073 #ifdef EDM_ML_DEBUG
2074  edm::LogVerbatim("HGCalGeom")
2075  << "Layer:u:v " << i << ":" << lay << ":" << u << ":" << v << " Part " << corner0.first << ":"
2076  << part << " Orient " << corner0.second << ":" << orient << " Position " << xpos0 << ":" << ypos0
2077  << " delta " << r1 << ":" << R1 << " Limit " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
2078  << " Compatibiliety Flag " << ok;
2079 #endif
2080  if (!ok)
2081  ++nwarn;
2082  }
2083  }
2084  waferTypes[wl] = corner0;
2085 #ifdef EDM_ML_DEBUG
2086  edm::LogVerbatim("HGCalGeom")
2087  << "Layer " << lay << " u|v " << u << ":" << v << " Index " << std::hex << wl << std::dec << " pos "
2088  << xpos0 << ":" << ypos0 << " R " << r1 << ":" << R1 << " Range " << php.rMinLayHex_[i] << ":"
2089  << php.rMaxLayHex_[i] << type << ":" << php.waferMaskMode_ << " corner " << corner.first << ":"
2090  << corner.second << " croner0 " << corner0.first << ":" << corner0.second;
2091 #endif
2092  } else {
2093  waferTypes[wl] = corner;
2094 #ifdef EDM_ML_DEBUG
2095  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u << ":" << v << " with corner "
2096  << corner.first << ":" << corner.second;
2097 #endif
2098  }
2099  }
2100  }
2101  }
2102  }
2103  if (nwarn > 0)
2104  edm::LogWarning("HGCalGeom") << "HGCalGeomParameters::loadWafer8: there are " << nwarn
2105  << " wafers with non-matching partial- orientation types";
2106  php.waferUVMax_ = uvmax;
2107  php.waferUVMaxLayer_ = uvmx;
2108  php.wafersInLayers_ = wafersInLayers;
2109  php.typesInLayers_ = typesInLayers;
2110  php.waferTypes_ = waferTypes;
2111  php.nSectors_ = static_cast<int>(php.waferCopy_.size());
2113  mytr.lay = 1;
2114  mytr.bl = php.waferR_;
2115  mytr.tl = php.waferR_;
2116  mytr.h = php.waferR_;
2117  mytr.alpha = 0.0;
2119  for (auto const& dz : php.cellThickness_) {
2120  mytr.dz = 0.5 * HGCalParameters::k_ScaleToDDD * dz;
2121  php.fillModule(mytr, false);
2122  }
2123  for (unsigned k = 0; k < php.cellThickness_.size(); ++k) {
2124  HGCalParameters::hgtrap mytr = php.getModule(k, false);
2130  php.fillModule(mytr, true);
2131  }
2132 #ifdef EDM_ML_DEBUG
2133  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Total of " << php.waferCopy_.size() << " wafers";
2134  for (unsigned int k = 0; k < php.waferCopy_.size(); ++k) {
2135  int id = php.waferCopy_[k];
2136  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << std::hex << id << std::dec << ":"
2137  << HGCalWaferIndex::waferLayer(id) << ":" << HGCalWaferIndex::waferU(id) << ":"
2138  << HGCalWaferIndex::waferV(id) << " x " << php.waferPosX_[k] << " y "
2139  << php.waferPosY_[k] << " index " << php.wafersInLayers_[id];
2140  }
2141  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Total of " << php.waferTypeL_.size() << " wafer types";
2142  for (unsigned int k = 0; k < php.waferTypeL_.size(); ++k) {
2143  int id = indtypes[k];
2144  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.typesInLayers_[id] << ":" << php.waferTypeL_[k] << " ID "
2145  << std::hex << id << std::dec << ":" << HGCalWaferIndex::waferLayer(id) << ":"
2146  << HGCalWaferIndex::waferU(id) << ":" << HGCalWaferIndex::waferV(id);
2147  }
2148 #endif
2149 
2150  //Wafer offset
2151  php.xLayerHex_.clear();
2152  php.yLayerHex_.clear();
2153  double waferSize = php.waferSize_ + php.sensorSeparation_;
2154 #ifdef EDM_ML_DEBUG
2155  edm::LogVerbatim("HGCalGeom") << "WaferSize " << waferSize;
2156 #endif
2157  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
2158  int copy = k + php.layerOffset_;
2159  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], waferSize);
2160  php.xLayerHex_.emplace_back(xyoff.first);
2161  php.yLayerHex_.emplace_back(xyoff.second);
2162 #ifdef EDM_ML_DEBUG
2163  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Off " << copy << ":" << php.layerCenter_[copy] << " Shift "
2164  << xyoff.first << ":" << xyoff.second;
2165 #endif
2166  }
2167 }
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:93
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
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_
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, const bool &v17, const bool &debug=false)
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
static bool goodTypeMode(const double &xpos, const double &ypos, const double &delX, const double &delY, const double &rin, const double &rout, const int &part, const int &rotn, const bool &v17, const bool &debug=false)
#define N
Definition: blowfish.cc:9
std::vector< double > cellThickness_
std::unordered_map< int32_t, int32_t > wafer_map
part
Definition: HCALResponse.h:20
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 2431 of file HGCalGeomParameters.cc.

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

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

2431  {
2432  std::for_each(v.begin(), v.end(), [s](double& n) { n *= s; });
2433 }

◆ resetZero()

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

Definition at line 2435 of file HGCalGeomParameters.cc.

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

2435  {
2436  for (auto& n : v) {
2437  if (std::abs(n) < tolmin)
2438  n = 0;
2439  }
2440 }
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