test
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 loadCellParsHexagon (const DDCompactView *cpv, HGCalParameters &php)
 
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 &)
 
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 26 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 }
tuple cout
Definition: gather_cfg.py:145
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 }
tuple cout
Definition: gather_cfg.py:145

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

References funct::abs().

Referenced by loadGeometryHexagon().

929  {
930 
931  if (itrf == wafers.end()) {
932  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin();
933  itr != wafers.end(); ++itr) {
934  if (itr->wafer == wafer) {
935  itrf = itr;
936  break;
937  }
938  }
939  }
940  double dx(0), dy(0);
941  if (itrf != wafers.end()) {
942  dx = (xx - itrf->xyz.x());
943  if (std::abs(dx) < 0.001) dx = 0;
944  dy = (yy - itrf->xyz.y());
945  if (std::abs(dy) < 0.001) dy = 0;
946  }
947  return std::pair<double,double>(dx,dy);
948 }
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 890 of file HGCalGeomParameters.cc.

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

Referenced by loadSpecParsHexagon(), and loadSpecParsSquare().

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

Definition at line 855 of file HGCalGeomParameters.cc.

References DDFilteredView::addFilter(), AND, HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, gather_cfg::cout, dbl_to_int(), DDFilteredView::firstChild(), DDVectorGetter::get(), relval_2017::k, not_equals, convertSQLiteXML::ok, DDSpecificsFilter::setCriteria(), AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by HGCalParametersFromDD::build().

856  {
857 
858  //Special parameters for cell parameters
859  std::string attribute = "OnlyForHGCalNumbering";
860  std::string value = "any";
861  DDValue val1(attribute, value, 0.0);
862  DDSpecificsFilter filter1;
863  filter1.setCriteria(val1, DDCompOp::not_equals,
864  DDLogOp::AND, true, // compare strings otherwise doubles
865  true // use merged-specifics or simple-specifics
866  );
867  DDFilteredView fv1(*cpv);
868  fv1.addFilter(filter1);
869  bool ok = fv1.firstChild();
870 
871  if (ok) {
872  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
873  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
874  }
875 
876 #ifdef EDM_ML_DEBUG
877  std::cout << "HGCalLoadCellPars: " << php.cellFine_.size()
878  << " rows for fine cells\n";
879  for (unsigned int k=0; k<php.cellFine_.size(); ++k)
880  std::cout << k << ":" << php.cellFine_[k] << " ";
881  std::cout << std::endl;
882  std::cout << "HGCalLoadCellPars: " <<php.cellCoarse_.size()
883  << " rows for coarse cells\n";
884  for (unsigned int k=0; k<php.cellCoarse_.size(); ++k)
885  std::cout << k << ":" << php.cellCoarse_[k] << " ";
886  std::cout << std::endl;
887 #endif
888 }
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 &)
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:253
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:33
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 212 of file HGCalGeomParameters.cc.

References funct::abs(), DDFilteredView::addFilter(), 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_, filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), funct::cos(), gather_cfg::cout, SimDataFormats::CaloAnalysis::cp, TauDecayModes::dec, HLT_25ns10e33_v2_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, relval_steps::k2, 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, AlCaHLTBitMon_ParallelJobs::p, p1, p2, 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, 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, z, HGCalParameters::zLayerHex_, HGCalParameters::hgtrform::zp, and DDPolyhedra::zVec().

Referenced by HGCalParametersFromDD::build().

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

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_.size() == 0) php.nSectors_ = 1;
75  php.layer_.push_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.push_back(mytrf);
97  trformUse.push_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_.push_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_.push_back(i+1);
138  php.depthIndex_.push_back(depth);
139  php.depthLayerF_.push_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_
int i
Definition: DBlmapReader.cc:9
std::vector< int > depthLayerF_
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:174
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:182
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:37
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:180
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:186
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:184
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:188
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 655 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

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

Definition at line 616 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

617  {
618 
620  //Granularity in x-y plane
621  php.nCells_ = 0;
622  php.cellSize_ = getDDDArray("Granularity",sv,php.nCells_);
623 #ifdef EDM_ML_DEBUG
624  std::cout << "HGCalGeomParameters: " << php.nCells_
625  << " entries for cellSize_" << std::endl;
626  for (int i=0; i<php.nCells_; i++) {
627  std::cout << " [" << i << "] = " << php.cellSize_[i] << std::endl;
628  }
629 #endif
630 
631  //Grouping in the detector plane
632  php.cellFactor_ = dbl_to_int(getDDDArray("GroupingXY",sv,php.nCells_));
633  int nmin = 1;
634  std::vector<double> slp = getDDDArray("Slope",sv,nmin);
635  php.slopeMin_ = slp[0];
636 #ifdef EDM_ML_DEBUG
637  std::cout << "HGCalGeomParameters: minimum slope " << php.slopeMin_
638  << " and " << php.nCells_ << " entries for cellFactor_\n";
639  for (int i=0; i<php.nCells_; i++) {
640  std::cout << " [" << i << "] = " << php.cellFactor_[i] << std::endl;
641  }
642 #endif
643 
644  //Grouping of layers
645  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZ",sv,php.nCells_));
646 #ifdef EDM_ML_DEBUG
647  std::cout << "HGCalGeomParameters: " << php.nCells_
648  << " entries for layerGroup_" << std::endl;
649  for (int i=0; i<php.nCells_; i++) {
650  std::cout << " [" << i << "] = " << php.layerGroup_[i] << std::endl;
651  }
652 #endif
653 }
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.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
tuple cout
Definition: gather_cfg.py:145
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 739 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, filterCSVwithJSON::copy, gather_cfg::cout, relval_2017::k, relval_steps::k2, k_ScaleFromDDD, HGCalParameters::layer_, 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().

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

Member Data Documentation

double HGCalGeomParameters::waferSize_
private