12 #include "CLHEP/Units/GlobalSystemOfUnits.h" 26 const std::vector<DetId>& detids( rgeo.
detIds());
27 std::unordered_map<uint32_t, GEMSuperChamber*> superChambers;
28 std::unordered_map<uint32_t, GEMChamber*>
chambers;
29 std::unordered_map<uint32_t, GEMEtaPartition*>
partitions;
31 for(
unsigned int id = 0;
id < detids.size(); ++
id ){
33 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"GEMGeometryBuilderFromDDD adding " << gemid << std::endl;
34 if (gemid.
roll() == 0){
35 if (gemid.
layer() == 0){
37 superChambers.emplace(gemid.
rawId(), gsc);
41 chambers.emplace(gemid.
rawId(), gch);
46 partitions.emplace(gemid.
rawId(), gep);
53 if (superChambers.empty()){
54 for(
unsigned int id = 0;
id < detids.size(); ++
id ){
56 if (gemid.
roll() == 1){
59 if (gemid.
layer() == 1){
69 for (
int re = -1; re <= 1; re = re+2){
78 for (
int ri=1; ri<=1; ++ri) {
81 for (
auto sch : superChambers){
82 auto superChamber = sch.second;
83 const GEMDetId scId(superChamber->id());
84 if (scId.region() != re || scId.station() != st || scId.ring() != ri)
continue;
88 const GEMDetId chId(re,ri,st,ly,ch,0);
89 auto chamberIt = chambers.find(chId.
rawId());
90 if (chamberIt == chambers.end())
continue;
91 auto chamber = chamberIt->second;
94 const GEMDetId rollId(re,ri,st,ly,ch,roll);
95 auto gepIt = partitions.find(rollId.
rawId());
96 if (gepIt == partitions.end())
continue;
97 auto gep = gepIt->second;
100 theGeometry->add(gep);
107 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding super chamber " << scId <<
" to ring: " << std::endl;
108 ring->
add(superChamber);
109 theGeometry->add(superChamber);
113 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding ring " << ri <<
" to station " <<
"re " << re <<
" st " << st << std::endl;
115 theGeometry->add(ring);
123 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding station " << st <<
" to region " << re << std::endl;
124 region->
add(station);
125 theGeometry->add(station);
132 LogDebug(
"GEMGeometryBuilderFromDDD") <<
"Adding region " << re <<
" to the geometry " << std::endl;
133 theGeometry->add(region);
140 LogDebug(
"GEMGeometryBuilderFromCondDB") <<
"buildSuperChamber "<< detId <<std::endl;
150 LogDebug(
"GEMGeometryBuilderFromCondDB") <<
"buildChamber "<< detId <<std::endl;
160 std::vector<std::string>::const_iterator strStart = rgeo.
strStart( gid );
162 LogDebug(
"GEMGeometryBuilderFromCondDB") <<
"buildEtaPartition "<< name<<
" "<< detId <<std::endl;
164 std::vector<double>::const_iterator shapeStart = rgeo.
shapeStart( gid );
165 float be = *(shapeStart+0)/cm;
166 float te = *(shapeStart+1)/cm;
167 float ap = *(shapeStart+2)/cm;
168 float ti = *(shapeStart+3)/cm;
169 float nstrip = *(shapeStart+4);
170 float npad = *(shapeStart+5);
172 std::vector<float> pars;
173 pars.emplace_back(be);
174 pars.emplace_back(te);
175 pars.emplace_back(ap);
176 pars.emplace_back(nstrip);
177 pars.emplace_back(npad);
182 LogDebug(
"GEMGeometryBuilderFromCondDB") <<
"size "<< be <<
" " << te <<
" " << ap <<
" " << ti <<std::endl;
190 std::vector<double>::const_iterator shapeStart = rgeo.
shapeStart( gid );
191 float be = *(shapeStart+0)/cm;
192 float te = *(shapeStart+1)/cm;
193 float ap = *(shapeStart+2)/cm;
194 float ti = *(shapeStart+3)/cm;
197 std::vector<double>::const_iterator tranStart = rgeo.
tranStart( gid );
200 std::vector<double>::const_iterator rotStart = rgeo.
rotStart( gid );
202 *(rotStart+3), *(rotStart+4), *(rotStart+5),
203 *(rotStart+6), *(rotStart+7), *(rotStart+8));
210 bool isOdd = detId.
chamber()%2;
212 if (detId.
station() == 0) isOdd =
true;
213 if (isOdd) newY *= -1;
void build(const std::shared_ptr< GEMGeometry > &theGeometry, const RecoIdealGeometry &rgeo)
int nSuperChambers() const
Return numbers of chambers.
std::vector< double >::const_iterator rotStart(size_t ind) const
static const int maxRollId
GEMSuperChamber * buildSuperChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
GEMDetId superChamberId() const
Return the corresponding superChamberId.
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
void add(GEMRing *ring)
Add ring to the station which takes ownership.
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
static const int maxLayerId
std::vector< std::string >::const_iterator strStart(size_t ind) const
GEMDetId chamberId() const
Return the corresponding ChamberId.
uint32_t rawId() const
get the raw id
GEMEtaPartition * buildEtaPartition(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
int station() const
Station id : the station is the pair of chambers at same disk.
std::vector< double >::const_iterator tranStart(size_t ind) const
static const int maxStationId
void setName(std::string name)
Set the station name.
GEMChamber * buildChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
const std::vector< DetId > & detIds() const
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
~GEMGeometryBuilderFromCondDB()
GEMGeometryBuilderFromCondDB()
std::vector< double >::const_iterator shapeStart(size_t ind) const
int nRings() const
Return numbers of rings for this station.
void add(GEMStation *st)
Add station to the region which takes ownership.
static char chambers[264][20]