Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Tracker Topology for Building Geometry Hierarchy #16364

Merged
merged 1 commit into from Oct 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Fireworks/Geometry/interface/FWTGeoRecoGeometryESProducer.h
Expand Up @@ -15,6 +15,7 @@ namespace edm
class CaloGeometry;
class GlobalTrackingGeometry;
class TrackerGeometry;
class TrackerTopology;
class FWTGeoRecoGeometry;
class FWTGeoRecoGeometryRecord;

Expand Down Expand Up @@ -78,6 +79,7 @@ class FWTGeoRecoGeometryESProducer : public edm::ESProducer
edm::ESHandle<GlobalTrackingGeometry> m_geomRecord;
edm::ESHandle<CaloGeometry> m_caloGeom;
const TrackerGeometry* m_trackerGeom;
const TrackerTopology* m_trackerTopology;

std::shared_ptr<FWTGeoRecoGeometry> m_fwGeometry;

Expand Down
3 changes: 2 additions & 1 deletion Fireworks/Geometry/interface/FWTGeoRecoGeometryRecord.h
Expand Up @@ -4,7 +4,8 @@
# include "FWCore/Framework/interface/DependentRecordImplementation.h"
# include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
# include "Geometry/Records/interface/CaloGeometryRecord.h"
# include "Geometry/Records/interface/TrackerTopologyRcd.h"

class FWTGeoRecoGeometryRecord : public edm::eventsetup::DependentRecordImplementation<FWTGeoRecoGeometryRecord,boost::mpl::vector<GlobalTrackingGeometryRecord,CaloGeometryRecord> > {};
class FWTGeoRecoGeometryRecord : public edm::eventsetup::DependentRecordImplementation<FWTGeoRecoGeometryRecord,boost::mpl::vector<GlobalTrackingGeometryRecord,CaloGeometryRecord,TrackerTopologyRcd> > {};

#endif // GEOMETRY_FWTGEORECO_GEOMETRY_RECORD_H
236 changes: 109 additions & 127 deletions Fireworks/Geometry/src/FWTGeoRecoGeometryESProducer.cc
Expand Up @@ -4,12 +4,11 @@

#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
#include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
#include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
#include "DataFormats/SiStripDetId/interface/TECDetId.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "DataFormats/MuonDetId/interface/GEMDetId.h"
#include "DataFormats/MuonDetId/interface/ME0DetId.h"
Expand Down Expand Up @@ -305,7 +304,11 @@ FWTGeoRecoGeometryESProducer::produce( const FWTGeoRecoGeometryRecord& record )
{
DetId detId( DetId::Tracker, 0 );
m_trackerGeom = (const TrackerGeometry*) m_geomRecord->slaveGeometry( detId );


edm::ESHandle<TrackerTopology> trackerTopologyHandle;
record.getRecord<TrackerTopologyRcd>().get( trackerTopologyHandle );
m_trackerTopology = trackerTopologyHandle.product();

addPixelBarrelGeometry();
addPixelForwardGeometry();

Expand Down Expand Up @@ -448,169 +451,148 @@ FWTGeoRecoGeometryESProducer::createVolume( const std::string& name, const GeomD
///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////


void
FWTGeoRecoGeometryESProducer::addPixelBarrelGeometry()
{
TGeoVolume* tv = GetTopHolder("SiPixel", kSiPixel);
TGeoVolume *assembly = GetDaughter(tv, "PXB", kSiPixel);

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();

PXBDetId xx(rawid);
std::string name = Form("PXB Ly:%d, Md:%d Ld:%d ", xx.layer(), xx.module(), xx.ladder());
TGeoVolume* child = createVolume( name, *it, kSiPixel );

TGeoVolume* holder = GetDaughter(assembly, "Layer", kSiPixel, xx.layer());
holder = GetDaughter(holder, "Module", kSiPixel, xx.module());

AddLeafNode(holder, child, name.c_str(), createPlacement( *it ));
}


TGeoVolume* tv = GetTopHolder( "SiPixel", kSiPixel );
TGeoVolume *assembly = GetDaughter( tv, "PXB", kSiPixel );

for( auto it : m_trackerGeom->detsPXB()) {
DetId detid = it->geographicalId();
unsigned int layer = m_trackerTopology->pxbLayer( detid );
unsigned int module = m_trackerTopology->pxbModule( detid );
unsigned int ladder = m_trackerTopology->pxbLadder( detid );

std::string name = Form( "PXB Ly:%d, Md:%d Ld:%d ", layer, module, ladder );
TGeoVolume* child = createVolume( name, it, kSiPixel );

TGeoVolume* holder = GetDaughter( assembly, "Layer", kSiPixel, layer );
holder = GetDaughter( holder, "Module", kSiPixel, module );

AddLeafNode( holder, child, name.c_str(), createPlacement( it ));
}
}
//______________________________________________________________________________


void
FWTGeoRecoGeometryESProducer::addPixelForwardGeometry()
{
TGeoVolume* tv = GetTopHolder("SiPixel", kSiPixel);
TGeoVolume *assembly = GetDaughter(tv, "PXF", kSiPixel);

for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsPXF().begin(),
end = m_trackerGeom->detsPXF().end();
it != end; ++it )
{
PXFDetId detid = ( *it )->geographicalId();
std::stringstream s;
s << detid;
std::string name = s.str();

TGeoVolume* child = createVolume( name, *it, kSiPixel );

TGeoVolume* tv = GetTopHolder( "SiPixel", kSiPixel );
TGeoVolume* assembly = GetDaughter( tv, "PXF", kSiPixel );

for( auto it : m_trackerGeom->detsPXF()) {
DetId detid = it->geographicalId();
unsigned int disk = m_trackerTopology->pxfDisk( detid );
unsigned int blade = m_trackerTopology->pxfBlade( detid );
unsigned int panel = m_trackerTopology->pxfPanel( detid );
unsigned int side = m_trackerTopology->side( detid );

std::string name = Form( "PXF D:%d, B:%d, P:%d, S:%d", disk, blade, panel, side );
TGeoVolume* child = createVolume( name, it, kSiPixel );

TGeoVolume* holder = GetDaughter(assembly, "Side", kSiPixel, detid.side());
holder = GetDaughter(holder, "Disk", kSiPixel, detid.disk());
holder = GetDaughter(holder, "Blade", kSiPixel, detid.blade());
holder = GetDaughter(holder, "Panel", kSiPixel, detid.panel());
TGeoVolume* holder = GetDaughter( assembly, "Side", kSiPixel, side );
holder = GetDaughter( holder, "Disk", kSiPixel, disk );
holder = GetDaughter( holder, "Blade", kSiPixel, blade );
holder = GetDaughter( holder, "Panel", kSiPixel, panel );

// holder->AddNode( child, 1, createPlacement( *it ));
AddLeafNode(holder, child, name.c_str(), createPlacement( *it ));

}

AddLeafNode( holder, child, name.c_str(), createPlacement( it ));
}
}

//______________________________________________________________________________


void
FWTGeoRecoGeometryESProducer::addTIBGeometry()
{
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip);
TGeoVolume *assembly = GetDaughter(tv,"TIB", kSiStrip);
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip );
TGeoVolume *assembly = GetDaughter( tv, "TIB", kSiStrip );

for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTIB().begin(),
end = m_trackerGeom->detsTIB().end();
it != end; ++it )
{
TIBDetId detid(( *it )->geographicalId());
std::stringstream s;
s << detid;
std::string name = s.str();
for( auto it : m_trackerGeom->detsTIB()) {
DetId detid = it->geographicalId();
unsigned int module = m_trackerTopology->tibModule( detid );
unsigned int order = m_trackerTopology->tibOrder( detid );
unsigned int side = m_trackerTopology->tibSide( detid );

TGeoVolume* child = createVolume( name, *it, kSiStrip );

TGeoVolume* holder = GetDaughter(assembly, "Module", kSiStrip, detid.module());
holder = GetDaughter(holder, "Order", kSiStrip, detid.order());
holder = GetDaughter(holder, "Side", kSiStrip, detid.side());
AddLeafNode(holder, child, name.c_str(), createPlacement( *it ));
}
std::stringstream s;
s << TIBDetId( detid );
std::string name = s.str();

TGeoVolume* child = createVolume( name, it, kSiStrip );
TGeoVolume* holder = GetDaughter( assembly, "Module", kSiStrip, module );
holder = GetDaughter( holder, "Order", kSiStrip, order );
holder = GetDaughter( holder, "Side", kSiStrip, side );
AddLeafNode( holder, child, name.c_str(), createPlacement( it ));
}
}

//______________________________________________________________________________


void
FWTGeoRecoGeometryESProducer::addTIDGeometry()
{
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip);
TGeoVolume *assembly = GetDaughter( tv, "TID", kSiStrip);
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip );
TGeoVolume* assembly = GetDaughter( tv, "TID", kSiStrip );

for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTID().begin(),
end = m_trackerGeom->detsTID().end();
it != end; ++it)
{
TIDDetId detid = ( *it )->geographicalId();
std::stringstream s;
s << detid;
std::string name = s.str();
for( auto it : m_trackerGeom->detsTID()) {
DetId detid = it->geographicalId();
unsigned int side = m_trackerTopology->tidSide( detid );
unsigned int wheel = m_trackerTopology->tidWheel( detid );
unsigned int ring = m_trackerTopology->tidRing( detid );

TGeoVolume* child = createVolume( name, *it, kSiStrip );
TGeoVolume* holder = GetDaughter(assembly, "Side", kSiStrip, detid.side());
holder = GetDaughter(holder, "Wheel", kSiStrip, detid.wheel());
holder = GetDaughter(holder, "Ring", kSiStrip, detid.ring());
AddLeafNode(holder, child, name.c_str(), createPlacement( *it ));
}
}
std::stringstream s;
s << TIDDetId( detid );
std::string name = s.str();

//______________________________________________________________________________
TGeoVolume* child = createVolume( name, it, kSiStrip );
TGeoVolume* holder = GetDaughter( assembly, "Side", kSiStrip, side );
holder = GetDaughter( holder, "Wheel", kSiStrip, wheel );
holder = GetDaughter( holder, "Ring", kSiStrip, ring );
AddLeafNode( holder, child, name.c_str(), createPlacement( it ));
}
}

void
FWTGeoRecoGeometryESProducer::addTOBGeometry()
{
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip);
TGeoVolume *assembly = GetDaughter(tv, "TOB", kSiStrip);

for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTOB().begin(),
end = m_trackerGeom->detsTOB().end();
it != end; ++it )
{
TOBDetId detid(( *it )->geographicalId());
std::stringstream s;
s << detid;
std::string name = s.str();

TGeoVolume* child = createVolume( name, *it, kSiStrip );
TGeoVolume* holder = GetDaughter(assembly, "Rod", kSiStrip, detid.rodNumber());
holder = GetDaughter(holder, "Side", kSiStrip, detid.side());
holder = GetDaughter(holder, "Module", kSiStrip, detid.moduleNumber());
AddLeafNode(holder, child, name.c_str(), createPlacement( *it ));
}
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip );
TGeoVolume* assembly = GetDaughter( tv, "TOB", kSiStrip );

for( auto it : m_trackerGeom->detsTOB()) {
DetId detid = it->geographicalId();
unsigned int rod = m_trackerTopology->tobRod( detid );
unsigned int side = m_trackerTopology->tobSide( detid );
unsigned int module = m_trackerTopology->tobModule( detid );

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

TGeoVolume* child = createVolume( name, it, kSiStrip );
TGeoVolume* holder = GetDaughter( assembly, "Rod", kSiStrip, rod );
holder = GetDaughter( holder, "Side", kSiStrip, side );
holder = GetDaughter( holder, "Module", kSiStrip, module );
AddLeafNode( holder, child, name.c_str(), createPlacement( it ));
}
}
//______________________________________________________________________________


void
FWTGeoRecoGeometryESProducer::addTECGeometry()
{
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip);
TGeoVolume *assembly = GetDaughter(tv, "TEC", kSiStrip);
TGeoVolume* tv = GetTopHolder( "SiStrip", kSiStrip );
TGeoVolume* assembly = GetDaughter( tv, "TEC", kSiStrip );

for( TrackerGeometry::DetContainer::const_iterator it = m_trackerGeom->detsTEC().begin(),
end = m_trackerGeom->detsTEC().end();
it != end; ++it )
{
TECDetId detid = ( *it )->geographicalId();
for( auto it : m_trackerGeom->detsTEC()) {
DetId detid = it->geographicalId();
unsigned int order = m_trackerTopology->tecOrder( detid );
unsigned int ring = m_trackerTopology->tecRing( detid );
unsigned int module = m_trackerTopology->tecModule( detid );

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

TGeoVolume* child = createVolume( name, *it, kSiStrip );
TGeoVolume* child = createVolume( name, it, kSiStrip );

TGeoVolume* holder = GetDaughter(assembly, "Order", kSiStrip, detid.order());
holder = GetDaughter(holder, "Ring", kSiStrip, detid.ring());
holder = GetDaughter(holder, "Module", kSiStrip, detid.module());
AddLeafNode(holder, child, name.c_str(), createPlacement( *it ));
}
TGeoVolume* holder = GetDaughter( assembly, "Order", kSiStrip, order );
holder = GetDaughter( holder, "Ring", kSiStrip, ring );
holder = GetDaughter( holder, "Module", kSiStrip, module );
AddLeafNode( holder, child, name.c_str(), createPlacement( it ));
}
}

//==============================================================================
Expand Down