CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions

DTGeometryBuilderFromCondDB Class Reference

#include <DTGeometryBuilderFromCondDB.h>

List of all members.

Public Member Functions

void build (boost::shared_ptr< DTGeometry > theGeometry, const RecoIdealGeometry &rig)
 DTGeometryBuilderFromCondDB ()
virtual ~DTGeometryBuilderFromCondDB ()

Private Types

typedef
ReferenceCountingPointer
< BoundPlane
RCPPlane

Private Member Functions

DTChamberbuildChamber (const DetId &id, const RecoIdealGeometry &rig, size_t idt) const
DTLayerbuildLayer (DTSuperLayer *sl, const DetId &id, const RecoIdealGeometry &rig, size_t idt) const
DTSuperLayerbuildSuperLayer (DTChamber *chamber, const DetId &id, const RecoIdealGeometry &rig, size_t idt) const
RCPPlane plane (const std::vector< double >::const_iterator tranStart, const std::vector< double >::const_iterator rotStart, const Bounds &bounds) const

Detailed Description

Description:

detailed description

Author:
: Stefano Lacaprara - INFN LNL <stefano.lacaprara@pd.infn.it> $date : 19/11/2008 19:14:24 CET $

Modification:

Definition at line 36 of file DTGeometryBuilderFromCondDB.h.


Member Typedef Documentation

Definition at line 66 of file DTGeometryBuilderFromCondDB.h.


Constructor & Destructor Documentation

DTGeometryBuilderFromCondDB::DTGeometryBuilderFromCondDB ( )

Definition at line 33 of file DTGeometryBuilderFromCondDB.cc.

                                                         {
}
DTGeometryBuilderFromCondDB::~DTGeometryBuilderFromCondDB ( ) [virtual]

Definition at line 37 of file DTGeometryBuilderFromCondDB.cc.

                                                          {
}

Member Function Documentation

void DTGeometryBuilderFromCondDB::build ( boost::shared_ptr< DTGeometry theGeometry,
const RecoIdealGeometry rig 
)

Definition at line 42 of file DTGeometryBuilderFromCondDB.cc.

References gather_cfg::cout, RecoIdealGeometry::detIds(), and RecoIdealGeometry::shapeStart().

Referenced by DTGeometryESModule::geometryCallback_().

                                                                 {
  //  cout << "DTGeometryBuilderFromCondDB " << endl;
  const std::vector<DetId>& detids(rig.detIds());
  //  cout << "size " << detids.size() << endl;

  size_t idt = 0;
  DTChamber* chamber(0);
  DTSuperLayer* sl(0);
  while(idt < detids.size()) {
    //copy(par.begin(), par.end(), ostream_iterator<double>(std::cout," "));
    if (int(*(rig.shapeStart(idt)))==0){ // a Chamber
      // add the provious chamber which by now has been updated with SL and
      // layers
      if (chamber) theGeometry->add(chamber);
      // go for the actual one
      DTChamberId chid(detids[idt]);
      //cout << "CH: " <<  chid << endl;
      chamber = buildChamber(chid, rig, idt); 
    }
    else if (int(*(rig.shapeStart(idt)))==1){ // a SL
      DTSuperLayerId slid(detids[idt]);
      //cout << "  SL: " <<  slid << endl;
      sl = buildSuperLayer(chamber, slid, rig, idt);
      theGeometry->add(sl);
    }
    else if (int(*(rig.shapeStart(idt)))==2){ // a Layer
      DTLayerId lid(detids[idt]);
      //cout << "    LAY: " <<  lid << endl;
      DTLayer* lay = buildLayer(sl, lid, rig, idt);
      theGeometry->add(lay);
    } else {
      cout << "What is this?" << endl;
    }
    ++idt;
  }
  if (chamber) theGeometry->add(chamber); // add the last chamber
}
DTChamber * DTGeometryBuilderFromCondDB::buildChamber ( const DetId id,
const RecoIdealGeometry rig,
size_t  idt 
) const [private]

SL the definition of length, width, thickness depends on the local reference frame of the Det

Definition at line 81 of file DTGeometryBuilderFromCondDB.cc.

References RecoIdealGeometry::rotStart(), RecoIdealGeometry::shapeStart(), RecoIdealGeometry::tranStart(), and tablePrinter::width.

                                                                        {
  DTChamberId detId(id);  


  float width = (*(rig.shapeStart(idt) + 1))/cm;     // r-phi  dimension - different in different chambers
  float length = (*(rig.shapeStart(idt) + 2))/cm;    // z      dimension - constant 125.55 cm
  float thickness = (*(rig.shapeStart(idt) + 3))/cm; // radial thickness - almost constant about 18 cm

  // width is along local X
  // length is along local Y
  // thickness is long local Z
  RectangularPlaneBounds bound(width, length, thickness);
  //  std::vector<double> tran(rig.tranStart(idt), rig.tranEnd(idt));
  //  std::vector<double> rot(rig.rotStart(idt), rig.rotEnd(idt));
  RCPPlane surf(plane(rig.tranStart(idt), rig.rotStart(idt), bound));

  DTChamber* chamber = new DTChamber(detId, surf);

  return chamber;
}
DTLayer * DTGeometryBuilderFromCondDB::buildLayer ( DTSuperLayer sl,
const DetId id,
const RecoIdealGeometry rig,
size_t  idt 
) const [private]

Definition at line 130 of file DTGeometryBuilderFromCondDB.cc.

References DTSuperLayer::add(), RecoIdealGeometry::rotStart(), RecoIdealGeometry::shapeStart(), RecoIdealGeometry::tranStart(), and tablePrinter::width.

                                                          {

  DTLayerId layId(id);

  // Layer specific parameter (size)
  float width = (*(rig.shapeStart(idt) + 1))/cm;     // r-phi  dimension - changes in different chambers
  float length = (*(rig.shapeStart(idt) + 2))/cm;    // z      dimension - constant 126.8 cm
  float thickness = (*(rig.shapeStart(idt) + 3))/cm; // radial thickness - almost constant about 20 cm

  // define Bounds
  RectangularPlaneBounds bound(width, length, thickness);

  RCPPlane surf(plane(rig.tranStart(idt), rig.rotStart(idt), bound));//tran, rot, bound));

  // Loop on wires
  int firstWire=int(*(rig.shapeStart(idt) + 4 ));//par[4]);
  int WCounter=int(*(rig.shapeStart(idt) + 5 ));//par[5]);
  double sensibleLenght=(*(rig.shapeStart(idt) + 6 ))/cm;//par[6]/cm;
  DTTopology topology(firstWire, WCounter, sensibleLenght);

  DTLayerType layerType;

  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
  // cout << "adding layer " << layer->id() << " to sl "<<  sl->id() << endl;

  sl->add(layer);
  return layer;
}
DTSuperLayer * DTGeometryBuilderFromCondDB::buildSuperLayer ( DTChamber chamber,
const DetId id,
const RecoIdealGeometry rig,
size_t  idt 
) const [private]

Definition at line 106 of file DTGeometryBuilderFromCondDB.cc.

References DTChamber::add(), RecoIdealGeometry::rotStart(), RecoIdealGeometry::shapeStart(), RecoIdealGeometry::tranStart(), and tablePrinter::width.

                                                               {

  DTSuperLayerId slId(id);

  float width = (*(rig.shapeStart(idt) + 1))/cm;     // r-phi  dimension - different in different chambers
  float length = (*(rig.shapeStart(idt) + 2))/cm;    // z      dimension - constant 126.8 cm
  float thickness = (*(rig.shapeStart(idt) + 3))/cm; // radial thickness - almost constant about 5 cm

  RectangularPlaneBounds bound(width, length, thickness);

  // Ok this is the slayer position...
  RCPPlane surf(plane(rig.tranStart(idt), rig.rotStart(idt), bound));

  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);

  // cout << "adding slayer " << slayer->id() << " to chamber "<<  chamber->id() << endl;
  chamber->add(slayer);
  return slayer;
}
RCPPlane DTGeometryBuilderFromCondDB::plane ( const std::vector< double >::const_iterator  tranStart,
const std::vector< double >::const_iterator  rotStart,
const Bounds bounds 
) const [private]