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