Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:48:54

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   int lev = 1;
0017   GeometricTimingDet* subdet = mtd.get();
0018   hier.emplace_back(subdet);
0019   while (tri < detMax && pgd.pgeomdets_[tri].level_ == 1) {
0020     subdet = new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0021     ++tri;
0022     hier.back()->addComponent(subdet);
0023     hier.emplace_back(subdet);
0024     ++lev;
0025     while (tri < detMax && pgd.pgeomdets_[tri].level_ == 2) {
0026       subdet = new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0027       ++tri;
0028       hier.back()->addComponent(subdet);
0029       hier.emplace_back(subdet);
0030       ++lev;
0031       while (tri < detMax && pgd.pgeomdets_[tri].level_ == 3) {
0032         subdet =
0033             new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0034         ++tri;
0035         hier.back()->addComponent(subdet);
0036         hier.emplace_back(subdet);
0037         ++lev;
0038         while (tri < detMax && pgd.pgeomdets_[tri].level_ == 4) {
0039           subdet =
0040               new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0041           ++tri;
0042           hier.back()->addComponent(subdet);
0043           hier.emplace_back(subdet);
0044           ++lev;
0045           while (tri < detMax && pgd.pgeomdets_[tri].level_ == 5) {
0046             subdet =
0047                 new GeometricTimingDet(pgd.pgeomdets_[tri], GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0048             ++tri;
0049             hier.back()->addComponent(subdet);
0050             hier.emplace_back(subdet);
0051             ++lev;
0052             while (tri < detMax && pgd.pgeomdets_[tri].level_ == 6) {
0053               subdet = new GeometricTimingDet(pgd.pgeomdets_[tri],
0054                                               GeometricTimingDet::GTDEnumType(pgd.pgeomdets_[tri].type_));
0055               ++tri;
0056               hier.back()->addComponent(subdet);
0057             }
0058             --lev;
0059             hier.pop_back();
0060           }
0061           --lev;
0062           hier.pop_back();
0063         }
0064         --lev;
0065         hier.pop_back();
0066       }
0067       --lev;
0068       hier.pop_back();
0069     }
0070     --lev;
0071     hier.pop_back();
0072   }
0073   return mtd;
0074 }