CMS 3D CMS Logo

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< DDPartSelection > &selections, const DDsvalues_type &specs)
 
 Specific (const std::vector< std::string > &selections, const DDsvalues_type &specs, bool doRegex=true)
 
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

◆ Specific() [1/2]

DDI::Specific::Specific ( const std::vector< std::string > &  selections,
const DDsvalues_type specs,
bool  doRegex = true 
)

Definition at line 20 of file Specific.cc.

21  : specifics_(specs), partSelections_(0), valid_(false), doRegex_(doRegex) {
22  for (const auto& it : selections) {
24  }
25  }

References createPartSelections(), and clusterbigeventsdebugger_cfi::selections.

◆ Specific() [2/2]

DDI::Specific::Specific ( const std::vector< DDPartSelection > &  selections,
const DDsvalues_type specs 
)

Definition at line 27 of file Specific.cc.

Member Function Documentation

◆ addSelectionLevel()

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.

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  }

References mps_fire::result.

Referenced by createPartSelections().

◆ createPartSelections()

void DDI::Specific::createPartSelections ( const std::string &  selString)
protected

Definition at line 30 of file Specific.cc.

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  }

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

Referenced by Specific().

◆ node()

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.

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  }

References c, ddanyposp, ddchildposp, MillePedeFileConverter_cfg::e, partSelections_, and mps_fire::result.

◆ selection()

const std::vector< DDPartSelection > & DDI::Specific::selection ( ) const

Definition at line 87 of file Specific.cc.

87 { return partSelections_; }

References partSelections_.

Referenced by trackingPlots.Iteration::modules().

◆ specifics()

const DDsvalues_type& DDI::Specific::specifics ( void  ) const
inline

Definition at line 33 of file Specific.h.

33 { return specifics_; }

References specifics_.

◆ stream()

void DDI::Specific::stream ( std::ostream &  os) const

Definition at line 89 of file Specific.cc.

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  }

References mps_fire::i, partSelections_, alignCSCRings::s, specifics_, and findQualityFiles::v.

◆ tokenize()

void DDI::Specific::tokenize ( )

◆ updateLogicalPart()

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.

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  }

References cms::cuda::assert(), partSelections_, mps_fire::result, specifics_, and pfDeepBoostedJetPreprocessParams_cfi::sv.

Member Data Documentation

◆ doRegex_

bool DDI::Specific::doRegex_
protected

Definition at line 49 of file Specific.h.

Referenced by createPartSelections().

◆ partSelections_

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

Definition at line 47 of file Specific.h.

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

◆ specifics_

DDsvalues_type DDI::Specific::specifics_
protected

Definition at line 46 of file Specific.h.

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

◆ valid_

bool DDI::Specific::valid_
protected

Definition at line 48 of file Specific.h.

mps_fire.i
i
Definition: mps_fire.py:428
ddanyposp
Definition: DDPartSelection.h:16
HistogramManager_cfi.specs
specs
Definition: HistogramManager_cfi.py:83
cms::cuda::assert
assert(be >=bs)
DDPartSelection
Definition: DDPartSelection.h:37
mps_check.msg
tuple msg
Definition: mps_check.py:285
findQualityFiles.v
v
Definition: findQualityFiles.py:179
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DDI::Specific::specifics_
DDsvalues_type specifics_
Definition: Specific.h:46
alignCSCRings.s
s
Definition: alignCSCRings.py:92
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
ddchildposp
Definition: DDPartSelection.h:18
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
DDExpandedView
Provides an exploded view of the detector (tree-view)
Definition: DDExpandedView.h:41
DDI::Specific::valid_
bool valid_
Definition: Specific.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDPartSelectionLevel
Definition: DDPartSelection.h:30
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDI::Specific::createPartSelections
void createPartSelections(const std::string &selString)
Definition: Specific.cc:30
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
res
Definition: Electron.h:6
DDI::Specific::partSelections_
std::vector< DDPartSelection > partSelections_
Definition: Specific.h:47
DDI::Specific::doRegex_
bool doRegex_
Definition: Specific.h:49
DDValue
Definition: DDValue.h:21
DDI::Specific::addSelectionLevel
void addSelectionLevel(std::vector< DDLogicalPart > &lpv, int copyno, ddselection_type st, std::vector< DDPartSelection > &selv)
Definition: Specific.cc:59
DDIsValid
std::pair< bool, std::string > DDIsValid(const std::string &ns, const std::string &name, std::vector< DDLogicalPart > &result, bool doRegex=true)
Definition: DDLogicalPart.cc:248
clusterbigeventsdebugger_cfi.selections
selections
Definition: clusterbigeventsdebugger_cfi.py:10
DDTokenize2
void DDTokenize2(const std::string &selectionString, std::vector< DDPartSelRegExpLevel > &result)
Definition: DDPartSelection.cc:174
mps_fire.result
result
Definition: mps_fire.py:311
cms::Exception
Definition: Exception.h:70
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37