CMS 3D CMS Logo

VisEventSetupService Class Reference

#include <VisFramework/VisEventSetup/interface/VisEventSetupService.h>

Inheritance diagram for VisEventSetupService:

IgStateElement VisEventObserver

List of all members.

Public Types

enum  DetectorRep { FullDet, RZDet, RPhiDet }

Public Member Functions

void addMaterial (SoSeparator *separator, DetectorRep type)
 Add material to the scene graph based on the view.
SoSeparator * annotateCaloDet (DetectorRep type, const std::string detId, int subdetn)
SoSeparator * annotateCSCChambers (DetectorRep type, int chamber, int ring, int station, int endcap)
SoSeparator * annotateDTChambers (DetectorRep type, int station, int sector, int wheel)
SoSeparator * annotateRPCChambers (DetectorRep type, int region, int wheel, int sector, int station)
SoSeparator * annotateTracker (DetectorRep type, const std::string name)
SoSeparator * buildCaloDet (DetectorRep type, const std::string detId, const int subdetn)
SoSeparator * buildCSCChambers (DetectorRep type, int chamber, int ring, int station, int endcap)
SoSeparator * buildDet (DetectorRep type, std::vector< const GeomDetUnit * > &dets)
SoSeparator * buildDTChambers (DetectorRep type, int station, int sector, int wheel)
SoSeparator * buildHitDets (DetectorRep type, std::vector< DetId > &dets)
SoSeparator * buildLegoDet (const double scale)
SoSeparator * buildRPCChambers (DetectorRep type, int region, int wheel, int sector, int station)
SoSeparator * buildTracker (DetectorRep type, const std::string name)
bool caloGeomChanged (void)
const std::string caloTextRep (const std::string name, const int subdetn)
const std::string cscTextRep (int chamber, int ring, int station, int endcap)
const std::string dtTextRep (int station, int sector, int wheel)
bool emptyCorners (const DetId detId) const
float etaToTheta (float eta) const
bool fieldChanged (void)
unsigned int getBinNumber (const float eta, const float phi, const unsigned numR, const unsigned numZ, const float radiusR, const float radiusZ, const float barrelMaxEta=0.f, const float beamPipeTheta=0.f, const float endcapMaxTheta=0.f) const
unsigned int getBinNumber (const DetId detId, const unsigned numR, const unsigned numZ, const float radiusR, const float radiusZ, const float barrelMaxEta=0.f, const float beamPipeTheta=0.f, const float endcapMaxTheta=0.f) const
const GlobalPointgetCellPosition (const DetId detId) const
const
CaloCellGeometry::CornersVec
getCorners (const DetId detId) const
const GlobalPoint globalPosition (const TrackingRecHit *rechit)
bool globalTrackingGeomChanged (void)
const GeomDetidToDet (const DetId det)
const LocalPoint localPosition (const TrackingRecHit *rechit)
void localPositions (const TrackingRecHit *rechit, std::vector< LocalPoint > &points)
bool muonGeomChanged (void)
virtual void onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup)
float phi4eta (float eta) const
bool present (const DetId detId) const
SoSeparator * refitTrack (reco::TrackRef track, double in, double out, double step)
const std::string rpcTextRep (int region, int wheel, int sector, int station)
float thetaToEta (float theta) const
const GlobalPoint toGlobal (const LocalPoint point, const DetId detId)
bool trackerGeomChanged (void)
const std::string trackerModuleName (DetId detId)
const std::string trackerTextRep (const std::string name)
 VisEventSetupService (IgState *state)
 ~VisEventSetupService (void)

Private Member Functions

void addBoxWafer (SoSeparator *separator, const GeomDet *det)
 Transform and add the DetUnit to the scene graph.
void addDescription (SoSeparator *separator, const GeomDet *det, const std::string label)
void addWafer (SoSeparator *separator, const GeomDet *det, DetectorRep type)
 Transform and add the DetUnit to the scene graph.
void createRotation (const GeomDet *det, SbVec3f &axis, float &angle)
 Get rotation of a DetUnit.
DetId::Detector detectorId (const std::string &key)
 IG_DECLARE_STATE_ELEMENT (VisEventSetupService)
void invalidate (void)
int subDetector (const std::string &key)
bool visible (const GlobalPoint &point, DetectorRep type, int subDetector)

Private Attributes

int m_bx
edm::ESHandle< CaloGeometrym_caloGeom
bool m_caloGeomCanged
edm::ESHandle< CSCGeometrym_cscGeom
edm::ESHandle< DTGeometrym_dtGeom
int m_event
edm::ESHandle< MagneticFieldm_field
bool m_fieldGeomCanged
edm::ESHandle
< GlobalTrackingGeometry
m_globalTrackingGeom
bool m_globalTrackingGeomCanged
int m_ls
bool m_muonGeomCanged
int m_orbit
VisPhiDelta m_phiDelta
VisPhiStart m_phiStart
edm::ESHandle< RPCGeometrym_rpcGeom
int m_run
IgStatem_state
edm::ESHandle< TrackerGeometrym_trackerGeom
bool m_trackerGeomCanged
edm::ESWatcher
< CaloGeometryRecord
m_watch_caloGeom
edm::ESWatcher
< IdealMagneticFieldRecord
m_watch_field
edm::ESWatcher
< GlobalTrackingGeometryRecord
m_watch_globalTrackingGeom
edm::ESWatcher
< MuonGeometryRecord
m_watch_muonGeom
edm::ESWatcher
< TrackerDigiGeometryRecord
m_watch_trackerGeom


Detailed Description

Definition at line 41 of file VisEventSetupService.h.


Member Enumeration Documentation

enum VisEventSetupService::DetectorRep

Enumerator:
FullDet 
RZDet 
RPhiDet 

Definition at line 53 of file VisEventSetupService.h.

00053 { FullDet, RZDet, RPhiDet };


Constructor & Destructor Documentation

VisEventSetupService::VisEventSetupService ( IgState state  ) 

Definition at line 66 of file VisEventSetupService.cc.

References ASSERT, and IgState::put().

00067     : VisEventObserver (state),
00068       m_state (state),
00069       m_phiDelta (state, lat::CreateCallback (this, &VisEventSetupService::invalidate)),
00070       m_phiStart (state, lat::CreateCallback (this, &VisEventSetupService::invalidate)),
00071       m_globalTrackingGeomCanged (true),
00072       m_trackerGeomCanged (true),
00073       m_caloGeomCanged (true),
00074       m_muonGeomCanged (true),
00075       m_fieldGeomCanged (true)
00076 {    
00077     ASSERT (state);
00078     state->put (s_key, this);
00079 }

VisEventSetupService::~VisEventSetupService ( void   ) 

Definition at line 81 of file VisEventSetupService.cc.

References ASSERT, IgState::detach(), and m_state.

00082 {
00083     ASSERT (m_state);
00084     m_state->detach (s_key);
00085 }


Member Function Documentation

void VisEventSetupService::addBoxWafer ( SoSeparator *  separator,
const GeomDet det 
) [private]

Transform and add the DetUnit to the scene graph.

Definition at line 2197 of file VisEventSetupService.cc.

References BoundSurface::bounds(), f, Bounds::length(), GloballyPositioned< T >::position(), GloballyPositioned< T >::rotation(), GeomDet::surface(), Bounds::thickness(), Bounds::width(), Basic3DVector< T >::x(), x, Basic3DVector< T >::y(), y, Basic3DVector< T >::z(), and z.

02198 {    
02199     const int NVERT = 8;
02200 
02201     Basic3DVector< float > nx (1., 0., 0.); // x basis vector
02202     Basic3DVector< float > ny (0., 1., 0.); // y basis vector
02203     Basic3DVector< float > nz (0., 0., 1.); // z basis vector
02204 
02205     float posx = 0.;
02206     float posy = 0.;
02207     float posz = 0.;
02208     float x = 0.;
02209     float y = 0.;
02210     float z = 0.;
02211 
02212     static int faceIndices[] = 
02213         {0, 4, 3, 7, 2, 6, 1, 5, 0, 4, SO_END_FACE_INDEX,
02214          1, 0, 2, 3, SO_END_FACE_INDEX,
02215          6, 7, 5, 4, SO_END_FACE_INDEX
02216         };     
02217 
02218     static SoIndexedTriangleStripSet *detFaceSet = 0;
02219     if (detFaceSet == 0)
02220     {
02221         detFaceSet = new SoIndexedTriangleStripSet;
02222         detFaceSet->coordIndex.setValues(0, sizeof (faceIndices)/sizeof (int), faceIndices);
02223     }
02224     
02225     TkRotation< float > detRot = det->surface ().rotation ();
02226     Basic3DVector< float > px = detRot * nx; // Rxx Ryx Rzx
02227     Basic3DVector< float > py = detRot * ny; // Rxy Ryy Rzy
02228     Basic3DVector< float > pz = detRot * nz; // Rxz Ryz Rzz
02229 
02230     // set the rotation matrix
02231     SbMatrix rotMatrix (px.x (), py.x (), pz.x (), 0,
02232                         px.y (), py.y (), pz.y (), 0,
02233                         px.z (), py.z (), pz.z (), 0,
02234                         0, 0, 0, 1);
02235 
02236     // position of the wafer's center
02237     posx = det->surface ().position ().x () / 100.0;  // cm -> m
02238     posy = det->surface ().position ().y () / 100.0;  // cm -> m
02239     posz = det->surface ().position ().z () / 100.0;  // cm -> m
02240 
02241     x = det->surface ().bounds ().width () / 100.0;   // cm -> m
02242     y = det->surface ().bounds ().length () / 100.0; // cm -> m
02243     z = det->surface ().bounds ().thickness () / 100.0;  // cm -> m
02244                 
02245     SbVec3f points [NVERT] = {
02246         SbVec3f ( 0.5f, -0.5f, -0.5f),      // Origin (0, 0, 0) in the center of the cube:
02247         SbVec3f ( 0.5f,  0.5f, -0.5f),      //   7------6      Z
02248         SbVec3f ( 0.5f,  0.5f,  0.5f),      //  /|     /|      |
02249         SbVec3f ( 0.5f, -0.5f,  0.5f),      // 3------2 |      |
02250         SbVec3f (-0.5f, -0.5f, -0.5f),      // | 4----|-5     /--->Y
02251         SbVec3f (-0.5f,  0.5f, -0.5f),      // |/     |/     /
02252         SbVec3f (-0.5f,  0.5f,  0.5f),      // 0------1     X
02253         SbVec3f (-0.5f, -0.5f,  0.5f)       // 
02254     };
02255     
02256     SoMFVec3f vertexData;
02257     vertexData.setValues (0, NVERT, points);
02258 
02259     SoCoordinate3 *detCoords = new SoCoordinate3;
02260     detCoords->point = vertexData;
02261     
02262     SoTransform *detTransform = new SoTransform;
02263     detTransform->translation.setValue (posx, posy, posz);
02264     detTransform->rotation = SbRotation (rotMatrix);
02265     detTransform->scaleFactor.setValue (x, y, z);
02266 
02267     // Create the separator for the faces.
02268     SoSeparator *facesNode = new SoSeparator;
02269     facesNode->addChild (detTransform);
02270     facesNode->addChild (detCoords);
02271     facesNode->addChild (detFaceSet);
02272 
02273     separator->addChild (facesNode);
02274 }

void VisEventSetupService::addDescription ( SoSeparator *  separator,
const GeomDet det,
const std::string  label 
) [private]

Definition at line 2055 of file VisEventSetupService.cc.

References angle(), createRotation(), GloballyPositioned< T >::position(), and GeomDet::surface().

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), and annotateTracker().

02056 {
02057     // position of the wafer's center
02058     float posx = det->surface ().position ().x () / 100.0;  // cm -> m
02059     float posy = det->surface ().position ().y () / 100.0;  // cm -> m
02060     float posz = det->surface ().position ().z () / 100.0;  // cm -> m
02061 
02062     float angle;
02063     SbVec3f axis;
02064     createRotation (det, axis, angle);
02065 
02066     SoTransform *transform = new SoTransform;
02067     transform->translation.setValue (posx, posy, posz);
02068     transform->rotation.setValue (axis, angle);
02069 
02070     SoSeparator *labelSep = new SoSeparator;
02071     SoText2  *cLabel = new SoText2;
02072     cLabel->string = label.c_str ();
02073     labelSep->addChild (cLabel);
02074     
02075     separator->addChild (transform);
02076     separator->addChild (labelSep);
02077 }

void VisEventSetupService::addMaterial ( SoSeparator *  separator,
DetectorRep  type 
)

Add material to the scene graph based on the view.

Definition at line 1995 of file VisEventSetupService.cc.

References FullDet.

Referenced by buildDet().

01996 {    
01997     SoMaterial *mat = new SoMaterial;
01998 
01999     switch (type)
02000     {
02001     case FullDet:
02002         mat->ambientColor.setValue (0.88445997, 0.840042, 0.53582799);
02003         mat->diffuseColor.setValue (0.66334498, 0.630032, 0.401871);
02004         mat->specularColor.setValue (0.49999201, 0.49999201, 0.49999201);
02005         mat->emissiveColor.setValue (0, 0, 0);
02006         mat->shininess = 0.1;
02007         mat->transparency = 0;
02008         break;
02009     default:
02010         mat->ambientColor.setValue (0.66334498, 0.66334498, 0.66334498);
02011         mat->diffuseColor.setValue (0.66334498, 0.66334498, 0.66334498);
02012         mat->specularColor.setValue (0.66334498, 0.66334498, 0.66334498);
02013         mat->emissiveColor.setValue (0.66334498, 0.66334498, 0.66334498);
02014         SoDrawStyle *style = new SoDrawStyle;
02015         style->style = SoDrawStyle::LINES;
02016         separator->addChild (style);
02017         break;
02018     }
02019     
02020     separator->addChild (mat);
02021 }

void VisEventSetupService::addWafer ( SoSeparator *  separator,
const GeomDet det,
DetectorRep  type 
) [private]

Transform and add the DetUnit to the scene graph.

Definition at line 2081 of file VisEventSetupService.cc.

References IgSoG4Trap::alp1, IgSoG4Trap::alp2, angle(), b, b2, BoundSurface::bounds(), createRotation(), IgSoG4Trap::dx1, IgSoG4Trap::dx2, IgSoG4Trap::dx3, IgSoG4Trap::dx4, IgSoG4Trap::dy1, IgSoG4Trap::dy2, IgSoG4Trap::dz, GeomDet::geographicalId(), Bounds::length(), TrapezoidalPlaneBounds::parameters(), GloballyPositioned< T >::position(), RZDet, funct::sqrt(), DetId::subdetId(), GeomDet::surface(), Bounds::thickness(), Bounds::width(), and width.

Referenced by buildCSCChambers(), buildDet(), buildDTChambers(), buildHitDets(), buildRPCChambers(), and buildTracker().

02082 {    
02083     // position of the wafer's center
02084     float posx = det->surface ().position ().x () / 100.0;  // cm -> m
02085     float posy = det->surface ().position ().y () / 100.0;  // cm -> m
02086     float posz = det->surface ().position ().z () / 100.0;  // cm -> m
02087     if (type == RZDet) 
02088     {
02089         posx = 0;
02090         posy = sqrt (det->surface ().position ().x () * det->surface ().position ().x () 
02091                      + det->surface ().position ().y () * det->surface ().position ().y ()) / 100.0; 
02092         if (det->surface ().position ().y () < 0.0) posy = - posy;
02093     }
02094     float angle;
02095     SbVec3f axis;
02096     createRotation (det, axis, angle);
02097 
02098     SoTransform *transform = new SoTransform;
02099     transform->translation.setValue (posx, posy, posz);
02100     if (type == RZDet)
02101     {
02102         int subdet = det->geographicalId ().subdetId (); 
02103         if (subdet == 1 || subdet == 3 || subdet == 5) //barrel
02104         {
02105             SbMatrix sbm (1, 0, 0, 0,
02106                           0, 0, -1, 0,
02107                           0, 1, 0, 0,
02108                           0, 0, 0, 1);
02109             SbRotation sbr (sbm);
02110             sbr.getValue (axis, angle);
02111             transform->rotation.setValue (axis, angle);
02112         }  
02113         else 
02114             transform->rotation.setValue (axis, angle);
02115     }  
02116     else 
02117         transform->rotation.setValue (axis, angle);
02118 
02119     // Trapezoidal
02120     const Bounds *b = &((det->surface ()).bounds ());
02121     if (dynamic_cast<const TrapezoidalPlaneBounds *> (b))
02122     {
02123         const TrapezoidalPlaneBounds *b2 = dynamic_cast<const TrapezoidalPlaneBounds *> (b);
02124         std::vector< float > par = b2->parameters ();
02125         
02126         // these parameters are half-lengths, as in CMSIM/GEANT3
02127         float hBottomEdge = par [0];
02128         float hTopEdge    = par [1];
02129         float thickness   = par [2];
02130         float apothem     = par [3];
02131 
02132         IgSoG4Trap *g4Trap = new IgSoG4Trap ();
02133         g4Trap->dz = thickness / 100.; 
02134         g4Trap->dy1 = apothem / 100.;
02135         g4Trap->dy2 = apothem / 100.;
02136         g4Trap->dx1 = hBottomEdge / 100.;
02137         g4Trap->dx2 = hTopEdge / 100.;
02138         g4Trap->dx3 = hBottomEdge / 100.;
02139         g4Trap->dx4 = hTopEdge / 100.;
02140         g4Trap->alp1 = 0.0;
02141         g4Trap->alp2 = 0.0;
02142         separator->addChild (transform);
02143         separator->addChild (g4Trap);
02144     }
02145     if (dynamic_cast<const RectangularPlaneBounds *> (b))
02146     {
02147         SoCube *cube = new SoCube; // Default width 2, height 2, depth 2
02148             
02149         // Rectangular
02150         float length = det->surface ().bounds ().length () / 200.0; // cm -> m
02151         float width = det->surface ().bounds ().width () / 200.0;   // cm -> m
02152         float thickness = det->surface ().bounds ().thickness () / 200.0;  // cm -> m
02153         
02154         transform->scaleFactor.setValue (width, length, thickness);
02155         separator->addChild (transform);
02156         separator->addChild (cube);
02157     }
02158 }

SoSeparator * VisEventSetupService::annotateCaloDet ( DetectorRep  type,
const std::string  detId,
int  subdetn 
)

Definition at line 1988 of file VisEventSetupService.cc.

References NULL.

Referenced by VisCaloGeometryTwig::update().

01989 {
01990     return NULL;
01991 }

SoSeparator * VisEventSetupService::annotateCSCChambers ( DetectorRep  type,
int  chamber,
int  ring,
int  station,
int  endcap 
)

Definition at line 1602 of file VisEventSetupService.cc.

References addDescription(), arg, CSCDetId::chamber(), GeomDetEnumerators::CSC, detId, end, CSCDetId::endcap(), CSCChamber::geographicalId(), DBSPlugin::get(), edm::ESHandle< T >::isValid(), it, m_bx, m_cscGeom, m_event, m_ls, m_orbit, m_run, m_state, NULL, CSCDetId::ring(), CSCDetId::station(), GeomDet::surface(), Surface::toGlobal(), and visible().

Referenced by VisCSCGeometryTwig::update().

01603 {
01604     SoSeparator *sep = new SoSeparator;    
01605 //     SoMaterial *mat = new SoMaterial;
01606 //     SoDrawStyle *style = new SoDrawStyle;
01607 //     style->style = SoDrawStyle::LINES;
01608 //     style->lineWidth.setValue (1.0);
01609 //     float rgbcomponents [4];
01610 //     IgSbColorMap::unpack (0x8b898900, rgbcomponents); // snow4
01611 //     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01612 //     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01613 //     sep->addChild (mat);
01614 //     sep->addChild (style);
01615 
01616     if (m_cscGeom.isValid ())
01617     {
01618         QApplication::setOverrideCursor (Qt::waitCursor);
01619         
01620         QString message ("Annotating CSC Geometry ");
01621         std::string annot;
01622         
01623         if (endcap != 0)
01624         {
01625             message.append (QString (" for "));
01626             message.append (QString ("Endcap %1").arg (endcap));
01627             annot.append (QString ("E%1").arg (endcap).latin1 ());
01628             if (station != 0)
01629             {           
01630                 message.append (QString (", Station %1").arg (station));
01631                 annot.append (QString (" S%1").arg (station).latin1 ());
01632                 if (ring != 0) 
01633                 {
01634                     message.append (QString (", Ring %1").arg (ring));
01635                     annot.append (QString (" R%1").arg (ring).latin1 ());
01636                     if (chamber != 0)
01637                     {                   
01638                         message.append (QString (" Chamber %1").arg (chamber));
01639                         annot.append (QString (" C%1").arg (chamber).latin1 ());
01640                     }               
01641                 }
01642             }
01643         }
01644         message.append ("...");
01645         
01646         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01647             sbar->setMessage (message.latin1 ());
01648 
01649         std::vector<CSCChamber *> vc = m_cscGeom->chambers ();
01650     
01651         for (std::vector<CSCChamber *>::const_iterator it = vc.begin (), end = vc.end (); 
01652              it != end; ++it)
01653         {
01654             const CSCChamber *cscChamber = *it;
01655         
01656             if (cscChamber)
01657             {
01658                 DetId detId = cscChamber->geographicalId ();
01659                 int id = detId ();
01660             
01661                 bool draw = true;
01662             
01663                 ((chamber == 0) || (chamber == CSCDetId::chamber(id))) ? draw = true : draw = false;
01664                 ((ring == 0) || (ring == CSCDetId::ring(id)) && draw) ? draw = true : draw = false;
01665                 ((station == 0) || (station == CSCDetId::station(id)) && draw) ? draw = true : draw = false;
01666                 ((endcap == 0) || (endcap == CSCDetId::endcap(id)) && draw) ? draw = true : draw = false;
01667 
01668                 if (draw) 
01669                 {
01670                     const BoundSurface &bSurface = cscChamber->surface ();
01671 
01672                     LocalPoint  lCentre (0.0, 0.0, 0.0);
01673                     GlobalPoint gCentre = bSurface.toGlobal (lCentre);
01674                     {
01675                         if (visible (gCentre, type, GeomDetEnumerators::CSC))
01676                         {
01677                             SoSeparator* separator = new SoSeparator;
01678                             addDescription (separator, cscChamber, annot);
01679                             sep->addChild (separator);
01680                         }
01681                     }
01682                 }
01683             }
01684         }
01685 
01686         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01687             sbar->setMessage ("CSC Geometry Annotation Done.");
01688         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01689             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01690                               .arg (m_run)
01691                               .arg (m_event)
01692                               .arg (m_ls)
01693                               .arg (m_orbit)
01694                               .arg (m_bx)
01695                               .latin1 ());
01696 
01697         QApplication::restoreOverrideCursor ();
01698 
01699         return sep;
01700     }
01701     else
01702         return NULL;
01703 }

SoSeparator * VisEventSetupService::annotateDTChambers ( DetectorRep  type,
int  station,
int  sector,
int  wheel 
)

Definition at line 1706 of file VisEventSetupService.cc.

References addDescription(), arg, GeomDetEnumerators::DT, end, DBSPlugin::get(), DTChamber::id(), edm::ESHandle< T >::isValid(), it, m_bx, m_dtGeom, m_event, m_ls, m_orbit, m_run, m_state, NULL, DTChamberId::sector(), DTChamberId::station(), visible(), and DTChamberId::wheel().

Referenced by VisDTGeometryTwig::update().

01707 {    
01708     SoSeparator *sep = new SoSeparator;    
01709 //     SoMaterial *mat = new SoMaterial;
01710 //     SoDrawStyle *style = new SoDrawStyle;
01711 //     style->style = SoDrawStyle::LINES;
01712 //     style->lineWidth.setValue (1.0);
01713 //     float rgbcomponents [4];
01714 //     IgSbColorMap::unpack (0x8b898900, rgbcomponents); // snow4
01715 //     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01716 //     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01717 //     sep->addChild (mat);
01718 //     sep->addChild (style);
01719 
01720     if (m_dtGeom.isValid ())
01721     {
01722         QApplication::setOverrideCursor (Qt::waitCursor);
01723         
01724         QString message ("Annotating DT Geometry");
01725         std::string annot;
01726         
01727         if (wheel != 10)
01728         {
01729             message.append (QString (" for Wheel %1").arg (wheel));
01730             annot.append (QString ("W%1").arg (wheel).latin1 ());
01731             if (sector != 0)
01732             {           
01733                 message.append (QString (", Sector %1").arg (sector));
01734                 annot.append (QString (" SE%1").arg (sector).latin1 ());
01735                 if (station != 0)
01736                 {
01737                     message.append (QString (", Station %1").arg (station));
01738                     annot.append (QString (" ST%1").arg (station).latin1 ());
01739                 }
01740             }
01741         }
01742         message.append ("...");
01743         
01744         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01745             sbar->setMessage (message.latin1 ());
01746 
01747         std::vector<DTChamber *> vc = m_dtGeom->chambers ();
01748 
01749         for (std::vector<DTChamber *>::const_iterator it = vc.begin (), end = vc.end (); 
01750              it != end; ++it)
01751         {
01752             const DTChamber *chamber = *it;
01753         
01754             if (chamber)
01755             {
01756                 DTChamberId chId = chamber->id();
01757                 bool draw = true;
01758                 
01759                 ((station == 0) || (station == chId.station()) && draw) ? draw = true : draw = false;
01760                 ((sector == 0) || (sector == chId.sector()) && draw) ? draw = true : draw = false;
01761                 ((wheel == 10) || (wheel == chId.wheel()) && draw) ? draw = true : draw = false;
01762           
01763                 if (draw) 
01764                 {             
01765                     if (visible ((*it)->surface ().position (), type, GeomDetEnumerators::DT))
01766                     {
01767                         SoSeparator* separator = new SoSeparator;
01768                         addDescription (separator, *it, annot);
01769                         sep->addChild (separator);
01770                     }
01771                 }
01772             }
01773         }
01774 
01775         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01776             sbar->setMessage ("DT Geometry Annotation Done.");
01777         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01778             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01779                               .arg (m_run)
01780                               .arg (m_event)
01781                               .arg (m_ls)
01782                               .arg (m_orbit)
01783                               .arg (m_bx)
01784                               .latin1 ());
01785 
01786         QApplication::restoreOverrideCursor ();
01787 
01788         return sep;
01789     }
01790     else
01791         return NULL;
01792 }

SoSeparator * VisEventSetupService::annotateRPCChambers ( DetectorRep  type,
int  region,
int  wheel,
int  sector,
int  station 
)

Definition at line 1795 of file VisEventSetupService.cc.

References addDescription(), arg, end, DBSPlugin::get(), RPCRoll::id(), edm::ESHandle< T >::isValid(), it, m_bx, m_event, m_ls, m_orbit, m_rpcGeom, m_run, m_state, NULL, RPCDetId::region(), RPCDetId::ring(), GeomDetEnumerators::RPCBarrel, RPCDetId::sector(), RPCDetId::station(), and visible().

Referenced by VisRPCGeometryTwig::update().

01796 {    
01797     SoSeparator *sep = new SoSeparator;    
01798 //     SoMaterial *mat = new SoMaterial;
01799 //     SoDrawStyle *style = new SoDrawStyle;
01800 //     style->style = SoDrawStyle::LINES;
01801 //     style->lineWidth.setValue (1.0);
01802 //     float rgbcomponents [4];
01803 //     IgSbColorMap::unpack (0x8b898900, rgbcomponents); // snow4
01804 //     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01805 //     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01806 //     sep->addChild (mat);
01807 //     sep->addChild (style);
01808     if (m_rpcGeom.isValid ())
01809     {    
01810         QApplication::setOverrideCursor (Qt::waitCursor);
01811         
01812         QString message ("Annotating RPC Geometry ");
01813         std::string annot;
01814         
01815         if (region != 10)
01816         {
01817             message.append (QString (" for RGN %1").arg (region));
01818             annot.append (QString ("R%1").arg (region).latin1 ());
01819             if (wheel != 10)
01820             {           
01821                 message.append (QString (", Wheel %1").arg (wheel));
01822                 annot.append (QString ("W%1").arg (wheel).latin1 ());
01823                 if (sector != 30) 
01824                 {
01825                     message.append (QString (", Sector %1").arg (sector));
01826                     annot.append (QString (" SE%1").arg (sector).latin1 ());
01827                     if (station != 30)
01828                     {
01829                         message.append (QString (", Station %1").arg (station));
01830                         annot.append (QString (" ST%1").arg (station).latin1 ());
01831                     }
01832                 }
01833             }
01834         }
01835         message.append ("...");
01836         
01837         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01838             sbar->setMessage (message.latin1 ());
01839 
01840         std::vector<RPCRoll *> vc = m_rpcGeom->rolls ();
01841 
01842         for (std::vector<RPCRoll *>::const_iterator it = vc.begin (), end = vc.end (); 
01843              it != end; ++it)
01844         {
01845             const RPCRoll *roll = *it;
01846         
01847             if (roll)
01848             {
01849                 RPCDetId chId = roll->id ();
01850                 if (chId)
01851                 {
01852                     bool draw = true;
01853          
01854                     ((station == 30) || (station == chId.station()) && draw) ? draw = true : draw = false;
01855                     ((sector == 30) || (sector == chId.sector()) && draw) ? draw = true : draw = false;
01856                     ((wheel == 10) || (wheel == chId.ring()) && draw) ? draw = true : draw = false;
01857                     ((region == 10) || (region == chId.region ()) && draw) ? draw = true : draw = false;                    
01858             
01859                     if (draw) 
01860                     { 
01861                         if (visible ((*it)->surface ().position (), type, GeomDetEnumerators::RPCBarrel))
01862                         {
01863                             SoSeparator* separator = new SoSeparator;
01864                             addDescription (separator, *it, annot);
01865                             sep->addChild (separator);
01866                         }
01867                     }
01868                 }
01869             }
01870         }
01871 
01872         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01873             sbar->setMessage ("RPC Annotation Done.");
01874         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01875             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01876                               .arg (m_run)
01877                               .arg (m_event)
01878                               .arg (m_ls)
01879                               .arg (m_orbit)
01880                               .arg (m_bx)
01881                               .latin1 ());
01882 
01883         QApplication::restoreOverrideCursor ();
01884 
01885         return sep;
01886     }
01887     else
01888         return NULL;
01889 }

SoSeparator * VisEventSetupService::annotateTracker ( DetectorRep  type,
const std::string  name 
)

Definition at line 1892 of file VisEventSetupService.cc.

References addDescription(), arg, end, DBSPlugin::get(), edm::ESHandle< T >::isValid(), it, m_bx, m_event, m_ls, m_orbit, m_run, m_state, m_trackerGeom, NULL, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, subDetector(), GeomDetEnumerators::TEC, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, trackerModuleName(), and visible().

Referenced by VisTrackerGeometryTwig::update().

01893 {    
01894     SoSeparator *sep = new SoSeparator;    
01895 //     SoMaterial *mat = new SoMaterial;
01896 //     SoDrawStyle *style = new SoDrawStyle;
01897 //     style->style = SoDrawStyle::LINES;
01898 //     style->lineWidth.setValue (1.0);
01899 //     float rgbcomponents [4];
01900 //     IgSbColorMap::unpack (0x8b898900, rgbcomponents); // snow4
01901 //     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01902 //     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01903 //     sep->addChild (mat);
01904 //     sep->addChild (style);
01905     
01906     if (m_trackerGeom.isValid ())
01907     {
01908         QApplication::setOverrideCursor (Qt::waitCursor);
01909         std::string annot;
01910             
01911         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01912             sbar->setMessage (QString ("Annotating Tracker Geometry for %1...").arg (name).latin1 ());
01913 
01914         TrackerGeometry::DetContainer::const_iterator it;
01915         TrackerGeometry::DetContainer::const_iterator end;
01916 
01917         if (name == "Tracker") 
01918         {           
01919             it = m_trackerGeom->dets ().begin ();
01920             end = m_trackerGeom->dets ().end ();
01921         }
01922         else
01923         {           
01924             switch (subDetector (name))
01925             {
01926             case GeomDetEnumerators::PixelBarrel:
01927                 it = m_trackerGeom->detsPXB ().begin ();
01928                 end = m_trackerGeom->detsPXB ().end ();     
01929                 break;
01930             case GeomDetEnumerators::PixelEndcap:
01931                 it = m_trackerGeom->detsPXF ().begin ();
01932                 end = m_trackerGeom->detsPXF ().end ();     
01933                 break;
01934             case GeomDetEnumerators::TIB:
01935                 it = m_trackerGeom->detsTIB ().begin ();
01936                 end = m_trackerGeom->detsTIB ().end ();     
01937                 break;
01938             case GeomDetEnumerators::TOB:
01939                 it = m_trackerGeom->detsTOB ().begin ();
01940                 end = m_trackerGeom->detsTOB ().end ();     
01941                 break;
01942             case GeomDetEnumerators::TID:
01943                 it = m_trackerGeom->detsTID ().begin ();
01944                 end = m_trackerGeom->detsTID ().end ();     
01945                 break;
01946             case GeomDetEnumerators::TEC:
01947                 it = m_trackerGeom->detsTEC ().begin ();
01948                 end = m_trackerGeom->detsTEC ().end ();     
01949                 break;
01950             default:
01951                 it = m_trackerGeom->dets ().begin ();
01952                 end = m_trackerGeom->dets ().end ();
01953                 break;
01954             }
01955         }
01956         for (; it != end; ++it)
01957         {
01958             if (visible ((*it)->surface ().position (), type, subDetector (name)))
01959             {
01960                 SoSeparator* separator = new SoSeparator;
01961                 uint32_t id = (*it)->geographicalId ().rawId ();
01962                 annot = boost::lexical_cast<std::string> (trackerModuleName (id));
01963                 addDescription (separator, *it, annot);
01964                 sep->addChild (separator);
01965             }
01966         }       
01967 
01968         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01969             sbar->setMessage ("Tracker Annotation Done.");
01970         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01971             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01972                               .arg (m_run)
01973                               .arg (m_event)
01974                               .arg (m_ls)
01975                               .arg (m_orbit)
01976                               .arg (m_bx)
01977                               .latin1 ());
01978 
01979         QApplication::restoreOverrideCursor ();
01980 
01981         return sep;
01982     }
01983     else
01984         return NULL;
01985 }

SoSeparator * VisEventSetupService::buildCaloDet ( DetectorRep  type,
const std::string  detId,
const int  subdetn 
)

Definition at line 1264 of file VisEventSetupService.cc.

References arg, ASSERT, detectorId(), DBSPlugin::get(), CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloSubdetectorGeometry::getValidDetIds(), i, edm::ESHandle< T >::isValid(), m_bx, m_caloGeom, m_event, m_ls, m_orbit, m_run, m_state, NULL, EZArrayFL< T >::size(), IgSbColorMap::unpack(), visible(), x, y, and z.

Referenced by VisCaloGeometryTwig::update().

01265 {
01266     SoSeparator *sep = new SoSeparator;    
01267     SoMaterial *mat = new SoMaterial;
01268     SoDrawStyle *style = new SoDrawStyle;
01269     style->style = SoDrawStyle::LINES;
01270     style->lineWidth.setValue (1.0);
01271     float rgbcomponents [4];
01272     IgSbColorMap::unpack (0x59595900, rgbcomponents); // grey35
01273     mat->ambientColor.setValue (SbColor (rgbcomponents));
01274     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01275     mat->specularColor.setValue (SbColor (rgbcomponents));
01276     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01277     mat->shininess = 0;
01278     mat->transparency = 0;
01279     sep->addChild (mat);
01280     sep->addChild (style);
01281 
01282     if (m_caloGeom.isValid ())
01283     {
01284         QApplication::setOverrideCursor (Qt::waitCursor);
01285 
01286         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01287             sbar->setMessage (QString ("Constructing Calo Geometry Rep for %1...").arg (detId).latin1 ());
01288 
01289         const CaloSubdetectorGeometry *geom = (*m_caloGeom).getSubdetectorGeometry (detectorId (detId), subdetn);
01290         const std::vector<DetId>& ids (geom->getValidDetIds (detectorId (detId), subdetn));
01291         for (std::vector<DetId>::const_iterator i = ids.begin (), iEnd = ids.end (); i != iEnd; ++i) 
01292         {
01293             const CaloCellGeometry *cell = geom->getGeometry (*i);
01294         
01295             // FIXME: sub detector int
01296             if (visible (cell->getPosition (), type, subdetn))
01297             {
01298                 const CaloCellGeometry::CornersVec& corners = cell->getCorners ();
01299                 ASSERT (corners.size () == 8);  
01300                 
01301                 // Draw the hit in the crystal
01302                 IgSoCrystalHit *crystalHit = new IgSoCrystalHit;
01303 //              float energy = 0.5;
01304 //              crystalHit->energy.setValue (energy);
01305         
01306 //              crystalHit->scale.setValue (0.10);
01307 //              crystalHit->relativeWidth.setValue (0.5);
01308                 crystalHit->drawCrystal.setValue (true);
01309                 crystalHit->drawHit.setValue (false);
01310 
01311                 if (detId == "Hcal")
01312                 {
01313                     crystalHit->front1.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0);
01314                     crystalHit->front2.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0);
01315                     crystalHit->front3.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0);
01316                     crystalHit->front4.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0);
01317         
01318                     crystalHit->back1.setValue  (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0);
01319                     crystalHit->back2.setValue  (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0);
01320                     crystalHit->back3.setValue  (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0);
01321                     crystalHit->back4.setValue  (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0);
01322 
01323                     crystalHit->showLines.setValue (true);
01324                 }
01325                 else if (detId == "Ecal") 
01326                 {
01327                     crystalHit->front1.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0);
01328                     crystalHit->front2.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0);
01329                     crystalHit->front3.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0);
01330                     crystalHit->front4.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0);
01331             
01332                     crystalHit->back1.setValue  (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0);
01333                     crystalHit->back2.setValue  (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0);
01334                     crystalHit->back3.setValue  (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0);
01335                     crystalHit->back4.setValue  (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0); 
01336 
01337                     crystalHit->showLines.setValue (true);
01338                 }
01339 
01340 //              if (type == RZDet || type == RPhiDet)
01341 //                  crystalHit->showLines = true;
01342             
01343                 sep->addChild (crystalHit);
01344             }
01345         }
01346 
01347         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01348             sbar->setMessage ("Calo Geometry Rep Done.");
01349         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01350             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01351                               .arg (m_run)
01352                               .arg (m_event)
01353                               .arg (m_ls)
01354                               .arg (m_orbit)
01355                               .arg (m_bx)
01356                               .latin1 ());
01357 
01358         QApplication::restoreOverrideCursor ();
01359 
01360         return sep;
01361     }
01362     else
01363         return NULL;
01364 }

SoSeparator * VisEventSetupService::buildCSCChambers ( DetectorRep  type,
int  chamber,
int  ring,
int  station,
int  endcap 
)

Definition at line 868 of file VisEventSetupService.cc.

References addWafer(), arg, CSCDetId::chamber(), GeomDetEnumerators::CSC, detId, end, CSCDetId::endcap(), CSCChamber::geographicalId(), DBSPlugin::get(), edm::ESHandle< T >::isValid(), it, m_bx, m_cscGeom, m_event, m_ls, m_orbit, m_run, m_state, NULL, CSCDetId::ring(), CSCDetId::station(), GeomDet::surface(), Surface::toGlobal(), IgSbColorMap::unpack(), and visible().

Referenced by VisCSCGeometryTwig::update().

00869 {    
00870     SoSeparator *sep = new SoSeparator;    
00871     SoMaterial *mat = new SoMaterial;
00872     SoDrawStyle *style = new SoDrawStyle;
00873     style->style = SoDrawStyle::LINES;
00874     float rgbcomponents [4];
00875     IgSbColorMap::unpack (0x59595900, rgbcomponents); // grey35
00876     mat->ambientColor.setValue (SbColor (rgbcomponents));
00877     mat->diffuseColor.setValue (SbColor (rgbcomponents));
00878     mat->specularColor.setValue (SbColor (rgbcomponents));
00879     mat->emissiveColor.setValue (SbColor (rgbcomponents));
00880     mat->shininess = 0;
00881     mat->transparency = 0;
00882     sep->addChild (mat);
00883     sep->addChild (style);
00884 
00885     if (m_cscGeom.isValid ())
00886     {
00887         QApplication::setOverrideCursor (Qt::waitCursor);
00888         
00889         QString message ("Constructing CSC Geometry Rep");
00890         
00891         if (endcap != 0)
00892         {
00893             message.append (QString (" for Endcap %1").arg (endcap));
00894             if (station != 0)
00895             {           
00896                 message.append (QString (", Station %1").arg (station));
00897                 if (ring != 0) 
00898                 {
00899                     message.append (QString (", Ring %1").arg (ring));
00900                     if (chamber != 0)
00901                         message.append (QString (", Sector %1").arg (chamber));
00902                 }
00903             }
00904         }
00905         message.append ("...");
00906         
00907         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00908             sbar->setMessage (message.latin1 ());
00909 
00910         std::vector<CSCChamber *> vc = m_cscGeom->chambers ();
00911     
00912         for (std::vector<CSCChamber *>::const_iterator it = vc.begin (), end = vc.end (); 
00913              it != end; ++it)
00914         {
00915             const CSCChamber *cscChamber = *it;
00916         
00917             if (cscChamber)
00918             {
00919                 DetId detId = cscChamber->geographicalId ();
00920                 int id = detId ();
00921             
00922                 bool draw = true;
00923             
00924                 ((chamber == 0) || (chamber == CSCDetId::chamber(id))) ? draw = true : draw = false;
00925                 ((ring == 0) || (ring == CSCDetId::ring(id)) && draw) ? draw = true : draw = false;
00926                 ((station == 0) || (station == CSCDetId::station(id)) && draw) ? draw = true : draw = false;
00927                 ((endcap == 0) || (endcap == CSCDetId::endcap(id)) && draw) ? draw = true : draw = false;
00928 
00929                 if (draw) 
00930                 {
00931                     const BoundSurface &bSurface = cscChamber->surface ();
00932 
00933                     LocalPoint  lCentre (0.0, 0.0, 0.0);
00934                     GlobalPoint gCentre = bSurface.toGlobal (lCentre);
00935                     {
00936                         if (visible (gCentre, type, GeomDetEnumerators::CSC))
00937                         {
00938                             SoSeparator* separator = new SoSeparator;
00939                             addWafer (separator, cscChamber, type);
00940                             sep->addChild (separator);
00941                         }                       
00942                     }
00943                 }
00944             }
00945         }
00946 
00947         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00948             sbar->setMessage ("CSC Geometry Rep Done.");
00949         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00950             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
00951                               .arg (m_run)
00952                               .arg (m_event)
00953                               .arg (m_ls)
00954                               .arg (m_orbit)
00955                               .arg (m_bx)
00956                               .latin1 ());
00957 
00958         QApplication::restoreOverrideCursor ();
00959 
00960         return sep;
00961     }
00962     else
00963         return NULL;
00964 }

SoSeparator * VisEventSetupService::buildDet ( DetectorRep  type,
std::vector< const GeomDetUnit * > &  dets 
)

Definition at line 1245 of file VisEventSetupService.cc.

References addMaterial(), addWafer(), end, it, and visible().

Referenced by VisTkRecTrackDetsTwig::update().

01246 {
01247     SoSeparator *sep = new SoSeparator;    
01248  
01249     addMaterial (sep, type);
01250 
01251     for (std::vector<const GeomDetUnit *>::const_iterator it = detUnits.begin (), end = detUnits.end (); it != end; ++it)    
01252     {
01253         if (visible ((*it)->surface ().position (), type, (**it).type ().subDetector ()))
01254         {
01255             SoSeparator* separator = new SoSeparator;
01256             addWafer (separator, *it, type);
01257             sep->addChild (separator);
01258         }
01259     }
01260     return sep;
01261 }

SoSeparator * VisEventSetupService::buildDTChambers ( DetectorRep  type,
int  station,
int  sector,
int  wheel 
)

Definition at line 967 of file VisEventSetupService.cc.

References addWafer(), arg, GeomDetEnumerators::DT, end, DBSPlugin::get(), DTChamber::id(), edm::ESHandle< T >::isValid(), it, m_bx, m_dtGeom, m_event, m_ls, m_orbit, m_run, m_state, NULL, DTChamberId::sector(), DTChamberId::station(), IgSbColorMap::unpack(), visible(), and DTChamberId::wheel().

Referenced by VisDTGeometryTwig::update().

00968 {
00969     SoSeparator *sep = new SoSeparator;    
00970     SoMaterial *mat = new SoMaterial;
00971     SoDrawStyle *style = new SoDrawStyle;
00972     style->style = SoDrawStyle::LINES;
00973     float rgbcomponents [4];
00974     IgSbColorMap::unpack (0x59595900, rgbcomponents); // grey35
00975     mat->ambientColor.setValue (SbColor (rgbcomponents));
00976     mat->diffuseColor.setValue (SbColor (rgbcomponents));
00977     mat->specularColor.setValue (SbColor (rgbcomponents));
00978     mat->emissiveColor.setValue (SbColor (rgbcomponents));
00979     mat->shininess = 0;
00980     mat->transparency = 0;
00981     sep->addChild (mat);
00982     sep->addChild (style);
00983 
00984     if (m_dtGeom.isValid ())
00985     {
00986         QApplication::setOverrideCursor (Qt::waitCursor);
00987         
00988         QString message ("Constructing DT Geometry Rep");
00989         
00990         if (wheel != 10)
00991         {
00992             message.append (QString (" for Wheel %1").arg (wheel));
00993             if (sector != 0)
00994             {           
00995                 message.append (QString (", Sector %1").arg (sector));
00996                 if (station != 0) 
00997                     message.append (QString (", Station %1").arg (station));
00998 
00999             }
01000         }
01001         message.append ("...");
01002         
01003         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01004             sbar->setMessage (message.latin1 ());
01005 
01006         std::vector<DTChamber *> vc = m_dtGeom->chambers ();
01007 
01008         for (std::vector<DTChamber *>::const_iterator it = vc.begin (), end = vc.end (); 
01009              it != end; ++it)
01010         {
01011             const DTChamber *chamber = *it;
01012         
01013             if (chamber)
01014             {
01015                 DTChamberId chId = chamber->id();
01016                 bool draw = true;
01017                 
01018                 ((station == 0) || (station == chId.station()) && draw) ? draw = true : draw = false;
01019                 ((sector == 0) || (sector == chId.sector()) && draw) ? draw = true : draw = false;
01020                 ((wheel == 10) || (wheel == chId.wheel()) && draw) ? draw = true : draw = false;
01021           
01022                 if (draw) 
01023                 {             
01024                     if (visible ((*it)->surface ().position (), type, GeomDetEnumerators::DT))
01025                     {
01026                         SoSeparator* separator = new SoSeparator;
01027                         addWafer (separator, *it, type);
01028                         sep->addChild (separator);
01029                     }
01030                 }
01031             }
01032         }
01033 
01034         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01035             sbar->setMessage ("DT Geometry Rep Done.");
01036         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01037             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01038                               .arg (m_run)
01039                               .arg (m_event)
01040                               .arg (m_ls)
01041                               .arg (m_orbit)
01042                               .arg (m_bx)
01043                               .latin1 ());
01044 
01045         QApplication::restoreOverrideCursor ();
01046 
01047         return sep;
01048     }
01049     else
01050         return NULL;
01051 }

SoSeparator * VisEventSetupService::buildHitDets ( DetectorRep  type,
std::vector< DetId > &  dets 
)

Definition at line 1550 of file VisEventSetupService.cc.

References addWafer(), end, FullDet, edm::ESHandle< T >::isValid(), it, m_globalTrackingGeom, NULL, GloballyPositioned< T >::position(), RPhiDet, RZDet, GeomDet::subDetector(), GeomDet::surface(), and visible().

Referenced by VisMuonTwig::update().

01551 {
01552     SoSeparator *sep = new SoSeparator;    
01553     SoMaterial *mat = new SoMaterial;
01554     SoDrawStyle *style = new SoDrawStyle;
01555     style->style = SoDrawStyle::LINES;
01556     style->lineWidth.setValue (2.0);
01557     sep->addChild (style);
01558 
01559     switch (type)
01560     {
01561     case FullDet:// FFC0CB 255;192;203
01562         mat->ambientColor.setValue (1, 0.752941, 0.796078);
01563         mat->diffuseColor.setValue (1, 0.752941, 0.796078);
01564         mat->specularColor.setValue (1, 0.752941, 0.796078);
01565         mat->emissiveColor.setValue (1, 0.752941, 0.796078);
01566         mat->shininess = 0;
01567         mat->transparency = 0;
01568         break;
01569     case RZDet:
01570     case RPhiDet:
01571     default: // 140;23;23
01572         mat->ambientColor.setValue (0.5490196, 0.0090196, 0.0090196);
01573         mat->diffuseColor.setValue (0.5490196, 0.0090196, 0.0090196);
01574         mat->specularColor.setValue (0.5490196, 0.0090196, 0.0090196);
01575         mat->emissiveColor.setValue (0.5490196, 0.0090196, 0.0090196);
01576         mat->shininess = 0;
01577         mat->transparency = 0;
01578         break;
01579     }
01580     sep->addChild (mat);
01581 
01582     if (m_globalTrackingGeom.isValid ())
01583     {
01584         for (std::vector<DetId>::const_iterator it = dets.begin (), end = dets.end (); it != end; ++it)    
01585         {
01586             const GeomDet *geomDet = m_globalTrackingGeom->idToDet (*it);
01587             //GeomDetUnit
01588             if (visible (geomDet->surface ().position (), type, geomDet->subDetector ()))
01589             {
01590                 SoSeparator* separator = new SoSeparator;
01591                 addWafer (separator, geomDet, type);
01592                 sep->addChild (separator);
01593             }
01594         }
01595         return sep;
01596     }
01597     else
01598         return NULL;
01599 }

SoSeparator * VisEventSetupService::buildLegoDet ( const double  scale  ) 

Definition at line 1367 of file VisEventSetupService.cc.

References prof2calltree::ticks, IgSbColorMap::unpack(), x, and z.

Referenced by VisCaloGeometryTwig::update().

01368 {    
01369     SoSeparator *gridSep = new SoSeparator;
01370     SoMaterial *mat = new SoMaterial;
01371     float rgbcomponents [4];
01372     IgSbColorMap::unpack (0x59595900, rgbcomponents); // grey35
01373     mat->ambientColor.setValue (SbColor (rgbcomponents));
01374     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01375     mat->specularColor.setValue (SbColor (rgbcomponents));
01376     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01377     mat->shininess = 0;
01378     mat->transparency = 0;
01379     gridSep->addChild (mat);
01380 
01381     // HF
01382     float etaHFBins [43] = { 0, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609,
01383                              0.696, 0.783, 0.87, 0.957, 1.044, 1.131, 1.218, 1.305,
01384                              1.392, 1.479, 1.566, 1.653, 1.74, 1.83, 1.93, 2.043,
01385                              2.172, 2.322, 2.5, 2.65, 3,
01386                              2.853, 2.964, 3.139, 3.314, // HF
01387                              3.486, 3.664, 3.839, 4.013, 
01388                              4.191, 4.363, 4.538, 4.716, 
01389                              4.889, 5.191};
01390     
01391     SoVertexProperty *vtx = new SoVertexProperty;
01392     SoIndexedLineSet *grid = new SoIndexedLineSet;
01393     SoMFInt32 coords;
01394     int vertex = 6;
01395     int coord = 0;
01396     int tick = 0;
01397     
01398     float x = float (2 * M_PI);
01399     float z = 5.191;
01400     
01401     vtx->vertex.set1Value (0, SbVec3f (0, 0, -z));
01402     vtx->vertex.set1Value (1, SbVec3f (0, 0,  z));
01403     vtx->vertex.set1Value (2, SbVec3f (x, 0,  z));
01404     vtx->vertex.set1Value (3, SbVec3f (x, 0, -z));
01405     vtx->vertex.set1Value (4, SbVec3f (0, 0, -z));
01406     vtx->vertex.set1Value (5, SbVec3f (0, 1, -z));
01407     
01408     for (coord = 0; coord < vertex; coord++)
01409         coords.set1Value (coord, coord);
01410     coords.set1Value (coord++, SO_END_LINE_INDEX);
01411     
01412     for (tick = 0; tick < 43; tick++)
01413     {
01414         vtx->vertex.set1Value (vertex, SbVec3f (0, 0, etaHFBins [tick]));       
01415         coords.set1Value (coord++, vertex++);
01416         vtx->vertex.set1Value (vertex, SbVec3f (x, 0, etaHFBins [tick]));
01417         coords.set1Value (coord++, vertex++);
01418         coords.set1Value (coord++, SO_END_LINE_INDEX);
01419         
01420         vtx->vertex.set1Value (vertex, SbVec3f (0, 0, -etaHFBins [tick]));
01421         coords.set1Value (coord++, vertex++);
01422         vtx->vertex.set1Value (vertex, SbVec3f (x, 0, -etaHFBins [tick]));
01423         coords.set1Value (coord++, vertex++);
01424         coords.set1Value (coord++, SO_END_LINE_INDEX);
01425     }
01426     
01427     int ticks = 36;
01428     x = 0;
01429     
01430     for (tick = 0; tick < ticks; tick++)
01431     {
01432         x = tick * M_PI / 18.0;
01433         vtx->vertex.set1Value (vertex, SbVec3f (x, 0, -z));
01434         coords.set1Value (coord++, vertex++);
01435         vtx->vertex.set1Value (vertex, SbVec3f (x, 0, z));
01436         coords.set1Value (coord++, vertex++);
01437         coords.set1Value (coord++, SO_END_LINE_INDEX);
01438         
01439         for (int ttow = 1; ttow < 2; ttow++)
01440         {
01441             vtx->vertex.set1Value (vertex, SbVec3f (x + ttow * 0.087, 0, -1.74));
01442             coords.set1Value (coord++, vertex++);
01443             vtx->vertex.set1Value (vertex, SbVec3f (x + ttow * 0.087, 0, 1.74));
01444             coords.set1Value (coord++, vertex++);
01445             coords.set1Value (coord++, SO_END_LINE_INDEX);
01446         }
01447     }
01448     
01449     //
01450     float ztick = 5;
01451     float ytick = 0.1;
01452     float xtick = M_PI / 4;
01453     
01454     for (int etaTicks = 0; etaTicks < 11; etaTicks++, ztick--)
01455     {
01456         vtx->vertex.set1Value (vertex, SbVec3f (0, ytick, ztick));
01457         coords.set1Value (coord++, vertex++);
01458         vtx->vertex.set1Value (vertex, SbVec3f (0, 0, ztick));
01459         coords.set1Value (coord++, vertex++);
01460         vtx->vertex.set1Value (vertex, SbVec3f (-ytick, 0, ztick));
01461         coords.set1Value (coord++, vertex++);
01462         coords.set1Value (coord++, SO_END_LINE_INDEX);
01463     }
01464     for (int phiTicks = 0; phiTicks < 8; phiTicks++)
01465     {
01466         vtx->vertex.set1Value (vertex, SbVec3f (xtick, ytick, -z));
01467         coords.set1Value (coord++, vertex++);
01468         vtx->vertex.set1Value (vertex, SbVec3f (xtick, 0, -z));
01469         coords.set1Value (coord++, vertex++);
01470         vtx->vertex.set1Value (vertex, SbVec3f (xtick, 0, -z - ytick));
01471         coords.set1Value (coord++, vertex++);
01472         coords.set1Value (coord++, SO_END_LINE_INDEX);
01473         xtick += M_PI / 4;
01474     }
01475     //
01476 
01477     grid->vertexProperty = vtx;
01478     grid->coordIndex = coords;
01479     
01480     gridSep->addChild (grid);
01481     
01482     SoSeparator         *phiLabels = new SoSeparator;
01483     SoText2             *text;
01484     SoText2             *phiLabelText [8];
01485     SoTranslation       *phiStart = new SoTranslation;
01486     SoTranslation       *phiTranslation = new SoTranslation;
01487     
01488     z = 5.191;
01489     
01490     phiStart->translation = SbVec3f (M_PI / 4, 0, -z - 0.6);
01491     phiTranslation->translation = SbVec3f (M_PI / 4, 0, 0);
01492     phiLabels->addChild (phiStart);
01493     
01494     for (tick = 0; tick < 8; tick ++) 
01495     {
01496         text = phiLabelText [tick] = new SoText2;
01497         phiLabels->addChild (text);
01498         phiLabels->addChild (phiTranslation);
01499     }
01500     
01501     phiLabelText [0]->string = "PI/4";
01502     phiLabelText [1]->string = "PI/2";
01503     phiLabelText [2]->string = "3PI/4";
01504     phiLabelText [3]->string = "PI";
01505     phiLabelText [4]->string = "5PI/4";
01506     phiLabelText [5]->string = "3PI/2";
01507     phiLabelText [6]->string = "7PI/4";
01508     phiLabelText [7]->string = "2PI";
01509     
01510     gridSep->addChild (phiLabels);
01511     
01512     z = -5.191;
01513     
01514     // scale
01515     SoSeparator         *labelScale = new SoSeparator;
01516     SoText2             *labelScaleText = new SoText2;
01517     SoTranslation       *labelScaleOffset = new SoTranslation;
01518     char scaleChars [12] = "1.0 GeV";
01519     sprintf (scaleChars, "%.2G GeV", scale);
01520     labelScaleText->string = scaleChars;
01521     labelScaleOffset->translation
01522         = SbVec3f (-0.6, 1, z - 0.6);
01523     labelScale->addChild (labelScaleOffset);
01524     labelScale->addChild (labelScaleText);
01525     gridSep->addChild (labelScale);
01526     
01527     SoSeparator         *etaLabels = new SoSeparator;
01528     SoTranslation       *etaStart = new SoTranslation;
01529     SoTranslation       *etaTranslation = new SoTranslation;
01530     
01531     etaStart->translation = SbVec3f (-0.6, 0, -5.0);
01532     etaTranslation->translation = SbVec3f (0, 0, 1);
01533     etaLabels->addChild (etaStart);
01534     
01535     for (tick = 0; tick < 11; tick++, z++)
01536     {
01537         text = new SoText2;
01538         char textLabel [5];
01539         sprintf (textLabel, "%.0f", z);
01540         text->string = textLabel;
01541         etaLabels->addChild (text);
01542         etaLabels->addChild (etaTranslation);
01543     }
01544     gridSep->addChild (etaLabels);
01545 
01546     return gridSep;
01547 }

SoSeparator * VisEventSetupService::buildRPCChambers ( DetectorRep  type,
int  region,
int  wheel,
int  sector,
int  station 
)

Definition at line 1054 of file VisEventSetupService.cc.

References addWafer(), arg, end, DBSPlugin::get(), RPCRoll::id(), edm::ESHandle< T >::isValid(), it, m_bx, m_event, m_ls, m_orbit, m_rpcGeom, m_run, m_state, NULL, RPCDetId::region(), RPCDetId::ring(), GeomDetEnumerators::RPCBarrel, RPCDetId::sector(), RPCDetId::station(), IgSbColorMap::unpack(), and visible().

Referenced by VisRPCGeometryTwig::update().

01055 {    
01056     SoSeparator *sep = new SoSeparator;    
01057     SoMaterial *mat = new SoMaterial;
01058     SoDrawStyle *style = new SoDrawStyle;
01059     style->style = SoDrawStyle::LINES;
01060     float rgbcomponents [4];
01061     IgSbColorMap::unpack (0x59595900, rgbcomponents); // grey35
01062     mat->ambientColor.setValue (SbColor (rgbcomponents));
01063     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01064     mat->specularColor.setValue (SbColor (rgbcomponents));
01065     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01066     mat->shininess = 0;
01067     mat->transparency = 0;
01068     sep->addChild (mat);
01069     sep->addChild (style);
01070 
01071     if (m_rpcGeom.isValid ())
01072     {    
01073         QApplication::setOverrideCursor (Qt::waitCursor);
01074         
01075         QString message ("Constructing RPC Geometry Rep");
01076         
01077         if (region != 10)
01078         {
01079             message.append (QString (" for RGN %1").arg (region));
01080             if (wheel != 10)
01081             {           
01082                 message.append (QString (", Wheel %1").arg (wheel));
01083                 if (sector != 30) 
01084                 {
01085                     message.append (QString (", Sector %1").arg (sector));
01086                     if (station != 30)
01087                         message.append (QString (", Station %1").arg (station));
01088                 }
01089             }
01090         }
01091         message.append ("...");
01092         
01093         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01094             sbar->setMessage (message.latin1 ());
01095 
01096         std::vector<RPCRoll *> vc = m_rpcGeom->rolls ();
01097 
01098         for (std::vector<RPCRoll *>::const_iterator it = vc.begin (), end = vc.end (); 
01099              it != end; ++it)
01100         {
01101             const RPCRoll *roll = *it;
01102         
01103             if (roll)
01104             {
01105                 RPCDetId chId = roll->id ();
01106                 if (chId)
01107                 {
01108                     bool draw = true;
01109          
01110                     ((station == 30) || (station == chId.station()) && draw) ? draw = true : draw = false;
01111                     ((sector == 30) || (sector == chId.sector()) && draw) ? draw = true : draw = false;
01112                     ((wheel == 10) || (wheel == chId.ring()) && draw) ? draw = true : draw = false;
01113                     ((region == 10) || (region == chId.region ()) && draw) ? draw = true : draw = false;                    
01114             
01115                     if (draw) 
01116                     { 
01117                         if (visible ((*it)->surface ().position (), type, GeomDetEnumerators::RPCBarrel))
01118                         {
01119                             SoSeparator* separator = new SoSeparator;
01120                             addWafer (separator, *it, type);
01121                             sep->addChild (separator);
01122                         }
01123                     }
01124                 }
01125             }
01126         }
01127 
01128         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01129             sbar->setMessage ("RPC Geometry Rep Done.");
01130         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01131             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01132                               .arg (m_run)
01133                               .arg (m_event)
01134                               .arg (m_ls)
01135                               .arg (m_orbit)
01136                               .arg (m_bx)
01137                               .latin1 ());
01138 
01139         QApplication::restoreOverrideCursor ();
01140 
01141         return sep;
01142     }
01143     else
01144         return NULL;
01145 }

SoSeparator * VisEventSetupService::buildTracker ( DetectorRep  type,
const std::string  name 
)

Definition at line 1148 of file VisEventSetupService.cc.

References addWafer(), arg, end, DBSPlugin::get(), edm::ESHandle< T >::isValid(), it, m_bx, m_event, m_ls, m_orbit, m_run, m_state, m_trackerGeom, NULL, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, subDetector(), GeomDetEnumerators::TEC, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, IgSbColorMap::unpack(), and visible().

Referenced by VisTrackerGeometryTwig::update().

01149 {
01150     SoSeparator *sep = new SoSeparator;    
01151     SoMaterial *mat = new SoMaterial;
01152     float rgbcomponents [4];
01153     IgSbColorMap::unpack (0x59595900, rgbcomponents); // grey35
01154     mat->ambientColor.setValue (SbColor (rgbcomponents));
01155     mat->diffuseColor.setValue (SbColor (rgbcomponents));
01156     mat->specularColor.setValue (SbColor (rgbcomponents));
01157     mat->emissiveColor.setValue (SbColor (rgbcomponents));
01158     mat->shininess = 0;
01159     mat->transparency = 0;
01160     sep->addChild (mat);
01161     SoDrawStyle *style = new SoDrawStyle;
01162     style->style = SoDrawStyle::LINES;
01163     style->lineWidth.setValue (1.0);
01164     sep->addChild (style);
01165     
01166     if (m_trackerGeom.isValid ())
01167     {
01168         QApplication::setOverrideCursor (Qt::waitCursor);
01169             
01170         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01171             sbar->setMessage (QString ("Constructing Tracker Geometry Rep for %1...").arg (name).latin1 ());
01172 
01173         TrackerGeometry::DetContainer::const_iterator it;
01174         TrackerGeometry::DetContainer::const_iterator end;
01175 
01176         if (name == "Tracker") 
01177         {           
01178             it = m_trackerGeom->dets ().begin ();
01179             end = m_trackerGeom->dets ().end ();
01180         }
01181         else
01182         {           
01183             switch (subDetector (name))
01184             {
01185             case GeomDetEnumerators::PixelBarrel:
01186                 it = m_trackerGeom->detsPXB ().begin ();
01187                 end = m_trackerGeom->detsPXB ().end ();     
01188                 break;
01189             case GeomDetEnumerators::PixelEndcap:
01190                 it = m_trackerGeom->detsPXF ().begin ();
01191                 end = m_trackerGeom->detsPXF ().end ();     
01192                 break;
01193             case GeomDetEnumerators::TIB:
01194                 it = m_trackerGeom->detsTIB ().begin ();
01195                 end = m_trackerGeom->detsTIB ().end ();     
01196                 break;
01197             case GeomDetEnumerators::TOB:
01198                 it = m_trackerGeom->detsTOB ().begin ();
01199                 end = m_trackerGeom->detsTOB ().end ();     
01200                 break;
01201             case GeomDetEnumerators::TID:
01202                 it = m_trackerGeom->detsTID ().begin ();
01203                 end = m_trackerGeom->detsTID ().end ();     
01204                 break;
01205             case GeomDetEnumerators::TEC:
01206                 it = m_trackerGeom->detsTEC ().begin ();
01207                 end = m_trackerGeom->detsTEC ().end ();     
01208                 break;
01209             default:
01210                 it = m_trackerGeom->dets ().begin ();
01211                 end = m_trackerGeom->dets ().end ();
01212                 break;
01213             }
01214         }
01215         for (; it != end; ++it)
01216         {
01217             if (visible ((*it)->surface ().position (), type, subDetector (name)))
01218             {
01219                 SoSeparator* separator = new SoSeparator;
01220                 addWafer (separator, *it, type);
01221                 sep->addChild (separator);
01222             }
01223         }       
01224 
01225         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01226             sbar->setMessage ("Tracker Geometry Rep Done.");
01227         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
01228             sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
01229                               .arg (m_run)
01230                               .arg (m_event)
01231                               .arg (m_ls)
01232                               .arg (m_orbit)
01233                               .arg (m_bx)
01234                               .latin1 ());
01235 
01236         QApplication::restoreOverrideCursor ();
01237 
01238         return sep;
01239     }
01240     else
01241         return NULL;
01242 }

bool VisEventSetupService::caloGeomChanged ( void   )  [inline]

Definition at line 113 of file VisEventSetupService.h.

References m_caloGeomCanged.

Referenced by VisCaloGeometryTwig::onNewEvent().

00113 { return m_caloGeomCanged; }    

const std::string VisEventSetupService::caloTextRep ( const std::string  name,
const int  subdetn 
)

Definition at line 441 of file VisEventSetupService.cc.

References arg, detectorId(), DBSPlugin::get(), CaloSubdetectorGeometry::getValidDetIds(), edm::ESHandle< T >::isValid(), m_bx, m_caloGeom, m_event, m_ls, m_orbit, m_run, and m_state.

Referenced by VisCaloGeometryTwig::update().

00442 {
00443     std::ostringstream text;
00444     std::string txtString;
00445 
00446     if (m_caloGeom.isValid () && (subdetn != -1))
00447     {
00448         QApplication::setOverrideCursor (Qt::waitCursor);
00449             
00450         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00451             sbar->setMessage (QString ("Constructing Calo Geometry Table for %1...").arg (name).latin1 ());
00452 
00453         const CaloSubdetectorGeometry *geom = (*m_caloGeom).getSubdetectorGeometry (detectorId (name), subdetn);
00454         const std::vector<DetId>& ids (geom->getValidDetIds (detectorId (name), subdetn));
00455 
00456         text << "<TR align = right><TD COLSPAN = 3>";   
00457         text << " has " << ids.size () << " detectors.</TD>";
00458         
00459         txtString = text.str ();
00460     }
00461     else 
00462     {
00463         txtString = "<TR align = right><TD COLSPAN = 3>Calo geometry is not valid: Have you asked for an event?</TD></TR>";
00464     }
00465         
00466     if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00467         sbar->setMessage ("Calo Geometry Table Done.");
00468     if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00469         sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
00470                           .arg (m_run)
00471                           .arg (m_event)
00472                           .arg (m_ls)
00473                           .arg (m_orbit)
00474                           .arg (m_bx)
00475                           .latin1 ());
00476 
00477     QApplication::restoreOverrideCursor ();
00478 
00479     return txtString; 
00480 }

void VisEventSetupService::createRotation ( const GeomDet det,
SbVec3f &  axis,
float &  angle 
) [private]

Get rotation of a DetUnit.

Definition at line 2162 of file VisEventSetupService.cc.

References rot, GloballyPositioned< T >::rotation(), GeomDet::surface(), Basic3DVector< T >::x(), x, Basic3DVector< T >::y(), y, Basic3DVector< T >::z(), and z.

Referenced by addDescription(), and addWafer().

02163 {    
02164     // Extract the coeff of the rotation matrix
02165     // with a projection on the basis vectors
02166     TkRotation< float > rot = det->surface ().rotation ();
02167     Basic3DVector< float > nx (1., 0., 0.); // x basis vector
02168     Basic3DVector< float > ny (0., 1., 0.); // y basis vector
02169     Basic3DVector< float > nz (0., 0., 1.); // z basis vector
02170     Basic3DVector< float > px = rot * nx; // Rxx Ryx Rzx
02171     Basic3DVector< float > py = rot * ny; // Rxy Ryy Rzy
02172     Basic3DVector< float > pz = rot * nz; // Rxz Ryz Rzz
02173     /* the rotation matrix is
02174      *  Rxx Rxy Rxz
02175      *  Ryx Ryy Ryz
02176      *  Rzx Rzy Rzz
02177      */
02178     // SbMatrix in row major order.
02179     // The 4th dimension is set empiricly set to
02180     // the identity
02181     SbMatrix sbm (px.x (), py.x (), pz.x (), 0,
02182                   px.y (), py.y (), pz.y (), 0,
02183                   px.z (), py.z (), pz.z (), 0,
02184                   0, 0, 0, 1);
02185     SbRotation sbr (sbm);
02186 
02187     float x;
02188     float y;
02189     float z;
02190 
02191     sbr.getValue (axis, angle);
02192     axis.getValue (x, y, z);
02193 }

const std::string VisEventSetupService::cscTextRep ( int  chamber,
int  ring,
int  station,
int  endcap 
)

Definition at line 179 of file VisEventSetupService.cc.

References CSCDetId::chamber(), detId, end, CSCDetId::endcap(), CSCChamber::geographicalId(), edm::ESHandle< T >::isValid(), it, m_cscGeom, CSCDetId::ring(), CSCDetId::station(), GeomDet::surface(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by VisCSCGeometryTwig::update().

00180 {
00181     std::ostringstream text;
00182     std::string txtString;
00183     
00184     if (m_cscGeom.isValid ())
00185     {
00186         std::vector<CSCChamber *> vc = m_cscGeom->chambers ();
00187 
00188         int icount = 0;
00189         
00190         for (std::vector<CSCChamber *>::const_iterator it = vc.begin (), end = vc.end (); 
00191              it != end; ++it)
00192         {
00193             const CSCChamber *cscChamber = *it;
00194         
00195             if (cscChamber)
00196             {           
00197                 DetId detId = cscChamber->geographicalId ();
00198                 int id = detId ();
00199 
00200                 bool draw = true;
00201 
00202                 ((chamber == 0) || (chamber == CSCDetId::chamber(id))) ? draw = true : draw = false;
00203                 ((ring == 0) || (ring == CSCDetId::ring(id)) && draw) ? draw = true : draw = false;
00204                 ((station == 0) || (station == CSCDetId::station(id)) && draw) ? draw = true : draw = false;
00205                 ((endcap == 0) || (endcap == CSCDetId::endcap(id)) && draw) ? draw = true : draw = false;
00206 
00207                 if (draw) 
00208                 { 
00209                     const BoundSurface &bSurface = cscChamber->surface ();
00210 
00211                     LocalPoint  lCentre (0.0, 0.0, 0.0);
00212                     GlobalPoint gCentre = bSurface.toGlobal (lCentre);
00213 
00214                     text << "<TR align = right>"
00215                          << "<TD>" << std::setw (4) << ++icount << "</TD>"
00216                          << "<TD>" << std::setw (12) << id << "</TD>"
00217                          << "<TD>" << std::hex << std::setw (12) << id << "</TD>" 
00218                          << "<TD>" << std::dec << std::setw (4)  << 
00219                             "E" << CSCDetId::endcap (id) << 
00220                             " S" << CSCDetId::station (id) << 
00221                             " R" << CSCDetId::ring (id) << 
00222                             " C" << std::setw (2) << CSCDetId::chamber (id) << std::setw (4) << "</TD>"
00223                          << "<TD>" << std::setprecision (3) << gCentre.x () << ", " << gCentre.y () << ", " << gCentre.z () 
00224                          << "</TD></TR>";
00225                 }
00226             }
00227         }
00228         txtString = text.str ();
00229     }
00230     else
00231     {
00232         txtString = "<TR align = right><TD COLSPAN = 5>CSC geometry is not valid: Have you asked for an event?</TD></TR>";
00233     }
00234     
00235     return txtString;
00236 }

DetId::Detector VisEventSetupService::detectorId ( const std::string &  key  )  [private]

Definition at line 2531 of file VisEventSetupService.cc.

References DetId::Calo, DetId::Ecal, DetId::Hcal, DetId::Muon, and DetId::Tracker.

Referenced by buildCaloDet(), caloTextRep(), and localPositions().

02532 { 
02533     std::map<std::string, DetId::Detector> type; 
02534 
02535     type ["Tracker"] = DetId::Tracker;
02536     type ["Muon"] = DetId::Muon;
02537     type ["Ecal"] = DetId::Ecal;
02538     type ["Hcal"] = DetId::Hcal;
02539     type ["Calo"] = DetId::Calo;
02540 
02541     return type [key]; 
02542 }

const std::string VisEventSetupService::dtTextRep ( int  station,
int  sector,
int  wheel 
)

Definition at line 239 of file VisEventSetupService.cc.

References end, DTChamber::id(), edm::ESHandle< T >::isValid(), it, m_dtGeom, DTChamberId::sector(), DTChamberId::station(), GeomDet::surface(), Surface::toGlobal(), DTChamberId::wheel(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by VisDTGeometryTwig::update().

00240 {
00241     std::ostringstream text;
00242     std::string txtString;
00243     
00244     if (m_dtGeom.isValid ())
00245     {
00246         std::vector<DTChamber *> vc = m_dtGeom->chambers ();
00247 
00248         int icount = 0;
00249         
00250         for (std::vector<DTChamber *>::const_iterator it = vc.begin (), end = vc.end (); 
00251              it != end; ++it)
00252         {
00253             const DTChamber *chamber = *it;
00254         
00255             if (chamber)
00256             {           
00257                 DTChamberId chId = chamber->id();
00258                 bool draw = true;
00259 
00260                 ((station == 0) || (station == chId.station()) && draw) ? draw = true : draw = false;
00261                 ((sector == 0) || (sector == chId.sector()) && draw) ? draw = true : draw = false;
00262                 ((wheel == 10) || (wheel == chId.wheel()) && draw) ? draw = true : draw = false;
00263 
00264                 if (draw) 
00265                 { 
00266                     const BoundSurface &bSurface = chamber->surface ();
00267 
00268                     LocalPoint  lCentre (0.0, 0.0, 0.0);
00269                     GlobalPoint gCentre = bSurface.toGlobal (lCentre);
00270 
00271                     text << "<TR align = right>"
00272                          << "<TD>" << std::setw (4) << ++icount << "</TD>"
00273                          << "<TD>" << std::dec << std::setw (4)
00274                          << "WHE"  << chId.wheel()
00275                          << " STA" << chId.station()
00276                          << " SEC" << chId.sector() << std::setw (4) << "</TD>"
00277                          << "<TD>" << std::setprecision (3) << gCentre.x () << ", " << gCentre.y () << ", " << gCentre.z () 
00278                          << "</TD></TR>";
00279                 }
00280             }
00281         }
00282         txtString = text.str ();
00283     }
00284     else
00285     {
00286         txtString = "<TR align = right><TD COLSPAN = 3>DT geometry is not valid: Have you asked for an event?</TD></TR>";
00287     }
00288     
00289     return txtString;
00290 }

bool VisEventSetupService::emptyCorners ( const DetId  detId  )  const

Definition at line 845 of file VisEventSetupService.cc.

References ASSERT, and CaloCellGeometry::emptyCorners().

Referenced by VisCaloTowerTwig::update().

00846 {
00847     const CaloCellGeometry *cell = (*m_caloGeom).getGeometry (detId);
00848     ASSERT (cell);
00849     return cell->emptyCorners ();    
00850 }

float VisEventSetupService::etaToTheta ( float  eta  )  const

Definition at line 827 of file VisEventSetupService.cc.

References funct::exp(), and f.

Referenced by getBinNumber(), VisHBHERecHitTwig::update(), and VisCaloTowerTwig::update().

00828 {
00829     return (2.f * atan (exp (- eta)));
00830 }

bool VisEventSetupService::fieldChanged ( void   )  [inline]

Definition at line 115 of file VisEventSetupService.h.

References m_fieldGeomCanged.

00115 { return m_fieldGeomCanged; }

unsigned VisEventSetupService::getBinNumber ( const float  eta,
const float  phi,
const unsigned  numR,
const unsigned  numZ,
const float  radiusR,
const float  radiusZ,
const float  barrelMaxEta = 0.f,
const float  beamPipeTheta = 0.f,
const float  endcapMaxTheta = 0.f 
) const

Definition at line 723 of file VisEventSetupService.cc.

References eta, etaToTheta(), f, theta, thetaToEta(), y, and z.

00732 {
00733     unsigned binNum = 0;
00734     const float y = phi;
00735     const float z = ceta;
00736     const float eta = fabs (ceta);
00737     
00738     const float theta = etaToTheta (eta);
00739         
00740     float barrelMaxEta = _barrelMaxEta;
00741     float endcapMaxTheta = _endcapMaxTheta;
00742         
00743     // determine barrelmaxeta if it's not given yet, by assigning
00744     // endcapmaxtheta if it's given or else calculating the corner. Same for
00745     // endcapmaxtheta.
00746     if (barrelMaxEta <= 0.f)
00747     {
00748         if (endcapMaxTheta <= 0.f)
00749         {
00750             endcapMaxTheta = atan (radiusR / radiusZ);
00751             barrelMaxEta = thetaToEta (endcapMaxTheta);
00752         }
00753         else
00754         {
00755             barrelMaxEta = endcapMaxTheta;
00756         }
00757     }
00758         
00759     if (endcapMaxTheta <= 0.f)
00760     {
00761         endcapMaxTheta = etaToTheta (barrelMaxEta);
00762     }
00763         
00764     // remember that the positive y-Axis points downwards
00765     if (y < 0.f)
00766     {
00767         if (z > 0.f)
00768         {
00769             if (eta > barrelMaxEta)
00770             {
00771                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00772                 binNum = (unsigned) ((theta - beamPipeTheta) / deltaTheta);
00773             }
00774             else
00775             {
00776                 const float deltaEta = barrelMaxEta / (numZ/2);
00777                 binNum = (numZ + numR)/2 - (unsigned) (eta / deltaEta) - 1;
00778             }
00779         }
00780         else
00781         {
00782             if (eta <= barrelMaxEta)
00783             {
00784                 const float deltaEta = barrelMaxEta / (numZ/2);
00785                 binNum = (unsigned)(eta / deltaEta) + (numR + numZ)/2;
00786             }
00787             else
00788             {
00789                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00790                 binNum = numR + numZ - (unsigned) ((theta - beamPipeTheta) / deltaTheta) - 1;
00791             }
00792         }
00793     }
00794     else
00795     {
00796         if (z < 0.f) 
00797         {
00798             if (eta > barrelMaxEta)
00799             {
00800                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00801                 binNum = (unsigned) ((theta - beamPipeTheta) / deltaTheta) + numR + numZ;
00802             }
00803             else
00804             {
00805                 const float deltaEta = barrelMaxEta / (numZ/2);
00806                 binNum = 3*(numZ + numR)/2 - (unsigned) (eta / deltaEta) - 1;
00807             }
00808         }
00809         else
00810         {
00811             if (eta <= barrelMaxEta)
00812             {
00813                 const float deltaEta = barrelMaxEta / (numZ/2);
00814                 binNum = 3*(numZ + numR)/2 + (unsigned) (eta / deltaEta);
00815             }
00816             else
00817             {
00818                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00819                 binNum = 2*(numR + numZ) - (unsigned) ((theta - beamPipeTheta) / deltaTheta) - 1;
00820             }
00821         }
00822     }
00823     return binNum;
00824 }

unsigned VisEventSetupService::getBinNumber ( const DetId  detId,
const unsigned  numR,
const unsigned  numZ,
const float  radiusR,
const float  radiusZ,
const float  barrelMaxEta = 0.f,
const float  beamPipeTheta = 0.f,
const float  endcapMaxTheta = 0.f 
) const

Definition at line 618 of file VisEventSetupService.cc.

References eta, PV3DBase< T, PVType, FrameType >::eta(), etaToTheta(), f, CaloCellGeometry::getPosition(), theta, thetaToEta(), PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by VisHORecHitTwig::update(), VisEcalRecHitTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisBasicClusterTwig::update(), VisHBHERecHitTwig::update(), VisHFRecHitTwig::update(), VisBasicClusterCollectionTwig::update(), VisSuperClusterCollectionTwig::update(), VisCaloTowerTwig::update(), and VisSuperClusterTwig::update().

00627 {
00628     unsigned binNum = 0;
00629     
00630     const CaloCellGeometry *cell = (*m_caloGeom).getGeometry (detId); 
00631     const float y = cell->getPosition ().y ();
00632     const float z = cell->getPosition ().z ();
00633     const float eta = fabs (cell->getPosition ().eta ());
00634     const float theta = etaToTheta (eta);
00635         
00636     float barrelMaxEta = _barrelMaxEta;
00637     float endcapMaxTheta = _endcapMaxTheta;
00638         
00639     // determine barrelmaxeta if it's not given yet, by assigning
00640     // endcapmaxtheta if it's given or else calculating the corner. Same for
00641     // endcapmaxtheta.
00642     if (barrelMaxEta <= 0.f)
00643     {
00644         if (endcapMaxTheta <= 0.f)
00645         {
00646             endcapMaxTheta = atan (radiusR / radiusZ);
00647             barrelMaxEta = thetaToEta (endcapMaxTheta);
00648         }
00649         else
00650         {
00651             barrelMaxEta = endcapMaxTheta;
00652         }
00653     }
00654         
00655     if (endcapMaxTheta <= 0.f)
00656     {
00657         endcapMaxTheta = etaToTheta (barrelMaxEta);
00658     }
00659         
00660     // remember that the positive y-Axis points downwards
00661     if (y < 0.f)
00662     {
00663         if (z > 0.f)
00664         {
00665             if (eta > barrelMaxEta)
00666             {
00667                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00668                 binNum = (unsigned) ((theta - beamPipeTheta) / deltaTheta);
00669             }
00670             else
00671             {
00672                 const float deltaEta = barrelMaxEta / (numZ/2);
00673                 binNum = (numZ + numR)/2 - (unsigned) (eta / deltaEta) - 1;
00674             }
00675         }
00676         else
00677         {
00678             if (eta <= barrelMaxEta)
00679             {
00680                 const float deltaEta = barrelMaxEta / (numZ/2);
00681                 binNum = (unsigned)(eta / deltaEta) + (numR + numZ)/2;
00682             }
00683             else
00684             {
00685                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00686                 binNum = numR + numZ - (unsigned) ((theta - beamPipeTheta) / deltaTheta) - 1;
00687             }
00688         }
00689     }
00690     else
00691     {
00692         if (z < 0.f)
00693         {
00694             if (eta > barrelMaxEta)
00695             {
00696                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00697                 binNum = (unsigned) ((theta - beamPipeTheta) / deltaTheta) + numR + numZ;
00698             }
00699             else
00700             {
00701                 const float deltaEta = barrelMaxEta / (numZ/2);
00702                 binNum = 3*(numZ + numR)/2 - (unsigned) (eta / deltaEta) - 1;
00703             }
00704         }
00705         else
00706         {
00707             if (eta <= barrelMaxEta)
00708             {
00709                 const float deltaEta = barrelMaxEta / (numZ/2);
00710                 binNum = 3*(numZ + numR)/2 + (unsigned) (eta / deltaEta);
00711             }
00712             else
00713             {
00714                 const float deltaTheta = (endcapMaxTheta - beamPipeTheta) / (numR/2);
00715                 binNum = 2*(numR + numZ) - (unsigned) ((theta - beamPipeTheta) / deltaTheta) - 1;
00716             }
00717         }
00718     }
00719     return binNum;
00720 }

const GlobalPoint & VisEventSetupService::getCellPosition ( const DetId  detId  )  const

Definition at line 861 of file VisEventSetupService.cc.

References CaloCellGeometry::getPosition().

Referenced by VisEcalRecHitTwig::update(), VisPCaloHitTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisBasicClusterTwig::update(), VisBasicClusterCollectionTwig::update(), VisSuperClusterCollectionTwig::update(), and VisSuperClusterTwig::update().

00862 {
00863     const CaloCellGeometry *cell = (*m_caloGeom).getGeometry (detId);
00864     return cell->getPosition ();
00865 }

const CaloCellGeometry::CornersVec & VisEventSetupService::getCorners ( const DetId  detId  )  const

Definition at line 853 of file VisEventSetupService.cc.

References ASSERT, and CaloCellGeometry::getCorners().

Referenced by VisHORecHitTwig::update(), VisEcalRecHitTwig::update(), VisPCaloHitTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisBasicClusterTwig::update(), VisHBHERecHitTwig::update(), VisHFRecHitTwig::update(), VisBasicClusterCollectionTwig::update(), VisSuperClusterCollectionTwig::update(), VisCaloTowerTwig::update(), and VisSuperClusterTwig::update().

00854 {
00855     const CaloCellGeometry *cell = (*m_caloGeom).getGeometry (detId);
00856     ASSERT (cell);
00857     return cell->getCorners ();
00858 }       

const GlobalPoint VisEventSetupService::globalPosition ( const TrackingRecHit rechit  ) 

Definition at line 495 of file VisEventSetupService.cc.

References TrackingRecHit::geographicalId(), GlobalTrackingGeometry::idToDet(), edm::ESHandle< T >::isValid(), m_globalTrackingGeom, edm::ESHandle< T >::product(), and GeomDet::toGlobal().

Referenced by VisTrajectorySeedTwig::onNewEvent().

00496 {
00497     if (m_globalTrackingGeom.isValid ())
00498         return m_globalTrackingGeom.product ()->idToDet (rechit->geographicalId ())->surface ().toGlobal (this->localPosition (rechit));
00499     else
00500         return GlobalPoint ();
00501 }

bool VisEventSetupService::globalTrackingGeomChanged ( void   )  [inline]

Definition at line 111 of file VisEventSetupService.h.

References m_globalTrackingGeomCanged.

00111 { return m_globalTrackingGeomCanged; }

const GeomDet * VisEventSetupService::idToDet ( const DetId  det  ) 

Definition at line 489 of file VisEventSetupService.cc.

References GlobalTrackingGeometry::idToDet(), m_globalTrackingGeom, and edm::ESHandle< T >::product().

Referenced by VisTrajectorySeedTwig::onNewEvent().

00490 {
00491     return m_globalTrackingGeom.product ()->idToDet (det);
00492 }

VisEventSetupService::IG_DECLARE_STATE_ELEMENT ( VisEventSetupService   )  [private]

void VisEventSetupService::invalidate ( void   )  [inline, private]

Definition at line 125 of file VisEventSetupService.h.

00125 {};

const LocalPoint VisEventSetupService::localPosition ( const TrackingRecHit rechit  ) 

Definition at line 504 of file VisEventSetupService.cc.

References average(), DetId::det(), TrackingRecHit::geographicalId(), GlobalTrackingGeometry::idToDet(), GlobalTrackingGeometry::idToDetUnit(), edm::ESHandle< T >::isValid(), kBPIX, kFPIX, TrackingRecHit::localPosition(), localPositions(), m_globalTrackingGeom, SiStripMatchedRecHit2D::monoHit(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::ESHandle< T >::product(), SiStripMatchedRecHit2D::stereoHit(), DetId::subdetId(), GeomDet::toGlobal(), GeomDet::toLocal(), DetId::Tracker, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00505 {
00506     if (m_globalTrackingGeom.isValid ())
00507     {
00508         const int kBPIX = PixelSubdetector::PixelBarrel;
00509         const int kFPIX = PixelSubdetector::PixelEndcap;
00510 
00511         if (rechit->geographicalId ().det () == DetId::Tracker && 
00512             rechit->geographicalId ().subdetId () != kBPIX && 
00513             rechit->geographicalId().subdetId () != kFPIX)
00514         {
00515             std::vector<LocalPoint> points;
00516             this->localPositions (rechit, points);
00517             if (points.size () == 1)
00518                 return points.front ();
00519             else
00520             {
00521                 //this is not really nice, but that's all we can do there.
00522                 const SiStripMatchedRecHit2D *matched = dynamic_cast<const SiStripMatchedRecHit2D *>(rechit);
00523                 if (matched)
00524                 {
00525                     GlobalPoint pos_1 = m_globalTrackingGeom.product ()->idToDetUnit (matched->monoHit ()->geographicalId ())->surface ().toGlobal (points [0]);
00526                     GlobalPoint pos_2 = m_globalTrackingGeom.product ()->idToDetUnit (matched->stereoHit ()->geographicalId ())->surface ().toGlobal (points [1]);
00527                     GlobalPoint average ((pos_1.x () + pos_2.x ()) / 2,
00528                                          (pos_1.y () + pos_2.y ()) / 2,
00529                                          (pos_1.z () + pos_2.z ()) / 2);      
00530                     return m_globalTrackingGeom.product ()->idToDet (rechit->geographicalId ())->surface ().toLocal (average);
00531                 }
00532                 else return LocalPoint ();
00533             }
00534         }
00535         else
00536         {
00537             return rechit->localPosition ();
00538         }
00539     }
00540     else 
00541         return LocalPoint ();
00542 }

void VisEventSetupService::localPositions ( const TrackingRecHit rechit,
std::vector< LocalPoint > &  points 
)

Definition at line 545 of file VisEventSetupService.cc.

References ASSERT, SiStripCluster::barycenter(), SiStripRecHit2D::cluster(), SiStripRecHit2D::cluster_regional(), DetId::det(), detectorId(), TrackingRecHit::geographicalId(), GlobalTrackingGeometry::idToDetUnit(), kBPIX, kFPIX, TrackingRecHit::localPosition(), StripTopology::localPosition(), m_globalTrackingGeom, SiStripMatchedRecHit2D::monoHit(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::ESHandle< T >::product(), SiStripMatchedRecHit2D::stereoHit(), DetId::subdetId(), GeomDetUnit::topology(), and DetId::Tracker.

Referenced by localPosition(), and VisTrackerRechit2DMatchedTwig::onNewEvent().

00546 {
00547     const int kBPIX = PixelSubdetector::PixelBarrel;
00548     const int kFPIX = PixelSubdetector::PixelEndcap;
00549 
00550     if (rechit->geographicalId ().det () == DetId::Tracker && 
00551         rechit->geographicalId ().subdetId () != kBPIX && 
00552         rechit->geographicalId ().subdetId () != kFPIX)
00553     {
00554         const RecHit2DLocalPos *rechit2D = dynamic_cast<const RecHit2DLocalPos *> (rechit);
00555         const SiStripRecHit2D *single = dynamic_cast<const SiStripRecHit2D *> (rechit);
00556         //matched or single rechits
00557         if (single)
00558         {
00559             DetId detectorId = rechit2D->geographicalId ();
00560     
00561             const SiStripCluster *Cluster = 0;
00562             if (single->cluster ().isNonnull ())
00563                 Cluster = single->cluster ().get ();
00564             else if (single->cluster_regional ().isNonnull ())
00565                 Cluster = single->cluster_regional ().get ();
00566             else 
00567                 points.push_back (LocalPoint ());
00568             const StripTopology  *topology = dynamic_cast<const StripTopology *> (&(m_globalTrackingGeom.product ()->idToDetUnit (detectorId)->topology ()));
00569             ASSERT(topology);
00570                         
00571             points.push_back (topology->localPosition (Cluster->barycenter ()));
00572         }
00573         else
00574         {
00575             const SiStripMatchedRecHit2D *matched = dynamic_cast<const SiStripMatchedRecHit2D *> (rechit);
00576             if (matched)
00577             {
00578                 this->localPositions (matched->monoHit (), points);
00579                 this->localPositions (matched->stereoHit (), points);
00580             }
00581         }
00582     }   
00583     else
00584     {
00585         points.push_back (rechit->localPosition());
00586     }
00587 }

bool VisEventSetupService::muonGeomChanged ( void   )  [inline]

Definition at line 114 of file VisEventSetupService.h.

References m_muonGeomCanged.

Referenced by VisCSCGeometryTwig::onNewEvent(), VisRPCGeometryTwig::onNewEvent(), and VisDTGeometryTwig::onNewEvent().

00114 { return m_muonGeomCanged; } 

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

Implements VisEventObserver.

Definition at line 88 of file VisEventSetupService.cc.

References arg, edm::ESWatcher< T >::check(), find(), edm::EventSetup::get(), DBSPlugin::get(), edm::ParameterSet::getUntrackedParameter(), m_bx, m_caloGeom, m_caloGeomCanged, m_cscGeom, m_dtGeom, m_event, m_field, m_fieldGeomCanged, m_globalTrackingGeom, m_globalTrackingGeomCanged, m_ls, m_muonGeomCanged, m_orbit, m_rpcGeom, m_run, m_state, m_trackerGeom, m_trackerGeomCanged, m_watch_caloGeom, m_watch_field, m_watch_globalTrackingGeom, m_watch_muonGeom, m_watch_trackerGeom, VisConfigurationService::pSet(), and python::EventAnalyzer_cfg::pset.

00090 {
00091     m_run = event.id ().run ();
00092     m_event = event.id ().event ();
00093     m_ls = event.luminosityBlock ();
00094     m_orbit = event.orbitNumber ();
00095     m_bx = event.bunchCrossing ();
00096 
00097     QApplication::setOverrideCursor (Qt::waitCursor);
00098     
00099     std::vector<std::string> ess (6);
00100     ess.push_back ("GlobalTrackingGeometry");
00101     ess.push_back ("CaloGeometry");
00102     ess.push_back ("CSCGeometry");
00103     ess.push_back ("DTGeometry");
00104     ess.push_back ("RPCGeometry");
00105     ess.push_back ("TrackerGeometry");
00106     ess.push_back ("MagneticField");
00107 
00108     const edm::ParameterSet *pset = VisConfigurationService::pSet ();
00109     if (pset)
00110     {
00111         ess = pset->getUntrackedParameter<std::vector<std::string> > ("VisEventSetup", ess);
00112     }
00113 
00114     if (std::find (ess.begin (), ess.end (), "GlobalTrackingGeometry") != ess.end ()) 
00115     {
00116         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00117             sbar->setMessage ("CMSSW is retrieving GlobalTrackingGeometryRecord...");
00118         eventSetup.get<GlobalTrackingGeometryRecord> ().get (m_globalTrackingGeom);
00119         m_globalTrackingGeomCanged = m_watch_globalTrackingGeom.check (eventSetup);
00120     }
00121     if (std::find (ess.begin (), ess.end (), "TrackerGeometry") != ess.end ()) 
00122     {    
00123         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00124             sbar->setMessage ("CMSSW is retrieving TrackerDigiGeometryRecord...");
00125         eventSetup.get<TrackerDigiGeometryRecord> ().get (m_trackerGeom);
00126         m_trackerGeomCanged = m_watch_trackerGeom.check (eventSetup);
00127     }
00128     if (std::find (ess.begin (), ess.end (), "CaloGeometry") != ess.end ()) 
00129     {    
00130         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00131             sbar->setMessage ("CMSSW is retrieving CaloGeometryRecord...");
00132         eventSetup.get<CaloGeometryRecord> ().get (m_caloGeom);
00133         m_caloGeomCanged = m_watch_caloGeom.check (eventSetup);
00134     }
00135     if (std::find (ess.begin (), ess.end (), "CSCGeometry") != ess.end ()) 
00136     {    
00137         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00138             sbar->setMessage ("CMSSW is retrieving MuonGeometryRecord...");
00139         eventSetup.get<MuonGeometryRecord> ().get (m_cscGeom);
00140         m_muonGeomCanged = m_watch_muonGeom.check (eventSetup);
00141     }
00142     if (std::find (ess.begin (), ess.end (), "DTGeometry") != ess.end ()) 
00143     {    
00144         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00145             sbar->setMessage ("CMSSW is retrieving MuonGeometryRecord...");
00146         eventSetup.get<MuonGeometryRecord> ().get (m_dtGeom);
00147         m_muonGeomCanged = m_watch_muonGeom.check (eventSetup);
00148     }
00149     if (std::find (ess.begin (), ess.end (), "RPCGeometry") != ess.end ()) 
00150     {
00151         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00152             sbar->setMessage ("CMSSW is retrieving MuonGeometryRecord...");
00153         eventSetup.get<MuonGeometryRecord> ().get (m_rpcGeom);
00154         m_muonGeomCanged = m_watch_muonGeom.check (eventSetup);
00155     }
00156     if (std::find (ess.begin (), ess.end (), "MagneticField") != ess.end ()) 
00157     {
00158         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00159             sbar->setMessage ("CMSSW is retrieving IdealMagneticFieldRecord...");
00160         eventSetup.get<IdealMagneticFieldRecord> ().get (m_field);
00161         m_fieldGeomCanged = m_watch_field.check (eventSetup);
00162     }
00163 
00164     if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00165         sbar->setMessage ("CMSSW has completed building EventSetup.");
00166     if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00167         sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
00168                           .arg (m_run)
00169                           .arg (m_event)
00170                           .arg (m_ls)
00171                           .arg (m_orbit)
00172                           .arg (m_bx)
00173                           .latin1 ());
00174 
00175     QApplication::restoreOverrideCursor ();
00176 }

float VisEventSetupService::phi4eta ( float  eta  )  const

Definition at line 590 of file VisEventSetupService.cc.

References i, and phi.

Referenced by VisCaloTowerTwig::update(), VisCaloJetTwig::update(), and VisCandidateTwig::update().

00591 {
00592     float phi = 0.087;
00593     float etaBins [29] = { 0, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609,
00594                            0.696, 0.783, 0.87, 0.957, 1.044, 1.131, 1.218, 1.305,
00595                            1.392, 1.479, 1.566, 1.653, 1.74, 1.83, 1.93, 2.043,
00596                            2.172, 2.322, 2.5, 2.65, 3};
00597     
00598     float etaHFBins [14] = {2.853, 2.964, 3.139, 3.314, // HF
00599                             3.486, 3.664, 3.839, 4.013, 
00600                             4.191, 4.363, 4.538, 4.716, 
00601                             4.889, 5.191};
00602     if (eta > 2.853) 
00603         for (int i = 0; i < 13; i++) 
00604         {
00605             if ((eta > etaHFBins [i]) && (eta < etaHFBins [i + 1])) 
00606                 phi =  etaHFBins [i + 1] - etaHFBins [i];
00607         }
00608     else  
00609         for (int i = 0; i < 28; i++) 
00610         {
00611             if ((eta > etaBins [i]) && (eta < etaBins [i + 1])) 
00612                 phi =  etaBins [i + 1] - etaBins [i];
00613         }
00614     return phi;
00615 }

bool VisEventSetupService::present ( const DetId  detId  )  const

Definition at line 839 of file VisEventSetupService.cc.

Referenced by VisCaloTowerTwig::update().

00840 {
00841     return (*m_caloGeom).present (detId);
00842 }

SoSeparator * VisEventSetupService::refitTrack ( reco::TrackRef  track,
double  in,
double  out,
double  step 
)

Definition at line 2277 of file VisEventSetupService.cc.

References alongMomentum, TrajectoryStateClosestToPoint::charge(), IgSoSimpleTrajectory::controlPoints, Vector3DBase< T, FrameTag >::cross(), end, TrajectoryStateOnSurface::globalPosition(), reco::TransientTrack::impactPointTSCP(), int, edm::Ref< C, T, F >::isNonnull(), TrajectoryStateOnSurface::isValid(), it, IgSoSimpleTrajectory::lineWidth, m_field, IgSoSimpleTrajectory::markerPoints, n, NULL, oppositeToMomentum, SteppingHelixPropagator::propagate(), rot, w, w2, ww, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by VisRefitTrackTwig::update().

02278 {
02279     if (track.isNonnull ())
02280     {
02281         SoSeparator *sep = new SoSeparator;
02282         std::vector<SbVec3f> myTrack;
02283 
02284         reco::TransientTrack aRealTrack (track, &*m_field);
02285         // float recPt = aRealTrack.impactPointTSCP ().momentum ().perp ();
02286   
02287         //      std::cout << " p: "<< aRealTrack.impactPointTSCP ().momentum ().mag () << " pT: " << recPt << std::endl;
02288         //      std::cout << " and the charge is ... " << aRealTrack.impactPointTSCP ().charge () << std::endl;
02289 
02290         //Get a propagator and inner/outer state
02291         SteppingHelixPropagator propagator ( &*m_field, alongMomentum);
02292         SteppingHelixPropagator reversePropagator ( &*m_field, oppositeToMomentum);
02293         GlobalPoint gPin ((*track).innerPosition ().x (),
02294                           (*track).innerPosition ().y (),
02295                           (*track).innerPosition ().z ());
02296         GlobalPoint gPout ((*track).outerPosition ().x (),
02297                            (*track).outerPosition ().y (),
02298                            (*track).outerPosition ().z ());
02299         GlobalVector InOutVector = (gPout - gPin);
02300 
02301         // Define rotation for plane perpendicular to InOutVector
02302         // z axis coincides with perp
02303         GlobalVector zAxis = InOutVector.unit();
02304         // x axis has no global Z component
02305         GlobalVector xAxis;
02306         if ( zAxis.x() != 0 || zAxis.y() != 0) {
02307           // precision is not an issue here, just protect against divizion by zero
02308           xAxis = GlobalVector( -zAxis.y(), zAxis.x(), 0).unit();
02309         }
02310         else { // perp coincides with global Z
02311           xAxis = GlobalVector( 1, 0, 0);
02312         }
02313         // y axis obtained by cross product
02314         GlobalVector yAxis( zAxis.cross( xAxis));
02315         Surface::RotationType rot( xAxis.x(), xAxis.y(), xAxis.z(),
02316                                    yAxis.x(), yAxis.y(), yAxis.z(),
02317                                    zAxis.x(), zAxis.y(), zAxis.z());
02318 
02319         // Define step size and number of extra steps on inside and outside
02320         int nSteps = 0;
02321         int nStepsInside = 0;
02322         int nStepsOutside = 0;
02323         GlobalVector StepVector;
02324         if( step > 0.01 ) {
02325           StepVector = InOutVector * step;
02326           nSteps = int (0.5 + 1.0/step);
02327           nStepsInside = int (0.5 + in/step);
02328           nStepsOutside = int (0.5 + out/step);
02329         } else {
02330           StepVector = InOutVector * 0.01;
02331           nSteps = 100;
02332           nStepsInside = int (0.5 + in*100);
02333           nStepsOutside = int (0.5 + out*100);    
02334         } 
02335 
02336         GlobalVector gVin ((*track).innerMomentum ().x (),
02337                            (*track).innerMomentum ().y (),
02338                            (*track).innerMomentum ().z ());
02339         GlobalVector gVout ((*track).outerMomentum ().x (),
02340                             (*track).outerMomentum ().y (),
02341                             (*track).outerMomentum ().z ());
02342         GlobalTrajectoryParameters GTPin (gPin, gVin, aRealTrack.impactPointTSCP ().charge (), &*m_field);
02343         FreeTrajectoryState FTSin (GTPin);
02344         GlobalTrajectoryParameters GTPout (gPout, gVout, aRealTrack.impactPointTSCP ().charge (), &*m_field);
02345         FreeTrajectoryState FTSout (GTPout);
02346 
02347         int nGood = 0;
02348         int nBad = 0;
02349 
02350         // Do nStepsInside propagations on inside to plot track
02351         GlobalPoint GP = gPin; 
02352         GP -= nStepsInside * StepVector;
02353         Basic3DVector<float> Basic3DV (StepVector.x (), StepVector.y (), StepVector.z ());
02354         for (int istep = 0; istep < nStepsInside; ++istep) 
02355         {
02356             GP += StepVector;
02357             Surface::PositionType pos (GP.x (), GP.y (), GP.z ());
02358             PlaneBuilder::ReturnType SteppingPlane = PlaneBuilder ().plane (pos, rot);
02359             TrajectoryStateOnSurface trj =  reversePropagator.propagate (FTSin, *SteppingPlane);
02360             if (trj.isValid ())
02361             {
02362                 float x = trj.globalPosition ().x () / 100.0;
02363                 float y = trj.globalPosition ().y () / 100.0;
02364                 float z = trj.globalPosition ().z () / 100.0;              
02365                 myTrack.push_back (SbVec3f (x, y, z));
02366                 nGood++;
02367             } 
02368             else 
02369             {
02370                 nBad++;
02371             }
02372         }
02373         // Do nStep propagations from track Inner state to track Outer state
02374 
02375 
02376         GP = gPin - StepVector;
02377         float w = 0;
02378         for (int istep = 0; istep < nSteps+1 ; ++istep) 
02379           { // from innerPosition to outerPosition
02380             GP += StepVector;
02381             Surface::PositionType pos (GP.x (), GP.y (), GP.z ());
02382             PlaneBuilder::ReturnType SteppingPlane = PlaneBuilder ().plane (pos, rot);
02383             TrajectoryStateOnSurface trj_in =  propagator.propagate (FTSin, *SteppingPlane);
02384             TrajectoryStateOnSurface trj_out =  reversePropagator.propagate (FTSout, *SteppingPlane);
02385             if (trj_in.isValid () && trj_out.isValid ()) 
02386             {
02387                 float x1 = trj_in.globalPosition ().x () / 100.0;
02388                 float y1 = trj_in.globalPosition ().y () / 100.0;
02389                 float z1 = trj_in.globalPosition ().z () / 100.0;                  
02390 
02391                 float x2 = trj_out.globalPosition ().x () / 100.0;
02392                 float y2 = trj_out.globalPosition ().y () / 100.0;
02393                 float z2 = trj_out.globalPosition ().z () / 100.0;                 
02394 
02395                 float ww = w<0.4999 ? ww = w : ww=1.0-w;
02396                 float w2 = 0.5*ww*ww/((1.0-ww)*(1.0-ww));
02397                 if(w>0.4999) w2=1.0-w2;  
02398 
02399                 float x = (1.0-w2)*x1 + w2*x2;
02400                 float y = (1.0-w2)*y1 + w2*y2;
02401                 float z = (1.0-w2)*z1 + w2*z2;
02402 
02403 
02404 
02405                 myTrack.push_back (SbVec3f (x, y, z));
02406                 nGood++;
02407             } 
02408             else 
02409             {
02410                 nBad++;
02411             }
02412             w += 1.0/float(nSteps);
02413         }
02414         // Do nStepsInside propagations on Outside to plot track
02415         GP = gPout;
02416         for (int istep = 0; istep < nStepsOutside; ++istep) 
02417         {
02418             GP += StepVector;
02419             Surface::PositionType pos (GP.x (), GP.y (), GP.z ());
02420             PlaneBuilder::ReturnType SteppingPlane = PlaneBuilder ().plane (pos, rot);
02421             TrajectoryStateOnSurface trj =  propagator.propagate (FTSout, *SteppingPlane);
02422             if (trj.isValid ())
02423             {
02424                 float x = trj.globalPosition ().x () / 100.0;
02425                 float y = trj.globalPosition ().y () / 100.0;
02426                 float z = trj.globalPosition ().z () / 100.0;              
02427                 myTrack.push_back (SbVec3f (x, y, z));
02428                 nGood++;
02429             } 
02430             else 
02431             {
02432                 nBad++;
02433             }
02434         }
02435 
02436 
02437 
02438 
02439         // Save the new track
02440         IgSoSimpleTrajectory* reconstructedTrack = new IgSoSimpleTrajectory;
02441         reconstructedTrack->lineWidth = 3.0;
02442         // FIXME: m_Tracks.push_back (myTrack);
02443         int n = 0;
02444         for (std::vector<SbVec3f>::const_iterator it = myTrack.begin (), end = myTrack.end (); it != end; ++it) 
02445         {
02446             reconstructedTrack->controlPoints.set1Value (n, (*it));
02447             reconstructedTrack->markerPoints.set1Value (n, (*it));
02448             
02449             n++;
02450         }
02451         sep->addChild (reconstructedTrack);
02452         
02453         //      std::cout << "eeeh... " << nGood << " out of " << nGood+nBad << " propagations successful " << std::endl;
02454         //      std::cout << " And track is based on " << nRecHit << " valid RecHits " << std::endl;
02455 
02456         return sep;     
02457     }
02458     else
02459         return NULL;
02460 }

const std::string VisEventSetupService::rpcTextRep ( int  region,
int  wheel,
int  sector,
int  station 
)

Definition at line 293 of file VisEventSetupService.cc.

References end, RPCRoll::id(), edm::ESHandle< T >::isValid(), it, m_rpcGeom, RPCDetId::region(), RPCDetId::ring(), RPCDetId::sector(), RPCDetId::station(), GeomDet::surface(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by VisRPCGeometryTwig::update().

00294 {
00295     std::ostringstream text;
00296     std::string txtString;
00297     
00298     if (m_rpcGeom.isValid ())
00299     {   
00300         std::vector<RPCRoll *> vc = m_rpcGeom->rolls ();
00301       
00302         int icount = 0;
00303       
00304         for (std::vector<RPCRoll *>::const_iterator it = vc.begin (), end = vc.end (); 
00305              it != end; ++it)
00306         {
00307             const RPCRoll *roll = *it;
00308 
00309             if (roll)
00310             {
00311                 RPCDetId chId = roll->id ();
00312                 if (chId)
00313                 {
00314                     bool draw = true;
00315 
00316                     ((station == 30) || (station == chId.station()) && draw) ? draw = true : draw = false;
00317                     ((sector == 30) || (sector == chId.sector()) && draw) ? draw = true : draw = false;
00318                     ((wheel == 10) || (wheel == chId.ring()) && draw) ? draw = true : draw = false;
00319                     ((region == 10) || (region == chId.region ()) && draw) ? draw = true : draw = false;                    
00320 
00321                     if (draw) 
00322                     { 
00323                         const BoundSurface &bSurface = roll->surface ();
00324                   
00325                         LocalPoint  lCentre (0.0, 0.0, 0.0);
00326                         GlobalPoint gCentre = bSurface.toGlobal (lCentre);
00327                   
00328                         text << "<TR align = right>"
00329                              << "<TD>" << std::setw (4) << ++icount << "</TD>" 
00330                              << "<TD>" << std::dec << std::setw (4)  << 
00331                             "RGN "  << chId.region() << 
00332                             "; WHE "  << chId.ring() << 
00333                             "; STA " << chId.station() << 
00334                             "; SEC " << chId.sector() << std::setw (4) << "</TD>"
00335                     
00336                              << "<TD>" << std::setprecision (3) << gCentre.x () << ", " << gCentre.y () << ", " << gCentre.z () 
00337                              << "</TD></TR>";
00338                     }
00339                 }
00340             }
00341         }
00342         txtString = text.str ();
00343     }  
00344     else
00345     {
00346         txtString = "<TR align = right><TD COLSPAN = 3>RPC geometry is not valid: Have you asked for an event?</TD></TR>";
00347     }
00348     
00349     return txtString;
00350 }

int VisEventSetupService::subDetector ( const std::string &  key  )  [private]

Definition at line 2512 of file VisEventSetupService.cc.

References GeomDetEnumerators::CSC, GeomDetEnumerators::DT, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GeomDetEnumerators::RPCBarrel, GeomDetEnumerators::RPCEndcap, GeomDetEnumerators::TEC, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, and GeomDetEnumerators::TOB.

Referenced by annotateTracker(), buildTracker(), and trackerTextRep().

02513 { 
02514     std::map<std::string, GeomDetEnumerators::SubDetector> type; 
02515 
02516     type ["PixelBarrel"] = GeomDetEnumerators::PixelBarrel;
02517     type ["PixelEndcap"] = GeomDetEnumerators::PixelEndcap;
02518     type ["TIB"] = GeomDetEnumerators::TIB;
02519     type ["TOB"] = GeomDetEnumerators::TOB;
02520     type ["TID"] = GeomDetEnumerators::TID;
02521     type ["TEC"] = GeomDetEnumerators::TEC;
02522     type ["CSC"] = GeomDetEnumerators::CSC;
02523     type ["DT"] = GeomDetEnumerators::DT;
02524     type ["RPCBarrel"] = GeomDetEnumerators::RPCBarrel;
02525     type ["RPCEndcap"] = GeomDetEnumerators::RPCEndcap;
02526     
02527     return type [key]; 
02528 }

float VisEventSetupService::thetaToEta ( float  theta  )  const

Definition at line 833 of file VisEventSetupService.cc.

References f, funct::log(), and funct::tan().

Referenced by getBinNumber().

00834 {
00835     return (-log (tan (theta / 2.f)));
00836 }

const GlobalPoint VisEventSetupService::toGlobal ( const LocalPoint  point,
const DetId  detId 
)

Definition at line 483 of file VisEventSetupService.cc.

References GlobalTrackingGeometry::idToDetUnit(), m_globalTrackingGeom, edm::ESHandle< T >::product(), GeomDet::surface(), and Surface::toGlobal().

Referenced by VisTrackerRechit2DMatchedTwig::onNewEvent(), and VisPSimHitTwig::update().

00484 {
00485     return m_globalTrackingGeom.product ()->idToDetUnit (detId)->surface ().toGlobal (point);
00486 }

bool VisEventSetupService::trackerGeomChanged ( void   )  [inline]

Definition at line 112 of file VisEventSetupService.h.

References m_trackerGeomCanged.

Referenced by VisTrackerGeometryTwig::onNewEvent().

00112 { return m_trackerGeomCanged; }

const std::string VisEventSetupService::trackerModuleName ( DetId  detId  ) 

Definition at line 2024 of file VisEventSetupService.cc.

References PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by annotateTracker().

02025 {
02026     std::ostringstream outs;
02027     switch (detId.subdetId ())
02028     {
02029     case PixelSubdetector::PixelBarrel:
02030         outs << PXBDetId (detId);
02031         break;
02032     case PixelSubdetector::PixelEndcap:
02033         outs << PXFDetId (detId);
02034         break;
02035     case StripSubdetector::TIB:
02036         outs << TIBDetId (detId);
02037         break;
02038     case StripSubdetector::TID:
02039         outs << TIDDetId (detId);
02040         break;
02041     case StripSubdetector::TOB:
02042         outs << TOBDetId (detId);
02043         break;
02044     case StripSubdetector::TEC:
02045         outs << TECDetId (detId);
02046         break;
02047     default:
02048         break;
02049     }
02050     
02051     return outs.str ();
02052 }

const std::string VisEventSetupService::trackerTextRep ( const std::string  name  ) 

Definition at line 353 of file VisEventSetupService.cc.

References arg, end, DBSPlugin::get(), edm::ESHandle< T >::isValid(), it, m_bx, m_event, m_ls, m_orbit, m_run, m_state, m_trackerGeom, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, subDetector(), GeomDetEnumerators::TEC, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by VisTrackerGeometryTwig::update().

00354 {
00355     std::ostringstream text;
00356     std::string txtString;
00357 
00358     if (m_trackerGeom.isValid ())
00359     {
00360         QApplication::setOverrideCursor (Qt::waitCursor);
00361             
00362         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00363             sbar->setMessage (QString ("Constructing Tracker Geometry Table for %1...").arg (name).latin1 ());
00364     
00365         TrackerGeometry::DetContainer::const_iterator it;
00366         TrackerGeometry::DetContainer::const_iterator end;
00367 
00368         int icount = 0;
00369 
00370         if (name == "Tracker") 
00371         {           
00372             it = m_trackerGeom->dets ().begin ();
00373             end = m_trackerGeom->dets ().end ();
00374         }
00375         else
00376         {           
00377             switch (subDetector (name))
00378             {
00379             case GeomDetEnumerators::PixelBarrel:
00380                 it = m_trackerGeom->detsPXB ().begin ();
00381                 end = m_trackerGeom->detsPXB ().end ();     
00382                 break;
00383             case GeomDetEnumerators::PixelEndcap:
00384                 it = m_trackerGeom->detsPXF ().begin ();
00385                 end = m_trackerGeom->detsPXF ().end ();     
00386                 break;
00387             case GeomDetEnumerators::TIB:
00388                 it = m_trackerGeom->detsTIB ().begin ();
00389                 end = m_trackerGeom->detsTIB ().end ();     
00390                 break;
00391             case GeomDetEnumerators::TOB:
00392                 it = m_trackerGeom->detsTOB ().begin ();
00393                 end = m_trackerGeom->detsTOB ().end ();     
00394                 break;
00395             case GeomDetEnumerators::TID:
00396                 it = m_trackerGeom->detsTID ().begin ();
00397                 end = m_trackerGeom->detsTID ().end ();     
00398                 break;
00399             case GeomDetEnumerators::TEC:
00400                 it = m_trackerGeom->detsTEC ().begin ();
00401                 end = m_trackerGeom->detsTEC ().end ();     
00402                 break;
00403             default:
00404                 break;
00405             }
00406         }
00407         
00408         for (; it != end; ++it)
00409         {
00410             Surface::GlobalPoint pos =  (**it).surface ().position ();
00411             text << "<TR align = right>"
00412                  << "<TD>" << std::setw (4) << ++icount << "</TD>" ;
00413             
00414             text << "<TD>" << (**it).geographicalId ().rawId () << "</TD>" 
00415                  << "<TD>" << pos.x () << ", " << pos.y () << ", " << pos.z () << "</TD></TR>";
00416         }
00417         txtString = text.str ();
00418     }
00419     else 
00420     {
00421         txtString = "<TR align = right><TD COLSPAN = 3>Tracker geometry is not valid: Have you asked for an event?</TD></TR>";
00422     }
00423 
00424     if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00425         sbar->setMessage ("Tracker Geometry Table Done.");
00426     if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (m_state))
00427         sbar->setMessage (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5")
00428                           .arg (m_run)
00429                           .arg (m_event)
00430                           .arg (m_ls)
00431                           .arg (m_orbit)
00432                           .arg (m_bx)
00433                           .latin1 ());
00434 
00435     QApplication::restoreOverrideCursor ();
00436 
00437     return txtString;
00438 }

bool VisEventSetupService::visible ( const GlobalPoint point,
DetectorRep  type,
int  subDetector 
) [private]

Definition at line 2463 of file VisEventSetupService.cc.

References GeomDetEnumerators::CSC, GeomDetEnumerators::DT, FullDet, m_phiDelta, m_phiStart, p, PV3DBase< T, PVType, FrameType >::phi(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GeomDetEnumerators::RPCBarrel, RPhiDet, RZDet, GeomDetEnumerators::TEC, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, GeomDetEnumerators::TOB, VisActiveConfigurable< T >::value(), width, and PV3DBase< T, PVType, FrameType >::z().

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), annotateTracker(), buildCaloDet(), buildCSCChambers(), buildDet(), buildDTChambers(), buildHitDets(), buildRPCChambers(), and buildTracker().

02464 {
02465     bool visible = false;
02466     double width = 1.0;
02467     double length = 10.0;
02468     if (subDetector == GeomDetEnumerators::PixelBarrel) width = 1.0;
02469     if (subDetector == GeomDetEnumerators::PixelEndcap) width = 1.0;
02470     if (subDetector == GeomDetEnumerators::TOB) width = 10.0;
02471     if (subDetector == GeomDetEnumerators::TIB) width = 5.5;
02472     if (subDetector == GeomDetEnumerators::TID) width = 15.0;
02473     if (subDetector == GeomDetEnumerators::TEC) width = 30.0;
02474     if (subDetector == GeomDetEnumerators::CSC) width = 75.0;
02475     if (subDetector == GeomDetEnumerators::RPCBarrel) width = 270.0;
02476     if (subDetector == GeomDetEnumerators::DT) width = 170.0;
02477     
02478 //     std::cout << m_phiStart.value () << std::endl;
02479 //     std::cout << m_phiDelta.value () << std::endl;
02480     
02481     switch (type)
02482     {
02483     case FullDet:
02484         visible = true;
02485         break;
02486     case RZDet:
02487         {           
02488             double p = point.phi ();
02489             if (p < 0) p += 2 * M_PI;
02490             double p0 = m_phiStart.value ();
02491             double pD = m_phiDelta.value ();
02492         
02493             double pMin = p0 - pD;
02494             double pMax = p0 + pD;
02495         
02496             ((p >= pMin && p <= pMax) || 
02497              (p >= pMin + M_PI && p <= pMax + M_PI)) ?  visible = true : visible = false;
02498             //fabs (point.x ()) < width ? visible = true : visible = false; 
02499         }
02500         break;
02501     case RPhiDet:
02502         fabs (point.z ()) < length ? visible = true : visible = false;
02503         break;
02504     default:
02505         break;
02506     }
02507 
02508     return visible;
02509 }


Member Data Documentation

int VisEventSetupService::m_bx [private]

Definition at line 132 of file VisEventSetupService.h.

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), annotateTracker(), buildCaloDet(), buildCSCChambers(), buildDTChambers(), buildRPCChambers(), buildTracker(), caloTextRep(), onNewEvent(), and trackerTextRep().

edm::ESHandle<CaloGeometry> VisEventSetupService::m_caloGeom [private]

Definition at line 144 of file VisEventSetupService.h.

Referenced by buildCaloDet(), caloTextRep(), and onNewEvent().

bool VisEventSetupService::m_caloGeomCanged [private]

Definition at line 138 of file VisEventSetupService.h.

Referenced by caloGeomChanged(), and onNewEvent().

edm::ESHandle<CSCGeometry> VisEventSetupService::m_cscGeom [private]

Definition at line 145 of file VisEventSetupService.h.

Referenced by annotateCSCChambers(), buildCSCChambers(), cscTextRep(), and onNewEvent().

edm::ESHandle<DTGeometry> VisEventSetupService::m_dtGeom [private]

Definition at line 146 of file VisEventSetupService.h.

Referenced by annotateDTChambers(), buildDTChambers(), dtTextRep(), and onNewEvent().

int VisEventSetupService::m_event [private]

Definition at line 129 of file VisEventSetupService.h.

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), annotateTracker(), buildCaloDet(), buildCSCChambers(), buildDTChambers(), buildRPCChambers(), buildTracker(), caloTextRep(), onNewEvent(), and trackerTextRep().

edm::ESHandle<MagneticField> VisEventSetupService::m_field [private]

Definition at line 148 of file VisEventSetupService.h.

Referenced by onNewEvent(), and refitTrack().

bool VisEventSetupService::m_fieldGeomCanged [private]

Definition at line 140 of file VisEventSetupService.h.

Referenced by fieldChanged(), and onNewEvent().

edm::ESHandle<GlobalTrackingGeometry> VisEventSetupService::m_globalTrackingGeom [private]

Definition at line 142 of file VisEventSetupService.h.

Referenced by buildHitDets(), globalPosition(), idToDet(), localPosition(), localPositions(), onNewEvent(), and toGlobal().

bool VisEventSetupService::m_globalTrackingGeomCanged [private]

Definition at line 136 of file VisEventSetupService.h.

Referenced by globalTrackingGeomChanged(), and onNewEvent().

int VisEventSetupService::m_ls [private]

Definition at line 130 of file VisEventSetupService.h.

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), annotateTracker(), buildCaloDet(), buildCSCChambers(), buildDTChambers(), buildRPCChambers(), buildTracker(), caloTextRep(), onNewEvent(), and trackerTextRep().

bool VisEventSetupService::m_muonGeomCanged [private]

Definition at line 139 of file VisEventSetupService.h.

Referenced by muonGeomChanged(), and onNewEvent().

int VisEventSetupService::m_orbit [private]

Definition at line 131 of file VisEventSetupService.h.

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), annotateTracker(), buildCaloDet(), buildCSCChambers(), buildDTChambers(), buildRPCChambers(), buildTracker(), caloTextRep(), onNewEvent(), and trackerTextRep().

VisPhiDelta VisEventSetupService::m_phiDelta [private]

Definition at line 133 of file VisEventSetupService.h.

Referenced by visible().

VisPhiStart VisEventSetupService::m_phiStart [private]

Definition at line 134 of file VisEventSetupService.h.

Referenced by visible().

edm::ESHandle<RPCGeometry> VisEventSetupService::m_rpcGeom [private]

Definition at line 147 of file VisEventSetupService.h.

Referenced by annotateRPCChambers(), buildRPCChambers(), onNewEvent(), and rpcTextRep().

int VisEventSetupService::m_run [private]

Definition at line 128 of file VisEventSetupService.h.

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), annotateTracker(), buildCaloDet(), buildCSCChambers(), buildDTChambers(), buildRPCChambers(), buildTracker(), caloTextRep(), onNewEvent(), and trackerTextRep().

IgState* VisEventSetupService::m_state [private]

Reimplemented from VisEventObserver.

Definition at line 125 of file VisEventSetupService.h.

Referenced by annotateCSCChambers(), annotateDTChambers(), annotateRPCChambers(), annotateTracker(), buildCaloDet(), buildCSCChambers(), buildDTChambers(), buildRPCChambers(), buildTracker(), caloTextRep(), onNewEvent(), trackerTextRep(), and ~VisEventSetupService().

edm::ESHandle<TrackerGeometry> VisEventSetupService::m_trackerGeom [private]

Definition at line 143 of file VisEventSetupService.h.

Referenced by annotateTracker(), buildTracker(), onNewEvent(), and trackerTextRep().

bool VisEventSetupService::m_trackerGeomCanged [private]

Definition at line 137 of file VisEventSetupService.h.

Referenced by onNewEvent(), and trackerGeomChanged().

edm::ESWatcher<CaloGeometryRecord> VisEventSetupService::m_watch_caloGeom [private]

Definition at line 152 of file VisEventSetupService.h.

Referenced by onNewEvent().

edm::ESWatcher<IdealMagneticFieldRecord> VisEventSetupService::m_watch_field [private]

Definition at line 154 of file VisEventSetupService.h.

Referenced by onNewEvent().

edm::ESWatcher<GlobalTrackingGeometryRecord> VisEventSetupService::m_watch_globalTrackingGeom [private]

Definition at line 150 of file VisEventSetupService.h.

Referenced by onNewEvent().

edm::ESWatcher<MuonGeometryRecord> VisEventSetupService::m_watch_muonGeom [private]

Definition at line 153 of file VisEventSetupService.h.

Referenced by onNewEvent().

edm::ESWatcher<TrackerDigiGeometryRecord> VisEventSetupService::m_watch_trackerGeom [private]

Definition at line 151 of file VisEventSetupService.h.

Referenced by onNewEvent().


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