CMS 3D CMS Logo

VisGsfTrackTwig Class Reference

#include <VisReco/VisTracker/interface/VisGsfTrackTwig.h>

Inheritance diagram for VisGsfTrackTwig:

VisQueuedTwig IgSimpleTwig VisEventObserver IgCompoundTwig IgTwig IgRepresentable

List of all members.

Public Member Functions

virtual void onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup)
virtual void twigChanged (void)
virtual void update (IgRZRep *rep)
virtual void update (IgRPhiRep *rep)
virtual void update (IgTextRep *rep)
virtual void update (IgLegoRep *rep)
virtual void update (Ig3DRep *rep)
 VisGsfTrackTwig (IgState *state, IgTwig *parent, const std::string &name="", const std::string &friendlyName="", const std::string &moduleLabel="", const std::string &instanceName="", const std::string &processName="")

Private Attributes

const std::string m_friendlyName
const std::string m_instanceName
const std::string m_moduleLabel
const std::string m_processName
VisGsfTrackShape m_shape
VisGsfTrackDirection m_showDirection
std::string m_text
std::vector< reco::GsfTrackm_tracks
std::vector< std::vector
< SbVec3f > > 
m_trajectoryDirections
std::vector< std::vector
< SbVec3f > > 
m_trajectoryPositions


Detailed Description

Definition at line 25 of file VisGsfTrackTwig.h.


Constructor & Destructor Documentation

VisGsfTrackTwig::VisGsfTrackTwig ( IgState state,
IgTwig parent,
const std::string &  name = "",
const std::string &  friendlyName = "",
const std::string &  moduleLabel = "",
const std::string &  instanceName = "",
const std::string &  processName = "" 
)

Definition at line 66 of file VisGsfTrackTwig.cc.

References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().

00072     : VisQueuedTwig (state, parent, name),
00073       m_text ("no info"),
00074       m_friendlyName (friendlyName),
00075       m_moduleLabel (moduleLabel),
00076       m_instanceName (instanceName),
00077       m_processName (processName),
00078       m_showDirection (state, lat::CreateCallback (this, &VisGsfTrackTwig::twigChanged)),
00079       m_shape (state, lat::CreateCallback (this, &VisGsfTrackTwig::twigChanged))
00080 {
00081     VisTwigFactroyService *tfService = VisTwigFactroyService::get (state);
00082     if (! tfService)
00083     {
00084         tfService = new VisTwigFactroyService (state);
00085     }
00086     edm::TypeID trackID (typeid (reco::GsfTrackCollection));
00087     tfService->registerTwig (trackID.friendlyClassName (), &createThisTwig);   
00088 }


Member Function Documentation

void VisGsfTrackTwig::onNewEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 96 of file VisGsfTrackTwig.cc.

References arg, GenMuonPlsPt100GeV_cfg::cout, e, lat::endl(), exception, edm::Event::id(), IgRepSet::invalidate(), edm::Handle< T >::isValid(), LFfwvis, LOG, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_text, m_tracks, m_trajectoryDirections, m_trajectoryPositions, IgSimpleTwig::name(), VisQueuedTwig::onNewEvent(), IgTwig::SELF_MASK, IgTwig::STRUCTURE_MASK, GsfMatrixTools::trace(), track, x, y, and z.

00098 {
00099     // Get debugging dump.
00100     VisQueuedTwig::onNewEvent (event, eventSetup);
00101 
00102     m_text = QString ("Run # %1, event # %2")
00103              .arg (event.id ().run ())
00104              .arg (event.id ().event ()).latin1 ();
00105     m_tracks.clear ();
00106     m_trajectoryPositions.clear ();
00107     m_trajectoryDirections.clear ();
00108     
00109     edm::Handle<reco::GsfTrackCollection> collections;
00110     try 
00111     {
00112         if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ()))
00113         {
00114             VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName);
00115             event.get (visSel, collections);
00116         }
00117     }
00118     catch (cms::Exception& e)
00119     {
00120         if (this->m_onCmsException)
00121             this->m_onCmsException (&e);
00122     }
00123     catch (lat::Error &e) 
00124     {
00125         if (this->m_onError)
00126             this->m_onError (&e);
00127     }
00128     catch (std::exception &e) 
00129     {
00130         if (this->m_onException)
00131             this->m_onException (&e);
00132     }
00133     catch (...) 
00134     {
00135         if (this->m_onUnhandledException)
00136             this->m_onUnhandledException ();
00137     }
00138     try 
00139     {
00140         if (collections.isValid ())
00141         {
00142             QString sizeStr = (QString ("%1").arg (collections->size ()));
00143             QString nameStr = QString (this->name ());
00144             int ib = nameStr.find ("[");
00145             int ie = nameStr.find ("]");
00146             nameStr.replace (ib + 1, ie - 1, sizeStr);
00147             this->name (nameStr);
00148 
00149             for (reco::GsfTrackCollection::const_iterator track = collections->begin (), trackEnd = collections->end (); 
00150                  track != trackEnd; ++track)
00151             {
00152                 m_tracks.push_back (*track);
00153             
00154                 if ((*track).gsfExtra ().isNonnull ())
00155                 {               
00156                     std::vector<reco::GsfTrackExtra::LocalParameterVector> islp = (*track).gsfExtra ()->innerStateLocalParameters ();
00157                     std::vector<reco::GsfTrackExtra::LocalParameterVector> oslp = (*track).gsfExtra ()->outerStateLocalParameters ();
00158 
00159                     LOG (2, trace, LFfwvis, "GsfTrackExtra: Inner State Local Parameters:\n");
00160             
00161                     for (std::vector<reco::GsfTrackExtra::LocalParameterVector>::const_iterator ii = islp.begin (), iiEnd = islp.end ();
00162                          ii != iiEnd; ++ii)
00163                     {
00164                         std::cout << (*ii) << std::endl;
00165                     }
00166 
00167                     std::cout << "GsfTrackExtra: Outer State Local Parameters:" << std::endl;
00168             
00169                     for (std::vector<reco::GsfTrackExtra::LocalParameterVector>::const_iterator io = oslp.begin (), ioEnd = oslp.end ();
00170                          io != ioEnd; ++io)
00171                     {
00172                         std::cout << (*io) << std::endl;
00173                     }
00174                     std::cout << "GsfTrackExtra: Sign of local P_z at inner state: " << (*track).gsfExtra ()->innerStateLocalPzSign () << std::endl;
00175                     std::cout << "GsfTrackExtra: Sign of local P_z at outermost state: " << (*track).gsfExtra ()->outerStateLocalPzSign () << std::endl;
00176                 }
00177             
00178                 std::vector<SbVec3f> myTraPos;
00179                 std::vector<SbVec3f> myTraDir;
00180             
00181                 std::cout << "Innermost state is ";
00182 
00183                 (*track).innerOk () ? (std::cout << "OK") : (std::cout << "not OK");
00184                 std::cout << std::endl;
00185 
00186                 std::cout << "Outermost state is ";
00187                 (*track).outerOk () ? (std::cout << "OK") : (std::cout << "not OK");
00188                 std::cout << std::endl;
00189 
00190                 if ((*track).innerOk () && (*track).outerOk ())
00191                 {
00192                     float x = (*track).innerPosition ().x () / 100.0;
00193                     float y = (*track).innerPosition ().y () / 100.0;
00194                     float z = (*track).innerPosition ().z () / 100.0;
00195 
00196                     float dirx = (*track).innerMomentum ().x ();
00197                     float diry = (*track).innerMomentum ().y ();
00198                     float dirz = (*track).innerMomentum ().z ();
00199                     SbVec3f diri (dirx, diry, dirz);
00200                     diri.normalize ();
00201                 
00202                     myTraPos.push_back (SbVec3f (x, y, z));
00203                     myTraDir.push_back (diri);
00204 
00205                     x = (*track).outerPosition ().x () / 100.0;
00206                     y = (*track).outerPosition ().y () / 100.0;
00207                     z = (*track).outerPosition ().z () / 100.0;
00208 
00209                     dirx = (*track).outerMomentum ().x ();
00210                     diry = (*track).outerMomentum ().y ();
00211                     dirz = (*track).outerMomentum ().z ();
00212                     SbVec3f diro (dirx, diry, dirz);
00213                     diro.normalize ();
00214 
00215                     myTraPos.push_back (SbVec3f (x, y, z));
00216                     myTraDir.push_back (diro);
00217                 }
00218                 m_trajectoryPositions.push_back (myTraPos);
00219                 m_trajectoryDirections.push_back (myTraDir);
00220             }
00221         }
00222     }
00223     catch (cms::Exception& e)
00224     {
00225         if (this->m_onCmsException)
00226             this->m_onCmsException (&e);
00227     }
00228     catch (lat::Error &e) 
00229     {
00230         if (this->m_onError)
00231             this->m_onError (&e);
00232     }
00233     catch (std::exception &e) 
00234     {
00235         if (this->m_onException)
00236             this->m_onException (&e);
00237     }
00238     catch (...) 
00239     {
00240         if (this->m_onUnhandledException)
00241             this->m_onUnhandledException ();
00242     }
00243 
00244     IgRepSet::invalidate (this, IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK);
00245 }

void VisGsfTrackTwig::twigChanged ( void   )  [virtual]

Definition at line 91 of file VisGsfTrackTwig.cc.

References IgRepSet::invalidate(), and IgTwig::SELF_MASK.

00092 { IgRepSet::invalidate (this, SELF_MASK); }

void VisGsfTrackTwig::update ( IgRZRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 522 of file VisGsfTrackTwig.cc.

References Ig3DBaseRep::clear(), IgSoSimpleTrajectory::controlPoints, dir, IgSoSimpleTrajectory::linePattern, IgSoSimpleTrajectory::lineWidth, m_shape, m_showDirection, m_trajectoryDirections, m_trajectoryPositions, IgSoSimpleTrajectory::markerPoints, Ig3DBaseRep::node(), VarParsing::obj, IgSoSplineTrack::points, funct::sqrt(), IgSoArrow::tail, IgSoSplineTrack::tangents, IgSoArrow::tip, IgSbColorMap::unpack(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00523 {
00524     // Get debugging dump.
00525     VisQueuedTwig::update (rep);
00526 
00527     // Lock the Qt application.
00528     IgQtLock ();
00529     rep->clear ();
00530     
00531     SoSeparator *contents = new SoSeparator;
00532     SoMaterial *mat = new SoMaterial;
00533     float rgbcomponents [4];
00534     IgSbColorMap::unpack (0xCD00CC00, rgbcomponents);
00535     mat->diffuseColor.setValue (SbColor (rgbcomponents));
00536     contents->addChild (mat);
00537 
00538     //set line width
00539     SoDrawStyle *sty = new SoDrawStyle;
00540     sty->style = SoDrawStyle::LINES;
00541     sty->lineWidth.setValue (4);
00542     contents->addChild (sty);
00543       
00544     if (!m_trajectoryPositions.empty () && !m_trajectoryDirections.empty ())        
00545     {
00546         std::vector<std::vector<SbVec3f> >::const_iterator ipos = m_trajectoryPositions.begin ();
00547         std::vector<std::vector<SbVec3f> >::const_iterator idir = m_trajectoryDirections.begin ();
00548         for (unsigned int itrack = 0; itrack != m_trajectoryPositions.size(); ++itrack)
00549         {
00550             IgSoSimpleTrajectory *obj = new IgSoSimpleTrajectory;
00551             IgSoSplineTrack* myTraj = new IgSoSplineTrack;
00552             SoMFVec3f tangents;
00553             SoMFVec3f points;
00554             int nState = 0;
00555             float xlayer = -0.1;
00556 
00557             std::vector<SbVec3f>::const_iterator idd = (*idir).begin ();
00558             for (std::vector<SbVec3f>::const_iterator ipp = (*ipos).begin (); ipp != (*ipos).end (); ++ipp)
00559             {
00560                 float posy = sqrt((*ipp)[0]*(*ipp)[0]+(*ipp)[1]*(*ipp)[1]);
00561                 if ( (*ipp)[1] < 0 ) posy = -posy;
00562 
00563                 float diry = sqrt((*idd)[0]*(*idd)[0]+(*idd)[1]*(*idd)[1]);
00564                 if ( (*idd)[1] < 0 ) diry = -diry;
00565 
00566                 SbVec3f rzpos(xlayer, posy, (*ipp)[2]);
00567                 SbVec3f rzdir(xlayer, diry, (*idd)[2]);
00568 
00569                 obj->controlPoints.set1Value (nState, rzpos);
00570                 obj->markerPoints.set1Value (nState, rzpos);
00571 
00572                 if (m_showDirection.value ()) 
00573                 {
00574                     SoSeparator *directions = new SoSeparator;
00575                     contents->addChild (directions);
00576                     
00577                     SoMaterial *dirMat = new SoMaterial;
00578                     IgSbColorMap::unpack (0x03C03C00, rgbcomponents);
00579                     dirMat->ambientColor.setValue (SbColor (rgbcomponents));
00580                     dirMat->diffuseColor.setValue (SbColor (rgbcomponents));
00581                     dirMat->specularColor.setValue (SbColor (rgbcomponents));
00582                     dirMat->emissiveColor.setValue (SbColor (rgbcomponents));
00583                     directions->addChild (dirMat);
00584                     
00585                     IgSoArrow* dir = new IgSoArrow;
00586                     dir->tail.setValue (SbVec3f (xlayer, rzpos[1], rzpos[2]));
00587                     dir->tip.setValue (SbVec3f (xlayer, rzpos[1] + rzdir[1] / 2.0, rzpos[2] + rzdir[2] / 2.0));
00588                     directions->addChild (dir);
00589                 }
00590 
00591                 points.set1Value (nState, (*ipp));
00592                 tangents.set1Value (nState, (*idd));
00593 
00594                 nState++;
00595                 idd++;
00596             }
00597             obj->linePattern = 0xffff;
00598             obj->lineWidth = 4.0;
00599             
00600             myTraj->points = points;
00601             myTraj->tangents = tangents;
00602 
00603             if (m_shape.value ().compare ("spline") == 0) 
00604             {
00605                 contents->addChild (myTraj);
00606             } 
00607             if (m_shape.value ().compare ("line") == 0)
00608             {
00609                 contents->addChild (obj);
00610             }
00611             if (m_shape.value ().compare ("both") == 0) 
00612             {
00613                 contents->addChild (myTraj);
00614                 contents->addChild (obj);
00615             }
00616             ipos++;
00617             idir++;
00618         }
00619     }
00620 
00621     rep->node ()->addChild (contents);
00622 }

void VisGsfTrackTwig::update ( IgRPhiRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 425 of file VisGsfTrackTwig.cc.

References Ig3DBaseRep::clear(), IgSoSimpleTrajectory::controlPoints, dir, IgSoSimpleTrajectory::linePattern, IgSoSimpleTrajectory::lineWidth, m_shape, m_showDirection, m_trajectoryDirections, m_trajectoryPositions, IgSoSimpleTrajectory::markerPoints, Ig3DBaseRep::node(), VarParsing::obj, IgSoSplineTrack::points, IgSoArrow::tail, IgSoSplineTrack::tangents, IgSoArrow::tip, IgSbColorMap::unpack(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00426 {
00427     // Get debugging dump.
00428     VisQueuedTwig::update (rep);
00429 
00430     // Lock the Qt application.
00431     IgQtLock ();
00432     rep->clear ();
00433     
00434     SoSeparator *contents = new SoSeparator;
00435     SoMaterial *mat = new SoMaterial;
00436     float rgbcomponents [4];
00437     IgSbColorMap::unpack (0xCD00CC00, rgbcomponents);
00438     mat->diffuseColor.setValue (SbColor (rgbcomponents));
00439     contents->addChild (mat);
00440 
00441     //set line width
00442     SoDrawStyle *sty = new SoDrawStyle;
00443     sty->style = SoDrawStyle::LINES;
00444     sty->lineWidth.setValue (4);
00445     contents->addChild (sty);
00446 
00447     if (!m_trajectoryPositions.empty () && !m_trajectoryDirections.empty ())
00448     {
00449         std::vector<std::vector<SbVec3f> >::const_iterator ipos = m_trajectoryPositions.begin ();
00450         std::vector<std::vector<SbVec3f> >::const_iterator idir = m_trajectoryDirections.begin ();
00451         for (unsigned int itrack = 0; itrack != m_trajectoryPositions.size (); ++itrack)
00452         {
00453             IgSoSimpleTrajectory *obj = new IgSoSimpleTrajectory;
00454             IgSoSplineTrack* myTraj = new IgSoSplineTrack;
00455             SoMFVec3f tangents;
00456             SoMFVec3f points;
00457             int nState = 0;
00458             float zlayer = 0.1;
00459             std::vector<SbVec3f>::const_iterator idd = (*idir).begin ();
00460             for (std::vector<SbVec3f>::const_iterator ipp = (*ipos).begin (); ipp != (*ipos).end (); ++ipp)
00461             {
00462                 SbVec3f rphipos((*ipp)[0], (*ipp)[1], zlayer);
00463                 SbVec3f rphidir((*idd)[0], (*idd)[1], zlayer);
00464                 rphidir.normalize ();
00465                 
00466                 obj->controlPoints.set1Value (nState, rphipos);
00467                 obj->markerPoints.set1Value (nState, rphipos);
00468 
00469                 if (m_showDirection.value ()) 
00470                 {
00471                     SoSeparator *directions = new SoSeparator;
00472                     contents->addChild (directions);
00473                     
00474                     SoMaterial *dirMat = new SoMaterial;
00475                     IgSbColorMap::unpack (0x03C03C00, rgbcomponents);
00476                     dirMat->ambientColor.setValue (SbColor (rgbcomponents));
00477                     dirMat->diffuseColor.setValue (SbColor (rgbcomponents));
00478                     dirMat->specularColor.setValue (SbColor (rgbcomponents));
00479                     dirMat->emissiveColor.setValue (SbColor (rgbcomponents));
00480                     directions->addChild (dirMat);
00481                     
00482                     IgSoArrow* dir = new IgSoArrow;
00483                     dir->tail.setValue (SbVec3f (rphipos[0], rphipos[1], zlayer));
00484                     dir->tip.setValue (SbVec3f (rphipos[0] + rphidir[0] / 2.0, rphipos[1] + rphidir[1] / 2.0, zlayer));
00485                     directions->addChild (dir);
00486                 }
00487 
00488                 points.set1Value (nState, (*ipp));
00489                 tangents.set1Value (nState, (*idd));
00490 
00491                 nState++;
00492                 ++idd;
00493             }
00494             obj->linePattern = 0xffff;
00495             obj->lineWidth = 4.0;
00496 
00497             myTraj->points = points;
00498             myTraj->tangents = tangents;
00499 
00500             if (m_shape.value ().compare ("spline") == 0) 
00501             {
00502                 contents->addChild (myTraj);
00503             } 
00504             if (m_shape.value ().compare ("line") == 0)
00505             {
00506                 contents->addChild (obj);
00507             }
00508             if (m_shape.value ().compare ("both") == 0) 
00509             {
00510                 contents->addChild (myTraj);
00511                 contents->addChild (obj);
00512             }
00513             ipos++;
00514             idir++;
00515         }
00516     }
00517 
00518     rep->node ()->addChild (contents);
00519 }

void VisGsfTrackTwig::update ( IgTextRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 248 of file VisGsfTrackTwig.cc.

References cms::Exception::append(), e, exception, it, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_text, m_tracks, n, IgTextRep::setText(), and VisQueuedTwig::update().

00249 {
00250     // Get debugging dump.
00251     VisQueuedTwig::update (rep);
00252 
00253     // Prepare property description.
00254     std::ostringstream  text;
00255 
00256     text << m_text << "<br>";
00257 
00258     text << "<table width='100%' border=1>"
00259          << "<TR align = center>"
00260          << "<TH>Number</TH>"
00261          << "<TH>P<SUB>T (GeV)</TH>"
00262          << "<TH>Eta</TH>"
00263          << "<TH>Phi</TH>"
00264          << "<TH>Charge</TH>"
00265          << "</TR>";
00266     text << setiosflags (std::ios::showpoint | std::ios::fixed);
00267     text.setf (std::ios::right, std::ios::adjustfield);
00268     
00269     int n = 0;
00270     if (! m_tracks.empty ()) 
00271     {
00272         try 
00273         {
00274             for (std::vector<reco::GsfTrack>::const_iterator it = m_tracks.begin (), itEnd = m_tracks.end (); it != itEnd; ++it) 
00275             {
00276                 double pt = (*it).pt ();            
00277         
00278                 text << "<TR align = right>"
00279                      << "<TD>" << std::setw (3) << n++ << "</TD>"
00280                      << "<TD>" << std::setw (2) << std::setprecision (3) << pt << "</TD>"
00281                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*it).eta () << "</TD>"
00282                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*it).phi () << "</TD>"
00283                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*it).charge () << "</TD>"
00284                      << "</TR>";
00285             }
00286         }
00287         catch (cms::Exception& e)
00288         {
00289             e.append (" from VisGsfTrackTwig: ");
00290             e.append (this->name ());
00291             
00292             if (this->m_onCmsException)
00293                 this->m_onCmsException (&e);
00294         }
00295         catch (lat::Error &e) 
00296         {
00297             if (this->m_onError)
00298                 this->m_onError (&e);
00299         }
00300         catch (std::exception &e) 
00301         {
00302             if (this->m_onException)
00303                 this->m_onException (&e);
00304         }
00305         catch (...) 
00306         {
00307             if (this->m_onUnhandledException)
00308                 this->m_onUnhandledException ();
00309         }
00310     }   
00311        
00312     text << "</table>";
00313     
00314     // Send it over.
00315     IgQtLock ();
00316 
00317     rep->setText (text.str ());
00318 }

void VisGsfTrackTwig::update ( IgLegoRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 410 of file VisGsfTrackTwig.cc.

References Ig3DBaseRep::clear(), Ig3DBaseRep::node(), and VisQueuedTwig::update().

00411 {
00412     // Get debugging dump.
00413     VisQueuedTwig::update (rep);
00414 
00415     // Lock the Qt application.
00416     IgQtLock ();
00417     rep->clear ();
00418     
00419     SoSeparator *contents = new SoSeparator;
00420 
00421     rep->node ()->addChild (contents);
00422 }

void VisGsfTrackTwig::update ( Ig3DRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 321 of file VisGsfTrackTwig.cc.

References Ig3DBaseRep::clear(), IgSoSimpleTrajectory::controlPoints, dir, IgSoSimpleTrajectory::linePattern, IgSoSimpleTrajectory::lineWidth, m_shape, m_showDirection, m_trajectoryDirections, m_trajectoryPositions, IgSoSimpleTrajectory::markerPoints, Ig3DBaseRep::node(), VarParsing::obj, IgSoSplineTrack::points, IgSoArrow::tail, IgSoSplineTrack::tangents, IgSoArrow::tip, IgSbColorMap::unpack(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00322 {
00323     // Get debugging dump.
00324     VisQueuedTwig::update (rep);
00325 
00326     // Lock the Qt application.
00327     IgQtLock ();
00328     rep->clear ();
00329  
00330     SoSeparator *contents = new SoSeparator;
00331     SoMaterial *mat = new SoMaterial;
00332     float rgbcomponents [4];
00333     IgSbColorMap::unpack (0xCD00CC00, rgbcomponents);
00334     mat->diffuseColor.setValue (SbColor (rgbcomponents));
00335     contents->addChild (mat);
00336 
00337     //set line width
00338     SoDrawStyle *sty = new SoDrawStyle;
00339     sty->style = SoDrawStyle::LINES;
00340     sty->lineWidth.setValue (4);
00341     contents->addChild (sty);
00342 
00343     if (!m_trajectoryPositions.empty () && !m_trajectoryDirections.empty ())
00344     {
00345         std::vector<std::vector<SbVec3f> >::const_iterator ipos = m_trajectoryPositions.begin ();
00346         std::vector<std::vector<SbVec3f> >::const_iterator idir = m_trajectoryDirections.begin ();
00347         for (unsigned int itrack = 0; itrack != m_trajectoryPositions.size (); ++itrack)
00348         {
00349             IgSoSimpleTrajectory *obj = new IgSoSimpleTrajectory;
00350             IgSoSplineTrack* myTraj = new IgSoSplineTrack;
00351             SoMFVec3f tangents;
00352             SoMFVec3f points;
00353             int nState = 0;
00354             std::vector<SbVec3f>::const_iterator idd = (*idir).begin ();
00355             for (std::vector<SbVec3f>::const_iterator ipp = (*ipos).begin (); ipp != (*ipos).end (); ++ipp)
00356             {
00357                 obj->controlPoints.set1Value (nState, (*ipp));
00358                 obj->markerPoints.set1Value (nState, (*ipp));
00359 
00360                 points.set1Value (nState, (*ipp));
00361                 tangents.set1Value (nState, (*idd));
00362 
00363                 if (m_showDirection.value ()) 
00364                 {
00365                     SoSeparator *directions = new SoSeparator;
00366                     contents->addChild (directions);
00367                     
00368                     SoMaterial *dirMat = new SoMaterial;
00369                     IgSbColorMap::unpack (0x03C03C00, rgbcomponents);
00370                     dirMat->diffuseColor.setValue (SbColor (rgbcomponents));
00371                     directions->addChild (dirMat);
00372                     
00373                     IgSoArrow* dir = new IgSoArrow;
00374                     dir->tail.setValue (SbVec3f ((*ipp)[0], (*ipp)[1], (*ipp)[2]));
00375                     dir->tip.setValue (SbVec3f ((*ipp)[0] + (*idd)[0] / 2.0, (*ipp)[1] + (*idd)[1] / 2.0, (*ipp)[2] + (*idd)[2] / 2.0));
00376                     directions->addChild (dir);
00377                 }
00378                 
00379                 nState++;
00380                 idd++;
00381             }
00382             obj->linePattern = 0xdfff;
00383             obj->lineWidth = 4.0;
00384             
00385             myTraj->points = points;
00386             myTraj->tangents = tangents;
00387 
00388             if (m_shape.value () == "spline") 
00389             {
00390                 contents->addChild (myTraj);
00391             } 
00392             if (m_shape.value () == "line")
00393             {
00394                 contents->addChild (obj);
00395             }
00396             if (m_shape.value () == "both") 
00397             {
00398                 contents->addChild (myTraj);
00399                 contents->addChild (obj);
00400             }
00401             ipos++;
00402             idir++;
00403         }
00404     }
00405 
00406     rep->node ()->addChild (contents);
00407 }


Member Data Documentation

const std::string VisGsfTrackTwig::m_friendlyName [private]

Definition at line 51 of file VisGsfTrackTwig.h.

Referenced by onNewEvent().

const std::string VisGsfTrackTwig::m_instanceName [private]

Definition at line 53 of file VisGsfTrackTwig.h.

Referenced by onNewEvent().

const std::string VisGsfTrackTwig::m_moduleLabel [private]

Definition at line 52 of file VisGsfTrackTwig.h.

Referenced by onNewEvent().

const std::string VisGsfTrackTwig::m_processName [private]

Definition at line 54 of file VisGsfTrackTwig.h.

Referenced by onNewEvent().

VisGsfTrackShape VisGsfTrackTwig::m_shape [private]

Definition at line 56 of file VisGsfTrackTwig.h.

Referenced by update().

VisGsfTrackDirection VisGsfTrackTwig::m_showDirection [private]

Definition at line 55 of file VisGsfTrackTwig.h.

Referenced by update().

std::string VisGsfTrackTwig::m_text [private]

Definition at line 50 of file VisGsfTrackTwig.h.

Referenced by onNewEvent(), and update().

std::vector<reco::GsfTrack> VisGsfTrackTwig::m_tracks [private]

Definition at line 58 of file VisGsfTrackTwig.h.

Referenced by onNewEvent(), and update().

std::vector<std::vector<SbVec3f> > VisGsfTrackTwig::m_trajectoryDirections [private]

Definition at line 60 of file VisGsfTrackTwig.h.

Referenced by onNewEvent(), and update().

std::vector<std::vector<SbVec3f> > VisGsfTrackTwig::m_trajectoryPositions [private]

Definition at line 59 of file VisGsfTrackTwig.h.

Referenced by onNewEvent(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:26 2009 for CMSSW by  doxygen 1.5.4