CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DDI::Specific Class Reference

#include <Specific.h>

Public Types

typedef std::vector
< DDPartSelection
partsel_type
 
typedef std::vector< std::string > selectors_type
 

Public Member Functions

std::pair< bool, DDExpandedViewnode () const
 gives the geometrical history of a fully specified PartSelector More...
 
bool nodes (DDNodes &) const
 CURRENTLY NOT IMPLEMENTED! 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< DDPartSelection *, 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_
 
partsel_type partSelections_
 
DDsvalues_type specifics_
 
bool valid_
 

Detailed Description

Definition at line 19 of file Specific.h.

Member Typedef Documentation

Definition at line 22 of file Specific.h.

typedef std::vector<std::string> DDI::Specific::selectors_type

Definition at line 23 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 11 of file Specific.cc.

References createPartSelections().

14  : specifics_(specs),
15  partSelections_(0),
16  valid_(false),
17  doRegex_(doRegex)
18  {
19  std::vector<std::string>::const_iterator it = selections.begin();
20  for(; it != selections.end(); ++it) {
22  }
23  }
bool valid_
Definition: Specific.h:56
DDsvalues_type specifics_
Definition: Specific.h:54
bool doRegex_
Definition: Specific.h:57
void createPartSelections(const std::string &selString)
Definition: Specific.cc:30
partsel_type partSelections_
Definition: Specific.h:55
DDI::Specific::Specific ( const std::vector< DDPartSelection > &  selections,
const DDsvalues_type specs 
)

Definition at line 25 of file Specific.cc.

27  : specifics_(specs), partSelections_(selections), valid_(false), doRegex_(false)
28  { }
bool valid_
Definition: Specific.h:56
DDsvalues_type specifics_
Definition: Specific.h:54
bool doRegex_
Definition: Specific.h:57
partsel_type partSelections_
Definition: Specific.h:55
DDI::Specific::~Specific ( )

Definition at line 203 of file Specific.cc.

204  {
205  // DDsvalues_type::iterator it = specifics_.begin();
206  // for (; it != specifics_.end(); ++it) {
207  // it->second.clear();
208  // }
209  }

Member Function Documentation

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

Definition at line 65 of file Specific.cc.

References query::result.

Referenced by createPartSelections().

67  {
68  if (!selv.size()) { // create one, no entry yet!
69  selv.push_back(DDPartSelection());
70  }
71  typedef std::vector<DDLogicalPart>::size_type lpv_sizetype;
72  typedef std::vector<DDPartSelection>::size_type ps_sizetype;
73  ps_sizetype ps_sz = selv.size();
74  lpv_sizetype lpv_sz = lpv.size();
75  //edm::LogInfo ("Specific") << "lpv_sz=" << lpv_sz << std::endl;
76  lpv_sizetype lpv_i = 0;
77  std::vector<DDPartSelection> result;
78  for (; lpv_i < lpv_sz; ++lpv_i) {
79  std::vector<DDPartSelection>::const_iterator ps_it = selv.begin();
80  for (; ps_it != selv.end(); ++ps_it) {
81  result.push_back(*ps_it);
82  }
83  }
84  //edm::LogInfo ("Specific") << "result-size=" << result.size() << std::endl;
85  //ps_sizetype ps_sz = result.size();
86  ps_sizetype ps_i = 0;
87  for(lpv_i=0; lpv_i < lpv_sz; ++lpv_i) {
88  for(ps_i = ps_sz*lpv_i; ps_i < ps_sz*(lpv_i+1); ++ps_i) {
89  result[ps_i].push_back(DDPartSelectionLevel(lpv[lpv_i],copyno,st));
90  }
91  }
92  selv = result;
93  }
uint16_t size_type
tuple result
Definition: query.py:137
void DDI::Specific::createPartSelections ( const std::string &  selString)
protected

Definition at line 30 of file Specific.cc.

References addSelectionLevel(), DDIsValid(), DDTokenize2(), doRegex_, lumiQueryAPI::msg, partSelections_, AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

Referenced by Specific().

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

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

159  {
161  DDExpandedView e(c);
162 
163  if (partSelections_.size() != 1) {
164  edm::LogError("Specific") << " >> more or less than one part-selector, currently NOT SUPPORTED! <<" << std::endl;
165  return std::make_pair(false,e);
166  }
167  const DDPartSelection & ps = partSelections_[0];
168 
169  DDPartSelection::const_iterator it = ps.begin();
170  DDPartSelection::const_iterator ed = ps.end();
171  if ( (it != ed) && ( it->selectionType_ != ddanyposp) ) {
172  edm::LogError("Specific") << " >> part-selector must start with //Name[no] ! << " << std::endl;
173  return std::make_pair(false,e);
174  }
175  ++it;
176  for (; it != ps.end(); ++it) {
177  if ( it->selectionType_ != ddchildposp ) {
178  edm::LogError("Specific") << " >> part-selector must be a concatenation of direct children\n"
179  << " including their copy-number only, CURRENT LIMITATION! <<" << std::endl;
180  return std::make_pair(false,e);
181  }
182  }
183 
184  it = ps.begin();
185  bool result = true;
186  for (; it != ed; ++it) {
187  while(result) {
188  if( (it->copyno_ == e.copyno()) && (it->lp_ == e.logicalPart())) {
189  break;
190  }
191  else {
192  result = e.nextSibling();
193  }
194  }
195  if ((ed-it)>1) {
196  result = e.firstChild();
197  }
198  }
199  return std::make_pair(result,e);
200  }
type of data representation of DDCompactView
Definition: DDCompactView.h:77
tuple result
Definition: query.py:137
partsel_type partSelections_
Definition: Specific.h:55
Provides an exploded view of the detector (tree-view)
bool DDI::Specific::nodes ( DDNodes ) const
inline

CURRENTLY NOT IMPLEMENTED!

Definition at line 43 of file Specific.h.

43 { return false; }
const std::vector< DDPartSelection > & DDI::Specific::selection ( ) const
const DDsvalues_type& DDI::Specific::specifics ( void  ) const
inline

Definition at line 40 of file Specific.h.

References specifics_.

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

Definition at line 101 of file Specific.cc.

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

102  {
103  // os << " no output available yet, sorry. ";
104  os << " Size: " << specifics_.size() << std::endl;
105  os << "\tSelections:" << std::endl;
106  partsel_type::const_iterator pit(partSelections_.begin()), pend(partSelections_.end());
107  for (;pit!=pend;++pit) {
108  os << *pit << std::endl;
109  }
110 
111  DDsvalues_type::const_iterator vit(specifics_.begin()), ved(specifics_.end());
112  for (;vit!=ved;++vit) {
113  const DDValue & v = vit->second;
114  os << "\tParameter name= \"" << v.name() << "\" " << std::endl;
115  os << "\t\t Value pairs: " << std::endl;
116  size_t s=v.size();
117  size_t i=0;
118  if ( v.isEvaluated() ) {
119  for (; i<s; ++i) {
120  os << "\t\t\t\"" << v[i].first << "\"" << ", " << v[i].second << std::endl;
121  }
122  } else { // v is not evaluated
123  const std::vector<std::string>& vs = v.strings();
124  for (; i<s; ++i) {
125  os << "\t\t\t\"" << vs[i] << "\"" << ", not evaluated" << std::endl;
126  }
127  }
128  }
129  }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:64
int i
Definition: DBlmapReader.cc:9
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:198
DDsvalues_type specifics_
Definition: Specific.h:54
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:71
partsel_type partSelections_
Definition: Specific.h:55
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:78
void DDI::Specific::tokenize ( )
void DDI::Specific::updateLogicalPart ( std::vector< std::pair< DDLogicalPart, std::pair< DDPartSelection *, DDsvalues_type * > > > &  result) const

Definition at line 131 of file Specific.cc.

References partSelections_, query::result, and specifics_.

132  {
133  if (partSelections_.size()) {
134  partsel_type::const_iterator it = partSelections_.begin();
135  DDsvalues_type* sv = const_cast<DDsvalues_type*>(&specifics_);
136  for (; it != partSelections_.end(); ++it) {
137  DDLogicalPart logp = it->back().lp_;
138  /*if (!logp.isDefined().second) {
139  throw DDException("Specific::updateLogicalPart(..): LogicalPart not defined, name=" + std::string(logp.ddname()));
140  }*/
141  DDPartSelection * ps = const_cast<DDPartSelection*>(&(*it));
142  assert(ps);
143  assert(sv);
144  std::pair<DDPartSelection*,DDsvalues_type*> pssv(ps,sv);
145  result.push_back(std::make_pair(logp,pssv));
146  }
147  }
148  }
DDsvalues_type specifics_
Definition: Specific.h:54
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
partsel_type partSelections_
Definition: Specific.h:55

Member Data Documentation

bool DDI::Specific::doRegex_
protected

Definition at line 57 of file Specific.h.

Referenced by createPartSelections().

partsel_type DDI::Specific::partSelections_
protected

Definition at line 55 of file Specific.h.

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

DDsvalues_type DDI::Specific::specifics_
protected

Definition at line 54 of file Specific.h.

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

bool DDI::Specific::valid_
protected

Definition at line 56 of file Specific.h.