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), solid_(s), cat_(c), weight_(0), specifics_(0), hasDDValue_(1,false)
15 { }
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 30 of file LogicalPart.cc.

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

31 {
32  if ( ! (s.first && s.second) ) {
33  // FIXME
34  std::cerr << "LogicalPart::addSpecific error pointer 0 "
35  << s.first << "," << s.second << std::endl;
36  return;
37  }
38  specifics_.push_back(s);
39  for( const auto& it : *s.second ) {
40  unsigned int id = it.first;
41  if ( id < hasDDValue_.size() ) {
42  hasDDValue_[id] = true;
43  }
44  else {
45  hasDDValue_.resize(id+1,false);
46  hasDDValue_[id] = true;
47  }
48  }
49 }
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 21 of file LogicalPart.cc.

References cat_.

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

Definition at line 51 of file LogicalPart.cc.

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

Referenced by attachedSpecifics().

52 {
53  bool result = false;
54  unsigned int id = v.id();
55  if ( id < hasDDValue_.size()) {
56  result = hasDDValue_[id];
57  }
58  return result;
59 }
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 17 of file LogicalPart.cc.

References material_.

Referenced by stream().

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

Definition at line 86 of file LogicalPart.cc.

References mergedSpecificsV().

86  {
87  DDsvalues_type merged;
88  mergedSpecificsV(merged);
89  return merged;
90 }
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:92
void LogicalPart::mergedSpecificsV ( DDsvalues_type res) const

Definition at line 92 of file LogicalPart.cc.

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

Referenced by mergedSpecifics().

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

Definition at line 61 of file LogicalPart.cc.

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

62 {
63  std::vector<std::pair<const DDPartSelection*, const DDsvalues_type* > >::iterator it =
64  std::find(specifics_.begin(),specifics_.end(),s);
65  specifics_.erase(it);
66 }
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 19 of file LogicalPart.cc.

References solid_.

Referenced by stream().

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

Definition at line 68 of file LogicalPart.cc.

References mps_fire::result, and specificsV().

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

Definition at line 76 of file LogicalPart.cc.

References ddanylogp, and specifics_.

Referenced by mergedSpecificsV(), and specifics().

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

Definition at line 23 of file LogicalPart.cc.

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

Referenced by attachedSpecifics().

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

Definition at line 28 of file LogicalPart.cc.

References weight_.

Referenced by attachedSpecifics().

28 { 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().