#include <VisReco/VisTrigger/interface/VisL1GlobalTriggerReadoutRecordTwig.h>
Public Member Functions | |
virtual void | onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | update (IgTextRep *rep) |
virtual void | update (Ig3DRep *rep) |
VisL1GlobalTriggerReadoutRecordTwig (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 | |
std::vector< std::pair < std::string, bool > > | m_algos |
std::vector< bool > | m_decision |
std::string | m_friendlyName |
std::string | m_instanceName |
std::string | m_moduleLabel |
bool | m_passed |
std::string | m_processName |
IgState * | m_state |
std::string | m_text |
std::vector< unsigned int > | m_triggerMaskAlgoTrig |
std::vector< unsigned int > | m_triggerMaskTechTrig |
Definition at line 15 of file VisL1GlobalTriggerReadoutRecordTwig.h.
VisL1GlobalTriggerReadoutRecordTwig::VisL1GlobalTriggerReadoutRecordTwig | ( | 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 70 of file VisL1GlobalTriggerReadoutRecordTwig.cc.
References createThisTwig(), DBSPlugin::get(), id, and VisTwigFactroyService::registerTwig().
00076 : VisQueuedTwig (state, parent, name), 00077 m_text ("no info"), 00078 m_friendlyName (friendlyName), 00079 m_moduleLabel (moduleLabel), 00080 m_instanceName (instanceName), 00081 m_processName (processName) 00082 { 00083 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00084 if (! tfService) 00085 { 00086 tfService = new VisTwigFactroyService (state); 00087 } 00088 edm::TypeID id (typeid (L1GlobalTriggerReadoutRecord)); 00089 tfService->registerTwig (id.friendlyClassName (), &createThisTwig); 00090 00091 VisL1FilterService *trgService = VisL1FilterService::get (state); 00092 if (! trgService) 00093 { 00094 trgService = new VisL1FilterService (state); 00095 } 00096 }
void VisL1GlobalTriggerReadoutRecordTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 99 of file VisL1GlobalTriggerReadoutRecordTwig.cc.
References VisL1FilterService::algorithm(), cms::Exception::append(), arg, ASSERT, edm::Event::bunchCrossing(), e, exception, edm::EventSetup::get(), DBSPlugin::get(), L1GtTriggerMenu::gtAlgorithmMap(), L1GtTriggerMenu::gtAlgorithmResult(), L1GtTriggerMask::gtTriggerMask(), edm::Event::id(), VisL1FilterService::initialized(), IgRepSet::invalidate(), edm::Handle< T >::isValid(), LFfwvis, LOG, edm::Event::luminosityBlock(), m_algos, m_decision, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_passed, m_processName, m_text, m_triggerMaskAlgoTrig, m_triggerMaskTechTrig, IgSimpleTwig::name(), VisQueuedTwig::onBaseInvalidate(), edm::Event::orbitNumber(), edm::ESHandle< T >::product(), VisL1FilterService::registerAlgo(), IgTwig::SELF_MASK, ss, VisQueuedTwig::state(), IgTwig::STRUCTURE_MASK, and GsfMatrixTools::trace().
00101 { 00102 LOG (1, trace, LFfwvis, "VisL1GlobalTriggerReadoutRecordTwig[" << name () 00103 << "]::onNewEvent()\n"); 00104 00105 VisQueuedTwig::onBaseInvalidate (); 00106 00107 m_text = QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5") 00108 .arg (event.id ().run ()) 00109 .arg (event.id ().event ()) 00110 .arg (event.luminosityBlock ()) 00111 .arg (event.orbitNumber ()) 00112 .arg (event.bunchCrossing ()) 00113 .latin1 (); 00114 00115 m_decision.clear (); 00116 m_algos.clear (); 00117 m_triggerMaskAlgoTrig.clear (); 00118 m_triggerMaskTechTrig.clear (); 00119 00120 edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord; 00121 edm::ESHandle< L1GtTriggerMask > l1GtTmTech; 00122 edm::ESHandle< L1GtTriggerMask > l1GtTmAlgo; 00123 00124 try 00125 { 00126 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00127 { 00128 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00129 event.get (visSel, gtRecord); 00130 00131 eventSetup.get< L1GtTriggerMaskTechTrigRcd >().get (l1GtTmTech); 00132 const L1GtTriggerMask *trigMask = l1GtTmTech.product (); 00133 m_triggerMaskTechTrig = trigMask->gtTriggerMask (); 00134 00135 eventSetup.get< L1GtTriggerMaskAlgoTrigRcd >().get (l1GtTmAlgo); 00136 const L1GtTriggerMask *trigMaskAlgo = l1GtTmAlgo.product (); 00137 m_triggerMaskAlgoTrig = trigMaskAlgo->gtTriggerMask (); 00138 00139 // get menu 00140 edm::ESHandle<L1GtTriggerMenu> menuRcd; 00141 eventSetup.get<L1GtTriggerMenuRcd> ().get (menuRcd) ; 00142 const L1GtTriggerMenu *menu = menuRcd.product (); 00143 const AlgorithmMap amap = menu->gtAlgorithmMap (); 00144 00145 VisL1FilterService *trgService = VisL1FilterService::get (state ()); 00146 ASSERT (trgService); 00147 00148 for (AlgorithmMap::const_iterator mit = amap.begin(), mitEnd = amap.end(); mit != mitEnd; ++mit) 00149 { 00150 std::string strKey = mit->first; 00151 int algBitNumber = (mit->second).algoBitNumber (); 00152 QString algoName = QString ("%1: %2").arg (algBitNumber).arg (QString (strKey)); 00153 00154 std::pair<std::string, bool> apair; 00155 apair.first = algoName.latin1 (); 00156 apair.second = false; 00157 m_algos.push_back (apair); 00158 if (! trgService->initialized ()) 00159 { 00160 trgService->registerAlgo (algoName.latin1 (), QString ("%1").arg (algBitNumber).latin1 ()); 00161 } 00162 } 00163 trgService->initialized (true); 00164 00165 if (gtRecord.isValid ()) 00166 { 00167 QString sizeStr = (QString ("%1").arg ((gtRecord->decision () ? ("True") : ("False")))); 00168 QString nameStr = QString (this->name ()); 00169 int ib = nameStr.find ("["); 00170 int ie = nameStr.find ("]"); 00171 nameStr.replace (ib + 1, ie - 1, sizeStr); 00172 this->name (nameStr); 00173 00174 const DecisionWord dWord = gtRecord->decisionWord (); 00175 m_passed = gtRecord->decision (); 00176 m_decision = dWord; 00177 for (std::vector<std::pair<std::string, bool> >::iterator ait = m_algos.begin (), aitEnd = m_algos.end (); ait != aitEnd; ++ait) 00178 { 00179 (*ait).second = menu->gtAlgorithmResult ((QString((*ait).first).section (": ", 1, 1)).latin1 (), dWord); // ? ((*ait).second = true) : ((*ait).second = false); 00180 // std::cout << "Map: " << (QString((*ait).first).section (": ", 1, 1)).latin1 () << ":" << std::boolalpha << (*ait).second << std::endl; 00181 std::stringstream ss; 00182 ss << std::boolalpha << (*ait).second; 00183 trgService->algorithm ((*ait).first, ss.str ()); 00184 } 00185 } 00186 } 00187 } 00188 catch (lat::Error& e) 00189 { 00190 if (this->m_onError) 00191 this->m_onError (&e); 00192 } 00193 catch (cms::Exception& e) 00194 { 00195 e.append (" from VisL1GlobalTriggerReadoutRecordTwig::onNewEvent "); 00196 e.append (this->name ()); 00197 00198 if (this->m_onCmsException) 00199 this->m_onCmsException (&e); 00200 } 00201 catch (std::exception& e) 00202 { 00203 if (this->m_onException) 00204 this->m_onException (&e); 00205 } 00206 catch (...) 00207 { 00208 if (this->m_onUnhandledException) 00209 this->m_onUnhandledException (); 00210 } 00211 00212 IgRepSet::invalidate (this, IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK); 00213 }
Reimplemented from VisQueuedTwig.
Definition at line 216 of file VisL1GlobalTriggerReadoutRecordTwig.cc.
References i, it, m_algos, m_decision, m_friendlyName, m_instanceName, m_moduleLabel, m_passed, m_processName, m_text, m_triggerMaskAlgoTrig, m_triggerMaskTechTrig, IgTextRep::setText(), and VisQueuedTwig::update().
00217 { 00218 // Get debugging dump. 00219 VisQueuedTwig::update (rep); 00220 00221 // Prepare property description. 00222 std::ostringstream text; 00223 text << m_text << "<br>"; 00224 00225 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00226 { 00227 text << "<table width='100%' border=1>" 00228 << "<TR align = center>" 00229 << "<TH>Decision</TH>" 00230 << "<TD COLSPAN=8>Decision Word</TD>" 00231 << "</TR>"; 00232 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00233 text.setf (std::ios::right, std::ios::adjustfield); 00234 00235 text << "<TR align = left>" 00236 << "<TD " << std::setw (3); 00237 m_passed ? (text << "bgcolor=#00ff00>True") : (text << "bgcolor=#ff0000>False"); 00238 text << "</TD>" 00239 << "<TD>" << std::setw (2) << std::setprecision (3); 00240 00241 unsigned int i = 0; 00242 for (std::vector<bool>::const_iterator it = m_decision.begin (), itEnd = m_decision.end (); it != itEnd; ++it) 00243 { 00244 (*it) ? (text << "<b>X</b>"):(text << "0"); 00245 if (((++i % 16) == 0) && i < m_decision.size ()) 00246 { 00247 text << "</TD><TD>"; 00248 } 00249 else if (i >= m_decision.size ()) 00250 text << "</TD>"; 00251 } 00252 00253 text << "</TR>"; 00254 i = 0; 00255 text << "<TR align = left>" 00256 << "<TD>Algo Mask</TD><TD>"; 00257 for (std::vector<unsigned int>::const_iterator ait = m_triggerMaskAlgoTrig.begin (), aitEnd = m_triggerMaskAlgoTrig.end (); 00258 ait != aitEnd; ++ait) 00259 { 00260 text << (*ait); 00261 if (((++i % 16) == 0) && i < m_triggerMaskAlgoTrig.size ()) 00262 { 00263 text << "</TD><TD>"; 00264 } 00265 else if (i >= m_triggerMaskAlgoTrig.size ()) 00266 text << "</TD>"; 00267 } 00268 text << "</TD></TR>"; 00269 i = 0; 00270 text << "<TR align = left>" 00271 << "<TD>Tech Mask</TD><TD>"; 00272 for (std::vector<unsigned int>::const_iterator tit = m_triggerMaskTechTrig.begin (), titEnd = m_triggerMaskTechTrig.end (); 00273 tit != titEnd; ++tit) 00274 { 00275 text << (*tit); 00276 if (((++i % 16) == 0) && i < m_triggerMaskTechTrig.size ()) 00277 { 00278 text << "</TD><TD>"; 00279 } 00280 else if (i >= m_triggerMaskTechTrig.size ()) 00281 text << "</TD>"; 00282 } 00283 text << "</TD></TR>"; 00284 00285 text << "</table>"; 00286 for (std::vector<std::pair<std::string, bool> >::const_iterator ait = m_algos.begin (), aitEnd = m_algos.end (); ait != aitEnd; ++ait) 00287 { 00288 if ((*ait).second) 00289 text << (*ait).first << "<br>"; 00290 } 00291 } 00292 00293 // Send it over. 00294 IgQtLock (); 00295 00296 rep->setText (text.str ()); 00297 }
Reimplemented from VisQueuedTwig.
Definition at line 300 of file VisL1GlobalTriggerReadoutRecordTwig.cc.
References Ig3DBaseRep::clear(), m_algos, Ig3DBaseRep::node(), reset(), IgSbColorMap::unpack(), VisQueuedTwig::update(), x, y, and z.
00301 { 00302 // Get debugging dump. 00303 VisQueuedTwig::update (rep); 00304 00305 // Lock the Qt application. 00306 IgQtLock (); 00307 rep->clear (); 00308 00309 SoAnnotation *sep = new SoAnnotation; 00310 SoMaterial *mat = new SoMaterial; 00311 float rgbcomponents [4]; 00312 IgSbColorMap::unpack (0x8b898900, rgbcomponents); // snow4 00313 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00314 sep->addChild (mat); 00315 00316 SoFont* labelFont = new SoFont; 00317 labelFont->size.setValue (14.0); 00318 labelFont->name.setValue ("Arial"); 00319 sep->addChild (labelFont); 00320 00321 float x = -15.0; 00322 float y = 7.0; 00323 float z = 0.0; 00324 00325 SbVec3f pos = SbVec3f (x, y, z); 00326 00327 for (std::vector<std::pair<std::string, bool> >::const_iterator ait = m_algos.begin (), aitEnd = m_algos.end (); ait != aitEnd; ++ait) 00328 { 00329 if ((*ait).second) 00330 { 00331 SoText2 *eventLabel = new SoText2; 00332 eventLabel->string = (*ait).first.c_str (); 00333 00334 SoTranslation *labelTranslation = new SoTranslation; 00335 00336 labelTranslation->translation = pos; 00337 sep->addChild (labelTranslation); 00338 sep->addChild (eventLabel); 00339 y = 0.3; 00340 pos = SbVec3f (0.0, -y, 0.0); 00341 } 00342 } 00343 SoResetTransform *reset = new SoResetTransform; 00344 sep->addChild (reset); 00345 00346 rep->node ()->addChild (sep); 00347 }
std::vector<std::pair<std::string, bool> > VisL1GlobalTriggerReadoutRecordTwig::m_algos [private] |
Definition at line 44 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
std::vector<bool> VisL1GlobalTriggerReadoutRecordTwig::m_decision [private] |
Definition at line 40 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
std::string VisL1GlobalTriggerReadoutRecordTwig::m_friendlyName [private] |
Definition at line 36 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
std::string VisL1GlobalTriggerReadoutRecordTwig::m_instanceName [private] |
Definition at line 38 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
std::string VisL1GlobalTriggerReadoutRecordTwig::m_moduleLabel [private] |
Definition at line 37 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
Definition at line 43 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
std::string VisL1GlobalTriggerReadoutRecordTwig::m_processName [private] |
Definition at line 39 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
Reimplemented from VisQueuedTwig.
Definition at line 34 of file VisL1GlobalTriggerReadoutRecordTwig.h.
std::string VisL1GlobalTriggerReadoutRecordTwig::m_text [private] |
Definition at line 35 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
std::vector<unsigned int> VisL1GlobalTriggerReadoutRecordTwig::m_triggerMaskAlgoTrig [private] |
Definition at line 41 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().
std::vector<unsigned int> VisL1GlobalTriggerReadoutRecordTwig::m_triggerMaskTechTrig [private] |
Definition at line 42 of file VisL1GlobalTriggerReadoutRecordTwig.h.
Referenced by onNewEvent(), and update().