#include <VisReco/VisRecoJets/interface/VisCandidateTwig.h>
Public Member Functions | |
virtual void | onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | scaleChanged (void) |
virtual void | update (IgRZRep *rep) |
virtual void | update (IgRPhiRep *rep) |
virtual void | update (IgLegoRep *rep) |
Update object. | |
virtual void | update (Ig3DRep *rep) |
Update object. | |
virtual void | update (IgTextRep *rep) |
VisCandidateTwig (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 | |
VisCaloAnnotation | m_annotation |
std::vector< const reco::Candidate * > | m_candidates |
VisEnergyCut | m_cut |
VisCaloEnergyScale | m_escale |
const std::string | m_friendlyName |
const std::string | m_instanceName |
const std::string | m_moduleLabel |
const std::string | m_processName |
VisLegoScale | m_scale |
std::string | m_text |
Definition at line 25 of file VisCandidateTwig.h.
VisCandidateTwig::VisCandidateTwig | ( | 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 65 of file VisCandidateTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00071 : VisQueuedTwig (state, parent, name), 00072 m_text (name), 00073 m_friendlyName (friendlyName), 00074 m_moduleLabel (moduleLabel), 00075 m_instanceName (instanceName), 00076 m_processName (processName), 00077 m_scale (state, lat::CreateCallback (this, &VisCandidateTwig::scaleChanged)), 00078 m_cut (state, lat::CreateCallback (this, &VisCandidateTwig::scaleChanged)), 00079 m_escale (state, lat::CreateCallback (this, &VisCandidateTwig::scaleChanged)), 00080 m_annotation (state, lat::CreateCallback (this, &VisCandidateTwig::scaleChanged)) 00081 { 00082 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00083 if (! tfService) 00084 { 00085 tfService = new VisTwigFactroyService (state); 00086 } 00087 edm::TypeID candID (typeid (reco::CandidateCollection)); 00088 tfService->registerTwig (candID.friendlyClassName (), &createThisTwig); 00089 }
void VisCandidateTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 97 of file VisCandidateTwig.cc.
References arg, e, exception, edm::Event::id(), edm::Handle< T >::isValid(), it, m_candidates, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_text, IgSimpleTwig::name(), VisQueuedTwig::onBaseInvalidate(), and VisQueuedTwig::onNewEvent().
00099 { 00100 // Get debugging dump. 00101 VisQueuedTwig::onNewEvent (event, eventSetup); 00102 00103 m_text = QString ("Run # %1, event # %2") 00104 .arg (event.id ().run ()) 00105 .arg (event.id ().event ()).latin1 (); 00106 m_candidates.clear (); 00107 00108 edm::Handle<reco::CandidateCollection> collections; 00109 try 00110 { 00111 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00112 { 00113 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00114 event.get (visSel, collections); 00115 } 00116 } 00117 catch (cms::Exception& e) 00118 { 00119 if (this->m_onCmsException) 00120 this->m_onCmsException (&e); 00121 } 00122 catch (lat::Error &e) 00123 { 00124 if (this->m_onError) 00125 this->m_onError (&e); 00126 } 00127 catch (std::exception &e) 00128 { 00129 if (this->m_onException) 00130 this->m_onException (&e); 00131 } 00132 catch (...) 00133 { 00134 if (this->m_onUnhandledException) 00135 this->m_onUnhandledException (); 00136 } 00137 if (collections.isValid ()) 00138 { 00139 QString sizeStr = (QString ("%1").arg (collections->size ())); 00140 QString nameStr = QString (this->name ()); 00141 int ib = nameStr.find ("["); 00142 int ie = nameStr.find ("]"); 00143 nameStr.replace (ib + 1, ie - 1, sizeStr); 00144 this->name (nameStr); 00145 00146 for (reco::CandidateCollection::const_iterator it = collections->begin (), itEnd = collections->end (); it != itEnd; ++it) 00147 { 00148 m_candidates.push_back ((*it).clone ()); 00149 } 00150 } 00151 00152 VisQueuedTwig::onBaseInvalidate (); 00153 }
Definition at line 92 of file VisCandidateTwig.cc.
References IgRepSet::invalidate(), and IgTwig::SELF_MASK.
00093 { IgRepSet::invalidate (this, SELF_MASK); }
Update object.
Reimplemented from VisQueuedTwig.
Definition at line 294 of file VisCandidateTwig.cc.
References ASSERT, Ig3DBaseRep::clear(), e, eta, exception, DBSPlugin::get(), i, it, label, m_annotation, m_candidates, m_cut, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_scale, Ig3DBaseRep::node(), phi, VisEventSetupService::phi4eta(), VisQueuedTwig::state(), IgSbColorMap::unpack(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00295 { 00296 // Get debugging dump. 00297 VisQueuedTwig::update (rep); 00298 00299 // Lock the Qt application. 00300 IgQtLock (); 00301 00302 rep->clear (); 00303 00304 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00305 ASSERT (esService); 00306 00307 SoSeparator *contents = new SoSeparator; 00308 00309 SoSeparator *candSep = new SoSeparator; 00310 contents->addChild (candSep); 00311 00312 SoSeparator *labelSep = new SoSeparator; 00313 contents->addChild (labelSep); 00314 00315 if (! m_candidates.empty ()) 00316 { 00317 try 00318 { 00319 unsigned colour [10] = { 0xff000000, 0x00ff0000, 0xffff0000, // red green yellow 00320 0xff00ff00, 0x00ffff00, 0xd0dfff00, // magenta cyan 00321 0xff000fff, 0x00ffff00, 0xe00fff00, 00322 0xff00ee00}; 00323 int i = 0; 00324 00325 for (std::vector<const reco::Candidate *>::const_iterator it = m_candidates.begin (), itEnd = m_candidates.end (); it != itEnd; ++it) 00326 { 00327 double et = (*it)->et (); 00328 if (et > m_cut.value ()) 00329 { 00330 if (i == 10) i = 0; 00331 00332 SoSeparator *sep = new SoSeparator; 00333 candSep->addChild (sep); 00334 SoMaterial *mat = new SoMaterial; 00335 float rgbcomponents [4]; 00336 IgSbColorMap::unpack (colour [i++], rgbcomponents); 00337 mat->diffuseColor.setValue (rgbcomponents); 00338 sep->addChild (mat); 00339 00340 SoFont *font = new SoFont; 00341 font->name = "Times-Roman"; 00342 font->size = 14.0; 00343 sep->addChild (font); 00344 00345 double eta = (*it)->eta (); 00346 double phi = (*it)->phi (); 00347 if (phi < 0) phi += 2 * M_PI; 00348 00349 if (m_annotation.value ()) 00350 { 00351 QString label = QString ("Et = %1 GeV") 00352 .arg (et, 0, 'f', 2); 00353 SoSeparator *labelSep = new SoSeparator; 00354 SoText2 *labelText = new SoText2; 00355 labelText->string = label.latin1 (); 00356 SoTranslation *labelTranslation = new SoTranslation; 00357 double labelHight = et / m_scale.value () + 0.2; 00358 00359 labelTranslation->translation = SbVec3f (phi, labelHight, eta); //m_scale.value () 00360 00361 labelSep->addChild (labelTranslation); 00362 labelSep->addChild (labelText); 00363 sep->addChild (labelSep); 00364 } 00365 00366 SoSeparator *tsep = new SoSeparator; 00367 00368 SoTranslation *localTransl = new SoTranslation; 00369 localTransl->translation.setValue (SbVec3f (phi, et / (2 * m_scale.value ()), eta)); 00370 00371 SoCube *towerBox = new SoCube; 00372 towerBox->height = et / m_scale.value () + 0.001; 00373 if (fabs(eta) > 1.74) towerBox->width = 0.176f; 00374 else towerBox->width = 0.089; 00375 towerBox->depth = esService->phi4eta (fabs(eta)) + 0.002; 00376 00377 tsep->addChild (localTransl); 00378 tsep->addChild (towerBox); 00379 sep->addChild (tsep); 00380 } 00381 } 00382 } 00383 catch (cms::Exception& e) 00384 { 00385 if (this->m_onCmsException) 00386 this->m_onCmsException (&e); 00387 } 00388 catch (lat::Error &e) 00389 { 00390 if (this->m_onError) 00391 this->m_onError (&e); 00392 } 00393 catch (std::exception &e) 00394 { 00395 if (this->m_onException) 00396 this->m_onException (&e); 00397 } 00398 catch (...) 00399 { 00400 if (this->m_onUnhandledException) 00401 this->m_onUnhandledException (); 00402 } 00403 } 00404 00405 rep->node ()->addChild (contents); 00406 }
Update object.
Reimplemented from VisQueuedTwig.
Definition at line 227 of file VisCandidateTwig.cc.
References Ig3DBaseRep::clear(), e, exception, i, it, m_candidates, m_cut, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, Ig3DBaseRep::node(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00228 { 00229 // Get debugging dump. 00230 VisQueuedTwig::update (rep); 00231 00232 // Lock the Qt application. 00233 IgQtLock (); 00234 rep->clear (); 00235 00236 SoSeparator *contents = new SoSeparator; 00237 SoSeparator *candSep = new SoSeparator; 00238 contents->addChild (candSep); 00239 00240 SoSeparator *labelSep = new SoSeparator; 00241 contents->addChild (labelSep); 00242 00243 if (! m_candidates.empty ()) 00244 { 00245 try 00246 { 00247 unsigned colour [10] = { 0xff000000, 0x00ff0000, 0xffff0000, // red green yellow 00248 0xff00ff00, 0x00ffff00, 0xd0dfff00, // magenta cyan 00249 0xff000fff, 0x00ffff00, 0xe00fff00, 00250 0xff00ee00}; 00251 int i = 0; 00252 00253 for (std::vector<const reco::Candidate *>::const_iterator it = m_candidates.begin (), itEnd = m_candidates.end (); it != itEnd; ++it) 00254 { 00255 double et = (*it)->et (); 00256 if (et > m_cut.value ()) 00257 { 00258 SbVec3f tipPos (SbVec3f ((*it)->px () / 100.0, (*it)->py () / 100.0, (*it)->pz () / 100.0)); 00259 SbVec3f tailPos (SbVec3f ((*it)->vx () / 100.0, (*it)->vy () / 100.0, (*it)->vz () / 100.0)); 00260 IgSoArrow* arrow = new IgSoArrow; 00261 arrow->tail.setValue (tailPos); 00262 arrow->tip.setValue (tipPos); 00263 candSep->addChild (arrow); 00264 } 00265 } 00266 } 00267 catch (cms::Exception& e) 00268 { 00269 if (this->m_onCmsException) 00270 this->m_onCmsException (&e); 00271 } 00272 catch (lat::Error &e) 00273 { 00274 if (this->m_onError) 00275 this->m_onError (&e); 00276 } 00277 catch (std::exception &e) 00278 { 00279 if (this->m_onException) 00280 this->m_onException (&e); 00281 } 00282 catch (...) 00283 { 00284 if (this->m_onUnhandledException) 00285 this->m_onUnhandledException (); 00286 } 00287 } 00288 00289 rep->node ()->addChild (contents); 00290 }
Reimplemented from VisQueuedTwig.
Definition at line 156 of file VisCandidateTwig.cc.
References e, eta, exception, it, m_candidates, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_text, n, phi, IgTextRep::setText(), and VisQueuedTwig::update().
00157 { 00158 // Get debugging dump. 00159 VisQueuedTwig::update (rep); 00160 00161 // Prepare property description. 00162 std::ostringstream text; 00163 00164 text << m_text << "<br>"; 00165 00166 text << "<table width='100%' border=1>" 00167 << "<TR align = center>" 00168 << "<TH>Number</TH>" 00169 << "<TH>E<SUB>T (GeV)</TH>" 00170 << "<TH>eta</TH>" 00171 << "<TH>phi [rad]</TH>" 00172 << "</TR>"; 00173 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00174 text.setf (std::ios::right, std::ios::adjustfield); 00175 00176 int n = 0; 00177 if (! m_candidates.empty ()) 00178 { 00179 try 00180 { 00181 for (std::vector<const reco::Candidate *>::const_iterator it = m_candidates.begin (), itEnd = m_candidates.end (); it != itEnd; ++it) 00182 { 00183 double et = (*it)->et (); 00184 double phi = (*it)->phi (); 00185 double eta = (*it)->eta (); 00186 00187 text << "<TR align = right>" 00188 << "<TD>" << std::setw (3) << n++ << "</TD>" 00189 << "<TD>" << std::setw (2) << std::setprecision (3) << et << "</TD>" 00190 << "<TD>" << std::setw (6) << std::setprecision (3) << eta << "</TD>" 00191 << "<TD>" << std::setw (5) << std::setprecision (3) << phi << "</TD>" 00192 << "</TR>"; 00193 } 00194 } 00195 catch (cms::Exception& e) 00196 { 00197 if (this->m_onCmsException) 00198 this->m_onCmsException (&e); 00199 } 00200 catch (lat::Error &e) 00201 { 00202 if (this->m_onError) 00203 this->m_onError (&e); 00204 } 00205 catch (std::exception &e) 00206 { 00207 if (this->m_onException) 00208 this->m_onException (&e); 00209 } 00210 catch (...) 00211 { 00212 if (this->m_onUnhandledException) 00213 this->m_onUnhandledException (); 00214 } 00215 } 00216 00217 text << "</table>"; 00218 00219 // Send it over. 00220 IgQtLock (); 00221 00222 rep->setText (text.str ()); 00223 }
std::vector<const reco::Candidate *> VisCandidateTwig::m_candidates [private] |
VisEnergyCut VisCandidateTwig::m_cut [private] |
VisCaloEnergyScale VisCandidateTwig::m_escale [private] |
Definition at line 58 of file VisCandidateTwig.h.
const std::string VisCandidateTwig::m_friendlyName [private] |
const std::string VisCandidateTwig::m_instanceName [private] |
const std::string VisCandidateTwig::m_moduleLabel [private] |
const std::string VisCandidateTwig::m_processName [private] |
VisLegoScale VisCandidateTwig::m_scale [private] |
std::string VisCandidateTwig::m_text [private] |