#include <VisSimulation/VisSimData/interface/VisHepMCProductTwig.h>
Public Member Functions | |
virtual void | onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | update (IgRZRep *rep) |
virtual void | update (IgRPhiRep *rep) |
virtual void | update (IgLegoRep *rep) |
virtual void | update (Ig3DRep *rep) |
virtual void | update (IgTextRep *rep) |
VisHepMCProductTwig (IgState *state, IgTwig *parent, const std::string &name="", const std::string &friendlyName="", const std::string &moduleLabel="", const std::string &instanceName="", const std::string &productName="") | |
Private Attributes | |
std::string | m_friendlyName |
std::string | m_instanceName |
std::string | m_moduleLabel |
std::map< int, HepMC::GenParticle * > | m_pMap |
std::string | m_processName |
std::string | m_text |
std::map< int, IgSimpleTwig * > | m_twigMap |
Definition at line 21 of file VisHepMCProductTwig.h.
VisHepMCProductTwig::VisHepMCProductTwig | ( | IgState * | state, | |
IgTwig * | parent, | |||
const std::string & | name = "" , |
|||
const std::string & | friendlyName = "" , |
|||
const std::string & | moduleLabel = "" , |
|||
const std::string & | instanceName = "" , |
|||
const std::string & | productName = "" | |||
) |
Definition at line 65 of file VisHepMCProductTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00070 : VisQueuedTwig (state, parent, name), 00071 m_text (name), 00072 m_friendlyName (friendlyName), 00073 m_moduleLabel (moduleLabel), 00074 m_instanceName (instanceName), 00075 m_processName (processName) 00076 { 00077 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00078 if (! tfService) 00079 { 00080 tfService = new VisTwigFactroyService (state); 00081 } 00082 edm::TypeID hepMCID (typeid (edm::HepMCProduct)); 00083 tfService->registerTwig (hepMCID.friendlyClassName (), &createThisTwig); 00084 }
void VisHepMCProductTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 87 of file VisHepMCProductTwig.cc.
References arg, IgCompoundTwig::children(), GenMuonPlsPt100GeV_cfg::cout, IgCompoundTwig::destroy(), e, end, exception, edm::EventSetup::getData(), i, edm::Event::id(), IgRepSet::invalidate(), m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pMap, m_processName, m_text, m_twigMap, IgSimpleTwig::name(), VisQueuedTwig::onNewEvent(), p, IgTwig::SELF_MASK, and IgTwig::STRUCTURE_MASK.
00089 { 00090 // Get debugging dump. 00091 VisQueuedTwig::onNewEvent (event, eventSetup); 00092 00093 IgQtLock (); 00094 00095 if (children ()) destroy (); 00096 00097 m_text = (QString ("Run # %1, event # %2") 00098 .arg (event.id ().run ()) 00099 .arg (event.id ().event ()).latin1 ()); 00100 00101 std::vector<edm::Handle<edm::HepMCProduct> > evtHandles; 00102 00103 try 00104 { 00105 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00106 { 00107 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00108 event.getMany (visSel, evtHandles); 00109 } 00110 else 00111 { 00112 event.getManyByType (evtHandles); 00113 } 00114 } 00115 catch (cms::Exception& e) 00116 { 00117 if (this->m_onCmsException) 00118 this->m_onCmsException (&e); 00119 } 00120 catch (lat::Error &e) 00121 { 00122 if (this->m_onError) 00123 this->m_onError (&e); 00124 } 00125 catch (std::exception &e) 00126 { 00127 if (this->m_onException) 00128 this->m_onException (&e); 00129 } 00130 catch (...) 00131 { 00132 if (this->m_onUnhandledException) 00133 this->m_onUnhandledException (); 00134 } 00135 00136 if (! evtHandles.empty ()) 00137 { 00138 edm::ESHandle < ParticleDataTable > particle_data_table; // my 00139 eventSetup.getData( particle_data_table ); // my 00140 00141 std::vector<edm::Handle<edm::HepMCProduct> >::iterator i; 00142 for (i = evtHandles.begin (); i != evtHandles.end (); ++i) 00143 { 00144 if ((i)->isValid ()) 00145 { 00146 const HepMC::GenEvent *evt = (*i)->GetEvent (); 00147 00148 for (HepMC::GenEvent::particle_const_iterator p = evt->particles_begin (); 00149 p != evt->particles_end (); ++p) 00150 { 00151 m_pMap [(*p)->barcode ()] = (*p); 00152 00153 std::vector<HepMC::GenParticle *> parents; 00154 if ((*p)->production_vertex ()) 00155 { 00156 for (HepMC::GenVertex::particle_iterator mother 00157 = (*p)->production_vertex ()-> 00158 particles_begin (HepMC::parents); 00159 mother != (*p)->production_vertex ()-> 00160 particles_end (HepMC::parents); 00161 ++mother) 00162 { 00163 std::cout << "\t"; 00164 (*mother)->print (); 00165 parents.push_back (*mother); 00166 } 00167 } // = (*p)->listParents (); 00168 if (parents.empty ()) 00169 { 00170 const HepPDT::ParticleData* pd = 00171 particle_data_table->particle((*p)->pdg_id ()); // my 00172 std::string name = pd->name(); // my 00173 VisGenParticleTwig *ptwig = 00174 new VisGenParticleTwig (this, name, *(*p)); // my 00175 //VisGenParticleTwig *ptwig = new VisGenParticleTwig (this, itoa ((*p)->pdg_id ()), *(*p)); 00176 m_twigMap [(*p)->barcode ()] = ptwig; 00177 } 00178 00179 std::vector<HepMC::GenParticle *> children; 00180 if ((*p)->end_vertex ()) 00181 { 00182 for (HepMC::GenVertex::particle_iterator child 00183 = (*p)->end_vertex ()-> 00184 particles_begin (HepMC::children); 00185 child != (*p)->end_vertex ()-> 00186 particles_end (HepMC::children); 00187 ++child) 00188 { 00189 std::cout << "\t"; 00190 (*child)->print (); 00191 parents.push_back (*child); 00192 } 00193 } 00194 00195 if (! children.empty ()) 00196 { 00197 for (std::vector<HepMC::GenParticle *>::const_iterator ic = children.begin (), end = children.end (); ic != end; ++ic) 00198 { 00199 const HepPDT::ParticleData* pd = 00200 particle_data_table->particle((*ic)->pdg_id ()); // my 00201 std::string name = pd->name(); // my 00202 VisGenParticleTwig *ptwig = new VisGenParticleTwig // my 00203 (m_twigMap [(*p)->barcode ()], name, *(*ic)); 00204 00205 // VisGenParticleTwig *ptwig = new VisGenParticleTwig (m_twigMap [(*p)->barcode ()], itoa ((*ic)->pdg_id ()), *(*ic)); 00206 m_twigMap [(*ic)->barcode ()] = ptwig; 00207 } 00208 } 00209 } 00210 } 00211 } 00212 } 00213 00214 IgRepSet::invalidate (this->parent (), IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK); 00215 }
Reimplemented from VisQueuedTwig.
Definition at line 279 of file VisHepMCProductTwig.cc.
References VisQueuedTwig::update().
00280 { 00281 // Get debugging dump. 00282 VisQueuedTwig::update (rep); 00283 }
Reimplemented from VisQueuedTwig.
Definition at line 272 of file VisHepMCProductTwig.cc.
References VisQueuedTwig::update().
00273 { 00274 // Get debugging dump. 00275 VisQueuedTwig::update (rep); 00276 }
Reimplemented from VisQueuedTwig.
Definition at line 265 of file VisHepMCProductTwig.cc.
References VisQueuedTwig::update().
00266 { 00267 // Get debugging dump. 00268 VisQueuedTwig::update (rep); 00269 }
Reimplemented from VisQueuedTwig.
Definition at line 256 of file VisHepMCProductTwig.cc.
References Ig3DBaseRep::clear(), and VisQueuedTwig::update().
00257 { 00258 // Get debugging dump. 00259 VisQueuedTwig::update (rep); 00260 IgQtLock (); 00261 rep->clear (); 00262 }
Reimplemented from VisQueuedTwig.
Definition at line 218 of file VisHepMCProductTwig.cc.
References it, itoa(), m_pMap, IgSimpleTwig::name(), IgTextRep::setText(), and VisQueuedTwig::update().
00219 { 00220 // Get debugging dump. 00221 VisQueuedTwig::update (rep); 00222 IgQtLock (); 00223 00224 // Prepare property description. 00225 std::ostringstream text; 00226 00227 text << "<table width='100%' border=1>" 00228 << "<TR align = center>" 00229 << "<TH>Number</TH>" 00230 << "<TH>Bar code</TH>" 00231 << "<TH>Name</TH>" 00232 << "</TR>"; 00233 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00234 text.setf (std::ios::right, std::ios::adjustfield); 00235 00236 int nPart = 0; 00237 00238 for (std::map<int, HepMC::GenParticle *>::iterator it = m_pMap.begin (); 00239 it != m_pMap.end (); it++) 00240 { 00241 std::string name = itoa ((*it).second->pdg_id ()); 00242 00243 text << "<TR align = right>" 00244 << "<TD>" << std::setw (3) << nPart++ << "</TD>" 00245 << "<TD>" << (*it).first << "</TD>" 00246 << "<TD>" << name << "</TD>"; 00247 } 00248 00249 text << "</table>"; 00250 00251 // Send it over. 00252 rep->setText (text.str ()); 00253 }
std::string VisHepMCProductTwig::m_friendlyName [private] |
std::string VisHepMCProductTwig::m_instanceName [private] |
std::string VisHepMCProductTwig::m_moduleLabel [private] |
std::map<int, HepMC::GenParticle *> VisHepMCProductTwig::m_pMap [private] |
std::string VisHepMCProductTwig::m_processName [private] |
std::string VisHepMCProductTwig::m_text [private] |
std::map<int, IgSimpleTwig *> VisHepMCProductTwig::m_twigMap [private] |