CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Fireworks/ParticleFlow/plugins/FWPFTrackRPZProxyBuilder.cc

Go to the documentation of this file.
00001 #include "FWPFTrackRPZProxyBuilder.h"
00002 
00003 //______________________________________________________________________________
00004 void
00005 FWPFTrackRPZProxyBuilder::build( const reco::Track &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc )
00006 {
00007    FWPFTrackUtils *utils = new FWPFTrackUtils();
00008    TEveTrack *trk = utils->setupTrack( iData );
00009    TEvePointSet *ps = utils->getCollisionMarkers( trk );
00010    TEvePointSet *rzps = new TEvePointSet();
00011    setupAddElement( trk, &oItemHolder );
00012 
00013    Float_t *trackPoints = trk->GetP();
00014    unsigned int last = ( trk->GetN() - 1 ) * 3;
00015    float y = trackPoints[last+1];
00016    float z = trackPoints[last+2];
00017 
00018    // Reposition any points that have been translated in RhoZ
00019    for( signed int i = 0; i < ps->GetN(); ++i )
00020    {
00021       // WORKS BUT DOESN'T HANDLE ALL SCENARIOS.....
00022       Float_t a,b,c;
00023       ps->GetPoint( i, a, b, c );
00024 
00025       if( y < 0 && b > 0 )
00026          b *= -1;
00027       else if( y > 0 && b < 0 )
00028          b *= -1;
00029 
00030       if( z < 0 && c > 0 )
00031          c *= -1;
00032       else if( z > 0 && c < 0 )
00033          c *= -1;
00034 
00035       rzps->SetNextPoint( a, b, c );
00036    }
00037 
00038    if( rzps->GetN() != 0 )
00039       setupAddElement( rzps, &oItemHolder );
00040    else
00041       delete rzps;
00042 
00043    delete ps;
00044    delete utils;
00045 }
00046 
00047 //______________________________________________________________________________
00048 REGISTER_FWPROXYBUILDER( FWPFTrackRPZProxyBuilder, reco::Track, "PF Tracks", FWViewType::kRhoPhiPFBit  | FWViewType::kRhoZBit );