CMS 3D CMS Logo

VisPCaloHitTwig Class Reference

#include <VisSimulation/VisSimHits/interface/VisPCaloHitTwig.h>

Inheritance diagram for VisPCaloHitTwig:

VisQueuedTwig IgSimpleTwig VisEventObserver IgCompoundTwig IgTwig IgRepresentable

List of all members.

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)
 VisPCaloHitTwig (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::string m_friendlyName
std::vector< PCaloHitm_hits
std::string m_instanceName
double m_minEnergy
std::string m_moduleLabel
std::string m_processName
std::string m_text


Detailed Description

Definition at line 19 of file VisPCaloHitTwig.h.


Constructor & Destructor Documentation

VisPCaloHitTwig::VisPCaloHitTwig ( 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 67 of file VisPCaloHitTwig.cc.

References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), edm::ParameterSet::getUntrackedParameter(), m_minEnergy, VisConfigurationService::pSet(), python::EventAnalyzer_cfg::pset, and VisTwigFactroyService::registerTwig().

00072     : VisQueuedTwig (state, parent, name),
00073       m_text (name),
00074       m_friendlyName (friendlyName),
00075       m_moduleLabel (moduleLabel),
00076       m_instanceName (instanceName),
00077       m_processName (processName),
00078       m_minEnergy (0.1)
00079 {
00080     VisTwigFactroyService *tfService = VisTwigFactroyService::get (state);
00081     if (! tfService)
00082     {
00083         tfService = new VisTwigFactroyService (state);
00084     }
00085     edm::TypeID caloJetsID (typeid (edm::PCaloHitContainer));
00086     tfService->registerTwig (caloJetsID.friendlyClassName (), &createThisTwig);
00087     
00088     const edm::ParameterSet *pset = VisConfigurationService::pSet ();
00089     if (pset)
00090     {
00091         m_minEnergy = pset->getUntrackedParameter<double> ("VisPCaloHitTwig_minEnergy", 0.1);
00092     }
00093 }


Member Function Documentation

void VisPCaloHitTwig::onNewEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 96 of file VisPCaloHitTwig.cc.

References cms::Exception::append(), arg, edm::Event::bunchCrossing(), c, e, exception, i, edm::Event::id(), IgRepSet::invalidate(), edm::Event::luminosityBlock(), m_friendlyName, m_hits, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_text, IgSimpleTwig::name(), VisQueuedTwig::onNewEvent(), edm::Event::orbitNumber(), IgTwig::SELF_MASK, and IgTwig::STRUCTURE_MASK.

00098 {
00099     // Get debugging dump.
00100     VisQueuedTwig::onNewEvent (event, eventSetup);
00101 
00102     m_hits.clear ();
00103     m_text = (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
00104               .arg (event.id ().run ())
00105               .arg (event.id ().event ())
00106               .arg (event.luminosityBlock ())
00107               .arg (event.orbitNumber ())
00108               .arg (event.bunchCrossing ())
00109               .latin1 ());
00110 
00111     std::vector<edm::Handle<edm::PCaloHitContainer> > hitCollections;
00112     
00113     try
00114     {
00115         if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ()))
00116         {
00117             VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName);
00118             event.getMany (visSel, hitCollections);
00119         }
00120     }
00121     catch (cms::Exception& e)
00122     {
00123         e.append (" from VisPCaloHitTwig::onNewEvent ");
00124         e.append (this->name ());    
00125 
00126         if (this->m_onCmsException)
00127             this->m_onCmsException (&e);
00128     }
00129     catch (lat::Error &e) 
00130     {
00131         if (this->m_onError)
00132             this->m_onError (&e);
00133     }
00134     catch (std::exception &e) 
00135     {
00136         if (this->m_onException)
00137             this->m_onException (&e);
00138     }
00139     catch (...) 
00140     {
00141         if (this->m_onUnhandledException)
00142             this->m_onUnhandledException ();
00143     }
00144 
00145     if (! hitCollections.empty ())
00146     {
00147         for (std::vector<edm::Handle<edm::PCaloHitContainer> >::iterator i = hitCollections.begin (), iEnd = hitCollections.end (); i != iEnd; ++i) 
00148         {
00149             const edm::PCaloHitContainer& c = *(*i);
00150             QString sizeStr = (QString ("%1").arg (c.size ()));
00151             QString nameStr = QString (this->name ());
00152             int ib = nameStr.find ("[");
00153             int ie = nameStr.find ("]");
00154             nameStr.replace (ib + 1, ie - 1, sizeStr);
00155             
00156             this->name (nameStr);
00157 
00158             for (std::vector<PCaloHit>::const_iterator isim = c.begin (), isimEnd = c.end ();
00159                  isim != isimEnd; ++isim)
00160             {
00161                 m_hits.push_back ((*isim));
00162             }    
00163         }
00164     }
00165 
00166     IgRepSet::invalidate (this, IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK);
00167 }

void VisPCaloHitTwig::update ( IgRZRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 481 of file VisPCaloHitTwig.cc.

References ASSERT, Ig3DBaseRep::clear(), GenMuonPlsPt100GeV_cfg::cout, IgSoRZHist::deltaEta, DetId::det(), VisSubdetector::detName(), lat::endl(), IgSoRZHist::energies, relval_parameters_module::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), gen_hydjet_hard_muon_trigger_cfg::etaMax, first, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, int, prof2calltree::last, IgSoRZHist::layer, IgSoRZHist::logScale, m_hits, m_minEnergy, PV3DBase< T, PVType, FrameType >::mag(), IgSoRZHist::maxRadius, IgSoRZHist::minRadius, Ig3DBaseRep::node(), radius(), IgSoRZHist::showAnnotations, VisQueuedTwig::state(), DetId::subdetId(), VisSubdetector::subDetName(), VisQueuedTwig::update(), IgSoRZHist::upper, PV3DBase< T, PVType, FrameType >::y(), and y.

00482 {
00483     // Get debugging dump.
00484     VisQueuedTwig::update (rep);
00485     IgQtLock ();
00486 
00487     rep->clear ();
00488     
00489     if (! m_hits.empty ())
00490     {
00491         SoSeparator *sep = new SoSeparator;    
00492         SoSeparator *posSep = new SoSeparator;    
00493         SoSeparator *negSep = new SoSeparator;
00494         sep->addChild (posSep);
00495         sep->addChild (negSep);
00496     
00497         SoMaterial *mat = new SoMaterial;
00498         posSep->addChild (mat);
00499     
00500         SoMaterial *negMat = new SoMaterial;
00501         negMat->diffuseColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); // Light Green Teal
00502         negSep->addChild (negMat);
00503 
00504         int nbrOfBins = 0;
00505         int binNumber;
00506         double radius = 0;
00507         float etaMax = 1.479;
00508         float deltaEta = 0.087;
00509         float layer = 0;
00510         
00511         const DetId detID (m_hits [0].id ());
00512         
00513         if (VisSubdetector::detName (detID.det ()) == "Hcal" && VisSubdetector::subDetName (detID.det (), detID.subdetId ()) == "HcalBarrel")
00514         {           
00515             mat->diffuseColor.setValue (153.0 / 255.0, 51.0 / 255.0, 204.0 / 255.0); // Medium Violet Mangenta
00516             nbrOfBins = 2 * 16;
00517             etaMax = 1.305;
00518             radius = 1.9;
00519             layer = -5.0;
00520         }
00521         else if (VisSubdetector::detName (detID.det ()) == "Ecal" && VisSubdetector::subDetName (detID.det (), detID.subdetId ()) == "EcalBarrel")
00522         {
00523             mat->diffuseColor.setValue (1.0 , 0.0, 153.0 / 255.0);
00524             nbrOfBins = 2 * 17 * 5;
00525             etaMax = 1.479; // max eta of ECAL Barrel   
00526             deltaEta = 1.521 / 18.0 / 6.0;
00527             radius = 1.280;
00528             layer = -5.0;
00529         }
00530 
00531         std::vector<float> bufferUpperPositive (nbrOfBins);
00532         std::vector<float> bufferUpperNegative (nbrOfBins);
00533         std::vector<float> bufferLowerPositive (nbrOfBins);
00534         std::vector<float> bufferLowerNegative (nbrOfBins);
00535 
00536         try 
00537         {
00538             VisEventSetupService *esService = VisEventSetupService::get (state ());
00539             ASSERT (esService);
00540 
00541             if (nbrOfBins > 0) 
00542             {           
00543                 for (std::vector<PCaloHit>::const_iterator i = m_hits.begin (); i != m_hits.end (); ++i) 
00544                 {
00545                     double energy = (*i).energy ();
00546 
00547                     if (energy >= m_minEnergy) 
00548                     {
00549                         // create a DetId from the detUnitId
00550                         const DetId detUnitId ((*i).id ());
00551 
00552                         double energy = (*i).energy () * 100.0;
00553                         GlobalPoint pos = esService->getCellPosition (detUnitId);
00554                         if (! radius)
00555                         {
00556                             radius = pos.mag () / 100.0;
00557                         }
00558 
00559                         double eta = pos.eta ();
00560                         double y = pos.y ();                
00561 
00562                         // if the hit is in the barrel 
00563                         if (! ((eta < -etaMax) || (eta > etaMax)))
00564                         {
00565                             if (eta <= 0.0) 
00566                             {
00567                                 binNumber = nbrOfBins - 1 - (int) floor ((etaMax - eta) / deltaEta);
00568                             }
00569                             else 
00570                             {
00571                                 binNumber = nbrOfBins - 1 - (int) (nbrOfBins / 2 + floor (eta / deltaEta));
00572                             }
00573                         
00574                             if (energy >= 0)
00575                             {
00576                                 if (y >= 0)
00577                                 {
00578                                     bufferUpperPositive [binNumber] += energy;
00579                                 }
00580                                 else
00581                                 {
00582                                     bufferLowerPositive [binNumber] += energy;
00583                                 }
00584                             }
00585                             else
00586                             {
00587                                 if (y >= 0)
00588                                 {
00589                                     bufferUpperNegative [binNumber] -= energy;
00590                                 }
00591                                 else
00592                                 {
00593                                     bufferLowerNegative [binNumber] -= energy;
00594                                 }                   
00595                             }               
00596                         }
00597                     }
00598                 }
00599 
00600                 std::vector<float>::const_iterator first = bufferUpperPositive.begin ();
00601                 std::vector<float>::const_iterator last = bufferUpperPositive.end ();
00602             
00603                 if (*max_element (first, last) > 0.0)
00604                 {
00605                     IgSoRZHist *upper = new IgSoRZHist;
00606                     upper->minRadius = radius;
00607                     upper->maxRadius = -1;
00608                     upper->energies.setValues (0, nbrOfBins, &bufferUpperPositive [0]);
00609                     upper->logScale = false;
00610                     upper->showAnnotations = false;
00611                     upper->layer = layer;
00612                     upper->upper = true;
00613                     upper->deltaEta = deltaEta;
00614                     posSep->addChild (upper);
00615                 }
00616             
00617                 std::vector<float> ::const_iterator nfirst = bufferUpperNegative.begin ();
00618                 std::vector<float> ::const_iterator nlast = bufferUpperNegative.end ();
00619             
00620                 if (*max_element (nfirst, nlast) > 0.0)
00621                 {
00622                     IgSoRZHist *lower = new IgSoRZHist;
00623                     lower->minRadius = radius;
00624                     lower->maxRadius = -1;
00625                     lower->energies.setValues (0, nbrOfBins, &bufferUpperNegative [0]);
00626                     lower->logScale = false;
00627                     lower->showAnnotations = false;
00628                     lower->layer = layer;
00629                     lower->upper = false;       
00630                     lower->deltaEta = deltaEta;
00631                     negSep->addChild (lower);
00632                 }
00633 
00634                 std::vector<float>::const_iterator lfirst = bufferLowerPositive.begin ();
00635                 std::vector<float>::const_iterator llast = bufferLowerPositive.end ();
00636             
00637                 if (*max_element (lfirst, llast) > 0.0)
00638                 {
00639                     IgSoRZHist *upperNeg = new IgSoRZHist;
00640                     upperNeg->minRadius = radius;
00641                     upperNeg->maxRadius = -1;
00642                     upperNeg->energies.setValues (0, nbrOfBins, &bufferLowerPositive [0]);
00643                     upperNeg->logScale = false;
00644                     upperNeg->showAnnotations = false;
00645                     upperNeg->layer = layer;
00646                     upperNeg->upper = true;     
00647                     upperNeg->deltaEta = deltaEta;
00648                     posSep->addChild (upperNeg);
00649                 }
00650             
00651                 std::vector<float> ::const_iterator lnfirst = bufferLowerNegative.begin ();
00652                 std::vector<float> ::const_iterator lnlast = bufferLowerNegative.end ();
00653             
00654                 if (*max_element (lnfirst, lnlast) > 0.0)
00655                 {
00656                     IgSoRZHist *lowerNeg = new IgSoRZHist;
00657                     lowerNeg->minRadius = radius;
00658                     lowerNeg->maxRadius = -1;
00659                     lowerNeg->energies.setValues (0, nbrOfBins, &bufferLowerNegative [0]);
00660                     lowerNeg->logScale = false;
00661                     lowerNeg->showAnnotations = false;
00662                     lowerNeg->layer = layer;    
00663                     lowerNeg->upper = false;    
00664                     lowerNeg->deltaEta = deltaEta;
00665                     negSep->addChild (lowerNeg);
00666                 }
00667             }       
00668         }
00669         catch (...) 
00670         {
00671             std::cout << "No PCaloHits." << std::endl;
00672         }
00673     
00674         rep->node ()->addChild (sep);
00675     }
00676 }

void VisPCaloHitTwig::update ( IgRPhiRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 360 of file VisPCaloHitTwig.cc.

References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), GenMuonPlsPt100GeV_cfg::cout, VisSubdetector::detName(), e, lat::endl(), IgSoCircularHist::energies, relval_parameters_module::energy, exception, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, int, IgSoCircularHist::layer, IgSoCircularHist::logScale, m_hits, m_minEnergy, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, PV3DBase< T, PVType, FrameType >::mag(), IgSoCircularHist::maxRadius, IgSoCircularHist::minRadius, Ig3DBaseRep::node(), IgSoCircularHist::numberOfBins, phi, radius(), IgSoCircularHist::scaleFactor, IgSoCircularHist::showAnnotations, VisQueuedTwig::state(), VisSubdetector::subDetName(), and VisQueuedTwig::update().

00361 {
00362     // Get debugging dump.
00363     VisQueuedTwig::update (rep);
00364     IgQtLock ();
00365 
00366     rep->clear ();
00367     
00368     if (! m_hits.empty ())
00369     {
00370         int nbrOfBins = 0;
00371         int binNumber;
00372         double radius = 0;
00373         float layer = 0;
00374 
00375         try 
00376         {
00377             VisEventSetupService *esService = VisEventSetupService::get (state ());
00378             ASSERT (esService);
00379             
00380             std::vector<PCaloHit>::const_iterator i = m_hits.begin ();
00381             
00382             // create a DetId from the detUnitId
00383             const DetId detUnitId ((*i).id ());
00384 
00385             if ((VisSubdetector::detName (detUnitId.det ()) == "Hcal" && VisSubdetector::subDetName (detUnitId.det (), detUnitId.subdetId ()) == "HcalBarrel") ||
00386                 (VisSubdetector::detName (detUnitId.det ()) == "Ecal" && VisSubdetector::subDetName (detUnitId.det (), detUnitId.subdetId ()) == "EcalBarrel"))
00387             {   
00388                 SoSeparator *sep = new SoSeparator;    
00389 
00390                 if (VisSubdetector::detName (detUnitId.det ()) == "Hcal" && VisSubdetector::subDetName (detUnitId.det (), detUnitId.subdetId ()) == "HcalBarrel")
00391                 {           
00392                     SoMaterial *mat = new  SoMaterial;
00393                     mat->diffuseColor.setValue (0.6, 0.2, 0.8); // Medium Violet Mangenta
00394                     sep->addChild (mat);
00395                 
00396                     nbrOfBins = 72;
00397                     radius = 1.9;
00398                     layer = 10.0;
00399                 }
00400                 else if (VisSubdetector::detName (detUnitId.det ()) == "Ecal" && VisSubdetector::subDetName (detUnitId.det (), detUnitId.subdetId ()) == "EcalBarrel")
00401                 {
00402                     SoMaterial *mat = new  SoMaterial;
00403                     mat->diffuseColor.setValue (1.0 , 0.0, 0.6);
00404                     sep->addChild (mat);
00405 
00406                     nbrOfBins = 360;
00407                     radius = 1.3;
00408                     layer = 11.0;
00409                 }
00410 
00411                 std::vector<float> bufferPositive (nbrOfBins);
00412 
00413                 std::cout << VisSubdetector::detName (detUnitId.det ()) << VisSubdetector::subDetName (detUnitId.det (), detUnitId.subdetId ()) << std::endl;
00414             
00415                 for (i = m_hits.begin (); i != m_hits.end (); ++i) 
00416                 {
00417                     double energy = (*i).energy ();
00418 
00419                     if (energy >= m_minEnergy && nbrOfBins > 0) 
00420                     {
00421                         // create a DetId from the detUnitId
00422                         const DetId detUnitId ((*i).id ());
00423                         GlobalPoint pos = esService->getCellPosition (detUnitId);
00424                         if (! radius)
00425                         {
00426                             radius = pos.mag () / 100.0;
00427                         }
00428 
00429                         double phi = pos.phi ();
00430                         binNumber = (int) floor (phi / (2 * M_PI / nbrOfBins));
00431 
00432                         //(phi < 0) ? phi = 2 * M_PI + phi : phi;
00433                         if (energy >= 0.0)
00434                             bufferPositive [binNumber] += energy;
00435                     }
00436                 }
00437                 
00438                 if (*max_element (bufferPositive.begin (), bufferPositive.end ()) > 0.0)
00439                 {
00440                     IgSoCircularHist *recHits = new IgSoCircularHist;
00441                     recHits->minRadius = radius;
00442                     recHits->maxRadius = -1;
00443                     recHits->scaleFactor = 1.0;
00444                     recHits->numberOfBins = nbrOfBins;
00445                     recHits->energies.setValues (0, nbrOfBins, &bufferPositive [0]);
00446                     recHits->logScale = false;
00447                     recHits->showAnnotations = true;
00448                     recHits->layer = layer;
00449                     sep->addChild (recHits);
00450                 }       
00451                 rep->node ()->addChild (sep);
00452             }    
00453         }
00454         catch (cms::Exception& e)
00455         {
00456             e.append (" from VisPCaloHitTwig::update(Ig3DRep*) ");
00457             e.append (this->name ());    
00458 
00459             if (this->m_onCmsException)
00460                 this->m_onCmsException (&e);
00461         }
00462         catch (lat::Error &e) 
00463         {
00464             if (this->m_onError)
00465                 this->m_onError (&e);
00466         }
00467         catch (std::exception &e) 
00468         {
00469             if (this->m_onException)
00470                 this->m_onException (&e);
00471         }
00472         catch (...) 
00473         {
00474             if (this->m_onUnhandledException)
00475                 this->m_onUnhandledException ();
00476         }
00477     }
00478 }

void VisPCaloHitTwig::update ( IgLegoRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 353 of file VisPCaloHitTwig.cc.

References VisQueuedTwig::update().

00354 {
00355     // Get debugging dump.
00356     VisQueuedTwig::update (rep);
00357 }

void VisPCaloHitTwig::update ( Ig3DRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 240 of file VisPCaloHitTwig.cc.

References cms::Exception::append(), ASSERT, DetId::Calo, Ig3DBaseRep::clear(), e, DetId::Ecal, relval_parameters_module::energy, exception, DBSPlugin::get(), VisEventSetupService::getCorners(), DetId::Hcal, i, m_hits, m_minEnergy, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, Ig3DBaseRep::node(), VisQueuedTwig::state(), VisQueuedTwig::update(), x, y, and z.

00241 {
00242     // Get debugging dump.
00243     VisQueuedTwig::update (rep);
00244 
00245     IgQtLock ();
00246     rep->clear ();
00247 
00248     if (! m_hits.empty ())
00249     {
00250         SoSeparator *sep = new SoSeparator; // global
00251 
00252         SoMaterial *mat = new SoMaterial;
00253         mat->diffuseColor.setValue (0.0, 0.0, 1.0);
00254         sep->addChild (mat);
00255 
00256         try 
00257         {
00258             VisEventSetupService *esService = VisEventSetupService::get (state ());
00259             ASSERT (esService);
00260             
00261             for (std::vector<PCaloHit>::const_iterator i = m_hits.begin (); i != m_hits.end (); ++i) 
00262             {
00263                 double energy = (*i).energy ();
00264 
00265                 if (energy >= m_minEnergy) 
00266                 {
00267                     const DetId detUnitId ((*i).id ());
00268 
00269                     const CaloCellGeometry::CornersVec& corners = esService->getCorners (detUnitId);
00270                     ASSERT (corners.size () == 8);
00271 
00272                     IgSoCrystalHit *crystalHit = new IgSoCrystalHit;
00273                     crystalHit->energy.setValue (energy);
00274                     crystalHit->scale.setValue (1.0);
00275                     crystalHit->relativeWidth.setValue (1.0);
00276                     crystalHit->drawCrystal.setValue (true);
00277                     crystalHit->drawHit.setValue (true);
00278 
00279                     switch (detUnitId.det ()) 
00280                     {
00281                     case DetId::Ecal:
00282 //                      // surface_style_15
00283 //                      mat->ambientColor.setValue (0.115997, 0.111996, 0.109998);
00284 //                      mat->diffuseColor.setValue (0.521988, 0.503984, 0.494989);
00285 //                      mat->specularColor.setValue (0.599991, 0.599991, 0.599991);
00286                     
00287                         crystalHit->front1.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0);
00288                         crystalHit->front2.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0);
00289                         crystalHit->front3.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0);
00290                         crystalHit->front4.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0);
00291                     
00292                         crystalHit->back1.setValue  (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0);
00293                         crystalHit->back2.setValue  (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0);
00294                         crystalHit->back3.setValue  (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0);
00295                         crystalHit->back4.setValue  (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0);
00296 
00297                         break;
00298                     case DetId::Hcal:
00299 //                      // style 16
00300 //                      mat->ambientColor.setValue (0.449982, 0.429993, 0.36998);
00301 //                      mat->diffuseColor.setValue (0.337486, 0.322495, 0.277485);
00302 //                      mat->specularColor.setValue (0.499992, 0.499992, 0.499992);
00303                     
00304                         crystalHit->front1.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0);
00305                         crystalHit->front2.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0);
00306                         crystalHit->front3.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0);
00307                         crystalHit->front4.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0);
00308                     
00309                         crystalHit->back1.setValue  (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0);
00310                         crystalHit->back2.setValue  (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0);
00311                         crystalHit->back3.setValue  (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0);
00312                         crystalHit->back4.setValue  (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0);
00313 
00314                         break;
00315                     case DetId::Calo:
00316                         // type [DetId::Calo] = "Calo";
00317                         break;
00318                     default:
00319                         break;
00320                     }
00321                     sep->addChild (crystalHit);
00322                 }
00323             }       
00324         }
00325         catch (cms::Exception& e)
00326         {
00327             e.append (" from VisPCaloHitTwig::update(Ig3DRep*) ");
00328             e.append (this->name ());    
00329 
00330             if (this->m_onCmsException)
00331                 this->m_onCmsException (&e);
00332         }
00333         catch (lat::Error &e) 
00334         {
00335             if (this->m_onError)
00336                 this->m_onError (&e);
00337         }
00338         catch (std::exception &e) 
00339         {
00340             if (this->m_onException)
00341                 this->m_onException (&e);
00342         }
00343         catch (...) 
00344         {
00345             if (this->m_onUnhandledException)
00346                 this->m_onUnhandledException ();
00347         }
00348         rep->node ()->addChild (sep);
00349     }
00350 }

void VisPCaloHitTwig::update ( IgTextRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 170 of file VisPCaloHitTwig.cc.

References e, exception, i, m_hits, m_minEnergy, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_text, IgTextRep::setText(), and VisQueuedTwig::update().

00171 {
00172     // Get debugging dump.
00173     VisQueuedTwig::update (rep);
00174 
00175     // Prepare property description.
00176     std::ostringstream  text;
00177     text << "Total " << m_hits.size () << " hits from ";
00178     text << m_text << "<br>";
00179 
00180     text << "Above 0.1 GeV:<br>";
00181 
00182     text << "<table width='100%' border=1>"
00183          << "<TR align = center>"
00184          << "<TH>Number</TH>"
00185          << "<TH>Energy</TH>"
00186          << "<TH>Time of deposit</TH>"
00187          << "<TH>DetID</TH>"
00188          << "<TH>Track ID</TH>"
00189          << "</TR>";
00190     text << setiosflags (std::ios::showpoint | std::ios::fixed);
00191     text.setf (std::ios::right, std::ios::adjustfield);
00192 
00193     if ((! m_hits.empty ())) 
00194     {
00195         int nHits = 0;
00196         try 
00197         {
00198             for (std::vector<PCaloHit>::const_iterator i = m_hits.begin (); i != m_hits.end (); ++i) 
00199             {
00200                 if ((*i).energy () >= m_minEnergy)
00201                 {
00202                     text << "<TR align = right>"
00203                          << "<TD>" << std::setw (3) << nHits++ << "</TD>"
00204                          << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).energy () << "</TD>"
00205                          << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).time () << "</TD>"
00206                          << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).id () << "</TD>"
00207                          << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).geantTrackId () << "</TD></TR>";
00208                 }
00209             }
00210         }
00211         catch (cms::Exception& e)
00212         {
00213             if (this->m_onCmsException)
00214                 this->m_onCmsException (&e);
00215         }
00216         catch (lat::Error &e) 
00217         {
00218             if (this->m_onError)
00219                 this->m_onError (&e);
00220         }
00221         catch (std::exception &e) 
00222         {
00223             if (this->m_onException)
00224                 this->m_onException (&e);
00225         }
00226         catch (...) 
00227         {
00228             if (this->m_onUnhandledException)
00229                 this->m_onUnhandledException ();
00230         }
00231         text << "</table>";
00232     }
00233 
00234     // Send it over.
00235     IgQtLock ();
00236     rep->setText (text.str ());
00237 }


Member Data Documentation

std::string VisPCaloHitTwig::m_friendlyName [private]

Definition at line 43 of file VisPCaloHitTwig.h.

Referenced by onNewEvent().

std::vector<PCaloHit> VisPCaloHitTwig::m_hits [private]

Definition at line 48 of file VisPCaloHitTwig.h.

Referenced by onNewEvent(), and update().

std::string VisPCaloHitTwig::m_instanceName [private]

Definition at line 45 of file VisPCaloHitTwig.h.

Referenced by onNewEvent().

double VisPCaloHitTwig::m_minEnergy [private]

Definition at line 47 of file VisPCaloHitTwig.h.

Referenced by update(), and VisPCaloHitTwig().

std::string VisPCaloHitTwig::m_moduleLabel [private]

Definition at line 44 of file VisPCaloHitTwig.h.

Referenced by onNewEvent().

std::string VisPCaloHitTwig::m_processName [private]

Definition at line 46 of file VisPCaloHitTwig.h.

Referenced by onNewEvent().

std::string VisPCaloHitTwig::m_text [private]

Definition at line 42 of file VisPCaloHitTwig.h.

Referenced by onNewEvent(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:34 2009 for CMSSW by  doxygen 1.5.4