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