test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions
DDDTotemRPContruction Class Reference

Builds structure of DetGeomDesc objects out of DDCompactView (resp. DDFilteredView). More...

#include <DDDTotemRPConstruction.h>

Public Member Functions

const DetGeomDescconstruct (const DDCompactView *cpv)
 
 DDDTotemRPContruction ()
 

Protected Member Functions

void buildDetGeomDesc (DDFilteredView *fv, DetGeomDesc *gd)
 

Detailed Description

Builds structure of DetGeomDesc objects out of DDCompactView (resp. DDFilteredView).

It adds detector IDs (via class TotemRPDetId). intended to be called from: modul TotemRPDetGeomDescESModule.

Definition at line 25 of file DDDTotemRPConstruction.h.

Constructor & Destructor Documentation

DDDTotemRPContruction::DDDTotemRPContruction ( )

Definition at line 24 of file DDDTotemRPConstruction.cc.

25 {
26 }

Member Function Documentation

void DDDTotemRPContruction::buildDetGeomDesc ( DDFilteredView fv,
DetGeomDesc gd 
)
protected

Definition at line 50 of file DDDTotemRPConstruction.cc.

References funct::A, DetGeomDesc::addComponent(), DDFilteredView::copyNumbers(), DDD_TOTEM_RP_DETECTOR_NAME, DDFilteredView::firstChild(), DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDFilteredView::parent(), DetGeomDesc::setGeographicalID(), and relativeConstraints::station.

Referenced by construct().

51 {
52  using namespace std;
53 
54  // try to dive into next level
55  if (! fv->firstChild()) return;
56 
57  // loop over siblings in the level
58  do {
59  // create new DetGeomDesc node and add it to the parent's (gd) list
60  DetGeomDesc* newGD = new DetGeomDesc(fv);
61 
62  // add ID (only for detectors)
63  if (! fv->logicalPart().name().name().compare(DDD_TOTEM_RP_DETECTOR_NAME)) {
64  const vector<int> &cN = fv->copyNumbers();
65  // check size of copy numubers array
66  if (cN.size() < 3)
67  throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for RP_Silicon_Detector is " << cN.size() << ". It must be >= 3." << endl;
68 
69  // extract information
70  unsigned int A = cN[cN.size() - 3];
71  unsigned int arm = A / 100;
72  unsigned int station = (A % 100) / 10;
73  unsigned int rp = A % 10;
74  unsigned int detector = cN[cN.size() - 1];
75  //.std::cout<<"arm:"<<arm<<", station:"<<station<<", rp:"<<rp<<", detector:"<<detector<<std::endl;
76  //.std::cout<<"TotemRPDetId(arm, station, rp, detector) "<<TotemRPDetId(arm, station, rp, detector).DetectorDecId()<<", "<<TotemRPDetId(arm, station, rp, detector).rawId()<<std::endl;
77  newGD->setGeographicalID(TotemRPDetId(arm, station, rp, detector));
78  //.cout << "A = " << A << "; arm = " << arm << " st = " << station << " rp = " << rp << " det = " << detector << " --> "<< gd->geographicalID().rawId() << endl;
79  }
80 
81  gd->addComponent(newGD);
82 
83  // recursion
84  buildDetGeomDesc(fv, newGD);
85  } while (fv->nextSibling());
86 
87  // go a level up
88  fv->parent();
89 }
Roman Pot detector ID.
Definition: TotemRPDetId.h:51
void buildDetGeomDesc(DDFilteredView *fv, DetGeomDesc *gd)
bool parent()
set the current node to the parent node ...
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:78
nav_type copyNumbers() const
return the stack of copy numbers
bool nextSibling()
set the current node to the next sibling ...
void setGeographicalID(DetId id)
ID stuff.
Definition: DetGeomDesc.h:63
Geometrical description of a detector.
Definition: DetGeomDesc.h:40
bool firstChild()
set the current node to the first child ...
const char DDD_TOTEM_RP_DETECTOR_NAME[]
DDD name of RP detector.
void addComponent(DetGeomDesc *)
Definition: DetGeomDesc.cc:159
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
const DetGeomDesc * DDDTotemRPContruction::construct ( const DDCompactView cpv)

Definition at line 30 of file DDDTotemRPConstruction.cc.

References buildDetGeomDesc(), and patCandidatesForDimuonsSequences_cff::tracker.

Referenced by TotemRPGeometryESModule::produceMeasuredGD().

31 {
32  using namespace std;
33 
34  // create DDFilteredView and apply the filter
35  DDFilteredView fv(*cpv);
36  //.fv.addFilter(filter);
37 
38  // conversion to DetGeomDesc structure
39  // create the root node and recursively propagates through the tree
40  // adds IDs
41  DetGeomDesc* tracker = new DetGeomDesc(&fv);
43 
44  // return the root of the structure
45  return tracker;
46 }
void buildDetGeomDesc(DDFilteredView *fv, DetGeomDesc *gd)
Geometrical description of a detector.
Definition: DetGeomDesc.h:40