CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/Geometry/TrackerNumberingBuilder/plugins/CmsDetConstruction.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/plugins/CmsDetConstruction.h"
00002 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h"
00003 #include "DataFormats/DetId/interface/DetId.h"
00004 
00005 void CmsDetConstruction::buildComponent(
00006                                         DDFilteredView& fv, 
00007                                         GeometricDet *mother, 
00008                                         std::string attribute){
00009   
00010   //
00011   // at this level I check whether it is a merged detector or not
00012   //
00013 
00014   GeometricDet * det  = new GeometricDet(&fv,theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(attribute,&fv)));
00015   if (theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(attribute,&fv)) ==  GeometricDet::mergedDet){
00016     //
00017     // I have to go one step lower ...
00018     //
00019     bool dodets = fv.firstChild(); // descend to the first Layer
00020     while (dodets) {
00021       buildSmallDets(fv,det,attribute);
00022       dodets = fv.nextSibling(); // go to next layer
00023         /*
00024         Add algo to sort the merged DET
00025         */
00026     }
00027     fv.parent();
00028   }
00029   
00030   mother->addComponent(det);
00031 }
00032 
00033 void CmsDetConstruction::buildSmallDets( 
00034                                         DDFilteredView& fv, 
00035                                         GeometricDet *mother, 
00036                                         std::string attribute){
00037 
00038   GeometricDet * det  = 
00039     new GeometricDet(&fv,
00040                      theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(attribute,&fv)));
00041   static const std::string stereo = "TrackerStereoDetectors";
00042   if (ExtractStringFromDDD::getString(stereo,&fv) == "true"){
00043     uint32_t temp = 1;
00044     det->setGeographicalID(DetId(temp));
00045   }else{
00046     uint32_t temp = 2;
00047     det->setGeographicalID(DetId(temp));
00048   }
00049   
00050   mother->addComponent(det); 
00051 }
00052