CMS 3D CMS Logo

Private Member Functions

CmsTrackerWheelBuilder Class Reference

#include <CmsTrackerWheelBuilder.h>

Inheritance diagram for CmsTrackerWheelBuilder:
CmsTrackerLevelBuilder CmsTrackerAbstractConstruction

List of all members.

Private Member Functions

virtual void buildComponent (DDFilteredView &, GeometricDet *, std::string)
virtual void sortNS (DDFilteredView &, GeometricDet *)

Detailed Description

Class which builds TEC wheels

Definition at line 11 of file CmsTrackerWheelBuilder.h.


Member Function Documentation

void CmsTrackerWheelBuilder::buildComponent ( DDFilteredView fv,
GeometricDet g,
std::string  s 
) [private, virtual]

Implements CmsTrackerLevelBuilder.

Definition at line 14 of file CmsTrackerWheelBuilder.cc.

References GeometricDet::addComponent(), CmsTrackerLevelBuilder::build(), ExtractStringFromDDD::getString(), GeometricDet::petal, GeometricDet::ring, CmsTrackerLevelBuilder::theCmsTrackerStringToEnum, and CmsTrackerStringToEnum::type().

                                                                                           {
  CmsTrackerRingBuilder theCmsTrackerRingBuilder ;
  CmsTrackerPetalBuilder theCmsTrackerPetalBuilder ;

  GeometricDet * subdet = new GeometricDet(&fv,theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(s,&fv)));
  switch (theCmsTrackerStringToEnum.type(ExtractStringFromDDD::getString(s,&fv))){
  case GeometricDet::ring:
    theCmsTrackerRingBuilder.build(fv,subdet,s);      
    break;
  case GeometricDet::petal:
    theCmsTrackerPetalBuilder.build(fv,subdet,s);      
    break;
  default:
    edm::LogError("CmsTrackerWheelBuilder")<<" ERROR - I was expecting a Ring or Petal, I got a "<<ExtractStringFromDDD::getString(s,&fv);
  }  
  g->addComponent(subdet);
}
void CmsTrackerWheelBuilder::sortNS ( DDFilteredView fv,
GeometricDet det 
) [private, virtual]

Reimplemented from CmsTrackerLevelBuilder.

Definition at line 32 of file CmsTrackerWheelBuilder.cc.

References GeometricDet::addComponents(), GeometricDet::clearComponents(), GeometricDet::components(), i, GeometricDet::petal, groupFilesInBlocks::temp, TrackerStablePhiSort(), GeometricDet::translation(), and z.

                                                                        {
  GeometricDet::GeometricDetContainer comp = det->components();
       
  if(comp.size()){
    if(comp.front()->type()==GeometricDet::petal){
      GeometricDet::GeometricDetContainer compfw;
      GeometricDet::GeometricDetContainer compbw;
      compfw.clear();
      compbw.clear();
      for(uint32_t i=0; i<comp.size();i++){
        if(fabs(comp[i]->translation().z())<fabs(det->translation().z())){
          compfw.push_back(comp[i]);
        }else{
          compbw.push_back(comp[i]);      
        }
      }    
      
      TrackerStablePhiSort(compfw.begin(), compfw.end(), ExtractPhiModule());
      TrackerStablePhiSort(compbw.begin(), compbw.end(), ExtractPhiModule());
      
      //
      // TEC
      // Wheel Part:   3 bits [back:1 front:2]
      // Petal Number: 4 bits [1,...,8]
      //
      for(uint32_t i=0; i<compbw.size(); i++){
        uint32_t temp = i+1;
        temp|=(1<<4);
        compbw[i]->setGeographicalID(DetId(temp));
      }
      for(uint32_t i=0; i<compfw.size(); i++){
        uint32_t temp = i+1;
        temp|=(2<<4);
        compfw[i]->setGeographicalID(DetId(temp));
      }
      
      det->clearComponents();
      det->addComponents(compfw);
      det->addComponents(compbw);
      
    }else{
      std::stable_sort(comp.begin(),comp.end(),LessR_module());

      // TID
      // Disk Number: 2 bits [1,2,3]
      for(uint32_t i=0; i<comp.size(); i++){
        comp[i]->setGeographicalID(DetId(i+1));
      }
      
      det->clearComponents();
      det->addComponents(comp);
    }
  }else{
    edm::LogError("CmsTrackerWheelBuilder")<<"Where are the Petals or Rings?";
  }
  
}