CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DDI::LogicalPart Class Reference

#include <LogicalPart.h>

Public Member Functions

void addSpecifics (const std::pair< DDPartSelection *, DDsvalues_type * > &)
 
const std::vector< std::pair
< DDPartSelection
*, 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< DDPartSelection *, 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
< DDPartSelection
*, DDsvalues_type * > > 
specifics_
 
std::map< DDValue, std::vector
< DDPartSelection * > > 
valToParsel_
 
double weight_
 

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), solid_(s), cat_(c), weight_(0), specifics_(0), hasDDValue_(1,false)
15 { }
std::vector< bool > hasDDValue_
Definition: LogicalPart.h:48
std::vector< std::pair< DDPartSelection *, DDsvalues_type * > > specifics_
Definition: LogicalPart.h:47
DDMaterial material_
Definition: LogicalPart.h:40
DDEnums::Category cat_
Definition: LogicalPart.h:42

Member Function Documentation

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

Definition at line 30 of file LogicalPart.cc.

References dtNoiseDBValidation_cfg::cerr, DCOUT, hasDDValue_, DDValue::name(), specifics_, and DDValue::strings().

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  DDsvalues_type::const_iterator it = s.second->begin();
40  DDsvalues_type::const_iterator ed = s.second->end();
41  for (; it != ed; ++it) {
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  DCOUT('S', "hasValue_.size()=" << hasDDValue_.size() << " DDValue_id=" << id << std::flush
52  << " DDValue_name=" << DDValue(id).name() << std::flush
53  << " DDValue_string=" << DDValue(id).strings().size() );
54  }
55 }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:64
std::vector< bool > hasDDValue_
Definition: LogicalPart.h:48
std::vector< std::pair< DDPartSelection *, DDsvalues_type * > > specifics_
Definition: LogicalPart.h:47
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
Definition: DDValue.h:71
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
const std::vector<std::pair< DDPartSelection*, DDsvalues_type* > >& DDI::LogicalPart::attachedSpecifics ( void  ) const
inline

Definition at line 34 of file LogicalPart.h.

References specifics_.

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

Definition at line 22 of file LogicalPart.cc.

References cat_.

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

Definition at line 57 of file LogicalPart.cc.

References hasDDValue_, DDValue::id(), and query::result.

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

Definition at line 20 of file LogicalPart.cc.

References material_.

Referenced by stream().

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

Definition at line 96 of file LogicalPart.cc.

References mergedSpecificsV().

96  {
97  DDsvalues_type merged;
98  mergedSpecificsV(merged);
99  return merged;
100 }
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:19
void mergedSpecificsV(DDsvalues_type &res) const
Definition: LogicalPart.cc:103
void LogicalPart::mergedSpecificsV ( DDsvalues_type res) const

Definition at line 103 of file LogicalPart.cc.

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

Referenced by mergedSpecifics().

103  {
104  merged.clear();
105  std::vector<const DDsvalues_type *> unmerged; specificsV(unmerged);
106  if (unmerged.size()==1) {
107  merged = *(unmerged[0]);
108  }
109  else if (unmerged.size()>1) {
110  std::vector<const DDsvalues_type *>::const_iterator it = unmerged.begin();
111  std::vector<const DDsvalues_type *>::const_iterator ed = unmerged.end();
112  for (; it != ed; ++it) {
113  merge(merged, **it);
114  }
115  }
116 }
void specificsV(std::vector< const DDsvalues_type * > &result) const
Definition: LogicalPart.cc:83
void LogicalPart::removeSpecifics ( const std::pair< DDPartSelection *, DDsvalues_type * > &  s)

Definition at line 67 of file LogicalPart.cc.

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

68 {
69  std::vector<std::pair<DDPartSelection*,DDsvalues_type* > >::iterator it =
70  std::find(specifics_.begin(),specifics_.end(),s);
71  specifics_.erase(it);
72 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::pair< DDPartSelection *, DDsvalues_type * > > specifics_
Definition: LogicalPart.h:47
const DDSolid & LogicalPart::solid ( void  ) const

Definition at line 21 of file LogicalPart.cc.

References solid_.

Referenced by stream().

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

Definition at line 75 of file LogicalPart.cc.

References query::result, and specificsV().

76 {
77  std::vector<const DDsvalues_type*> result;
78  specificsV(result);
79  return result;
80 
81 }
tuple result
Definition: query.py:137
void specificsV(std::vector< const DDsvalues_type * > &result) const
Definition: LogicalPart.cc:83
void LogicalPart::specificsV ( std::vector< const DDsvalues_type * > &  result) const

Definition at line 83 of file LogicalPart.cc.

References ddanylogp, and specifics_.

Referenced by mergedSpecificsV(), and specifics().

84 {
85  typedef std::vector<std::pair<DDPartSelection*,DDsvalues_type* > > sp_type;
86  sp_type::const_iterator it = specifics_.begin();
87  sp_type::const_iterator ed = specifics_.end();
88  for (; it != ed; ++it) {
89  DDPartSelection & ps = *(it->first);
90  if (ps.size()==1 && ps[0].selectionType_==ddanylogp) {
91  result.push_back(it->second);
92  }
93  }
94 }
std::vector< std::pair< DDPartSelection *, DDsvalues_type * > > specifics_
Definition: LogicalPart.h:47
tuple result
Definition: query.py:137
void LogicalPart::stream ( std::ostream &  os)

Definition at line 23 of file LogicalPart.cc.

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

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

Member Data Documentation

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

Definition at line 42 of file LogicalPart.h.

Referenced by category().

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

Definition at line 48 of file LogicalPart.h.

Referenced by addSpecifics(), and hasDDValue().

DDMaterial DDI::LogicalPart::material_
private

Definition at line 40 of file LogicalPart.h.

Referenced by material().

DDSolid DDI::LogicalPart::solid_
private

Definition at line 41 of file LogicalPart.h.

Referenced by solid().

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

Definition at line 47 of file LogicalPart.h.

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

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

Definition at line 46 of file LogicalPart.h.

double DDI::LogicalPart::weight_
private

Definition at line 43 of file LogicalPart.h.

Referenced by weight().