Skip to content

Commit

Permalink
Merge pull request #8899 from alja/gemtra
Browse files Browse the repository at this point in the history
75x Fireworks: port GEM related changes from CMSSW_7_6_X_SLHC
  • Loading branch information
cmsbuild committed Apr 28, 2015
2 parents cd68ca5 + 09c71cd commit b8e87cc
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Fireworks/Core/interface/FWGeometry.h
Expand Up @@ -28,7 +28,7 @@ class FWGeometry
static const int kSubdetOffset = 25;

enum Detector { Tracker = 1, Muon = 2, Ecal = 3, Hcal = 4, Calo = 5 };
enum SubDetector { PixelBarrel = 1, PixelEndcap = 2, TIB = 3, TID = 4, TOB = 5, TEC = 6, CSC = 7, DT = 8, RPCBarrel = 9, RPCEndcap = 10 };
enum SubDetector { PixelBarrel = 1, PixelEndcap = 2, TIB = 3, TID = 4, TOB = 5, TEC = 6, CSC = 7, DT = 8, RPCBarrel = 9, RPCEndcap = 10, GEM = 11, ME0 = 12};

struct Range {
double min1;
Expand Down
52 changes: 47 additions & 5 deletions Fireworks/Core/src/FW3DViewGeometry.cc
Expand Up @@ -17,6 +17,7 @@

#include "TEveManager.h"
#include "TEveGeoNode.h"
#include "TEveCompound.h"

#include "Fireworks/Core/interface/FW3DViewGeometry.h"
#include "Fireworks/Core/interface/FWGeometry.h"
Expand All @@ -26,6 +27,7 @@

#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "DataFormats/MuonDetId/interface/GEMDetId.h"

#include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
#include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
Expand Down Expand Up @@ -154,16 +156,17 @@ FW3DViewGeometry::showMuonBarrelFull(bool showMuonBarrel)
void
FW3DViewGeometry::showMuonEndcap( bool showMuonEndcap )
{
if( showMuonEndcap && !m_muonEndcapElements )
if( showMuonEndcap && !m_muonEndcapElements )
{
m_muonEndcapElements = new TEveElementList( "CSC" );
m_muonEndcapElements = new TEveElementList( "EndCap" );

for( Int_t iEndcap = 1; iEndcap <= 2; ++iEndcap ) // 1=forward (+Z), 2=backward(-Z)
{
TEveElementList* cEndcap = 0;
if( iEndcap == 1 )
cEndcap = new TEveElementList( "Forward" );
cEndcap = new TEveElementList( "CSC Forward" );
else
cEndcap = new TEveElementList( "Backward" );
cEndcap = new TEveElementList( "CSC Backward" );
m_muonEndcapElements->AddElement( cEndcap );
// Actual CSC geometry:
// Station 1 has 4 rings with 36 chambers in each
Expand All @@ -179,7 +182,7 @@ FW3DViewGeometry::showMuonEndcap( bool showMuonEndcap )
for( Int_t iRing = 1; iRing <= 4; ++iRing )
{
if( iStation > 1 && iRing > 2 ) continue;
// if( iStation > 3 && iRing > 1 ) continue;
if( iStation > 3 && iRing > 1 ) continue;
std::ostringstream s; s << "Ring" << iRing;
TEveElementList* cRing = new TEveElementList( s.str().c_str() );
cStation->AddElement( cRing );
Expand All @@ -196,9 +199,48 @@ FW3DViewGeometry::showMuonEndcap( bool showMuonEndcap )
cRing->AddElement( shape );
}
}
}
}

// m_muonEndcapElements->AddElement(CSClist);


TEveElementList* GEMlist = new TEveCompound( "GEM" );
for( Int_t iRegion = GEMDetId::minRegionId; iRegion <= GEMDetId::maxRegionId; ++iRegion )
{
for( Int_t iStation = GEMDetId::minStationId; iStation <= GEMDetId::maxStationId; ++iStation )
{
TEveElementList* cStation = new TEveCompound(Form("Station_%d Region_%d", iStation, iRegion) );
GEMlist->AddElement( cStation );
for( Int_t iRing = GEMDetId::minRingId; iRing <= GEMDetId::maxRingId; ++iRing )
{
TEveCompound* cRing = new TEveCompound( Form("Ring_%d", iRing) );
cStation->AddElement( cRing );
for( Int_t iChamber = GEMDetId::minChamberId; iChamber <= GEMDetId::maxChamberId; ++iChamber )
{
for( Int_t iLayer = GEMDetId::minLayerId; iLayer <= GEMDetId::maxLayerId ; ++iLayer )
{
for (Int_t iRoll = GEMDetId::minRollId; iRoll <= GEMDetId::maxRollId ; ++iRoll )
{
GEMDetId id( iRegion, iRing, iStation, iLayer, iChamber, iRoll );
TEveGeoShape* shape = m_geom->getEveShape( id.rawId() );
shape->SetTitle(TString::Format("GEM: , Rng=%d, St=%d, Ch=%d Rl=%d\ndet-id=%u",
iRing, iStation, iChamber, iRoll, id.rawId()));

cRing->AddElement( shape );
addToCompound(shape, kFWMuonEndcapLineColorIndex );
}
}
}
}
}
}
m_muonEndcapElements->AddElement(GEMlist);

// EVE debug :: add list on bottom of TEveBrowser list tree
gEve->AddToListTree(GEMlist, false);
AddElement( m_muonEndcapElements );

}

if( m_muonEndcapElements )
Expand Down
1 change: 1 addition & 0 deletions Fireworks/Geometry/interface/FWRecoGeometryESProducer.h
Expand Up @@ -35,6 +35,7 @@ class FWRecoGeometryESProducer : public edm::ESProducer
void addDTGeometry( void );
void addRPCGeometry( void );
void addGEMGeometry( void );
void addME0Geometry( void );
void addPixelBarrelGeometry( void );
void addPixelForwardGeometry( void );
void addTIBGeometry( void );
Expand Down
110 changes: 75 additions & 35 deletions Fireworks/Geometry/src/FWRecoGeometryESProducer.cc
Expand Up @@ -15,6 +15,7 @@
#include "Geometry/DTGeometry/interface/DTLayer.h"
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
#include "Geometry/GEMGeometry/interface/ME0Geometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h"
Expand Down Expand Up @@ -95,18 +96,8 @@ FWRecoGeometryESProducer::produce( const FWRecoGeometryRecord& record )
addDTGeometry();
addCSCGeometry();
addRPCGeometry();

try
{
addGEMGeometry();
}
catch( cms::Exception& exception )
{
edm::LogWarning("FWRecoGeometryProducerException")
<< "Exception caught while building GEM geometry: " << exception.what()
<< std::endl;
}

addGEMGeometry();
addME0Geometry();
addCaloGeometry();

m_fwGeometry->idToName.resize( m_current + 1 );
Expand Down Expand Up @@ -260,34 +251,83 @@ FWRecoGeometryESProducer::addGEMGeometry( void )
// GEM geometry
//
DetId detId( DetId::Muon, 4 );
const GEMGeometry* gemGeom = (const GEMGeometry*) m_geomRecord->slaveGeometry( detId );
for( auto it = gemGeom->etaPartitions().begin(),
end = gemGeom->etaPartitions().end();
it != end; ++it )

try
{
const GEMEtaPartition* roll = (*it);
if( roll )
{
unsigned int rawid = (*it)->geographicalId().rawId();
unsigned int current = insert_id( rawid );
fillShapeAndPlacement( current, roll );
const GEMGeometry* gemGeom = (const GEMGeometry*) m_geomRecord->slaveGeometry( detId );

for(auto roll : gemGeom->etaPartitions())
{
if( roll )
{
unsigned int rawid = roll->geographicalId().rawId();
unsigned int current = insert_id( rawid );
fillShapeAndPlacement( current, roll );

const StripTopology& topo = roll->specificTopology();
m_fwGeometry->idToName[current].topology[0] = topo.nstrips();
m_fwGeometry->idToName[current].topology[1] = topo.stripLength();
m_fwGeometry->idToName[current].topology[2] = topo.pitch();

float height = topo.stripLength()/2;
LocalPoint lTop( 0., height, 0.);
LocalPoint lBottom( 0., -height, 0.);
m_fwGeometry->idToName[current].topology[3] = roll->localPitch(lTop);
m_fwGeometry->idToName[current].topology[4] = roll->localPitch(lBottom);
m_fwGeometry->idToName[current].topology[5] = roll->npads();
}
}

const StripTopology& topo = roll->specificTopology();
m_fwGeometry->idToName[current].topology[0] = topo.nstrips();
m_fwGeometry->idToName[current].topology[1] = topo.stripLength();
m_fwGeometry->idToName[current].topology[2] = topo.pitch();
m_fwGeometry->extraDet.Add(new TNamed("GEM", "GEM muon detector"));
}
catch( cms::Exception &exception )
{
edm::LogInfo("FWRecoGeometry") << "failed to produce GEM geometry " << exception.what() << std::endl;
}
}



void
FWRecoGeometryESProducer::addME0Geometry( void )
{
//
// ME0 geometry
//

float height = topo.stripLength()/2;
LocalPoint lTop( 0., height, 0.);
LocalPoint lBottom( 0., -height, 0.);
m_fwGeometry->idToName[current].topology[3] = roll->localPitch(lTop);
m_fwGeometry->idToName[current].topology[4] = roll->localPitch(lBottom);
m_fwGeometry->idToName[current].topology[5] = roll->npads();
DetId detId( DetId::Muon, 5 );
try
{
const ME0Geometry* me0Geom = (const ME0Geometry*) m_geomRecord->slaveGeometry( detId );

for(auto roll : me0Geom->etaPartitions())
{
if( roll )
{
unsigned int rawid = roll->geographicalId().rawId();
unsigned int current = insert_id( rawid );
fillShapeAndPlacement( current, roll );

const StripTopology& topo = roll->specificTopology();
m_fwGeometry->idToName[current].topology[0] = topo.nstrips();
m_fwGeometry->idToName[current].topology[1] = topo.stripLength();
m_fwGeometry->idToName[current].topology[2] = topo.pitch();

float height = topo.stripLength()/2;
LocalPoint lTop( 0., height, 0.);
LocalPoint lBottom( 0., -height, 0.);
m_fwGeometry->idToName[current].topology[3] = roll->localPitch(lTop);
m_fwGeometry->idToName[current].topology[4] = roll->localPitch(lBottom);
m_fwGeometry->idToName[current].topology[5] = roll->npads();
}
}
}

m_fwGeometry->extraDet.Add(new TNamed("GEM", "GEM muon detector"));
}
catch( cms::Exception &exception )
{
edm::LogInfo("FWRecoGeometry") << "failed to produce ME0 geometry " << exception.what() << std::endl;
}
}



void
Expand Down
5 changes: 5 additions & 0 deletions Fireworks/Tracks/plugins/FWTrackHitsDetailView.cc
Expand Up @@ -427,6 +427,11 @@ FWTrackHitsDetailView::addModules( const reco::Track& track,
case MuonSubdetId::RPC:
name = "RPC";
break;
case MuonSubdetId::GEM:
name = "GEM";
break;
case MuonSubdetId::ME0:
name = "ME0";
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions Fireworks/Tracks/plugins/FWTrackResidualDetailView.h
Expand Up @@ -23,6 +23,7 @@
// |mu = 0 DT = 1 layer hit type = 0-3
// |mu = 0 CSC = 2 layer hit type = 0-3
// |mu = 0 RPC = 3 layer hit type = 0-3
// |mu = 0 GEM = 3 layer hit type = 0-3
//
// hit type, see DataFormats/TrackingRecHit/interface/TrackingRecHit.h
// valid = valid hit = 0
Expand Down
22 changes: 22 additions & 0 deletions Fireworks/Tracks/src/TrackUtils.cc
Expand Up @@ -44,6 +44,8 @@
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "DataFormats/MuonDetId/interface/GEMDetId.h"
#include "DataFormats/MuonDetId/interface/ME0DetId.h"

#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
Expand Down Expand Up @@ -786,6 +788,26 @@ info(const DetId& id) {
}
}
break;
case MuonSubdetId::GEM:
{
GEMDetId detId(id.rawId());
oss << "GEM chamber (region, station, ring, chamber, layer): "
<< detId.region() << ", "
<< detId.station() << ", "
<< detId.ring() << ", "
<< detId.chamber() << ", "
<< detId.layer();
}
break;
case MuonSubdetId::ME0:
{
ME0DetId detId(id.rawId());
oss << "ME0 chamber (region, chamber, layer): "
<< detId.region() << ", "
<< detId.chamber() << ", "
<< detId.layer();
}
break;
}
break;

Expand Down

0 comments on commit b8e87cc

Please sign in to comment.