Skip to content

Commit

Permalink
Completing the geometry interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Dildick committed Dec 2, 2013
1 parent 1e1e78c commit e385ee1
Show file tree
Hide file tree
Showing 10 changed files with 571 additions and 78 deletions.
45 changes: 39 additions & 6 deletions Geometry/GEMGeometry/interface/GEMGeometry.h
Expand Up @@ -13,6 +13,9 @@
#include "Geometry/GEMGeometry/interface/GEMEtaPartition.h"
#include "Geometry/GEMGeometry/interface/GEMChamber.h"
#include "Geometry/GEMGeometry/interface/GEMSuperChamber.h"
#include "Geometry/GEMGeometry/interface/GEMRing.h"
#include "Geometry/GEMGeometry/interface/GEMStation.h"
#include "Geometry/GEMGeometry/interface/GEMRegion.h"
#include <vector>
#include <map>

Expand Down Expand Up @@ -52,6 +55,15 @@ class GEMGeometry : public TrackingGeometry {

//---- Extension of the interface

/// Return a vector of all GEM regions
const std::vector<GEMRegion*>& regions() const;

/// Return a vector of all GEM stations
const std::vector<GEMStation*>& stations() const;

/// Return a vector of all GEM rings
const std::vector<GEMRing*>& rings() const;

/// Return a vector of all GEM super chambers
const std::vector<GEMSuperChamber*>& superChambers() const;

Expand All @@ -61,24 +73,42 @@ class GEMGeometry : public TrackingGeometry {
/// Return a vector of all GEM eta partitions
const std::vector<GEMEtaPartition*>& etaPartitions() const;

// Return a GEMRegion
const GEMRegion* region(int region) const;

// Return a GEMStation
const GEMStation* station(int region, int station) const;

/// Return a GEMRing
const GEMRing* ring(int region, int station, int ring) const;

// Return a GEMSuperChamber given one of its layer detids
const GEMSuperChamber* superChamber(GEMDetId id) const;

// Return a GEMChamber given its id
const GEMChamber* chamber(GEMDetId id) const;

/// Return a etaPartition given its id
/// Return a GEMEtaPartition given its id
const GEMEtaPartition* etaPartition(GEMDetId id) const;

/// Add a GEM SuperChamber to the Geometry
void add(GEMSuperChamber* sch);
/// Add a GEMRegion to the Geometry
void add(GEMRegion* region);

/// Add a GEM etaPartition to the Geometry
void add(GEMEtaPartition* etaPartition);
/// Add a GEMStation to the Geometry
void add(GEMStation* station);

/// Add a GEMRing to the Geometry
void add(GEMRing* ring);

/// Add a GEM Chamber to the Geometry
/// Add a GEMSuperChamber to the Geometry
void add(GEMSuperChamber* sch);

/// Add a GEMChamber to the Geometry
void add(GEMChamber* ch);

/// Add a GEMEtaPartition to the Geometry
void add(GEMEtaPartition* etaPartition);

private:
DetUnitContainer theEtaPartitions;
DetContainer theDets;
Expand All @@ -92,6 +122,9 @@ class GEMGeometry : public TrackingGeometry {
std::vector<GEMEtaPartition*> allEtaPartitions; // Are not owned by this class; are owned by their chamber.
std::vector<GEMChamber*> allChambers; // Are owned by this class.
std::vector<GEMSuperChamber*> allSuperChambers; // Are owned by this class.
std::vector<GEMRing*> allRings; // Are owned by this class.
std::vector<GEMStation*> allStations; // Are owned by this class.
std::vector<GEMRegion*> allRegions; // Are owned by this class.
};

#endif
68 changes: 68 additions & 0 deletions Geometry/GEMGeometry/interface/GEMRegion.h
@@ -0,0 +1,68 @@
#ifndef GEMGeometry_GEMRegion_h
#define GEMGeometry_GEMRegion_h

/** \class GEMRegion
*
* Model of a GEM Region
*
* A region has maximal 5 stations
*
* \author S. Dildick
*/

#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "DataFormats/MuonDetId/interface/GEMDetId.h"

class GEMStation;
class GEMSuperChamber;

class GEMRegion
{
public:
/// constructor
GEMRegion(int region);

/// destructor
~GEMRegion();

/// Return the vector of GEMDetIds in this ring
std::vector<GEMDetId> ids() const;

/// equal if the id is the same
bool operator==(const GEMRegion& reg) const;

/// Add station to the region which takes ownership
void add(GEMStation* st);

/// Return the super chambers in the region
virtual std::vector<const GeomDet*> components() const;

/// Return the sub-component (super chamber) with a given id in this region
virtual const GeomDet* component(DetId id) const;

/// Return the super chamber corresponding to the given id
const GEMSuperChamber* superChamber(GEMDetId id) const;

/// Return the super chambers in the region
std::vector<const GEMSuperChamber*> superChambers() const;

/// Return a station
const GEMStation* station(int st) const;

/// Return all stations
const std::vector<const GEMStation*>& stations() const;

/// Return numbers of stations
int nStations() const;

/// Return the region
int region() const;

private:

int region_;
// vector of stations for a region
std::vector<const GEMStation*> stations_;

};
#endif
75 changes: 75 additions & 0 deletions Geometry/GEMGeometry/interface/GEMRing.h
@@ -0,0 +1,75 @@
#ifndef GEMGeometry_GEMRing_h
#define GEMGeometry_GEMRing_h

/** \class GEMRing
*
* Model of a GEM Ring
*
* A ring is composed of 36 super chambers
*
* \author S. Dildick
*/

#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "DataFormats/MuonDetId/interface/GEMDetId.h"

class GEMSuperChamber;

class GEMRing
{
public:
/// constructor
GEMRing(int region, int station, int ring);

/// destructor
~GEMRing();

/// Return the vector of GEMDetIds in this ring
std::vector<GEMDetId> ids() const;

/// equal if the id is the same
bool operator==(const GEMRing& sch) const;

/// Add super chamber to the ring which takes ownership
void add(GEMSuperChamber* ch);

/// Return the super chambers in the ring
virtual std::vector<const GeomDet*> components() const;

/// Return the sub-component (super chamber) with a given id in this ring
virtual const GeomDet* component(DetId id) const;

/// Return the chamber corresponding to the given id
const GEMSuperChamber* superChamber(GEMDetId id) const;

// Return a super chamber
const GEMSuperChamber* superChamber(int sch) const;

/// Return the chambers in the ring
std::vector<const GEMSuperChamber*> superChambers() const;

/// Return numbers of chambers
int nSuperChambers() const;

/// Return the region number
int region() const;

/// Return the station number
int station() const;

/// Return the ring number
int ring() const;

private:

int region_;
int station_;
int ring_;

std::vector<GEMDetId> detIds_;

// vector of chambers for a super chamber
std::vector<const GEMSuperChamber*> superChambers_;

};
#endif
80 changes: 80 additions & 0 deletions Geometry/GEMGeometry/interface/GEMStation.h
@@ -0,0 +1,80 @@
#ifndef GEMGeometry_GEMStation_h
#define GEMGeometry_GEMStation_h

/** \class GEMStation
*
* Model of a GEM Station
*
* A station is composed of maximal 3 rings
*
* \author S. Dildick
*/

#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "DataFormats/MuonDetId/interface/GEMDetId.h"
#include "Geometry/GEMGeometry/interface/GEMRing.h"

class GEMSuperChamber;

class GEMStation
{
public:
/// constructor
GEMStation(int region, int station);

/// destructor
~GEMStation();

/// Return the vector of GEMDetIds in this station
std::vector<GEMDetId> ids() const;

/// equal if the id is the same
bool operator==(const GEMStation& st) const;

/// Add ring to the station which takes ownership
void add(GEMRing* ring);

/// Return the super chambers in the station
virtual std::vector<const GeomDet*> components() const;

/// Return the sub-component (super chamber) with a given id in this station
virtual const GeomDet* component(DetId id) const;

/// Return the chamber corresponding to the given id
const GEMSuperChamber* superChamber(GEMDetId id) const;

/// Return the super chambers in the region
std::vector<const GEMSuperChamber*> superChambers() const;

/// Get a ring
const GEMRing* ring(int ring) const;

/// Return the rings in the station
const std::vector<const GEMRing*>& rings() const;

/// Return numbers of rings for this station
int nRings() const;

/// Set the station name
void setName(std::string name);

/// Set the station name
const std::string getName() const;

/// Get the region
int region() const;

/// Get the station
int station() const;

private:

int region_;
int station_;

// vector of rings for a station
std::vector<const GEMRing*> rings_;
std::string name_;

};
#endif
40 changes: 10 additions & 30 deletions Geometry/GEMGeometry/src/GEMChamber.cc
Expand Up @@ -14,62 +14,42 @@ GEMChamber::GEMChamber(GEMDetId id, const ReferenceCountingPointer<BoundPlane> &
setDetId(id);
}

GEMChamber::~GEMChamber()
{
}
GEMChamber::~GEMChamber() {}

GEMDetId
GEMChamber::id() const
{
GEMDetId GEMChamber::id() const {
return detId_;
}

bool
GEMChamber::operator==(const GEMChamber& ch) const
{
bool GEMChamber::operator==(const GEMChamber& ch) const {
return this->id()==ch.id();
}

void
GEMChamber::add(GEMEtaPartition* rl)
{
void GEMChamber::add(GEMEtaPartition* rl) {
etaPartitions_.push_back(rl);
}

std::vector<const GeomDet*>
GEMChamber::components() const
{
std::vector<const GeomDet*> GEMChamber::components() const {
return std::vector<const GeomDet*>(etaPartitions_.begin(), etaPartitions_.end());
}

const GeomDet*
GEMChamber::component(DetId id) const
{
const GeomDet* GEMChamber::component(DetId id) const {
return etaPartition(GEMDetId(id.rawId()));
}

const std::vector<const GEMEtaPartition*>&
GEMChamber::etaPartitions() const
{
const std::vector<const GEMEtaPartition*>& GEMChamber::etaPartitions() const {
return etaPartitions_;
}

int
GEMChamber::nEtaPartitions() const
{
int GEMChamber::nEtaPartitions() const {
return etaPartitions_.size();
}

const GEMEtaPartition*
GEMChamber::etaPartition(GEMDetId id) const
{
const GEMEtaPartition* GEMChamber::etaPartition(GEMDetId id) const {
if (id.chamberId()!=detId_) return 0; // not in this eta partition!
return etaPartition(id.roll());
}

const GEMEtaPartition*
GEMChamber::etaPartition(int isl) const
{
const GEMEtaPartition* GEMChamber::etaPartition(int isl) const {
for (auto roll : etaPartitions_){
if (roll->id().roll()==isl)
return roll;
Expand Down

0 comments on commit e385ee1

Please sign in to comment.