CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTBHodoscopeGeometryLoaderFromDDD.cc
Go to the documentation of this file.
3 
4 
7 
8 
16 //#include "DetectorDescription/Core/interface/DDInit.h"
17 
18 
19 #include <iostream>
20 #include <vector>
21 
23 {
25 }
26 
27 std::auto_ptr<CaloSubdetectorGeometry> EcalTBHodoscopeGeometryLoaderFromDDD::load(const DDCompactView* cpv) {
28  std::cout << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: start the construction of EcalTBHodoscope" << std::endl;
29  std::auto_ptr<CaloSubdetectorGeometry> ebg(new CaloSubdetectorGeometry());
30  makeGeometry(cpv,dynamic_cast<CaloSubdetectorGeometry*>(ebg.get()));
31  std::cout << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: Returning EcalTBHodoscopeGeometry" << std::endl;
32  return ebg;
33 }
34 
36 {
37 
38  if( ebg->cornersMgr() == 0 ) ebg->allocateCorners( 256 ) ;
39  if( ebg->parMgr() == 0 ) ebg->allocatePar( 10, 3 ) ;
40 
42 
43  DDFilteredView fv(*cpv);
44  fv.addFilter(*filter);
45 
46  bool doSubDets;
47  for (doSubDets = fv.firstChild(); doSubDets ; doSubDets = fv.nextSibling())
48  {
49 
50 #if 0
51  std::string answer = getDDDString("ReadOutName",&fv);
52  if (answer != "EcalTBH4BeamHits")
53  continue;
54 #endif
55 
56  const DDSolid & solid = fv.logicalPart().solid();
57 
58  if (solid.shape() != ddbox) {
59  throw DDException(std::string(__FILE__)
60  +"\n CaloGeometryEcalTBHodoscope::upDate(...): currently only box fiber shapes supported ");
61  edm::LogWarning("EcalTBHodoscopeGeometry") << "Wrong shape for sensitive volume!" << solid;
62  }
63 
64  std::vector<double> pv = solid.parameters();
65 
66  // use preshower strip as box in space representation
67 
68  // rotate the box and then move it
69  DD3Vector x, y, z;
70  fv.rotation().GetComponents(x,y,z);
71  CLHEP::Hep3Vector hx(x.X(), x.Y(), x.Z());
72  CLHEP::Hep3Vector hy(y.X(), y.Y(), y.Z());
73  CLHEP::Hep3Vector hz(z.X(), z.Y(), z.Z());
74  CLHEP::HepRotation hrot(hx, hy, hz);
75  CLHEP::Hep3Vector htran(fv.translation().X(), fv.translation().Y(), fv.translation().Z());
76 
77  const HepGeom::Transform3D ht3d ( hrot, // only scale translation
79 
80 
81  const HepGeom::Point3D<double> ctr ( ht3d*HepGeom::Point3D<double> (0,0,0) ) ;
82 
83  const GlobalPoint refPoint ( ctr.x(), ctr.y(), ctr.z() ) ;
84 
85 
86  std::vector<double> vv ;
87  vv.reserve( pv.size() ) ;
88  for( unsigned int i ( 0 ) ; i != pv.size() ; ++i )
89  {
90  vv.push_back( CaloCellGeometry::k_ScaleFromDDDtoGeant*pv[i] ) ;
91  }
92  const double* pP ( CaloCellGeometry::getParmPtr( vv,
93  ebg->parMgr(),
94  ebg->parVecVec() ) ) ;
95 
96  PreshowerStrip* cell ( new PreshowerStrip( refPoint,
97  ebg->cornersMgr(),
98  pP ) ) ;
99 
100  //Adding cell to the Geometry
101  ebg->addCell(DetId(getDetIdForDDDNode(fv)),cell);
102  } // loop over all children (i.e. crystals)
103 }
104 
106 {
107  // perform some consistency checks
108  // get the parents and grandparents of this node
110 
111  assert(parents.size() >= 3);
112 
113  EcalBaseNumber baseNumber;
114  //baseNumber.setSize(parents.size());
115 
116  for (unsigned int i=1 ;i <= parents.size(); i++)
117  baseNumber.addLevel(parents[parents.size()-i].logicalPart().name().name(),parents[parents.size()-i].copyno());
118 
119  return (_scheme->getUnitID(baseNumber));
120 
121 }
122 
124 {
126  filter->setCriteria(DDValue("SensitiveDetector","EcalTBH4BeamDetector",0),DDSpecificsFilter::equals,DDSpecificsFilter::AND,true,true);
127  filter->setCriteria(DDValue("ReadOutName","EcalTBH4BeamHits",0),DDSpecificsFilter::equals,DDSpecificsFilter::AND,true,true);
128  return filter;
129 }
const std::vector< double > & parameters() const
Don&#39;t use (only meant to be used by DDbox(), DDtub(), ...)
Definition: DDSolid.cc:153
answer
Definition: submit.py:44
int i
Definition: DBlmapReader.cc:9
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
void addFilter(const DDFilter &, log_op op=AND)
TPRegexp parents
Definition: eve_filter.cc:24
std::auto_ptr< CaloSubdetectorGeometry > load(const DDCompactView *cpv)
DDSolidShape shape() const
The type of the solid.
Definition: DDSolid.cc:147
bool nextSibling()
set the current node to the next sibling ...
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
An exception for DDD errors.
Definition: DDException.h:23
type of data representation of DDCompactView
Definition: DDCompactView.h:81
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
void allocatePar(ParVec::size_type n, unsigned int m)
double double double z
A DDSolid represents the shape of a part.
Definition: DDSolid.h:42
A base class to handle the shape of preshower strips.
std::string getDDDString(std::string s, DDFilteredView *fv)
void addCell(const DetId &id, CaloCellGeometry *ccg)
Add a cell to the geometry.
void addLevel(const std::string &name, const int &copyNumber)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
static const float k_ScaleFromDDDtoGeant
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
Definition: DetId.h:20
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
Definition: align_tpl.py:86
CaloCellGeometry::CornersMgr * cornersMgr()
virtual uint32_t getUnitID(const EcalBaseNumber &baseNumber) const
static const double * getParmPtr(const std::vector< double > &vd, ParMgr *mgr, ParVecVec &pvv)
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
bool firstChild()
set the current node to the first child ...
unsigned int getDetIdForDDDNode(const DDFilteredView &fv)
A Filter accepts or rejects a DDExpandedNode based on a user-coded decision rule. ...
Definition: DDFilter.h:18
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
tuple cout
Definition: gather_cfg.py:41
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDAxes.h:10
void makeGeometry(const DDCompactView *cpv, CaloSubdetectorGeometry *ebg)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37