CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 loadGeometryHexagon (const DDFilteredView &, HGCalParameters &, const std::string &, const DDCompactView *, const std::string &, const std::string &)
 
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 &)
 
 ~HGCalGeomParameters ()
 

Private Member Functions

std::pair< double, double > cellPosition (const std::vector< GlobalPoint > &wafers, std::vector< GlobalPoint >::const_iterator &itrf, unsigned int num, double rmax, double ymax, double xx, double yy, unsigned int ncells)
 
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 26 of file HGCalGeomParameters.h.

Constructor & Destructor Documentation

HGCalGeomParameters::HGCalGeomParameters ( )

Definition at line 23 of file HGCalGeomParameters.cc.

References gather_cfg::cout.

23  {
24 #ifdef DebugLog
25  std::cout << "HGCalGeomParameters::HGCalGeomParameters() constructor" << std::endl;
26 #endif
27 }
tuple cout
Definition: gather_cfg.py:145
HGCalGeomParameters::~HGCalGeomParameters ( )

Definition at line 29 of file HGCalGeomParameters.cc.

References gather_cfg::cout.

29  {
30 #ifdef DebugLog
31  std::cout << "HGCalGeomParameters::destructed!!!" << std::endl;
32 #endif
33 }
tuple cout
Definition: gather_cfg.py:145

Member Function Documentation

std::pair< double, double > HGCalGeomParameters::cellPosition ( const std::vector< GlobalPoint > &  wafers,
std::vector< GlobalPoint >::const_iterator &  itrf,
unsigned int  num,
double  rmax,
double  ymax,
double  xx,
double  yy,
unsigned int  ncells 
)
private

Definition at line 757 of file HGCalGeomParameters.cc.

References funct::abs(), funct::tan(), SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::ymax.

Referenced by loadGeometryHexagon().

760  {
761 
762  if (itrf == wafers.end()) {
763  for (std::vector<GlobalPoint>::const_iterator itr = wafers.begin();
764  itr != wafers.end(); ++itr) {
765  double dx = std::abs(xx - itr->x());
766  double dy = std::abs(yy - itr->y());
767  if (dx <= (rmax+0.0001) && dy <= ymax) {
768  double xmax = (dy <= 0.5*ymax) ? rmax : (rmax-(dy-0.5*ymax)/tan(30.0*CLHEP::deg));
769  if ((dx <= (xmax+0.0001)) && ((yy-itr->y()>0) || (num<=ncells/2+8))) {
770  itrf = itr;
771  break;
772  }
773  }
774  }
775  }
776  double dx(0), dy(0);
777  if (itrf != wafers.end()) {
778  dx = (xx - itrf->x());
779  if (std::abs(dx) < 0.001) dx = 0;
780  dy = (yy - itrf->y());
781  if (std::abs(dy) < 0.001) dy = 0;
782  }
783  return std::pair<double,double>(dx,dy);
784 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
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 720 of file HGCalGeomParameters.cc.

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

Referenced by loadSpecParsHexagon(), and loadSpecParsSquare().

722  {
723  DDValue value(str);
724  if (DDfetch(&sv,value)) {
725  const std::vector<double> & fvec = value.doubles();
726  int nval = fvec.size();
727  if (nmin > 0) {
728  if (nval < nmin) {
729  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
730  << " bins " << nval << " < " << nmin
731  << " ==> illegal";
732  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
733  }
734  } else {
735  if (nval < 1 && nmin == 0) {
736  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
737  << " bins " << nval << " < 2 ==> illegal"
738  << " (nmin=" << nmin << ")";
739  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
740  }
741  }
742  nmin = nval;
743  return fvec;
744  } else {
745  if (nmin >= 0) {
746  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
747  << str;
748  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
749  }
750  std::vector<double> fvec;
751  nmin = 0;
752  return fvec;
753  }
754 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
void HGCalGeomParameters::loadGeometryHexagon ( const DDFilteredView _fv,
HGCalParameters php,
const std::string &  sdTag1,
const DDCompactView cpv,
const std::string &  sdTag2,
const std::string &  sdTag3 
)

Definition at line 210 of file HGCalGeomParameters.cc.

References funct::abs(), DDFilteredView::addFilter(), HGCalParameters::addTrForm(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::boundR_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellPosition(), HGCalParameters::hgtrap::cellSize, HGCalParameters::copiesInLayers_, filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), funct::cos(), gather_cfg::cout, CommonMethods::cp(), TauDecayModes::dec, HLT_FULL_cff::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, equals, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, DDFilteredView::firstChild(), citk::for(), HGCalParameters::getModule(), HGCalParameters::hgtrap::h, AnalysisDataFormats_SUSYBSMObjects::hr, i, relval_2017::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_, mergeVDriftHistosByStation::name, DDBase< N, C >::name(), cscdqm::h::names, DDFilteredView::next(), HGCalParameters::nSectors_, convertSQLiteXML::ok, alignCSCRings::r, DDTubs::rIn(), HGCalParameters::rMaxLayHex_, DDPolyhedra::rMaxVec(), HGCalParameters::rMinLayHex_, idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::scaleTrForm(), DDSpecificsFilter::setCriteria(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), 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, create_public_lumi_plots::xy, y, SiStripMonitorClusterAlca_cfi::ymax, z, HGCalParameters::zLayerHex_, HGCalParameters::hgtrform::zp, and DDPolyhedra::zVec().

Referenced by HGCalParametersFromDD::build().

215  {
216 
217  DDFilteredView fv = _fv;
218  bool dodet(true);
219  std::map<int,HGCalGeomParameters::layerParameters> layers;
220  std::vector<HGCalParameters::hgtrform> trforms;
221  std::vector<bool> trformUse;
222 
223  while (dodet) {
224  const DDSolid & sol = fv.logicalPart().solid();
225  std::string name = sol.name();
226  bool isd = (name.find(sdTag1) != std::string::npos);
227  // Layers first
228  if (isd) {
229  std::vector<int> copy = fv.copyNumbers();
230  int nsiz = (int)(copy.size());
231  int lay = (nsiz > 0) ? copy[nsiz-1] : 0;
232  int zp = (nsiz > 2) ? copy[nsiz-3] : -1;
233  if (zp !=1 ) zp = -1;
234  if (lay == 0) {
235  edm::LogError("HGCalGeom") << "Funny layer # " << lay << " zp "
236  << zp << " in " << nsiz << " components";
237  throw cms::Exception("DDException") << "Funny layer # " << lay;
238  } else {
239  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
240  php.layer_.end()) php.layer_.push_back(lay);
241  std::map<int,HGCalGeomParameters::layerParameters>::iterator itr = layers.find(lay);
242  if (itr == layers.end()) {
243  const DDTubs & tube = static_cast<DDTubs>(sol);
244  double rin = k_ScaleFromDDD*tube.rIn();
245  double rout= k_ScaleFromDDD*tube.rOut();
246  double zp = k_ScaleFromDDD*fv.translation().Z();
247  HGCalGeomParameters::layerParameters laypar(rin,rout,zp);
248  layers[lay] = laypar;
249  }
250  DD3Vector x, y, z;
251  fv.rotation().GetComponents( x, y, z ) ;
252  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
253  x.Y(), y.Y(), z.Y(),
254  x.Z(), y.Z(), z.Z() );
255  const CLHEP::HepRotation hr ( rotation );
256  double xx = k_ScaleFromDDD*fv.translation().X();
257  if (std::abs(xx) < 0.001) xx = 0;
258  double yy = k_ScaleFromDDD*fv.translation().Y();
259  if (std::abs(yy) < 0.001) yy = 0;
260  const CLHEP::Hep3Vector h3v ( xx, yy, fv.translation().Z() );
262  mytrf.zp = zp;
263  mytrf.lay = lay;
264  mytrf.sec = 0;
265  mytrf.subsec= 0;
266  mytrf.h3v = h3v;
267  mytrf.hr = hr;
268  trforms.push_back(mytrf);
269  trformUse.push_back(false);
270  }
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<GlobalPoint> wafers;
283  std::string attribute = "Volume";
284  DDValue val1(attribute, sdTag2, 0.0);
285  DDSpecificsFilter filter1;
286  filter1.setCriteria(val1, DDCompOp::equals);
287  DDFilteredView fv1(*cpv);
288  fv1.addFilter(filter1);
289  bool ok = fv1.firstChild();
290  double rmax(0);
291  if (!ok) {
292  edm::LogError("HGCalGeom") << " Attribute " << val1
293  << " not found but needed.";
294  throw cms::Exception("DDException") << "Attribute " << val1
295  << " not found but needed.";
296  } else {
297  dodet = true;
298  std::unordered_set<std::string> names;
299  while (dodet) {
300  const DDSolid & sol = fv1.logicalPart().solid();
301  std::string name = fv1.logicalPart().name();
302  bool isd = (name.find(sdTag2) != std::string::npos);
303  if (isd) {
304  std::vector<int> copy = fv1.copyNumbers();
305  int nsiz = (int)(copy.size());
306  int wafer = (nsiz > 0) ? copy[nsiz-1] : 0;
307  int layer = (nsiz > 0) ? copy[nsiz-2] : 0;
308  if (wafer == 0 ) {
309  edm::LogError("HGCalGeom") << "Funny wafer # " << wafer << " in "
310  << nsiz << " components";
311  throw cms::Exception("DDException") << "Funny wafer # " << wafer;
312  } else {
313  std::unordered_map<int32_t,int32_t>::iterator itr =
314  copies.find(wafer);
315  std::unordered_map<int32_t,int32_t>::iterator cpy =
316  copiesInLayers[layer].find(wafer);
317  if( itr != copies.end() && cpy == copiesInLayers[layer].end() ) {
318  copiesInLayers[layer][wafer] = itr->second;
319  }
320  if (itr == copies.end()) {
321  copies[wafer] = wafer2copy.size();
322  copiesInLayers[layer][wafer] = wafer2copy.size();
323  double xx = k_ScaleFromDDD*fv1.translation().X();
324  if (std::abs(xx) < 0.001) xx = 0;
325  double yy = k_ScaleFromDDD*fv1.translation().Y();
326  if (std::abs(yy) < 0.001) yy = 0;
327  wafer2copy.emplace_back(wafer);
328  wafers.emplace_back(xx,yy,k_ScaleFromDDD*fv1.translation().Z());
329  if ( names.count(name) == 0 ) {
330  const DDPolyhedra & polyhedra = static_cast<DDPolyhedra>(sol);
331  std::vector<double> zv = polyhedra.zVec();
332  std::vector<double> rv = polyhedra.rMaxVec();
333  php.waferR_ = rv[0]/std::cos(30.0*CLHEP::deg);
334  rmax = k_ScaleFromDDD*rv[0];
335  double dz = 0.5*(zv[1]-zv[0]);
337  mytr.lay = 1; mytr.bl = php.waferR_;
338  mytr.tl = php.waferR_; mytr.h = php.waferR_;
339  mytr.dz = dz; mytr.alpha = 0.0;
340  mytr.cellSize = waferSize_;
341  php.fillModule(mytr,false);
342  names.insert(name);
343  }
344  }
345  }
346  }
347  dodet = fv1.next();
348  }
349  }
350 
351  // Finally the cells
352  std::map<int,int> wafertype;
353  std::map<int,HGCalGeomParameters::cellParameters> cellsf, cellsc;
354  double ymax = 2.0*rmax*tan(30.0*CLHEP::deg);
355  DDValue val2(attribute, sdTag3, 0.0);
356  DDSpecificsFilter filter2;
357  filter2.setCriteria(val2, DDCompOp::equals);
358  DDFilteredView fv2(*cpv);
359  fv2.addFilter(filter2);
360  ok = fv2.firstChild();
361  if (!ok) {
362  edm::LogError("HGCalGeom") << " Attribute " << val2
363  << " not found but needed.";
364  throw cms::Exception("DDException") << "Attribute " << val2
365  << " not found but needed.";
366  } else {
367  dodet = true;
368  while (dodet) {
369  const DDSolid & sol = fv2.logicalPart().solid();
370  std::string name = sol.name();
371  bool isd = (name.find(sdTag3) != std::string::npos);
372  if (isd) {
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  if (type == 1) {
389  itr = cellsf.find(cell);
390  newc= (itr == cellsf.end());
391  } else {
392  itr = cellsc.find(cell);
393  newc= (itr == cellsc.end());
394  }
395  if (newc) {
396  bool half = (name.find("Half") != std::string::npos);
397  double xx = k_ScaleFromDDD*fv2.translation().X();
398  double yy = k_ScaleFromDDD*fv2.translation().Y();
400  if (type == 1) {
401  cellsf[cell] = cp;
402  } else {
403  cellsc[cell] = cp;
404  }
405  }
406  }
407  }
408  dodet = fv2.next();
409  }
410  }
411 
412  if ((cellsf.size()==0) || (cellsc.size()==0) || (wafers.size()==0) ||
413  (layers.size()==0)) {
414  edm::LogError("HGCalGeom") << "HGCalGeomParameters : number of cells "
415  << cellsf.size() << ":" << cellsc.size()
416  << " wafers " << wafers.size() << " layers "
417  << layers.size() << " illegal";
418  throw cms::Exception("DDException")
419  << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
420  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
421  << " layers " << layers.size();
422  }
423 
424  for (unsigned int i=0; i<layers.size(); ++i) {
425  for (std::map<int,HGCalGeomParameters::layerParameters>::iterator itr = layers.begin();
426  itr != layers.end(); ++itr) {
427  if (itr->first == (int)(i+1)) {
428  php.layerIndex_.push_back(i);
429  php.rMinLayHex_.push_back(itr->second.rmin);
430  php.rMaxLayHex_.push_back(itr->second.rmax);
431  php.zLayerHex_.push_back(itr->second.zpos);
432  break;
433  }
434  }
435  }
436  for (unsigned int i=0; i<php.layer_.size(); ++i) {
437  for (unsigned int i1=0; i1<trforms.size(); ++i1) {
438  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay-1] ==
439  (int)(i+1)) {
440  trforms[i1].h3v *= k_ScaleFromDDD;
441  trforms[i1].lay = (i+1);
442  trformUse[i1] = true;
443  php.fillTrForm(trforms[i1]);
444  int nz(1);
445  for (unsigned int i2=i1+1; i2<trforms.size(); ++i2) {
446  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
447  php.layerGroup_[trforms[i2].lay-1] == (int)(i+1)) {
448  php.addTrForm(k_ScaleFromDDD*trforms[i2].h3v);
449  nz++;
450  trformUse[i2] = true;
451  }
452  }
453  if (nz > 0) {
454  php.scaleTrForm(double(1.0/nz));
455  }
456  }
457  }
458  }
459 
460  double rmin = k_ScaleFromDDD*php.waferR_;
461  for (unsigned i = 0; i < wafer2copy.size(); ++i ) {
462  php.waferCopy_.push_back(wafer2copy[i]);
463  php.waferPosX_.push_back(wafers[i].x());
464  php.waferPosY_.push_back(wafers[i].y());
465  std::map<int,int>::iterator ktr = wafertype.find(wafer2copy[i]);
466  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
467  php.waferTypeT_.push_back(typet);
468  double r = wafers[i].perp();
469  int type(3);
470  for (int k=1; k<4; ++k) {
471  if ((r+rmin)<=php.boundR_[k]) {
472  type = k; break;
473  }
474  }
475  php.waferTypeL_.push_back(type);
476  }
477  php.copiesInLayers_ = copiesInLayers;
478  php.nSectors_ = (int)(php.waferCopy_.size());
479 
480  std::vector<GlobalPoint>::const_iterator itrf = wafers.end();
481  for (unsigned int i=0; i<cellsf.size(); ++i) {
482  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr = cellsf.find(i);
483  if (itr == cellsf.end()) {
484  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
485  << " fine cell number " << i;
486  throw cms::Exception("DDException")
487  << "HGCalGeomParameters: missing info for fine cell number " << i;
488  } else {
489  double xx = (itr->second).xyz.x();
490  double yy = (itr->second).xyz.y();
491  std::pair<double,double> xy = cellPosition(wafers,itrf,i,rmax,ymax,xx,yy,cellsf.size());
492  if ((itr->second).half) {
493  if (xy.first > 0) xy.first -= 0.001;
494  else xy.first += 0.001;
495  }
496  php.cellFineX_.push_back(xy.first);
497  php.cellFineY_.push_back(xy.second);
498  }
499  }
500  itrf = wafers.end();
501  for (unsigned int i=0; i<cellsc.size(); ++i) {
502  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr = cellsc.find(i);
503  if (itr == cellsc.end()) {
504  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
505  << " coarse cell number " << i;
506  throw cms::Exception("DDException")
507  << "HGCalGeomParameters: missing info for coarse cell number " << i;
508  } else {
509  double xx = (itr->second).xyz.x();
510  double yy = (itr->second).xyz.y();
511  std::pair<double,double> xy = cellPosition(wafers,itrf,i,rmax,ymax,xx,yy,cellsc.size());
512  if ((itr->second).half) {
513  if (xy.first > 0) xy.first -= 0.001;
514  else xy.first += 0.001;
515  }
516  php.cellCoarseX_.push_back(xy.first);
517  php.cellCoarseY_.push_back(xy.second);
518  }
519  }
520  int depth(0);
521  for (unsigned int i=0; i<php.layerGroup_.size(); ++i) {
522  bool first(true);
523  for (unsigned int k=0; k<php.layerGroup_.size(); ++k) {
524  if (php.layerGroup_[k] == (int)(i+1)) {
525  if (first) {
526  php.depth_.push_back(i+1);
527  php.depthIndex_.push_back(depth);
528  php.depthLayerF_.push_back(k);
529  ++depth;
530  first = false;
531  }
532  }
533  }
534  }
535  HGCalParameters::hgtrap mytr = php.getModule(0, false);
536  mytr.bl *= k_ScaleFromDDD;
537  mytr.tl *= k_ScaleFromDDD;
538  mytr.h *= k_ScaleFromDDD;
539  mytr.dz *= k_ScaleFromDDD;
540  double dz = mytr.dz;
541  php.fillModule(mytr, true);
542  mytr.dz = 2*dz;
543  php.fillModule(mytr, true);
544  mytr.dz = 3*dz;
545  php.fillModule(mytr, true);
546 #ifdef DebugLog
547  std::cout << "HGCalGeomParameters: rmax = " << rmax << ", ymax = " << ymax
548  << std::endl;
549  std::cout << "HGCalGeomParameters finds " << php.zLayerHex_.size()
550  << " layers" << std::endl;
551  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
552  int k = php.layerIndex_[i];
553  std::cout << "Layer[" << i << ":" << k << ":" << php.layer_[k]
554  << "] with r = " << php.rMinLayHex_[i] << ":"
555  << php.rMaxLayHex_[i] << " at z = " << php.zLayerHex_[i]
556  << std::endl;
557  }
558  std::cout << "HGCalGeomParameters has " << php.depthIndex_.size()
559  << " depths" << std::endl;
560  for (unsigned int i=0; i<php.depthIndex_.size(); ++i) {
561  int k = php.depthIndex_[i];
562  std::cout << "Reco Layer[" << i << ":" << k << "] First Layer "
563  << php.depthLayerF_[i] << " Depth " << php.depth_[k]
564  << std::endl;
565  }
566  std::cout << "HGCalGeomParameters finds " << php.nSectors_ << " wafers"
567  << std::endl;
568  for (unsigned int i=0; i<php.waferCopy_.size(); ++i)
569  std::cout << "Wafer[" << i << ": " <<php.waferCopy_[i] << "] type "
570  << php.waferTypeL_[i] << ":" << php.waferTypeT_[i] << " at ("
571  << php.waferPosX_[i] << "," << php.waferPosY_[i] << ",0)"
572  << std::endl;
573  std::cout << "HGCalGeomParameters: wafer radius " << php.waferR_
574  << " and dimensions of the wafers:" << std::endl;
575  std::cout << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0]
576  << ":" << php.moduleTlS_[0] << " dy " << php.moduleHS_[0]
577  << " dz " << php.moduleDzS_[0] << " alpha "
578  << php.moduleAlphaS_[0] << std::endl;
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]
583  << " alpha " << 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] << ")"
605  << std::endl;
606  }
607 #endif
608 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< int > layer_
std::vector< double > moduleDzR_
int i
Definition: DBlmapReader.cc:9
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
static const HistoName names[]
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:440
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:7
std::vector< double > trformRotXX_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > cellCoarseX_
std::vector< double > trformRotYZ_
std::vector< double > boundR_
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::pair< double, double > cellPosition(const std::vector< GlobalPoint > &wafers, std::vector< GlobalPoint >::const_iterator &itrf, unsigned int num, double rmax, double ymax, double xx, double yy, unsigned int ncells)
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
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
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)
std::vector< double > moduleTlS_
double rOut(void) const
Definition: DDSolid.cc:509
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
std::vector< double > zVec(void) const
Definition: DDSolid.cc:426
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_
std::vector< int > waferCopy_
std::vector< int > depthIndex_
double k_ScaleFromDDD
tuple cout
Definition: gather_cfg.py:145
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:507
for(const auto &isodef:isoDefs)
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32
void HGCalGeomParameters::loadGeometrySquare ( const DDFilteredView _fv,
HGCalParameters php,
const std::string &  sdTag 
)

Definition at line 35 of file HGCalGeomParameters.cc.

References HGCalParameters::addTrForm(), HGCalParameters::hgtrap::alpha, DDTrap::alpha1(), HGCalParameters::hgtrap::bl, HGCalParameters::cellFactor_, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), gather_cfg::cout, TauDecayModes::dec, HLT_FULL_cff::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, DDTrap::halfZ(), AnalysisDataFormats_SUSYBSMObjects::hr, i, relval_2017::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_, mergeVDriftHistosByStation::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().

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

References DDFilteredView::addFilter(), HGCalParameters::boundR_, HGCalParameters::cellSize_, gather_cfg::cout, dbl_to_int(), DebugLog, equals, DDFilteredView::firstChild(), getDDDArray(), relval_2017::k, k_ScaleFromDDD, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, DDFilteredView::mergedSpecifics(), DDSpecificsFilter::setCriteria(), AlCaHLTBitMon_QueryRunRegistry::string, and waferSize_.

Referenced by HGCalParametersFromDD::build().

656  {
657 
659  int nmin(4);
660  php.boundR_ = getDDDArray("RadiusBound",sv,nmin);
661  for (unsigned int k=0; k<php.boundR_.size(); ++k)
662  php.boundR_[k] *= k_ScaleFromDDD;
663 #ifdef DebugLog
664  std::cout << "HGCalGeomParameters: wafer radius ranges for cell grouping "
665  << php.boundR_[0] << ":" << php.boundR_[1] << ":"
666  << php.boundR_[2] << ":" << php.boundR_[3] << std::endl;
667 #endif
668 
669  //Grouping of layers
670  nmin = 0;
671  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine",sv,nmin));
672  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid",sv,nmin));
673  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut",sv,nmin));
674 #ifdef DebugLog
675  std::cout << "HGCalGeomParameters: layer grouping for the 3 ranges:"
676  << std::endl;
677  for (int k=0; k<nmin; ++k)
678  std::cout << "[" << k << "] " << php.layerGroup_[k] << ":"
679  << php.layerGroupM_[k] << ":" << php.layerGroupO_[k] << std::endl;
680 #endif
681 
682  //Wafer size
683  std::string attribute = "Volume";
684  DDValue val1(attribute, sdTag1, 0.0);
685  DDSpecificsFilter filter1;
686  filter1.setCriteria(val1, DDCompOp::equals);
687  DDFilteredView fv1(*cpv);
688  fv1.addFilter(filter1);
689  if (fv1.firstChild()) {
690  DDsvalues_type sv(fv1.mergedSpecifics());
691  int nmin(0);
692  std::vector<double> dummy = getDDDArray("WaferSize",sv,nmin);
693  waferSize_ = dummy[0];
694  }
695 #ifdef DebugLog
696  std::cout << "HGCalGeomParameters: Wafer Size: " << waferSize_ << std::endl;
697 #endif
698 
699  //Cell size
700  DDValue val2(attribute, sdTag2, 0.0);
701  DDSpecificsFilter filter2;
702  filter2.setCriteria(val2, DDCompOp::equals);
703  DDFilteredView fv2(*cpv);
704  fv2.addFilter(filter2);
705  if (fv2.firstChild()) {
706  DDsvalues_type sv(fv2.mergedSpecifics());
707  int nmin(0);
708  php.cellSize_ = getDDDArray("CellSize",sv,nmin);
709  }
710 #ifdef DebugLog
711  std::cout << "HGCalGeomParameters: " << php.cellSize_.size()
712  << " cells of sizes:";
713  for (unsigned int k=0; k<php.cellSize_.size(); ++k)
714  std::cout << " [" << k << "] " << php.cellSize_[k];
715  std::cout << std::endl;
716 #endif
717 
718 }
#define DebugLog
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.cc:4
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:19
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, int &)
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
std::vector< int > layerGroupO_
double k_ScaleFromDDD
tuple cout
Definition: gather_cfg.py:145
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32
void HGCalGeomParameters::loadSpecParsSquare ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 610 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

611  {
612 
614  //Granularity in x-y plane
615  php.nCells_ = 0;
616  php.cellSize_ = getDDDArray("Granularity",sv,php.nCells_);
617 #ifdef DebugLog
618  std::cout << "HGCalGeomParameters: " << php.nCells_ <<" entries for cellSize_"
619  << std::endl;
620  for (int i=0; i<php.nCells_; i++) {
621  std::cout << " [" << i << "] = " << php.cellSize_[i];
622  if (i%8 == 7) std::cout << std::endl;
623  }
624  if ((php.nCells_-1)%8 != 7) std::cout << std::endl;
625 #endif
626 
627  //Grouping in the detector plane
628  php.cellFactor_ = dbl_to_int(getDDDArray("GroupingXY",sv,php.nCells_));
629 #ifdef DebugLog
630  std::cout << "HGCalGeomParameters: " << php.nCells_
631  << " entries for cellFactor_" << std::endl;
632  for (int i=0; i<php.nCells_; i++) {
633  std::cout << " [" << i << "] = " << php.cellFactor_[i];
634  if (i%8 == 7) std::cout << std::endl;
635  }
636  if ((php.nCells_-1)%8 != 7) std::cout << std::endl;
637 #endif
638 
639  //Grouping of layers
640  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZ",sv,php.nCells_));
641 #ifdef DebugLog
642  std::cout << "HGCalGeomParameters: " << php.nCells_
643  << " entries for layerGroup_" << std::endl;
644  for (int i=0; i<php.nCells_; i++) {
645  std::cout << " [" << i << "] = " << php.layerGroup_[i];
646  if (i%8 == 7) std::cout << std::endl;
647  }
648  if ((php.nCells_-1)%8 != 7) std::cout << std::endl;
649 #endif
650 }
int i
Definition: DBlmapReader.cc:9
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.cc:4
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:19
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, int &)
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
tuple cout
Definition: gather_cfg.py:145

Member Data Documentation

double HGCalGeomParameters::waferSize_
private

Definition at line 63 of file HGCalGeomParameters.h.

Referenced by loadGeometryHexagon(), and loadSpecParsHexagon().