CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
 
 ~Specific ()
 

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 19 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 8 of file Specific.cc.

References createPartSelections().

11  : specifics_(specs),
12  partSelections_(0),
13  valid_(false),
14  doRegex_(doRegex)
15  {
16  for( const auto& it : selections ) {
18  }
19  }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:48
bool valid_
Definition: Specific.h:49
DDsvalues_type specifics_
Definition: Specific.h:47
bool doRegex_
Definition: Specific.h:50
void createPartSelections(const std::string &selString)
Definition: Specific.cc:26
DDI::Specific::Specific ( const std::vector< DDPartSelection > &  selections,
const DDsvalues_type specs 
)

Definition at line 21 of file Specific.cc.

23  : specifics_(specs), partSelections_(selections), valid_(false), doRegex_(false)
24  { }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:48
bool valid_
Definition: Specific.h:49
DDsvalues_type specifics_
Definition: Specific.h:47
bool doRegex_
Definition: Specific.h:50
DDI::Specific::~Specific ( )
inline

Definition at line 29 of file Specific.h.

29 { }

Member Function Documentation

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

Definition at line 54 of file Specific.cc.

References query::result.

Referenced by createPartSelections().

56  {
57  if (!selv.size()) { // create one, no entry yet!
58  selv.push_back(DDPartSelection());
59  }
60  typedef std::vector<DDLogicalPart>::size_type lpv_sizetype;
61  typedef std::vector<DDPartSelection>::size_type ps_sizetype;
62  ps_sizetype ps_sz = selv.size();
63  lpv_sizetype lpv_sz = lpv.size();
64  lpv_sizetype lpv_i = 0;
65  std::vector<DDPartSelection> result;
66  for (; lpv_i < lpv_sz; ++lpv_i) {
67  std::vector<DDPartSelection>::const_iterator ps_it = selv.begin();
68  for (; ps_it != selv.end(); ++ps_it) {
69  result.push_back(*ps_it);
70  }
71  }
72  ps_sizetype ps_i = 0;
73  for(lpv_i=0; lpv_i < lpv_sz; ++lpv_i) {
74  for(ps_i = ps_sz*lpv_i; ps_i < ps_sz*(lpv_i+1); ++ps_i) {
75  result[ps_i].push_back(DDPartSelectionLevel(lpv[lpv_i],copyno,st));
76  }
77  }
78  selv = result;
79  }
uint16_t size_type
tuple result
Definition: query.py:137
void DDI::Specific::createPartSelections ( const std::string &  selString)
protected

Definition at line 26 of file Specific.cc.

References addSelectionLevel(), DDIsValid(), DDTokenize2(), doRegex_, visualization-live-secondInstance_cfg::msg, partSelections_, AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

Referenced by Specific().

27  {
28  std::vector<DDPartSelRegExpLevel> regv;
29  std::vector<DDPartSelection> temp;
30  DDTokenize2(selString,regv);
31 
32  if (!regv.size()) throw cms::Exception("DDException") << "Could not evaluate the selection-std::string ->" << selString << "<-";
33  std::pair<bool,std::string> res;
34  for( const auto& it : regv ) {
35  std::vector<DDLogicalPart> lpv;
36  res = DDIsValid( it.ns_, it.nm_, lpv, doRegex_ );
37  if (!res.first) {
38  std::string msg("Could not process q-name of a DDLogicalPart, reason:\n"+res.second);
39  msg+="\nSpecPar selection is:\n" + selString + "\n";
40  //throw cms::Exception("DDException") << "Could not process q-name of a DDLogicalPart, reason:\n" << res.second;
41  edm::LogError("Specific") << msg;
42  break; //EXIT for loop
43  }
44  addSelectionLevel( lpv, it.copyno_, it.selectionType_, temp );
45  }
46  if ( res.first ) { // i.e. it wasn't "thrown" out of the loop
47  partSelections_.reserve(temp.size() + partSelections_.size());
48  for( const auto& iit : temp ) {
49  partSelections_.push_back( iit );
50  }
51  }
52  }
void addSelectionLevel(std::vector< DDLogicalPart > &lpv, int copyno, ddselection_type st, std::vector< DDPartSelection > &selv)
Definition: Specific.cc:54
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:48
bool doRegex_
Definition: Specific.h:50
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)
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 134 of file Specific.cc.

References EnergyCorrector::c, DDExpandedView::copyno(), ddanyposp, ddchildposp, alignCSCRings::e, DDExpandedView::firstChild(), DDExpandedView::logicalPart(), DDExpandedView::nextSibling(), partSelections_, and query::result.

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

Definition at line 81 of file Specific.cc.

References partSelections_.

Referenced by Vispa.Plugins.ConfigEditor.CodeTableView.CodeTableView::keyPressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

82  {
83  return partSelections_;
84  }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:48
const DDsvalues_type& DDI::Specific::specifics ( void  ) const
inline

Definition at line 37 of file Specific.h.

References specifics_.

37 { return specifics_; }
DDsvalues_type specifics_
Definition: Specific.h:47
void DDI::Specific::stream ( std::ostream &  os) const

Definition at line 86 of file Specific.cc.

References i, DDValue::isEvaluated(), DDValue::name(), partSelections_, alignCSCRings::s, DDValue::size(), specifics_, DDValue::strings(), and findQualityFiles::v.

87  {
88  os << " Size: " << specifics_.size() << std::endl;
89  os << "\tSelections:" << std::endl;
90  for( const auto& pit : partSelections_ ) {
91  os << pit << std::endl;
92  }
93  for( const auto& vit : specifics_ ) {
94  const DDValue & v = vit.second;
95  os << "\tParameter name= \"" << v.name() << "\" " << std::endl;
96  os << "\t\t Value pairs: " << std::endl;
97  size_t s=v.size();
98  size_t i=0;
99  if ( v.isEvaluated() ) {
100  for( ; i<s; ++i) {
101  os << "\t\t\t\"" << v[i].first << "\"" << ", " << v[i].second << std::endl;
102  }
103  } else { // v is not evaluated
104  for( const auto& i : v.strings()) {
105  os << "\t\t\t\"" << i << "\"" << ", not evaluated" << std::endl;
106  }
107  }
108  }
109  }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:55
int i
Definition: DBlmapReader.cc:9
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:48
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:203
DDsvalues_type specifics_
Definition: Specific.h:47
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:62
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:69
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 111 of file Specific.cc.

References assert(), partSelections_, query::result, and specifics_.

112  {
113  if (partSelections_.size()) {
114  const DDsvalues_type* sv = (&specifics_);
115  for( const auto& it : partSelections_ ) {
116  DDLogicalPart logp = it.back().lp_;
117  const DDPartSelection * ps = (&it);
118  assert(ps);
119  assert(sv);
120  std::pair<const DDPartSelection*,const DDsvalues_type*> pssv(ps,sv);
121  result.push_back(std::make_pair(logp,pssv));
122  }
123  }
124  }
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:48
assert(m_qm.get())
DDsvalues_type specifics_
Definition: Specific.h:47
tuple result
Definition: query.py:137
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:19
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88

Member Data Documentation

bool DDI::Specific::doRegex_
protected

Definition at line 50 of file Specific.h.

Referenced by createPartSelections().

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

Definition at line 48 of file Specific.h.

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

DDsvalues_type DDI::Specific::specifics_
protected

Definition at line 47 of file Specific.h.

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

bool DDI::Specific::valid_
protected

Definition at line 49 of file Specific.h.