Skip to content

Commit

Permalink
fireworks fixing the position of GEM digi hits v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jshlee committed Nov 28, 2013
1 parent 1219486 commit 73782e8
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Fireworks/Core/interface/FWGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Fireworks/Core/interface/FWRPZViewGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 27 additions & 1 deletion Fireworks/Core/src/FW3DViewGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );
}
Expand Down
74 changes: 74 additions & 0 deletions Fireworks/Core/src/FWRPZViewGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

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

//
//
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 )
Expand Down
9 changes: 8 additions & 1 deletion Fireworks/Geometry/src/FWRecoGeometryESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ FWRecoGeometryESProducer::addGEMGeometry( void )
for( std::vector<GEMEtaPartition *>::const_iterator it = gemGeom->etaPartitions().begin(),
end = gemGeom->etaPartitions().end();
it != end; ++it )
{
{
GEMEtaPartition* roll = (*it);
if( roll )
{
Expand All @@ -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();
}
}
}
Expand Down
37 changes: 21 additions & 16 deletions Fireworks/Muons/plugins/FWGEMDigiProxyBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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 );
Expand All @@ -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 )
{
Expand All @@ -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];
Expand Down Expand Up @@ -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 );
Expand All @@ -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]);
}
Expand Down
6 changes: 4 additions & 2 deletions Fireworks/Muons/plugins/FWItemMuonAccessors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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$
//
Expand Down Expand Up @@ -58,11 +59,12 @@ REGISTER_TEMPLATE_FWITEMACCESSOR(CSCStripDigiAccessor, CSCStripDigiCollection, "
typedef FWItemMuonDigiAccessor<RPCDigiCollection, RPCDigi> RPCDigiAccessor;
REGISTER_TEMPLATE_FWITEMACCESSOR(RPCDigiAccessor, RPCDigiCollection, "RPCDigiCollectionAccessor");

typedef FWItemMuonDigiAccessor<GEMDigiCollection, GEMDigi> GEMDigiAccessor;
REGISTER_TEMPLATE_FWITEMACCESSOR(GEMDigiAccessor, GEMDigiCollection, "GEMDigiCollectionAccessor");

typedef FWItemMuonDigiAccessor<CSCRPCDigiCollection, CSCRPCDigi> CSCRPCDigiAccessor;
REGISTER_TEMPLATE_FWITEMACCESSOR(CSCRPCDigiAccessor, CSCRPCDigiCollection, "CSCRPCDigiCollectionAccessor");

typedef FWItemMuonDigiAccessor<GEMDigiCollection, GEMDigi> GEMDigiAccessor;
REGISTER_TEMPLATE_FWITEMACCESSOR(GEMDigiAccessor, GEMDigiCollection, "GEMDigiCollectionAccessor");

typedef FWItemMuonDigiAccessor<GEMCSCPadDigiCollection, GEMCSCPadDigi> GEMCSCPadDigiAccessor;
REGISTER_TEMPLATE_FWITEMACCESSOR(GEMCSCPadDigiAccessor, GEMCSCPadDigiCollection, "GEMCSCPadDigiCollectionAccessor");
3 changes: 3 additions & 0 deletions Fireworks/Tracks/plugins/FWTrackHitsDetailView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ FWTrackHitsDetailView::addModules( const reco::Track& track,
case MuonSubdetId::RPC:
name = "RPC";
break;
case MuonSubdetId::GEM:
name = "GEM";
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions Fireworks/Tracks/plugins/FWTrackResidualDetailView.h
Original file line number Diff line number Diff line change
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
12 changes: 12 additions & 0 deletions Fireworks/Tracks/src/TrackUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 73782e8

Please sign in to comment.