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)
 
template<>
void buildBTLModule (cms::DDFilteredView &fv, GeometricTimingDet *mother)
 
template<>
void buildBTLModule (DDFilteredView &fv, GeometricTimingDet *mother)
 
void buildBTLModule (FilteredView &, GeometricTimingDet *)
 
template<>
void buildETLModule (cms::DDFilteredView &fv, GeometricTimingDet *mother)
 
template<>
void buildETLModule (DDFilteredView &fv, GeometricTimingDet *mother)
 
void buildETLModule (FilteredView &, GeometricTimingDet *)
 
GeometricTimingDetbuildLayer (FilteredView &)
 
GeometricTimingDetbuildSubdet (FilteredView &)
 
 CmsMTDConstruction ()
 
bool isETLtdr (FilteredView &)
 
 ~CmsMTDConstruction ()=default
 

Static Public Member Functions

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_
 
ETLNumberingScheme etlScheme_
 
CmsMTDStringToEnum theCmsMTDStringToEnum
 

Detailed Description

template<class FilteredView>
class CmsMTDConstruction< FilteredView >

Adds GeometricTimingDets representing final modules to the previous level

Definition at line 13 of file CmsMTDConstruction.h.

Constructor & Destructor Documentation

◆ CmsMTDConstruction()

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

Definition at line 15 of file CmsMTDConstruction.cc.

15 : etlScheme_(), baseNumber_() {}

◆ ~CmsMTDConstruction()

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

Member Function Documentation

◆ baseNumberFromHistory()

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

◆ buildBTLModule() [1/3]

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

Definition at line 73 of file CmsMTDConstruction.cc.

73  {
74  std::string nodeName(fv.name());
75  GeometricTimingDet* det =
77 
78  const auto& copyNumbers = fv.copyNumbers();
79  auto module_number = copyNumbers[1];
80 
81  constexpr char positive[] = "PositiveZ";
82  constexpr char negative[] = "NegativeZ";
83 
84  const std::string modname(fv.name());
85  size_t delim1 = modname.find("BModule");
86  size_t delim2 = modname.find("Layer");
87  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
88 
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("MTDNumbering") << fv.path() << "\nBTLModule = " << modname << " " << copyNumbers[2] << " "
91  << module_number;
92 #endif
93 
94  if (modname.find(positive) != std::string::npos) {
95  det->setGeographicalID(BTLDetId(1, copyNumbers[2], module_number, 0, 1));
96  } else if (modname.find(negative) != std::string::npos) {
97  det->setGeographicalID(BTLDetId(0, copyNumbers[2], module_number, 0, 1));
98  } else {
99  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
100  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
101  }
102 
103  mother->addComponent(det);
104 }

References GeometricTimingDet::addComponent(), cms::DDFilteredView::copyNumbers(), Exception, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, cms::DDFilteredView::name(), cms::DDFilteredView::path(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ buildBTLModule() [2/3]

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

Definition at line 39 of file CmsMTDConstruction.cc.

39  {
40  std::string nodeName(fv.name());
41  GeometricTimingDet* det =
43 
44  const auto& copyNumbers = fv.copyNumbers();
45  auto module_number = copyNumbers[copyNumbers.size() - 2];
46 
47  constexpr char positive[] = "PositiveZ";
48  constexpr char negative[] = "NegativeZ";
49 
50  const std::string modname(fv.name());
51  size_t delim1 = modname.find("BModule");
52  size_t delim2 = modname.find("Layer");
53  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
54 
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("MTDNumbering") << "BTLModule = " << modname << " " << copyNumbers[copyNumbers.size() - 3] << " "
57  << module_number;
58 #endif
59 
60  if (modname.find(positive) != std::string::npos) {
61  det->setGeographicalID(BTLDetId(1, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
62  } else if (modname.find(negative) != std::string::npos) {
63  det->setGeographicalID(BTLDetId(0, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
64  } else {
65  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
66  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
67  }
68 
69  mother->addComponent(det);
70 }

References GeometricTimingDet::addComponent(), DDFilteredView::copyNumbers(), Exception, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, DDFilteredView::name(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ buildBTLModule() [3/3]

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

◆ buildETLModule() [1/3]

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

Definition at line 154 of file CmsMTDConstruction.cc.

154  {
155  std::string nodeName(fv.name());
156  GeometricTimingDet* det =
158 
159  baseNumber_.reset();
160  baseNumber_.setSize(fv.copyNos().size());
161 
162  for (uint i = 0; i < fv.copyNos().size(); i++) {
163  std::string name((fv.geoHistory()[i])->GetName());
164  name.assign(name.erase(name.rfind('_')));
165  int copyN(fv.copyNos()[i]);
166  baseNumber_.addLevel(name, copyN);
167 #ifdef EDM_ML_DEBUG
168  edm::LogVerbatim("CmsMTDConstruction") << name << " " << copyN;
169 #endif
170  }
171 
172  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
173 
174  mother->addComponent(det);
175 }

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.

◆ buildETLModule() [2/3]

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

Definition at line 107 of file CmsMTDConstruction.cc.

107  {
108  std::string nodeName(fv.name());
109  GeometricTimingDet* det =
111 
112  if (isETLtdr(fv)) {
113  //
114  // For the TDR ETL geometry
115  // in principle this method works also for the new geometry, if the main loop points to "Timingactive"
116  // but backward compatibility is kept in order to avoid change in volume name and number of siblings
117  //
118 
119  auto& gh = fv.geoHistory();
120 
121  baseNumber_.reset();
122  baseNumber_.setSize(gh.size());
123 
124  for (uint i = gh.size(); i-- > 0;) {
125  std::string name(gh[i].logicalPart().name().name());
126  int copyN(gh[i].copyno());
127  baseNumber_.addLevel(name, copyN);
128 #ifdef EDM_ML_DEBUG
129  edm::LogVerbatim("CmsMTDConstruction") << name << " " << copyN;
130 #endif
131  }
132 
133  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
134 
135  } else {
136  const auto& copyNumbers = fv.copyNumbers();
137  auto module_number = copyNumbers[copyNumbers.size() - 2];
138 
139  size_t delim_ring = det->name().find("EModule");
140  size_t delim_disc = det->name().find("Disc");
141 
142  std::string ringN = det->name().substr(delim_ring + CmsMTDStringToEnum::kModStrLen, delim_disc);
143 
144  const uint32_t side = det->translation().z() > 0 ? 1 : 0;
145 
146  // label geographic detid is front or back (even though it is one module per entry here)
147  det->setGeographicalID(ETLDetId(side, atoi(ringN.c_str()), module_number, 0));
148  }
149 
150  mother->addComponent(det);
151 }

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

◆ buildETLModule() [3/3]

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

◆ buildLayer()

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

Definition at line 196 of file CmsMTDConstruction.cc.

196  {
197  std::string nodeName(fv.name());
198  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
199  GeometricTimingDet* layer = new GeometricTimingDet(&fv, thisDet);
200 
201  if (thisDet != GeometricTimingDet::BTLLayer && thisDet != GeometricTimingDet::ETLDisc) {
202  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
203  }
204 
205  uint32_t nLayer;
206  if (thisDet == GeometricTimingDet::BTLLayer) {
207  //
208  // only one layer in BTL
209  //
210  nLayer = 1;
211  layer->setGeographicalID(nLayer);
212  } else if (thisDet == GeometricTimingDet::ETLDisc) {
213  //
214  // no change for pre TDR scenarios, otherwise identifiy layer with disc
215  //
216  nLayer = (fv.name().find("Disc1") != std::string::npos) ? 1 : 2;
217  layer->setGeographicalID(nLayer);
218  }
219 
220  return layer;
221 }

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

Referenced by DDCmsMTDConstruction::construct().

◆ buildSubdet()

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

Definition at line 178 of file CmsMTDConstruction.cc.

178  {
179  std::string nodeName(fv.name());
180  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
181  GeometricTimingDet* subdet = new GeometricTimingDet(&fv, thisDet);
182 
183  if (thisDet == GeometricTimingDet::BTL) {
184  subdet->setGeographicalID(BTLDetId(0, 0, 0, 0, 0));
185  } else if (thisDet == GeometricTimingDet::ETL) {
186  const uint32_t side = subdet->translation().z() > 0 ? 1 : 0;
187  subdet->setGeographicalID(ETLDetId(side, 0, 0, 0));
188  } else {
189  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
190  }
191 
192  return subdet;
193 }

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

Referenced by DDCmsMTDConstruction::construct().

◆ isETLtdr()

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

Definition at line 224 of file CmsMTDConstruction.cc.

224  {
225  return (fv.name() == "EModule_Timingactive");
226 }

Referenced by DDCmsMTDConstruction::construct().

◆ mtdOrderPhi()

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

Definition at line 32 of file CmsMTDConstruction.cc.

32  {
33  MTDDetId id1(a->geographicalId());
34  MTDDetId id2(b->geographicalId());
35  return (id1.mtdRR() == id2.mtdRR()) && (angle0to2pi::make0To2pi(a->phi()) < angle0to2pi::make0To2pi(b->phi()));
36 }

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

◆ mtdOrderRR()

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

Definition at line 25 of file CmsMTDConstruction.cc.

25  {
26  MTDDetId id1(a->geographicalId());
27  MTDDetId id2(b->geographicalId());
28  return id1.mtdRR() < id2.mtdRR();
29 }

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

◆ mtdOrderZ()

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

Definition at line 18 of file CmsMTDConstruction.cc.

18  {
19  bool order = (a->translation().z() == b->translation().z()) ? a->translation().rho() < b->translation().rho()
20  : a->translation().z() < b->translation().z();
21  return order;
22 }

References a, b, and eventshapeDQM_cfi::order.

Member Data Documentation

◆ baseNumber_

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

Definition at line 36 of file CmsMTDConstruction.h.

◆ etlScheme_

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

Definition at line 35 of file CmsMTDConstruction.h.

◆ theCmsMTDStringToEnum

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

Definition at line 33 of file CmsMTDConstruction.h.

ETLNumberingScheme::getUnitID
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
Definition: ETLNumberingScheme.cc:20
GeometricTimingDet::addComponent
void addComponent(GeometricTimingDet *)
Definition: GeometricTimingDet.cc:224
mps_fire.i
i
Definition: mps_fire.py:355
CmsMTDStringToEnum::kModStrLen
static constexpr size_t kModStrLen
Definition: CmsMTDStringToEnum.h:12
cms::DDFilteredView::path
const std::string path() const
The full path to the current node.
Definition: DDFilteredView.cc:76
cms::DDFilteredView::geoHistory
const std::vector< const Node * > geoHistory() const
Definition: DDFilteredView.cc:561
globals_cff.id1
id1
Definition: globals_cff.py:32
DDFilteredView::copyNumbers
nav_type copyNumbers() const
return the stack of copy numbers
Definition: DDFilteredView.cc:193
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
parallelization.uint
uint
Definition: parallelization.py:124
CmsMTDConstruction::etlScheme_
ETLNumberingScheme etlScheme_
Definition: CmsMTDConstruction.h:35
cms::DDFilteredView::name
std::string_view name() const
Definition: DDFilteredView.cc:606
BTLDetId
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0,...
Definition: BTLDetId.h:18
GeometricTimingDet::ETLDisc
Definition: GeometricTimingDet.h:60
cms::DDFilteredView::copyNos
const std::vector< int > copyNos() const
The list of the volume copy numbers.
Definition: DDFilteredView.cc:89
b
double b
Definition: hdecay.h:118
MTDBaseNumber::addLevel
void addLevel(const std::string &name, const int &copyNumber)
Definition: MTDBaseNumber.cc:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GeometricTimingDet::translation
Translation const & translation() const
Definition: GeometricTimingDet.h:99
GeometricTimingDet::ETL
Definition: GeometricTimingDet.h:59
MTDBaseNumber::setSize
void setSize(const int &size)
Definition: MTDBaseNumber.cc:10
a
double a
Definition: hdecay.h:119
CmsMTDConstruction::isETLtdr
bool isETLtdr(FilteredView &)
Definition: CmsMTDConstruction.cc:224
eventshapeDQM_cfi.order
order
Definition: eventshapeDQM_cfi.py:8
CmsMTDConstruction::baseNumber_
MTDBaseNumber baseNumber_
Definition: CmsMTDConstruction.h:36
CmsMTDStringToEnum::type
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
Definition: CmsMTDStringToEnum.cc:18
cms::DDFilteredView::copyNumbers
auto copyNumbers(Ts &&... ts) const -> decltype(copyNos(std::forward< Ts >(ts)...))
Definition: DDFilteredView.h:89
edm::LogVerbatim
Definition: MessageLogger.h:297
GeometricTimingDet
Definition: GeometricTimingDet.h:28
DDFilteredView::geoHistory
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Definition: DDFilteredView.cc:30
CmsMTDConstruction::theCmsMTDStringToEnum
CmsMTDStringToEnum theCmsMTDStringToEnum
Definition: CmsMTDConstruction.h:33
angle0to2pi::make0To2pi
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
GeometricTimingDet::BTLLayer
Definition: GeometricTimingDet.h:54
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
Exception
Definition: hltDiff.cc:246
GeometricTimingDet::BTL
Definition: GeometricTimingDet.h:53
MTDBaseNumber::reset
void reset()
Definition: MTDBaseNumber.cc:47
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
globals_cff.id2
id2
Definition: globals_cff.py:33
timingPdfMaker.modname
modname
Definition: timingPdfMaker.py:218
GeometricTimingDet::setGeographicalID
void setGeographicalID(DetId id)
Definition: GeometricTimingDet.h:76
DDFilteredView::name
const std::string & name() const
The name of a logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:18