CMS 3D CMS Logo

VisCuTracker.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 #include "VisFramework/VisFrameworkBase/interface/debug.h"
00003 #include "FWCore/Framework/interface/ESHandle.h"
00004 #include "VisReco/VisRecoGeometry/interface/VisTrackingGeometry.h"
00005 #include "VisReco/VisCustomTracker/interface/VisCuTracker.h"
00006 #include "VisReco/VisCustomTracker/interface/VisCuTkModule.h"
00007 #include "VisReco/VisCustomTracker/interface/VisCuTkModuleMap.h"
00008 #include "DataFormats/GeometrySurface/interface/TkRotation.h"
00009 #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
00010 #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
00011 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00012 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00013 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00014 #include "Iguana/Inventor/interface/IgSoG4Trap.h"
00015 #include "Iguana/Inventor/interface/IgSoCube.h"
00016 #include <Inventor/nodes/SoCoordinate3.h>
00017 #include <Inventor/nodes/SoIndexedFaceSet.h>
00018 #include <Inventor/nodes/SoIndexedTriangleStripSet.h>
00019 #include <Inventor/nodes/SoMaterial.h>
00020 #include <Inventor/nodes/SoSeparator.h>
00021 #include <Inventor/nodes/SoTransform.h>
00022 #include <map>
00023 #include <iostream>
00024 
00025 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00026 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00027 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00028 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00029 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00030 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00031 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00032 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00033 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00034 
00035 VisCuTracker::VisCuTracker (void)
00036 {
00037 }
00038 
00039 SoSeparator*
00040 VisCuTracker::buildDet(VisTrackingGeometry::DetectorRep type, TrackerGeometry* pDD, int subDetector)
00041 {
00042     SoSeparator *sep = new SoSeparator;
00043 
00044     SoMaterial *mat = new SoMaterial;
00045     mat->ambientColor.setValue (0.88445997, 0.840042, 0.53582799);
00046     mat->diffuseColor.setValue (0.66334498, 0.630032, 0.401871);
00047     mat->specularColor.setValue (0.49999201, 0.49999201, 0.49999201);
00048     mat->emissiveColor.setValue (0, 0, 0);
00049     mat->shininess = 0.1;
00050     mat->transparency = 0;
00051     sep->addChild (mat);
00052     
00053     for (TrackingGeometry::DetUnitContainer::const_iterator idet = pDD->detUnits().begin();
00054          idet != pDD->detUnits().end(); idet++)
00055     {
00056       VisCuTkModule * mod = VisCuTkModuleMap::moduleMap[(*idet)];
00057       if(mod->isVisible())
00058         {
00059 
00060           if (visible ((*idet)->surface ().position (), type, subDetector))
00061           {
00062 
00063               SoSeparator* separator = new SoSeparator;
00064               VisTrackingGeometry::addWafer (separator, *idet,type);
00065               sep->addChild (separator);
00066               }
00067         }
00068     }
00069     return sep;
00070 }
00071 
00072 bool
00073 VisCuTracker::visible (const GlobalPoint & point, VisTrackingGeometry::DetectorRep type, int subDetector)
00074 {
00075     bool visible = false;
00076     double width = 1.0;
00077     double length = 10.0;
00078     if (subDetector == GeomDetEnumerators::TOB) width = 10.0;
00079     if (subDetector == GeomDetEnumerators::TIB) width = 5.5;
00080     if (subDetector == GeomDetEnumerators::TID) width = 5.0;
00081     if (subDetector == GeomDetEnumerators::TEC) width = 10.0;
00082     if (subDetector == GeomDetEnumerators::CSC) width = 55.0;
00083     
00084     switch (type)
00085     {
00086     case VisTrackingGeometry::FullDet:
00087         visible = true;
00088         break;
00089     case VisTrackingGeometry::RZDet:
00090         visible = true;
00091         //fabs (point.x ()) < width ? visible = true : visible = false;
00092         break;
00093     case VisTrackingGeometry::RPhiDet:
00094         fabs (point.z ()) < length ? visible = true : visible = false;
00095         break;
00096     default:
00097         break;
00098     }
00099 
00100     return visible;
00101 }
00102 
00103 int
00104 VisCuTracker::subDetector (const std::string &key) 
00105 { 
00106     std::map<std::string, GeomDetEnumerators::SubDetector> type; 
00107 
00108     type ["PixelBarrel"] = GeomDetEnumerators::PixelBarrel;
00109     type ["TIB"] = GeomDetEnumerators::TIB;
00110     type ["TOB"] = GeomDetEnumerators::TOB;
00111     type ["PixelEndcap"] = GeomDetEnumerators::PixelEndcap;
00112     type ["TID"] = GeomDetEnumerators::TID;
00113     type ["TEC"] = GeomDetEnumerators::TEC;
00114 
00115     return type [key]; 
00116 }

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