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 loadGeometryHexagon (const DDFilteredView &, HGCalParameters &, const std::string &, const DDCompactView *, const std::string &, const std::string &, HGCalGeometryMode::WaferMode)
 
void loadGeometrySquare (const DDFilteredView &, HGCalParameters &, const std::string &)
 
void loadSpecParsHexagon (const DDFilteredView &, HGCalParameters &, const DDCompactView *, const std::string &, const std::string &)
 
void loadSpecParsSquare (const DDFilteredView &, HGCalParameters &)
 
void loadWaferHexagon (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 &, int &)
 

Private Attributes

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

References gather_cfg::cout.

25  {
26 #ifdef EDM_ML_DEBUG
27  std::cout << "HGCalGeomParameters::HGCalGeomParameters() constructor\n";
28 #endif
29 }
HGCalGeomParameters::~HGCalGeomParameters ( )

Definition at line 31 of file HGCalGeomParameters.cc.

References gather_cfg::cout.

31  {
32 #ifdef EDM_ML_DEBUG
33  std::cout << "HGCalGeomParameters::destructed!!!\n";
34 #endif
35 }

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

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

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

923  {
924 
925  if (itrf == wafers.end()) {
926  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin();
927  itr != wafers.end(); ++itr) {
928  if (itr->wafer == wafer) {
929  itrf = itr;
930  break;
931  }
932  }
933  }
934  double dx(0), dy(0);
935  if (itrf != wafers.end()) {
936  dx = (xx - itrf->xyz.x());
937  if (std::abs(dx) < 0.001) dx = 0;
938  dy = (yy - itrf->xyz.y());
939  if (std::abs(dy) < 0.001) dy = 0;
940  }
941  return std::pair<double,double>(dx,dy);
942 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > HGCalGeomParameters::getDDDArray ( const std::string &  str,
const DDsvalues_type sv,
int &  nmin 
)
private

Definition at line 884 of file HGCalGeomParameters.cc.

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

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), loadSpecParsHexagon(), and loadSpecParsSquare().

886  {
887  DDValue value(str);
888  if (DDfetch(&sv,value)) {
889  const std::vector<double> & fvec = value.doubles();
890  int nval = fvec.size();
891  if (nmin > 0) {
892  if (nval < nmin) {
893  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
894  << " bins " << nval << " < " << nmin
895  << " ==> illegal";
896  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
897  }
898  } else {
899  if (nval < 1 && nmin == 0) {
900  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
901  << " bins " << nval << " < 1 ==> illegal"
902  << " (nmin=" << nmin << ")";
903  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
904  }
905  }
906  nmin = nval;
907  return fvec;
908  } else {
909  if (nmin >= 0) {
910  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
911  << str;
912  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
913  }
914  std::vector<double> fvec;
915  nmin = 0;
916  return fvec;
917  }
918 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
void HGCalGeomParameters::loadCellParsHexagon ( const DDCompactView cpv,
HGCalParameters php 
)

Definition at line 856 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

857  {
858 
859  //Special parameters for cell parameters
860  std::string attribute = "OnlyForHGCalNumbering";
861  DDSpecificsHasNamedValueFilter filter1{attribute};
862  DDFilteredView fv1(*cpv,filter1);
863  bool ok = fv1.firstChild();
864 
865  if (ok) {
866  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
867  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
868  }
869 
870 #ifdef EDM_ML_DEBUG
871  std::cout << "HGCalLoadCellPars: " << php.cellFine_.size()
872  << " rows for fine cells\n";
873  for (unsigned int k=0; k<php.cellFine_.size(); ++k)
874  std::cout << k << ":" << php.cellFine_[k] << " ";
875  std::cout << std::endl;
876  std::cout << "HGCalLoadCellPars: " <<php.cellCoarse_.size()
877  << " rows for coarse cells\n";
878  for (unsigned int k=0; k<php.cellCoarse_.size(); ++k)
879  std::cout << k << ":" << php.cellCoarse_[k] << " ";
880  std::cout << std::endl;
881 #endif
882 }
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::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 212 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(), gather_cfg::cout, SimDataFormats::CaloAnalysis::cp, TauDecayModes::dec, particleFlowClusterECALTimeSelected_cfi::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, DDFilteredView::firstChild(), HGCalParameters::getModule(), HGCalParameters::hgtrap::h, AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, 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_, dataset::name, DDBase< N, C >::name(), cscdqm::h::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, 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::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().

218  {
219 
220  DDFilteredView fv = _fv;
221  bool dodet(true);
222  std::map<int,HGCalGeomParameters::layerParameters> layers;
223  std::vector<HGCalParameters::hgtrform> trforms;
224  std::vector<bool> trformUse;
225 
226  while (dodet) {
227  const DDSolid & sol = fv.logicalPart().solid();
228  std::string name = sol.name();
229  // Layers first
230  std::vector<int> copy = fv.copyNumbers();
231  int nsiz = (int)(copy.size());
232  int lay = (nsiz > 0) ? copy[nsiz-1] : 0;
233  int zp = (nsiz > 2) ? copy[nsiz-3] : -1;
234  if (zp != 1) zp = -1;
235  if (lay == 0) {
236  edm::LogError("HGCalGeom") << "Funny layer # " << lay << " zp "
237  << zp << " in " << nsiz << " components";
238  throw cms::Exception("DDException") << "Funny layer # " << lay;
239  } else {
240  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
241  php.layer_.end()) php.layer_.emplace_back(lay);
242  std::map<int,HGCalGeomParameters::layerParameters>::iterator itr = layers.find(lay);
243  if (itr == layers.end()) {
244  const DDTubs & tube = static_cast<DDTubs>(sol);
245  double rin = k_ScaleFromDDD*tube.rIn();
246  double rout= k_ScaleFromDDD*tube.rOut();
247  double zp = k_ScaleFromDDD*fv.translation().Z();
248  HGCalGeomParameters::layerParameters laypar(rin,rout,zp);
249  layers[lay] = laypar;
250  }
251  DD3Vector x, y, z;
252  fv.rotation().GetComponents( x, y, z ) ;
253  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
254  x.Y(), y.Y(), z.Y(),
255  x.Z(), y.Z(), z.Z() );
256  const CLHEP::HepRotation hr ( rotation );
257  double xx = k_ScaleFromDDD*fv.translation().X();
258  if (std::abs(xx) < 0.001) xx = 0;
259  double yy = k_ScaleFromDDD*fv.translation().Y();
260  if (std::abs(yy) < 0.001) yy = 0;
261  const CLHEP::Hep3Vector h3v ( xx, yy, fv.translation().Z() );
263  mytrf.zp = zp;
264  mytrf.lay = lay;
265  mytrf.sec = 0;
266  mytrf.subsec= 0;
267  mytrf.h3v = h3v;
268  mytrf.hr = hr;
269  trforms.emplace_back(mytrf);
270  trformUse.emplace_back(false);
271  }
272  dodet = fv.next();
273  }
274 
275  // Then wafers
276  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they were)
277  // to ensure that new copy numbers are always added
278  // to the end of the list.
279  std::unordered_map<int32_t,int32_t> copies;
280  HGCalParameters::layer_map copiesInLayers(layers.size()+1);
281  std::vector<int32_t> wafer2copy;
282  std::vector<HGCalGeomParameters::cellParameters> wafers;
283  std::string attribute = "Volume";
284  DDValue val1(attribute, sdTag2, 0.0);
285  DDSpecificsMatchesValueFilter filter1{val1};
286  DDFilteredView fv1(*cpv,filter1);
287  bool ok = fv1.firstChild();
288  if (!ok) {
289  edm::LogError("HGCalGeom") << " Attribute " << val1
290  << " not found but needed.";
291  throw cms::Exception("DDException") << "Attribute " << val1
292  << " not found but needed.";
293  } else {
294  dodet = true;
295  std::unordered_set<std::string> names;
296  while (dodet) {
297  const DDSolid & sol = fv1.logicalPart().solid();
298  std::string name = fv1.logicalPart().name();
299  std::vector<int> copy = fv1.copyNumbers();
300  int nsiz = (int)(copy.size());
301  int wafer = (nsiz > 0) ? copy[nsiz-1] : 0;
302  int layer = (nsiz > 1) ? copy[nsiz-2] : 0;
303  if (nsiz < 2) {
304  edm::LogError("HGCalGeom") << "Funny wafer # " << wafer << " in "
305  << nsiz << " components";
306  throw cms::Exception("DDException") << "Funny wafer # " << wafer;
307  } else {
308  std::unordered_map<int32_t,int32_t>::iterator itr = copies.find(wafer);
309  std::unordered_map<int32_t,int32_t>::iterator cpy =
310  copiesInLayers[layer].find(wafer);
311  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
312  copiesInLayers[layer][wafer] = itr->second;
313  }
314  if (itr == copies.end()) {
315  copies[wafer] = wafer2copy.size();
316  copiesInLayers[layer][wafer] = wafer2copy.size();
317  double xx = k_ScaleFromDDD*fv1.translation().X();
318  if (std::abs(xx) < 0.001) xx = 0;
319  double yy = k_ScaleFromDDD*fv1.translation().Y();
320  if (std::abs(yy) < 0.001) yy = 0;
321  wafer2copy.emplace_back(wafer);
322  GlobalPoint p(xx,yy,k_ScaleFromDDD*fv1.translation().Z());
323  HGCalGeomParameters::cellParameters cell(false,wafer,p);
324  wafers.emplace_back(cell);
325  if ( names.count(name) == 0 ) {
326  std::vector<double> zv, rv;
328  const DDPolyhedra & polyhedra = static_cast<DDPolyhedra>(sol);
329  zv = polyhedra.zVec();
330  rv = polyhedra.rMaxVec();
331  } else {
332  const DDExtrudedPolygon & polygon = static_cast<DDExtrudedPolygon>(sol);
333  zv = polygon.zVec();
334  rv = polygon.xVec();
335  }
336  php.waferR_ = rv[0]/std::cos(30.0*CLHEP::deg);
337  double dz = 0.5*(zv[1]-zv[0]);
338 #ifdef EDM_ML_DEBUG
339  std::cout << "Mode " << mode << " R " << php.waferR_ << " z " << dz
340  << std::endl;
341 #endif
343  mytr.lay = 1; mytr.bl = php.waferR_;
344  mytr.tl = php.waferR_; mytr.h = php.waferR_;
345  mytr.dz = dz; mytr.alpha = 0.0;
346  mytr.cellSize = waferSize_;
347  php.fillModule(mytr,false);
348  names.insert(name);
349  }
350  }
351  }
352  dodet = fv1.next();
353  }
354  }
355 
356  // Finally the cells
357  std::map<int,int> wafertype;
358  std::map<int,HGCalGeomParameters::cellParameters> cellsf, cellsc;
359  DDValue val2(attribute, sdTag3, 0.0);
360  DDSpecificsMatchesValueFilter filter2{val2};
361  DDFilteredView fv2(*cpv,filter2);
362  ok = fv2.firstChild();
363  if (!ok) {
364  edm::LogError("HGCalGeom") << " Attribute " << val2
365  << " not found but needed.";
366  throw cms::Exception("DDException") << "Attribute " << val2
367  << " not found but needed.";
368  } else {
369  dodet = true;
370  while (dodet) {
371  const DDSolid & sol = fv2.logicalPart().solid();
372  std::string name = sol.name();
373  std::vector<int> copy = fv2.copyNumbers();
374  int nsiz = (int)(copy.size());
375  int cellx= (nsiz > 0) ? copy[nsiz-1] : 0;
376  int wafer= (nsiz > 1) ? copy[nsiz-2] : 0;
377  int cell = cellx%1000;
378  int type = cellx/1000;
379  if (type != 1 && type != 2) {
380  edm::LogError("HGCalGeom") << "Funny cell # " << cell << " type "
381  << type << " in " << nsiz << " components";
382  throw cms::Exception("DDException") << "Funny cell # " << cell;
383  } else {
384  std::map<int,int>::iterator ktr = wafertype.find(wafer);
385  if (ktr == wafertype.end()) wafertype[wafer] = type;
386  bool newc(false);
387  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr;
388  double cellsize = php.cellSize_[0];
389  if (type == 1) {
390  itr = cellsf.find(cell);
391  newc= (itr == cellsf.end());
392  } else {
393  itr = cellsc.find(cell);
394  newc= (itr == cellsc.end());
395  cellsize = php.cellSize_[1];
396  }
397  if (newc) {
398  bool half = (name.find("Half") != std::string::npos);
399  double xx = k_ScaleFromDDD*fv2.translation().X();
400  double yy = k_ScaleFromDDD*fv2.translation().Y();
401  if (half) {
402  math::XYZPointD p1(-2.0*cellsize/9.0,0,0);
403  math::XYZPointD p2 = fv2.rotation()(p1);
404  xx += (k_ScaleFromDDD*(p2.X()));
405  yy += (k_ScaleFromDDD*(p2.Y()));
406 #ifdef EDM_ML_DEBUG
407  std::cout << "Type " << type << " Cell " << cellx << " local "
408  << xx << ":" << yy << " new " << p1 << ":" << p2 <<"\n";
409 #endif
410  }
412  if (type == 1) {
413  cellsf[cell] = cp;
414  } else {
415  cellsc[cell] = cp;
416  }
417  }
418  }
419  dodet = fv2.next();
420  }
421  }
422 
423  if (((cellsf.size()+cellsc.size())==0) || (wafers.empty()) ||
424  (layers.empty())) {
425  edm::LogError("HGCalGeom") << "HGCalGeomParameters : number of cells "
426  << cellsf.size() << ":" << cellsc.size()
427  << " wafers " << wafers.size() << " layers "
428  << layers.size() << " illegal";
429  throw cms::Exception("DDException")
430  << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
431  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
432  << " layers " << layers.size();
433  }
434 
435  for (unsigned int i=0; i<layers.size(); ++i) {
436  for (auto & layer : layers) {
437  if (layer.first == (int)(i+1)) {
438  php.layerIndex_.emplace_back(i);
439  php.rMinLayHex_.emplace_back(layer.second.rmin);
440  php.rMaxLayHex_.emplace_back(layer.second.rmax);
441  php.zLayerHex_.emplace_back(layer.second.zpos);
442  break;
443  }
444  }
445  }
446  for (unsigned int i=0; i<php.layer_.size(); ++i) {
447  for (unsigned int i1=0; i1<trforms.size(); ++i1) {
448  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay-1] ==
449  (int)(i+1)) {
450  trforms[i1].h3v *= k_ScaleFromDDD;
451  trforms[i1].lay = (i+1);
452  trformUse[i1] = true;
453  php.fillTrForm(trforms[i1]);
454  int nz(1);
455  for (unsigned int i2=i1+1; i2<trforms.size(); ++i2) {
456  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
457  php.layerGroup_[trforms[i2].lay-1] == (int)(i+1)) {
458  php.addTrForm(k_ScaleFromDDD*trforms[i2].h3v);
459  nz++;
460  trformUse[i2] = true;
461  }
462  }
463  if (nz > 0) {
464  php.scaleTrForm(double(1.0/nz));
465  }
466  }
467  }
468  }
469 
470  double rmin = k_ScaleFromDDD*php.waferR_;
471  for (unsigned i = 0; i < wafer2copy.size(); ++i ) {
472  php.waferCopy_.emplace_back(wafer2copy[i]);
473  php.waferPosX_.emplace_back(wafers[i].xyz.x());
474  php.waferPosY_.emplace_back(wafers[i].xyz.y());
475  std::map<int,int>::iterator ktr = wafertype.find(wafer2copy[i]);
476  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
477  php.waferTypeT_.emplace_back(typet);
478  double r = wafers[i].xyz.perp();
479  int type(3);
480  for (int k=1; k<4; ++k) {
481  if ((r+rmin)<=php.boundR_[k]) {
482  type = k; break;
483  }
484  }
485  php.waferTypeL_.emplace_back(type);
486  }
487  php.copiesInLayers_ = copiesInLayers;
488  php.nSectors_ = (int)(php.waferCopy_.size());
489 
490  std::vector<HGCalGeomParameters::cellParameters>::const_iterator itrf = wafers.end();
491  for (unsigned int i=0; i<cellsf.size(); ++i) {
492  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr = cellsf.find(i);
493  if (itr == cellsf.end()) {
494  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
495  << " fine cell number " << i;
496  throw cms::Exception("DDException")
497  << "HGCalGeomParameters: missing info for fine cell number " << i;
498  } else {
499  double xx = (itr->second).xyz.x();
500  double yy = (itr->second).xyz.y();
501  int waf= (itr->second).wafer;
502  std::pair<double,double> xy = cellPosition(wafers,itrf,waf,xx,yy);
503  php.cellFineX_.emplace_back(xy.first);
504  php.cellFineY_.emplace_back(xy.second);
505  php.cellFineHalf_.emplace_back((itr->second).half);
506  }
507  }
508  itrf = wafers.end();
509  for (unsigned int i=0; i<cellsc.size(); ++i) {
510  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr = cellsc.find(i);
511  if (itr == cellsc.end()) {
512  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
513  << " coarse cell number " << i;
514  throw cms::Exception("DDException")
515  << "HGCalGeomParameters: missing info for coarse cell number " << i;
516  } else {
517  double xx = (itr->second).xyz.x();
518  double yy = (itr->second).xyz.y();
519  int waf= (itr->second).wafer;
520  std::pair<double,double> xy = cellPosition(wafers,itrf,waf,xx,yy);
521  php.cellCoarseX_.emplace_back(xy.first);
522  php.cellCoarseY_.emplace_back(xy.second);
523  php.cellCoarseHalf_.emplace_back((itr->second).half);
524  }
525  }
526  int depth(0);
527  for (unsigned int i=0; i<php.layerGroup_.size(); ++i) {
528  bool first(true);
529  for (unsigned int k=0; k<php.layerGroup_.size(); ++k) {
530  if (php.layerGroup_[k] == (int)(i+1)) {
531  if (first) {
532  php.depth_.emplace_back(i+1);
533  php.depthIndex_.emplace_back(depth);
534  php.depthLayerF_.emplace_back(k);
535  ++depth;
536  first = false;
537  }
538  }
539  }
540  }
541  HGCalParameters::hgtrap mytr = php.getModule(0, false);
542  mytr.bl *= k_ScaleFromDDD;
543  mytr.tl *= k_ScaleFromDDD;
544  mytr.h *= k_ScaleFromDDD;
545  mytr.dz *= k_ScaleFromDDD;
546  double dz = mytr.dz;
547  php.fillModule(mytr, true);
548  mytr.dz = 2*dz;
549  php.fillModule(mytr, true);
550  mytr.dz = 3*dz;
551  php.fillModule(mytr, true);
552 #ifdef EDM_ML_DEBUG
553  std::cout << "HGCalGeomParameters finds " << php.zLayerHex_.size()
554  << " layers" << std::endl;
555  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
556  int k = php.layerIndex_[i];
557  std::cout << "Layer[" << i << ":" << k << ":" << php.layer_[k]
558  << "] with r = " << php.rMinLayHex_[i] << ":"
559  << php.rMaxLayHex_[i] << " at z = " << php.zLayerHex_[i]
560  << std::endl;
561  }
562  std::cout << "HGCalGeomParameters has " << php.depthIndex_.size()
563  << " depths" <<std::endl;
564  for (unsigned int i=0; i<php.depthIndex_.size(); ++i) {
565  int k = php.depthIndex_[i];
566  std::cout << "Reco Layer[" << i << ":" << k << "] First Layer "
567  << php.depthLayerF_[i] << " Depth " << php.depth_[k] <<std::endl;
568  }
569  std::cout << "HGCalGeomParameters finds " << php.nSectors_ << " wafers\n";
570  for (unsigned int i=0; i<php.waferCopy_.size(); ++i)
571  std::cout << "Wafer[" << i << ": " << php.waferCopy_[i] << "] type "
572  << php.waferTypeL_[i] << ":" << php.waferTypeT_[i] << " at ("
573  << php.waferPosX_[i] << "," << php.waferPosY_[i] << ",0)\n";
574  std::cout << "HGCalGeomParameters: wafer radius " << php.waferR_
575  << " and dimensions of the wafers:" << std::endl;
576  std::cout << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0]
577  << ":" << php.moduleTlS_[0] << " dy " << php.moduleHS_[0] << " dz "
578  << php.moduleDzS_[0] << " alpha " << php.moduleAlphaS_[0] << "\n";
579  for (unsigned int k=0; k<php.moduleLayR_.size(); ++k)
580  std::cout << "Rec[" << k << "] " << php.moduleLayR_[k] << " dx "
581  << php.moduleBlR_[k] << ":" << php.moduleTlR_[k] << " dy "
582  << php.moduleHR_[k] << " dz " << php.moduleDzR_[k] << " alpha "
583  << php.moduleAlphaR_[k] << std::endl;
584  std::cout << "HGCalGeomParameters finds " << php.cellFineX_.size()
585  << " fine cells in a wafer" << std::endl;
586  for (unsigned int i=0; i<php.cellFineX_.size(); ++i)
587  std::cout << "Fine Cell[" << i << "] at (" << php.cellFineX_[i] << ","
588  << php.cellFineY_[i] << ",0)" << std::endl;
589  std::cout << "HGCalGeomParameters finds " << php.cellCoarseX_.size()
590  << " coarse cells in a wafer" << std::endl;
591  for (unsigned int i=0; i<php.cellCoarseX_.size(); ++i)
592  std::cout << "Coarse Cell[" << i << "] at (" << php.cellCoarseX_[i]
593  << "," << php.cellCoarseY_[i] << ",0)" << std::endl;
594  std::cout << "Obtained " << php.trformIndex_.size()
595  << " transformation matrices" << std::endl;
596  for (unsigned int k=0; k<php.trformIndex_.size(); ++k) {
597  std::cout << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k]
598  << std::dec << ") Trnaslation (" << php.trformTranX_[k]
599  << ", " << php.trformTranY_[k] << ", " << php.trformTranZ_[k]
600  << " Rotation (" << php.trformRotXX_[k] << ", "
601  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", "
602  << php.trformRotXY_[k] << ", " << php.trformRotYY_[k] << ", "
603  << php.trformRotZY_[k] << ", " << php.trformRotXZ_[k] << ", "
604  << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k] << ")\n";
605  }
606  std::cout << "Dump copiesInLayers for " << php.copiesInLayers_.size()
607  << " layers\n";
608  for (unsigned int k=0; k<php.copiesInLayers_.size(); ++k) {
609  const auto& theModules = php.copiesInLayers_[k];
610  std::cout << "Layer " << k << ":" << theModules.size() << std::endl;
611  int k2(0);
612  for (std::unordered_map<int, int>::const_iterator itr=theModules.begin();
613  itr != theModules.end(); ++itr) {
614  std::cout << " " << itr->first << ":" << itr->second;
615  ++k2;
616  if (k2 > 9) { std::cout << std::endl; k2 = 0; }
617  }
618  if (k2 > 0) std::cout << std::endl;
619  }
620 #endif
621 }
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:78
std::vector< bool > cellCoarseHalf_
static const HistoName names[]
std::vector< bool > cellFineHalf_
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:457
std::vector< int > moduleLayR_
nav_type copyNumbers() const
return the stack of copy numbers
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
std::vector< double > trformRotXX_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > xVec(void) const
Definition: DDSolid.cc:500
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
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:611
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:514
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:441
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_
const double k_ScaleFromDDD
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:608
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_
void HGCalGeomParameters::loadGeometrySquare ( const DDFilteredView _fv,
HGCalParameters php,
const std::string &  sdTag 
)

Definition at line 37 of file HGCalGeomParameters.cc.

References HGCalParameters::addTrForm(), HGCalParameters::hgtrap::alpha, DDTrap::alpha1(), HGCalParameters::hgtrap::bl, HGCalParameters::cellFactor_, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, popcon2dropbox::copy(), DDFilteredView::copyNumbers(), gather_cfg::cout, TauDecayModes::dec, particleFlowClusterECALTimeSelected_cfi::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, DDTrap::halfZ(), AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, k_ScaleFromDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerGroup_, HGCalParameters::layerIndex_, DDFilteredView::logicalPart(), HGCalParameters::moduleAlphaR_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleBlS_, HGCalParameters::moduleCellR_, HGCalParameters::moduleCellS_, HGCalParameters::moduleDzR_, HGCalParameters::moduleDzS_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, HGCalParameters::moduleLayR_, HGCalParameters::moduleLayS_, HGCalParameters::moduleTlR_, HGCalParameters::moduleTlS_, dataset::name, DDBase< N, C >::name(), DDFilteredView::next(), HGCalParameters::nSectors_, idealTransformation::rotation, DDFilteredView::rotation(), HGCalParameters::scaleTrForm(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrap::tl, 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, DDTrap::x1(), DDTrap::x2(), y, DDTrap::y1(), DDTrap::y2(), z, and HGCalParameters::hgtrform::zp.

Referenced by HGCalParametersFromDD::build().

39  {
40 
41  DDFilteredView fv = _fv;
42  bool dodet(true), first(true);
43  int zpFirst(0);
44  std::vector<HGCalParameters::hgtrform> trforms;
45  std::vector<bool> trformUse;
46 
47  while (dodet) {
48  const DDSolid & sol = fv.logicalPart().solid();
49  std::string name = sol.name();
50  int isd = (name.find(sdTag) == std::string::npos) ? -1 : 1;
51  if (isd > 0) {
52  std::vector<int> copy = fv.copyNumbers();
53  int nsiz = (int)(copy.size());
54  int lay = (nsiz > 0) ? copy[nsiz-1] : -1;
55  int sec = (nsiz > 1) ? copy[nsiz-2] : -1;
56  int zp = (nsiz > 3) ? copy[nsiz-4] : -1;
57  if (zp !=1 ) zp = -1;
58  if (first) {first = false; zpFirst = zp;}
59  const DDTrap & trp = static_cast<DDTrap>(sol);
61  mytr.lay = lay; mytr.bl = trp.x1(); mytr.tl = trp.x2();
62  mytr.h = 0.5*(trp.y1()+trp.y2()); mytr.dz = trp.halfZ();
63  mytr.alpha = trp.alpha1(); mytr.cellSize = 0;
64  int subs = (trp.alpha1()>0 ? 1 : 0);
65  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
66  php.layer_.end()) {
67  for (unsigned int k=0; k<php.cellSize_.size(); ++k) {
68  if (lay == (int)(k+1)) {
69  mytr.cellSize = php.cellSize_[k];
70  break;
71  }
72  }
73  php.fillModule(mytr,false);
74  if (php.layer_.empty()) php.nSectors_ = 1;
75  php.layer_.emplace_back(lay);
76  } else if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
77  php.layer_.begin()) {
78  if (zp == zpFirst) ++(php.nSectors_);
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 );
86  const CLHEP::Hep3Vector h3v ( fv.translation().X(),
87  fv.translation().Y(),
88  fv.translation().Z() );
90  mytrf.zp = zp;
91  mytrf.lay = lay;
92  mytrf.sec = sec;
93  mytrf.subsec= subs;
94  mytrf.h3v = h3v;
95  mytrf.hr = hr;
96  trforms.emplace_back(mytrf);
97  trformUse.emplace_back(false);
98  }
99  dodet = fv.next();
100  }
101  if (php.layer_.size() != php.cellSize_.size()) {
102  edm::LogError("HGCalGeom") << "HGCalGeomParameters : mismatch in # of bins "
103  << php.layer_.size() << ":" << php.cellSize_.size()
104  << " between geometry and specpar";
105  throw cms::Exception("DDException") << "HGCalGeomParameters: mismatch between geometry and specpar";
106  }
107  for (unsigned int i=0; i<php.layer_.size(); ++i) {
108  for (unsigned int k=0; k<php.layer_.size(); ++k) {
109  if (php.layer_[k] == (int)(i+1)) {
110  php.layerIndex_.emplace_back(k);
111  break;
112  }
113  }
114  }
115 #ifdef EDM_ML_DEBUG
116  std::cout << "HGCalGeomParameters finds " << php.layerIndex_.size()
117  << " modules for " << sdTag << " with " << php.nSectors_
118  << " sectors and " << trforms.size() << " transformation matrices"
119  << std::endl;
120  for (unsigned int i=0; i<php.layerIndex_.size(); ++i) {
121  int k = php.layerIndex_[i];
122  std::cout << "Module[" << i << ":" << k << "] Layer " << php.layer_[k]
123  << ":" << php.moduleLayS_[k] << " dx " << php.moduleBlS_[k]
124  << ":" << php.moduleTlS_[k] << " dy "<< php.moduleHS_[k]
125  << " dz " << php.moduleDzS_[k] << " alpha "
126  << php.moduleAlphaS_[k] << " cell " << php.moduleCellS_[k]
127  << std::endl;
128  }
129 #endif
130  int depth(0);
131  for (unsigned int i=0; i<php.layer_.size(); ++i) {
132  bool first(true);
133  float dz(0);
134  for (unsigned int k=0; k<php.layerGroup_.size(); ++k) {
135  if (php.layerGroup_[k] == (int)(i+1)) {
136  if (first) {
137  php.depth_.emplace_back(i+1);
138  php.depthIndex_.emplace_back(depth);
139  php.depthLayerF_.emplace_back(k);
140  ++depth;
141  HGCalParameters::hgtrap mytr = php.getModule(k,false);
142  mytr.lay = depth;
143  mytr.bl *= k_ScaleFromDDD;
144  mytr.tl *= k_ScaleFromDDD;
145  mytr.h *= k_ScaleFromDDD;
146  mytr.dz *= k_ScaleFromDDD;
147  mytr.cellSize *= (k_ScaleFromDDD*php.cellFactor_[k]);
148  php.fillModule(mytr, true);
149  dz = mytr.dz;
150  first = false;
151  } else {
152  dz += (k_ScaleFromDDD*php.moduleDzS_[k]);
153  php.moduleDzR_.back() = dz;
154  }
155  }
156  }
157  }
158 #ifdef EDM_ML_DEBUG
159  std::cout << "HGCalGeomParameters has " << php.depthIndex_.size()
160  << " depths" << std::endl;
161  for (unsigned int i=0; i<php.depthIndex_.size(); ++i) {
162  int k = php.depthIndex_[i];
163  std::cout << "Module[" << i << ":" << k <<"] First Layer "
164  << php.depthLayerF_[i] << " Depth " << php.depth_[k] << ":"
165  << php.moduleLayR_[k] << " dx " << php.moduleBlR_[k] << ":"
166  << php.moduleTlR_[k] << " dy " <<php.moduleHR_[k] << " dz "
167  << php.moduleDzR_[k] << " alpha " << php.moduleAlphaR_[k]
168  << " cellSize " << php.moduleCellR_[k] << std::endl;
169  }
170 #endif
171  for (unsigned int i=0; i<php.layer_.size(); ++i) {
172  for (unsigned int i1=0; i1<trforms.size(); ++i1) {
173  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay-1] ==
174  (int)(i+1)) {
175  trforms[i1].h3v *= k_ScaleFromDDD;
176  trforms[i1].lay = (i+1);
177  trformUse[i1] = true;
178  php.fillTrForm(trforms[i1]);
179  int nz(1);
180  for (unsigned int i2=i1+1; i2<trforms.size(); ++i2) {
181  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
182  php.layerGroup_[trforms[i2].lay-1] == (int)(i+1) &&
183  trforms[i2].sec == trforms[i1].sec &&
184  trforms[i2].subsec == trforms[i1].subsec) {
185  php.addTrForm(k_ScaleFromDDD*trforms[i2].h3v);
186  nz++;
187  trformUse[i2] = true;
188  }
189  }
190  if (nz > 0) {
191  php.scaleTrForm(double(1.0/nz));
192  }
193  }
194  }
195  }
196 #ifdef EDM_ML_DEBUG
197  std::cout << "Obtained " << php.trformIndex_.size()
198  << " transformation matrices" << std::endl;
199  for (unsigned int k=0; k<php.trformIndex_.size(); ++k) {
200  std::cout << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k]
201  << std::dec << ") Trnaslation (" << php.trformTranX_[k]
202  << ", " << php.trformTranY_[k] << ", " << php.trformTranZ_[k]
203  << ") Rotation (" << php.trformRotXX_[k] << ", "
204  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", "
205  << php.trformRotXY_[k] << ", " << php.trformRotYY_[k] << ", "
206  << php.trformRotZY_[k] << ", " << php.trformRotXZ_[k] << ", "
207  << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k] << ")\n";
208  }
209 #endif
210 }
std::vector< int > layer_
std::vector< double > moduleDzR_
std::vector< int > depthLayerF_
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:165
std::vector< int > depth_
std::vector< double > moduleCellR_
std::vector< double > moduleHR_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:177
const N & name() const
Definition: DDBase.h:78
std::vector< int > moduleLayR_
nav_type copyNumbers() const
return the stack of copy numbers
std::vector< double > moduleHS_
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
std::vector< double > trformTranY_
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
std::vector< int > cellFactor_
std::vector< double > trformRotXX_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > trformRotYZ_
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
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
hgtrap getModule(unsigned int k, bool reco) const
Interface to a Trapezoid.
Definition: DDSolid.h:79
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:174
std::vector< double > moduleBlR_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > moduleTlS_
int k[5][pyjets_maxn]
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
void scaleTrForm(double)
std::vector< int > layerGroup_
std::vector< double > moduleCellS_
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
Definition: DDSolid.cc:183
std::vector< double > trformRotYY_
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:180
std::vector< double > trformRotZZ_
std::vector< double > moduleAlphaS_
std::vector< double > moduleBlS_
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:186
const double k_ScaleFromDDD
std::vector< int > depthIndex_
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
void HGCalGeomParameters::loadSpecParsHexagon ( const DDFilteredView fv,
HGCalParameters php,
const DDCompactView cpv,
const std::string &  sdTag1,
const std::string &  sdTag2 
)

Definition at line 662 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

666  {
667 
669  int nmin(4);
670  php.boundR_ = getDDDArray("RadiusBound",sv,nmin);
671  for (double & k : php.boundR_)
672  k *= k_ScaleFromDDD;
673 #ifdef EDM_ML_DEBUG
674  std::cout << "HGCalGeomParameters: wafer radius ranges for cell grouping "
675  << php.boundR_[0] << ":" << php.boundR_[1] << ":"
676  << php.boundR_[2] << ":" << php.boundR_[3] << std::endl;
677 #endif
678  nmin = 2;
679  php.rLimit_ = getDDDArray("RadiusLimits",sv,nmin);
680  for (double & k : php.rLimit_)
681  k *= k_ScaleFromDDD;
682 #ifdef EDM_ML_DEBUG
683  std::cout << "HGCalGeomParameters: Minimum/maximum R "
684  << php.rLimit_[0] << ":" << php.rLimit_[1] << "\n";
685 #endif
686  nmin = 0;
687  std::vector<int> ndummy = dbl_to_int(getDDDArray("LevelTop",sv,nmin));
688  php.levelT_ = ndummy[0];
689 #ifdef EDM_ML_DEBUG
690  std::cout << "HGCalGeomParameters: LevelTop " << php.levelT_ << "\n";
691 #endif
692 
693  //Grouping of layers
694  nmin = 0;
695  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine",sv,nmin));
696  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid",sv,nmin));
697  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut",sv,nmin));
698  nmin = 1;
699  std::vector<double> slp = getDDDArray("Slope",sv,nmin);
700  php.slopeMin_ = slp[0];
701 #ifdef EDM_ML_DEBUG
702  std::cout << "HGCalGeomParameters: minimum slope " << php.slopeMin_
703  << " and layer groupings for the 3 ranges:" << std::endl;
704  for (int k=0; k<nmin; ++k)
705  std::cout << "[" << k << "] " << php.layerGroup_[k] << ":"
706  << php.layerGroupM_[k] << ":" << php.layerGroupO_[k] << "\n";
707 #endif
708 
709  //Wafer size
710  std::string attribute = "Volume";
711  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, sdTag1, 0.0)};
712  DDFilteredView fv1(*cpv,filter1);
713  if (fv1.firstChild()) {
714  DDsvalues_type sv(fv1.mergedSpecifics());
715  int nmin(0);
716  std::vector<double> dummy = getDDDArray("WaferSize",sv,nmin);
717  waferSize_ = dummy[0];
718  }
719 #ifdef EDM_ML_DEBUG
720  std::cout << "HGCalGeomParameters: Wafer Size: " << waferSize_ << std::endl;
721 #endif
722 
723  //Cell size
724  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, sdTag2, 0.0)};
725  DDFilteredView fv2(*cpv,filter2);
726  if (fv2.firstChild()) {
727  DDsvalues_type sv(fv2.mergedSpecifics());
728  int nmin(0);
729  php.cellSize_ = getDDDArray("CellSize",sv,nmin);
730  }
731 #ifdef EDM_ML_DEBUG
732  std::cout << "HGCalGeomParameters: " << php.cellSize_.size()
733  << " cells of sizes:\n";
734  for (unsigned int k=0; k<php.cellSize_.size(); ++k)
735  std::cout << " [" << k << "] " << php.cellSize_[k] << "\n";
736 #endif
737 
738 }
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_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, int &)
int k[5][pyjets_maxn]
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
std::vector< int > layerGroupO_
const double k_ScaleFromDDD
std::vector< double > rLimit_
void HGCalGeomParameters::loadSpecParsSquare ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 623 of file HGCalGeomParameters.cc.

References HGCalParameters::cellFactor_, HGCalParameters::cellSize_, gather_cfg::cout, dbl_to_int(), getDDDArray(), mps_fire::i, HGCalParameters::layerGroup_, DDFilteredView::mergedSpecifics(), HGCalParameters::nCells_, and HGCalParameters::slopeMin_.

Referenced by HGCalParametersFromDD::build().

624  {
625 
627  //Granularity in x-y plane
628  php.nCells_ = 0;
629  php.cellSize_ = getDDDArray("Granularity",sv,php.nCells_);
630 #ifdef EDM_ML_DEBUG
631  std::cout << "HGCalGeomParameters: " << php.nCells_
632  << " entries for cellSize_" << std::endl;
633  for (int i=0; i<php.nCells_; i++) {
634  std::cout << " [" << i << "] = " << php.cellSize_[i] << std::endl;
635  }
636 #endif
637 
638  //Grouping in the detector plane
639  php.cellFactor_ = dbl_to_int(getDDDArray("GroupingXY",sv,php.nCells_));
640  int nmin = 1;
641  std::vector<double> slp = getDDDArray("Slope",sv,nmin);
642  php.slopeMin_ = slp[0];
643 #ifdef EDM_ML_DEBUG
644  std::cout << "HGCalGeomParameters: minimum slope " << php.slopeMin_
645  << " and " << php.nCells_ << " entries for cellFactor_\n";
646  for (int i=0; i<php.nCells_; i++) {
647  std::cout << " [" << i << "] = " << php.cellFactor_[i] << std::endl;
648  }
649 #endif
650 
651  //Grouping of layers
652  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZ",sv,php.nCells_));
653 #ifdef EDM_ML_DEBUG
654  std::cout << "HGCalGeomParameters: " << php.nCells_
655  << " entries for layerGroup_" << std::endl;
656  for (int i=0; i<php.nCells_; i++) {
657  std::cout << " [" << i << "] = " << php.layerGroup_[i] << std::endl;
658  }
659 #endif
660 }
std::vector< int > cellFactor_
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_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, int &)
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 740 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, popcon2dropbox::copy(), TCMET_cfi::corner, gather_cfg::cout, PVValHelper::dx, PVValHelper::dy, createfilelist::int, gen::k, 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_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, waferSize_, HGCalParameters::waferTypeL_, and HGCalParameters::waferTypeT_.

Referenced by HGCalParametersFromDD::build().

740  {
741 
742  double waferW(k_ScaleFromDDD*waferSize_), rmin(k_ScaleFromDDD*php.waferR_);
743  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
744 #ifdef EDM_ML_DEBUG
745  std::cout << "Input waferWidth " << waferW << ":" << rmin
746  << " R Limits: " << rin << ":" << rout
747  << " Fine " << rMaxFine << "\n";
748 #endif
749  // Clear the vectors
750  php.waferCopy_.clear();
751  php.waferTypeL_.clear();
752  php.waferTypeT_.clear();
753  php.waferPosX_.clear();
754  php.waferPosY_.clear();
755  double dx = 0.5*waferW;
756  double dy = 3.0*dx*tan(30.0*CLHEP::deg);
757  double rr = 2.0*dx*tan(30.0*CLHEP::deg);
758  int ncol = (int)(2.0*rout/waferW) + 1;
759  int nrow = (int)(rout/(waferW*tan(30.0*CLHEP::deg))) + 1;
760  int incm(0), inrm(0), kount(0), ntot(0);
761  double xc[6], yc[6];
762  HGCalParameters::layer_map copiesInLayers(php.layer_.size()+1);
763 #ifdef EDM_ML_DEBUG
764  std::cout << "Row " << nrow << " Column " << ncol << std::endl;
765 #endif
766  for (int nr=-nrow; nr <= nrow; ++nr) {
767  int inr = (nr >= 0) ? nr : -nr;
768  for (int nc=-ncol; nc <= ncol; ++nc) {
769  int inc = (nc >= 0) ? nc : -nc;
770  if (inr%2 == inc%2) {
771  double xpos = nc*dx;
772  double ypos = nr*dy;
773  xc[0] = xpos+dx; yc[0] = ypos-0.5*rr;
774  xc[1] = xpos+dx; yc[1] = ypos+0.5*rr;
775  xc[2] = xpos; yc[2] = ypos+rr;
776  xc[3] = xpos-dx; yc[3] = ypos+0.5*rr;
777  xc[4] = xpos+dx; yc[4] = ypos-0.5*rr;
778  xc[5] = xpos; yc[5] = ypos-rr;
779  bool cornerOne(false);
780  bool cornerAll(true);
781  for (int k=0; k<6; ++k) {
782  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
783  if (rpos >= rin && rpos <= rout) cornerOne = true;
784  else cornerAll = false;
785  }
786  double rpos = std::sqrt(xpos*xpos+ypos*ypos);
787  int typet = (rpos < rMaxFine) ? 1 : 2;
788  int typel(3);
789  for (int k=1; k<4; ++k) {
790  if ((rpos+rmin)<=php.boundR_[k]) {
791  typel = k; break;
792  }
793  }
794  ++ntot;
795  if (cornerOne) {
796  int copy = inr*100 + inc;
797  if (nc < 0) copy += 10000;
798  if (nr < 0) copy += 100000;
799  if (inc > incm) incm = inc;
800  if (inr > inrm) inrm = inr;
801  kount++;
802 #ifdef EDM_ML_DEBUG
803  std::cout << kount << ":" << ntot << " Copy " << copy
804  << " Type " << typel << ":" << typet
805  << " Location " << cornerOne << ":" << cornerAll
806  << " Position " << xpos << ":" << ypos << "\n";
807 #endif
808  php.waferCopy_.emplace_back(copy);
809  php.waferTypeL_.emplace_back(typel);
810  php.waferTypeT_.emplace_back(typet);
811  php.waferPosX_.emplace_back(xpos);
812  php.waferPosY_.emplace_back(ypos);
813  for (unsigned int il=0; il<php.layer_.size(); ++il) {
814  bool corner(false);
815  cornerAll = true;
816  for (int k=0; k<6; ++k) {
817  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
818  if (rpos >= php.rMinLayHex_[il] &&
819  rpos <= php.rMaxLayHex_[il]) corner = true;
820  else cornerAll = false;
821  }
822  if (corner) {
823  std::unordered_map<int32_t,int32_t>::iterator cpy =
824  copiesInLayers[php.layer_[il]].find(copy);
825  if (cpy == copiesInLayers[php.layer_[il]].end())
826  copiesInLayers[php.layer_[il]][copy] = cornerAll ? php.waferCopy_.size() : -1;
827  }
828  }
829  }
830  }
831  }
832  }
833  php.copiesInLayers_ = copiesInLayers;
834  php.nSectors_ = (int)(php.waferCopy_.size());
835 #ifdef EDM_ML_DEBUG
836  std::cout << "HGCalWaferHexagon: # of columns " << incm << " # of rows "
837  << inrm << " and " << kount << ":" << ntot << " wafers; R "
838  << rin << ":" << rout << std::endl;
839  std::cout << "Dump copiesInLayers for " << php.copiesInLayers_.size()
840  << " layers\n";
841  for (unsigned int k=0; k<copiesInLayers.size(); ++k) {
842  const auto& theModules = copiesInLayers[k];
843  std::cout << "Layer " << k << ":" << theModules.size() << std::endl;
844  int k2(0);
845  for (std::unordered_map<int, int>::const_iterator itr=theModules.begin();
846  itr != theModules.end(); ++itr) {
847  std::cout << " " << itr->first << ":" << itr->second;
848  ++k2;
849  if (k2 > 9) { std::cout << std::endl; k2 = 0; }
850  }
851  if (k2 > 0) std::cout << std::endl;
852  }
853 #endif
854 }
std::vector< double > waferPosY_
std::vector< int > layer_
layer_map copiesInLayers_
std::vector< double > boundR_
T sqrt(T t)
Definition: SSEVec.h:18
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_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
std::vector< int > waferCopy_
const double k_ScaleFromDDD
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_

Member Data Documentation

double HGCalGeomParameters::waferSize_
private