CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWTGeoRecoGeometryESProducer Class Reference

#include <FWTGeoRecoGeometryESProducer.h>

Inheritance diagram for FWTGeoRecoGeometryESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 FWTGeoRecoGeometryESProducer (const edm::ParameterSet &)
boost::shared_ptr
< FWTGeoRecoGeometry
produce (const FWTGeoRecoGeometryRecord &)
virtual ~FWTGeoRecoGeometryESProducer (void)

Private Member Functions

void addCaloGeometry (void)
void addCSCGeometry (TGeoVolume *top, const std::string &name="CSC", int copy=1)
void addDTGeometry (TGeoVolume *top, const std::string &name="DT", int copy=1)
void addPixelBarrelGeometry (TGeoVolume *top, const std::string &name="PixelBarrel", int copy=1)
void addPixelForwardGeometry (TGeoVolume *top, const std::string &name="PixelForward", int copy=1)
void addRPCGeometry (TGeoVolume *top, const std::string &name="RPC", int copy=1)
void addTECGeometry (TGeoVolume *top, const std::string &name="TEC", int copy=1)
void addTIBGeometry (TGeoVolume *top, const std::string &name="TIB", int copy=1)
void addTIDGeometry (TGeoVolume *top, const std::string &name="TID", int copy=1)
void addTOBGeometry (TGeoVolume *top, const std::string &name="TOB", int copy=1)
TGeoManager * createManager (int level)
TGeoMaterial * createMaterial (const std::string &name)
TGeoShape * createShape (const GeomDet *det)
TGeoVolume * createVolume (const std::string &name, const GeomDet *det, const std::string &matname="Air")
 FWTGeoRecoGeometryESProducer (const FWTGeoRecoGeometryESProducer &)
const
FWTGeoRecoGeometryESProducer
operator= (const FWTGeoRecoGeometryESProducer &)
const std::string path (TGeoVolume *top, const std::string &name, int copy)

Private Attributes

edm::ESHandle< CaloGeometrym_caloGeom
boost::shared_ptr
< FWTGeoRecoGeometry
m_fwGeometry
edm::ESHandle
< GlobalTrackingGeometry
m_geomRecord
std::map< std::string,
TGeoMaterial * > 
m_nameToMaterial
std::map< std::string,
TGeoMedium * > 
m_nameToMedium
std::map< std::string,
TGeoShape * > 
m_nameToShape
std::map< std::string,
TGeoVolume * > 
m_nameToVolume
const TrackerGeometrym_trackerGeom

Detailed Description

Definition at line 28 of file FWTGeoRecoGeometryESProducer.h.


Constructor & Destructor Documentation

FWTGeoRecoGeometryESProducer::FWTGeoRecoGeometryESProducer ( const edm::ParameterSet )

Definition at line 64 of file FWTGeoRecoGeometryESProducer.cc.

References edm::ESProducer::setWhatProduced().

{
  setWhatProduced( this );
}
FWTGeoRecoGeometryESProducer::~FWTGeoRecoGeometryESProducer ( void  ) [virtual]

Definition at line 69 of file FWTGeoRecoGeometryESProducer.cc.

{}
FWTGeoRecoGeometryESProducer::FWTGeoRecoGeometryESProducer ( const FWTGeoRecoGeometryESProducer ) [private]

Member Function Documentation

void FWTGeoRecoGeometryESProducer::addCaloGeometry ( void  ) [private]

Definition at line 657 of file FWTGeoRecoGeometryESProducer.cc.

References end, m_caloGeom, and m_fwGeometry.

Referenced by produce().

{
  std::vector<DetId> vid = m_caloGeom->getValidDetIds(); // Calo
  for( std::vector<DetId>::const_iterator it = vid.begin(),
                                         end = vid.end();
       it != end; ++it )
  {
    const CaloCellGeometry::CornersVec& cor( m_caloGeom->getGeometry( *it )->getCorners());
    m_fwGeometry->idToName[ it->rawId()].fillPoints( cor.begin(), cor.end());
  }
}
void FWTGeoRecoGeometryESProducer::addCSCGeometry ( TGeoVolume *  top,
const std::string &  name = "CSC",
int  copy = 1 
) [private]

Definition at line 291 of file FWTGeoRecoGeometryESProducer.cc.

References RadialStripTopology::angularWidth(), RadialStripTopology::centreToIntersection(), filterCSVwithJSON::copy, createVolume(), CSCDetId, m_fwGeometry, m_geomRecord, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), RadialStripTopology::phiOfOneEdge(), alignCSCRings::s, OffsetRadialStripTopology::stripOffset(), CSCWireTopology::wireAngle(), CSCWireTopology::wireSpacing(), RadialStripTopology::yAxisOrientation(), and RadialStripTopology::yCentreOfStripPlane().

Referenced by produce().

{
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  if(! m_geomRecord->slaveGeometry( CSCDetId()))
    throw cms::Exception( "FatalError" ) << "Cannnot find CSCGeometry\n";

  const std::vector<GeomDet*>& cscGeom = m_geomRecord->slaveGeometry( CSCDetId())->dets();
  for( std::vector<GeomDet*>::const_iterator it = cscGeom.begin(), itEnd = cscGeom.end(); it != itEnd; ++it )
  {    
    if( CSCChamber* chamber = dynamic_cast<CSCChamber*>(*it))
    {
      unsigned int rawid = chamber->geographicalId();
      std::stringstream s;
      s << rawid;
      std::string name = s.str();
      
      TGeoVolume* child = createVolume( name, chamber );
      assembly->AddNode( child, copy, createPlacement( chamber ));
      child->SetLineColor( kBlue );

      std::stringstream p;
      p << path( top, iName, copy ) << "/" << name << "_" << copy;
      m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));
    }
    else if( CSCLayer* layer = dynamic_cast<CSCLayer*>(*it))
    {
      unsigned int rawid = layer->geographicalId();
      std::stringstream s;
      s << rawid;
      std::string name = s.str();
      
      TGeoVolume* child = createVolume( name, layer );
      assembly->AddNode( child, copy, createPlacement( layer ));
      child->SetLineColor( kBlue );
      
      std::stringstream p;
      p << path( top, iName, copy ) << "/" << name << "_" << copy;
      m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

      const CSCStripTopology* stripTopology = layer->geometry()->topology();
      m_fwGeometry->idToName[rawid].topology[0] = stripTopology->yAxisOrientation();
      m_fwGeometry->idToName[rawid].topology[1] = stripTopology->centreToIntersection();
      m_fwGeometry->idToName[rawid].topology[2] = stripTopology->yCentreOfStripPlane();
      m_fwGeometry->idToName[rawid].topology[3] = stripTopology->phiOfOneEdge();
      m_fwGeometry->idToName[rawid].topology[4] = stripTopology->stripOffset();
      m_fwGeometry->idToName[rawid].topology[5] = stripTopology->angularWidth();

      const CSCWireTopology* wireTopology = layer->geometry()->wireTopology();
      m_fwGeometry->idToName[rawid].topology[6] = wireTopology->wireSpacing();
      m_fwGeometry->idToName[rawid].topology[7] = wireTopology->wireAngle();
    }
  }

  top->AddNode( assembly, copy );
}
void FWTGeoRecoGeometryESProducer::addDTGeometry ( TGeoVolume *  top,
const std::string &  name = "DT",
int  copy = 1 
) [private]

Definition at line 348 of file FWTGeoRecoGeometryESProducer.cc.

References BoundSurface::bounds(), DTTopology::cellHeight(), DTTopology::cellLenght(), DTTopology::cellWidth(), DTTopology::channels(), filterCSVwithJSON::copy, createVolume(), DTChamberId, DTLayerId, DTSuperLayerId, end, DTTopology::firstChannel(), DTTopology::lastChannel(), Bounds::length(), m_fwGeometry, m_geomRecord, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), alignCSCRings::s, Bounds::thickness(), and Bounds::width().

Referenced by produce().

{
  //
  // DT chambers geometry
  //
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  const std::vector<GeomDet*>& dtChamberGeom = m_geomRecord->slaveGeometry( DTChamberId())->dets();
  for( std::vector<GeomDet*>::const_iterator it = dtChamberGeom.begin(),
                                             end = dtChamberGeom.end(); 
       it != end; ++it )
  {
    if( DTChamber* chamber = dynamic_cast< DTChamber *>(*it))
    {      
      unsigned int rawid = chamber->geographicalId().rawId();
      std::stringstream s;
      s << rawid;
      std::string name = s.str();
      
      TGeoVolume* child = createVolume( name, chamber );
      assembly->AddNode( child, copy, createPlacement( chamber ));
      child->SetLineColor( kRed );
      
      std::stringstream p;
      p << path( top, iName, copy ) << "/" << name << "_" << copy;
      m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));
    }
  }
  top->AddNode( assembly, copy );

  // Fill in DT super layer parameters
  const std::vector<GeomDet*>& dtSuperLayerGeom = m_geomRecord->slaveGeometry( DTLayerId())->dets();
  for( std::vector<GeomDet*>::const_iterator it = dtSuperLayerGeom.begin(),
                                            end = dtSuperLayerGeom.end(); 
       it != end; ++it )
  {
    if( DTSuperLayer* superlayer = dynamic_cast<DTSuperLayer*>(*it))
    {
      unsigned int rawid = superlayer->id().rawId();
      std::stringstream s;
      s << rawid;
      std::string name = s.str();
      
      TGeoVolume* child = createVolume( name, superlayer );
      assembly->AddNode( child, copy, createPlacement( superlayer ));
      child->SetLineColor( kBlue );
      
      std::stringstream p;
      p << path( top, iName, copy ) << "/" << name << "_" << copy;
      m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

      const BoundPlane& surf = superlayer->surface();
      // Bounds W/H/L:
      m_fwGeometry->idToName[rawid].topology[0] = surf.bounds().width();
      m_fwGeometry->idToName[rawid].topology[1] = surf.bounds().thickness();
      m_fwGeometry->idToName[rawid].topology[2] = surf.bounds().length();
    }
  }

  // Fill in DT layer parameters
  const std::vector<GeomDet*>& dtLayerGeom = m_geomRecord->slaveGeometry( DTSuperLayerId())->dets();
  for( std::vector<GeomDet*>::const_iterator it = dtLayerGeom.begin(),
                                            end = dtLayerGeom.end(); 
       it != end; ++it )
  {
    if( DTLayer* layer = dynamic_cast<DTLayer*>(*it))
    {
      unsigned int rawid = layer->id().rawId();
      std::stringstream s;
      s << rawid;
      std::string name = s.str();
      
      TGeoVolume* child = createVolume( name, layer );
      assembly->AddNode( child, copy, createPlacement( layer ));
      child->SetLineColor( kBlue );
      
      std::stringstream p;
      p << path( top, iName, copy ) << "/" << name << "_" << copy;
      m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

      const DTTopology& topo = layer->specificTopology();
      const BoundPlane& surf = layer->surface();
      // Topology W/H/L:
      m_fwGeometry->idToName[rawid].topology[0] = topo.cellWidth();
      m_fwGeometry->idToName[rawid].topology[1] = topo.cellHeight();
      m_fwGeometry->idToName[rawid].topology[2] = topo.cellLenght();
      m_fwGeometry->idToName[rawid].topology[3] = topo.firstChannel();
      m_fwGeometry->idToName[rawid].topology[4] = topo.lastChannel();
      m_fwGeometry->idToName[rawid].topology[5] = topo.channels();

      // Bounds W/H/L:
      m_fwGeometry->idToName[rawid].topology[6] = surf.bounds().width();
      m_fwGeometry->idToName[rawid].topology[7] = surf.bounds().thickness();
      m_fwGeometry->idToName[rawid].topology[8] = surf.bounds().length();
    }
  }  
}
void FWTGeoRecoGeometryESProducer::addPixelBarrelGeometry ( TGeoVolume *  top,
const std::string &  name = "PixelBarrel",
int  copy = 1 
) [private]

Definition at line 484 of file FWTGeoRecoGeometryESProducer.cc.

References ADD_PIXEL_TOPOLOGY, filterCSVwithJSON::copy, createVolume(), cond::rpcobgas::detid, TrackerGeometry::detsPXB(), end, TrackerGeometry::idToDetUnit(), m_fwGeometry, m_trackerGeom, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), DetId::rawId(), and alignCSCRings::s.

Referenced by produce().

{
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsPXB().begin(),
                                                    end = m_trackerGeom->detsPXB().end();
       it != end; ++it)
  {
    DetId detid = ( *it )->geographicalId();
    unsigned int rawid = detid.rawId();

    std::stringstream s;
    s << rawid;
    std::string name = s.str();

    TGeoVolume* child = createVolume( name, *it );
    assembly->AddNode( child, copy, createPlacement( *it ));
    child->SetLineColor( kGreen );

    std::stringstream p;
    p << path( top, iName, copy ) << "/" << name << "_" << copy;
    m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

    ADD_PIXEL_TOPOLOGY( rawid, m_trackerGeom->idToDetUnit( detid ));
  }
  
  top->AddNode( assembly, copy );
}
void FWTGeoRecoGeometryESProducer::addPixelForwardGeometry ( TGeoVolume *  top,
const std::string &  name = "PixelForward",
int  copy = 1 
) [private]

Definition at line 513 of file FWTGeoRecoGeometryESProducer.cc.

References ADD_PIXEL_TOPOLOGY, filterCSVwithJSON::copy, createVolume(), cond::rpcobgas::detid, TrackerGeometry::detsPXF(), end, TrackerGeometry::idToDetUnit(), m_fwGeometry, m_trackerGeom, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), DetId::rawId(), and alignCSCRings::s.

Referenced by produce().

{
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsPXF().begin(),
                                                    end = m_trackerGeom->detsPXF().end();
       it != end; ++it )
  {
    DetId detid = ( *it )->geographicalId();
    unsigned int rawid = detid.rawId();

    std::stringstream s;
    s << rawid;
    std::string name = s.str();

    TGeoVolume* child = createVolume( name, *it );
    assembly->AddNode( child, copy, createPlacement( *it ));
    child->SetLineColor( kGreen );

    std::stringstream p;
    p << path( top, iName, copy ) << "/" << name << "_" << copy;
    m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));
    
    ADD_PIXEL_TOPOLOGY( rawid, m_trackerGeom->idToDetUnit( detid ));
  }
  
  top->AddNode( assembly, copy );
}
void FWTGeoRecoGeometryESProducer::addRPCGeometry ( TGeoVolume *  top,
const std::string &  name = "RPC",
int  copy = 1 
) [private]

Definition at line 446 of file FWTGeoRecoGeometryESProducer.cc.

References filterCSVwithJSON::copy, createVolume(), end, GeomDet::geographicalId(), m_fwGeometry, m_geomRecord, DetId::Muon, mergeVDriftHistosByStation::name, RPCRoll::nstrips(), AlCaHLTBitMon_ParallelJobs::p, path(), StripTopology::pitch(), DetId::rawId(), RPCGeometry::rolls(), alignCSCRings::s, RPCRoll::specificTopology(), and StripTopology::stripLength().

Referenced by produce().

{
  //
  // RPC chambers geometry
  //
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  DetId detId( DetId::Muon, 3 );
  const RPCGeometry* rpcGeom = (const RPCGeometry*) m_geomRecord->slaveGeometry( detId );
  for( std::vector<RPCRoll *>::const_iterator it = rpcGeom->rolls().begin(),
                                             end = rpcGeom->rolls().end(); 
       it != end; ++it )
  {
    RPCRoll* roll = (*it);
    if( roll )
    {
      unsigned int rawid = roll->geographicalId().rawId();
      std::stringstream s;
      s << rawid;
      std::string name = s.str();
      
      TGeoVolume* child = createVolume( name, roll );
      assembly->AddNode( child, copy, createPlacement( roll ));
      child->SetLineColor( kYellow );
      
      std::stringstream p;
      p << path( top, iName, copy ) << "/" << name << "_" << copy;
      m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

      const StripTopology& topo = roll->specificTopology();
      m_fwGeometry->idToName[rawid].topology[0] = roll->nstrips();
      m_fwGeometry->idToName[rawid].topology[1] = topo.stripLength();
      m_fwGeometry->idToName[rawid].topology[2] = topo.pitch();
    }
  }
  top->AddNode( assembly, copy );
}
void FWTGeoRecoGeometryESProducer::addTECGeometry ( TGeoVolume *  top,
const std::string &  name = "TEC",
int  copy = 1 
) [private]

Definition at line 628 of file FWTGeoRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, filterCSVwithJSON::copy, createVolume(), cond::rpcobgas::detid, TrackerGeometry::detsTEC(), end, TrackerGeometry::idToDet(), m_fwGeometry, m_trackerGeom, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), DetId::rawId(), and alignCSCRings::s.

Referenced by produce().

{
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTEC().begin(),
                                                    end = m_trackerGeom->detsTEC().end();
       it != end; ++it )
  {
    DetId detid = ( *it )->geographicalId();
    unsigned int rawid = detid.rawId();

    std::stringstream s;
    s << rawid;
    std::string name = s.str();

    TGeoVolume* child = createVolume( name, *it );
    assembly->AddNode( child, copy, createPlacement( *it ));
    child->SetLineColor( kGreen );

    std::stringstream p;
    p << path( top, iName, copy ) << "/" << name << "_" << copy;
    m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

    ADD_SISTRIP_TOPOLOGY( rawid, m_trackerGeom->idToDet( detid ));
  }
  
  top->AddNode( assembly, copy );
}
void FWTGeoRecoGeometryESProducer::addTIBGeometry ( TGeoVolume *  top,
const std::string &  name = "TIB",
int  copy = 1 
) [private]

Definition at line 542 of file FWTGeoRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, filterCSVwithJSON::copy, createVolume(), cond::rpcobgas::detid, TrackerGeometry::detsTIB(), end, TrackerGeometry::idToDet(), m_fwGeometry, m_trackerGeom, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), DetId::rawId(), and alignCSCRings::s.

Referenced by produce().

{
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTIB().begin(),
                                                    end = m_trackerGeom->detsTIB().end();
       it != end; ++it )
  {
    DetId detid = ( *it )->geographicalId();
    unsigned int rawid = detid.rawId();
    std::stringstream s;
    s << rawid;
    std::string name = s.str();

    TGeoVolume* child = createVolume( name, *it );
    assembly->AddNode( child, copy, createPlacement( *it ));
    child->SetLineColor( kGreen );

    std::stringstream p;
    p << path( top, iName, copy ) << "/" << name << "_" << copy;
    m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

    ADD_SISTRIP_TOPOLOGY( rawid, m_trackerGeom->idToDet( detid ));
  }
  
  top->AddNode( assembly, copy );
}
void FWTGeoRecoGeometryESProducer::addTIDGeometry ( TGeoVolume *  top,
const std::string &  name = "TID",
int  copy = 1 
) [private]

Definition at line 599 of file FWTGeoRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, filterCSVwithJSON::copy, createVolume(), cond::rpcobgas::detid, TrackerGeometry::detsTID(), end, TrackerGeometry::idToDet(), m_fwGeometry, m_trackerGeom, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), DetId::rawId(), and alignCSCRings::s.

Referenced by produce().

{
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTID().begin(),
                                                    end = m_trackerGeom->detsTID().end();
       it != end; ++it)
  {
    DetId detid = ( *it )->geographicalId();
    unsigned int rawid = detid.rawId();

    std::stringstream s;
    s << rawid;
    std::string name = s.str();

    TGeoVolume* child = createVolume( name, *it );
    assembly->AddNode( child, copy, createPlacement( *it ));
    child->SetLineColor( kGreen );

    std::stringstream p;
    p << path( top, iName, copy ) << "/" << name << "_" << copy;
    m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

    ADD_SISTRIP_TOPOLOGY( rawid, m_trackerGeom->idToDet( detid ));
  }
  
  top->AddNode( assembly, copy );
}
void FWTGeoRecoGeometryESProducer::addTOBGeometry ( TGeoVolume *  top,
const std::string &  name = "TOB",
int  copy = 1 
) [private]

Definition at line 570 of file FWTGeoRecoGeometryESProducer.cc.

References ADD_SISTRIP_TOPOLOGY, filterCSVwithJSON::copy, createVolume(), cond::rpcobgas::detid, TrackerGeometry::detsTOB(), end, TrackerGeometry::idToDet(), m_fwGeometry, m_trackerGeom, mergeVDriftHistosByStation::name, AlCaHLTBitMon_ParallelJobs::p, path(), DetId::rawId(), and alignCSCRings::s.

Referenced by produce().

{
  TGeoVolume *assembly = new TGeoVolumeAssembly( iName.c_str());
  for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTOB().begin(),
                                                    end = m_trackerGeom->detsTOB().end();
       it != end; ++it )
  {
    DetId detid = ( *it )->geographicalId();
    unsigned int rawid = detid.rawId();

    std::stringstream s;
    s << rawid;
    std::string name = s.str();

    TGeoVolume* child = createVolume( name, *it );
    assembly->AddNode( child, copy, createPlacement( *it ));
    child->SetLineColor( kGreen );

    std::stringstream p;
    p << path( top, iName, copy ) << "/" << name << "_" << copy;
    m_fwGeometry->idToName.insert( std::pair<unsigned int, FWTGeoRecoGeometry::Info>( rawid, FWTGeoRecoGeometry::Info( p.str())));

    ADD_SISTRIP_TOPOLOGY( rawid, m_trackerGeom->idToDet( detid ));
  }
  
  top->AddNode( assembly, copy );
}
TGeoManager* FWTGeoRecoGeometryESProducer::createManager ( int  level) [private]
TGeoMaterial * FWTGeoRecoGeometryESProducer::createMaterial ( const std::string &  name) [private]

Create TGeo material based on its name

Definition at line 265 of file FWTGeoRecoGeometryESProducer.cc.

References m_nameToMaterial, and mergeVDriftHistosByStation::name.

Referenced by createVolume().

{
  TGeoMaterial *material = m_nameToMaterial[name];

  if( material == 0 )
  {
    // FIXME: Do we need to set real parameters of the material?
    material = new TGeoMaterial( name.c_str(),
                                 0, 0, 0 );
    m_nameToMaterial[name] = material;
  }

  return material;
}
TGeoShape * FWTGeoRecoGeometryESProducer::createShape ( const GeomDet det) [private]

Create TGeo shape for GeomDet

Definition at line 162 of file FWTGeoRecoGeometryESProducer.cc.

References b, BoundSurface::bounds(), Bounds::length(), m_nameToShape, mergeVDriftHistosByStation::name, TrapezoidalPlaneBounds::parameters(), alignCSCRings::s, GeomDet::surface(), Bounds::thickness(), tablePrinter::width, and Bounds::width().

Referenced by createVolume().

{
  TGeoShape* shape = 0;

  // Trapezoidal
  const Bounds *b = &((det->surface ()).bounds ());
  const TrapezoidalPlaneBounds *b2 = dynamic_cast<const TrapezoidalPlaneBounds *> (b);
  if( b2 )
  {
    std::vector< float > par = b2->parameters ();
    
    // These parameters are half-lengths, as in CMSIM/GEANT3
    float hBottomEdge = par [0];
    float hTopEdge    = par [1];
    float thickness   = par [2];
    float apothem     = par [3];

    std::stringstream s;
    s << "T_"
      << hBottomEdge << "_"
      << hTopEdge << "_"
      << thickness << "_"
      << apothem;
    std::string name = s.str();

    // Do not create identical shape,
    // if one already exists
    shape = m_nameToShape[name];
    if( 0 == shape )
    {
      shape = new TGeoTrap(
        name.c_str(),
        thickness,  //dz
        0,          //theta
        0,          //phi
        apothem,    //dy1
        hBottomEdge,//dx1
        hTopEdge,   //dx2
        0,          //alpha1
        apothem,    //dy2
        hBottomEdge,//dx3
        hTopEdge,   //dx4
        0);         //alpha2

      m_nameToShape[name] = shape;
    }
  }
  if( dynamic_cast<const RectangularPlaneBounds *> (b) != 0 )
  {
    // Rectangular
    float length = det->surface().bounds().length();
    float width = det->surface().bounds ().width();
    float thickness = det->surface().bounds().thickness();

    std::stringstream s;
    s << "R_"
      << width << "_"
      << length << "_"
      << thickness;
    std::string name = s.str();

    // Do not create identical shape,
    // if one already exists
    shape = m_nameToShape[name];
    if( 0 == shape )
    {
      shape = new TGeoBBox( name.c_str(), width / 2., length / 2., thickness / 2. ); // dx, dy, dz

      m_nameToShape[name] = shape;
    }
  }
  
  return shape;
}
TGeoVolume * FWTGeoRecoGeometryESProducer::createVolume ( const std::string &  name,
const GeomDet det,
const std::string &  material = "Air" 
) [private]

Create TGeo volume for GeomDet

Definition at line 239 of file FWTGeoRecoGeometryESProducer.cc.

References createMaterial(), createShape(), m_nameToMedium, m_nameToVolume, and mergeVDriftHistosByStation::name.

Referenced by addCSCGeometry(), addDTGeometry(), addPixelBarrelGeometry(), addPixelForwardGeometry(), addRPCGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), and addTOBGeometry().

{
  TGeoVolume* volume = m_nameToVolume[name];
  if( 0 == volume )
  { 
    TGeoShape* solid = createShape( det );
    TGeoMedium* medium = m_nameToMedium[material];
    if( 0 == medium )
    {
      medium = new TGeoMedium( material.c_str(), 0, createMaterial( material ));
      m_nameToMedium[material] = medium;
    }
    if( solid )
    {
      volume = new TGeoVolume( name.c_str(),
                               solid,
                               medium );
      m_nameToVolume[name] = volume;
    }
  }  
  
  return volume;
}
const FWTGeoRecoGeometryESProducer& FWTGeoRecoGeometryESProducer::operator= ( const FWTGeoRecoGeometryESProducer ) [private]
const std::string FWTGeoRecoGeometryESProducer::path ( TGeoVolume *  top,
const std::string &  name,
int  copy 
) [private]

Definition at line 281 of file FWTGeoRecoGeometryESProducer.cc.

References filterCSVwithJSON::copy.

Referenced by addCSCGeometry(), addDTGeometry(), addPixelBarrelGeometry(), addPixelForwardGeometry(), addRPCGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), and addTOBGeometry().

{
  std::stringstream outs;
  outs << volume->GetName() << "_" << volume->GetNumber() << "/"
       << name << "_" << copy;

  return outs.str();
}
boost::shared_ptr< FWTGeoRecoGeometry > FWTGeoRecoGeometryESProducer::produce ( const FWTGeoRecoGeometryRecord record)

Definition at line 100 of file FWTGeoRecoGeometryESProducer.cc.

References addCaloGeometry(), addCSCGeometry(), addDTGeometry(), addPixelBarrelGeometry(), addPixelForwardGeometry(), addRPCGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), addTOBGeometry(), relativeConstraints::geom, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), m_caloGeom, m_fwGeometry, m_geomRecord, m_nameToMaterial, m_nameToMedium, m_nameToShape, m_nameToVolume, m_trackerGeom, and DetId::Tracker.

{
  using namespace edm;

  m_fwGeometry =  boost::shared_ptr<FWTGeoRecoGeometry>( new FWTGeoRecoGeometry );

  record.getRecord<GlobalTrackingGeometryRecord>().get( m_geomRecord );
  
  DetId detId( DetId::Tracker, 0 );
  m_trackerGeom = (const TrackerGeometry*) m_geomRecord->slaveGeometry( detId );
  
  record.getRecord<CaloGeometryRecord>().get( m_caloGeom );

  TGeoManager *geom = new TGeoManager( "cmsGeo", "CMS Detector" );
  // NOTE: The default constructor does not create an identity matrix
  if( 0 == gGeoIdentity )
  {
    gGeoIdentity = new TGeoIdentity( "Identity" );
  }

  m_fwGeometry->manager( geom );
  
  // Default material is Vacuum
  TGeoMaterial *matVacuum = new TGeoMaterial( "Vacuum", 0 ,0 ,0 );
  // so is default medium
  TGeoMedium *vacuum = new TGeoMedium( "Vacuum", 1, matVacuum );
  TGeoVolume *top = geom->MakeBox( "CMS", vacuum, 270., 270., 120. );
  
  if( 0 == top )
  {
    return boost::shared_ptr<FWTGeoRecoGeometry>();
  }
  geom->SetTopVolume( top );
  // ROOT chokes unless colors are assigned
  top->SetVisibility( kFALSE );
  top->SetLineColor( kBlue );

  addPixelBarrelGeometry( top );
  addPixelForwardGeometry( top );
  addTIBGeometry( top );
  addTIDGeometry( top );
  addTOBGeometry( top );
  addTECGeometry( top );
  addDTGeometry( top );
  addCSCGeometry( top );
  addRPCGeometry( top );

  addCaloGeometry();
  
  geom->CloseGeometry();
  geom->DefaultColors();

  m_nameToShape.clear();
  m_nameToVolume.clear();
  m_nameToMaterial.clear();
  m_nameToMedium.clear();

  return m_fwGeometry;
}

Member Data Documentation

Definition at line 63 of file FWTGeoRecoGeometryESProducer.h.

Referenced by addCaloGeometry(), and produce().

std::map<std::string, TGeoMaterial*> FWTGeoRecoGeometryESProducer::m_nameToMaterial [private]

Definition at line 59 of file FWTGeoRecoGeometryESProducer.h.

Referenced by createMaterial(), and produce().

std::map<std::string, TGeoMedium*> FWTGeoRecoGeometryESProducer::m_nameToMedium [private]

Definition at line 60 of file FWTGeoRecoGeometryESProducer.h.

Referenced by createVolume(), and produce().

std::map<std::string, TGeoShape*> FWTGeoRecoGeometryESProducer::m_nameToShape [private]

Definition at line 57 of file FWTGeoRecoGeometryESProducer.h.

Referenced by createShape(), and produce().

std::map<std::string, TGeoVolume*> FWTGeoRecoGeometryESProducer::m_nameToVolume [private]

Definition at line 58 of file FWTGeoRecoGeometryESProducer.h.

Referenced by createVolume(), and produce().