CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDI::LogicalPart Class Reference

#include <LogicalPart.h>

Public Member Functions

void addSpecifics (const std::pair< const DDPartSelection *, const DDsvalues_type * > &)
 
const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > & attachedSpecifics () const
 
DDEnums::Category category () const
 
bool hasDDValue (const DDValue &) const
 
 LogicalPart (const DDMaterial &, const DDSolid &, DDEnums::Category=DDEnums::unspecified)
 
const DDMaterialmaterial () const
 
DDsvalues_type mergedSpecifics () const
 
void mergedSpecificsV (DDsvalues_type &res) const
 
void removeSpecifics (const std::pair< const DDPartSelection *, const DDsvalues_type * > &)
 
const DDSolidsolid () const
 
std::vector< const DDsvalues_type * > specifics () const
 
void specificsV (std::vector< const DDsvalues_type * > &result) const
 
void stream (std::ostream &)
 

Private Attributes

DDEnums::Category cat_
 
std::vector< bool > hasDDValue_
 
DDMaterial material_
 
DDSolid solid_
 
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
 
std::map< DDValue, std::vector< DDPartSelection * > > valToParsel_
 

Detailed Description

Definition at line 18 of file LogicalPart.h.

Constructor & Destructor Documentation

LogicalPart::LogicalPart ( const DDMaterial m,
const DDSolid s,
DDEnums::Category  c = DDEnums::unspecified 
)

Definition at line 11 of file LogicalPart.cc.

14  : material_(m),
15  solid_(s),
16  cat_(c),
17  specifics_(0),
18  hasDDValue_( 1, false )
19 { }
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:44
std::vector< bool > hasDDValue_
Definition: LogicalPart.h:45
DDMaterial material_
Definition: LogicalPart.h:39
DDEnums::Category cat_
Definition: LogicalPart.h:41

Member Function Documentation

void LogicalPart::addSpecifics ( const std::pair< const DDPartSelection *, const DDsvalues_type * > &  s)

Definition at line 32 of file LogicalPart.cc.

References MessageLogger_cfi::cerr, hasDDValue_, triggerObjects_cff::id, and specifics_.

33 {
34  if ( ! (s.first && s.second) ) {
35  // FIXME
36  std::cerr << "LogicalPart::addSpecific error pointer 0 "
37  << s.first << "," << s.second << std::endl;
38  return;
39  }
40  specifics_.emplace_back(s);
41  for( const auto& it : *s.second ) {
42  unsigned int id = it.first;
43  if ( id < hasDDValue_.size() ) {
44  hasDDValue_[id] = true;
45  }
46  else {
47  hasDDValue_.resize(id+1,false);
48  hasDDValue_[id] = true;
49  }
50  }
51 }
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:44
std::vector< bool > hasDDValue_
Definition: LogicalPart.h:45
const std::vector<std::pair<const DDPartSelection*,const DDsvalues_type* > >& DDI::LogicalPart::attachedSpecifics ( void  ) const
inline

Definition at line 34 of file LogicalPart.h.

References hasDDValue(), specifics_, and stream().

34 { return specifics_; }
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:44
DDEnums::Category LogicalPart::category ( void  ) const

Definition at line 25 of file LogicalPart.cc.

References cat_.

25 { return cat_; }
DDEnums::Category cat_
Definition: LogicalPart.h:41
bool LogicalPart::hasDDValue ( const DDValue v) const

Definition at line 53 of file LogicalPart.cc.

References hasDDValue_, triggerObjects_cff::id, DDValue::id(), and mps_fire::result.

Referenced by attachedSpecifics().

54 {
55  bool result = false;
56  unsigned int id = v.id();
57  if ( id < hasDDValue_.size()) {
58  result = hasDDValue_[id];
59  }
60  return result;
61 }
unsigned int id(void) const
returns the ID of the DDValue
Definition: DDValue.h:48
std::vector< bool > hasDDValue_
Definition: LogicalPart.h:45
const DDMaterial & LogicalPart::material ( void  ) const

Definition at line 21 of file LogicalPart.cc.

References material_.

Referenced by stream().

21 { return material_; }
DDMaterial material_
Definition: LogicalPart.h:39
DDsvalues_type LogicalPart::mergedSpecifics ( void  ) const

Definition at line 88 of file LogicalPart.cc.

References mergedSpecificsV().

88  {
89  DDsvalues_type merged;
90  mergedSpecificsV(merged);
91  return merged;
92 }
void mergedSpecificsV(DDsvalues_type &res) const
Definition: LogicalPart.cc:94
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
void LogicalPart::mergedSpecificsV ( DDsvalues_type res) const

Definition at line 94 of file LogicalPart.cc.

References MatrixUtil::merge(), and specificsV().

Referenced by mergedSpecifics().

94  {
95  merged.clear();
96  std::vector<const DDsvalues_type *> unmerged;
97  specificsV(unmerged);
98  if (unmerged.size()==1) {
99  merged = *(unmerged[0]);
100  }
101  else if (unmerged.size()>1) {
102  for( const auto& it : unmerged ) {
103  merge(merged, *it);
104  }
105  }
106 }
void specificsV(std::vector< const DDsvalues_type * > &result) const
Definition: LogicalPart.cc:78
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:194
void LogicalPart::removeSpecifics ( const std::pair< const DDPartSelection *, const DDsvalues_type * > &  s)

Definition at line 63 of file LogicalPart.cc.

References spr::find(), alignCSCRings::s, and specifics_.

64 {
65  std::vector<std::pair<const DDPartSelection*, const DDsvalues_type* > >::iterator it =
66  std::find(specifics_.begin(),specifics_.end(),s);
67  specifics_.erase(it);
68 }
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:44
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const DDSolid & LogicalPart::solid ( void  ) const

Definition at line 23 of file LogicalPart.cc.

References solid_.

Referenced by stream().

23 { return solid_; }
std::vector< const DDsvalues_type * > LogicalPart::specifics ( void  ) const

Definition at line 70 of file LogicalPart.cc.

References mps_fire::result, and specificsV().

71 {
72  std::vector<const DDsvalues_type*> result;
73  specificsV(result);
74  return result;
75 
76 }
void specificsV(std::vector< const DDsvalues_type * > &result) const
Definition: LogicalPart.cc:78
void LogicalPart::specificsV ( std::vector< const DDsvalues_type * > &  result) const

Definition at line 78 of file LogicalPart.cc.

References ddanylogp, and specifics_.

Referenced by mergedSpecificsV(), and specifics().

79 {
80  for( const auto& it : specifics_ ) {
81  const DDPartSelection & ps = *(it.first);
82  if (ps.size()==1 && ps[0].selectionType_==ddanylogp) {
83  result.emplace_back(it.second);
84  }
85  }
86 }
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:44
void LogicalPart::stream ( std::ostream &  os)

Definition at line 27 of file LogicalPart.cc.

References DDBase< N, C >::ddname(), material(), and solid().

Referenced by attachedSpecifics().

28 {
29  os << std::endl << " mat=" << material().ddname() << std::endl << " solid=" << solid();
30 }
const DDMaterial & material() const
Definition: LogicalPart.cc:21
const DDSolid & solid() const
Definition: LogicalPart.cc:23
const N & ddname() const
Definition: DDBase.h:76

Member Data Documentation

DDEnums::Category DDI::LogicalPart::cat_
private

Definition at line 41 of file LogicalPart.h.

Referenced by category().

std::vector<bool> DDI::LogicalPart::hasDDValue_
private

Definition at line 45 of file LogicalPart.h.

Referenced by addSpecifics(), and hasDDValue().

DDMaterial DDI::LogicalPart::material_
private

Definition at line 39 of file LogicalPart.h.

Referenced by material().

DDSolid DDI::LogicalPart::solid_
private

Definition at line 40 of file LogicalPart.h.

Referenced by solid().

std::vector<std::pair<const DDPartSelection*, const DDsvalues_type* > > DDI::LogicalPart::specifics_
private

Definition at line 44 of file LogicalPart.h.

Referenced by addSpecifics(), attachedSpecifics(), removeSpecifics(), and specificsV().

std::map<DDValue, std::vector<DDPartSelection*> > DDI::LogicalPart::valToParsel_
private

Definition at line 43 of file LogicalPart.h.