CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
DDI::Specific Class Reference

#include <Specific.h>

Public Member Functions

std::pair< bool, DDExpandedViewnode () const
 gives the geometrical history of a fully specified PartSelector More...
 
const std::vector< DDPartSelection > & selection () const
 
 Specific (const std::vector< std::string > &selections, const DDsvalues_type &specs, bool doRegex=true)
 
 Specific (const std::vector< DDPartSelection > &selections, const DDsvalues_type &specs)
 
const DDsvalues_typespecifics () const
 
void stream (std::ostream &) const
 
void tokenize ()
 
void updateLogicalPart (std::vector< std::pair< DDLogicalPart, std::pair< const DDPartSelection *, const DDsvalues_type *> > > &) const
 

Protected Member Functions

void addSelectionLevel (std::vector< DDLogicalPart > &lpv, int copyno, ddselection_type st, std::vector< DDPartSelection > &selv)
 
void createPartSelections (const std::string &selString)
 

Protected Attributes

bool doRegex_
 
std::vector< DDPartSelectionpartSelections_
 
DDsvalues_type specifics_
 
bool valid_
 

Detailed Description

Definition at line 20 of file Specific.h.

Constructor & Destructor Documentation

◆ Specific() [1/2]

DDI::Specific::Specific ( const std::vector< std::string > &  selections,
const DDsvalues_type specs,
bool  doRegex = true 
)

Definition at line 20 of file Specific.cc.

References createPartSelections(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and clusterbigeventsdebugger_cfi::selections.

21  : specifics_(specs), partSelections_(0), valid_(false), doRegex_(doRegex) {
22  for (const auto& it : selections) {
24  }
25  }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
bool valid_
Definition: Specific.h:48
DDsvalues_type specifics_
Definition: Specific.h:46
bool doRegex_
Definition: Specific.h:49
void createPartSelections(const std::string &selString)
Definition: Specific.cc:30

◆ Specific() [2/2]

DDI::Specific::Specific ( const std::vector< DDPartSelection > &  selections,
const DDsvalues_type specs 
)

Definition at line 27 of file Specific.cc.

std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
bool valid_
Definition: Specific.h:48
DDsvalues_type specifics_
Definition: Specific.h:46
bool doRegex_
Definition: Specific.h:49

Member Function Documentation

◆ addSelectionLevel()

void DDI::Specific::addSelectionLevel ( std::vector< DDLogicalPart > &  lpv,
int  copyno,
ddselection_type  st,
std::vector< DDPartSelection > &  selv 
)
protected

Definition at line 59 of file Specific.cc.

References mps_fire::result.

Referenced by createPartSelections().

62  {
63  if (selv.empty()) { // create one, no entry yet!
64  selv.emplace_back(DDPartSelection());
65  }
66  typedef std::vector<DDLogicalPart>::size_type lpv_sizetype;
67  typedef std::vector<DDPartSelection>::size_type ps_sizetype;
68  ps_sizetype ps_sz = selv.size();
69  lpv_sizetype lpv_sz = lpv.size();
70  lpv_sizetype lpv_i = 0;
71  std::vector<DDPartSelection> result;
72  for (; lpv_i < lpv_sz; ++lpv_i) {
73  std::vector<DDPartSelection>::const_iterator ps_it = selv.begin();
74  for (; ps_it != selv.end(); ++ps_it) {
75  result.emplace_back(*ps_it);
76  }
77  }
78  ps_sizetype ps_i = 0;
79  for (lpv_i = 0; lpv_i < lpv_sz; ++lpv_i) {
80  for (ps_i = ps_sz * lpv_i; ps_i < ps_sz * (lpv_i + 1); ++ps_i) {
81  result[ps_i].emplace_back(DDPartSelectionLevel(lpv[lpv_i], copyno, st));
82  }
83  }
84  selv = result;
85  }
uint16_t size_type

◆ createPartSelections()

void DDI::Specific::createPartSelections ( const std::string &  selString)
protected

Definition at line 30 of file Specific.cc.

References addSelectionLevel(), DDIsValid(), DDTokenize2(), doRegex_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, mps_check::msg, partSelections_, AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

Referenced by Specific().

30  {
31  std::vector<DDPartSelRegExpLevel> regv;
32  std::vector<DDPartSelection> temp;
33  DDTokenize2(selString, regv);
34 
35  if (regv.empty())
36  throw cms::Exception("DDException") << "Could not evaluate the selection-std::string ->" << selString << "<-";
37 
38  std::pair<bool, std::string> res;
39  for (const auto& it : regv) {
40  std::vector<DDLogicalPart> lpv;
41  res = DDIsValid(it.ns_, it.nm_, lpv, doRegex_);
42  if (!res.first) {
43  std::string msg("Could not process q-name of a DDLogicalPart, reason:\n" + res.second);
44  msg += "\nSpecPar selection is:\n" + selString + "\n";
45  //throw cms::Exception("DDException") << "Could not process q-name of a DDLogicalPart, reason:\n" << res.second;
46  edm::LogError("Specific") << msg;
47  break; //EXIT for loop
48  }
49  addSelectionLevel(lpv, it.copyno_, it.selectionType_, temp);
50  }
51  if (res.first) { // i.e. it wasn't "thrown" out of the loop
52  partSelections_.reserve(temp.size() + partSelections_.size());
53  for (const auto& iit : temp) {
54  partSelections_.emplace_back(iit);
55  }
56  }
57  }
void addSelectionLevel(std::vector< DDLogicalPart > &lpv, int copyno, ddselection_type st, std::vector< DDPartSelection > &selv)
Definition: Specific.cc:59
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
Log< level::Error, false > LogError
Definition: Electron.h:6
bool doRegex_
Definition: Specific.h:49
std::pair< bool, std::string > DDIsValid(const std::string &ns, const std::string &name, std::vector< DDLogicalPart > &result, bool doRegex=true)
void DDTokenize2(const std::string &selectionString, std::vector< DDPartSelRegExpLevel > &result)
tuple msg
Definition: mps_check.py:286

◆ node()

std::pair< bool, DDExpandedView > DDI::Specific::node ( ) const

gives the geometrical history of a fully specified PartSelector

node() will only work, if

  • there is only one PartSelection std::string
  • the PartSelection std::string specifies exactly one full path concatenating always direct children including their copy-number and will return (true,const DDGeoHistory&) if the std::string matches an expanded-part in the ExpandedView, else it will return (false, xxx), whereas xxx is a history which is not valid.

Definition at line 138 of file Specific.cc.

References HltBtagPostValidation_cff::c, ddanyposp, ddchildposp, MillePedeFileConverter_cfg::e, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, partSelections_, and mps_fire::result.

138  {
140  DDExpandedView e(c);
141 
142  if (partSelections_.size() != 1) {
143  edm::LogError("Specific") << " >> more or less than one part-selector, currently NOT SUPPORTED! <<" << std::endl;
144  return std::make_pair(false, e);
145  }
146  const DDPartSelection& ps = partSelections_[0];
147 
148  DDPartSelection::const_iterator it = ps.begin();
149  DDPartSelection::const_iterator ed = ps.end();
150  if ((it != ed) && (it->selectionType_ != ddanyposp)) {
151  edm::LogError("Specific") << " >> part-selector must start with //Name[no] ! << " << std::endl;
152  return std::make_pair(false, e);
153  }
154  ++it;
155  for (; it != ps.end(); ++it) {
156  if (it->selectionType_ != ddchildposp) {
157  edm::LogError("Specific") << " >> part-selector must be a concatenation of direct children\n"
158  << " including their copy-number only, CURRENT LIMITATION! <<" << std::endl;
159  return std::make_pair(false, e);
160  }
161  }
162 
163  it = ps.begin();
164  bool result = true;
165  for (; it != ed; ++it) {
166  while (result) {
167  if ((it->copyno_ == e.copyno()) && (it->lp_ == e.logicalPart())) {
168  break;
169  } else {
170  result = e.nextSibling();
171  }
172  }
173  if ((ed - it) > 1) {
174  result = e.firstChild();
175  }
176  }
177  return std::make_pair(result, e);
178  }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
Provides an exploded view of the detector (tree-view)

◆ selection()

const std::vector< DDPartSelection > & DDI::Specific::selection ( ) const

Definition at line 87 of file Specific.cc.

References partSelections_.

Referenced by trackingPlots.Iteration::modules().

87 { return partSelections_; }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47

◆ specifics()

const DDsvalues_type& DDI::Specific::specifics ( void  ) const
inline

Definition at line 33 of file Specific.h.

References specifics_.

33 { return specifics_; }
DDsvalues_type specifics_
Definition: Specific.h:46

◆ stream()

void DDI::Specific::stream ( std::ostream &  os) const

Definition at line 89 of file Specific.cc.

References mps_fire::i, partSelections_, alignCSCRings::s, specifics_, and findQualityFiles::v.

89  {
90  os << " Size: " << specifics_.size() << std::endl;
91  os << "\tSelections:" << std::endl;
92  for (const auto& pit : partSelections_) {
93  os << pit << std::endl;
94  }
95  for (const auto& vit : specifics_) {
96  const DDValue& v = vit.second;
97  os << "\tParameter name= \"" << v.name() << "\" " << std::endl;
98  os << "\t\t Value pairs: " << std::endl;
99  size_t s = v.size();
100  size_t i = 0;
101  if (v.isEvaluated()) {
102  for (; i < s; ++i) {
103  os << "\t\t\t\"" << v[i].first << "\""
104  << ", " << v[i].second << std::endl;
105  }
106  } else { // v is not evaluated
107  for (const auto& i : v.strings()) {
108  os << "\t\t\t\"" << i << "\""
109  << ", not evaluated" << std::endl;
110  }
111  }
112  }
113  }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
DDsvalues_type specifics_
Definition: Specific.h:46

◆ tokenize()

void DDI::Specific::tokenize ( )

◆ updateLogicalPart()

void DDI::Specific::updateLogicalPart ( std::vector< std::pair< DDLogicalPart, std::pair< const DDPartSelection *, const DDsvalues_type *> > > &  result) const

Definition at line 115 of file Specific.cc.

References cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, partSelections_, mps_fire::result, specifics_, and pfDeepBoostedJetPreprocessParams_cfi::sv.

116  {
117  if (!partSelections_.empty()) {
118  const DDsvalues_type* sv = (&specifics_);
119  for (const auto& it : partSelections_) {
120  DDLogicalPart logp = it.back().lp_;
121  const DDPartSelection* ps = (&it);
122  assert(ps);
123  assert(sv);
124  std::pair<const DDPartSelection*, const DDsvalues_type*> pssv(ps, sv);
125  result.emplace_back(std::make_pair(logp, pssv));
126  }
127  }
128  }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
assert(be >=bs)
DDsvalues_type specifics_
Definition: Specific.h:46
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93

Member Data Documentation

◆ doRegex_

bool DDI::Specific::doRegex_
protected

Definition at line 49 of file Specific.h.

Referenced by createPartSelections().

◆ partSelections_

std::vector<DDPartSelection> DDI::Specific::partSelections_
protected

Definition at line 47 of file Specific.h.

Referenced by createPartSelections(), node(), selection(), stream(), and updateLogicalPart().

◆ specifics_

DDsvalues_type DDI::Specific::specifics_
protected

Definition at line 46 of file Specific.h.

Referenced by specifics(), stream(), and updateLogicalPart().

◆ valid_

bool DDI::Specific::valid_
protected

Definition at line 48 of file Specific.h.