CMS 3D CMS Logo

Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes

DDFilteredView Class Reference

#include <DDFilteredView.h>

List of all members.

Public Types

enum  log_op { AND, OR }
typedef DDExpandedView::nav_type nav_type

Public Member Functions

void addFilter (const DDFilter &, log_op op=AND)
void clearScope ()
 clears the scope; the full tree is available, depth=0
int copyno () const
 Copy number associated with the current node.
nav_type copyNumbers () const
 return the stack of copy numbers
 DDFilteredView (const DDCompactView &)
bool firstChild ()
 set the current node to the first child ...
const DDGeoHistorygeoHistory () const
 The list of ancestors up to the root-node of the current node.
bool goTo (const nav_type &)
const std::vector< DDGeoHistory > & history () const
const DDLogicalPartlogicalPart () const
 The logical-part of the current node in the filtered-view.
DDsvalues_type mergedSpecifics () const
void mergedSpecificsV (DDsvalues_type &merged) const
nav_type navPos () const
 return the stack of sibling numbers
bool next ()
 set current node to the next node in the filtered tree
bool nextSibling ()
 set the current node to the next sibling ...
bool parent ()
 set the current node to the parent node ...
void print ()
void reset ()
 clears the scope and sets the filtered view to its root-node
const DDRotationMatrixrotation () const
 The absolute rotation of the current node.
const DDGeoHistoryscope () const
 The scope of the expanded-view.
bool setScope (const DDGeoHistory &hist)
 sets the scope of the expanded view
std::vector< const
DDsvalues_type * > 
specifics () const
void specificsV (std::vector< const DDsvalues_type * > &result) const
 User specific data attached to the current node.
const DDTranslationtranslation () const
 The absolute translation of the current node.
 ~DDFilteredView ()

Private Types

typedef std::vector
< criterion_type
criteria_type
typedef DDFilter const * criterion_type
typedef std::vector< log_oplogops_type

Private Member Functions

bool filter ()

Private Attributes

criteria_type criteria_
DDExpandedView epv_
logops_type logOps_
std::vector< DDGeoHistoryparents_
const DDScopescope_

Detailed Description

Definition at line 11 of file DDFilteredView.h.


Member Typedef Documentation

typedef std::vector<criterion_type> DDFilteredView::criteria_type [private]

Definition at line 89 of file DDFilteredView.h.

typedef DDFilter const* DDFilteredView::criterion_type [private]

Definition at line 88 of file DDFilteredView.h.

typedef std::vector<log_op> DDFilteredView::logops_type [private]

Definition at line 90 of file DDFilteredView.h.

Definition at line 14 of file DDFilteredView.h.


Member Enumeration Documentation

Enumerator:
AND 
OR 

Definition at line 20 of file DDFilteredView.h.

{ AND, OR };

Constructor & Destructor Documentation

DDFilteredView::DDFilteredView ( const DDCompactView cpv)

Definition at line 7 of file DDFilteredView.cc.

References epv_, DDExpandedView::geoHistory(), and parents_.

 : epv_(cpv)
{
   parents_.push_back(epv_.geoHistory());
}
DDFilteredView::~DDFilteredView ( )

Definition at line 14 of file DDFilteredView.cc.

{ }

Member Function Documentation

void DDFilteredView::addFilter ( const DDFilter f,
log_op  op = AND 
)
void DDFilteredView::clearScope ( )

clears the scope; the full tree is available, depth=0

Definition at line 96 of file DDFilteredView.cc.

References DDExpandedView::clearScope(), epv_, DDExpandedView::geoHistory(), and parents_.

{
   epv_.clearScope();
   parents_.clear();
   parents_.push_back(epv_.geoHistory());
}
int DDFilteredView::copyno ( void  ) const

Copy number associated with the current node.

Definition at line 73 of file DDFilteredView.cc.

References DDExpandedView::copyno(), and epv_.

Referenced by MuonRPCDetLayerGeometryBuilder::buildLayer(), DTGeometryBuilderFromDDD::buildLayer(), and DTGeometryParsFromDD::insertLayer().

{
  return epv_.copyno();
}
DDFilteredView::nav_type DDFilteredView::copyNumbers ( ) const

return the stack of copy numbers

Definition at line 282 of file DDFilteredView.cc.

References DDExpandedView::copyNumbers(), and epv_.

Referenced by HcalNumberingFromDDD::loadGeometry(), and PrintGeomInfoAction::update().

{
  return epv_.copyNumbers();
}
bool DDFilteredView::filter ( ) [private]

Definition at line 249 of file DDFilteredView.cc.

References AND, criteria_, epv_, logOps_, OR, and query::result.

Referenced by next(), and nextSibling().

{
  bool result = true;
  //DCOUT('Q', "Filter: " << epv_.history_);
  criteria_type::const_iterator it = criteria_.begin();
  logops_type::const_iterator logOpIt = logOps_.begin();
  // loop over all user-supplied criteria (==filters)
  for (; it != criteria_.end(); ++it, ++logOpIt) {
    // avoid useless evaluations
    if ( (   result &&(*logOpIt)==OR ) ||
         ( (!result)&&(*logOpIt)==AND) ) continue; 
    
    bool locres = (*it)->accept(epv_);
    // need correction DCOUT('F', " Filter(" << criteria_.end()-it << ") accepted: " << epv_.geoHistory().back());
    
    // now do the logical-operations on the results encountered so far:
    if (*logOpIt==AND) { // AND
      result &= locres; 
    }
    else { // OR
      result |= locres;  
    }
  } // <-- loop over filters     
  return result;
}
bool DDFilteredView::firstChild ( )

set the current node to the first child ...

Algorithm:

  • find the first child matching the filter down the current subtree using next() which transverses already in the required hierarchical sequence ...

Definition at line 131 of file DDFilteredView.cc.

References DDExpandedView::depth_, epv_, DDExpandedView::geoHistory(), DDExpandedView::goToHistory(), next(), parents_, query::result, and DDExpandedView::scope_.

Referenced by ListIds::analyze(), CmsTrackerLevelBuilder::build(), CSCGeometryParsFromDD::build(), CmsDetConstruction::buildComponent(), RPCGeometryBuilderFromDDD::buildGeometry(), DTGeometryBuilderFromDDD::buildGeometry(), DTGeometryParsFromDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), MuonRPCDetLayerGeometryBuilder::buildLayer(), DTGeometryBuilderFromDDD::buildLayer(), CaloTrkProcessing::CaloTrkProcessing(), DDDCmsTrackerContruction::construct(), ECalSD::ECalSD(), MaterialBudgetHcalHistos::fillBeginJob(), HcalTB06BeamSD::getNames(), MaterialBudgetHcalHistos::getNames(), HCalSD::getNames(), HCalSD::HCalSD(), HcalTB06BeamSD::HcalTB06BeamSD(), HFFibre::HFFibre(), HFShower::HFShower(), HFShowerFibreBundle::HFShowerFibreBundle(), HFShowerLibrary::HFShowerLibrary(), HFShowerParam::HFShowerParam(), HFShowerPMT::HFShowerPMT(), HcalNumberingFromDDD::initialize(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), DTGeometryParsFromDD::insertLayer(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), MuonDDDConstants::MuonDDDConstants(), nextSibling(), DTGeometryParserFromDDD::parseGeometry(), CocoaAnalyzer::ReadXMLFile(), CmsTrackerRingBuilder::sortNS(), and PrintGeomInfoAction::update().

{
   bool result = false;
   
   // save the current position
   DDGeoHistory savedPos = epv_.geoHistory();
           
   // save the current scope
   DDGeoHistory savedScope = epv_.scope_;
   int savedDepth = epv_.depth_;
   
   // set current node to be the scope
   epv_.scope_ = epv_.geoHistory();
   epv_.depth_ = 0;
   
   // search the subtree for the first matching node
   if (next()) { 
     result = true;
     epv_.scope_ = savedScope;
     epv_.depth_ = savedDepth;
   }
   else { // restore the starting point
     epv_.scope_ = savedScope;
     epv_.depth_ = savedDepth;
     epv_.goToHistory(savedPos);
   }
   
   if (result) {
     parents_.push_back(epv_.geoHistory());
   }
     
   return result;
}
const DDGeoHistory & DDFilteredView::geoHistory ( ) const
bool DDFilteredView::goTo ( const nav_type n)

Definition at line 288 of file DDFilteredView.cc.

References query::result.

Referenced by TouchableToHistory::getFilteredView(), and DDDefaultNumberingScheme::node().

{
 // WARNING!!!!!!!!!!
 // NOT IMPLEMENTED!!!!!!!
 bool result(false);
 return result;
}
const std::vector< DDGeoHistory > & DDFilteredView::history ( ) const

Definition at line 308 of file DDFilteredView.cc.

References parents_.

{
  return parents_;
}
const DDLogicalPart & DDFilteredView::logicalPart ( ) const
DDsvalues_type DDFilteredView::mergedSpecifics ( ) const
void DDFilteredView::mergedSpecificsV ( DDsvalues_type merged) const

Definition at line 61 of file DDFilteredView.cc.

References epv_, and DDExpandedView::mergedSpecificsV().

{
  epv_.mergedSpecificsV(merged);
}
DDFilteredView::nav_type DDFilteredView::navPos ( ) const

return the stack of sibling numbers

Definition at line 276 of file DDFilteredView.cc.

References epv_, and DDExpandedView::navPos().

Referenced by DDDefaultNumberingScheme::DDDefaultNumberingScheme(), GeometricDet::GeometricDet(), and DDDefaultNumberingScheme::id().

{
  return epv_.navPos();
}
bool DDFilteredView::next ( void  )

set current node to the next node in the filtered tree

Definition at line 104 of file DDFilteredView.cc.

References epv_, filter(), i, DDExpandedView::next(), and query::result.

Referenced by ListGroups::analyze(), ListIds::analyze(), CSCGeometryParsFromDD::build(), DDDefaultNumberingScheme::DDDefaultNumberingScheme(), firstChild(), HcalTB06BeamSD::getNames(), MaterialBudgetHcalHistos::getNames(), HCalSD::getNames(), HCalSD::HCalSD(), HcalTB06BeamSD::HcalTB06BeamSD(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), HcalNumberingFromDDD::loadGeometry(), MaterialAccountingGroup::MaterialAccountingGroup(), CocoaAnalyzer::ReadXMLFile(), and PrintGeomInfoAction::update().

{
   bool result = false;
   int i=0;
   //epv_.scope_.clear();
   //DCOUT('F', "DDFilteredView::next(): scope of ExpandedView = " << epv_.scope_ );
   while(epv_.next()) {
     //DCOUT('F', " node " << i << " " << epv_.logicalPart().ddname() );
     ++i;
     //DCOUT('F', "DDFilteredView::next() at " << epv_.geoHistory().back() );
     if ( filter() ) {
       result = true;
       //DCOUT('F', "DDFilteredView::next(): filter()==true at " << epv_.geoHistory() );
       break;
     }
   }
   //DCOUT('F', "DDFilteredView::next(): just iterated over " << i << " nodes."); 
   return result;
}
bool DDFilteredView::nextSibling ( )

set the current node to the next sibling ...

Algorithm:

  • find the first node - which matches the filter - in the subtrees of the siblings of the current node

Definition at line 172 of file DDFilteredView.cc.

References epv_, filter(), firstChild(), DDExpandedView::geoHistory(), DDExpandedView::goToHistory(), DDExpandedView::nextSibling(), DDExpandedView::parent(), parents_, and query::result.

Referenced by CmsTrackerLevelBuilder::build(), CmsDetConstruction::buildComponent(), RPCGeometryBuilderFromDDD::buildGeometry(), DTGeometryParsFromDD::buildGeometry(), DTGeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), MuonRPCDetLayerGeometryBuilder::buildLayer(), DTGeometryBuilderFromDDD::buildLayer(), DTGeometryParsFromDD::insertLayer(), EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry(), and DTGeometryParserFromDDD::parseGeometry().

{
  //PRE:  the current node A is one matching the filter or the (scoped) root
  //POST: current node is A if no filter has matched, or B with matching filter
  //      B is the firstChild matching the filter in the subtrees of A's siblings
  bool result = false;
  DDGeoHistory savedPos = epv_.geoHistory();
  
  //DDGeoHistory::size_type level = parents_.back().size();
  
  bool flag = true;
  //bool shuffleParent = false;
  while (flag) {
    if (epv_.nextSibling()) {
      if ( filter() ) {
        result = true;
        break;
      }
      else if (firstChild()) {
        result = true;
        // firstChild increases parents!
        parents_.pop_back(); 
        break;
      }
    } // <-- epv_.nextSibling      
    else if (!epv_.parent()) {
      flag = false;
    }
    if (epv_.geoHistory().size() == parents_[parents_.size()-2].size()) {
      flag = false;
    }  
  }   
      
  if (!result)
    epv_.goToHistory(savedPos);
  else
    parents_.back() = epv_.geoHistory();
       
  return result;
}
bool DDFilteredView::parent ( )

set the current node to the parent node ...

Definition at line 214 of file DDFilteredView.cc.

References epv_, DDExpandedView::goToHistory(), parents_, and query::result.

Referenced by CmsTrackerLevelBuilder::build(), CmsDetConstruction::buildComponent(), DTGeometryBuilderFromDDD::buildGeometry(), DTGeometryParsFromDD::buildGeometry(), DDDCmsTrackerContruction::construct(), DTGeometryParsFromDD::insertLayer(), DTGeometryParserFromDDD::parseGeometry(), and CmsTrackerRingBuilder::sortNS().

{
   bool result = false;
 
   if (parents_.size()==1) {
     result = false;
   }
   else {
     parents_.pop_back();
     epv_.goToHistory(parents_.back());
     result = true;
   }  
   
   // =====> CHECK WHETHER THE FOLLOWING REMARKS STILL REPRESENT THE IMPLEMENTATION ABOVE <===   
   // case 1: we've reached the (scoped) root of the underlying expanded-view
   //         from the first child of the fitered-view; result must be true
   // case 2: we've reached a parent-node where the filter said 'yes'; 
   //         result must be true
   // case 3: we are already at the (scoped) root of the underlying expanded-view
   //         result must be false
      
   return result;
}
void DDFilteredView::print ( void  )

Definition at line 297 of file DDFilteredView.cc.

References epv_, i, parents_, and DDExpandedView::scope_.

                           {
  edm::LogInfo("DDFliteredView") << "FilteredView Status" << std::endl
       << "-------------------" << std::endl
       << "scope = " << epv_.scope_ << std::endl
       << "parents:" << std::endl;
  for (unsigned int i=0; i<parents_.size(); ++i)
    edm::LogInfo("DDFliteredView") << "  " << parents_[i] << std::endl;
    
}
void DDFilteredView::reset ( void  )

clears the scope and sets the filtered view to its root-node

Definition at line 239 of file DDFilteredView.cc.

References epv_, DDExpandedView::geoHistory(), parents_, and DDExpandedView::reset().

Referenced by DDDefaultNumberingScheme::DDDefaultNumberingScheme().

{
  //while (epv_.parent())
  //  ;
  epv_.reset();
  parents_.clear();
  parents_.push_back(epv_.geoHistory());          
}
const DDRotationMatrix & DDFilteredView::rotation ( void  ) const
const DDGeoHistory & DDFilteredView::scope ( ) const

The scope of the expanded-view.

Definition at line 79 of file DDFilteredView.cc.

References epv_, and DDExpandedView::scope().

{
  return epv_.scope();
}
bool DDFilteredView::setScope ( const DDGeoHistory hist)

sets the scope of the expanded view

Definition at line 85 of file DDFilteredView.cc.

References epv_, parents_, query::result, and DDExpandedView::setScope().

{
  bool result = epv_.setScope(hist,0);
  if (result) {
    parents_.clear();
    parents_.push_back(hist);
  }  
  return result;
}  
std::vector< const DDsvalues_type * > DDFilteredView::specifics ( ) const
void DDFilteredView::specificsV ( std::vector< const DDsvalues_type * > &  result) const

User specific data attached to the current node.

Definition at line 56 of file DDFilteredView.cc.

References epv_, and DDExpandedView::specificsV().

Referenced by dddGetStringRaw(), and ExtractStringFromDDD::getString().

const DDTranslation & DDFilteredView::translation ( void  ) const

Member Data Documentation

Definition at line 92 of file DDFilteredView.h.

Referenced by addFilter(), and filter().

Definition at line 93 of file DDFilteredView.h.

Referenced by addFilter(), and filter().

std::vector<DDGeoHistory> DDFilteredView::parents_ [private]
const DDScope* DDFilteredView::scope_ [private]

Definition at line 87 of file DDFilteredView.h.