Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GEMChamber to GEM geometry interface
- Loading branch information
Sven Dildick
committed
Nov 26, 2013
1 parent
1219486
commit c142973
Showing
6 changed files
with
301 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#ifndef GEMGeometry_GEMChamber_h | ||
#define GEMGeometry_GEMChamber_h | ||
|
||
/** \class GEMChamber | ||
* | ||
* Model of a GEM chamber. | ||
* | ||
* A chamber is a GeomDet. | ||
* The chamber is composed by 6,8 or 10 eta partitions (GeomDetUnit). | ||
* | ||
* \author S. Dildick | ||
*/ | ||
|
||
#include "Geometry/CommonDetUnit/interface/GeomDet.h" | ||
#include "DataFormats/MuonDetId/interface/GEMDetId.h" | ||
|
||
class GEMEtaPartition; | ||
|
||
class GEMChamber : public GeomDet { | ||
public: | ||
/// Constructor | ||
GEMChamber(GEMDetId id, const ReferenceCountingPointer<BoundPlane>& plane); | ||
|
||
/// Destructor | ||
virtual ~GEMChamber(); | ||
|
||
/// Return the GEMDetId of this chamber | ||
GEMDetId id() const; | ||
|
||
// Which subdetector | ||
virtual SubDetector subDetector() const {return GeomDetEnumerators::GEM;} | ||
|
||
/// equal if the id is the same | ||
bool operator==(const GEMChamber& ch) const; | ||
|
||
/// Add EtaPartition to the chamber which takes ownership | ||
void add(GEMEtaPartition* roll); | ||
|
||
/// Return the rolls in the chamber | ||
virtual std::vector<const GeomDet*> components() const; | ||
|
||
/// Return the sub-component (roll) with a given id in this chamber | ||
virtual const GeomDet* component(DetId id) const; | ||
|
||
/// Return the eta partition corresponding to the given id | ||
const GEMEtaPartition* etaPartition(GEMDetId id) const; | ||
|
||
const GEMEtaPartition* etaPartition(int isl) const; | ||
|
||
/// Return the eta partitions | ||
const std::vector<const GEMEtaPartition*>& etaPartitions() const; | ||
|
||
/// Retunr numbers of eta partitions | ||
int nEtaPartitions() const; | ||
|
||
private: | ||
|
||
GEMDetId detId_; | ||
|
||
// vector of eta partitions for a chamber | ||
std::vector<const GEMEtaPartition*> etaPartitions_; | ||
|
||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* Implementation of the Model for a GEM Chamber | ||
* | ||
* \author S.Dildick | ||
*/ | ||
|
||
|
||
#include "Geometry/GEMGeometry/interface/GEMChamber.h" | ||
#include "Geometry/GEMGeometry/interface/GEMEtaPartition.h" | ||
|
||
#include <iostream> | ||
|
||
|
||
GEMChamber::GEMChamber(GEMDetId id, const ReferenceCountingPointer<BoundPlane> & plane) : | ||
GeomDet(plane), detId_(id) | ||
{ | ||
setDetId(id); | ||
} | ||
|
||
|
||
GEMChamber::~GEMChamber() | ||
{ | ||
} | ||
|
||
|
||
GEMDetId | ||
GEMChamber::id() const | ||
{ | ||
return detId_; | ||
} | ||
|
||
|
||
bool | ||
GEMChamber::operator==(const GEMChamber& ch) const | ||
{ | ||
return this->id()==ch.id(); | ||
} | ||
|
||
|
||
void | ||
GEMChamber::add(GEMEtaPartition* rl) | ||
{ | ||
etaPartitions_.push_back(rl); | ||
} | ||
|
||
|
||
std::vector<const GeomDet*> | ||
GEMChamber::components() const | ||
{ | ||
return std::vector<const GeomDet*>(etaPartitions_.begin(), etaPartitions_.end()); | ||
} | ||
|
||
|
||
const GeomDet* | ||
GEMChamber::component(DetId id) const | ||
{ | ||
return etaPartition(GEMDetId(id.rawId())); | ||
} | ||
|
||
|
||
const std::vector<const GEMEtaPartition*>& | ||
GEMChamber::etaPartitions() const | ||
{ | ||
return etaPartitions_; | ||
} | ||
|
||
|
||
int | ||
GEMChamber::nEtaPartitions() const | ||
{ | ||
return etaPartitions_.size(); | ||
} | ||
|
||
|
||
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 | ||
{ | ||
for (auto roll : etaPartitions_){ | ||
if (roll->id().roll()==isl) | ||
return roll; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.