27 #include "TGeoManager.h"
29 #include "TGeoMatrix.h"
34 # define ADD_PIXEL_TOPOLOGY( rawid, detUnit ) \
35 const PixelGeomDetUnit* det = dynamic_cast<const PixelGeomDetUnit*>( detUnit ); \
38 const PixelTopology& topo = det->specificTopology(); \
39 m_fwGeometry->idToName[rawid].topology[0] = topo.nrows(); \
40 m_fwGeometry->idToName[rawid].topology[1] = topo.ncolumns(); \
43 # define ADD_SISTRIP_TOPOLOGY( rawid, detUnit ) \
44 const StripGeomDetUnit* det = dynamic_cast<const StripGeomDetUnit*>( detUnit ); \
47 const StripTopology* topo = dynamic_cast<const StripTopology*>( &det->specificTopology()); \
48 m_fwGeometry->idToName[rawid].topology[0] = topo->nstrips(); \
49 m_fwGeometry->idToName[rawid].topology[1] = topo->stripLength(); \
50 if( const RadialStripTopology* rtop = dynamic_cast<const RadialStripTopology*>( topo )) \
52 m_fwGeometry->idToName[rawid].topology[2] = rtop->phiPitch(); \
54 else if( dynamic_cast<const RectangularStripTopology*>( topo )) \
56 m_fwGeometry->idToName[rawid].topology[2] = topo->pitch(); \
58 else if( dynamic_cast<const TrapezoidalStripTopology*>( topo )) \
60 m_fwGeometry->idToName[rawid].topology[2] = topo->pitch(); \
75 TGeoCombiTrans* createPlacement(
const GeomDet *det )
82 TGeoTranslation trans( posx, posy, posz );
89 const Double_t
matrix[9] = { detRot.
xx(), detRot.
yx(), detRot.
zx(),
90 detRot.
xy(), detRot.
yy(), detRot.
zy(),
91 detRot.
xz(), detRot.
yz(), detRot.
zz()
93 rotation.SetMatrix( matrix );
95 return new TGeoCombiTrans( trans, rotation );
99 boost::shared_ptr<FWTGeoRecoGeometry>
113 TGeoManager *
geom =
new TGeoManager(
"cmsGeo",
"CMS Detector" );
115 if( 0 == gGeoIdentity )
117 gGeoIdentity =
new TGeoIdentity(
"Identity" );
123 TGeoMaterial *matVacuum =
new TGeoMaterial(
"Vacuum", 0 ,0 ,0 );
125 TGeoMedium *vacuum =
new TGeoMedium(
"Vacuum", 1, matVacuum );
126 TGeoVolume *top =
geom->MakeBox(
"CMS", vacuum, 270., 270., 120. );
130 return boost::shared_ptr<FWTGeoRecoGeometry>();
132 geom->SetTopVolume( top );
134 top->SetVisibility( kFALSE );
135 top->SetLineColor( kBlue );
149 geom->CloseGeometry();
150 geom->DefaultColors();
164 TGeoShape* shape = 0;
171 std::array< const float, 4 >
const & par = b2->
parameters ();
174 float hBottomEdge = par [0];
175 float hTopEdge = par [1];
176 float thickness = par [2];
177 float apothem = par [3];
181 << hBottomEdge <<
"_"
192 shape =
new TGeoTrap(
209 if( dynamic_cast<const RectangularPlaneBounds *> (b) != 0 )
228 shape =
new TGeoBBox( name.c_str(), width / 2., length / 2., thickness / 2. );
248 medium =
new TGeoMedium( material.c_str(), 0,
createMaterial( material ));
253 volume =
new TGeoVolume( name.c_str(),
272 material =
new TGeoMaterial( name.c_str(),
283 std::stringstream outs;
284 outs << volume->GetName() <<
"_" << volume->GetNumber() <<
"/"
285 << name <<
"_" <<
copy;
293 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
295 throw cms::Exception(
"FatalError" ) <<
"Cannnot find CSCGeometry\n";
298 for( std::vector<GeomDet*>::const_iterator it = cscGeom.begin(), itEnd = cscGeom.end(); it != itEnd; ++it )
300 if(
CSCChamber* chamber = dynamic_cast<CSCChamber*>(*it))
302 unsigned int rawid = chamber->geographicalId();
308 assembly->AddNode( child, copy, createPlacement( chamber ));
309 child->SetLineColor( kBlue );
312 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
315 else if(
CSCLayer* layer = dynamic_cast<CSCLayer*>(*it))
317 unsigned int rawid = layer->geographicalId();
323 assembly->AddNode( child, copy, createPlacement( layer ));
324 child->SetLineColor( kBlue );
327 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
338 const CSCWireTopology* wireTopology = layer->geometry()->wireTopology();
344 top->AddNode( assembly, copy );
353 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
355 for( std::vector<GeomDet*>::const_iterator it = dtChamberGeom.begin(),
356 end = dtChamberGeom.end();
359 if(
DTChamber* chamber = dynamic_cast< DTChamber *>(*it))
361 unsigned int rawid = chamber->geographicalId().rawId();
367 assembly->AddNode( child, copy, createPlacement( chamber ));
368 child->SetLineColor( kRed );
371 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
375 top->AddNode( assembly, copy );
379 for( std::vector<GeomDet*>::const_iterator it = dtSuperLayerGeom.begin(),
380 end = dtSuperLayerGeom.end();
383 if(
DTSuperLayer* superlayer = dynamic_cast<DTSuperLayer*>(*it))
385 unsigned int rawid = superlayer->id().rawId();
391 assembly->AddNode( child, copy, createPlacement( superlayer ));
392 child->SetLineColor( kBlue );
395 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
398 const BoundPlane& surf = superlayer->surface();
400 m_fwGeometry->idToName[rawid].topology[0] = surf.bounds().width();
401 m_fwGeometry->idToName[rawid].topology[1] = surf.bounds().thickness();
402 m_fwGeometry->idToName[rawid].topology[2] = surf.bounds().length();
408 for( std::vector<GeomDet*>::const_iterator it = dtLayerGeom.begin(),
409 end = dtLayerGeom.end();
412 if(
DTLayer* layer = dynamic_cast<DTLayer*>(*it))
414 unsigned int rawid = layer->id().rawId();
420 assembly->AddNode( child, copy, createPlacement( layer ));
421 child->SetLineColor( kBlue );
424 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
427 const DTTopology& topo = layer->specificTopology();
438 m_fwGeometry->idToName[rawid].topology[6] = surf.bounds().width();
439 m_fwGeometry->idToName[rawid].topology[7] = surf.bounds().thickness();
440 m_fwGeometry->idToName[rawid].topology[8] = surf.bounds().length();
451 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
454 for( std::vector<RPCRoll *>::const_iterator it = rpcGeom->
rolls().begin(),
467 assembly->AddNode( child, copy, createPlacement( roll ));
468 child->SetLineColor( kYellow );
471 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
480 top->AddNode( assembly, copy );
486 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
492 unsigned int rawid = detid.
rawId();
499 assembly->AddNode( child, copy, createPlacement( *it ));
500 child->SetLineColor( kGreen );
503 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
509 top->AddNode( assembly, copy );
515 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
521 unsigned int rawid = detid.
rawId();
528 assembly->AddNode( child, copy, createPlacement( *it ));
529 child->SetLineColor( kGreen );
532 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
538 top->AddNode( assembly, copy );
544 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
550 unsigned int rawid = detid.
rawId();
556 assembly->AddNode( child, copy, createPlacement( *it ));
557 child->SetLineColor( kGreen );
560 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
566 top->AddNode( assembly, copy );
572 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
578 unsigned int rawid = detid.
rawId();
585 assembly->AddNode( child, copy, createPlacement( *it ));
586 child->SetLineColor( kGreen );
589 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
595 top->AddNode( assembly, copy );
601 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
607 unsigned int rawid = detid.
rawId();
614 assembly->AddNode( child, copy, createPlacement( *it ));
615 child->SetLineColor( kGreen );
618 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
624 top->AddNode( assembly, copy );
630 TGeoVolume *assembly =
new TGeoVolumeAssembly( iName.c_str());
636 unsigned int rawid = detid.
rawId();
643 assembly->AddNode( child, copy, createPlacement( *it ));
644 child->SetLineColor( kGreen );
647 p <<
path( top, iName, copy ) <<
"/" << name <<
"_" <<
copy;
653 top->AddNode( assembly, copy );
659 std::vector<DetId> vid =
m_caloGeom->getValidDetIds();
660 for( std::vector<DetId>::const_iterator it = vid.begin(),
665 m_fwGeometry->idToName[ it->rawId()].fillPoints( cor.begin(), cor.end());
const TrackerGeometry * m_trackerGeom
virtual float length() const =0
virtual const std::array< const float, 4 > parameters() const
edm::ESHandle< CaloGeometry > m_caloGeom
edm::ESHandle< GlobalTrackingGeometry > m_geomRecord
float yCentreOfStripPlane() const
TGeoShape * createShape(const GeomDet *det)
std::map< std::string, TGeoMedium * > m_nameToMedium
virtual ~FWTGeoRecoGeometryESProducer(void)
void addTOBGeometry(TGeoVolume *top, const std::string &name="TOB", int copy=1)
float cellWidth() const
Returns the cell width.
const Bounds & bounds() const
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, const std::string &matname="Air")
double wireSpacing() const
const StripTopology & specificTopology() const
void addDTGeometry(TGeoVolume *top, const std::string &name="DT", int copy=1)
const Plane & surface() const
The nominal surface of the GeomDet.
void addTIDGeometry(TGeoVolume *top, const std::string &name="TID", int copy=1)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
#define ADD_SISTRIP_TOPOLOGY(rawid, detUnit)
int firstChannel() const
Returns the wire number of the first wire.
uint32_t rawId() const
get the raw id
virtual float thickness() const =0
const DepRecordT & getRecord() const
int lastChannel() const
Returns the wire number of the last wire.
virtual float stripLength() const =0
const DetContainer & detsTEC() const
void addRPCGeometry(TGeoVolume *top, const std::string &name="RPC", int copy=1)
void addCSCGeometry(TGeoVolume *top, const std::string &name="CSC", int copy=1)
std::map< std::string, TGeoShape * > m_nameToShape
float yAxisOrientation() const
void addCaloGeometry(void)
const DetContainer & detsPXB() const
DetId geographicalId() const
The label of this GeomDet.
float centreToIntersection() const
float phiOfOneEdge() const
float cellHeight() const
Returns the cell height.
float angularWidth() const
virtual const GeomDet * idToDet(DetId) const
void addPixelBarrelGeometry(TGeoVolume *top, const std::string &name="PixelBarrel", int copy=1)
const DetContainer & detsTIB() const
void addTIBGeometry(TGeoVolume *top, const std::string &name="TIB", int copy=1)
std::map< std::string, TGeoVolume * > m_nameToVolume
virtual float stripOffset(void) const
int channels() const
Returns the number of wires in the layer.
#define ADD_PIXEL_TOPOLOGY(rawid, detUnit)
boost::shared_ptr< FWTGeoRecoGeometry > produce(const FWTGeoRecoGeometryRecord &)
boost::shared_ptr< FWTGeoRecoGeometry > m_fwGeometry
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void addPixelForwardGeometry(TGeoVolume *top, const std::string &name="PixelForward", int copy=1)
FWTGeoRecoGeometryESProducer(const edm::ParameterSet &)
virtual float pitch() const =0
const DetContainer & detsPXF() const
const DetContainer & detsTOB() const
const RotationType & rotation() const
void addTECGeometry(TGeoVolume *top, const std::string &name="TEC", int copy=1)
TGeoMaterial * createMaterial(const std::string &name)
std::map< std::string, TGeoMaterial * > m_nameToMaterial
virtual float width() const =0
const std::string path(TGeoVolume *top, const std::string &name, int copy)
const PositionType & position() const
const std::vector< RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
const DetContainer & detsTID() const