CMS 3D CMS Logo

LogicalPart.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <memory>
3 
8 
9 using DDI::LogicalPart;
10 
11 LogicalPart::LogicalPart(const DDMaterial& m, const DDSolid& s, DDEnums::Category c)
12  : material_(m), solid_(s), cat_(c), specifics_(0), hasDDValue_(1, false) {}
13 
14 const DDMaterial& LogicalPart::material() const { return material_; }
15 
16 const DDSolid& LogicalPart::solid() const { return solid_; }
17 
19 
20 void LogicalPart::stream(std::ostream& os) {
21  os << std::endl << " mat=" << material().ddname() << std::endl << " solid=" << solid();
22 }
23 
24 void LogicalPart::addSpecifics(const std::pair<const DDPartSelection*, const DDsvalues_type*>& s) {
25  if (!(s.first && s.second)) {
26  // FIXME
27  std::cerr << "LogicalPart::addSpecific error pointer 0 " << s.first << "," << s.second << std::endl;
28  return;
29  }
30  specifics_.emplace_back(s);
31  for (const auto& it : *s.second) {
32  unsigned int id = it.first;
33  if (id < hasDDValue_.size()) {
34  hasDDValue_[id] = true;
35  } else {
36  hasDDValue_.resize(id + 1, false);
37  hasDDValue_[id] = true;
38  }
39  }
40 }
41 
42 bool LogicalPart::hasDDValue(const DDValue& v) const {
43  bool result = false;
44  unsigned int id = v.id();
45  if (id < hasDDValue_.size()) {
47  }
48  return result;
49 }
50 
51 void LogicalPart::removeSpecifics(const std::pair<const DDPartSelection*, const DDsvalues_type*>& s) {
52  std::vector<std::pair<const DDPartSelection*, const DDsvalues_type*> >::iterator it =
53  std::find(specifics_.begin(), specifics_.end(), s);
54  specifics_.erase(it);
55 }
56 
57 std::vector<const DDsvalues_type*> LogicalPart::specifics() const {
58  std::vector<const DDsvalues_type*> result;
60  return result;
61 }
62 
63 void LogicalPart::specificsV(std::vector<const DDsvalues_type*>& result) const {
64  for (const auto& it : specifics_) {
65  const DDPartSelection& ps = *(it.first);
66  if (ps.size() == 1 && ps[0].selectionType_ == ddanylogp) {
67  result.emplace_back(it.second);
68  }
69  }
70 }
71 
73  DDsvalues_type merged;
74  mergedSpecificsV(merged);
75  return merged;
76 }
77 
79  merged.clear();
80  std::vector<const DDsvalues_type*> unmerged;
81  specificsV(unmerged);
82  if (unmerged.size() == 1) {
83  merged = *(unmerged[0]);
84  } else if (unmerged.size() > 1) {
85  for (const auto& it : unmerged) {
86  merge(merged, *it);
87  }
88  }
89 }
DDI::LogicalPart::solid
const DDSolid & solid() const
Definition: LogicalPart.cc:16
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
DDI::LogicalPart::solid_
DDSolid solid_
Definition: LogicalPart.h:39
DDI::LogicalPart::mergedSpecificsV
void mergedSpecificsV(DDsvalues_type &res) const
Definition: LogicalPart.cc:78
DDI::LogicalPart::hasDDValue_
std::vector< bool > hasDDValue_
Definition: LogicalPart.h:44
DDPartSelection
Definition: DDPartSelection.h:37
findQualityFiles.v
v
Definition: findQualityFiles.py:179
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
DDI::LogicalPart::specificsV
void specificsV(std::vector< const DDsvalues_type * > &result) const
Definition: LogicalPart.cc:63
DDI::LogicalPart::material
const DDMaterial & material() const
Definition: LogicalPart.cc:14
DDPartSelection.h
DDI::LogicalPart::category
DDEnums::Category category() const
Definition: LogicalPart.cc:18
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDI::LogicalPart::hasDDValue
bool hasDDValue(const DDValue &) const
Definition: LogicalPart.cc:42
DDI::LogicalPart::material_
DDMaterial material_
Definition: LogicalPart.h:38
LogicalPart.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
DDEnums::Category
Category
Definition: DDEnums.h:7
DDBase::ddname
const N & ddname() const
Definition: DDBase.h:61
DDI::LogicalPart::specifics_
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:43
ddanylogp
Definition: DDPartSelection.h:15
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
DDI::LogicalPart::stream
void stream(std::ostream &)
Definition: LogicalPart.cc:20
DDValue
Definition: DDValue.h:21
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
DDI::LogicalPart::cat_
DDEnums::Category cat_
Definition: LogicalPart.h:40
DDName.h
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDI::LogicalPart::mergedSpecifics
DDsvalues_type mergedSpecifics() const
Definition: LogicalPart.cc:72
DDI::LogicalPart
Definition: LogicalPart.h:18
mps_fire.result
result
Definition: mps_fire.py:311
MatrixUtil.merge
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:201
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
DDI::LogicalPart::specifics
std::vector< const DDsvalues_type * > specifics() const
Definition: LogicalPart.cc:57
DDI::LogicalPart::removeSpecifics
void removeSpecifics(const std::pair< const DDPartSelection *, const DDsvalues_type * > &)
Definition: LogicalPart.cc:51
DDI::LogicalPart::addSpecifics
void addSpecifics(const std::pair< const DDPartSelection *, const DDsvalues_type * > &)
Definition: LogicalPart.cc:24