LCOV - code coverage report
Current view: top level - FMD/FMDbase - AliFMDGeometry.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 19 21 90.5 %
Date: 2016-06-14 17:26:59 Functions: 20 27 74.1 %

          Line data    Source code
       1             : #ifndef ALIFMDGEOMETRY_H
       2             : #define ALIFMDGEOMETRY_H
       3             : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
       4             :  * reserved. 
       5             :  *
       6             :  * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
       7             :  *
       8             :  * See cxx source for full Copyright notice                               
       9             :  */
      10             : /** @file    AliFMDGeometry.h
      11             :     @author  Christian Holm Christensen <cholm@nbi.dk>
      12             :     @date    Mon Mar 27 12:40:37 2006
      13             :     @brief   Geometry mananger for the FMD
      14             : */
      15             : //____________________________________________________________________
      16             : //                                                                          
      17             : // Forward Multiplicity Detector based on Silicon wafers. 
      18             : //
      19             : // This class is a singleton that handles the geometry parameters of
      20             : // the FMD detectors.  
      21             : // The actual code is done by various separate classes.
      22             : //                                                       
      23             : #ifndef ALIGEOMETRY_H
      24             : # include <AliGeometry.h>
      25             : #endif
      26             : #ifndef ROOT_TArrayI
      27             : # include <TArrayI.h>
      28             : #endif
      29             : #ifndef ROOT_TMatrixFfwd
      30             : # include <TMatrixFfwd.h>
      31             : #endif
      32             : class TVector3;
      33             : class TParticle;
      34             : class AliRecPoint;
      35             : class AliFMDRing;
      36             : class AliFMDDetector;
      37             : class AliFMD1;
      38             : class AliFMD2;
      39             : class AliFMD3;
      40             : class AliFMDGeometryBuilder;
      41             : 
      42             : 
      43             : //__________________________________________________________________
      44             : /** @brief Singleton object of FMD geometry descriptions and parameters.
      45             :     This class is a singleton that handles the geometry parameters of
      46             :     the FMD detectors.  
      47             :                                                           
      48             :     The actual code is done by various separate classes.   Below is
      49             :     diagram showing the relationship between the various FMD classes
      50             :     that handles the geometry 
      51             :     @verbatim
      52             :                                   +------------+ 
      53             :                                +- | AliFMDRing |
      54             :                            2   |  +------------+
      55             :          +----------------+<>--+        |                         
      56             :          | AliFMDGeometry |             ^                               
      57             :          +----------------+<>--+        V 1..2                            
      58             :                            3   | +----------------+             
      59             :                                +-| AliFMDDetector |             
      60             :                                  +----------------+             
      61             :                                         ^
      62             :                                         |
      63             :                           +-------------+-------------+
      64             :                           |             |             |       
      65             :                      +---------+   +---------+   +---------+
      66             :                      | AliFMD1 |   | AliFMD2 |   | AliFMD3 |
      67             :                      +---------+   +---------+   +---------+
      68             :          
      69             :     @endverbatim
      70             :     -  AliFMDRing 
      71             :        This class contains all stuff needed to do with a ring.  It's
      72             :        used by the AliFMDDetector objects to instantise inner and
      73             :        outer rings.  The AliFMDRing objects are shared by the
      74             :        AliFMDDetector objects, and owned by the AliFMDv1 object. 
      75             :     -  AliFMD1, AliFMD2, and AliFMD3 
      76             :        These are specialisation of AliFMDDetector, that contains the
      77             :        particularities of each of the sub-detector system.  It is
      78             :        envisioned that the classes should also define the support
      79             :        volumes and material for each of the detectors.
      80             : 
      81             :     @ingroup FMD_base
      82             :  */
      83             : class AliFMDGeometry : public AliGeometry
      84             : {
      85             : public:
      86             :   /** 
      87             :    * singleton access 
      88             :    *
      89             :    * @return Singleton 
      90             :    */
      91             :   static AliFMDGeometry* Instance();
      92             :   /** 
      93             :    * Initialize the the singleton if not done so already 
      94             :    */
      95             :   virtual void Init();
      96             :   /** 
      97             :    * Find all local <-> global transforms 
      98             :    */
      99             :   virtual void InitTransformations(Bool_t force=kFALSE);
     100             :   /** 
     101             :    * @return Get inner description 
     102             :    */
     103           2 :   AliFMDRing*     GetInner() const { return fInner; }
     104             :   /** 
     105             :    * @return Get outer description 
     106             :    */
     107           2 :   AliFMDRing*     GetOuter() const { return fOuter; }
     108             :   /** 
     109             :    * @return Get FMD1 description 
     110             :    */
     111           4 :   AliFMD1*        GetFMD1()  const { return (fUseFMD1 ? fFMD1 : 0); }
     112             :   /** 
     113             :    * @return Get FMD2 description 
     114             :    */
     115           4 :   AliFMD2*        GetFMD2()  const { return (fUseFMD2 ? fFMD2 : 0); }
     116             :   /** 
     117             :    * @return Get FMD3 description 
     118             :    */
     119           4 :   AliFMD3*        GetFMD3()  const { return (fUseFMD3 ? fFMD3 : 0); }
     120             :   /** 
     121             :    * Get description of a sub-detector
     122             :    * 
     123             :    * @param i Sub-detector #
     124             :    * @return Description of sub-detector, or 0 
     125             :    */
     126             :   AliFMDDetector* GetDetector(Int_t i) const;
     127             :   /** 
     128             :    * Get description of a ring, i should be one of 'I' or 'O' (case
     129             :    * insensitive).  If an invalid parameter is passed, 0 (NULL) is
     130             :    * returned.
     131             :    *
     132             :    * @param i Ring id
     133             :    * @return Description of ring, or 0 
     134             :    */
     135             :   AliFMDRing*     GetRing(Char_t i) const;
     136             :   /** 
     137             :    * Disable the ith detector
     138             :    *
     139             :    * @param i IF true, disable sub-detector @a i 
     140             :    */
     141             :   void            Disable(Int_t i);
     142             :   /** 
     143             :    * Enable the ith detector
     144             :    *
     145             :    * @param i IF true, enable sub-detector @a i 
     146             :    */
     147             :   void            Enable(Int_t i);
     148             :   /** 
     149             :    * @return Density @f$ \rho@f$ of silicon 
     150             :    */
     151           8 :   Double_t        GetSiDensity() const { return 2.33; }
     152             :   /** 
     153             :    * Translate detector coordinates (detector, ring, sector, strip)
     154             :    * to spatial coordinates (x, y, z) in the master reference frame
     155             :    * of ALICE.  The member function uses the transformations
     156             :    * previously obtained from the TGeoManager.
     157             :    *
     158             :    * @param detector Detector number
     159             :    * @param ring     Ring id
     160             :    * @param sector   Sector number
     161             :    * @param strip    Strip number
     162             :    * @param x        On return, X coordinate 
     163             :    * @param y        On return, Y coordinate 
     164             :    * @param z        On return, Z coordinate  
     165             :    */
     166             :   void            Detector2XYZ(UShort_t detector, Char_t ring, 
     167             :                                UShort_t sector, UShort_t strip, 
     168             :                                Double_t& x, Double_t& y, Double_t& z) const;
     169             :   /** 
     170             :    * Translate spatial coordinates (x,y,z) in the master reference
     171             :    * frame of ALICE to the detector coordinates (detector, ring,
     172             :    * sector, strip).  Note, that if this method is to be used in
     173             :    * reconstruction or the like, then the input z-coordinate should
     174             :    *  be corrected for the events interactions points z-coordinate,
     175             :    * like  
     176             :    * @code 
     177             :    * geom->XYZ2Detector(x,y,z-ipz,d,r,s,t);
     178             :    * @endcode
     179             :    *
     180             :    * @param x        X coordinate
     181             :    * @param y         Y coordinate
     182             :    * @param z         Z coordinate
     183             :    * @param detector On return, Detector number
     184             :    * @param ring     On return, Ring id            
     185             :    * @param sector   On return, Sector number      
     186             :    * @param strip    On return, Strip number       
     187             :    * @return @c  false of (@a x, @a y, @a z) is not within this
     188             :    * detector.  
     189             :    */
     190             :   Bool_t          XYZ2Detector(Double_t x, Double_t y, Double_t z, 
     191             :                                UShort_t& detector, Char_t& ring, 
     192             :                                UShort_t& sector, UShort_t& strip) const;
     193             :   /** 
     194             :    * Make the geometry.  This delegates to AliFMDGeometryBuilder 
     195             :    */
     196             :   void   Build();
     197             :   /** 
     198             :    * @return Get detector offset in paths 
     199             :    */
     200         676 :   Int_t  GetDetectorOff() const    { return fDetectorOff; }
     201             :   /**
     202             :    * @return Get sensor offset in paths 
     203             :    */
     204        1352 :   Int_t  GetModuleOff() const      { return fModuleOff;   }
     205             :   /** 
     206             :    * @return Get ring offset in paths 
     207             :    */
     208         676 :   Int_t  GetRingOff() const        { return fRingOff;     }
     209             :   /** 
     210             :    * @return Get ring sector in paths 
     211             :    */
     212         676 :   Int_t  GetSectorOff() const      { return fSectorOff;   }
     213             :   /** 
     214             :    * @param off Detector off-set set in geometry path 
     215             :    */
     216           2 :   void   SetDetectorOff(Int_t off) { fDetectorOff = off; }
     217             :   /** 
     218             :    * @param off Module off-set set in geometry path 
     219             :    */
     220           2 :   void   SetModuleOff(Int_t off)   { fModuleOff   = off; }
     221             :   /** 
     222             :    * @param off Ring off-set set in geometry path 
     223             :    */
     224           2 :   void   SetRingOff(Int_t off)     { fRingOff     = off; }
     225             :   /** 
     226             :    * @param off Sectord off-set set in geometry path 
     227             :    */
     228           2 :   void   SetSectorOff(Int_t off)   { fSectorOff   = off; }
     229             :   /** 
     230             :    * Check if volume @a vol is marked as active 
     231             :    *
     232             :    * @param vol Volume ID
     233             :    * @return  @c true if @a vol is declared active 
     234             :    */
     235             :   Bool_t IsActive(Int_t vol) const;
     236             :   /** 
     237             :    * Set active volumes 
     238             :    *
     239             :    * @param active Active volume id array 
     240             :    * @param n elements of @a active 
     241             :    */
     242             :   void   SetActive(Int_t* active, Int_t n);
     243             :   /** 
     244             :    * Add an active volume 
     245             :    *
     246             :    * @param id Register volume @a id to be active 
     247             :    */
     248             :   void   AddActive(Int_t id);
     249             :   /** 
     250             :    * Get Array of active volume numbers 
     251             :    *
     252             :    * @return constant reference to active volume numbers 
     253             :    */ 
     254           2 :   const TArrayI& ActiveIds() const { return fActive; }
     255             :   /** 
     256             :    * Set an external geometry builder
     257             :    *
     258             :    * @param b Geometry builder 
     259             :    */
     260           0 :   void   SetBuilder(AliFMDGeometryBuilder* b) { fBuilder = b; }
     261             :   /** 
     262             :    * Check the volume depth of some nodes, get the active volume
     263             :    * numbers, and so forth.
     264             :    * 
     265             :    * @todo Here, we should actually also get the parameters of the
     266             :    * shapes, like the verticies of the polygon shape that makes up the
     267             :    * silicon sensor, the strip pitch, the ring radii, the z-positions,
     268             :    * and so on - that is, all the geometric information we need for
     269             :    * futher processing, such as simulation, digitization,
     270             :    * reconstruction, etc.
     271             :   */
     272             :   void   ExtractGeomInfo();
     273             :   /** 
     274             :    * Whether we are to use a detailed geometry or not
     275             :    * 
     276             :    * @param det if @c true, make a detailed geometry. 
     277             :    */
     278           1 :   void   SetDetailed(Bool_t det) { fDetailed = det; }
     279             :   /** 
     280             :    * @return @c true if geometry is detailed 
     281             :    */
     282         676 :   Bool_t IsDetailed() const { return fDetailed; }
     283             :   /** 
     284             :    * @param ass Whether to use assemblies or not 
     285             :    */
     286           1 :   void   UseAssembly(Bool_t ass)  { fUseAssembly = ass; }
     287             : 
     288             :   // AliGeometry member functions 
     289             :   /** 
     290             :    * Get global coordinates cooresponding to a rec point. 
     291             :    * 
     292             :    * @param p   Reconstructed point.
     293             :    * @param pos On return, the position
     294             :    * @param mat On return, the material at @a post 
     295             :    */
     296             :   virtual void GetGlobal(const AliRecPoint* p, TVector3& pos, 
     297             :                          TMatrixF& mat) const;
     298             :   /** 
     299             :    * Get global coordinates cooresponding to a rec point. 
     300             :    *
     301             :    * @param p   Reconstructed point.
     302             :    * @param pos On return, the position 
     303             :    */
     304             :   virtual void GetGlobal(const AliRecPoint* p, TVector3& pos) const;
     305             :   /** 
     306             :    * Check if particle will hit an active detector element.  
     307             :    * 
     308             :    * @todo implement this function 
     309             :    *
     310             :    * @param particle Track 
     311             :    * @return @c true if @a particle will hit this detector 
     312             :    */
     313             :   virtual Bool_t Impact(const TParticle* particle) const;
     314             :   /** 
     315             :    * Declare alignable volumes 
     316             :    */
     317             :   virtual void SetAlignableVolumes() const;
     318             : 
     319             : 
     320             :   /** 
     321             :    * Service function to convert Cartisean XYZ to r, eta, phi, and theta.   
     322             :    *
     323             :    * Note, that the z input should be corrected for the vertex location 
     324             :    * if needed.
     325             :    * 
     326             :    * @param x      Cartisean X coordinate
     327             :    * @param y      Cartisean Y coordinate 
     328             :    * @param z      Cartisean Z coordinate 
     329             :    * @param r      On return, the radius
     330             :    * @param eta    On return, the pseudo-rapidity
     331             :    * @param phi    On return, the azimuthal angle
     332             :    * @param theta  On return, the polar angle;
     333             :    *
     334             :    * @return kTRUE on success, kFALSE in case of problems
     335             :    */     
     336             :   static Bool_t XYZ2REtaPhiTheta(Double_t  x,   Double_t y, 
     337             :                                  Double_t  z, 
     338             :                                  Double_t& r,   Double_t& eta, 
     339             :                                  Double_t& phi, Double_t& theta);
     340             : 
     341             : protected:
     342             :   Bool_t        fIsInitialized; // Whether singleton is initalized
     343             :   AliFMDRing*   fInner;         // Inner ring geometry information
     344             :   AliFMDRing*   fOuter;         // Outer ring geometry information
     345             :   AliFMD1*      fFMD1;          // FMD1 geometry information
     346             :   AliFMD2*      fFMD2;          // FMD2 geometry information
     347             :   AliFMD3*      fFMD3;          // FMD3 geometry information
     348             :   Bool_t        fUseFMD1;       // Wheter to Use FMD1 or not
     349             :   Bool_t        fUseFMD2;       // Wheter to Use FMD2 or not
     350             :   Bool_t        fUseFMD3;       // Wheter to Use FMD3 or not
     351             :   Bool_t        fIsInitTrans;   // Transforms initialised?
     352             :   static AliFMDGeometry* fgInstance; // Singleton instance 
     353             :   /** 
     354             :    * CTOR 
     355             :    */
     356             :   AliFMDGeometry();
     357             :   /** 
     358             :    * CTOR 
     359             :    *
     360             :    * @param name Not used
     361             :    */
     362             :   AliFMDGeometry(const char* name);
     363             :   /** 
     364             :    * Copy CTOR
     365             :    * 
     366             :    * @param other To copy from  
     367             :    */
     368             :   AliFMDGeometry(const AliFMDGeometry& other);
     369             :   /** 
     370             :    * Assignment operator 
     371             :    * 
     372             :    * @param other To assig from
     373             :    * @return reference to this.  
     374             :    */
     375             :   AliFMDGeometry& operator=(const AliFMDGeometry& other);
     376             :   /** 
     377             :    * Destructor 
     378             :    */
     379           0 :   virtual ~AliFMDGeometry() {}
     380             :   
     381             :   AliFMDGeometryBuilder* fBuilder; // Geometry builder 
     382             :   Int_t fDetectorOff;              // Detector off-set 
     383             :   Int_t fModuleOff;                // Module off-set 
     384             :   Int_t fRingOff;                  // ring offset
     385             :   Int_t fSectorOff;                // Sector offset    
     386             :   TArrayI fActive;                 // Active volumes
     387             :   Bool_t fDetailed;                // Whether to make detailed geom
     388             :   Bool_t fUseAssembly;             // Whther to use assemblies 
     389             : 
     390          24 :   ClassDef(AliFMDGeometry,1); // Geometry parameters and manager 
     391             : };
     392             : 
     393             : 
     394             : #endif
     395             : //____________________________________________________________________
     396             : //
     397             : // Local Variables:
     398             : //   mode: C++
     399             : // End:
     400             : //
     401             : // EOF
     402             : //

Generated by: LCOV version 1.11