CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
DDDCmsTrackerContruction Namespace Reference

Functions

std::unique_ptr< GeometricDetconstruct (DDCompactView const &cpv, std::vector< int > const &detidShifts)
 
std::unique_ptr< GeometricDetconstruct (cms::DDCompactView const &cpv, std::vector< int > const &detidShifts)
 
void printAllTrackerGeometricDets (const GeometricDet *tracker)
 

Detailed Description

High level class to build a tracker. It will only build subdets, then call subdet builders

Function Documentation

std::unique_ptr< GeometricDet > DDDCmsTrackerContruction::construct ( DDCompactView const &  cpv,
std::vector< int > const &  detidShifts 
)

Definition at line 18 of file DDDCmsTrackerContruction.cc.

References CmsTrackerLevelBuilder< FilteredView >::build(), CmsTrackerDetIdBuilder::buildId(), DEBUG, Exception, alcazmumu_cfi::filter, DDFilteredView::firstChild(), ExtractStringFromDDD< FilteredView >::getString(), printAllTrackerGeometricDets(), AlCaHLTBitMon_QueryRunRegistry::string, GeometricDet::Tracker, and CmsTrackerStringToEnum::type().

Referenced by TStorageFactoryFile::Initialize(), TrackerGeometricDetESModule::produce(), and TStorageFactoryFile::TStorageFactoryFile().

19  {
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  edm::LogVerbatim("DDDCmsTrackerContruction") << "Assign DetIds";
43  CmsTrackerDetIdBuilder theCmsTrackerDetIdBuilder(detidShifts);
44  theCmsTrackerDetIdBuilder.buildId(*tracker);
45 
46  if (DEBUG) {
47  printAllTrackerGeometricDets(tracker.get());
48  }
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 }
Log< level::Info, true > LogVerbatim
static std::string getString(const std::string &, FilteredView *)
#define DEBUG
void build(FilteredView &, GeometricDet *, const std::string &) override
void printAllTrackerGeometricDets(const GeometricDet *tracker)
GeometricDet::GeometricEnumType type(std::string const &) const
std::unique_ptr< GeometricDet > DDDCmsTrackerContruction::construct ( cms::DDCompactView const &  cpv,
std::vector< int > const &  detidShifts 
)

Definition at line 62 of file DDDCmsTrackerContruction.cc.

References CmsTrackerLevelBuilder< FilteredView >::build(), CmsTrackerDetIdBuilder::buildId(), DEBUG, Exception, cms::DDFilteredView::firstChild(), ExtractStringFromDDD< FilteredView >::getString(), printAllTrackerGeometricDets(), AlCaHLTBitMon_QueryRunRegistry::string, GeometricDet::Tracker, and CmsTrackerStringToEnum::type().

63  {
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  edm::LogVerbatim("DDDCmsTrackerContruction") << "Assign DetIds";
87  CmsTrackerDetIdBuilder theCmsTrackerDetIdBuilder(detidShifts);
88  theCmsTrackerDetIdBuilder.buildId(*tracker);
89 
90  if (DEBUG) {
91  printAllTrackerGeometricDets(tracker.get());
92  }
93 
94  return tracker;
95 }
Log< level::Info, true > LogVerbatim
static std::string getString(const std::string &, FilteredView *)
#define DEBUG
void build(FilteredView &, GeometricDet *, const std::string &) override
void printAllTrackerGeometricDets(const GeometricDet *tracker)
GeometricDet::GeometricEnumType type(std::string const &) const
void DDDCmsTrackerContruction::printAllTrackerGeometricDets ( const GeometricDet tracker)

Definition at line 103 of file DDDCmsTrackerContruction.cc.

References GeometricDet::components(), cms::ddbox, cms::ddtrap, cms::ddtubs, GeometricDet::geographicalId(), GeometricDet::isLowerSensor(), GeometricDet::isUpperSensor(), GeometricDet::name(), submitPVResolutionJobs::out, download_sqlite_cfg::outputFile, GeometricDet::params(), GeometricDet::phi(), GeometricDet::pixROCCols(), GeometricDet::pixROCRows(), GeometricDet::pixROCx(), GeometricDet::pixROCy(), GeometricDet::radLength(), GeometricDet::rho(), GeometricDet::rotation(), GeometricDet::shape(), GeometricDet::shape_dd4hep(), GeometricDet::siliconAPVNum(), GeometricDet::stereo(), GeometricDet::translation(), GeometricDet::type(), and GeometricDet::xi().

Referenced by construct().

103  {
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 }
double pixROCy() const
Definition: GeometricDet.h:137
double radLength() const
Definition: GeometricDet.h:128
bool isUpperSensor() const
Definition: GeometricDet.h:141
LegacySolidShape shape() const
Definition: GeometricDet.h:114
const std::vector< double > & params() const
Definition: GeometricDet.h:118
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:152
const RotationMatrix & rotation() const
Definition: GeometricDet.h:105
const GeometricEnumType & type() const
Definition: GeometricDet.h:93
double pixROCCols() const
Definition: GeometricDet.h:135
const cms::DDSolidShape & shape_dd4hep() const
Definition: GeometricDet.h:116
const DetId & geographicalId() const
Definition: GeometricDet.h:98
double xi() const
Definition: GeometricDet.h:129
double pixROCx() const
Definition: GeometricDet.h:136
double phi() const
Definition: GeometricDet.h:104
const Translation & translation() const
Definition: GeometricDet.h:102
const std::string & name() const
Definition: GeometricDet.h:92
double siliconAPVNum() const
Definition: GeometricDet.h:142
bool stereo() const
Definition: GeometricDet.h:139
double pixROCRows() const
Definition: GeometricDet.h:134
bool isLowerSensor() const
Definition: GeometricDet.h:140
double rho() const
Definition: GeometricDet.h:103