CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::Cabling Class Reference

#include <Cabling.h>

Public Member Functions

void addphi (const std::string &dtc, double phi, int layer, int module)
 
 Cabling (std::string dtcconfig, std::string moduleconfig, Settings const &settings)
 
const std::string & dtc (int layer, int ladder, int module) const
 
std::vector< std::string > DTCs () const
 
void writephirange () const
 
 ~Cabling ()=default
 

Private Attributes

std::map< std::string, DTCdtcranges_
 
std::map< std::string, DTCdtcs_
 
std::vector< DTCLinklinks_
 
std::map< int, std::map< int, std::map< int, std::string > > > modules_
 
Settings const & settings_
 

Detailed Description

Definition at line 16 of file Cabling.h.

Constructor & Destructor Documentation

◆ Cabling()

Cabling::Cabling ( std::string  dtcconfig,
std::string  moduleconfig,
Settings const &  settings 
)

Definition at line 13 of file Cabling.cc.

13  : settings_(settings) {
14  ifstream indtc(dtcconfig.c_str());
15  assert(indtc.good());
16 
17  string dtc;
18  int isec;
19 
20  while (indtc.good()) {
21  indtc >> dtc >> isec;
22 
23  if (!indtc.good())
24  continue;
25 
26  if (dtcs_.find(dtc) == dtcs_.end()) {
27  dtcs_[dtc].setName(dtc);
28  }
29 
30  dtcs_[dtc].addSec(isec);
31 
32  string dtcbase = dtc.substr(2, dtc.size() - 2);
33  if (dtc[0] == 'n') {
34  dtcbase = "neg_" + dtc.substr(6, dtc.size() - 6);
35  }
36  if (dtcranges_.find(dtcbase) == dtcranges_.end()) {
37  dtcranges_[dtcbase].setName(dtcbase);
38  }
39  }
40 
41  ifstream inmodules(moduleconfig.c_str());
42 
43  int layer, ladder, module;
44 
45  while (inmodules.good()) {
46  inmodules >> layer >> ladder >> module >> dtc;
47 
48  // in the cabling module map, module# 300+ is flat part of barrel, 200-299 is tilted z-, 100-199 is tilted z+
49  if (module > 300) {
50  if (layer > 0 && layer <= (int)N_PSLAYER) {
51  module = (module - 300) + N_TILTED_RINGS;
52  } else if (layer > (int)N_PSLAYER) {
53  module = (module - 300);
54  }
55  }
56  if (module > 200) {
57  module = (module - 200);
58  }
59  if ((module > 100) && (layer > 0 && layer <= (int)N_PSLAYER)) {
60  module = (module - 100) + N_TILTED_RINGS + N_MOD_PLANK.at(layer - 1);
61  }
62  if (!inmodules.good())
63  break;
64  modules_[layer][ladder][module] = dtc;
65  }
66 }

References cms::cuda::assert(), dtc(), dtcranges_, dtcs_, createfilelist::int, PVValHelper::ladder, modules_, trklet::N_MOD_PLANK, trklet::N_PSLAYER, and trklet::N_TILTED_RINGS.

◆ ~Cabling()

trklet::Cabling::~Cabling ( )
default

Member Function Documentation

◆ addphi()

void Cabling::addphi ( const std::string &  dtc,
double  phi,
int  layer,
int  module 
)

Definition at line 81 of file Cabling.cc.

81  {
82  unsigned int layerdisk = layer - 1;
83 
84  if (layer > 1000)
85  layerdisk = module + N_DISK;
86 
87  assert(layerdisk < N_LAYER + N_DISK);
88 
89  int isec = dtc[0] - '0';
90 
91  string dtcbase = dtc.substr(2, dtc.size() - 2);
92  if (dtc[0] == 'n') {
93  dtcbase = "neg_" + dtc.substr(6, dtc.size() - 6);
94  isec = dtc[4] - '0';
95  }
96 
97  double phisec = reco::reduceRange(phi - isec * settings_.dphisector());
98 
99  assert(dtcranges_.find(dtcbase) != dtcranges_.end());
100 
101  dtcranges_[dtcbase].addphi(phisec, layerdisk);
102 }

References cms::cuda::assert(), trklet::Settings::dphisector(), dtc(), dtcranges_, trklet::N_DISK, trklet::N_LAYER, reco::reduceRange(), and settings_.

◆ dtc()

const string & Cabling::dtc ( int  layer,
int  ladder,
int  module 
) const

Definition at line 68 of file Cabling.cc.

68  {
69  auto it1 = modules_.find(layer);
70  assert(it1 != modules_.end());
71  auto it2 = it1->second.find(ladder);
72  assert(it2 != it1->second.end());
73  auto it3 = it2->second.find(module);
74  if (it3 == it2->second.end()) {
75  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << "Could not find stub " << layer << " "
76  << ladder << " " << module;
77  }
78  return it3->second;
79 }

References cms::cuda::assert(), Exception, PVValHelper::ladder, and modules_.

Referenced by addphi(), and Cabling().

◆ DTCs()

std::vector< string > Cabling::DTCs ( ) const

Definition at line 118 of file Cabling.cc.

118  {
119  std::vector<string> tmp;
120 
121  for (const auto& it : dtcs_) {
122  tmp.push_back(it.first);
123  }
124 
125  return tmp;
126 }

References dtcs_, and createJobs::tmp.

◆ writephirange()

void Cabling::writephirange ( ) const

Definition at line 104 of file Cabling.cc.

104  {
105  ofstream out("dtcphirange.txt");
106 
107  for (auto&& it : dtcranges_) {
108  for (unsigned int i = 0; i < N_LAYER + N_DISK; i++) {
109  double min = it.second.min(i);
110  double max = it.second.max(i);
111  if (min < max) {
112  out << it.first << " " << i + 1 << " " << min << " " << max << endl;
113  }
114  }
115  }
116 }

References dtcranges_, mps_fire::i, SiStripPI::max, min(), trklet::N_DISK, trklet::N_LAYER, and MillePedeFileConverter_cfg::out.

Member Data Documentation

◆ dtcranges_

std::map<std::string, DTC> trklet::Cabling::dtcranges_
private

Definition at line 33 of file Cabling.h.

Referenced by addphi(), Cabling(), and writephirange().

◆ dtcs_

std::map<std::string, DTC> trklet::Cabling::dtcs_
private

Definition at line 34 of file Cabling.h.

Referenced by Cabling(), and DTCs().

◆ links_

std::vector<DTCLink> trklet::Cabling::links_
private

Definition at line 32 of file Cabling.h.

◆ modules_

std::map<int, std::map<int, std::map<int, std::string> > > trklet::Cabling::modules_
private

Definition at line 35 of file Cabling.h.

Referenced by Cabling(), and dtc().

◆ settings_

Settings const& trklet::Cabling::settings_
private

Definition at line 31 of file Cabling.h.

Referenced by addphi().

trklet::N_PSLAYER
constexpr unsigned int N_PSLAYER
Definition: Settings.h:21
mps_fire.i
i
Definition: mps_fire.py:428
min
T min(T a, T b)
Definition: MathUtil.h:58
trklet::Cabling::settings_
Settings const & settings_
Definition: Cabling.h:31
cms::cuda::assert
assert(be >=bs)
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:20
trklet::Settings::dphisector
double dphisector() const
Definition: Settings.h:238
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::N_TILTED_RINGS
constexpr unsigned int N_TILTED_RINGS
Definition: Settings.h:727
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
trklet::Cabling::dtcs_
std::map< std::string, DTC > dtcs_
Definition: Cabling.h:34
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
trklet::Cabling::dtc
const std::string & dtc(int layer, int ladder, int module) const
Definition: Cabling.cc:68
createfilelist.int
int
Definition: createfilelist.py:10
trklet::Cabling::dtcranges_
std::map< std::string, DTC > dtcranges_
Definition: Cabling.h:33
Exception
Definition: hltDiff.cc:246
trklet::N_MOD_PLANK
constexpr std::array< unsigned int, N_PSLAYER > N_MOD_PLANK
Definition: Settings.h:728
PVValHelper::ladder
Definition: PVValidationHelpers.h:72
trklet::Cabling::modules_
std::map< int, std::map< int, std::map< int, std::string > > > modules_
Definition: Cabling.h:35
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
reco::reduceRange
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18