CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | 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 loadCellTrapezoid (HGCalParameters &php)
 
void loadGeometryHexagon (const DDFilteredView &, HGCalParameters &, const std::string &, const DDCompactView *, const std::string &, const std::string &, HGCalGeometryMode::WaferMode)
 
void loadGeometryHexagon8 (const DDFilteredView &, HGCalParameters &, int)
 
void loadSpecParsHexagon (const DDFilteredView &, HGCalParameters &, const DDCompactView *, const std::string &, const std::string &)
 
void loadSpecParsHexagon8 (const DDFilteredView &, HGCalParameters &)
 
void loadSpecParsTrapezoid (const DDFilteredView &, HGCalParameters &)
 
void loadWaferHexagon (HGCalParameters &php)
 
void loadWaferHexagon8 (HGCalParameters &php)
 
 ~HGCalGeomParameters ()
 

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 &, const DDsvalues_type &, const int)
 

Private Attributes

const double sqrt3_
 
double waferSize_
 

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 28 of file HGCalGeomParameters.h.

Constructor & Destructor Documentation

HGCalGeomParameters::HGCalGeomParameters ( )

Definition at line 29 of file HGCalGeomParameters.cc.

29  : sqrt3_(std::sqrt(3.0)) {
30 #ifdef EDM_ML_DEBUG
31  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters::HGCalGeomParameters "
32  << "constructor";
33 #endif
34 }
T sqrt(T t)
Definition: SSEVec.h:18
HGCalGeomParameters::~HGCalGeomParameters ( )

Definition at line 36 of file HGCalGeomParameters.cc.

36  {
37 #ifdef EDM_ML_DEBUG
38  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters::destructed!!!";
39 #endif
40 }

Member Function Documentation

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

Definition at line 1278 of file HGCalGeomParameters.cc.

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

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), and loadGeometryHexagon().

1280  {
1281 
1282  if (itrf == wafers.end()) {
1283  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin();
1284  itr != wafers.end(); ++itr) {
1285  if (itr->wafer == wafer) {
1286  itrf = itr;
1287  break;
1288  }
1289  }
1290  }
1291  double dx(0), dy(0);
1292  if (itrf != wafers.end()) {
1293  dx = (xx - itrf->xyz.x());
1294  if (std::abs(dx) < tolerance) dx = 0;
1295  dy = (yy - itrf->xyz.y());
1296  if (std::abs(dy) < tolerance) dy = 0;
1297  }
1298  return std::make_pair(dx,dy);
1299 }
const double tolerance
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > HGCalGeomParameters::getDDDArray ( const std::string &  str,
const DDsvalues_type sv,
const int  nmin 
)
private

Definition at line 1243 of file HGCalGeomParameters.cc.

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

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), loadSpecParsHexagon(), loadSpecParsHexagon8(), and loadSpecParsTrapezoid().

1245  {
1246  DDValue value(str);
1247  if (DDfetch(&sv,value)) {
1248  const std::vector<double> & fvec = value.doubles();
1249  int nval = fvec.size();
1250  if (nmin > 0) {
1251  if (nval < nmin) {
1252  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
1253  << " bins " << nval << " < " << nmin
1254  << " ==> illegal";
1255  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1256  }
1257  } else {
1258  if (nval < 1 && nmin == 0) {
1259  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
1260  << " bins " << nval << " < 1 ==> illegal"
1261  << " (nmin=" << nmin << ")";
1262  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1263  }
1264  }
1265  return fvec;
1266  } else {
1267  if (nmin >= 0) {
1268  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
1269  << str;
1270  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1271  }
1272  std::vector<double> fvec;
1273  return fvec;
1274  }
1275 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
#define str(s)
void HGCalGeomParameters::loadCellParsHexagon ( const DDCompactView cpv,
HGCalParameters php 
)

Definition at line 1080 of file HGCalGeomParameters.cc.

References HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, dbl_to_int(), DDFilteredView::firstChild(), DDVectorGetter::get(), gen::k, convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HGCalParametersFromDD::build().

1081  {
1082 
1083  //Special parameters for cell parameters
1084  std::string attribute = "OnlyForHGCalNumbering";
1085  DDSpecificsHasNamedValueFilter filter1{attribute};
1086  DDFilteredView fv1(*cpv,filter1);
1087  bool ok = fv1.firstChild();
1088 
1089  if (ok) {
1090  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
1091  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
1092  }
1093 
1094 #ifdef EDM_ML_DEBUG
1095  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: "
1096  << php.cellFine_.size()
1097  << " rows for fine cells";
1098  for (unsigned int k=0; k<php.cellFine_.size(); ++k)
1099  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
1100  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: "
1101  << php.cellCoarse_.size()
1102  << " rows for coarse cells";
1103  for (unsigned int k=0; k<php.cellCoarse_.size(); ++k)
1104  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
1105 #endif
1106 }
std::vector< int > cellFine_
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< int > cellCoarse_
std::vector< double > get(const std::string &)
int k[5][pyjets_maxn]
void HGCalGeomParameters::loadCellTrapezoid ( HGCalParameters php)

Definition at line 1108 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, createfilelist::int, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, GetRecoTauVFromDQM_MC_cff::kk, HGCalParameters::lastModule_, HGCalParameters::hgtrap::lay, HGCalParameters::layerFrontBH_, cmsBatch::log, HGCalParameters::minTileSize_, HGCalParameters::nSectors_, HGCalParameters::radiusLayer_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayerBH_, HGCalParameters::rMinLayHex_, HGCalParameters::scintCellSize(), HGCalParameters::scintType(), funct::tan(), HGCalParameters::hgtrap::tl, HGCalParameters::waferThick_, HGCalParameters::waferUVMax_, and HGCalParameters::zLayerHex_.

Referenced by HGCalParametersFromDD::build().

1108  {
1109  // Find the radius of each eta-partitions
1110  for (unsigned k=0; k<2; ++k) {
1111  double rmax = ((k == 0) ?
1112  (php.rMaxLayHex_[php.layerFrontBH_[1]-php.firstLayer_]-1) :
1113  (php.rMaxLayHex_[php.rMaxLayHex_.size()-1]));
1114  double rv = php.rMinLayerBH_[k];
1115  double zv = ((k == 0) ?
1116  (php.zLayerHex_[php.layerFrontBH_[1]-php.firstLayer_]) :
1117  (php.zLayerHex_[php.zLayerHex_.size()-1]));
1118  php.radiusLayer_[k].emplace_back(rv);
1119 #ifdef EDM_ML_DEBUG
1120  double eta =-(std::log(std::tan(0.5*std::atan(rv/zv))));
1121  edm::LogVerbatim("HGCalGeom") << "[" << k << "] rmax " << rmax << " Z = "
1122  << zv << " dEta = " << php.cellSize_[k]
1123  << "\n[0] new R = " << rv << " Eta = "
1124  << eta;
1125  int kount(1);
1126 #endif
1127  while (rv < rmax) {
1128  double eta =-(php.cellSize_[k]+std::log(std::tan(0.5*std::atan(rv/zv))));
1129  rv = zv*std::tan(2.0*std::atan(std::exp(-eta)));
1130  php.radiusLayer_[k].emplace_back(rv);
1131 #ifdef EDM_ML_DEBUG
1132  edm::LogVerbatim("HGCalGeom") << "[" << kount << "] new R = " << rv
1133  << " Eta = " << eta;
1134  ++kount;
1135 #endif
1136  }
1137  }
1138 
1139  // Find minimum and maximum radius index for each layer
1140  for (unsigned k=0; k<php.zLayerHex_.size(); ++k) {
1141  int kk = php.scintType(php.firstLayer_+(int)(k));
1142  std::vector<double>::iterator low, high;
1143  low = std::lower_bound(php.radiusLayer_[kk].begin(),
1144  php.radiusLayer_[kk].end(),
1145  php.rMinLayHex_[k]);
1146 #ifdef EDM_ML_DEBUG
1147  edm::LogVerbatim("HGCalGeom") << "[" << k << "] RLow = "
1148  << php.rMinLayHex_[k] << " pos "
1149  << (int)(low-php.radiusLayer_[kk].begin());
1150 #endif
1151  if (low == php.radiusLayer_[kk].begin()) ++low;
1152  int irlow = (int)(low-php.radiusLayer_[kk].begin());
1153  double drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
1154 #ifdef EDM_ML_DEBUG
1155  edm::LogVerbatim("HGCalGeom") << "irlow " << irlow << " dr " << drlow
1156  << " min " << php.minTileSize_;
1157 #endif
1158  if (drlow < php.minTileSize_) {
1159  ++irlow;
1160 #ifdef EDM_ML_DEBUG
1161  drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
1162  edm::LogVerbatim("HGCalGeom") << "Modified irlow " << irlow << " dr "
1163  << drlow;
1164 #endif
1165  }
1166  high = std::lower_bound(php.radiusLayer_[kk].begin(),
1167  php.radiusLayer_[kk].end(),
1168  php.rMaxLayHex_[k]);
1169 #ifdef EDM_ML_DEBUG
1170  edm::LogVerbatim("HGCalGeom") << "[" << k << "] RHigh = "
1171  << php.rMaxLayHex_[k] << " pos "
1172  << (int)(high-php.radiusLayer_[kk].begin());
1173 #endif
1174  if (high == php.radiusLayer_[kk].end()) --high;
1175  int irhigh = (int)(high-php.radiusLayer_[kk].begin());
1176  double drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh-1];
1177 #ifdef EDM_ML_DEBUG
1178  edm::LogVerbatim("HGCalGeom") << "irhigh " << irhigh << " dr " << drhigh
1179  << " min " << php.minTileSize_;
1180 #endif
1181  if (drhigh < php.minTileSize_) {
1182  --irhigh;
1183 #ifdef EDM_ML_DEBUG
1184  drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh-1];
1185  edm::LogVerbatim("HGCalGeom") << "Modified irhigh " << irhigh << " dr "
1186  << drhigh;
1187 #endif
1188  }
1189  php.iradMinBH_.emplace_back(irlow);
1190  php.iradMaxBH_.emplace_back(irhigh);
1191 #ifdef EDM_ML_DEBUG
1192  edm::LogVerbatim("HGcalGeom") << "Layer " << k << " Type " << kk
1193  << " Low edge " << irlow << ":" << drlow
1194  << " Top edge " << irhigh << ":" << drhigh;
1195 #endif
1196  }
1197 
1198  // Now define the volumes
1199  int im(0);
1200  php.waferUVMax_ = 0;
1202  mytr.alpha = 0.0;
1203  for (unsigned int k=0; k<php.zLayerHex_.size(); ++k) {
1204  if (php.iradMaxBH_[k] > php.waferUVMax_) php.waferUVMax_ = php.iradMaxBH_[k];
1205  int kk = ((php.firstLayer_+(int)(k)) < php.layerFrontBH_[1]) ? 0 : 1;
1206 #ifdef EDM_ML_DEBUG
1207  edm::LogVerbatim("HGCalGeom") << "Layer " << php.firstLayer_+k << ":"
1208  << kk << " Radius range "
1209  << php.iradMinBH_[k] << ":"
1210  << php.iradMaxBH_[k];
1211 #endif
1212  mytr.lay = php.firstLayer_ + k;
1213  for (int irad=php.iradMinBH_[k]; irad<=php.iradMaxBH_[k]; ++irad) {
1214  double rmin = php.radiusLayer_[kk][irad-1];
1215  double rmax = php.radiusLayer_[kk][irad];
1216  mytr.bl = 0.5*rmin*php.scintCellSize(mytr.lay);
1217  mytr.tl = 0.5*rmax*php.scintCellSize(mytr.lay);
1218  mytr.h = 0.5*(rmax-rmin);
1219  mytr.dz = 0.5*php.waferThick_;
1220  mytr.cellSize = 0.5*(rmax+rmin)*php.scintCellSize(mytr.lay);
1221  php.fillModule(mytr,true);
1227  php.fillModule(mytr, false);
1228  if (irad == php.iradMinBH_[k]) php.firstModule_.emplace_back(im);
1229  ++im;
1230  if (irad == php.iradMaxBH_[k]-1) php.lastModule_.emplace_back(im);
1231  }
1232  }
1233  php.nSectors_ = php.waferUVMax_;
1234 #ifdef EDM_ML_DEBUG
1235  edm::LogVerbatim("HGCalGeom") << "Maximum radius index " << php.waferUVMax_;
1236  for (unsigned int k=0; k< php.firstModule_.size(); ++k)
1237  edm::LogVerbatim("HGCalGeom") << "Layer " << k+php.firstLayer_
1238  << " Modules " << php.firstModule_[k]
1239  << ":" << php.lastModule_[k];
1240 #endif
1241 }
std::vector< int > iradMaxBH_
int scintType(const int layer) const
double scintCellSize(const int layer) const
std::vector< double > rMinLayerBH_
std::vector< int > firstModule_
std::vector< double > cellSize_
static double k_ScaleFromDDD
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_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
std::vector< int > lastModule_
static double k_ScaleToDDD
std::vector< int > iradMinBH_
std::vector< int > layerFrontBH_
std::vector< double > radiusLayer_[2]
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 42 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::addTrForm(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::boundR_, HGCalParameters::cellCoarseHalf_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineHalf_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellPosition(), HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, HGCalParameters::copiesInLayers_, popcon2dropbox::copy(), DDFilteredView::copyNumbers(), funct::cos(), SimDataFormats::CaloAnalysis::cp, TauDecayModes::dec, egammaForCoreTracking_cff::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, DDFilteredView::firstChild(), HGCalParameters::firstLayer_, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerGroup_, HGCalParameters::layerIndex_, LayerTriplets::layers(), DDFilteredView::logicalPart(), HGCalParameters::moduleAlphaR_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleBlS_, HGCalParameters::moduleDzR_, HGCalParameters::moduleDzS_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, HGCalParameters::moduleLayR_, HGCalParameters::moduleLayS_, HGCalParameters::moduleTlR_, HGCalParameters::moduleTlS_, DDName::name(), dataset::name, DDBase< N, C >::name(), names, DDFilteredView::next(), HGCalParameters::nSectors_, convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, p1, p2, HGCalGeometryMode::Polyhedra, alignCSCRings::r, DDTubs::rIn(), HGCalParameters::rMaxLayHex_, DDPolyhedra::rMaxVec(), HGCalParameters::rMinLayHex_, idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::scaleTrForm(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrap::tl, tolerance, DDFilteredView::translation(), 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_, waferSize_, HGCalParameters::waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, x, DDExtrudedPolygon::xVec(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, y, geometryCSVtoXML::yy, z, HGCalParameters::zLayerHex_, HGCalParameters::hgtrform::zp, DDPolyhedra::zVec(), and DDExtrudedPolygon::zVec().

Referenced by HGCalParametersFromDD::build().

48  {
49 
50  DDFilteredView fv = _fv;
51  bool dodet(true);
52  std::map<int,HGCalGeomParameters::layerParameters> layers;
53  std::vector<HGCalParameters::hgtrform> trforms;
54  std::vector<bool> trformUse;
55 
56  while (dodet) {
57  const DDSolid & sol = fv.logicalPart().solid();
58  // Layers first
59  std::vector<int> copy = fv.copyNumbers();
60  int nsiz = (int)(copy.size());
61  int lay = (nsiz > 0) ? copy[nsiz-1] : 0;
62  int zp = (nsiz > 2) ? copy[nsiz-3] : -1;
63  if (zp != 1) zp = -1;
64  if (lay == 0) {
65  throw cms::Exception("DDException") << "Funny layer # " << lay << " zp "
66  << zp << " in " << nsiz
67  << " components";
68  } else {
69  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
70  php.layer_.end()) php.layer_.emplace_back(lay);
71  auto itr = layers.find(lay);
72  if (itr == layers.end()) {
73  const DDTubs & tube = static_cast<DDTubs>(sol);
74  double rin = HGCalParameters::k_ScaleFromDDD*tube.rIn();
75  double rout= HGCalParameters::k_ScaleFromDDD*tube.rOut();
76  double zp = HGCalParameters::k_ScaleFromDDD*fv.translation().Z();
77  HGCalGeomParameters::layerParameters laypar(rin,rout,zp);
78  layers[lay] = laypar;
79  }
80  DD3Vector x, y, z;
81  fv.rotation().GetComponents( x, y, z ) ;
82  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
83  x.Y(), y.Y(), z.Y(),
84  x.Z(), y.Z(), z.Z() );
85  const CLHEP::HepRotation hr ( rotation );
87  if (std::abs(xx) < tolerance) xx = 0;
89  if (std::abs(yy) < tolerance) yy = 0;
90  const CLHEP::Hep3Vector h3v ( xx, yy, fv.translation().Z() );
92  mytrf.zp = zp;
93  mytrf.lay = lay;
94  mytrf.sec = 0;
95  mytrf.subsec= 0;
96  mytrf.h3v = h3v;
97  mytrf.hr = hr;
98  trforms.emplace_back(mytrf);
99  trformUse.emplace_back(false);
100  }
101  dodet = fv.next();
102  }
103 
104  // Then wafers
105  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they were)
106  // to ensure that new copy numbers are always added
107  // to the end of the list.
108  std::unordered_map<int32_t,int32_t> copies;
109  HGCalParameters::layer_map copiesInLayers(layers.size()+1);
110  std::vector<int32_t> wafer2copy;
111  std::vector<HGCalGeomParameters::cellParameters> wafers;
112  std::string attribute = "Volume";
113  DDValue val1(attribute, sdTag2, 0.0);
114  DDSpecificsMatchesValueFilter filter1{val1};
115  DDFilteredView fv1(*cpv,filter1);
116  bool ok = fv1.firstChild();
117  if (!ok) {
118  edm::LogError("HGCalGeom") << " Attribute " << val1
119  << " not found but needed.";
120  throw cms::Exception("DDException") << "Attribute " << val1
121  << " not found but needed.";
122  } else {
123  dodet = true;
124  std::unordered_set<std::string> names;
125  while (dodet) {
126  const DDSolid & sol = fv1.logicalPart().solid();
127  const std::string & name = fv1.logicalPart().name().name();
128  std::vector<int> copy = fv1.copyNumbers();
129  int nsiz = (int)(copy.size());
130  int wafer = (nsiz > 0) ? copy[nsiz-1] : 0;
131  int layer = (nsiz > 1) ? copy[nsiz-2] : 0;
132  if (nsiz < 2) {
133  edm::LogError("HGCalGeom") << "Funny wafer # " << wafer << " in "
134  << nsiz << " components";
135  throw cms::Exception("DDException") << "Funny wafer # " << wafer;
136  } else {
137  auto itr = copies.find(wafer);
138  auto cpy = copiesInLayers[layer].find(wafer);
139  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
140  copiesInLayers[layer][wafer] = itr->second;
141  }
142  if (itr == copies.end()) {
143  copies[wafer] = wafer2copy.size();
144  copiesInLayers[layer][wafer] = wafer2copy.size();
145  double xx = HGCalParameters::k_ScaleFromDDD*fv1.translation().X();
146  if (std::abs(xx) < tolerance) xx = 0;
147  double yy = HGCalParameters::k_ScaleFromDDD*fv1.translation().Y();
148  if (std::abs(yy) < tolerance) yy = 0;
149  wafer2copy.emplace_back(wafer);
150  GlobalPoint p(xx,yy,HGCalParameters::k_ScaleFromDDD*fv1.translation().Z());
151  HGCalGeomParameters::cellParameters cell(false,wafer,p);
152  wafers.emplace_back(cell);
153  if ( names.count(name) == 0 ) {
154  std::vector<double> zv, rv;
156  const DDPolyhedra & polyhedra = static_cast<DDPolyhedra>(sol);
157  zv = polyhedra.zVec();
158  rv = polyhedra.rMaxVec();
159  } else {
160  const DDExtrudedPolygon & polygon = static_cast<DDExtrudedPolygon>(sol);
161  zv = polygon.zVec();
162  rv = polygon.xVec();
163  }
164  php.waferR_ = rv[0]/std::cos(30.0*CLHEP::deg);
166  double dz = 0.5*(zv[1]-zv[0]);
167 #ifdef EDM_ML_DEBUG
168  edm::LogVerbatim("HGCalGeom") << "Mode " << mode << " R "
169  << php.waferSize_ << ":"
170  << php.waferR_ << " z " << dz;
171 #endif
173  mytr.lay = 1; mytr.bl = php.waferR_;
174  mytr.tl = php.waferR_; mytr.h = php.waferR_;
175  mytr.dz = dz; mytr.alpha = 0.0;
176  mytr.cellSize = waferSize_;
177  php.fillModule(mytr,false);
178  names.insert(name);
179  }
180  }
181  }
182  dodet = fv1.next();
183  }
184  }
185 
186  // Finally the cells
187  std::map<int,int> wafertype;
188  std::map<int,HGCalGeomParameters::cellParameters> cellsf, cellsc;
189  DDValue val2(attribute, sdTag3, 0.0);
190  DDSpecificsMatchesValueFilter filter2{val2};
191  DDFilteredView fv2(*cpv,filter2);
192  ok = fv2.firstChild();
193  if (!ok) {
194  edm::LogError("HGCalGeom") << " Attribute " << val2
195  << " not found but needed.";
196  throw cms::Exception("DDException") << "Attribute " << val2
197  << " not found but needed.";
198  } else {
199  dodet = true;
200  while (dodet) {
201  const DDSolid & sol = fv2.logicalPart().solid();
202  const std::string & name = sol.name().name();
203  std::vector<int> copy = fv2.copyNumbers();
204  int nsiz = (int)(copy.size());
205  int cellx= (nsiz > 0) ? copy[nsiz-1] : 0;
206  int wafer= (nsiz > 1) ? copy[nsiz-2] : 0;
207  int cell = cellx%1000;
208  int type = cellx/1000;
209  if (type != 1 && type != 2) {
210  edm::LogError("HGCalGeom") << "Funny cell # " << cell << " type "
211  << type << " in " << nsiz << " components";
212  throw cms::Exception("DDException") << "Funny cell # " << cell;
213  } else {
214  auto ktr = wafertype.find(wafer);
215  if (ktr == wafertype.end()) wafertype[wafer] = type;
216  bool newc(false);
217  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr;
218  double cellsize = php.cellSize_[0];
219  if (type == 1) {
220  itr = cellsf.find(cell);
221  newc= (itr == cellsf.end());
222  } else {
223  itr = cellsc.find(cell);
224  newc= (itr == cellsc.end());
225  cellsize = php.cellSize_[1];
226  }
227  if (newc) {
228  bool half = (name.find("Half") != std::string::npos);
229  double xx = HGCalParameters::k_ScaleFromDDD*fv2.translation().X();
230  double yy = HGCalParameters::k_ScaleFromDDD*fv2.translation().Y();
231  if (half) {
232  math::XYZPointD p1(-2.0*cellsize/9.0,0,0);
233  math::XYZPointD p2 = fv2.rotation()(p1);
234  xx += (HGCalParameters::k_ScaleFromDDD*(p2.X()));
235  yy += (HGCalParameters::k_ScaleFromDDD*(p2.Y()));
236 #ifdef EDM_ML_DEBUG
237  edm::LogVerbatim("HGCalGeom") << "Type " << type << " Cell "
238  << cellx << " local " << xx << ":"
239  << yy << " new " << p1 << ":"<< p2;
240 #endif
241  }
243  if (type == 1) {
244  cellsf[cell] = cp;
245  } else {
246  cellsc[cell] = cp;
247  }
248  }
249  }
250  dodet = fv2.next();
251  }
252  }
253 
254  if (((cellsf.size()+cellsc.size())==0) || (wafers.empty()) ||
255  (layers.empty())) {
256  edm::LogError("HGCalGeom") << "HGCalGeomParameters : number of cells "
257  << cellsf.size() << ":" << cellsc.size()
258  << " wafers " << wafers.size() << " layers "
259  << layers.size() << " illegal";
260  throw cms::Exception("DDException")
261  << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
262  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
263  << " layers " << layers.size();
264  }
265 
266  for (unsigned int i=0; i<layers.size(); ++i) {
267  for (auto & layer : layers) {
268  if (layer.first == (int)(i+php.firstLayer_)) {
269  php.layerIndex_.emplace_back(i);
270  php.rMinLayHex_.emplace_back(layer.second.rmin);
271  php.rMaxLayHex_.emplace_back(layer.second.rmax);
272  php.zLayerHex_.emplace_back(layer.second.zpos);
273  break;
274  }
275  }
276  }
277  for (unsigned int i=0; i<php.layer_.size(); ++i) {
278  for (unsigned int i1=0; i1<trforms.size(); ++i1) {
279  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay-1] ==
280  (int)(i+1)) {
281  trforms[i1].h3v *= HGCalParameters::k_ScaleFromDDD;
282  trforms[i1].lay = (i+1);
283  trformUse[i1] = true;
284  php.fillTrForm(trforms[i1]);
285  int nz(1);
286  for (unsigned int i2=i1+1; i2<trforms.size(); ++i2) {
287  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
288  php.layerGroup_[trforms[i2].lay-1] == (int)(i+1)) {
289  php.addTrForm(HGCalParameters::k_ScaleFromDDD*trforms[i2].h3v);
290  nz++;
291  trformUse[i2] = true;
292  }
293  }
294  if (nz > 0) {
295  php.scaleTrForm(double(1.0/nz));
296  }
297  }
298  }
299  }
300 
301  double rmin = HGCalParameters::k_ScaleFromDDD*php.waferR_;
302  for (unsigned i = 0; i < wafer2copy.size(); ++i ) {
303  php.waferCopy_.emplace_back(wafer2copy[i]);
304  php.waferPosX_.emplace_back(wafers[i].xyz.x());
305  php.waferPosY_.emplace_back(wafers[i].xyz.y());
306  auto ktr = wafertype.find(wafer2copy[i]);
307  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
308  php.waferTypeT_.emplace_back(typet);
309  double r = wafers[i].xyz.perp();
310  int type(3);
311  for (int k=1; k<4; ++k) {
312  if ((r+rmin)<=php.boundR_[k]) {
313  type = k; break;
314  }
315  }
316  php.waferTypeL_.emplace_back(type);
317  }
318  php.copiesInLayers_ = copiesInLayers;
319  php.nSectors_ = (int)(php.waferCopy_.size());
320 
321  std::vector<HGCalGeomParameters::cellParameters>::const_iterator itrf = wafers.end();
322  for (unsigned int i=0; i<cellsf.size(); ++i) {
323  auto itr = cellsf.find(i);
324  if (itr == cellsf.end()) {
325  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
326  << " fine cell number " << i;
327  throw cms::Exception("DDException")
328  << "HGCalGeomParameters: missing info for fine cell number " << i;
329  } else {
330  double xx = (itr->second).xyz.x();
331  double yy = (itr->second).xyz.y();
332  int waf= (itr->second).wafer;
333  std::pair<double,double> xy = cellPosition(wafers,itrf,waf,xx,yy);
334  php.cellFineX_.emplace_back(xy.first);
335  php.cellFineY_.emplace_back(xy.second);
336  php.cellFineHalf_.emplace_back((itr->second).half);
337  }
338  }
339  itrf = wafers.end();
340  for (unsigned int i=0; i<cellsc.size(); ++i) {
341  auto itr = cellsc.find(i);
342  if (itr == cellsc.end()) {
343  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
344  << " coarse cell number " << i;
345  throw cms::Exception("DDException")
346  << "HGCalGeomParameters: missing info for coarse cell number " << i;
347  } else {
348  double xx = (itr->second).xyz.x();
349  double yy = (itr->second).xyz.y();
350  int waf= (itr->second).wafer;
351  std::pair<double,double> xy = cellPosition(wafers,itrf,waf,xx,yy);
352  php.cellCoarseX_.emplace_back(xy.first);
353  php.cellCoarseY_.emplace_back(xy.second);
354  php.cellCoarseHalf_.emplace_back((itr->second).half);
355  }
356  }
357  int depth(0);
358  for (unsigned int i=0; i<php.layerGroup_.size(); ++i) {
359  bool first(true);
360  for (unsigned int k=0; k<php.layerGroup_.size(); ++k) {
361  if (php.layerGroup_[k] == (int)(i+1)) {
362  if (first) {
363  php.depth_.emplace_back(i+1);
364  php.depthIndex_.emplace_back(depth);
365  php.depthLayerF_.emplace_back(k);
366  ++depth;
367  first = false;
368  }
369  }
370  }
371  }
372  HGCalParameters::hgtrap mytr = php.getModule(0, false);
378  double dz = mytr.dz;
379  php.fillModule(mytr, true);
380  mytr.dz = 2*dz;
381  php.fillModule(mytr, true);
382  mytr.dz = 3*dz;
383  php.fillModule(mytr, true);
384 #ifdef EDM_ML_DEBUG
385  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds "
386  << php.zLayerHex_.size() << " layers";
387  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
388  int k = php.layerIndex_[i];
389  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":"
390  << php.layer_[k] << "] with r = "
391  << php.rMinLayHex_[i] << ":"
392  << php.rMaxLayHex_[i] << " at z = "
393  << php.zLayerHex_[i];
394  }
395  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters has "
396  << php.depthIndex_.size() << " depths";
397  for (unsigned int i=0; i<php.depthIndex_.size(); ++i) {
398  int k = php.depthIndex_[i];
399  edm::LogVerbatim("HGCalGeom") << "Reco Layer[" << i << ":" << k
400  << "] First Layer " << php.depthLayerF_[i]
401  << " Depth " << php.depth_[k];
402  }
403  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds "
404  << php.nSectors_ << " wafers";
405  for (unsigned int i=0; i<php.waferCopy_.size(); ++i)
406  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << ": " <<php.waferCopy_[i]
407  << "] type " << php.waferTypeL_[i] << ":"
408  << php.waferTypeT_[i] << " at ("
409  << php.waferPosX_[i] << ","
410  << php.waferPosY_[i] << ",0)";
411  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius "
412  << php.waferR_ << " and dimensions of the "
413  << "wafers:";
414  edm::LogVerbatim("HGCalGeom") << "Sim[0] " << php.moduleLayS_[0] << " dx "
415  << php.moduleBlS_[0] << ":"
416  << php.moduleTlS_[0] << " dy "
417  << php.moduleHS_[0] << " dz "
418  << php.moduleDzS_[0] << " alpha "
419  << php.moduleAlphaS_[0];
420  for (unsigned int k=0; k<php.moduleLayR_.size(); ++k)
421  edm::LogVerbatim("HGCalGeom") << "Rec[" << k << "] " << php.moduleLayR_[k]
422  << " dx " << php.moduleBlR_[k] << ":"
423  << php.moduleTlR_[k] << " dy "
424  << php.moduleHR_[k] << " dz "
425  << php.moduleDzR_[k] << " alpha "
426  << php.moduleAlphaR_[k];
427  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds "
428  << php.cellFineX_.size()
429  << " fine cells in a wafer";
430  for (unsigned int i=0; i<php.cellFineX_.size(); ++i)
431  edm::LogVerbatim("HGCalGeom") << "Fine Cell[" << i << "] at ("
432  << php.cellFineX_[i] << ","
433  << php.cellFineY_[i] << ",0)";
434  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds "
435  << php.cellCoarseX_.size()
436  << " coarse cells in a wafer";
437  for (unsigned int i=0; i<php.cellCoarseX_.size(); ++i)
438  edm::LogVerbatim("HGCalGeom") << "Coarse Cell[" << i << "] at ("
439  << php.cellCoarseX_[i]
440  << "," << php.cellCoarseY_[i] << ",0)";
441  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size()
442  << " transformation matrices";
443  for (unsigned int k=0; k<php.trformIndex_.size(); ++k) {
444  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex
445  << php.trformIndex_[k]
446  << std::dec << ") Translation ("
447  << php.trformTranX_[k] << ", "
448  << php.trformTranY_[k] << ", "
449  << php.trformTranZ_[k] << " Rotation ("
450  << php.trformRotXX_[k] << ", "
451  << php.trformRotYX_[k] << ", "
452  << php.trformRotZX_[k] << ", "
453  << php.trformRotXY_[k] << ", "
454  << php.trformRotYY_[k] << ", "
455  << php.trformRotZY_[k] << ", "
456  << php.trformRotXZ_[k] << ", "
457  << php.trformRotYZ_[k] << ", "
458  << php.trformRotZZ_[k] << ")";
459  }
460  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for "
461  << php.copiesInLayers_.size()
462  << " layers";
463  for (unsigned int k=0; k<php.copiesInLayers_.size(); ++k) {
464  const auto& theModules = php.copiesInLayers_[k];
465  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" <<theModules.size();
466  int k2(0);
467  for (std::unordered_map<int, int>::const_iterator itr=theModules.begin();
468  itr != theModules.end(); ++itr, ++k2) {
469  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":"
470  << itr->second;
471  }
472  }
473 #endif
474 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< int > layer_
std::vector< double > moduleDzR_
std::vector< int > depthLayerF_
std::vector< int > depth_
std::vector< double > moduleHR_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
layer_map copiesInLayers_
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const N & name() const
Definition: DDBase.h:74
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:430
def copy(args, dbName)
std::vector< int > moduleLayR_
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
std::vector< double > moduleHS_
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
std::vector< double > trformTranY_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< double > cellFineY_
std::vector< double > trformRotZY_
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::vector< uint32_t > trformIndex_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const std::string names[nVars_]
std::vector< double > trformRotXX_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > xVec(void) const
Definition: DDSolid.cc:473
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 > cellSize_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
std::vector< double > moduleDzS_
bool next()
set current node to the next node in the filtered tree
std::vector< int > layerIndex_
std::vector< double > moduleAlphaR_
susybsm::HSCParticleRef hr
Definition: classes.h:26
static double k_ScaleFromDDD
std::vector< double > trformRotXY_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< double > trformRotYX_
hgtrap getModule(unsigned int k, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
std::vector< double > moduleBlR_
std::vector< double > rMinLayHex_
void fillModule(const hgtrap &mytr, bool reco)
double p2[4]
Definition: TauolaWrapper.h:90
std::vector< double > moduleTlS_
double rOut(void) const
Definition: DDSolid.cc:584
std::vector< double > zLayerHex_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > zVec(void) const
Definition: DDSolid.cc:487
std::vector< double > trformRotXZ_
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
Definition: Point3D.h:8
std::vector< double > zVec(void) const
Definition: DDSolid.cc:414
void scaleTrForm(double)
std::vector< int > layerGroup_
std::vector< double > trformRotYY_
std::vector< double > cellFineX_
std::vector< double > trformRotZZ_
std::vector< double > moduleAlphaS_
std::vector< double > moduleBlS_
double p1[4]
Definition: TauolaWrapper.h:89
std::vector< int > waferCopy_
std::vector< int > depthIndex_
std::vector< int > waferTypeT_
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< double > cellCoarseY_
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
double rIn(void) const
Definition: DDSolid.cc:581
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
void HGCalGeomParameters::loadGeometryHexagon8 ( const DDFilteredView _fv,
HGCalParameters php,
int  firstLayer 
)

Definition at line 476 of file HGCalGeomParameters.cc.

References funct::abs(), popcon2dropbox::copy(), DDFilteredView::copyNumbers(), TauDecayModes::dec, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, Exception, HGCalParameters::fillTrForm(), spr::find(), AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, HGCalParameters::layerIndex_, LayerTriplets::layers(), HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::logicalPart(), SiStripPI::max, DDFilteredView::next(), DDTubs::rIn(), HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), DDLogicalPart::solid(), tolerance, DDFilteredView::translation(), 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_, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::zLayerHex_, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

Referenced by HGCalParametersFromDD::build().

478  {
479 
480  DDFilteredView fv = _fv;
481  bool dodet(true);
482  std::map<int,HGCalGeomParameters::layerParameters> layers;
483  std::map<std::pair<int,int>,HGCalParameters::hgtrform> trforms;
484  int levelTop = 3+std::max(php.levelT_[0],php.levelT_[1]);
485  while (dodet) {
486  const DDSolid & sol = fv.logicalPart().solid();
487  // Layers first
488  std::vector<int> copy = fv.copyNumbers();
489  int nsiz = (int)(copy.size());
490  int lay = (nsiz > levelTop) ? copy[nsiz-4] : copy[nsiz-1];
491  int zside= (nsiz > php.levelZSide_) ? copy[php.levelZSide_] : -1;
492  if (zside != 1) zside = -1;
493  if (lay == 0) {
494  edm::LogError("HGCalGeom") << "Funny layer # " << lay << " zp "
495  << zside << " in " << nsiz << " components";
496  throw cms::Exception("DDException") << "Funny layer # " << lay;
497  } else {
498  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
499  php.layer_.end()) php.layer_.emplace_back(lay);
500  auto itr = layers.find(lay);
501  if (itr == layers.end()) {
502  const DDTubs & tube = static_cast<DDTubs>(sol);
503  double rin = HGCalParameters::k_ScaleFromDDD*tube.rIn();
504  double rout= HGCalParameters::k_ScaleFromDDD*tube.rOut();
505  double zp = HGCalParameters::k_ScaleFromDDD*fv.translation().Z();
506  HGCalGeomParameters::layerParameters laypar(rin,rout,zp);
507  layers[lay] = laypar;
508  }
509  if (trforms.find(std::make_pair(lay,zside)) == trforms.end()) {
510  DD3Vector x, y, z;
511  fv.rotation().GetComponents( x, y, z ) ;
512  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
513  x.Y(), y.Y(), z.Y(),
514  x.Z(), y.Z(), z.Z() );
515  const CLHEP::HepRotation hr ( rotation );
516  double xx = ((std::abs(fv.translation().X()) < tolerance) ? 0 :
517  fv.translation().X());
518  double yy = ((std::abs(fv.translation().Y()) < tolerance) ? 0 :
519  fv.translation().Y());
520  const CLHEP::Hep3Vector h3v (xx, yy, fv.translation().Z());
522  mytrf.zp = zside;
523  mytrf.lay = lay;
524  mytrf.sec = 0;
525  mytrf.subsec= 0;
526  mytrf.h3v = h3v;
527  mytrf.hr = hr;
528  trforms[std::make_pair(lay,zside)] = mytrf;
529  }
530  }
531  dodet = fv.next();
532  }
533 
534  double rmin(0), rmax(0);
535  for (unsigned int i=0; i<layers.size(); ++i) {
536  for (auto & layer : layers) {
537  if (layer.first == (int)(i+firstLayer)) {
538  php.layerIndex_.emplace_back(i);
539  php.rMinLayHex_.emplace_back(layer.second.rmin);
540  php.rMaxLayHex_.emplace_back(layer.second.rmax);
541  php.zLayerHex_.emplace_back(layer.second.zpos);
542  if (i == 0) {
543  rmin = layer.second.rmin; rmax = layer.second.rmax;
544  } else {
545  if (rmin > layer.second.rmin) rmin = layer.second.rmin;
546  if (rmax < layer.second.rmax) rmax = layer.second.rmax;
547  }
548  break;
549  }
550  }
551  }
552  php.rLimit_.emplace_back(rmin);
553  php.rLimit_.emplace_back(rmax);
554  php.depth_ = php.layer_;
555  php.depthIndex_ = php.layerIndex_;
556  php.depthLayerF_= php.layerIndex_;
557 
558  for (unsigned int i=0; i<php.layer_.size(); ++i) {
559  for (auto & trform : trforms) {
560  if (trform.first.first == (int)(i+firstLayer)) {
561  trform.second.h3v *= HGCalParameters::k_ScaleFromDDD;
562  php.fillTrForm(trform.second);
563  }
564  }
565  }
566 #ifdef EDM_ML_DEBUG
567  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R "
568  << php.rLimit_[0] << ":" << php.rLimit_[1];
569  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds "
570  << php.zLayerHex_.size() << " layers";
571  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
572  int k = php.layerIndex_[i];
573  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":"
574  << php.layer_[k] << "] with r = "
575  << php.rMinLayHex_[i] << ":"
576  << php.rMaxLayHex_[i] << " at z = "
577  << php.zLayerHex_[i];
578  }
579  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size()
580  << " transformation matrices";
581  for (unsigned int k=0; k<php.trformIndex_.size(); ++k) {
582  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex
583  << php.trformIndex_[k]
584  << std::dec << ") Translation ("
585  << php.trformTranX_[k] << ", "
586  << php.trformTranY_[k] << ", "
587  << php.trformTranZ_[k] << " Rotation ("
588  << php.trformRotXX_[k] << ", "
589  << php.trformRotYX_[k] << ", "
590  << php.trformRotZX_[k] << ", "
591  << php.trformRotXY_[k] << ", "
592  << php.trformRotYY_[k] << ", "
593  << php.trformRotZY_[k] << ", "
594  << php.trformRotXZ_[k] << ", "
595  << php.trformRotYZ_[k] << ", "
596  << php.trformRotZZ_[k] << ")";
597  }
598 #endif
599 }
std::vector< int > layer_
std::vector< int > depthLayerF_
std::vector< int > depth_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
def copy(args, dbName)
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
std::vector< double > trformTranY_
std::vector< double > trformRotZY_
int zside(DetId const &)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::vector< uint32_t > trformIndex_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< double > trformRotXX_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > trformRotYZ_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
bool next()
set current node to the next node in the filtered tree
std::vector< int > layerIndex_
susybsm::HSCParticleRef hr
Definition: classes.h:26
static double k_ScaleFromDDD
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > rMinLayHex_
double rOut(void) const
Definition: DDSolid.cc:584
std::vector< double > zLayerHex_
int k[5][pyjets_maxn]
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_
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< int > levelT_
std::vector< double > trformTranZ_
double rIn(void) const
Definition: DDSolid.cc:581
void HGCalGeomParameters::loadSpecParsHexagon ( const DDFilteredView fv,
HGCalParameters php,
const DDCompactView cpv,
const std::string &  sdTag1,
const std::string &  sdTag2 
)

Definition at line 601 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::cellSize_, dbl_to_int(), DDFilteredView::firstChild(), getDDDArray(), gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::levelT_, DDFilteredView::mergedSpecifics(), gen::n, HGCalParameters::rLimit_, HGCalParameters::slopeMin_, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, and waferSize_.

Referenced by HGCalParametersFromDD::build().

605  {
606 
608  php.boundR_ = getDDDArray("RadiusBound",sv,4);
609  std::for_each(php.boundR_.begin(), php.boundR_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
610 #ifdef EDM_ML_DEBUG
611  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius ranges"
612  << " for cell grouping " << php.boundR_[0]
613  << ":" << php.boundR_[1] << ":"
614  << php.boundR_[2] << ":" << php.boundR_[3];
615 #endif
616  php.rLimit_ = getDDDArray("RadiusLimits",sv,2);
617  std::for_each(php.rLimit_.begin(), php.rLimit_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
618 #ifdef EDM_ML_DEBUG
619  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R "
620  << php.rLimit_[0] << ":" << php.rLimit_[1];
621 #endif
622  php.levelT_ = dbl_to_int(getDDDArray("LevelTop",sv,0));
623 #ifdef EDM_ML_DEBUG
624  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: LevelTop "
625  << php.levelT_[0];
626 #endif
627 
628  //Grouping of layers
629  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine",sv,0));
630  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid",sv,0));
631  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut",sv,0));
632  php.slopeMin_ = getDDDArray("Slope",sv,1);
633 #ifdef EDM_ML_DEBUG
634  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: minimum slope "
635  << php.slopeMin_[0] << " and layer groupings "
636  << "for the 3 ranges:";
637  for (unsigned int k=0; k<php.layerGroup_.size(); ++k)
638  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerGroup_[k]
639  << ":" << php.layerGroupM_[k] << ":"
640  << php.layerGroupO_[k];
641 #endif
642 
643  //Wafer size
644  std::string attribute = "Volume";
645  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, sdTag1, 0.0)};
646  DDFilteredView fv1(*cpv,filter1);
647  if (fv1.firstChild()) {
648  DDsvalues_type sv(fv1.mergedSpecifics());
649  const auto & dummy = getDDDArray("WaferSize",sv,0);
650  waferSize_ = dummy[0];
651  }
652 #ifdef EDM_ML_DEBUG
653  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Wafer Size: "
654  << waferSize_;
655 #endif
656 
657  //Cell size
658  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, sdTag2, 0.0)};
659  DDFilteredView fv2(*cpv,filter2);
660  if (fv2.firstChild()) {
661  DDsvalues_type sv(fv2.mergedSpecifics());
662  php.cellSize_ = getDDDArray("CellSize",sv,0);
663  }
664 #ifdef EDM_ML_DEBUG
665  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: "
666  << php.cellSize_.size() << " cells of sizes:";
667  for (unsigned int k=0; k<php.cellSize_.size(); ++k)
668  edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << php.cellSize_[k];
669 #endif
670 
671 }
std::vector< int > layerGroupM_
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 > boundR_
std::vector< double > cellSize_
static double k_ScaleFromDDD
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
int k[5][pyjets_maxn]
std::vector< double > slopeMin_
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
std::vector< int > layerGroupO_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > rLimit_
std::vector< int > levelT_
void HGCalGeomParameters::loadSpecParsHexagon8 ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 673 of file HGCalGeomParameters.cc.

References HGCalParameters::cellThickness_, HGCalParameters::choiceType_, HGCalParameters::fracAreaMin_, DDVectorGetter::get(), getDDDArray(), createfilelist::int, gen::k, HGCalParameters::k_ScaleFromDDD, DDFilteredView::mergedSpecifics(), gen::n, HGCalParameters::nCornerCut_, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

Referenced by HGCalParametersFromDD::build().

674  {
675 
677  php.cellThickness_ = getDDDArray("CellThickness",sv,3);
678  std::for_each(php.cellThickness_.begin(), php.cellThickness_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
679 #ifdef EDM_ML_DEBUG
680  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: cell Thickness "
681  << php.cellThickness_[0] << ":"
682  << php.cellThickness_[1] << ":"
683  << php.cellThickness_[2];
684 #endif
685  php.radius100to200_ = getDDDArray("Radius100to200",sv,5);
686 #ifdef EDM_ML_DEBUG
687  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
688  << "parameters for 120 to 200 micron "
689  << "transition " << php.radius100to200_[0]
690  << ":" << php.radius100to200_[1] << ":"
691  << php.radius100to200_[2] << ":"
692  << php.radius100to200_[3] << ":"
693  << php.radius100to200_[4];
694 #endif
695  php.radius200to300_ = getDDDArray("Radius200to300",sv,5);
696 #ifdef EDM_ML_DEBUG
697  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
698  << "parameters for 200 to 300 micron "
699  << "transition " << php.radius200to300_[0]
700  << ":" << php.radius200to300_[1] << ":"
701  << php.radius200to300_[2] << ":"
702  << php.radius200to300_[3] << ":"
703  << php.radius200to300_[4];
704 #endif
705  const auto & dummy = getDDDArray("RadiusCuts",sv,4);
706  php.choiceType_ = (int)(dummy[0]);
707  php.nCornerCut_ = (int)(dummy[1]);
708  php.fracAreaMin_= dummy[2];
710 #ifdef EDM_ML_DEBUG
711  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Parameters for the"
712  << " transition " << php.choiceType_ << ":"
713  << php.nCornerCut_ << ":" << php.fracAreaMin_
714  << ":" << php.zMinForRad_;
715 #endif
716  php.radiusMixBoundary_ = DDVectorGetter::get("RadiusMixBoundary");
717  std::for_each(php.radiusMixBoundary_.begin(), php.radiusMixBoundary_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
718 #ifdef EDM_ML_DEBUG
719  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k)
720  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Mix[" << k << "] R = "
721  << php.radiusMixBoundary_[k];
722 #endif
723  php.slopeMin_ = getDDDArray("SlopeBottom",sv,0);
724  php.zFrontMin_ = getDDDArray("ZFrontBottom",sv,0);
725  std::for_each(php.zFrontMin_.begin(), php.zFrontMin_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
726  php.rMinFront_ = getDDDArray("RMinFront",sv,0);
727  std::for_each(php.rMinFront_.begin(), php.rMinFront_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
728 #ifdef EDM_ML_DEBUG
729  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
730  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k
731  << "] Bottom Z = " << php.zFrontMin_[k]
732  << " Slope = " << php.slopeMin_[k]
733  << " rMax = " << php.rMinFront_[k];
734 #endif
735  php.slopeTop_ = getDDDArray("SlopeTop",sv,0);
736  php.zFrontTop_ = getDDDArray("ZFrontTop",sv,0);
737  std::for_each(php.zFrontTop_.begin(), php.zFrontTop_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
738  php.rMaxFront_ = getDDDArray("RMaxFront",sv,0);
739  std::for_each(php.rMaxFront_.begin(), php.rMaxFront_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
740 #ifdef EDM_ML_DEBUG
741  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
742  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k
743  << "] Top Z = " << php.zFrontTop_[k]
744  << " Slope = " << php.slopeTop_[k]
745  << " rMax = " << php.rMaxFront_[k];
746 #endif
747  php.zRanges_ = DDVectorGetter::get("ZRanges");
748  std::for_each(php.zRanges_.begin(), php.zRanges_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
749 #ifdef EDM_ML_DEBUG
750  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary "
751  << php.zRanges_[0] << ":" << php.zRanges_[1]
752  << ":" << php.zRanges_[2] << ":"
753  << php.zRanges_[3];
754 #endif
755 }
std::vector< double > zFrontMin_
static double k_ScaleFromDDD
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
std::vector< double > get(const std::string &)
int k[5][pyjets_maxn]
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
std::vector< double > radius200to300_
std::vector< double > radius100to200_
DDsvalues_type mergedSpecifics() const
std::vector< double > rMinFront_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > zFrontTop_
void HGCalGeomParameters::loadSpecParsTrapezoid ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 757 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, dbl_to_int(), HGCalParameters::firstLayer_, DDVectorGetter::get(), getDDDArray(), gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerFrontBH_, M_PI, DDFilteredView::mergedSpecifics(), gen::n, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::nPhiBinBH_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, HGCalParameters::scintCells(), HGCalParameters::scintCellSize(), HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, and HGCalParameters::zRanges_.

Referenced by HGCalParametersFromDD::build().

758  {
759 
761  php.radiusMixBoundary_ = DDVectorGetter::get("RadiusMixBoundary");
762  std::for_each(php.radiusMixBoundary_.begin(), php.radiusMixBoundary_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
763  php.nPhiBinBH_ = dbl_to_int(getDDDArray("NPhiBinBH",sv,0));
764  php.layerFrontBH_ = dbl_to_int(getDDDArray("LayerFrontBH",sv,0));
765  php.rMinLayerBH_ = getDDDArray("RMinLayerBH",sv,0);
766  std::for_each(php.rMinLayerBH_.begin(), php.rMinLayerBH_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
767  php.nCellsFine_ = php.nPhiBinBH_[0];
768  php.nCellsCoarse_ = php.nPhiBinBH_[1];
769  php.cellSize_.emplace_back(2.0*M_PI/php.nCellsFine_);
770  php.cellSize_.emplace_back(2.0*M_PI/php.nCellsCoarse_);
771 #ifdef EDM_ML_DEBUG
772  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters:nCells "
773  << php.nCellsFine_ << ":" << php.nCellsCoarse_
774  << " cellSize: " << php.cellSize_[0] << ":"
775  << php.cellSize_[1];
776  for (unsigned int k=0; k<php.layerFrontBH_.size(); ++k)
777  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Type[" << k
778  << "] Front Layer = " << php.layerFrontBH_[k]
779  << " rMin = " << php.rMinLayerBH_[k];
780  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k) {
781  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Mix[" << k
782  << "] R = " << php.radiusMixBoundary_[k]
783  << " Nphi = " << php.scintCells(k+php.firstLayer_)
784  << " dPhi = " << php.scintCellSize(k+php.firstLayer_);
785  }
786 #endif
787  php.slopeMin_ = getDDDArray("SlopeBottom",sv,0);
788  php.zFrontMin_ = getDDDArray("ZFrontBottom",sv,0);
789  std::for_each(php.zFrontMin_.begin(), php.zFrontMin_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
790  php.rMinFront_ = getDDDArray("RMinFront",sv,0);
791  std::for_each(php.rMinFront_.begin(), php.rMinFront_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
792 #ifdef EDM_ML_DEBUG
793  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
794  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k
795  << "] Bottom Z = " << php.zFrontMin_[k]
796  << " Slope = " << php.slopeMin_[k]
797  << " rMax = " << php.rMinFront_[k];
798 #endif
799  php.slopeTop_ = getDDDArray("SlopeTop",sv,0);
800  php.zFrontTop_ = getDDDArray("ZFrontTop",sv,0);
801  std::for_each(php.zFrontTop_.begin(), php.zFrontTop_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
802  php.rMaxFront_ = getDDDArray("RMaxFront",sv,0);
803  std::for_each(php.rMaxFront_.begin(), php.rMaxFront_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
804 #ifdef EDM_ML_DEBUG
805  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
806  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k
807  << "] Top Z = " << php.zFrontTop_[k]
808  << " Slope = " << php.slopeTop_[k]
809  << " rMax = " << php.rMaxFront_[k];
810 #endif
811  php.zRanges_ = DDVectorGetter::get("ZRanges");
812  std::for_each(php.zRanges_.begin(), php.zRanges_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
813 #ifdef EDM_ML_DEBUG
814  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary "
815  << php.zRanges_[0] << ":" << php.zRanges_[1]
816  << ":" << php.zRanges_[2] << ":"
817  << php.zRanges_[3];
818 #endif
819 }
std::vector< double > zFrontMin_
double scintCellSize(const int layer) const
std::vector< int > nPhiBinBH_
std::vector< double > rMinLayerBH_
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 > cellSize_
static double k_ScaleFromDDD
std::vector< double > rMaxFront_
int scintCells(const int layer) const
std::vector< double > slopeTop_
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
std::vector< double > get(const std::string &)
#define M_PI
int k[5][pyjets_maxn]
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
DDsvalues_type mergedSpecifics() const
std::vector< double > rMinFront_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 821 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, popcon2dropbox::copy(), TCMET_cfi::corner, PVValHelper::dx, PVValHelper::dy, createfilelist::int, gen::k, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, create_public_lumi_plots::ncol, HGCalParameters::nSectors_, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), funct::tan(), HGCalParameters::waferCopy_, HGCalGeomTools::waferCorner(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypes_, HGCalParameters::waferTypeT_, and HGCalParameters::waferUVMax_.

Referenced by HGCalParametersFromDD::build().

821  {
822 
824  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
825 #ifdef EDM_ML_DEBUG
826  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":"
827  << rmin << " R Limits: " << rin << ":"
828  << rout << " Fine " << rMaxFine;
829 #endif
830  // Clear the vectors
831  php.waferCopy_.clear();
832  php.waferTypeL_.clear();
833  php.waferTypeT_.clear();
834  php.waferPosX_.clear();
835  php.waferPosY_.clear();
836  double dx = 0.5*waferW;
837  double dy = 3.0*dx*tan(30.0*CLHEP::deg);
838  double rr = 2.0*dx*tan(30.0*CLHEP::deg);
839  int ncol = (int)(2.0*rout/waferW) + 1;
840  int nrow = (int)(rout/(waferW*tan(30.0*CLHEP::deg))) + 1;
841  int ns2 = (2*ncol+1)*(2*nrow+1)*php.layer_.size();
842  int incm(0), inrm(0), kount(0), ntot(0);
843  HGCalParameters::layer_map copiesInLayers(php.layer_.size()+1);
844  HGCalParameters::waferT_map waferTypes(ns2+1);
845 #ifdef EDM_ML_DEBUG
846  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
847 #endif
848  for (int nr=-nrow; nr <= nrow; ++nr) {
849  int inr = (nr >= 0) ? nr : -nr;
850  for (int nc=-ncol; nc <= ncol; ++nc) {
851  int inc = (nc >= 0) ? nc : -nc;
852  if (inr%2 == inc%2) {
853  double xpos = nc*dx;
854  double ypos = nr*dy;
855  std::pair<int,int> corner =
856  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
857  double rpos = std::sqrt(xpos*xpos+ypos*ypos);
858  int typet = (rpos < rMaxFine) ? 1 : 2;
859  int typel(3);
860  for (int k=1; k<4; ++k) {
861  if ((rpos+rmin)<=php.boundR_[k]) {
862  typel = k; break;
863  }
864  }
865  ++ntot;
866  if (corner.first > 0) {
867  int copy = inr*100 + inc;
868  if (nc < 0) copy += 10000;
869  if (nr < 0) copy += 100000;
870  if (inc > incm) incm = inc;
871  if (inr > inrm) inrm = inr;
872  kount++;
873 #ifdef EDM_ML_DEBUG
874  edm::LogVerbatim("HGCalGeom") << kount << ":" << ntot << " Copy "
875  << copy << " Type " << typel << ":"
876  << typet << " Location " << corner.first
877  << " Position " << xpos << ":" << ypos
878  << " Layers " << php.layer_.size();
879 #endif
880  php.waferCopy_.emplace_back(copy);
881  php.waferTypeL_.emplace_back(typel);
882  php.waferTypeT_.emplace_back(typet);
883  php.waferPosX_.emplace_back(xpos);
884  php.waferPosY_.emplace_back(ypos);
885  for (unsigned int il=0; il<php.layer_.size(); ++il) {
886  std::pair<int,int> corner =
887  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr,
888  php.rMinLayHex_[il],
889  php.rMaxLayHex_[il], true);
890  if (corner.first > 0) {
891  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
892  if (cpy == copiesInLayers[php.layer_[il]].end())
893  copiesInLayers[php.layer_[il]][copy] = ((corner.first == (int)(HGCalParameters::k_CornerSize)) ? php.waferCopy_.size() : -1);
894  }
895  if ((corner.first > 0) &&
896  (corner.first < (int)(HGCalParameters::k_CornerSize))) {
897  int wl = HGCalWaferIndex::waferIndex(php.layer_[il],copy,0,true);
898  waferTypes[wl] = std::make_pair(corner.first,corner.second);
899  }
900  }
901  }
902  }
903  }
904  }
905  php.copiesInLayers_ = copiesInLayers;
906  php.waferTypes_ = waferTypes;
907  php.nSectors_ = (int)(php.waferCopy_.size());
908  php.waferUVMax_ = 0;
909 #ifdef EDM_ML_DEBUG
910  edm::LogVerbatim("HGCalGeom") << "HGCalWaferHexagon: # of columns "
911  << incm << " # of rows " << inrm << " and "
912  << kount << ":" << ntot << " wafers; R "
913  << rin << ":" << rout;
914  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for "
915  << php.copiesInLayers_.size() << " layers";
916  for (unsigned int k=0; k<copiesInLayers.size(); ++k) {
917  const auto& theModules = copiesInLayers[k];
918  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" <<theModules.size();
919  int k2(0);
920  for (std::unordered_map<int, int>::const_iterator itr=theModules.begin();
921  itr != theModules.end(); ++itr,++k2) {
922  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":"
923  << itr->second;
924  }
925  }
926 #endif
927 }
std::vector< double > waferPosY_
std::vector< int > layer_
layer_map copiesInLayers_
std::unordered_map< int32_t, std::pair< int32_t, int32_t > > waferT_map
def copy(args, dbName)
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:18
static double k_ScaleFromDDD
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
std::vector< double > rMinLayHex_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
std::vector< int > waferCopy_
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
void HGCalGeomParameters::loadWaferHexagon8 ( HGCalParameters php)

Definition at line 929 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, TCMET_cfi::corner, TauDecayModes::dec, HGCalParameters::defineFull_, PVValHelper::dy, HGCalParameters::hgtrap::dz, PVValHelper::dz, HGCalParameters::fillModule(), HGCalParameters::fracAreaMin_, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, mps_fire::i, triggerObjects_cff::id, createfilelist::int, gen::k, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerIndex_, SiStripPI::max, N, HGCalParameters::nCornerCut_, HGCalParameters::nSectors_, dttmaxenums::R, alignCSCRings::r, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::sensorSeparation_, sqrt3_, HGCalParameters::hgtrap::tl, HGCalParameters::typesInLayers_, findQualityFiles::v, HGCalParameters::waferCopy_, HGCalGeomTools::waferCorner(), HGCalWaferIndex::waferIndex(), HGCalWaferIndex::waferLayer(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, HGCalParameters::wafersInLayers_, HGCalParameters::waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypes_, HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), HGCalParameters::waferUVMax_, HGCalParameters::waferUVMaxLayer_, HGCalWaferIndex::waferV(), HGCalParameters::zLayerHex_, and HGCalParameters::zMinForRad_.

Referenced by HGCalParametersFromDD::build().

929  {
930 
931  double waferW(php.waferSize_);
932  double waferS(php.sensorSeparation_);
933  auto wType = std::make_unique<HGCalWaferType>(php.radius100to200_,
934  php.radius200to300_,
935  HGCalParameters::k_ScaleToDDD*(waferW+waferS),
937  php.choiceType_,
938  php.nCornerCut_,
939  php.fracAreaMin_);
940 
941  double rout(php.rLimit_[1]);
942 #ifdef EDM_ML_DEBUG
943  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":"
944  << waferS << " R Max: " << rout;
945 #endif
946  // Clear the vectors
947  php.waferCopy_.clear();
948  php.waferTypeL_.clear();
949  php.waferTypeT_.clear();
950  php.waferPosX_.clear();
951  php.waferPosY_.clear();
952  double r = 0.5*(waferW+waferS);
953  double R = 2.0*r/sqrt3_;
954  double dy = 0.75*R;
955  int N = (r == 0) ? 3 : ((int)(0.5*rout/r) + 3);
956  int ns1 = (2*N+1)*(2*N+1);
957  int ns2 = ns1*php.zLayerHex_.size();
958 #ifdef EDM_ML_DEBUG
959  edm::LogVerbatim("HGCalGeom") << "r " << r << " dy " << dy << " N " << N
960  << " sizes " << ns1 << ":" << ns2;
961  std::vector<int> indtypes(ns1+1);
962  indtypes.clear();
963 #endif
964  HGCalParameters::wafer_map wafersInLayers(ns1+1);
965  HGCalParameters::wafer_map typesInLayers(ns2+1);
966  HGCalParameters::waferT_map waferTypes(ns2+1);
967  int ipos(0), lpos(0), uvmax(0);
968  std::vector<int> uvmx(php.zLayerHex_.size(),0);
969  for (int v = -N; v <= N; ++v) {
970  for (int u = -N; u <= N; ++u) {
971  int nr = 2*v;
972  int nc =-2*u+v;
973  double xpos = nc*r;
974  double ypos = nr*dy;
975  int indx = HGCalWaferIndex::waferIndex(0,u,v);
976  php.waferCopy_.emplace_back(indx);
977  php.waferPosX_.emplace_back(xpos);
978  php.waferPosY_.emplace_back(ypos);
979  wafersInLayers[indx] = ipos;
980  ++ipos;
981  std::pair<int,int> corner =
982  HGCalGeomTools::waferCorner(xpos, ypos, r, R, 0, rout, false);
983  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) ||
984  ((corner.first > 0) && php.defineFull_)) {
985  uvmax = std::max(uvmax,std::max(std::abs(u),std::abs(v)));
986  }
987  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
988  int lay = php.layer_[php.layerIndex_[i]];
989  double zpos = php.zLayerHex_[i];
991  php.waferTypeL_.emplace_back(type);
992  int kndx = HGCalWaferIndex::waferIndex(lay,u,v);
993  typesInLayers[kndx] = lpos;
994  ++lpos;
995 #ifdef EDM_ML_DEBUG
996  indtypes.emplace_back(kndx);
997 #endif
998  std::pair<int,int> corner =
999  HGCalGeomTools::waferCorner(xpos, ypos, r, R,
1000  php.rMinLayHex_[i],
1001  php.rMaxLayHex_[i], false);
1002 #ifdef EDM_ML_DEBUG
1003  if (((corner.first==0) && std::abs(u) < 5 && std::abs(v) < 5) ||
1004  (std::abs(u) < 2 && std::abs(v) < 2)) {
1005  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " R "
1006  << php.rMinLayHex_[i] << ":"
1007  << php.rMaxLayHex_[i] << " u "
1008  << u << " v " << v << " with "
1009  << corner.first << " corners";
1010  }
1011 #endif
1012  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) ||
1013  ((corner.first > 0) && php.defineFull_)) {
1014  uvmx[i] = std::max(uvmx[i],std::max(std::abs(u),std::abs(v)));
1015  }
1016  if ((corner.first < (int)(HGCalParameters::k_CornerSize)) &&
1017  (corner.first > 0)) {
1018 #ifdef EDM_ML_DEBUG
1019  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u
1020  << ":" << v << " with "
1021  << corner.first << " corners First "
1022  << corner.second;
1023 #endif
1024  int wl = HGCalWaferIndex::waferIndex(lay,u,v);
1025  waferTypes[wl] = std::make_pair(corner.first,corner.second);
1026  }
1027  }
1028  }
1029  }
1030  php.waferUVMax_ = uvmax;
1031  php.waferUVMaxLayer_= uvmx;
1032  php.wafersInLayers_ = wafersInLayers;
1033  php.typesInLayers_ = typesInLayers;
1034  php.waferTypes_ = waferTypes;
1035  php.nSectors_ = (int)(php.waferCopy_.size());
1037  mytr.lay = 1; mytr.bl = php.waferR_;
1038  mytr.tl = php.waferR_; mytr.h = php.waferR_;
1039  mytr.alpha = 0.0; mytr.cellSize = HGCalParameters::k_ScaleToDDD*php.waferSize_;
1040  for (auto const & dz : php.cellThickness_) {
1041  mytr.dz = 0.5*HGCalParameters::k_ScaleToDDD*dz;
1042  php.fillModule(mytr,false);
1043  }
1044  for (unsigned k=0; k<php.cellThickness_.size(); ++k) {
1045  HGCalParameters::hgtrap mytr = php.getModule(k, false);
1051  php.fillModule(mytr, true);
1052  }
1053 #ifdef EDM_ML_DEBUG
1054  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Total of "
1055  << php.waferCopy_.size() << " wafers";
1056  for (unsigned int k=0; k<php.waferCopy_.size(); ++k) {
1057  int id = php.waferCopy_[k];
1058  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << std::hex << id
1059  << std::dec << ":" << HGCalWaferIndex::waferLayer(id)
1060  << ":" << HGCalWaferIndex::waferU(id) << ":"
1061  << HGCalWaferIndex::waferV(id) << " x "
1062  << php.waferPosX_[k] << " y "
1063  << php.waferPosY_[k] << " index "
1064  << php.wafersInLayers_[id];
1065  }
1066  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Total of "
1067  << php.waferTypeL_.size() << " wafer types";
1068  for (unsigned int k=0; k<php.waferTypeL_.size(); ++k) {
1069  int id = indtypes[k];
1070  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.typesInLayers_[id]
1071  << ":" << php.waferTypeL_[k]
1072  << " ID " << std::hex << id << std::dec
1073  << ":" << HGCalWaferIndex::waferLayer(id)
1074  << ":" << HGCalWaferIndex::waferU(id) << ":"
1075  << HGCalWaferIndex::waferV(id);
1076  }
1077 #endif
1078 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< int > layer_
std::unordered_map< int32_t, std::pair< int32_t, int32_t > > waferT_map
static int32_t waferV(const int32_t index)
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 double k_ScaleFromDDD
hgtrap getModule(unsigned int k, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int32_t waferU(const int32_t index)
std::vector< double > rMinLayHex_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
void fillModule(const hgtrap &mytr, bool reco)
static int32_t waferLayer(const int32_t index)
std::vector< double > zLayerHex_
waferT_map waferTypes_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
#define N
Definition: blowfish.cc:9
std::vector< double > cellThickness_
std::unordered_map< int32_t, int32_t > wafer_map
static double k_ScaleToDDD
std::vector< double > radius200to300_
std::vector< double > radius100to200_
wafer_map typesInLayers_
std::vector< int > waferCopy_
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_

Member Data Documentation

const double HGCalGeomParameters::sqrt3_
private

Definition at line 71 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

double HGCalGeomParameters::waferSize_
private