CMS 3D CMS Logo

Public Member Functions | Private Member Functions

RPCGeometryParsFromDD Class Reference

#include <RPCGeometryParsFromDD.h>

List of all members.

Public Member Functions

void build (const DDCompactView *cview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
 RPCGeometryParsFromDD ()
 ~RPCGeometryParsFromDD ()

Private Member Functions

void buildGeometry (DDFilteredView &fview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)

Detailed Description

Build the RPCGeometry ftom the DDD description

Author:
Port of: MuDDDRPCBuilder, MuonRPCGeometryBuilder (ORCA)
M. Maggi - INFN Bari

Definition at line 22 of file RPCGeometryParsFromDD.h.


Constructor & Destructor Documentation

RPCGeometryParsFromDD::RPCGeometryParsFromDD ( )

Implementation of the RPC Geometry Builder from DDD

Author:
Port of: MuDDDRPCBuilder (ORCA)
M. Maggi - INFN Bari

Definition at line 25 of file RPCGeometryParsFromDD.cc.

{ }
RPCGeometryParsFromDD::~RPCGeometryParsFromDD ( )

Definition at line 28 of file RPCGeometryParsFromDD.cc.

{ }

Member Function Documentation

void RPCGeometryParsFromDD::build ( const DDCompactView cview,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rgeo 
)

Definition at line 32 of file RPCGeometryParsFromDD.cc.

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

Referenced by RPCRecoIdealDBLoader::beginRun().

{
  std::string attribute = "ReadOutName"; // could come from .orcarc
  std::string value     = "MuonRPCHits";    // could come from .orcarc
  DDValue val(attribute, value, 0.0);

  // Asking only for the MuonRPC's
  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);

  this->buildGeometry(fview, muonConstants, rgeo);
}
void RPCGeometryParsFromDD::buildGeometry ( DDFilteredView fview,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rgeo 
) [private]

Definition at line 54 of file RPCGeometryParsFromDD.cc.

References RPCNumberingScheme::baseNumberToUnitNumber(), gather_cfg::cout, DDfetch(), cond::rpcobgas::detid, DDValue::doubles(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), RecoIdealGeometry::insert(), DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), mergeVDriftHistosByStation::name, DDFilteredView::nextSibling(), DDSolid::parameters(), DetId::rawId(), DDFilteredView::rotation(), DDLogicalPart::solid(), DDFilteredView::specifics(), DDFilteredView::translation(), tablePrinter::width, x, detailsBasic3DVector::y, and z.

Referenced by build().

{

  bool doSubDets = fview.firstChild();

  while (doSubDets){

    // Get the Base Muon Number
    MuonDDDNumbering mdddnum(muonConstants);
    MuonBaseNumber   mbn=mdddnum.geoHistoryToBaseNumber(fview.geoHistory());

    // Get the The Rpc det Id 
    RPCNumberingScheme rpcnum(muonConstants);
    int detid = 0;

    detid = rpcnum.baseNumberToUnitNumber(mbn);
    RPCDetId rpcid(detid);

    DDValue numbOfStrips("nStrips");

    std::vector<const DDsvalues_type* > specs(fview.specifics());
    std::vector<const DDsvalues_type* >::iterator is=specs.begin();
    int nStrips=0;
    for (;is!=specs.end(); is++){
      if (DDfetch( *is, numbOfStrips)){
        nStrips=int(numbOfStrips.doubles()[0]); 
      }
    }
    if (nStrips == 0 )
      std::cout <<"No strip found!!"<<std::endl;
    
    std::vector<double> dpar=fview.logicalPart().solid().parameters();

    std::vector<std::string> strpars;
    std::string name=fview.logicalPart().name().name();
    strpars.push_back(name);
    DDTranslation tran    = fview.translation();

    DDRotationMatrix rota = fview.rotation();//.Inverse();
    DD3Vector x, y, z;
    rota.GetComponents(x,y,z);
    std::vector<double> pars;    
    if (dpar.size()==3){
      double width     = dpar[0];
      double length    = dpar[1];
      double thickness = dpar[2];
      pars.push_back(width);
      pars.push_back(length);
      pars.push_back(thickness);
      pars.push_back(numbOfStrips.doubles()[0]); 
    }else{
      pars.push_back(dpar[4]); //b/2;
      pars.push_back(dpar[8]); //B/2;
      pars.push_back(dpar[0]); //h/2;
      pars.push_back(0.4);
      pars.push_back(numbOfStrips.doubles()[0]); //h/2;
    }

    
    std::vector<double> vtra(3);
    std::vector<double> vrot(9);
    vtra[0]=(float) 1.0 * (tran.x());
    vtra[1]=(float) 1.0 * (tran.y());
    vtra[2]=(float) 1.0 * (tran.z());
    vrot[0]=(float) 1.0 * x.X();
    vrot[1]=(float) 1.0 * x.Y();
    vrot[2]=(float) 1.0 * x.Z();
    vrot[3]=(float) 1.0 * y.X();
    vrot[4]=(float) 1.0 * y.Y();
    vrot[5]=(float) 1.0 * y.Z();
    vrot[6]=(float) 1.0 * z.X();
    vrot[7]=(float) 1.0 * z.Y();
    vrot[8]=(float) 1.0 * z.Z();
    rgeo.insert(rpcid.rawId(),vtra,vrot, pars,strpars);
    doSubDets = fview.nextSibling(); // go to next layer
  }
  
}