#include <DetectorDescription/Core/src/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< DDPartSelection > &selections, const DDsvalues_type &specs) | |
Specific (const std::vector< std::string > &selections, const DDsvalues_type &specs, bool doRegex=true) | |
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 12 of file Specific.cc.
References createPartSelections(), and it.
00015 : specifics_(specs), 00016 partSelections_(0), 00017 valid_(false), 00018 doRegex_(doRegex) 00019 { 00020 std::vector<std::string>::const_iterator it = selections.begin(); 00021 for(; it != selections.end(); ++it) { 00022 createPartSelections(*it); 00023 } 00024 }
DDI::Specific::Specific | ( | const std::vector< DDPartSelection > & | selections, | |
const DDsvalues_type & | specs | |||
) |
Definition at line 26 of file Specific.cc.
00028 : specifics_(specs), partSelections_(selections), valid_(false), doRegex_(false) 00029 { }
DDI::Specific::~Specific | ( | ) |
Definition at line 207 of file Specific.cc.
References it, and specifics_.
00208 { 00209 DDsvalues_type::iterator it = specifics_.begin(); 00210 for (; it != specifics_.end(); ++it) { 00211 it->second.clear(); 00212 } 00213 }
void DDI::Specific::addSelectionLevel | ( | std::vector< DDLogicalPart > & | lpv, | |
int | copyno, | |||
ddselection_type | st, | |||
std::vector< DDPartSelection > & | selv | |||
) | [protected] |
Definition at line 66 of file Specific.cc.
References HLT_VtxMuL3::result.
Referenced by createPartSelections().
00068 { 00069 //static int count =0; 00070 //++count; 00071 //edm::LogInfo ("Specific") << "count=" << count << " " << flush; 00072 if (!selv.size()) { // create one, no entry yet! 00073 selv.push_back(DDPartSelection()); 00074 } 00075 typedef std::vector<DDLogicalPart>::size_type lpv_sizetype; 00076 typedef std::vector<DDPartSelection>::size_type ps_sizetype; 00077 ps_sizetype ps_sz = selv.size(); 00078 lpv_sizetype lpv_sz = lpv.size(); 00079 //edm::LogInfo ("Specific") << "lpv_sz=" << lpv_sz << std::endl; 00080 lpv_sizetype lpv_i = 0; 00081 std::vector<DDPartSelection> result; 00082 for (; lpv_i < lpv_sz; ++lpv_i) { 00083 std::vector<DDPartSelection>::const_iterator ps_it = selv.begin(); 00084 for (; ps_it != selv.end(); ++ps_it) { 00085 result.push_back(*ps_it); 00086 } 00087 } 00088 //edm::LogInfo ("Specific") << "result-size=" << result.size() << std::endl; 00089 //ps_sizetype ps_sz = result.size(); 00090 ps_sizetype ps_i = 0; 00091 for(lpv_i=0; lpv_i < lpv_sz; ++lpv_i) { 00092 for(ps_i = ps_sz*lpv_i; ps_i < ps_sz*(lpv_i+1); ++ps_i) { 00093 result[ps_i].push_back(DDPartSelectionLevel(lpv[lpv_i],copyno,st)); 00094 } 00095 } 00096 selv = result; 00097 }
void DDI::Specific::createPartSelections | ( | const std::string & | selString | ) | [protected] |
Definition at line 31 of file Specific.cc.
References addSelectionLevel(), DDIsValid(), DDTokenize2(), doRegex_, it, alivecheck_mergeAndRegister::msg, partSelections_, res, and pyDBSRunClass::temp.
Referenced by Specific().
00032 { 00033 00034 std::vector<DDPartSelRegExpLevel> regv; 00035 std::vector<DDPartSelection> temp; 00036 DDTokenize2(selString,regv); 00037 00038 if (!regv.size()) throw DDException("Could not evaluate the selection-std::string ->" + selString + "<-"); 00039 std::vector<DDPartSelRegExpLevel>::const_iterator it = regv.begin(); 00040 std::pair<bool,std::string> res; 00041 for (; it != regv.end(); ++it) { 00042 std::vector<DDLogicalPart> lpv; 00043 res = DDIsValid(it->ns_,it->nm_,lpv,doRegex_); 00044 if (!res.first) { 00045 std::string msg("Could not process q-name of a DDLogicalPart, reason:\n"+res.second); 00046 msg+="\nSpecPar selection is:\n" + selString + "\n"; 00047 //throw DDException("Could not process q-name of a DDLogicalPart, reason:\n"+res.second); 00048 edm::LogError("Specific") << msg; 00049 break; //EXIT for loop 00050 } 00051 //edm::LogInfo ("Specific") << "call addSelectionLevel" << std::endl; 00052 addSelectionLevel(lpv,it->copyno_,it->selectionType_,temp); 00053 } 00054 if ( res.first ) { // i.e. it wasn't "thrown" out of the loop 00055 std::vector<DDPartSelection>::const_iterator iit = temp.begin(); 00056 partSelections_.reserve(temp.size() + partSelections_.size()); 00057 for (; iit != temp.end(); ++iit) { 00058 partSelections_.push_back(*iit); 00059 //edm::LogInfo ("Specific") << *iit << std::endl; 00060 } 00061 } 00062 }
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 162 of file Specific.cc.
References c, DDExpandedView::copyno(), ddanyposp, ddchildposp, e, lat::endl(), DDExpandedView::firstChild(), it, DDExpandedView::logicalPart(), DDExpandedView::nextSibling(), partSelections_, and HLT_VtxMuL3::result.
00163 { 00164 DDCompactView c; 00165 DDExpandedView e(c); 00166 00167 if (partSelections_.size() != 1) { 00168 edm::LogError("Specific") << " >> more or less than one part-selector, currently NOT SUPPORTED! <<" << std::endl; 00169 return std::make_pair(false,e); 00170 } 00171 const DDPartSelection & ps = partSelections_[0]; 00172 00173 DDPartSelection::const_iterator it = ps.begin(); 00174 DDPartSelection::const_iterator ed = ps.end(); 00175 if ( (it != ed) && ( it->selectionType_ != ddanyposp) ) { 00176 edm::LogError("Specific") << " >> part-selector must start with //Name[no] ! << " << std::endl; 00177 return std::make_pair(false,e); 00178 } 00179 ++it; 00180 for (; it != ps.end(); ++it) { 00181 if ( it->selectionType_ != ddchildposp ) { 00182 edm::LogError("Specific") << " >> part-selector must be a concatenation of direct children\n" 00183 << " including their copy-number only, CURRENT LIMITATION! <<" << std::endl; 00184 return std::make_pair(false,e); 00185 } 00186 } 00187 00188 it = ps.begin(); 00189 bool result = true; 00190 for (; it != ed; ++it) { 00191 while(result) { 00192 if( (it->copyno_ == e.copyno()) && (it->lp_ == e.logicalPart())) { 00193 break; 00194 } 00195 else { 00196 result = e.nextSibling(); 00197 } 00198 } 00199 if ((ed-it)>1) { 00200 result = e.firstChild(); 00201 } 00202 } 00203 return std::make_pair(result,e); 00204 }
const std::vector< DDPartSelection > & DDI::Specific::selection | ( | ) | const |
Definition at line 99 of file Specific.cc.
References partSelections_.
00100 { 00101 return partSelections_; 00102 }
const DDsvalues_type& DDI::Specific::specifics | ( | ) | const [inline] |
void DDI::Specific::stream | ( | std::ostream & | os | ) | const |
Definition at line 105 of file Specific.cc.
References lat::endl(), i, DDValue::isEvaluated(), DDValue::name(), partSelections_, s, DDValue::size(), specifics_, DDValue::strings(), and v.
00106 { 00107 // os << " no output available yet, sorry. "; 00108 os << " Size: " << specifics_.size() << std::endl; 00109 os << "\tSelections:" << std::endl; 00110 partsel_type::const_iterator pit(partSelections_.begin()), pend(partSelections_.end()); 00111 for (;pit!=pend;++pit) { 00112 os << *pit << std::endl; 00113 } 00114 00115 DDsvalues_type::const_iterator vit(specifics_.begin()), ved(specifics_.end()); 00116 for (;vit!=ved;++vit) { 00117 const DDValue & v = vit->second; 00118 os << "\tParameter name= \"" << v.name() << "\" " << std::endl; 00119 os << "\t\t Value pairs: " << std::endl; 00120 size_t s=v.size(); 00121 size_t i=0; 00122 if ( v.isEvaluated() ) { 00123 for (; i<s; ++i) { 00124 os << "\t\t\t\"" << v[i].first << "\"" << ", " << v[i].second << std::endl; 00125 } 00126 } else { // v is not evaluated 00127 const std::vector<std::string>& vs = v.strings(); 00128 for (; i<s; ++i) { 00129 os << "\t\t\t\"" << vs[i] << "\"" << ", not evaluated" << std::endl; 00130 } 00131 } 00132 } 00133 }
void DDI::Specific::tokenize | ( | ) |
void DDI::Specific::updateLogicalPart | ( | std::vector< std::pair< DDLogicalPart, std::pair< DDPartSelection *, DDsvalues_type * > > > & | result | ) | const |
Definition at line 135 of file Specific.cc.
References it, partSelections_, HLT_VtxMuL3::result, specifics_, and sv.
00136 { 00137 if (partSelections_.size()) { 00138 partsel_type::const_iterator it = partSelections_.begin(); 00139 DDsvalues_type* sv = const_cast<DDsvalues_type*>(&specifics_); 00140 for (; it != partSelections_.end(); ++it) { 00141 DDLogicalPart logp = it->back().lp_; 00142 /*if (!logp.isDefined().second) { 00143 throw DDException("Specific::updateLogicalPart(..): LogicalPart not defined, name=" + std::string(logp.ddname())); 00144 }*/ 00145 DDPartSelection * ps = const_cast<DDPartSelection*>(&(*it)); 00146 assert(ps); 00147 assert(sv); 00148 std::pair<DDPartSelection*,DDsvalues_type*> pssv(ps,sv); 00149 result.push_back(std::make_pair(logp,pssv)); 00150 } 00151 } 00152 }
bool DDI::Specific::doRegex_ [protected] |
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(), updateLogicalPart(), and ~Specific().
bool DDI::Specific::valid_ [protected] |
Definition at line 56 of file Specific.h.