00001
00002
00003 #include "VisReco/VisMuon/interface/VisMuonTwig.h"
00004 #include "VisFramework/VisFrameworkBase/interface/VisTwigFactroyService.h"
00005 #include "VisFramework/VisFrameworkBase/interface/VisEventSelector.h"
00006 #include "VisFramework/VisEventSetup/interface/VisEventSetupService.h"
00007 #include "VisReco/VisMuon/interface/VisMuonEnergyTwig.h"
00008 #include "VisReco/VisMuon/interface/VisRefitTrackTwig.h"
00009 #include "DataFormats/MuonReco/interface/Muon.h"
00010 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00011 #include "DataFormats/MuonReco/interface/MuonChamberMatch.h"
00012 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
00013 #include "DataFormats/TrackReco/interface/Track.h"
00014 #include "FWCore/Framework/interface/Event.h"
00015 #include "FWCore/Framework/interface/EventSetup.h"
00016 #include "Iguana/Models/interface/IgTextRep.h"
00017 #include "Iguana/GLModels/interface/Ig3DBaseModel.h"
00018 #include "Iguana/GLModels/interface/Ig3DRep.h"
00019 #include "Iguana/GLModels/interface/IgLegoRep.h"
00020 #include "Iguana/GLModels/interface/IgRPhiRep.h"
00021 #include "Iguana/GLModels/interface/IgRZRep.h"
00022 #include "Iguana/Framework/interface/IgRepSet.h"
00023 #include "Iguana/Inventor/interface/IgSbColorMap.h"
00024 #include "Iguana/Inventor/interface/IgSoIdealTrack.h"
00025 #include "Iguana/Inventor/interface/IgParticleChar.h"
00026 #include "Iguana/Studio/interface/IgDocumentData.h"
00027 #include "Iguana/Studio/interface/IgQtLock.h"
00028 #include <Inventor/engines/SoTimeCounter.h>
00029 #include <Inventor/engines/SoEngine.h>
00030 #include <Inventor/nodes/SoMaterial.h>
00031 #include <Inventor/nodes/SoSeparator.h>
00032 #include <Inventor/nodes/SoText2.h>
00033 #include <Inventor/nodes/SoTranslation.h>
00034 #include <qstring.h>
00035 #include <sstream>
00036 #include <iomanip>
00037 #include <classlib/utils/Error.h>
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 namespace
00048 {
00049 VisQueuedTwig *
00050 createThisTwig (IgState *state, IgTwig *parent,
00051 const std::string &name,
00052 const std::string &friendlyName,
00053 const std::string &modLabel,
00054 const std::string &instanceName,
00055 const std::string &processName)
00056 {
00057 IgTwig *rootTwig = IgDocumentData::get (state)->root ();
00058 IgTwig *eventTwig = 0;
00059 eventTwig = rootTwig->lookup ("/Objects/CMS Event and Detector/Muon Event/Muons");
00060
00061 if (! eventTwig)
00062 eventTwig = parent;
00063 else
00064 {
00065 IgRepSet::invalidate (eventTwig->parent (), IgTwig::STRUCTURE_MASK);
00066 }
00067 return new VisMuonTwig (state, eventTwig, "[N/A] Muon (" + name + ")",
00068 friendlyName, modLabel, instanceName, processName);
00069 }
00070 }
00071
00072
00073
00074
00075 VisMuonTwig::VisMuonTwig (IgState *state, IgTwig *parent,
00076 const std::string &name ,
00077 const std::string &friendlyName ,
00078 const std::string &moduleLabel ,
00079 const std::string &instanceName ,
00080 const std::string &processName )
00081 : VisQueuedTwig (state, parent, name),
00082 m_text ("no info"),
00083 m_friendlyName (friendlyName),
00084 m_moduleLabel (moduleLabel),
00085 m_instanceName (instanceName),
00086 m_processName (processName),
00087 m_animate (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00088 m_counterMax (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00089 m_counterMin (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00090 m_frequency (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00091 m_BField (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00092 m_RMax (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00093 m_ZMax (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00094 m_t0 (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00095 m_dt (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00096 m_annot (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00097 m_showDets (state, lat::CreateCallback (this, &VisMuonTwig::configChanged))
00098 {
00099 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state);
00100 if (! tfService)
00101 {
00102 tfService = new VisTwigFactroyService (state);
00103 }
00104 edm::TypeID muonID (typeid (reco::MuonCollection));
00105 tfService->registerTwig (muonID.friendlyClassName (), &createThisTwig);
00106 }
00107
00108 VisMuonTwig::VisMuonTwig (IgState *state, IgTwig *parent,
00109 const std::string &name,
00110 const std::string &friendlyName,
00111 const std::string &moduleLabel,
00112 const std::string &instanceName,
00113 const std::string &processName,
00114 const reco::Muon &muon,
00115 std::vector<DetId> &dets)
00116 : VisQueuedTwig (state, parent, name),
00117 m_text ("no info"),
00118 m_friendlyName (friendlyName),
00119 m_moduleLabel (moduleLabel),
00120 m_instanceName (instanceName),
00121 m_processName (processName),
00122 m_animate (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00123 m_counterMax (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00124 m_counterMin (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00125 m_frequency (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00126 m_BField (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00127 m_RMax (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00128 m_ZMax (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00129 m_t0 (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00130 m_dt (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00131 m_annot (state, lat::CreateCallback (this, &VisMuonTwig::configChanged)),
00132 m_showDets (state, lat::CreateCallback (this, &VisMuonTwig::configChanged))
00133 {
00134 m_muons.push_back (muon);
00135 m_dets = dets;
00136 }
00137
00138 void
00139 VisMuonTwig::configChanged (void)
00140 { IgRepSet::invalidate (this, SELF_MASK); }
00141
00142 void
00143 VisMuonTwig::onNewEvent (const edm::Event &event,
00144 const edm::EventSetup &eventSetup)
00145 {
00146 if (this->children ())
00147 {
00148 for (unsigned int i = 0; i < this->children (); ++i)
00149 this->child (i)->destroy ();
00150 }
00151
00152
00153 VisQueuedTwig::onNewEvent (event, eventSetup);
00154
00155 typedef std::vector<edm::Handle<reco::MuonCollection> > Collections;
00156 Collections muonCollections;
00157
00158 m_muons.clear ();
00159 m_dets.clear ();
00160
00161 m_text = (QString ("Run # %1, event # %2")
00162 .arg (event.id ().run ())
00163 .arg (event.id ().event ()).latin1 ());
00164
00165 try
00166 {
00167 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ()))
00168 {
00169 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName);
00170 event.getMany (visSel, muonCollections);
00171 }
00172
00173
00174
00175
00176 }
00177 catch (cms::Exception& e)
00178 {
00179 e.append (" from VisMuonTwig: ");
00180 e.append (this->name ());
00181
00182 if (this->m_onCmsException)
00183 this->m_onCmsException (&e);
00184 }
00185 catch (lat::Error &e)
00186 {
00187 if (this->m_onError)
00188 this->m_onError (&e);
00189 }
00190 catch (std::exception &e)
00191 {
00192 if (this->m_onException)
00193 this->m_onException (&e);
00194 }
00195 catch (...)
00196 {
00197 if (this->m_onUnhandledException)
00198 this->m_onUnhandledException ();
00199 }
00200 if (! muonCollections.empty ())
00201 {
00202 Collections::iterator i (muonCollections.begin ()), end (muonCollections.end ());
00203 for (; i != end; ++i)
00204 {
00205 const reco::MuonCollection c = *(*i).product ();
00206 QString sizeStr = (QString ("%1").arg (c.size ()));
00207 QString nameStr = QString (this->name ());
00208 int ib = nameStr.find ("[");
00209 int ie = nameStr.find ("]");
00210 nameStr.replace (ib + 1, ie - 1, sizeStr);
00211
00212 this->name (nameStr);
00213
00214 for (reco::MuonCollection::const_iterator muon = c.begin (), tEnd = c.end (); muon != tEnd; ++muon)
00215 {
00216 std::vector<DetId> muonDetIds;
00217 muonDetIds.clear ();
00218
00219 QString label;
00220 if ((*muon).charge () > 0)
00221 {
00222 label = QString ("mu %1 GeV").arg ((*muon).pt(), 0, 'f', 2);
00223 }
00224 else if ((*muon).charge () < 0)
00225 {
00226 label = QString ("mu- %1 GeV").arg ((*muon).pt(), 0, 'f', 2);
00227 }
00228 else
00229 label = QString ("uncharged mu %1 GeV").arg ((*muon).pt(), 0, 'f', 2);
00230
00231 if ((*muon).isMatchesValid ())
00232 {
00233 const std::vector<reco::MuonChamberMatch> &dets = (*muon).matches ();
00234 for (std::vector<reco::MuonChamberMatch>::const_iterator dit = dets.begin (), ditEnd = dets.end (); dit != ditEnd; ++dit)
00235 {
00236 m_dets.push_back ((*dit).id);
00237 muonDetIds.push_back ((*dit).id);
00238 }
00239 }
00240 VisMuonTwig *msep = new VisMuonTwig (state (), dynamic_cast<IgTwig *>(this), label, m_friendlyName, m_moduleLabel,
00241 m_instanceName, m_processName, *muon, muonDetIds);
00242 msep->selfVisible (this->selfVisible ());
00243
00244 m_muons.push_back (*muon);
00245 if ((*muon).innerTrack ().isNonnull ())
00246 {
00247 double pt = (*muon).innerTrack ()->pt ();
00248 label = QString ("Tracker %1 GeV").arg (pt, 0, 'f', 2);
00249 VisRefitTrackTwig *twig = new VisRefitTrackTwig (state (), msep, label, (*muon).innerTrack ());
00250 twig->selfVisible (msep->selfVisible ());
00251 }
00252
00253 if ((*muon).outerTrack ().isNonnull ())
00254 {
00255 double pt = (*muon).outerTrack ()->pt ();
00256 label = QString ("Standalone %1 GeV").arg (pt, 0, 'f', 2);
00257 VisRefitTrackTwig *twig = new VisRefitTrackTwig (state (), msep, label, (*muon).outerTrack ());
00258 twig->selfVisible (msep->selfVisible ());
00259 }
00260
00261 if ((*muon).globalTrack ().isNonnull ())
00262 {
00263 double pt = (*muon).globalTrack ()->pt ();
00264 label = QString ("Global %1 GeV").arg (pt, 0, 'f', 2);
00265 VisRefitTrackTwig *twig = new VisRefitTrackTwig (state (), msep, label, (*muon).globalTrack ());
00266 twig->selfVisible (msep->selfVisible ());
00267 }
00268
00269 if ((*muon).isEnergyValid ())
00270 {
00271 float pt = (*muon).calEnergy ().tower;
00272 label = QString ("CaloTower %1 GeV").arg (pt, 0, 'f', 2);
00273 new VisMuonEnergyTwig (state (), msep, label, (*muon).calEnergy ());
00274 }
00275 }
00276 }
00277 }
00278
00279 IgRepSet::invalidate (this, IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK);
00280 }
00281
00282 void
00283 VisMuonTwig::update (IgTextRep *rep)
00284 {
00285
00286 VisQueuedTwig::update (rep);
00287
00288 std::ostringstream text;
00289
00290 text << setiosflags (std::ios::showpoint | std::ios::fixed);
00291 text.setf (std::ios::right, std::ios::adjustfield);
00292
00293 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ()))
00294 {
00295 text << "Muons = ";
00296
00297 try
00298 {
00299 text << std::setw (3) << m_muons.size ();
00300 int nt = 0;
00301
00302 if (! m_muons.empty ())
00303 {
00304 std::vector<reco::Muon>::iterator i (m_muons.begin ()), end (m_muons.end ());
00305 for (; i != end; ++i)
00306 {
00307 std::ostringstream out_pt;
00308 out_pt << (*i).pt ();
00309 text << "<table width='100%' border=1>"
00310 << "<TR align = center>"
00311 << "<TD COLSPAN = 5>Muon number = " << nt++
00312 << " with Pt = " << out_pt.str ()
00313 << " and charge = " << (*i).charge ()
00314 << ", calo-compatibility = " << muon::caloCompatibility (*i)
00315 << " and segment-compatibility = " << muon::segmentCompatibility (*i)
00316 << "</TD></TR><TR align = center>"
00317 << "<TH>Reference Point (vx, vy, vz)</TH>"
00318 << "<TH>px, py, pz</TH>"
00319 << "<TH>Phi</TH>"
00320 << "<TH>Eta</TH>"
00321 << "<TH># chambers</TH>"
00322 << "</TR>";
00323
00324 text << "<TR><TD>" << std::setw (3) << (*i).vx ()/100. << ", " << (*i).vy()/100. << ", " << (*i).vz()/100. << "</TD>"
00325 << "<TD>" << std::setw (3) << (*i).px () << ", " << (*i).py() << ", " << (*i).pz() << "</TD>"
00326 << "<TD>" << std::setw (3) << (*i).phi () << "</TD>"
00327 << "<TD>" << std::setw (3) << (*i).eta () << "</TD>"
00328 << "<TD>" << std::setw (3) << (*i).numberOfChambers () << "</TD></TR>";
00329
00330 text << "</table>";
00331 }
00332 }
00333 }
00334 catch (cms::Exception& e)
00335 {
00336 e.append (" from VisMuonTwig: ");
00337 e.append (this->name ());
00338
00339 if (this->m_onCmsException)
00340 this->m_onCmsException (&e);
00341 }
00342 catch (lat::Error &e)
00343 {
00344 if (this->m_onError)
00345 this->m_onError (&e);
00346 }
00347 catch (std::exception &e)
00348 {
00349 if (this->m_onException)
00350 this->m_onException (&e);
00351 }
00352 catch (...)
00353 {
00354 if (this->m_onUnhandledException)
00355 this->m_onUnhandledException ();
00356 }
00357 }
00358 else
00359 text << "This is a structure branch. "
00360 << "Select its children for information about "
00361 << "Muon collections. Double mouse click to "
00362 << "expand or collapse it.";
00363
00364 IgQtLock ();
00365 rep->setText (text.str ());
00366 }
00367
00368 void
00369 VisMuonTwig::update (IgLegoRep *rep)
00370 {
00371
00372 VisQueuedTwig::update (rep);
00373 }
00374
00375 void
00376 VisMuonTwig::update (Ig3DRep *rep)
00377 {
00378
00379 VisQueuedTwig::update (rep);
00380
00381 IgQtLock ();
00382 rep->clear ();
00383
00384 if (! m_muons.empty ())
00385 {
00386 SoSeparator *sep = new SoSeparator;
00387
00388 SoMaterial *mat = new SoMaterial;
00389 float rgbcomponents [4];
00390 IgSbColorMap::unpack (0x8b898900, rgbcomponents);
00391 mat->diffuseColor.setValue (SbColor (rgbcomponents));
00392 sep->addChild (mat);
00393
00394 SoTimeCounter *counter = new SoTimeCounter;
00395 counter->max = (short int) m_counterMax.value ();
00396 counter->min = (short int) m_counterMin.value ();
00397 counter->frequency = m_frequency.value ();
00398
00399 std::vector<reco::Muon>::iterator i (m_muons.begin ()), end (m_muons.end ());
00400 for (; i != end; ++i)
00401 {
00402 SoSeparator *labelSep = new SoSeparator;
00403 QString label;
00404 SoText2 *trackLabel = new SoText2;
00405 SoTranslation *trackLabelTranslation = new SoTranslation;
00406
00407 SbVec3f pos = SbVec3f ((*i).px (),
00408 (*i).py (),
00409 (*i).pz ());
00410 pos.normalize ();
00411
00412 trackLabelTranslation->translation = pos * m_ZMax.value ();
00413 labelSep->addChild (trackLabelTranslation);
00414 labelSep->addChild (trackLabel);
00415
00416 IgSoIdealTrack* myTraj = new IgSoIdealTrack;
00417 myTraj->setBField (m_BField.value ());
00418 myTraj->setRMax (m_RMax.value ());
00419 myTraj->setZMax (m_ZMax.value ());
00420 if ((*i).charge () >= 0)
00421 {
00422 myTraj->initialise ((*i).vx()/100., (*i).vy()/100., (*i).vz()/100.,
00423 (*i).px(), (*i).py(), (*i).pz(),
00424 1.0,
00425 IgParticleChar::getByName ("muon"));
00426 label = QString ("mu %1 GeV").arg ((*i).pt(), 0, 'f', 2);
00427 trackLabel->string = label.latin1 ();
00428 }
00429 else
00430 {
00431 myTraj->initialise ((*i).vx()/100., (*i).vy()/100., (*i).vz()/100.,
00432 (*i).px(), (*i).py(), (*i).pz(),
00433 1.0,
00434 IgParticleChar::getByName ("antimuon"));
00435 label = QString ("mu- %1 GeV").arg ((*i).pt(), 0, 'f', 2);
00436 trackLabel->string = label.latin1 ();
00437 }
00438
00439 myTraj->t0.setValue (m_t0.value ());
00440 myTraj->dt.setValue (m_dt.value ());
00441
00442 if (m_animate.value ())
00443 myTraj->dt.connectFrom (&counter->output);
00444
00445
00446
00447 if (m_annot.value () == true)
00448 {
00449 sep->addChild (labelSep);
00450 }
00451 if (m_showDets.value () == true)
00452 {
00453 VisEventSetupService *esService = VisEventSetupService::get (state ());
00454 if (esService)
00455 {
00456 SoSeparator *detSep = esService->buildHitDets (VisEventSetupService::FullDet, m_dets);
00457 if (detSep != NULL)
00458 sep->addChild (detSep);
00459 }
00460 }
00461 }
00462 rep->node ()->addChild (sep);
00463 }
00464 }
00465
00466 void
00467 VisMuonTwig::update (IgRPhiRep *rep)
00468 {
00469
00470 VisQueuedTwig::update (rep);
00471
00472 IgQtLock ();
00473 rep->clear ();
00474
00475 if (! m_muons.empty ())
00476 {
00477 SoSeparator *sep = new SoSeparator;
00478
00479 SoMaterial *mat = new SoMaterial;
00480 float rgbcomponents [4];
00481 IgSbColorMap::unpack (0x8b898900, rgbcomponents);
00482 mat->diffuseColor.setValue (SbColor (rgbcomponents));
00483 sep->addChild (mat);
00484
00485 SoTimeCounter *counter = new SoTimeCounter;
00486 counter->max = (short int) m_counterMax.value ();
00487 counter->min = (short int) m_counterMin.value ();
00488 counter->frequency = m_frequency.value ();
00489
00490 std::vector<reco::Muon>::iterator i (m_muons.begin ()), end (m_muons.end ());
00491 for (; i != end; ++i)
00492 {
00493 SoSeparator *labelSep = new SoSeparator;
00494 QString label;
00495 SoText2 *trackLabel = new SoText2;
00496 SoTranslation *trackLabelTranslation = new SoTranslation;
00497
00498 SbVec3f pos = SbVec3f ((*i).px (),
00499 (*i).py (),
00500 (*i).pz ());
00501 pos.normalize ();
00502
00503 trackLabelTranslation->translation = pos * m_ZMax.value ();
00504 labelSep->addChild (trackLabelTranslation);
00505 labelSep->addChild (trackLabel);
00506
00507 IgSoIdealTrack* myTraj = new IgSoIdealTrack;
00508 myTraj->setBField (m_BField.value ());
00509 myTraj->setRMax (m_RMax.value ());
00510 myTraj->setZMax (m_ZMax.value ());
00511 if ((*i).charge () >= 0)
00512 {
00513 myTraj->initialise ((*i).vx()/100., (*i).vy()/100., (*i).vz()/100.,
00514 (*i).px(), (*i).py(), (*i).pz(),
00515 1.0,
00516 IgParticleChar::getByName ("muon"));
00517 label = QString ("mu %1 GeV").arg ((*i).pt(), 0, 'f', 2);
00518 trackLabel->string = label.latin1 ();
00519 }
00520 else
00521 {
00522 myTraj->initialise ((*i).vx()/100., (*i).vy()/100., (*i).vz()/100.,
00523 (*i).px(), (*i).py(), (*i).pz(),
00524 1.0,
00525 IgParticleChar::getByName ("antimuon"));
00526 label = QString ("mu- %1 GeV").arg ((*i).pt(), 0, 'f', 2);
00527 trackLabel->string = label.latin1 ();
00528 }
00529
00530 myTraj->t0.setValue (m_t0.value ());
00531 myTraj->dt.setValue (m_dt.value ());
00532
00533 if (m_animate.value ())
00534 myTraj->dt.connectFrom (&counter->output);
00535
00536
00537 if (m_annot.value () == true)
00538 {
00539 sep->addChild (labelSep);
00540 }
00541 if (m_showDets.value () == true)
00542 {
00543 VisEventSetupService *esService = VisEventSetupService::get (state ());
00544 if (esService)
00545 {
00546 SoSeparator *detSep = esService->buildHitDets (VisEventSetupService::RPhiDet, m_dets);
00547 if (detSep != NULL)
00548 sep->addChild (detSep);
00549 }
00550 }
00551 }
00552 rep->node ()->addChild (sep);
00553 }
00554 }
00555
00556 void
00557 VisMuonTwig::update (IgRZRep *rep)
00558 {
00559
00560 VisQueuedTwig::update (rep);
00561
00562 IgQtLock ();
00563 rep->clear ();
00564
00565 if (! m_muons.empty ())
00566 {
00567 SoSeparator *sep = new SoSeparator;
00568
00569 SoMaterial *mat = new SoMaterial;
00570 float rgbcomponents [4];
00571 IgSbColorMap::unpack (0x8b898900, rgbcomponents);
00572 mat->diffuseColor.setValue (SbColor (rgbcomponents));
00573 sep->addChild (mat);
00574
00575 SoTimeCounter *counter = new SoTimeCounter;
00576 counter->max = (short int) m_counterMax.value ();
00577 counter->min = (short int) m_counterMin.value ();
00578 counter->frequency = m_frequency.value ();
00579
00580 std::vector<reco::Muon>::iterator i (m_muons.begin ()), end (m_muons.end ());
00581 for (; i != end; ++i)
00582 {
00583 SoSeparator *labelSep = new SoSeparator;
00584 QString label;
00585 SoText2 *trackLabel = new SoText2;
00586 SoTranslation *trackLabelTranslation = new SoTranslation;
00587
00588 SbVec3f pos = SbVec3f ((*i).px (),
00589 (*i).py (),
00590 (*i).pz ());
00591 pos.normalize ();
00592
00593 trackLabelTranslation->translation = pos * m_ZMax.value ();
00594 labelSep->addChild (trackLabelTranslation);
00595 labelSep->addChild (trackLabel);
00596
00597 IgSoIdealTrack* myTraj = new IgSoIdealTrack;
00598 myTraj->setBField (m_BField.value ());
00599 myTraj->setRMax (m_RMax.value ());
00600 myTraj->setZMax (m_ZMax.value ());
00601 if ((*i).charge () >= 0)
00602 {
00603 myTraj->initialise ((*i).vx()/100., (*i).vy()/100., (*i).vz()/100.,
00604 (*i).px(), (*i).py(), (*i).pz(),
00605 1.0,
00606 IgParticleChar::getByName ("muon"));
00607 label = QString ("mu %1 GeV").arg ((*i).pt(), 0, 'f', 2);
00608 trackLabel->string = label.latin1 ();
00609 }
00610 else
00611 {
00612 myTraj->initialise ((*i).vx()/100., (*i).vy()/100., (*i).vz()/100.,
00613 (*i).px(), (*i).py(), (*i).pz(),
00614 1.0,
00615 IgParticleChar::getByName ("antimuon"));
00616 label = QString ("mu- %1 GeV").arg ((*i).pt(), 0, 'f', 2);
00617 trackLabel->string = label.latin1 ();
00618 }
00619
00620 myTraj->t0.setValue (m_t0.value ());
00621 myTraj->dt.setValue (m_dt.value ());
00622
00623 if (m_animate.value ())
00624 myTraj->dt.connectFrom (&counter->output);
00625
00626
00627 if (m_annot.value () == true)
00628 {
00629 sep->addChild (labelSep);
00630 }
00631 if (m_showDets.value () == true)
00632 {
00633 VisEventSetupService *esService = VisEventSetupService::get (state ());
00634 if (esService)
00635 {
00636 SoSeparator *detSep = esService->buildHitDets (VisEventSetupService::RZDet, m_dets);
00637 if (detSep != NULL)
00638 sep->addChild (detSep);
00639 }
00640 }
00641 }
00642 rep->node ()->addChild (sep);
00643 }
00644 }