CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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().

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
DDI::Specific::Specific ( const std::vector< DDPartSelection > &  selections,
const DDsvalues_type specs 
)

Definition at line 27 of file Specific.cc.

28  : specifics_(specs), partSelections_(selections), valid_(false), doRegex_(false) {}
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

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
tuple result
Definition: mps_fire.py:311
void DDI::Specific::createPartSelections ( const std::string &  selString)
protected

Definition at line 30 of file Specific.cc.

References addSelectionLevel(), DDIsValid(), DDTokenize2(), doRegex_, 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
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:285
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 c, DDExpandedView::copyno(), ddanyposp, ddchildposp, alignCSCRings::e, DDExpandedView::firstChild(), DDExpandedView::logicalPart(), DDExpandedView::nextSibling(), 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  }
const edm::EventSetup & c
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
tuple result
Definition: mps_fire.py:311
Provides an exploded view of the detector (tree-view)
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
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
void DDI::Specific::stream ( std::ostream &  os) const

Definition at line 89 of file Specific.cc.

References mps_fire::i, DDValue::isEvaluated(), DDValue::name(), partSelections_, alignCSCRings::s, DDValue::size(), specifics_, DDValue::strings(), 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  }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:54
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:152
DDsvalues_type specifics_
Definition: Specific.h:46
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
Definition: DDValue.h:61
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:68
void DDI::Specific::tokenize ( )
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(), partSelections_, mps_fire::result, and specifics_.

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)
tuple result
Definition: mps_fire.py:311
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

bool DDI::Specific::doRegex_
protected

Definition at line 49 of file Specific.h.

Referenced by createPartSelections().

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

Definition at line 47 of file Specific.h.

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

DDsvalues_type DDI::Specific::specifics_
protected

Definition at line 46 of file Specific.h.

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

bool DDI::Specific::valid_
protected

Definition at line 48 of file Specific.h.