CMS 3D CMS Logo

Public Member Functions | Private Member Functions

DTGeometryParserFromDDD Class Reference

#include <DTGeometryParserFromDDD.h>

List of all members.

Public Member Functions

 DTGeometryParserFromDDD (const DDCompactView *cview, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
 Constructor.
 ~DTGeometryParserFromDDD ()
 Destructor.

Private Member Functions

void buildLayer (DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)
void parseGeometry (DDFilteredView &fv, const MuonDDDConstants &muonConstants, std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &theLayerIdWiresMap)

Detailed Description

Class which read the geometry from DDD to provide a map between layerId and pairs with first wire number, total number of wires.

Date:
2007/11/02 10:47:48
Revision:
1.1
Author:
S. Bolognesi - INFN Torino

Definition at line 23 of file DTGeometryParserFromDDD.h.


Constructor & Destructor Documentation

DTGeometryParserFromDDD::DTGeometryParserFromDDD ( const DDCompactView cview,
const MuonDDDConstants muonConstants,
std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &  theLayerIdWiresMap 
)

Constructor.

Definition at line 14 of file DTGeometryParserFromDDD.cc.

References DDFilteredView::addFilter(), DDSpecificsFilter::AND, benchmark_cfg::cerr, exception, align_tpl::filter, DDSpecificsFilter::matches, DDSpecificsFilter::setCriteria(), and relativeConstraints::value.

                                                                                                                                                                                          {

  try {
    std::string attribute = "MuStructure"; 
    std::string value     = "MuonBarrelDT";
    DDValue val(attribute, value, 0.0);

    // Asking only for the Muon DTs
    DDSpecificsFilter filter;
    filter.setCriteria(val,  // name & value of a variable 
                       DDSpecificsFilter::matches,
                       DDSpecificsFilter::AND, 
                       true, // compare strings otherwise doubles
                       true  // use merged-specifics or simple-specifics
                       );
    DDFilteredView fview(*cview);
    fview.addFilter(filter);

    parseGeometry(fview, muonConstants, theLayerIdWiresMap);
  }
  catch (const DDException & e ) {
    std::cerr << "DTGeometryParserFromDDD::build() : DDD Exception: something went wrong during XML parsing!" << std::endl
              << "  Message: " << e << std::endl
              << "  Terminating execution ... " << std::endl;
    throw;
  }
  catch (const exception & e) {
    std::cerr << "DTGeometryParserFromDDD::build() : an unexpected exception occured: " << e.what() << std::endl; 
    throw;
  }
  catch (...) {
    std::cerr << "DTGeometryParserFromDDD::build() : An unexpected exception occured!" << std::endl
              << "  Terminating execution ... " << std::endl;
    std::unexpected();           
  }
}
DTGeometryParserFromDDD::~DTGeometryParserFromDDD ( )

Destructor.

Definition at line 51 of file DTGeometryParserFromDDD.cc.

                                                 {
}

Member Function Documentation

void DTGeometryParserFromDDD::buildLayer ( DDFilteredView fv,
const MuonDDDConstants muonConstants,
std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &  theLayerIdWiresMap 
) [private]
void DTGeometryParserFromDDD::parseGeometry ( DDFilteredView fv,
const MuonDDDConstants muonConstants,
std::map< DTLayerId, std::pair< unsigned int, unsigned int > > &  theLayerIdWiresMap 
) [private]

Definition at line 54 of file DTGeometryParserFromDDD.cc.

References DDFilteredView::firstChild(), DDFilteredView::nextSibling(), and DDFilteredView::parent().

                                                                                                                                                                              {

  bool doChamber = fv.firstChild();

  // Loop on chambers
  int ChamCounter=0;
  while (doChamber){
    ChamCounter++;
  
    // Loop on SLs
    bool doSL = fv.firstChild();
    int SLCounter=0;
    while (doSL) {
      SLCounter++;
    
      bool doL = fv.firstChild();
      int LCounter=0;
      // Loop on SLs
      while (doL) {
        LCounter++;
        //DTLayer* layer = 
        buildLayer(fv, muonConstants, theLayerIdWiresMap);

        fv.parent();
        doL = fv.nextSibling(); // go to next layer
      } // layers

      fv.parent();
      doSL = fv.nextSibling(); // go to next SL
    } // sls

    fv.parent();
    doChamber = fv.nextSibling(); // go to next chamber
  } // chambers

}