From 73782e8d6fb3bcf0061c5138a9c509f42b77a946 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 28 Nov 2013 22:39:24 +0900 Subject: [PATCH] fireworks fixing the position of GEM digi hits v2 --- Fireworks/Core/interface/FWGeometry.h | 2 +- Fireworks/Core/interface/FWRPZViewGeometry.h | 1 + Fireworks/Core/src/FW3DViewGeometry.cc | 28 ++++++- Fireworks/Core/src/FWRPZViewGeometry.cc | 74 +++++++++++++++++++ .../Geometry/src/FWRecoGeometryESProducer.cc | 9 ++- .../Muons/plugins/FWGEMDigiProxyBuilder.cc | 37 ++++++---- .../Muons/plugins/FWItemMuonAccessors.cc | 6 +- .../Tracks/plugins/FWTrackHitsDetailView.cc | 3 + .../plugins/FWTrackResidualDetailView.h | 1 + Fireworks/Tracks/src/TrackUtils.cc | 12 +++ 10 files changed, 152 insertions(+), 21 deletions(-) diff --git a/Fireworks/Core/interface/FWGeometry.h b/Fireworks/Core/interface/FWGeometry.h index 5c609be258001..8e7f2fe37a5bd 100644 --- a/Fireworks/Core/interface/FWGeometry.h +++ b/Fireworks/Core/interface/FWGeometry.h @@ -27,7 +27,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 }; struct Range { double min1; diff --git a/Fireworks/Core/interface/FWRPZViewGeometry.h b/Fireworks/Core/interface/FWRPZViewGeometry.h index 0b87bf3530e3e..9da32e5ec6f70 100644 --- a/Fireworks/Core/interface/FWRPZViewGeometry.h +++ b/Fireworks/Core/interface/FWRPZViewGeometry.h @@ -60,6 +60,7 @@ class FWRPZViewGeometry : public FWViewGeometryList TEveElement* makeCaloOutlineRhoZ(); void estimateProjectionSizeDT( const FWGeometry::GeomDetInfo& info, float&, float&, float&, float& ); void estimateProjectionSizeCSC( const FWGeometry::GeomDetInfo& info, float&, float&, float&, float& ); + void estimateProjectionSizeGEM( const FWGeometry::GeomDetInfo& info, float&, float&, float&, float& ); void estimateProjectionSize( const float*, float&, float&, float&, float& ); void importNew(TEveElementList* x); diff --git a/Fireworks/Core/src/FW3DViewGeometry.cc b/Fireworks/Core/src/FW3DViewGeometry.cc index e162f5064f426..d829f1065198e 100644 --- a/Fireworks/Core/src/FW3DViewGeometry.cc +++ b/Fireworks/Core/src/FW3DViewGeometry.cc @@ -27,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" @@ -197,7 +198,32 @@ FW3DViewGeometry::showMuonEndcap( bool showMuonEndcap ) cRing->AddElement( shape ); } } - } + } + // Actual GEM geometry: + // Station 1 has 1 rings with 36 chambers in each + // for Phase 1, 1 ring and 1 station + maxChambers = 36; + // for( Int_t iStation = 1; iStation <= 1; ++iStation ){ + Int_t iStation = 1; + std::ostringstream s; + s << "Station" << iStation; + TEveElementList* cStation = new TEveElementList( s.str().c_str() ); + cEndcap->AddElement( cStation ); + // for( Int_t iRing = 1; iRing <= 1; ++iRing ){ + Int_t iRing = 1; + s << "Ring" << iRing; + TEveElementList* cRing = new TEveElementList( s.str().c_str() ); + cStation->AddElement( cRing ); + for( Int_t iChamber = 1; iChamber <= maxChambers; ++iChamber ) { + Int_t iLayer = 1; // Actually it should be GEM super chambers + GEMDetId id( iEndcap, iRing, iStation, iLayer, iChamber, 0 ); + TEveGeoShape* shape = m_geom->getEveShape( id.rawId() ); + shape->SetTitle(TString::Format("GEM: %s, R=%d, S=%d, C=%d\ndet-id=%u", + cEndcap->GetName(), iRing, iStation, iChamber, id.rawId())); + + addToCompound(shape, kFWMuonEndcapLineColorIndex); + cRing->AddElement( shape ); + } } AddElement( m_muonEndcapElements ); } diff --git a/Fireworks/Core/src/FWRPZViewGeometry.cc b/Fireworks/Core/src/FWRPZViewGeometry.cc index 42b6512ca8d83..45ad56e17b462 100644 --- a/Fireworks/Core/src/FWRPZViewGeometry.cc +++ b/Fireworks/Core/src/FWRPZViewGeometry.cc @@ -35,6 +35,7 @@ #include "DataFormats/MuonDetId/interface/DTChamberId.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/MuonDetId/interface/GEMDetId.h" // // @@ -258,6 +259,51 @@ FWRPZViewGeometry::makeMuonGeometryRhoZ( void ) } container->AddElement( cscContainer ); } + { + TEveCompound* gemContainer = new TEveCompound( "GEM" ); + + Int_t maxChambers = 36; + Int_t step = 9; + Int_t iRing = 1; + Int_t maxRolls = 8; + for( Int_t iEndcap = -1; iEndcap <= 1; iEndcap+=2 ){ // 1=forward (+Z), 2=backward(-Z) + // Actual GEM geometry: + // Station 1 has 1 rings with 36 chambers in each + // for( Int_t iStation = 1; iStation <= 1; ++iStation ){ + Int_t iStation = 1; + // iLayer chamber - Actually it should be GEM super chambers + for( Int_t iLayer = 1; iLayer <= 2; ++iLayer ){ + float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000); + ( iRing == 1 && iStation > 1 ) ? ( step = 5 ) : ( step = 18 ); + + // Skip most of the chambers since they will project + // the same way as the two top ones and the two bottom ones + for( Int_t iChamber = step; iChamber <= maxChambers; iChamber += step ){ + for( Int_t iRoll = 1; iRoll <= maxRolls; ++iRoll ){ + GEMDetId id( iEndcap, iRing, iStation, iLayer, iChamber, iRoll ); + FWGeometry::IdToInfoItr det = m_geom->find( id.rawId() ); + estimateProjectionSizeGEM( *det, min_rho, max_rho, min_z, max_z ); + + // and a chamber next to it + ++iChamber; + GEMDetId nextid( iEndcap, iRing, iStation, iLayer, iChamber, iRoll ); + det = m_geom->find( nextid.rawId() ); + estimateProjectionSizeGEM( *det, min_rho, max_rho, min_z, max_z ); + } + } + if ( min_rho > max_rho || min_z > max_z ) continue; + + TEveElement* se = makeShape( min_rho, max_rho, min_z, max_z); + addToCompound(se, kFWMuonEndcapLineColorIndex); + gemContainer->AddElement(se); + + se = makeShape( -max_rho, -min_rho, min_z, max_z ); + addToCompound(se, kFWMuonEndcapLineColorIndex); + gemContainer->AddElement(se); + } + } + container->AddElement( gemContainer ); + } return container; } @@ -365,6 +411,34 @@ FWRPZViewGeometry::estimateProjectionSizeCSC( const FWGeometry::GeomDetInfo& inf estimateProjectionSize( global, min_rho, max_rho, min_z, max_z ); } +void +FWRPZViewGeometry::estimateProjectionSizeGEM( const FWGeometry::GeomDetInfo& info, + float& min_rho, float& max_rho, float& min_z, float& max_z ) +{ + float local[3], global[3]; + + float dX = info.shape[2] - info.shape[1]; + float dY = info.shape[4]; + float ddY = sqrt( 4 * dY * dY + dX * dX ) * 0.5; // need to check this + float dZ = info.shape[3]; + + local[0] = info.shape[2]; local[1] = ddY; local[2] = -dZ; + m_geom->localToGlobal( info, local, global ); + estimateProjectionSize( global, min_rho, max_rho, min_z, max_z ); + + local[0] = info.shape[1]; local[1] = -ddY; local[2] = -dZ; + m_geom->localToGlobal( info, local, global ); + estimateProjectionSize( global, min_rho, max_rho, min_z, max_z ); + + local[0] = info.shape[1]; local[1] = -ddY; local[2] = dZ; + m_geom->localToGlobal( info, local, global ); + estimateProjectionSize( global, min_rho, max_rho, min_z, max_z ); + + local[0] = info.shape[2]; local[1] = ddY; local[2] = dZ; + m_geom->localToGlobal( info, local, global ); + estimateProjectionSize( global, min_rho, max_rho, min_z, max_z ); +} + void FWRPZViewGeometry::estimateProjectionSize( const float* global, float& min_rho, float& max_rho, float& min_z, float& max_z ) diff --git a/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc b/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc index 45af19225e932..caa49511444f3 100644 --- a/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc +++ b/Fireworks/Geometry/src/FWRecoGeometryESProducer.cc @@ -244,7 +244,7 @@ FWRecoGeometryESProducer::addGEMGeometry( void ) for( std::vector::const_iterator it = gemGeom->etaPartitions().begin(), end = gemGeom->etaPartitions().end(); it != end; ++it ) - { + { GEMEtaPartition* roll = (*it); if( roll ) { @@ -256,6 +256,13 @@ FWRecoGeometryESProducer::addGEMGeometry( void ) 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(); } } } diff --git a/Fireworks/Muons/plugins/FWGEMDigiProxyBuilder.cc b/Fireworks/Muons/plugins/FWGEMDigiProxyBuilder.cc index 13a96706950af..d70449ef81113 100644 --- a/Fireworks/Muons/plugins/FWGEMDigiProxyBuilder.cc +++ b/Fireworks/Muons/plugins/FWGEMDigiProxyBuilder.cc @@ -23,6 +23,8 @@ #include "DataFormats/GEMDigi/interface/GEMDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMCSCPadDigiCollection.h" +#include "Geometry/GEMGeometry/interface/GEMGeometry.h" +#include "Geometry/GEMGeometry/interface/GEMEtaPartition.h" class FWGEMDigiProxyBuilder : public FWProxyBuilderBase { @@ -60,7 +62,7 @@ void FWGEMDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* pro if( ! geom->contains( rawid )) { fwLog( fwlog::kWarning ) << "Failed to get geometry of GEM roll with detid: " - << rawid << std::endl; + << rawid << std::endl; TEveCompound* compound = createCompound(); setupAddElement( compound, product ); @@ -71,9 +73,9 @@ void FWGEMDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* pro const float* parameters = geom->getParameters( rawid ); float nStrips = parameters[0]; float halfStripLength = parameters[1]*0.5; - float pitch = parameters[2]; - float offset = -0.5*nStrips*pitch; - + float topPitch = parameters[3]; + float bottomPitch = parameters[4]; + for( GEMDigiCollection::const_iterator dit = range.first; dit != range.second; ++dit ) { @@ -82,16 +84,17 @@ void FWGEMDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* pro setupAddElement( stripDigiSet, product ); int strip = (*dit).strip(); - float centreOfStrip = (strip-0.5)*pitch + offset; + float topOfStrip = (strip-0.5)*topPitch - 0.5*nStrips*topPitch; + float bottomOfStrip = (strip-0.5)*bottomPitch - 0.5*nStrips*bottomPitch; float localPointTop[3] = { - centreOfStrip, halfStripLength, 0.0 + topOfStrip, halfStripLength, 0.0 }; float localPointBottom[3] = { - centreOfStrip, -halfStripLength, 0.0 + bottomOfStrip, -halfStripLength, 0.0 }; float globalPointTop[3]; @@ -146,7 +149,7 @@ FWGEMCSCPadDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* pr if( ! geom->contains( rawid )) { fwLog( fwlog::kWarning ) << "Failed to get geometry of GEM roll with detid: " - << rawid << std::endl; + << rawid << std::endl; TEveCompound* compound = createCompound(); setupAddElement( compound, product ); @@ -157,34 +160,36 @@ FWGEMCSCPadDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* pr const float* parameters = geom->getParameters( rawid ); float nStrips = parameters[0]; float halfStripLength = parameters[1]*0.5; - float pitch = parameters[2]; - float offset = -0.5*nStrips*pitch; - + float nPads = parameters[5]; + float topPitch = parameters[3]*nStrips/nPads; + float bottomPitch = parameters[4]*nStrips/nPads; + for( GEMCSCPadDigiCollection::const_iterator dit = range.first; dit != range.second; ++dit ) { TEveStraightLineSet* stripDigiSet = new TEveStraightLineSet; - stripDigiSet->SetLineWidth(3); + stripDigiSet->SetLineWidth(3*nStrips/nPads); setupAddElement( stripDigiSet, product ); int pad = (*dit).pad(); - float centreOfStrip = (pad-0.5)*pitch + offset; + float topOfStrip = (pad-0.5)*topPitch - 0.5*topPitch*nPads; + float bottomOfStrip = (pad-0.5)*bottomPitch - 0.5*bottomPitch*nPads; float localPointTop[3] = { - centreOfStrip, halfStripLength, 0.0 + topOfStrip, halfStripLength, 0.0 }; float localPointBottom[3] = { - centreOfStrip, -halfStripLength, 0.0 + bottomOfStrip, -halfStripLength, 0.0 }; float globalPointTop[3]; float globalPointBottom[3]; geom->localToGlobal( rawid, localPointTop, globalPointTop, localPointBottom, globalPointBottom ); - + stripDigiSet->AddLine(globalPointTop[0], globalPointTop[1], globalPointTop[2], globalPointBottom[0], globalPointBottom[1], globalPointBottom[2]); } diff --git a/Fireworks/Muons/plugins/FWItemMuonAccessors.cc b/Fireworks/Muons/plugins/FWItemMuonAccessors.cc index aa0af5dc8221a..1b7f811495258 100644 --- a/Fireworks/Muons/plugins/FWItemMuonAccessors.cc +++ b/Fireworks/Muons/plugins/FWItemMuonAccessors.cc @@ -8,6 +8,7 @@ // // Original Author: Giulio Eulisse // Created: Thu Feb 18 15:19:44 EDT 2008 +// $Id: FWItemMuonAccessors.cc,v 1.6 2010/06/11 08:21:07 mccauley Exp $ // $Id: FWItemMuonAccessors.cc,v 1.7 2010/06/18 12:44:05 yana Exp $ // $Id: FWItemMuonAccessors.cc,v 1.8 2013/10/10 22:17:00 YusangKim$ // @@ -58,11 +59,12 @@ REGISTER_TEMPLATE_FWITEMACCESSOR(CSCStripDigiAccessor, CSCStripDigiCollection, " typedef FWItemMuonDigiAccessor RPCDigiAccessor; REGISTER_TEMPLATE_FWITEMACCESSOR(RPCDigiAccessor, RPCDigiCollection, "RPCDigiCollectionAccessor"); -typedef FWItemMuonDigiAccessor GEMDigiAccessor; -REGISTER_TEMPLATE_FWITEMACCESSOR(GEMDigiAccessor, GEMDigiCollection, "GEMDigiCollectionAccessor"); typedef FWItemMuonDigiAccessor CSCRPCDigiAccessor; REGISTER_TEMPLATE_FWITEMACCESSOR(CSCRPCDigiAccessor, CSCRPCDigiCollection, "CSCRPCDigiCollectionAccessor"); +typedef FWItemMuonDigiAccessor GEMDigiAccessor; +REGISTER_TEMPLATE_FWITEMACCESSOR(GEMDigiAccessor, GEMDigiCollection, "GEMDigiCollectionAccessor"); + typedef FWItemMuonDigiAccessor GEMCSCPadDigiAccessor; REGISTER_TEMPLATE_FWITEMACCESSOR(GEMCSCPadDigiAccessor, GEMCSCPadDigiCollection, "GEMCSCPadDigiCollectionAccessor"); diff --git a/Fireworks/Tracks/plugins/FWTrackHitsDetailView.cc b/Fireworks/Tracks/plugins/FWTrackHitsDetailView.cc index 6594f51d37b88..e1649938eb8d4 100644 --- a/Fireworks/Tracks/plugins/FWTrackHitsDetailView.cc +++ b/Fireworks/Tracks/plugins/FWTrackHitsDetailView.cc @@ -424,6 +424,9 @@ FWTrackHitsDetailView::addModules( const reco::Track& track, case MuonSubdetId::RPC: name = "RPC"; break; + case MuonSubdetId::GEM: + name = "GEM"; + break; default: break; } diff --git a/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h b/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h index 9013b2b412945..e54a45b41fb4b 100644 --- a/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h +++ b/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h @@ -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 diff --git a/Fireworks/Tracks/src/TrackUtils.cc b/Fireworks/Tracks/src/TrackUtils.cc index 92d141224499c..7c82706097f64 100644 --- a/Fireworks/Tracks/src/TrackUtils.cc +++ b/Fireworks/Tracks/src/TrackUtils.cc @@ -43,6 +43,7 @@ #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/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" @@ -799,6 +800,17 @@ 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; } break;