#include <Specific.h>
Public Types | |
typedef std::vector < DDPartSelection > | partsel_type |
typedef std::vector< std::string > | selectors_type |
Public Member Functions | |
std::pair< bool, DDExpandedView > | node () const |
gives the geometrical history of a fully specified PartSelector | |
bool | nodes (DDNodes &) const |
CURRENTLY NOT IMPLEMENTED! | |
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_type & | specifics () 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_ |
Definition at line 19 of file Specific.h.
typedef std::vector<DDPartSelection> DDI::Specific::partsel_type |
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.
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().
: specifics_(specs), partSelections_(0), valid_(false), doRegex_(doRegex) { std::vector<std::string>::const_iterator it = selections.begin(); for(; it != selections.end(); ++it) { createPartSelections(*it); } }
DDI::Specific::Specific | ( | const std::vector< DDPartSelection > & | selections, |
const DDsvalues_type & | specs | ||
) |
Definition at line 25 of file Specific.cc.
: specifics_(specs), partSelections_(selections), valid_(false), doRegex_(false) { }
DDI::Specific::~Specific | ( | ) |
Definition at line 206 of file Specific.cc.
{ // DDsvalues_type::iterator it = specifics_.begin(); // for (; it != specifics_.end(); ++it) { // it->second.clear(); // } }
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().
{ //static int count =0; //++count; //edm::LogInfo ("Specific") << "count=" << count << " " << flush; if (!selv.size()) { // create one, no entry yet! selv.push_back(DDPartSelection()); } typedef std::vector<DDLogicalPart>::size_type lpv_sizetype; typedef std::vector<DDPartSelection>::size_type ps_sizetype; ps_sizetype ps_sz = selv.size(); lpv_sizetype lpv_sz = lpv.size(); //edm::LogInfo ("Specific") << "lpv_sz=" << lpv_sz << std::endl; lpv_sizetype lpv_i = 0; std::vector<DDPartSelection> result; for (; lpv_i < lpv_sz; ++lpv_i) { std::vector<DDPartSelection>::const_iterator ps_it = selv.begin(); for (; ps_it != selv.end(); ++ps_it) { result.push_back(*ps_it); } } //edm::LogInfo ("Specific") << "result-size=" << result.size() << std::endl; //ps_sizetype ps_sz = result.size(); ps_sizetype ps_i = 0; for(lpv_i=0; lpv_i < lpv_sz; ++lpv_i) { for(ps_i = ps_sz*lpv_i; ps_i < ps_sz*(lpv_i+1); ++ps_i) { result[ps_i].push_back(DDPartSelectionLevel(lpv[lpv_i],copyno,st)); } } selv = result; }
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_, and groupFilesInBlocks::temp.
Referenced by Specific().
{ std::vector<DDPartSelRegExpLevel> regv; std::vector<DDPartSelection> temp; DDTokenize2(selString,regv); if (!regv.size()) throw cms::Exception("DDException") << "Could not evaluate the selection-std::string ->" << selString << "<-"; std::vector<DDPartSelRegExpLevel>::const_iterator it = regv.begin(); std::pair<bool,std::string> res; for (; it != regv.end(); ++it) { std::vector<DDLogicalPart> lpv; res = DDIsValid(it->ns_,it->nm_,lpv,doRegex_); if (!res.first) { std::string msg("Could not process q-name of a DDLogicalPart, reason:\n"+res.second); msg+="\nSpecPar selection is:\n" + selString + "\n"; //throw cms::Exception("DDException") << "Could not process q-name of a DDLogicalPart, reason:\n" << res.second; edm::LogError("Specific") << msg; break; //EXIT for loop } //edm::LogInfo ("Specific") << "call addSelectionLevel" << std::endl; addSelectionLevel(lpv,it->copyno_,it->selectionType_,temp); } if ( res.first ) { // i.e. it wasn't "thrown" out of the loop std::vector<DDPartSelection>::const_iterator iit = temp.begin(); partSelections_.reserve(temp.size() + partSelections_.size()); for (; iit != temp.end(); ++iit) { partSelections_.push_back(*iit); //edm::LogInfo ("Specific") << *iit << std::endl; } } }
std::pair< bool, DDExpandedView > DDI::Specific::node | ( | ) | const |
gives the geometrical history of a fully specified PartSelector
node() will only work, if
Definition at line 161 of file Specific.cc.
References trackerHits::c, DDExpandedView::copyno(), ddanyposp, ddchildposp, alignCSCRings::e, DDExpandedView::firstChild(), DDExpandedView::logicalPart(), DDExpandedView::nextSibling(), partSelections_, and query::result.
{ DDCompactView c; DDExpandedView e(c); if (partSelections_.size() != 1) { edm::LogError("Specific") << " >> more or less than one part-selector, currently NOT SUPPORTED! <<" << std::endl; return std::make_pair(false,e); } const DDPartSelection & ps = partSelections_[0]; DDPartSelection::const_iterator it = ps.begin(); DDPartSelection::const_iterator ed = ps.end(); if ( (it != ed) && ( it->selectionType_ != ddanyposp) ) { edm::LogError("Specific") << " >> part-selector must start with //Name[no] ! << " << std::endl; return std::make_pair(false,e); } ++it; for (; it != ps.end(); ++it) { if ( it->selectionType_ != ddchildposp ) { edm::LogError("Specific") << " >> part-selector must be a concatenation of direct children\n" << " including their copy-number only, CURRENT LIMITATION! <<" << std::endl; return std::make_pair(false,e); } } it = ps.begin(); bool result = true; for (; it != ed; ++it) { while(result) { if( (it->copyno_ == e.copyno()) && (it->lp_ == e.logicalPart())) { break; } else { result = e.nextSibling(); } } if ((ed-it)>1) { result = e.firstChild(); } } return std::make_pair(result,e); }
bool DDI::Specific::nodes | ( | DDNodes & | ) | const [inline] |
const std::vector< DDPartSelection > & DDI::Specific::selection | ( | ) | const |
const DDsvalues_type& DDI::Specific::specifics | ( | void | ) | const [inline] |
void DDI::Specific::stream | ( | std::ostream & | os | ) | const |
Definition at line 104 of file Specific.cc.
References i, DDValue::isEvaluated(), DDValue::name(), partSelections_, alignCSCRings::s, DDValue::size(), specifics_, DDValue::strings(), and v.
{ // os << " no output available yet, sorry. "; os << " Size: " << specifics_.size() << std::endl; os << "\tSelections:" << std::endl; partsel_type::const_iterator pit(partSelections_.begin()), pend(partSelections_.end()); for (;pit!=pend;++pit) { os << *pit << std::endl; } DDsvalues_type::const_iterator vit(specifics_.begin()), ved(specifics_.end()); for (;vit!=ved;++vit) { const DDValue & v = vit->second; os << "\tParameter name= \"" << v.name() << "\" " << std::endl; os << "\t\t Value pairs: " << std::endl; size_t s=v.size(); size_t i=0; if ( v.isEvaluated() ) { for (; i<s; ++i) { os << "\t\t\t\"" << v[i].first << "\"" << ", " << v[i].second << std::endl; } } else { // v is not evaluated const std::vector<std::string>& vs = v.strings(); for (; i<s; ++i) { os << "\t\t\t\"" << vs[i] << "\"" << ", not evaluated" << std::endl; } } } }
void DDI::Specific::tokenize | ( | ) |
void DDI::Specific::updateLogicalPart | ( | std::vector< std::pair< DDLogicalPart, std::pair< DDPartSelection *, DDsvalues_type * > > > & | result | ) | const |
Definition at line 134 of file Specific.cc.
References partSelections_, query::result, and specifics_.
{ if (partSelections_.size()) { partsel_type::const_iterator it = partSelections_.begin(); DDsvalues_type* sv = const_cast<DDsvalues_type*>(&specifics_); for (; it != partSelections_.end(); ++it) { DDLogicalPart logp = it->back().lp_; /*if (!logp.isDefined().second) { throw DDException("Specific::updateLogicalPart(..): LogicalPart not defined, name=" + std::string(logp.ddname())); }*/ DDPartSelection * ps = const_cast<DDPartSelection*>(&(*it)); assert(ps); assert(sv); std::pair<DDPartSelection*,DDsvalues_type*> pssv(ps,sv); result.push_back(std::make_pair(logp,pssv)); } } }
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.