CMS 3D CMS Logo

DDDCmsTrackerContruction.cc
Go to the documentation of this file.
2 
3 #include <deque>
4 #include <fstream>
5 #include <utility>
15 
16 #define DEBUG false
17 
18 std::unique_ptr<GeometricDet> DDDCmsTrackerContruction::construct(const DDCompactView& cpv,
19  std::vector<int> const& detidShifts) {
20  std::string attribute = "TkDDDStructure";
22 
23  DDFilteredView fv(cpv, filter);
24 
25  CmsTrackerStringToEnum theCmsTrackerStringToEnum;
26  if (theCmsTrackerStringToEnum.type(ExtractStringFromDDD<DDFilteredView>::getString(attribute, &fv)) !=
28  fv.firstChild();
29  if (theCmsTrackerStringToEnum.type(ExtractStringFromDDD<DDFilteredView>::getString(attribute, &fv)) !=
31  throw cms::Exception("Configuration") << " The first child of the DDFilteredView is not what is expected \n"
32  << ExtractStringFromDDD<DDFilteredView>::getString(attribute, &fv) << "\n";
33  }
34  }
35 
36  auto tracker = std::make_unique<GeometricDet>(&fv, GeometricDet::Tracker);
37 
38  edm::LogVerbatim("DDDCmsTrackerContruction") << "DDDCmsTrackerContruction::construct: Call Tracker builder.";
39  CmsTrackerBuilder<DDFilteredView> theCmsTrackerBuilder;
40  theCmsTrackerBuilder.build(fv, tracker.get(), attribute);
41 
42  if (DEBUG) {
44  }
45 
46  edm::LogVerbatim("DDDCmsTrackerContruction") << "Assign DetIds";
47  CmsTrackerDetIdBuilder theCmsTrackerDetIdBuilder(detidShifts);
48  theCmsTrackerDetIdBuilder.buildId(*tracker);
49 
50  fv.parent();
51  //
52  // set the Tracker
53  //
54  //TrackerMapDDDtoID::instance().setTracker(tracker);
55  //NOTE: If it is decided that the TrackerMapDDDtoID should be
56  // constructed here, then we should return from this
57  // function so that the EventSetup can manage it
58 
59  return tracker;
60 }
61 
62 std::unique_ptr<GeometricDet> DDDCmsTrackerContruction::construct(const cms::DDCompactView& cpv,
63  std::vector<int> const& detidShifts) {
64  std::string attribute("TkDDDStructure");
65  cms::DDFilteredView fv(cpv, cms::DDFilter(attribute));
66  fv.firstChild();
67 
68  CmsTrackerStringToEnum theCmsTrackerStringToEnum;
69  if (theCmsTrackerStringToEnum.type(ExtractStringFromDDD<cms::DDFilteredView>::getString("TkDDDStructure", &fv)) !=
71  fv.firstChild();
72  if (theCmsTrackerStringToEnum.type(ExtractStringFromDDD<cms::DDFilteredView>::getString(attribute, &fv)) !=
74  throw cms::Exception("Configuration")
75  << " The first child of the DDFilteredView is not what is expected \n"
77  }
78  }
79 
80  auto tracker = std::make_unique<GeometricDet>(&fv, GeometricDet::Tracker);
81 
82  edm::LogVerbatim("DDDCmsTrackerContruction") << "DDDCmsTrackerContruction::construct: Call Tracker builder.";
83  CmsTrackerBuilder<cms::DDFilteredView> theCmsTrackerBuilder;
84  theCmsTrackerBuilder.build(fv, tracker.get(), attribute);
85 
86  if (DEBUG) {
88  }
89 
90  edm::LogVerbatim("DDDCmsTrackerContruction") << "Assign DetIds";
91  CmsTrackerDetIdBuilder theCmsTrackerDetIdBuilder(detidShifts);
92  theCmsTrackerDetIdBuilder.buildId(*tracker);
93 
94  return tracker;
95 }
96 
97 /*
98  * Print all Tracker GeometricDets, before DetIds building process.
99  * The tree is already fully constructed from XMLs,
100  * and all GeometricDets are sorted according to their geometric position.
101  * This allows a convenient debugging, as the DetIds will be later assigned according to this information.
102  */
104  std::ofstream outputFile("All_Tracker_GeometricDets_before_DetId_building.log", std::ios::out);
105 
106  // Tree navigation: queue for BFS (we want to see same hierarchy level together).
107  // (for DFS, would just use a stack instead).
108  std::deque<const GeometricDet*> queue;
109  queue.emplace_back(tracker);
110 
111  while (!queue.empty()) {
112  const GeometricDet* myDet = queue.front();
113  queue.pop_front();
114 
115  for (auto& child : myDet->components()) {
116  queue.emplace_back(child);
117  }
118 
119  outputFile << " " << std::endl;
120  outputFile << " " << std::endl;
121  outputFile << "............................." << std::endl;
122  outputFile << "myDet->geographicalID() = " << myDet->geographicalId() << std::endl;
123  outputFile << "myDet->name() = " << myDet->name() << std::endl;
124  outputFile << "myDet->module->type() = " << std::fixed << std::setprecision(7) << myDet->type() << std::endl;
125  outputFile << "myDet->module->translation() = " << std::fixed << std::setprecision(7) << myDet->translation()
126  << std::endl;
127  outputFile << "myDet->module->rho() = " << std::fixed << std::setprecision(7) << myDet->rho() << std::endl;
128  if (fabs(myDet->rho()) > 0.00001) {
129  outputFile << "myDet->module->phi() = " << std::fixed << std::setprecision(7) << myDet->phi() << std::endl;
130  }
131  outputFile << "myDet->module->rotation() = " << std::fixed << std::setprecision(7) << myDet->rotation()
132  << std::endl;
133  outputFile << "myDet->module->shape() = " << std::fixed << std::setprecision(7) << myDet->shape() << std::endl;
136  outputFile << "myDet->params() = " << std::fixed << std::setprecision(7);
137  for (const auto& para : myDet->params()) {
138  outputFile << para << " ";
139  }
140  outputFile << " " << std::endl;
141  }
142  outputFile << "myDet->radLength() = " << myDet->radLength() << std::endl;
143  outputFile << "myDet->xi() = " << myDet->xi() << std::endl;
144  outputFile << "myDet->pixROCRows() = " << myDet->pixROCRows() << std::endl;
145  outputFile << "myDet->pixROCCols() = " << myDet->pixROCCols() << std::endl;
146  outputFile << "myDet->pixROCx() = " << myDet->pixROCx() << std::endl;
147  outputFile << "myDet->pixROCy() = " << myDet->pixROCy() << std::endl;
148  outputFile << "myDet->stereo() = " << myDet->stereo() << std::endl;
149  outputFile << "myDet->isLowerSensor() = " << myDet->isLowerSensor() << std::endl;
150  outputFile << "myDet->isUpperSensor() = " << myDet->isUpperSensor() << std::endl;
151  outputFile << "myDet->siliconAPVNum() = " << myDet->siliconAPVNum() << std::endl;
152  }
153 }
CmsTrackerDetIdBuilder.h
GeometricDet::phi
double phi() const
Definition: GeometricDet.h:102
ExtractStringFromDDD::getString
static std::string getString(const std::string &, FilteredView *)
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
CmsTrackerStringToEnum::type
GeometricDet::GeometricEnumType type(std::string const &) const
Definition: CmsTrackerStringToEnum.cc:122
MessageLogger.h
GeometricDet::isLowerSensor
bool isLowerSensor() const
Definition: GeometricDet.h:137
cms::DDSolidShape::ddtubs
GeometricDet::components
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:149
DEBUG
#define DEBUG
Definition: DDDCmsTrackerContruction.cc:16
CmsTrackerBuilder
Definition: CmsTrackerBuilder.h:14
CmsTrackerStringToEnum
Definition: CmsTrackerStringToEnum.h:10
GeometricDet::translation
const Translation & translation() const
Definition: GeometricDet.h:100
cms::DDFilteredView
Definition: DDFilteredView.h:70
DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:161
DDCompactView.h
ExtractStringFromDDD
Definition: ExtractStringFromDDD.h:12
GeometricDet::shape
LegacySolidShape shape() const
Definition: GeometricDet.h:112
GeometricDet::Tracker
Definition: GeometricDet.h:50
download_sqlite_cfg.outputFile
outputFile
Definition: download_sqlite_cfg.py:5
GeometricDet::name
const std::string & name() const
Definition: GeometricDet.h:90
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
DDFilteredView.h
cms::DDFilter
Definition: DDFilteredView.h:59
GeometricDet::params
const std::vector< double > & params() const
Definition: GeometricDet.h:116
GeometricDet::shape_dd4hep
const cms::DDSolidShape & shape_dd4hep() const
Definition: GeometricDet.h:114
GeometricDet::rotation
const RotationMatrix & rotation() const
Definition: GeometricDet.h:103
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
cms::DDFilteredView::firstChild
bool firstChild()
set the current node to the first child
Definition: DDFilteredView.cc:268
GeometricDet
Definition: GeometricDet.h:31
DDFilteredView.h
DDCompactView.h
DDDCmsTrackerContruction::printAllTrackerGeometricDetsBeforeDetIDBuilding
void printAllTrackerGeometricDetsBeforeDetIDBuilding(const GeometricDet *tracker)
Definition: DDDCmsTrackerContruction.cc:103
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
GeometricDet::radLength
double radLength() const
Definition: GeometricDet.h:126
createBeamHaloJobs.queue
queue
Definition: createBeamHaloJobs.py:343
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
GeometricDet::stereo
bool stereo() const
Definition: GeometricDet.h:136
GeometricDet::geographicalId
const DetId & geographicalId() const
Definition: GeometricDet.h:96
CmsTrackerLevelBuilder::build
void build(FilteredView &, GeometricDet *, const std::string &) override
GeometricDet::pixROCRows
double pixROCRows() const
Definition: GeometricDet.h:131
cms::DDSolidShape::ddtrap
cms::DDSolidShape::ddbox
DDSpecificsHasNamedValueFilter
Definition: DDFilter.h:60
GeometricDet::pixROCx
double pixROCx() const
Definition: GeometricDet.h:133
GeometricDet.h
GeometricDet::rho
double rho() const
Definition: GeometricDet.h:101
CmsTrackerDetIdBuilder
Definition: CmsTrackerDetIdBuilder.h:15
ExtractStringFromDDD.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:246
GeometricDet::siliconAPVNum
double siliconAPVNum() const
Definition: GeometricDet.h:139
cms::DDCompactView
Definition: DDCompactView.h:31
GeometricDet::pixROCCols
double pixROCCols() const
Definition: GeometricDet.h:132
CmsTrackerBuilder.h
GeometricDet::xi
double xi() const
Definition: GeometricDet.h:127
GeometricDet::pixROCy
double pixROCy() const
Definition: GeometricDet.h:134
CmsTrackerDetIdBuilder::buildId
void buildId(GeometricDet &det)
Definition: CmsTrackerDetIdBuilder.cc:24
DDFilteredView
Definition: DDFilteredView.h:20
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
GeometricDet::type
const GeometricEnumType & type() const
Definition: GeometricDet.h:91
DDDCmsTrackerContruction::construct
std::unique_ptr< GeometricDet > construct(DDCompactView const &cpv, std::vector< int > const &detidShifts)
Definition: DDDCmsTrackerContruction.cc:18
child
Definition: simpleInheritance.h:11
DDDCmsTrackerContruction.h
GeometricDet::isUpperSensor
bool isUpperSensor() const
Definition: GeometricDet.h:138