Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:50:00

0001 #include "CondDBCmsMTDConstruction.h"
0002 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0003 #include "DetectorDescription/Core/interface/DDCompactView.h"
0004 #include "CondFormats/GeometryObjects/interface/PGeometricTimingDet.h"
0005 #include "Geometry/MTDNumberingBuilder/interface/GeometricTimingDet.h"
0006 #include "Geometry/MTDNumberingBuilder/plugins/ExtractStringFromDD.h"
0007 
0008 using namespace cms;
0009 
0010 std::unique_ptr<GeometricTimingDet> CondDBCmsMTDConstruction::construct(const PGeometricTimingDet& pgd) {
0011   auto mtd = std::make_unique<GeometricTimingDet>(pgd.pgeomdets_[0], GeometricTimingDet::MTD);
0012 
0013   size_t detMax = pgd.pgeomdets_.size();
0014   size_t tri = 1;
0015   std::vector<GeometricTimingDet*> hier;
0016   GeometricTimingDet* subdet = mtd.get();
0017   hier.emplace_back(subdet);
0018   while (tri < detMax && pgd.pgeomdets_[tri].level_ == 1) {
0019     subdet = new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0020     ++tri;
0021     hier.back()->addComponent(subdet);
0022     hier.emplace_back(subdet);
0023     while (tri < detMax && pgd.pgeomdets_[tri].level_ == 2) {
0024       subdet = new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0025       ++tri;
0026       hier.back()->addComponent(subdet);
0027       hier.emplace_back(subdet);
0028       while (tri < detMax && pgd.pgeomdets_[tri].level_ == 3) {
0029         subdet =
0030             new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0031         ++tri;
0032         hier.back()->addComponent(subdet);
0033         hier.emplace_back(subdet);
0034         while (tri < detMax && pgd.pgeomdets_[tri].level_ == 4) {
0035           subdet =
0036               new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0037           ++tri;
0038           hier.back()->addComponent(subdet);
0039           hier.emplace_back(subdet);
0040           while (tri < detMax && pgd.pgeomdets_[tri].level_ == 5) {
0041             subdet =
0042                 new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0043             ++tri;
0044             hier.back()->addComponent(subdet);
0045             hier.emplace_back(subdet);
0046             while (tri < detMax && pgd.pgeomdets_[tri].level_ == 6) {
0047               subdet = new GeometricTimingDet(pgd.pgeomdets_[tri],
0048                                               GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0049               ++tri;
0050               hier.back()->addComponent(subdet);
0051             }
0052             hier.pop_back();
0053           }
0054           hier.pop_back();
0055         }
0056         hier.pop_back();
0057       }
0058       hier.pop_back();
0059     }
0060     hier.pop_back();
0061   }
0062   return mtd;
0063 }