CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
CmsMTDConstruction< FilteredView > Class Template Reference

#include <CmsMTDConstruction.h>

Public Member Functions

void baseNumberFromHistory (const DDGeoHistory &gh)
 
void buildBTLModule (FilteredView &, GeometricTimingDet *)
 
template<>
void buildBTLModule (DDFilteredView &fv, GeometricTimingDet *mother)
 
template<>
void buildBTLModule (cms::DDFilteredView &fv, GeometricTimingDet *mother)
 
void buildETLModule (FilteredView &, GeometricTimingDet *)
 
template<>
void buildETLModule (DDFilteredView &fv, GeometricTimingDet *mother)
 
template<>
void buildETLModule (cms::DDFilteredView &fv, GeometricTimingDet *mother)
 
GeometricTimingDetbuildLayer (FilteredView &)
 
GeometricTimingDetbuildSubdet (FilteredView &)
 
 CmsMTDConstruction ()
 
bool isBTLV2 (FilteredView &)
 
 ~CmsMTDConstruction ()=default
 

Static Public Member Functions

static bool btlOrderPhi (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool btlOrderZ (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool mtdOrderPhi (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool mtdOrderRR (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool mtdOrderZ (const GeometricTimingDet *a, const GeometricTimingDet *b)
 

Protected Attributes

MTDBaseNumber baseNumber_
 
BTLNumberingScheme btlScheme_
 
ETLNumberingScheme etlScheme_
 
CmsMTDStringToEnum theCmsMTDStringToEnum
 

Detailed Description

template<class FilteredView>
class CmsMTDConstruction< FilteredView >

Adds GeometricTimingDets representing final modules to the previous level

Definition at line 14 of file CmsMTDConstruction.h.

Constructor & Destructor Documentation

◆ CmsMTDConstruction()

template<class FilteredView >
CmsMTDConstruction< FilteredView >::CmsMTDConstruction ( )

Definition at line 17 of file CmsMTDConstruction.cc.

BTLNumberingScheme btlScheme_
ETLNumberingScheme etlScheme_
MTDBaseNumber baseNumber_

◆ ~CmsMTDConstruction()

template<class FilteredView>
CmsMTDConstruction< FilteredView >::~CmsMTDConstruction ( )
default

Member Function Documentation

◆ baseNumberFromHistory()

template<class FilteredView>
void CmsMTDConstruction< FilteredView >::baseNumberFromHistory ( const DDGeoHistory gh)

◆ btlOrderPhi()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::btlOrderPhi ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 41 of file CmsMTDConstruction.cc.

References a, b, angle_units::operators::convertRadToDeg(), and angle0to2pi::make0To2pi().

41  {
42  return static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(a->phi()))) <
43  static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(b->phi())));
44 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
double b
Definition: hdecay.h:120
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
double a
Definition: hdecay.h:121

◆ btlOrderZ()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::btlOrderZ ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 47 of file CmsMTDConstruction.cc.

References a, b, angle_units::operators::convertRadToDeg(), angle0to2pi::make0To2pi(), and eventshapeDQM_cfi::order.

47  {
48  bool order = (static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(a->phi()))) ==
49  static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(b->phi())))) &&
50  (a->translation().z() < b->translation().z());
51  return order;
52 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
double b
Definition: hdecay.h:120
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
double a
Definition: hdecay.h:121

◆ buildBTLModule() [1/3]

template<class FilteredView>
void CmsMTDConstruction< FilteredView >::buildBTLModule ( FilteredView &  ,
GeometricTimingDet  
)

◆ buildBTLModule() [2/3]

template<>
void CmsMTDConstruction< DDFilteredView >::buildBTLModule ( DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 55 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), DDFilteredView::copyNumbers(), Exception, DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, Skims_PA_cff::name, DDFilteredView::name(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

55  {
56  std::string nodeName(fv.name());
57  GeometricTimingDet* det =
59 
60  if (isBTLV2(fv)) {
61  auto& gh = fv.geoHistory();
62 
64  baseNumber_.setSize(gh.size());
65 
66  for (uint i = gh.size(); i-- > 0;) {
67  baseNumber_.addLevel(gh[i].logicalPart().name().name(), gh[i].copyno());
68 #ifdef EDM_ML_DEBUG
69  edm::LogVerbatim("CmsMTDConstruction") << gh[i].logicalPart().name().name() << " " << gh[i].copyno();
70 #endif
71  }
72 
73  det->setGeographicalID(BTLDetId(btlScheme_.getUnitID(baseNumber_)));
74 
75  } else {
76  const auto& copyNumbers = fv.copyNumbers();
77  auto module_number = copyNumbers[copyNumbers.size() - 2];
78 
79  constexpr char positive[] = "PositiveZ";
80  constexpr char negative[] = "NegativeZ";
81 
82  const std::string& modname(fv.name());
83  size_t delim1 = modname.find("BModule");
84  size_t delim2 = modname.find("Layer");
85  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
86 
87 #ifdef EDM_ML_DEBUG
88  edm::LogVerbatim("CmsMTDConstruction")
89  << "BTLModule = " << modname << " " << copyNumbers[copyNumbers.size() - 3] << " " << module_number;
90 #endif
91 
92  if (modname.find(positive) != std::string::npos) {
93  det->setGeographicalID(BTLDetId(1, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
94  } else if (modname.find(negative) != std::string::npos) {
95  det->setGeographicalID(BTLDetId(0, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
96  } else {
97  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
98  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
99  }
100  }
101 
102  mother->addComponent(det);
103 }
Log< level::Info, true > LogVerbatim
bool isBTLV2(FilteredView &)
nav_type copyNumbers() const
return the stack of copy numbers
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::string & name() const
The name of a logical-part of the current node in the filtered-view.
static constexpr size_t kModStrLen
BTLNumberingScheme btlScheme_
void addComponent(GeometricTimingDet *)
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildBTLModule() [3/3]

template<>
void CmsMTDConstruction< cms::DDFilteredView >::buildBTLModule ( cms::DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 106 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), cms::DDFilteredView::copyNos(), cms::DDFilteredView::copyNumbers(), Exception, cms::DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, Skims_PA_cff::name, cms::DDFilteredView::name(), cms::DDFilteredView::path(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

106  {
107  std::string nodeName(fv.name());
108  GeometricTimingDet* det =
110 
111  if (isBTLV2(fv)) {
112  baseNumber_.reset();
113  baseNumber_.setSize(fv.copyNos().size());
114 
115  for (uint i = 0; i < fv.copyNos().size(); i++) {
116  std::string_view name((fv.geoHistory()[i])->GetName());
117  size_t ipos = name.rfind('_');
118  baseNumber_.addLevel(name.substr(0, ipos), fv.copyNos()[i]);
119 #ifdef EDM_ML_DEBUG
120  edm::LogVerbatim("CmsMTDConstruction") << name.substr(0, ipos) << " " << fv.copyNos()[i];
121 #endif
122  }
123 
124  det->setGeographicalID(BTLDetId(btlScheme_.getUnitID(baseNumber_)));
125 
126  } else {
127  const auto& copyNumbers = fv.copyNumbers();
128  auto module_number = copyNumbers[1];
129 
130  constexpr char positive[] = "PositiveZ";
131  constexpr char negative[] = "NegativeZ";
132 
133  const std::string modname(fv.name());
134  size_t delim1 = modname.find("BModule");
135  size_t delim2 = modname.find("Layer");
136  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
137 
138 #ifdef EDM_ML_DEBUG
139  edm::LogVerbatim("MTDNumbering") << fv.path() << "\nBTLModule = " << modname << " " << copyNumbers[2] << " "
140  << module_number;
141 #endif
142 
143  if (modname.find(positive) != std::string::npos) {
144  det->setGeographicalID(BTLDetId(1, copyNumbers[2], module_number, 0, 1));
145  } else if (modname.find(negative) != std::string::npos) {
146  det->setGeographicalID(BTLDetId(0, copyNumbers[2], module_number, 0, 1));
147  } else {
148  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
149  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
150  }
151  }
152 
153  mother->addComponent(det);
154 }
Log< level::Info, true > LogVerbatim
bool isBTLV2(FilteredView &)
const std::vector< int > copyNos() const
The list of the volume copy numbers.
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
const std::string path() const
The full path to the current node.
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::vector< const Node * > geoHistory() const
static constexpr size_t kModStrLen
std::string_view name() const
BTLNumberingScheme btlScheme_
void addComponent(GeometricTimingDet *)
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
auto copyNumbers(Ts &&... ts) const -> decltype(copyNos(std::forward< Ts >(ts)...))
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildETLModule() [1/3]

template<class FilteredView>
void CmsMTDConstruction< FilteredView >::buildETLModule ( FilteredView &  ,
GeometricTimingDet  
)

◆ buildETLModule() [2/3]

template<>
void CmsMTDConstruction< DDFilteredView >::buildETLModule ( DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 157 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, Skims_PA_cff::name, DDFilteredView::name(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

157  {
158  std::string nodeName(fv.name());
159  GeometricTimingDet* det =
161 
162  auto& gh = fv.geoHistory();
163 
164  baseNumber_.reset();
165  baseNumber_.setSize(gh.size());
166 
167  for (uint i = gh.size(); i-- > 0;) {
168  baseNumber_.addLevel(gh[i].logicalPart().name().name(), gh[i].copyno());
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("CmsMTDConstruction") << gh[i].logicalPart().name().name() << " " << gh[i].copyno();
171 #endif
172  }
173 
174  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
175 
176  mother->addComponent(det);
177 }
Log< level::Info, true > LogVerbatim
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::string & name() const
The name of a logical-part of the current node in the filtered-view.
static constexpr size_t kModStrLen
void addComponent(GeometricTimingDet *)
ETLNumberingScheme etlScheme_
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildETLModule() [3/3]

template<>
void CmsMTDConstruction< cms::DDFilteredView >::buildETLModule ( cms::DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 180 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), cms::DDFilteredView::copyNos(), cms::DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, Skims_PA_cff::name, cms::DDFilteredView::name(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

180  {
181  std::string nodeName(fv.name());
182  GeometricTimingDet* det =
184 
185  baseNumber_.reset();
186  baseNumber_.setSize(fv.copyNos().size());
187 
188  for (uint i = 0; i < fv.copyNos().size(); i++) {
189  std::string_view name((fv.geoHistory()[i])->GetName());
190  size_t ipos = name.rfind('_');
191  baseNumber_.addLevel(name.substr(0, ipos), fv.copyNos()[i]);
192 #ifdef EDM_ML_DEBUG
193  edm::LogVerbatim("CmsMTDConstruction") << name.substr(0, ipos) << " " << fv.copyNos()[i];
194 #endif
195  }
196 
197  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
198 
199  mother->addComponent(det);
200 }
Log< level::Info, true > LogVerbatim
const std::vector< int > copyNos() const
The list of the volume copy numbers.
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::vector< const Node * > geoHistory() const
static constexpr size_t kModStrLen
std::string_view name() const
void addComponent(GeometricTimingDet *)
ETLNumberingScheme etlScheme_
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildLayer()

template<class FilteredView >
GeometricTimingDet * CmsMTDConstruction< FilteredView >::buildLayer ( FilteredView &  fv)

Definition at line 221 of file CmsMTDConstruction.cc.

References Exception, nano_mu_digi_cff::layer, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDCmsMTDConstruction::construct().

221  {
222  std::string nodeName(fv.name());
223  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
224  GeometricTimingDet* layer = new GeometricTimingDet(&fv, thisDet);
225 
226  if (thisDet != GeometricTimingDet::BTLLayer && thisDet != GeometricTimingDet::ETLDisc) {
227  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
228  }
229 
230  uint32_t nLayer;
231  if (thisDet == GeometricTimingDet::BTLLayer) {
232  //
233  // only one layer in BTL
234  //
235  nLayer = 1;
236  layer->setGeographicalID(nLayer);
237  } else if (thisDet == GeometricTimingDet::ETLDisc) {
238  //
239  // no change for pre TDR scenarios, otherwise identifiy layer with disc
240  //
241  nLayer = (fv.name().find("Disc1") != std::string::npos) ? 1 : 2;
242  layer->setGeographicalID(nLayer);
243  }
244 
245  return layer;
246 }
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum

◆ buildSubdet()

template<class FilteredView >
GeometricTimingDet * CmsMTDConstruction< FilteredView >::buildSubdet ( FilteredView &  fv)

Definition at line 203 of file CmsMTDConstruction.cc.

References Exception, GeometricTimingDet::setGeographicalID(), AlCaHLTBitMon_QueryRunRegistry::string, and GeometricTimingDet::translation().

Referenced by DDCmsMTDConstruction::construct().

203  {
204  std::string nodeName(fv.name());
205  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
206  GeometricTimingDet* subdet = new GeometricTimingDet(&fv, thisDet);
207 
208  if (thisDet == GeometricTimingDet::BTL) {
209  subdet->setGeographicalID(BTLDetId(0, 0, 0, 0, 0));
210  } else if (thisDet == GeometricTimingDet::ETL) {
211  const uint32_t side = subdet->translation().z() > 0 ? 1 : 0;
212  subdet->setGeographicalID(ETLDetId(side, 0, 0, 0));
213  } else {
214  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
215  }
216 
217  return subdet;
218 }
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void setGeographicalID(DetId id)
Translation const & translation() 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:19

◆ isBTLV2()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::isBTLV2 ( FilteredView &  fv)

Definition at line 249 of file CmsMTDConstruction.cc.

Referenced by DDCmsMTDConstruction::construct().

249  {
250  return (fv.name().substr(0, 9) == "BTLModule");
251 }

◆ mtdOrderPhi()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderPhi ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 34 of file CmsMTDConstruction.cc.

References a, b, globals_cff::id1, globals_cff::id2, and angle0to2pi::make0To2pi().

34  {
35  MTDDetId id1(a->geographicalId());
36  MTDDetId id2(b->geographicalId());
37  return (id1.mtdRR() == id2.mtdRR()) && (angle0to2pi::make0To2pi(a->phi()) < angle0to2pi::make0To2pi(b->phi()));
38 }
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
double b
Definition: hdecay.h:120
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
double a
Definition: hdecay.h:121

◆ mtdOrderRR()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderRR ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 27 of file CmsMTDConstruction.cc.

References a, b, globals_cff::id1, and globals_cff::id2.

27  {
28  MTDDetId id1(a->geographicalId());
29  MTDDetId id2(b->geographicalId());
30  return id1.mtdRR() < id2.mtdRR();
31 }
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ mtdOrderZ()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderZ ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 20 of file CmsMTDConstruction.cc.

References a, b, and eventshapeDQM_cfi::order.

20  {
21  bool order = (a->translation().z() == b->translation().z()) ? a->translation().rho() < b->translation().rho()
22  : a->translation().z() < b->translation().z();
23  return order;
24 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

Member Data Documentation

◆ baseNumber_

template<class FilteredView>
MTDBaseNumber CmsMTDConstruction< FilteredView >::baseNumber_
protected

Definition at line 40 of file CmsMTDConstruction.h.

◆ btlScheme_

template<class FilteredView>
BTLNumberingScheme CmsMTDConstruction< FilteredView >::btlScheme_
protected

Definition at line 38 of file CmsMTDConstruction.h.

◆ etlScheme_

template<class FilteredView>
ETLNumberingScheme CmsMTDConstruction< FilteredView >::etlScheme_
protected

Definition at line 39 of file CmsMTDConstruction.h.

◆ theCmsMTDStringToEnum

template<class FilteredView>
CmsMTDStringToEnum CmsMTDConstruction< FilteredView >::theCmsMTDStringToEnum
protected

Definition at line 36 of file CmsMTDConstruction.h.