CMS 3D CMS Logo

CmsMTDConstruction.cc
Go to the documentation of this file.
4 
7 
9  GeometricTimingDet *mother,
10  std::string attribute){
11 
12  //
13  // at this level I check whether it is a merged detector or not
14  //
15 
17 
18  const std::string part_name = fv.logicalPart().name().fullname().substr(0,11);
19 
21  bool dodets = fv.firstChild();
22  while (dodets) {
23  buildBTLModule(fv,det,attribute);
24  dodets = fv.nextSibling();
25  }
26  fv.parent();
27  } else if ( theCmsMTDStringToEnum.type(part_name) == GeometricTimingDet::ETLModule ) {
28  bool dodets = fv.firstChild();
29  while (dodets) {
30  buildETLModule(fv,det,attribute);
31  dodets = fv.nextSibling();
32  }
33  fv.parent();
34  } else {
35  throw cms::Exception("MTDConstruction") << "woops got: " << part_name << std::endl;
36  }
37 
38  mother->addComponent(det);
39 }
40 
42  GeometricTimingDet *mother,
43  const std::string& attribute){
44 
46 
47  const auto& copyNumbers = fv.copyNumbers();
48  auto module_number = copyNumbers[copyNumbers.size()-2];
49 
50  constexpr char positive[] = "PositiveZ";
51  constexpr char negative[] = "NegativeZ";
52 
53  const std::string modname = fv.logicalPart().name().fullname();
54  size_t delim1 = modname.find("BModule");
55  size_t delim2 = modname.find("Layer");
56  module_number += atoi(modname.substr(delim1+7,delim2).c_str())-1;
57 
58  if( modname.find(positive) != std::string::npos ) {
59  det->setGeographicalID(BTLDetId(1,copyNumbers[copyNumbers.size()-3],module_number,0,1));
60  } else if ( modname.find(negative) != std::string::npos ) {
61  det->setGeographicalID(BTLDetId(0,copyNumbers[copyNumbers.size()-3],module_number,0,1));
62  } else {
63  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
64  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
65  }
66 
67  mother->addComponent(det);
68 }
69 
71  GeometricTimingDet *mother,
72  const std::string& attribute){
73 
75 
76  const auto& copyNumbers = fv.copyNumbers();
77  auto module_number = copyNumbers[copyNumbers.size()-2];
78 
79  size_t delim_ring = det->name().fullname().find("EModule");
80  size_t delim_disc = det->name().fullname().find("Disc");
81 
82  std::string ringN = det->name().fullname().substr(delim_ring+7,delim_disc);
83 
84  const uint32_t side = det->translation().z() > 0 ? 1 : 0;
85 
86  // label geographic detid is front or back (even though it is one module per entry here)
87  det->setGeographicalID(ETLDetId(side,atoi(ringN.c_str()),module_number,0));
88 
89  mother->addComponent(det);
90 }
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
bool parent()
set the current node to the parent node ...
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:74
nav_type copyNumbers() const
return the stack of copy numbers
bool nextSibling()
set the current node to the next sibling ...
CmsMTDStringToEnum theCmsMTDStringToEnum
static std::string getString(std::string const &, DDFilteredView *)
void buildETLModule(DDFilteredView &, GeometricTimingDet *, const std::string &)
DDTranslation const & translation() const
void buildBTLModule(DDFilteredView &, GeometricTimingDet *, const std::string &)
void addComponent(GeometricTimingDet *)
const std::string fullname() const
Definition: DDName.h:43
void setGeographicalID(DetId id)
DDName const & name() const
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
bool firstChild()
set the current node to the first child ...
#define constexpr
void buildComponent(DDFilteredView &, GeometricTimingDet *, std::string) override