CMS 3D CMS Logo

CondDBCmsTrackerConstruction.cc
Go to the documentation of this file.
9 
10 using namespace cms;
11 
12 std::unique_ptr<GeometricDet> CondDBCmsTrackerConstruction::construct(const PGeometricDet& pgd) {
13  //std::cout << "In CondDBCmsTrackerConstruction::construct with pgd.pgeomdets_.size() == " << pgd.pgeomdets_.size() << std::endl;
14  auto tracker = std::make_unique<GeometricDet>(pgd.pgeomdets_[0], GeometricDet::Tracker);
15 
16  size_t detMax = pgd.pgeomdets_.size();
17  size_t tri = 1;
18  std::vector<GeometricDet*> hier;
19  GeometricDet* subdet = tracker.get();
20  hier.emplace_back(subdet);
21  while (tri < detMax && pgd.pgeomdets_[tri]._level == 1) {
22  subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type));
23  //std::cout << lev << " type " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl;
24  ++tri;
25  hier.back()->addComponent(subdet);
26  hier.emplace_back(subdet);
27  while (tri < detMax && pgd.pgeomdets_[tri]._level == 2) {
28  subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type));
29  //std::cout << lev << "\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl;
30  ++tri;
31  hier.back()->addComponent(subdet);
32  hier.emplace_back(subdet);
33  while (tri < detMax && pgd.pgeomdets_[tri]._level == 3) {
34  subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type));
35  //std::cout << lev << "\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl;
36  ++tri;
37  hier.back()->addComponent(subdet);
38  hier.emplace_back(subdet);
39  while (tri < detMax && pgd.pgeomdets_[tri]._level == 4) {
40  subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type));
41  //std::cout << lev << "\t\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl;
42  ++tri;
43  hier.back()->addComponent(subdet);
44  hier.emplace_back(subdet);
45  while (tri < detMax && pgd.pgeomdets_[tri]._level == 5) {
46  subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type));
47  //std::cout << lev << "\t\t\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl;
48  ++tri;
49  hier.back()->addComponent(subdet);
50  hier.emplace_back(subdet);
51  while (tri < detMax && pgd.pgeomdets_[tri]._level == 6) {
52  subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type));
53  //std::cout << lev << "\t\t\t\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl;
54  ++tri;
55  hier.back()->addComponent(subdet);
56  }
57  hier.pop_back();
58  }
59  hier.pop_back();
60  }
61  hier.pop_back();
62  }
63  hier.pop_back();
64  }
65  hier.pop_back();
66  }
67  // std::cout << "Before \"deep components\" test I want to see if I can iterate to 6 layers by myself..." << std::endl;
68  // std::vector<const GeometricDet*> l0 = tracker->components();
69  // std::vector<const GeometricDet*>::const_iterator i0 = l0.begin();
70  // std::vector<const GeometricDet*>::const_iterator e0 = l0.end();
71  // int count=0; // count only the leaves.
72  // for ( ; i0 != e0 ; ++i0) {
73  // std::cout << lev << " type " << (*i0)->type() << " " << int((*i0)->geographicalId()) << std::endl;
74  // std::vector<const GeometricDet*> l1 = (*i0)->components();
75  // if ( l1.size() == 0 ) ++count;
76  // std::vector<const GeometricDet*>::const_iterator i1 = l1.begin();
77  // std::vector<const GeometricDet*>::const_iterator e1 = l1.end();
78  // ++lev;
79  // for ( ; i1 != e1 ; ++i1) {
80  // std::cout << lev << "\ttype " << (*i1)->type() << " " << int((*i1)->geographicalId()) << std::endl;
81  // std::vector<const GeometricDet*> l2 = (*i1)->components();
82  // if ( l2.size() == 0 ) ++count;
83  // std::vector<const GeometricDet*>::const_iterator i2 = l1.begin();
84  // std::vector<const GeometricDet*>::const_iterator e2 = l1.end();
85  // ++lev;
86  // for ( ; i2 != e2 ; ++i2) {
87  // std::cout << lev << "\t\ttype " << (*i2)->type() << " " << int((*i2)->geographicalId()) << std::endl;
88  // std::vector<const GeometricDet*> l3 = (*i2)->components();
89  // if ( l3.size() == 0 ) ++count;
90  // std::vector<const GeometricDet*>::const_iterator i3 = l3.begin();
91  // std::vector<const GeometricDet*>::const_iterator e3 = l3.end();
92  // ++lev;
93  // for ( ; i3 != e3 ; ++i3) {
94  // std::cout << lev << "\t\t\ttype " << (*i3)->type() << " " << int((*i3)->geographicalId()) << std::endl;
95  // std::vector<const GeometricDet*> l4 = (*i3)->components();
96  // if ( l4.size() == 0 ) ++count;
97  // std::vector<const GeometricDet*>::const_iterator i4 = l4.begin();
98  // std::vector<const GeometricDet*>::const_iterator e4 = l4.end();
99  // ++lev;
100  // for ( ; i4 != e4 ; ++i4) {
101  // std::cout << lev << "\t\t\t\ttype " << (*i4)->type() << " " << int((*i4)->geographicalId()) << std::endl;
102  // std::vector<const GeometricDet*> l5 = (*i4)->components();
103  // if ( l5.size() == 0 ) ++count;
104  // std::vector<const GeometricDet*>::const_iterator i5 = l5.begin();
105  // std::vector<const GeometricDet*>::const_iterator e5 = l5.end();
106  // ++lev;
107  // for ( ; i5 != e5 ; ++i5) {
108  // std::cout << lev << "\t\t\t\t\ttype " << (*i5)->type() << " " << int((*i5)->geographicalId()) << std::endl;
109  // ++count;
110  // // std::vector<const GeometricDet*> l6 = (*i0)->components();
111  // // std::vector<const GeometricDet*>::const_iterator i6 = l6.begin();
112  // // std::vector<const GeometricDet*>::const_iterator e6 = l6.end();
113  // // for ( ; i6 != e6 ; ++i6) {
114  // // std::cout << lev << " type " << (*i6)->type() << " " << int((*i6)->geographicalId()) << std::endl;
115  // // std::vector<const GeometricDet*> l1 = (*i0)->components();
116  // // std::vector<const GeometricDet*>::const_iterator i1 = l1.begin();
117  // // std::vector<const GeometricDet*>::const_iterator e1 = l1.end();
118  // // }
119  // }
120  // --lev;
121  // }
122  // --lev;
123  // }
124  // --lev;
125  // }
126  // --lev;
127  // }
128  // --lev;
129  // }
130  // std::cout << "done... count = " << count << std::endl;
131  // std::cout << "about to try to see what the \"deep components\" are" << std::endl;
132  // std::cout << "done with the \"deep components\" check, there are: " << tracker->deepComponents().size() << std::endl;
133  return tracker;
134 }
std::vector< Item > pgeomdets_
Definition: PGeometricDet.h:50
static std::unique_ptr< GeometricDet > construct(const PGeometricDet &pgd)
Namespace of DDCMS conversion namespace.