CMS 3D CMS Logo

Public Member Functions

TOBLayerBuilder Class Reference

#include <TOBLayerBuilder.h>

List of all members.

Public Member Functions

TOBLayer * build (const GeometricDet *aTOBLayer, const TrackerGeometry *theGeomDetGeometry)
 TOBLayerBuilder ()

Detailed Description

A concrete builder for TOBLayer

Definition at line 15 of file TOBLayerBuilder.h.


Constructor & Destructor Documentation

TOBLayerBuilder::TOBLayerBuilder ( ) [inline]

Definition at line 17 of file TOBLayerBuilder.h.

{};

Member Function Documentation

TOBLayer * TOBLayerBuilder::build ( const GeometricDet aTOBLayer,
const TrackerGeometry theGeomDetGeometry 
)

Definition at line 10 of file TOBLayerBuilder.cc.

References TOBRodBuilder::build(), GeometricDet::components(), getHLTprescales::index, perp(), and align::TOBLayer.

Referenced by GeometricSearchTrackerBuilder::build().

                                                                           {

  vector<const GeometricDet*>  theGeometricDetRods = aTOBLayer->components();
  vector<const GeometricDet*> negativeZrods;
  vector<const GeometricDet*> positiveZrods;

  for(vector<const GeometricDet*>::const_iterator it=theGeometricDetRods.begin();
      it!=theGeometricDetRods.end(); it++){
    if( (*it)->positionBounds().z() < 0) negativeZrods.push_back(*it);
    if( (*it)->positionBounds().z() >= 0) positiveZrods.push_back(*it);
  }

  TOBRodBuilder myTOBRodBuilder;

  vector<const TOBRod*> theInnerRods;
  vector<const TOBRod*> theOuterRods;
  
  //LogDebug("TkDetLayers") << "positiveZrods[0]->positionBounds().perp(): " 
  //                      << positiveZrods[0]->positionBounds().perp() ;
  //LogDebug("TkDetLayers") << "positiveZrods[1]->positionBounds().perp(): " 
  //                      << positiveZrods[1]->positionBounds().perp() ;

  double positiveMeanR = 0;
  if(positiveZrods.size()>0){
    for(unsigned int index=0; index!=positiveZrods.size(); index++){
      positiveMeanR += positiveZrods[index]->positionBounds().perp();
    }
    positiveMeanR = positiveMeanR/positiveZrods.size();
  }


  double negativeMeanR = 0;
  if(negativeZrods.size()>0){
    for(unsigned int index=0; index!=negativeZrods.size(); index++){
      negativeMeanR += negativeZrods[index]->positionBounds().perp();
    }
    negativeMeanR = negativeMeanR/negativeZrods.size();
  }

  if(positiveZrods.size()>0 && negativeZrods.size()>0){
    for(unsigned int index=0; index!=positiveZrods.size(); index++){
      if( positiveZrods[index]->positionBounds().phi() != negativeZrods[index]->positionBounds().phi()){
        edm::LogError("TkDetLayers") << "ERROR:rods don't have the same phi. exit!";
        break;      
      }

      if(positiveZrods[index]->positionBounds().perp() < positiveMeanR)
        theInnerRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
                                                     positiveZrods[index],
                                                     theGeomDetGeometry)    );       
      if(positiveZrods[index]->positionBounds().perp() >= positiveMeanR)
        theOuterRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
                                                     positiveZrods[index],
                                                     theGeomDetGeometry)    );
    }
  } else{
    if(positiveZrods.size()>0){
      for(unsigned int index=0; index!=positiveZrods.size(); index++){
        if(positiveZrods[index]->positionBounds().perp() < positiveMeanR)
          theInnerRods.push_back(myTOBRodBuilder.build(0,
                                                       positiveZrods[index],
                                                       theGeomDetGeometry)    );       
        if(positiveZrods[index]->positionBounds().perp() >= positiveMeanR)
          theOuterRods.push_back(myTOBRodBuilder.build(0,
                                                       positiveZrods[index],
                                                       theGeomDetGeometry)    );       
      }
    }
    if(negativeZrods.size()>0){
      for(unsigned int index=0; index!=negativeZrods.size(); index++){
        if(negativeZrods[index]->positionBounds().perp() < negativeMeanR)
          theInnerRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
                                                       0,
                                                       theGeomDetGeometry)    );       
        if(negativeZrods[index]->positionBounds().perp() >= negativeMeanR)
          theOuterRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
                                                       0,
                                                       theGeomDetGeometry)    );
      }
    }
  }
  
  //LogDebug("TkDetLayers") << "theInnerRods.size(): " << theInnerRods.size() ;
  //LogDebug("TkDetLayers") << "theOuterRods.size(): " << theOuterRods.size() ;
  

  return new TOBLayer(theInnerRods,theOuterRods);
}