CMS 3D CMS Logo

Public Member Functions | Private Member Functions

FWCSCStripDigiProxyBuilder Class Reference

Inheritance diagram for FWCSCStripDigiProxyBuilder:
FWProxyBuilderBase

List of all members.

Public Member Functions

 FWCSCStripDigiProxyBuilder ()
 REGISTER_PROXYBUILDER_METHODS ()
virtual ~FWCSCStripDigiProxyBuilder ()

Private Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 FWCSCStripDigiProxyBuilder (const FWCSCStripDigiProxyBuilder &)
const FWCSCStripDigiProxyBuilderoperator= (const FWCSCStripDigiProxyBuilder &)

Detailed Description

Definition at line 24 of file FWCSCStripDigiProxyBuilder.cc.


Constructor & Destructor Documentation

FWCSCStripDigiProxyBuilder::FWCSCStripDigiProxyBuilder ( ) [inline]

Definition at line 27 of file FWCSCStripDigiProxyBuilder.cc.

{}
virtual FWCSCStripDigiProxyBuilder::~FWCSCStripDigiProxyBuilder ( ) [inline, virtual]

Definition at line 28 of file FWCSCStripDigiProxyBuilder.cc.

{}
FWCSCStripDigiProxyBuilder::FWCSCStripDigiProxyBuilder ( const FWCSCStripDigiProxyBuilder ) [private]

Member Function Documentation

void FWCSCStripDigiProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext  
) [private, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 39 of file FWCSCStripDigiProxyBuilder.cc.

References FWGeometry::contains(), FWProxyBuilderBase::createCompound(), fwLog, relativeConstraints::geom, FWEventItem::get(), FWEventItem::getGeom(), FWGeometry::getParameters(), FWGeometry::getShapePars(), FWViewType::kAll3DBits, FWViewType::kAllRPZBits, fwlog::kWarning, FWGeometry::localToGlobal(), ExpressReco_HICollisions_FallBack::parameters, REGISTER_FWPROXYBUILDER, FWProxyBuilderBase::setupAddElement(), and funct::tan().

{
   const CSCStripDigiCollection* digis = 0;
  
   iItem->get(digis);

   if( ! digis ) 
   {
      fwLog( fwlog::kWarning ) << "failed to get CSCStripDigis"<<std::endl;
      return;
   }
   const FWGeometry *geom = iItem->getGeom();

   int thresholdOffset = 9;       

   for ( CSCStripDigiCollection::DigiRangeIterator dri = digis->begin(), driEnd = digis->end();
         dri != driEnd; ++dri )
   {    
      unsigned int rawid = (*dri).first.rawId();
      const CSCStripDigiCollection::Range& range = (*dri).second;

      if( ! geom->contains( rawid ))
      {
         fwLog( fwlog::kWarning ) << "failed to get geometry of CSC with detid: "
                                  << rawid << std::endl;

         TEveCompound* compound = createCompound();
         setupAddElement( compound, product );

         continue;
      }
     
      const float* shape = geom->getShapePars( rawid );
      float length = shape[4];

      const float* parameters = geom->getParameters( rawid );

      float yAxisOrientation = parameters[0];
      float centreToIntersection = parameters[1];
      float yCentre = parameters[2];
      float phiOfOneEdge = parameters[3];
      float stripOffset = parameters[4];
      float angularWidth = parameters[5];

      for( CSCStripDigiCollection::const_iterator dit = range.first;
           dit != range.second; ++dit )
      {
         std::vector<int> adcCounts = (*dit).getADCCounts();
      
         int signalThreshold = (adcCounts[0] + adcCounts[1])/2 + thresholdOffset;  
        
         TEveStraightLineSet* stripDigiSet = new TEveStraightLineSet();
         setupAddElement(stripDigiSet, product);
             
         if( std::find_if( adcCounts.begin(), adcCounts.end(), bind2nd( std::greater<int>(), signalThreshold )) != adcCounts.end()) 
         {
            stripDigiSet->SetLineWidth(3);
            int stripId = (*dit).getStrip();  

            float yOrigin = centreToIntersection-yCentre;      
            float stripAngle = phiOfOneEdge + yAxisOrientation*(stripId-(0.5-stripOffset))*angularWidth;
            float tanStripAngle = tan(stripAngle);
            //float xOfStrip = yAxisOrientation*yOrigin*tanStripAngle; this is x of strip at origin
             
            float localPointTop[3] = 
              {
                yAxisOrientation*(yOrigin+length)*tanStripAngle, length, 0.0
              };

            float localPointBottom[3] = 
              {
                yAxisOrientation*(yOrigin-length)*tanStripAngle, -length, 0.0
              };
      
            float globalPointTop[3];
            float globalPointBottom[3];
        
            geom->localToGlobal( rawid, localPointTop, globalPointTop, localPointBottom, globalPointBottom);
        
            stripDigiSet->AddLine( globalPointBottom[0], globalPointBottom[1], globalPointBottom[2],
                                   globalPointTop[0], globalPointTop[1], globalPointTop[2] );
         }
      }       
   }   
}
const FWCSCStripDigiProxyBuilder& FWCSCStripDigiProxyBuilder::operator= ( const FWCSCStripDigiProxyBuilder ) [private]
FWCSCStripDigiProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )