| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DetectorElement.h

Go to the documentation of this file.
00001 // $Id: DetectorElement.h,v 1.39 2008/10/28 12:04:36 cattanem Exp $
00002 #ifndef  DETDESC_DETECTORELEMENT_H
00003 #define  DETDESC_DETECTORELEMENT_H 1
00004 
00005 // Some pragmas to avoid warnings in VisualC
00006 #ifdef WIN32
00007   // Disable warning C4786: identifier was truncated to '255' characters
00008   // in the debug information
00009   #pragma warning ( disable : 4786 )
00010 #endif
00011 
00012 // Include Files
00013 #include <string>
00014 #include <vector>
00015 #include <map>
00016 
00017 #include "GaudiKernel/MsgStream.h"
00018 #include "GaudiKernel/SmartRef.h"
00019 
00020 #include "DetDesc/Condition.h"
00021 #include "DetDesc/Services.h"
00022 #include "DetDesc/ILVolume.h"
00023 #include "DetDesc/ParamValidDataObject.h"
00024 #include "DetDesc/IDetectorElement.h"
00025 #include "DetDesc/CLIDDetectorElement.h"
00026 
00027 
00028 // Forward declarations
00029 class IDataProviderSvc;
00030 class IMessageSvc;
00031 template <class T> class DataObjectFactory;
00032 class IUpdateManagerSvc;
00033 class IRegistry;
00034 
00046 class DetectorElement: public ParamValidDataObject,
00047                        virtual public IDetectorElement {
00048 
00049   friend class DataObjectFactory<DetectorElement> ;
00050 
00051 public:
00053   typedef std::map<std::string,SmartRef<Condition> > ConditionMap;
00054 
00056   DetectorElement (const std::string& name = "NotYetDefined");
00057 
00059   virtual ~DetectorElement();
00060 
00061 public:
00062 
00068   virtual StatusCode initialize();
00069 
00070 public:
00071 
00073   virtual const  CLID& clID()   const  { return classID(); }
00074   static const   CLID& classID()       { return CLID_DetectorElement; }
00075 
00076   virtual const std::string& name () const;
00077 
00079   virtual bool hasCondition(const std::string &name) const;
00080 
00082   virtual SmartRef<Condition> condition(const std::string &name) const;
00083 
00085   inline  ConditionMap::const_iterator conditionBegin() const
00086   { return m_de_conditions.begin(); }
00087 
00089   inline  ConditionMap::const_iterator conditionEnd() const
00090   { return m_de_conditions.end(); }
00091 
00093   inline        IGeometryInfo* geometry();
00094 
00096   inline  const IGeometryInfo* geometry() const;
00097 
00099   bool isInside(const Gaudi::XYZPoint& globalPoint) const;
00100 
00101   const IDetectorElement* childDEWithPoint(const Gaudi::XYZPoint& globalPoint) const;
00102 
00104   inline        IAlignment*    alignment();
00105 
00107   inline  const IAlignment*    alignment() const;
00108 
00109   // delegation for calibration
00110   inline        ICalibration*  calibration();
00111 
00112   // delegation for calibration (const version)
00113   inline  const ICalibration*  calibration() const;
00114 
00115   // delegation for readout
00116   inline        IReadOut*      readOut();
00117 
00118   // delegation for readout (const version)
00119   inline  const IReadOut*      readOut() const ;
00120 
00121   // delegation for slow control
00122   inline        ISlowControl*  slowControl();
00123 
00124   // delegation for slow control (const version)
00125   inline  const ISlowControl*  slowControl() const;
00126 
00127   // delegation for fast control
00128   inline        IFastControl*  fastControl();
00129 
00130   // delegation for fast control (const version)
00131   inline  const IFastControl*  fastControl() const;
00132 
00133   // another way to access: "pseudo-conversion"
00134   // cast to         IGeometryInfo*
00135   inline operator       IGeometryInfo*();
00136 
00137   // cast to   const IGeometryInfo*
00138   inline operator const IGeometryInfo*() const;
00139 
00140   // cast to         IAligment*
00141   inline operator       IAlignment*   ();
00142 
00143   // cast to   const IAlignment*
00144   inline operator const IAlignment*   () const;
00145 
00146   // cast to         ICalibration*
00147   inline operator       ICalibration* ();
00148 
00149   // cast to   const ICalibration*
00150   inline operator const ICalibration* () const;
00151 
00152   // cast to         IReadOut*
00153   inline operator       IReadOut*     ();
00154 
00155   // cast to   const IReadOut*
00156   inline operator const IReadOut*     () const;
00157 
00158   // cast to         ISlowControl*
00159   inline operator       ISlowControl* ();
00160 
00161   // cast to   const ISlowControl*
00162   inline operator const ISlowControl* () const;
00163 
00164   // cast to         IFastControl*
00165   inline operator       IFastControl* ();
00166 
00167   // cast to   const IFastControl*
00168   inline operator const IFastControl* () const;
00169 
00170   // cast to         IGeometryInfo&
00171   // (potentially could throw DetectorElementException)
00172   inline operator       IGeometryInfo&();
00173 
00174   // cast to   const IGeometryInfo&
00175   // (potentially could throw DetectorElementException)
00176   inline operator const IGeometryInfo&() const;
00177 
00178   // cast to         IAlignment&
00179   // (potentially could throw DetectorElementException)
00180   inline operator       IAlignment&   ();
00181 
00182   // cast to   const IAlignment&
00183   // (potentially could throw DetectorElementException)
00184   inline operator const IAlignment&   () const;
00185 
00186   // cast to         ICalibration&
00187   // (potentially could throw DetectorElementException)
00188   inline operator       ICalibration& ()                ;
00189 
00190   // cast to   const ICalibration&
00191   // (potentially could throw DetectorElementException)
00192   inline operator const ICalibration& ()          const ;
00193 
00194   // cast to         IReadOut&
00195   // (potentially could throw DetectorElementException)
00196   inline operator       IReadOut&     ()                ;
00197 
00198   // cast to   const IReadOut&
00199   // (potentially could throw DetectorElementException)
00200   inline operator const IReadOut&     ()          const ;
00201 
00202   // cast to         ISlowControl&
00203   // (potentially could throw DetectorElementException)
00204   inline operator       ISlowControl& ()                ;
00205 
00206   // cast to   const ISlowControl&
00207   // (potentially could throw DetectorElementException)
00208   inline operator const ISlowControl& ()          const ;
00209 
00210   // cast to         IFastControl&
00211   // (potentially could throw DetectorElementException)
00212   inline operator       IFastControl& ()                ;
00213 
00214   // cast to   const IFastControl&
00215   // (potentially could throw DetectorElementException)
00216   inline operator const IFastControl& ()          const ;
00217 
00218   //  printout (overloaded)
00219   // (potentially could throw DetectorElementException)
00220   virtual std::ostream& printOut( std::ostream& ) const;
00221 
00223   IDetectorElement* reset() ;
00224 
00225   virtual MsgStream&    printOut( MsgStream&    ) const;
00226 
00227   // pointer to parent IDetectorElement (const version)
00228   virtual IDetectorElement*  parentIDetectorElement() const;
00229 
00230   // (reference to) container of pointers to child detector elements
00231   virtual IDetectorElement::IDEContainer& childIDetectorElements() const;
00232 
00233   // iterators for manipulation of daughter elements
00234   inline virtual IDetectorElement::IDEContainer::iterator childBegin() {
00235     return childIDetectorElements().begin();
00236   }
00237   inline virtual IDetectorElement::IDEContainer::const_iterator
00238     childBegin() const { return childIDetectorElements().begin() ; }
00239   inline virtual IDetectorElement::IDEContainer::iterator
00240     childEnd  () { return childIDetectorElements().end  () ; }
00241   inline virtual IDetectorElement::IDEContainer::const_iterator
00242     childEnd  () const { return childIDetectorElements().end  () ; }
00243 
00248   virtual const ParamValidDataObject *params() const;
00249 
00255   virtual int sensitiveVolumeID(const Gaudi::XYZPoint& globalPos) const;
00256 
00258   void createCondition(std::string &name, std::string &path);
00259 
00260   //-- N. Gilardi; 2005.07.08 ---------------------------------------------
00262   virtual std::vector<std::string> conditionNames() const;
00263   //-----------------------------------------------------------------------
00264 
00267   // create "ghost"
00268   const IGeometryInfo* createGeometryInfo();
00269 
00270   // create "orphan"
00271   const IGeometryInfo* createGeometryInfo( const std::string& logVol);
00272 
00273   // create "regular"
00274   const IGeometryInfo* createGeometryInfo
00275          (const std::string& logVol,
00276           const std::string& support,
00277           const ILVolume::ReplicaPath & replicaPath );
00278 
00279   const IGeometryInfo* createGeometryInfo
00280          (const std::string& logVol,
00281           const std::string& support,
00282           const ILVolume::ReplicaPath & replicaPath,
00283           const std::string& alignmentPath);
00284 
00285   const IGeometryInfo* createGeometryInfo
00286          (const std::string& logVol,
00287           const std::string& support,
00288           const std::string& namePath);
00289 
00290   const IGeometryInfo* createGeometryInfo
00291          (const std::string& logVol,
00292           const std::string& support,
00293           const std::string& namePath,
00294           const std::string& alignmentPath);
00295 
00296   const IAlignment* createAlignment (const std::string& condition);
00297 
00298   const ICalibration* createCalibration (const std::string& condition);
00299 
00300   const IReadOut* createReadOut (const std::string& condition);
00301 
00302   const ISlowControl* createSlowControl (const std::string& condition);
00303 
00304   const IFastControl* createFastControl (const std::string& condition);
00305 
00306 public:
00307 
00308   // Implementation of IInterface
00309   virtual unsigned long addRef();
00310   virtual unsigned long release();
00311   virtual StatusCode queryInterface( const InterfaceID& riid,
00312                                      void** ppvInterface );
00313 
00314 protected:
00315 
00317   void setGeometry( IGeometryInfo* geoInfo ) { m_de_iGeometry = geoInfo; }
00318 
00319   IDataProviderSvc*  dataSvc () const;
00320   IMessageSvc*       msgSvc  () const;
00321   IUpdateManagerSvc* updMgrSvc() const;
00322 
00323   // technicalities
00324 
00325   inline void Assert
00326   ( bool assertion, const std::string& message =
00327     "DetectorElement Unknown Exception" ) const ;
00328 
00329   inline void Assert
00330   ( bool assertion, const char* message ) const ;
00331 
00332 private:
00333 
00334   // for IDetectorElement implementation
00335   IGeometryInfo*         m_de_iGeometry     ;
00336   IAlignment*            m_de_iAlignment    ;
00337   ICalibration*          m_de_iCalibration  ;
00338   IReadOut*              m_de_iReadOut      ;
00339   ISlowControl*          m_de_iSlowControl  ;
00340   IFastControl*          m_de_iFastControl  ;
00341 
00343   ConditionMap m_de_conditions;
00344 
00345   mutable bool                              m_de_childrensLoaded;
00346   mutable IDetectorElement::IDEContainer    m_de_childrens;
00347 
00349   enum userParamKind { DOUBLE, INT, OTHER };
00350 
00352   DetDesc::Services* m_services;
00353 
00354 };
00355 
00356 // implementation of the inlines functions
00357 #include "DetDesc/DetectorElement.icpp"
00358 
00359 #endif    //    DETDESC_DETECTORELEMENT_H
00360 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:00:13 2011 for DetDesc by doxygen 1.4.7