CMS 3D CMS Logo

Public Member Functions | Private Member Functions

FWDTDigiProxyBuilder Class Reference

Inheritance diagram for FWDTDigiProxyBuilder:
FWProxyBuilderBase

List of all members.

Public Member Functions

 FWDTDigiProxyBuilder (void)
virtual bool haveSingleProduct (void) const
 REGISTER_PROXYBUILDER_METHODS ()
virtual ~FWDTDigiProxyBuilder (void)

Private Member Functions

virtual void buildViewType (const FWEventItem *iItem, TEveElementList *product, FWViewType::EType, const FWViewContext *)
 FWDTDigiProxyBuilder (const FWDTDigiProxyBuilder &)
const FWDTDigiProxyBuilderoperator= (const FWDTDigiProxyBuilder &)

Detailed Description

Definition at line 53 of file FWDTDigiProxyBuilder.cc.


Constructor & Destructor Documentation

FWDTDigiProxyBuilder::FWDTDigiProxyBuilder ( void  ) [inline]

Definition at line 56 of file FWDTDigiProxyBuilder.cc.

{}
virtual FWDTDigiProxyBuilder::~FWDTDigiProxyBuilder ( void  ) [inline, virtual]

Definition at line 57 of file FWDTDigiProxyBuilder.cc.

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

Member Function Documentation

void FWDTDigiProxyBuilder::buildViewType ( const FWEventItem iItem,
TEveElementList *  product,
FWViewType::EType  type,
const FWViewContext  
) [private, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 73 of file FWDTDigiProxyBuilder.cc.

References FWGeometry::contains(), FWProxyBuilderBase::createCompound(), FWGeometry::find(), fwLog, relativeConstraints::geom, FWEventItem::get(), FWEventItem::getGeom(), FWGeometry::getParameters(), FWViewType::k3D, FWViewType::kISpy, FWViewType::kRhoPhi, FWViewType::kRhoPhiPF, FWViewType::kRhoZ, fwlog::kWarning, FWGeometry::localToGlobal(), DetId::rawId(), FWProxyBuilderBase::setupAddElement(), DTSuperLayerId::superLayer(), and DTLayerId::superlayerId().

{
   const DTDigiCollection* digis = 0;
   iItem->get( digis );
        
   if( ! digis )
   {
      return;
   }
   const FWGeometry *geom = iItem->getGeom();
        
   for( DTDigiCollection::DigiRangeIterator dri = digis->begin(), dre = digis->end(); dri != dre; ++dri )
   {
      const DTLayerId& layerId = (*dri).first;
      unsigned int rawid = layerId.rawId();
      const DTDigiCollection::Range &range = (*dri).second;

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

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

         continue;
      }

      const float* pars = geom->getParameters( rawid );
      FWGeometry::IdToInfoItr det = geom->find( rawid );

      int superLayer = layerId.superlayerId().superLayer();

      float localPos[3] = { 0.0, 0.0, 0.0 };
                
      // Loop over the digis of this DetUnit
      for( DTDigiCollection::const_iterator it = range.first;
           it != range.second; ++it )
      {
         // The x wire position in the layer, starting from its wire number.
         float firstChannel = pars[3];
         float nChannels = pars[5];
         localPos[0] = ((*it).wire() - ( firstChannel - 1 ) - 0.5 ) * pars[0] - nChannels / 2.0 * pars[0];

         if( type == FWViewType::k3D || type == FWViewType::kISpy )
         {
            TEveBox* box = new TEveBox;
            setupAddElement( box, product );
            ::addTube( box, *det, localPos, pars );
         }
         else if(( ( type == FWViewType::kRhoPhi ||  type == FWViewType::kRhoPhiPF ) && superLayer != 2 ) ||
                 ( type == FWViewType::kRhoZ && superLayer == 2 ))
         {
            TEvePointSet* pointSet = new TEvePointSet;
            pointSet->SetMarkerStyle( 24 );
            setupAddElement( pointSet, product);        

            float globalPos[3];                 
            geom->localToGlobal( *det, localPos, globalPos );
            pointSet->SetNextPoint( globalPos[0],  globalPos[1],  globalPos[2] );

            TEveBox* box = new TEveBox;
            setupAddElement( box, product );
            ::addTube( box, *det, localPos, pars );
         }
         else
         {
            TEveCompound* compound = createCompound();
            setupAddElement( compound, product );

         }
      }         
   }
}
virtual bool FWDTDigiProxyBuilder::haveSingleProduct ( void  ) const [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 59 of file FWDTDigiProxyBuilder.cc.

{ return false; }
const FWDTDigiProxyBuilder& FWDTDigiProxyBuilder::operator= ( const FWDTDigiProxyBuilder ) [private]
FWDTDigiProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )