CMS 3D CMS Logo

VisEventSetupService.h

Go to the documentation of this file.
00001 #ifndef VIS_EVENT_SETUP_VIS_EVENT_SETUP_SERVICE_H
00002 # define VIS_EVENT_SETUP_VIS_EVENT_SETUP_SERVICE_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "VisFramework/VisFrameworkBase/interface/VisEventObserver.h"
00007 # include "VisFramework/VisFrameworkBase/interface/VisPhiDelta.h"
00008 # include "VisFramework/VisFrameworkBase/interface/VisPhiStart.h"
00009 # include "Iguana/Framework/interface/IgStateElement.h"
00010 # include "FWCore/Framework/interface/ESHandle.h"
00011 # include "FWCore/Framework/interface/ESWatcher.h"
00012 # include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
00013 # include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00014 # include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00015 # include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00016 # include "Geometry/DTGeometry/interface/DTGeometry.h"
00017 # include "Geometry/RPCGeometry/interface/RPCGeometry.h"
00018 # include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00019 # include "Geometry/Records/interface/CaloGeometryRecord.h"
00020 # include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00021 # include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00022 # include "DataFormats/GeometryVector/interface/LocalPoint.h"
00023 # include "DataFormats/TrackReco/interface/TrackFwd.h"
00024 # include "MagneticField/Engine/interface/MagneticField.h"
00025 # include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00026 
00027 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00028 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00029 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00030 
00031 class GeomDet;
00032 class DetId;
00033 class SbVec3f;
00034 class SoSeparator;
00035 class TrackingRecHit;
00036 
00037 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00038 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00039 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00040 
00041 class VisEventSetupService : public IgStateElement, public VisEventObserver
00042 {
00043     IG_DECLARE_STATE_ELEMENT (VisEventSetupService);
00044 public:
00045     VisEventSetupService (IgState *state);
00046     ~VisEventSetupService (void);
00047     // implicit copy constructor
00048     // implicit assignment operator
00049     // implicit destructor
00050     virtual void        onNewEvent (const edm::Event &event,
00051                                     const edm::EventSetup &eventSetup);
00052 
00053     enum DetectorRep { FullDet, RZDet, RPhiDet };
00054 
00055     const GlobalPoint   toGlobal (const LocalPoint point, const DetId detId);
00056     const GlobalPoint   globalPosition (const TrackingRecHit * rechit);
00057     const LocalPoint    localPosition (const TrackingRecHit * rechit);
00058     const GeomDet*      idToDet (const DetId det);
00059     
00060     float               phi4eta (float eta) const;
00061     unsigned int        getBinNumber (const DetId detId,
00062                                       const unsigned numR, 
00063                                       const unsigned numZ, 
00064                                       const float radiusR,
00065                                       const float radiusZ,
00066                                       const float barrelMaxEta = 0.f, 
00067                                       const float beamPipeTheta = 0.f, 
00068                                       const float endcapMaxTheta = 0.f) const;
00069     unsigned int        getBinNumber (const float eta, const float phi,
00070                                       const unsigned numR, 
00071                                       const unsigned numZ, 
00072                                       const float radiusR,
00073                                       const float radiusZ,
00074                                       const float barrelMaxEta = 0.f, 
00075                                       const float beamPipeTheta = 0.f, 
00076                                       const float endcapMaxTheta = 0.f) const;
00077     float               etaToTheta (float eta) const;
00078     float               thetaToEta (float theta) const;
00079     bool                present (const DetId detId) const;
00080     bool                emptyCorners (const DetId detId) const;
00081     const CaloCellGeometry::CornersVec& getCorners (const DetId detId) const;
00082     const GlobalPoint&  getCellPosition (const DetId detId) const;
00083 
00084     const std::string   cscTextRep (int chamber, int ring, int station, int endcap);
00085     const std::string   dtTextRep (int station, int sector, int wheel);
00086     const std::string   rpcTextRep (int region, int wheel, int sector, int station);
00087     const std::string   trackerTextRep (const std::string name);
00088     const std::string   caloTextRep (const std::string name, const int subdetn);
00089 
00090     SoSeparator*        buildCSCChambers (DetectorRep type, int chamber, int ring, int station, int endcap);
00091     SoSeparator*        buildDTChambers (DetectorRep type, int station, int sector, int wheel);
00092     SoSeparator*        buildRPCChambers (DetectorRep type, int region, int wheel, int sector, int station);
00093     SoSeparator*        buildTracker (DetectorRep type, const std::string name);
00094     SoSeparator*        buildDet (DetectorRep type, std::vector<const GeomDetUnit*> &dets);
00095     SoSeparator*        buildCaloDet (DetectorRep type, const std::string detId, const int subdetn);
00096     SoSeparator*        buildLegoDet (const double scale);   
00097     SoSeparator*        buildHitDets (DetectorRep type, std::vector<DetId> &dets);   
00098 
00099     SoSeparator*        annotateCSCChambers (DetectorRep type, int chamber, int ring, int station, int endcap);
00100     SoSeparator*        annotateDTChambers (DetectorRep type, int station, int sector, int wheel);
00101     SoSeparator*        annotateRPCChambers (DetectorRep type, int region, int wheel, int sector, int station);
00102     SoSeparator*        annotateTracker (DetectorRep type, const std::string name);
00103     SoSeparator*        annotateCaloDet (DetectorRep type, const std::string detId, int subdetn);
00104     
00105     const std::string   trackerModuleName (DetId detId);
00106     void                addMaterial (SoSeparator *separator, DetectorRep type);
00107     
00108     SoSeparator*        refitTrack (reco::TrackRef track, double in, double out, double step);
00109     void                localPositions (const TrackingRecHit *rechit, std::vector<LocalPoint> &points);
00110 
00111     bool                globalTrackingGeomChanged (void) { return m_globalTrackingGeomCanged; }
00112     bool                trackerGeomChanged (void) { return m_trackerGeomCanged; }
00113     bool                caloGeomChanged (void) { return m_caloGeomCanged; }    
00114     bool                muonGeomChanged (void) { return m_muonGeomCanged; } 
00115     bool                fieldChanged (void) { return m_fieldGeomCanged; }
00116         
00117 private:
00118     bool                visible (const GlobalPoint & point, DetectorRep type, int subDetector);
00119     void                addDescription (SoSeparator *separator, const GeomDet *det, const std::string label);
00120     void                addWafer (SoSeparator *separator, const GeomDet *det, DetectorRep type);
00121     void                addBoxWafer (SoSeparator *separator, const GeomDet *det);
00122     void                createRotation (const GeomDet *det, SbVec3f & axis, float & angle);
00123     int                 subDetector (const std::string &key);
00124     DetId::Detector     detectorId (const std::string &key);
00125     void                invalidate (void) {};
00126     
00127     IgState            *m_state;
00128     int                 m_run;
00129     int                 m_event;
00130     int                 m_ls;
00131     int                 m_orbit;
00132     int                 m_bx;
00133     VisPhiDelta         m_phiDelta;
00134     VisPhiStart         m_phiStart;    
00135 
00136     bool        m_globalTrackingGeomCanged;
00137     bool        m_trackerGeomCanged;
00138     bool        m_caloGeomCanged;
00139     bool        m_muonGeomCanged;
00140     bool        m_fieldGeomCanged;
00141 
00142     edm::ESHandle<GlobalTrackingGeometry> m_globalTrackingGeom;
00143     edm::ESHandle<TrackerGeometry>        m_trackerGeom;
00144     edm::ESHandle<CaloGeometry>           m_caloGeom;
00145     edm::ESHandle<CSCGeometry>            m_cscGeom;
00146     edm::ESHandle<DTGeometry>             m_dtGeom;
00147     edm::ESHandle<RPCGeometry>            m_rpcGeom;
00148     edm::ESHandle<MagneticField>          m_field;
00149 
00150     edm::ESWatcher<GlobalTrackingGeometryRecord> m_watch_globalTrackingGeom;
00151     edm::ESWatcher<TrackerDigiGeometryRecord> m_watch_trackerGeom;
00152     edm::ESWatcher<CaloGeometryRecord> m_watch_caloGeom;
00153     edm::ESWatcher<MuonGeometryRecord> m_watch_muonGeom;
00154     edm::ESWatcher<IdealMagneticFieldRecord> m_watch_field;
00155 };
00156 
00157 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00158 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00159 
00160 #endif // VIS_EVENT_SETUP_VIS_EVENT_SETUP_SERVICE_H

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