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 &)
 
double & weight ()
 

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_
 
double weight_
 

Detailed Description

Definition at line 19 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  weight_(0),
18  specifics_(0),
19  hasDDValue_( 1, false )
20 { }
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:48
std::vector< bool > hasDDValue_
Definition: LogicalPart.h:49
DDMaterial material_
Definition: LogicalPart.h:41
DDEnums::Category cat_
Definition: LogicalPart.h:43

Member Function Documentation

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

Definition at line 35 of file LogicalPart.cc.

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

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

Definition at line 35 of file LogicalPart.h.

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

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

Definition at line 26 of file LogicalPart.cc.

References cat_.

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

Definition at line 56 of file LogicalPart.cc.

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

Referenced by attachedSpecifics().

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

Definition at line 22 of file LogicalPart.cc.

References material_.

Referenced by stream().

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

Definition at line 91 of file LogicalPart.cc.

References mergedSpecificsV().

91  {
92  DDsvalues_type merged;
93  mergedSpecificsV(merged);
94  return merged;
95 }
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
void mergedSpecificsV(DDsvalues_type &res) const
Definition: LogicalPart.cc:97
void LogicalPart::mergedSpecificsV ( DDsvalues_type res) const

Definition at line 97 of file LogicalPart.cc.

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

Referenced by mergedSpecifics().

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

Definition at line 66 of file LogicalPart.cc.

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

67 {
68  std::vector<std::pair<const DDPartSelection*, const DDsvalues_type* > >::iterator it =
69  std::find(specifics_.begin(),specifics_.end(),s);
70  specifics_.erase(it);
71 }
std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > specifics_
Definition: LogicalPart.h:48
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 24 of file LogicalPart.cc.

References solid_.

Referenced by stream().

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

Definition at line 73 of file LogicalPart.cc.

References mps_fire::result, and specificsV().

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

Definition at line 81 of file LogicalPart.cc.

References ddanylogp, and specifics_.

Referenced by mergedSpecificsV(), and specifics().

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

Definition at line 28 of file LogicalPart.cc.

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

Referenced by attachedSpecifics().

29 {
30  os << std::endl << " mat=" << material().ddname() << std::endl << " solid=" << solid();
31 }
const DDMaterial & material() const
Definition: LogicalPart.cc:22
const DDSolid & solid() const
Definition: LogicalPart.cc:24
const N & ddname() const
Definition: DDBase.h:80
double & LogicalPart::weight ( void  )

Definition at line 33 of file LogicalPart.cc.

References weight_.

Referenced by attachedSpecifics().

33 { return weight_; }

Member Data Documentation

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

Definition at line 43 of file LogicalPart.h.

Referenced by category().

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

Definition at line 49 of file LogicalPart.h.

Referenced by addSpecifics(), and hasDDValue().

DDMaterial DDI::LogicalPart::material_
private

Definition at line 41 of file LogicalPart.h.

Referenced by material().

DDSolid DDI::LogicalPart::solid_
private

Definition at line 42 of file LogicalPart.h.

Referenced by solid().

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

Definition at line 48 of file LogicalPart.h.

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

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

Definition at line 47 of file LogicalPart.h.

double DDI::LogicalPart::weight_
private

Definition at line 44 of file LogicalPart.h.

Referenced by weight().