00001
00002
00003 #include "VisReco/VisTrigger/interface/VisL1MuDTTrackContainerTwig.h"
00004 #include "VisFramework/VisFrameworkBase/interface/VisTwigFactroyService.h"
00005 #include "VisFramework/VisFrameworkBase/interface/VisEventSelector.h"
00006 #include "VisFramework/VisFrameworkBase/interface/debug.h"
00007 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h"
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/EventSetup.h"
00010 #include "Iguana/Studio/interface/IgQtLock.h"
00011 #include "Iguana/GLModels/interface/Ig3DRep.h"
00012 #include "Iguana/Models/interface/IgTextRep.h"
00013 #include <Inventor/nodes/SoSeparator.h>
00014 #include <Inventor/nodes/SoText2.h>
00015 #include <Inventor/nodes/SoTranslation.h>
00016 #include <Inventor/SbLinear.h>
00017 #include <qstring.h>
00018 #include <sstream>
00019 #include <iomanip>
00020 #include <iostream>
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 namespace
00031 {
00032 VisQueuedTwig *
00033 createThisTwig (IgState *state, IgTwig *parent,
00034 const std::string &name,
00035 const std::string &friendlyName,
00036 const std::string &modLabel,
00037 const std::string &instanceName,
00038 const std::string &processName)
00039 {
00040 return new VisL1MuDTTrackContainerTwig (state, parent, name,
00041 friendlyName, modLabel, instanceName, processName);
00042 }
00043 }
00044
00045
00046
00047
00048 VisL1MuDTTrackContainerTwig::VisL1MuDTTrackContainerTwig (IgState *state, IgTwig *parent,
00049 const std::string &name ,
00050 const std::string &friendlyName ,
00051 const std::string &moduleLabel ,
00052 const std::string &instanceName ,
00053 const std::string &processName )
00054 : VisQueuedTwig (state, parent, name),
00055 m_state (state),
00056 m_text ("no info"),
00057 m_friendlyName (friendlyName),
00058 m_moduleLabel (moduleLabel),
00059 m_instanceName (instanceName),
00060 m_processName (processName)
00061 {
00062 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state);
00063 if (! tfService)
00064 {
00065 tfService = new VisTwigFactroyService (state);
00066 }
00067 edm::TypeID triggerID (typeid (L1MuDTTrackContainer));
00068 tfService->registerTwig (triggerID.friendlyClassName (), &createThisTwig);
00069 }
00070
00071 void
00072 VisL1MuDTTrackContainerTwig::onNewEvent (const edm::Event &event,
00073 const edm::EventSetup &eventSetup)
00074 {
00075
00076 VisQueuedTwig::onNewEvent (event, eventSetup);
00077
00078 m_text = (QString ("Run # %1, event # %2")
00079 .arg (event.id ().run ())
00080 .arg (event.id ().event ()).latin1 ());
00081 try
00082 {
00083 edm::Handle<L1MuDTTrackContainer> l1MuDTTracks;
00084 event.getByType (l1MuDTTracks);
00085 if (l1MuDTTracks.isValid ())
00086 {
00087 m_container = l1MuDTTracks->getContainer ();
00088 std::cout << "L1MuDTTrackContainer: " << m_container->size () << std::endl;
00089
00090 for (std::vector<L1MuDTTrackCand>::const_iterator i = m_container->begin (), iEnd = m_container->end ();
00091 i != iEnd; ++i)
00092 {
00093 if (! i->empty ())
00094 {
00095 float phi = i->phiValue ();
00096 float eta = i->etaValue ();
00097 float pt = i->ptValue ();
00098 i->print ();
00099 }
00100 }
00101 }
00102 }
00103 catch (cms::Exception& e)
00104 {
00105 if (this->m_onCmsException)
00106 this->m_onCmsException (&e);
00107 }
00108 catch (lat::Error &e)
00109 {
00110 if (this->m_onError)
00111 this->m_onError (&e);
00112 }
00113 catch (std::exception &e)
00114 {
00115 if (this->m_onException)
00116 this->m_onException (&e);
00117 }
00118 catch (...)
00119 {
00120 if (this->m_onUnhandledException)
00121 this->m_onUnhandledException ();
00122 }
00123
00124 VisQueuedTwig::onBaseInvalidate ();
00125 }
00126
00127 void
00128 VisL1MuDTTrackContainerTwig::update (Ig3DRep *rep)
00129 {
00130
00131 VisQueuedTwig::update (rep);
00132
00133 IgQtLock ();
00134 }
00135
00136 void
00137 VisL1MuDTTrackContainerTwig::update (IgTextRep *rep)
00138 {
00139
00140 VisQueuedTwig::update (rep);
00141
00142
00143 std::ostringstream text;
00144
00145 text << m_text;
00146
00147 text << setiosflags (std::ios::showpoint | std::ios::fixed);
00148 text.setf (std::ios::right, std::ios::adjustfield);
00149 text << "<table width='100%' border=1>"
00150 << "<TR align = center>"
00151 << "<TH>DetId</TH>"
00152 << "<TH>Wheel</TH>"
00153 << "<TH>Station</TH>"
00154 << "<TH>Sector</TH>"
00155 << "</TR>";
00156
00157
00158
00159 text << "</table>";
00160
00161 IgQtLock ();
00162 rep->setText (text.str ());
00163 }