00001 #include "CondDBCmsTrackerConstruction.h" 00002 #include "DetectorDescription/Core/interface/DDFilteredView.h" 00003 #include "DetectorDescription/Core/interface/DDCompactView.h" 00004 #include "CondFormats/GeometryObjects/interface/PGeometricDet.h" 00005 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" 00006 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h" 00007 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerBuilder.h" 00008 #include "Geometry/TrackerNumberingBuilder/plugins/CmsTrackerDetIdBuilder.h" 00009 00010 using namespace cms; 00011 00012 CondDBCmsTrackerConstruction::CondDBCmsTrackerConstruction() { } 00013 00014 const GeometricDet* CondDBCmsTrackerConstruction::construct(const PGeometricDet& pgd) { 00015 //std::cout << "In CondDBCmsTrackerConstruction::construct with pgd.pgeomdets_.size() == " << pgd.pgeomdets_.size() << std::endl; 00016 GeometricDet* tracker = new GeometricDet(pgd.pgeomdets_[0],GeometricDet::Tracker); 00017 00018 size_t detMax = pgd.pgeomdets_.size(); 00019 size_t tri = 1; 00020 std::vector<GeometricDet*> hier; 00021 int lev=1; 00022 GeometricDet* subdet = tracker; 00023 hier.push_back(subdet); 00024 while ( tri < detMax && pgd.pgeomdets_[tri]._level == 1 ) { 00025 subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type)); 00026 //std::cout << lev << " type " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl; 00027 ++tri; 00028 hier.back()->addComponent(subdet); 00029 hier.push_back(subdet); 00030 ++lev; 00031 while ( tri < detMax && pgd.pgeomdets_[tri]._level == 2 ) { 00032 subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type)); 00033 //std::cout << lev << "\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl; 00034 ++tri; 00035 hier.back()->addComponent(subdet); 00036 hier.push_back(subdet); 00037 ++lev; 00038 while ( tri < detMax && pgd.pgeomdets_[tri]._level == 3 ) { 00039 subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type)); 00040 //std::cout << lev << "\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl; 00041 ++tri; 00042 hier.back()->addComponent(subdet); 00043 hier.push_back(subdet); 00044 ++lev; 00045 while ( tri < detMax && pgd.pgeomdets_[tri]._level == 4 ) { 00046 subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type)); 00047 //std::cout << lev << "\t\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl; 00048 ++tri; 00049 hier.back()->addComponent(subdet); 00050 hier.push_back(subdet); 00051 ++lev; 00052 while ( tri < detMax && pgd.pgeomdets_[tri]._level == 5 ) { 00053 subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type)); 00054 //std::cout << lev << "\t\t\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl; 00055 ++tri; 00056 hier.back()->addComponent(subdet); 00057 hier.push_back(subdet); 00058 ++lev; 00059 while ( tri < detMax && pgd.pgeomdets_[tri]._level == 6 ) { 00060 subdet = new GeometricDet(pgd.pgeomdets_[tri], GeometricDet::GDEnumType(pgd.pgeomdets_[tri]._type)); 00061 //std::cout << lev << "\t\t\t\t\ttype " << pgd.pgeomdets_[tri]._type << " " << subdet->geographicalId() << std::endl; 00062 ++tri; 00063 hier.back()->addComponent(subdet); 00064 } 00065 --lev; 00066 hier.pop_back(); 00067 } 00068 --lev; 00069 hier.pop_back(); 00070 } 00071 --lev; 00072 hier.pop_back(); 00073 } 00074 --lev; 00075 hier.pop_back(); 00076 } 00077 --lev; 00078 hier.pop_back(); 00079 } 00080 // std::cout << "Before \"deep components\" test I want to see if I can iterate to 6 layers by myself..." << std::endl; 00081 // std::vector<const GeometricDet*> l0 = tracker->components(); 00082 // std::vector<const GeometricDet*>::const_iterator i0 = l0.begin(); 00083 // std::vector<const GeometricDet*>::const_iterator e0 = l0.end(); 00084 // int count=0; // count only the leaves. 00085 // for ( ; i0 != e0 ; ++i0) { 00086 // std::cout << lev << " type " << (*i0)->type() << " " << int((*i0)->geographicalId()) << std::endl; 00087 // std::vector<const GeometricDet*> l1 = (*i0)->components(); 00088 // if ( l1.size() == 0 ) ++count; 00089 // std::vector<const GeometricDet*>::const_iterator i1 = l1.begin(); 00090 // std::vector<const GeometricDet*>::const_iterator e1 = l1.end(); 00091 // ++lev; 00092 // for ( ; i1 != e1 ; ++i1) { 00093 // std::cout << lev << "\ttype " << (*i1)->type() << " " << int((*i1)->geographicalId()) << std::endl; 00094 // std::vector<const GeometricDet*> l2 = (*i1)->components(); 00095 // if ( l2.size() == 0 ) ++count; 00096 // std::vector<const GeometricDet*>::const_iterator i2 = l1.begin(); 00097 // std::vector<const GeometricDet*>::const_iterator e2 = l1.end(); 00098 // ++lev; 00099 // for ( ; i2 != e2 ; ++i2) { 00100 // std::cout << lev << "\t\ttype " << (*i2)->type() << " " << int((*i2)->geographicalId()) << std::endl; 00101 // std::vector<const GeometricDet*> l3 = (*i2)->components(); 00102 // if ( l3.size() == 0 ) ++count; 00103 // std::vector<const GeometricDet*>::const_iterator i3 = l3.begin(); 00104 // std::vector<const GeometricDet*>::const_iterator e3 = l3.end(); 00105 // ++lev; 00106 // for ( ; i3 != e3 ; ++i3) { 00107 // std::cout << lev << "\t\t\ttype " << (*i3)->type() << " " << int((*i3)->geographicalId()) << std::endl; 00108 // std::vector<const GeometricDet*> l4 = (*i3)->components(); 00109 // if ( l4.size() == 0 ) ++count; 00110 // std::vector<const GeometricDet*>::const_iterator i4 = l4.begin(); 00111 // std::vector<const GeometricDet*>::const_iterator e4 = l4.end(); 00112 // ++lev; 00113 // for ( ; i4 != e4 ; ++i4) { 00114 // std::cout << lev << "\t\t\t\ttype " << (*i4)->type() << " " << int((*i4)->geographicalId()) << std::endl; 00115 // std::vector<const GeometricDet*> l5 = (*i4)->components(); 00116 // if ( l5.size() == 0 ) ++count; 00117 // std::vector<const GeometricDet*>::const_iterator i5 = l5.begin(); 00118 // std::vector<const GeometricDet*>::const_iterator e5 = l5.end(); 00119 // ++lev; 00120 // for ( ; i5 != e5 ; ++i5) { 00121 // std::cout << lev << "\t\t\t\t\ttype " << (*i5)->type() << " " << int((*i5)->geographicalId()) << std::endl; 00122 // ++count; 00123 // // std::vector<const GeometricDet*> l6 = (*i0)->components(); 00124 // // std::vector<const GeometricDet*>::const_iterator i6 = l6.begin(); 00125 // // std::vector<const GeometricDet*>::const_iterator e6 = l6.end(); 00126 // // for ( ; i6 != e6 ; ++i6) { 00127 // // std::cout << lev << " type " << (*i6)->type() << " " << int((*i6)->geographicalId()) << std::endl; 00128 // // std::vector<const GeometricDet*> l1 = (*i0)->components(); 00129 // // std::vector<const GeometricDet*>::const_iterator i1 = l1.begin(); 00130 // // std::vector<const GeometricDet*>::const_iterator e1 = l1.end(); 00131 // // } 00132 // } 00133 // --lev; 00134 // } 00135 // --lev; 00136 // } 00137 // --lev; 00138 // } 00139 // --lev; 00140 // } 00141 // --lev; 00142 // } 00143 // std::cout << "done... count = " << count << std::endl; 00144 // std::cout << "about to try to see what the \"deep components\" are" << std::endl; 00145 // std::cout << "done with the \"deep components\" check, there are: " << tracker->deepComponents().size() << std::endl; 00146 return tracker; 00147 } 00148