CMS 3D CMS Logo

VisRPCGeometryTwig.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "VisFramework/VisEventSetup/interface/VisRPCGeometryTwig.h"
00004 #include "VisFramework/VisEventSetup/interface/VisEventSetupService.h"
00005 #include "Iguana/Models/interface/IgTextRep.h"
00006 #include "Iguana/GLModels/interface/Ig3DRep.h"
00007 #include "Iguana/GLModels/interface/IgLegoRep.h"
00008 #include "Iguana/GLModels/interface/IgRPhiRep.h"
00009 #include "Iguana/GLModels/interface/IgRZRep.h"
00010 #include "Iguana/Studio/interface/IgQtLock.h"
00011 #include <classlib/utils/DebugAids.h>
00012 
00013 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00014 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00015 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00016 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00017 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00018 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00019 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00020 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00021 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00022 
00023 VisRPCGeometryTwig::VisRPCGeometryTwig (IgState *state, IgTwig *parent, 
00024                                         const std::string &name,  
00025                                         const int region,
00026                                         const int wheel,
00027                                         const int sector, 
00028                                         const int station)
00029     : VisQueuedTwig (state, parent, name),
00030       m_region (region),
00031       m_wheel (wheel),
00032       m_sector (sector),
00033       m_station (station),
00034       m_3dDet (NULL),
00035       m_rzDet (NULL),
00036       m_rphiDet (NULL),
00037       m_3Ddone (false),
00038       m_rzdone (false),
00039       m_rphidone (false),
00040       m_annotate (state, lat::CreateCallback (this, &VisRPCGeometryTwig::invalidate))
00041 {}
00042 
00044 VisRPCGeometryTwig::~VisRPCGeometryTwig (void) 
00045 {
00046     if (m_3dDet != NULL) m_3dDet->unref ();
00047     if (m_rzDet != NULL) m_rzDet->unref ();
00048     if (m_rphiDet != NULL) m_rphiDet->unref ();
00049 }
00050 
00051 void
00052 VisRPCGeometryTwig::invalidate (void)
00053 {
00054     if (m_3dDet != NULL) m_3dDet->unref ();
00055     if (m_rzDet != NULL) m_rzDet->unref ();
00056     if (m_rphiDet != NULL) m_rphiDet->unref ();
00057     m_3Ddone = false;    
00058     m_rzdone = false;
00059     m_rphidone = false;
00060 
00061     VisQueuedTwig::onBaseInvalidate ();
00062 }
00063 
00064 void
00065 VisRPCGeometryTwig::onNewEvent (const edm::Event &event,
00066                                 const edm::EventSetup &eventSetup)
00067 {
00068     // Get debugging dump.
00069     VisQueuedTwig::onNewEvent (event, eventSetup);
00070 
00071     VisEventSetupService *esService = VisEventSetupService::get (state ());
00072     ASSERT (esService);
00073 
00074     if (esService->muonGeomChanged ())
00075         invalidate ();
00076 }
00077 
00078 void
00079 VisRPCGeometryTwig::update (IgTextRep *rep)
00080 {
00081     // Get debugging dump.
00082     VisQueuedTwig::update (rep);
00083 
00084     // Prepare property description.
00085     std::ostringstream  text;
00086     text << "CMS RPC Muon Geometry: ";
00087     text << this->name () << "<br>";
00088     
00089     text << "<table width='100%' border=1>"
00090          << "<TR align = center>"
00091          << "<TH>#</TH>"
00092          << "<TH>Barrel/Wheel/Sector/Station</TH>"
00093          << "<TH>Position</TH>"
00094          << "</TR>";
00095 
00096     VisEventSetupService *esService = VisEventSetupService::get (state ());
00097     ASSERT (esService);
00098     
00099     text << esService->rpcTextRep (m_region, m_wheel, m_station, m_sector);
00100     text << "</table>";
00101 
00102     IgQtLock ();
00103     rep->setText (text.str ());
00104 }
00105 
00106 void
00107 VisRPCGeometryTwig::update (Ig3DRep *rep)
00108 {
00109     // Get debugging dump.
00110     VisQueuedTwig::update (rep);
00111 
00112     IgQtLock ();
00113     rep->clear ();
00114 
00115     if (! m_3Ddone)
00116     {
00117         VisEventSetupService *esService = VisEventSetupService::get (state ());
00118         ASSERT (esService);
00119 
00120         m_3dDet = esService->buildRPCChambers (VisEventSetupService::FullDet, m_region, m_wheel, m_sector, m_station);
00121 
00122         if (m_3dDet == NULL) return;
00123 
00124         if (m_annotate.value ()) 
00125         {
00126             SoSeparator *sep = esService->annotateRPCChambers (VisEventSetupService::FullDet, m_region, m_wheel, m_sector, m_station);
00127             if (sep != NULL) m_3dDet->addChild (sep);
00128         }
00129         
00130         m_3dDet->ref ();
00131         m_3Ddone = true;        
00132     }
00133     rep->node ()->addChild (m_3dDet);
00134 }
00135 
00136 void
00137 VisRPCGeometryTwig::update (IgRPhiRep *rep)
00138 {
00139     // Get debugging dump.
00140     VisQueuedTwig::update (rep);
00141 
00142     IgQtLock ();
00143     rep->clear ();
00144 
00145     if (! m_rphidone)
00146     {
00147         VisEventSetupService *esService = VisEventSetupService::get (state ());
00148         ASSERT (esService);
00149 
00150         m_rphiDet = esService->buildRPCChambers (VisEventSetupService::RPhiDet, m_region, m_wheel, m_sector, m_station);
00151 
00152         if (m_rphiDet == NULL) return;
00153 
00154         if (m_annotate.value ())
00155         {
00156             SoSeparator *sep = esService->annotateRPCChambers (VisEventSetupService::RPhiDet, m_region, m_wheel, m_sector, m_station);
00157             if (sep != NULL) m_rphiDet->addChild (sep);     
00158         }
00159         
00160         m_rphiDet->ref ();
00161         m_rphidone = true;
00162     }
00163     rep->node ()->addChild (m_rphiDet);
00164 }
00165 
00166 void
00167 VisRPCGeometryTwig::update (IgRZRep *rep)
00168 {
00169     // Get debugging dump.
00170     VisQueuedTwig::update (rep);
00171 
00172     IgQtLock ();
00173     rep->clear ();
00174 
00175     if (! m_rzdone)
00176     {
00177         VisEventSetupService *esService = VisEventSetupService::get (state ());
00178         ASSERT (esService);
00179 
00180         m_rzdone = esService->buildRPCChambers (VisEventSetupService::RZDet, m_region, m_wheel, m_sector, m_station);
00181 
00182         if (m_rzDet == NULL) return;
00183 
00184         if (m_annotate.value ())
00185         {
00186             SoSeparator *sep = esService->annotateRPCChambers (VisEventSetupService::RZDet, m_region, m_wheel, m_sector, m_station);
00187             if (sep != NULL) m_rzDet->addChild (sep);
00188         }
00189         
00190         m_rzDet->ref ();        
00191         m_rzdone = true;        
00192     }
00193     rep->node ()->addChild (m_rzDet);
00194 }

Generated on Tue Jun 9 17:49:49 2009 for CMSSW by  doxygen 1.5.4