ROOT logo
#ifndef ALIFMDDETECTOR_H
#define ALIFMDDETECTOR_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
 * reserved. 
 *
 * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
 *
 * See cxx source for full Copyright notice                               
 */
//__________________________________________________________________
//
// Utility class to help implement the FMD geometry.  This provides
// the interface for the concrete geometry implementations of the FMD
// sub-detectors. 
/** @file    AliFMDDetector.h
    @author  Christian Holm Christensen <cholm@nbi.dk>
    @date    Mon Mar 27 12:36:27 2006
    @brief   Sub-detector base class declaration
    @ingroup FMD_base
*/
#ifndef ROOT_TNamed
# include <TNamed.h>
#endif
class AliFMDRing;
class TGeoMatrix;

/** @defgroup FMD_base Basic classes */
//__________________________________________________________________
/** @brief Base class for the geometry description and parameters of
    the FMD sub detectors FMD1, FMD2, and FMD3.

    This class hold common parameters of the specific FMD detectors.
    @ingroup FMD_base
*/
class AliFMDDetector : public TNamed 
{
public:
  /** Constructor
      @param id    Detector number
      @param inner Pointer to inner ring geometry
      @param outer Pointer to inner outer geometry
      @return  */
  AliFMDDetector(Int_t id, AliFMDRing* inner, AliFMDRing* outer);
  /** Copy CTOR 
      @param other Object to copy from. */
  AliFMDDetector(const AliFMDDetector& other);
  /** Assignment operator 
      @param other Object to assign from
      @return reference to this object  */
  AliFMDDetector& operator=(const AliFMDDetector& other);
  virtual ~AliFMDDetector() {}
  /** Initialize the geometry */
  virtual void Init();
  /** Find the transformations that correspond to modules of this
      detector, and store them in the arrays. */
  virtual void InitTransformations();
  
  /** @param x Detector number */
  void SetId(Int_t x) { fId = x; }
  /** @param x Position of outer ring along z */
  void SetInnerZ(Double_t x) { fInnerZ = x; }
  /** @param x Position of outer ring along z */
  void SetOuterZ(Double_t x) { fOuterZ = x; }
  /** @param x Inner radius of inner honeycomb */
  void SetInnerHoneyLowR(Double_t x) { fInnerHoneyLowR = x; }
  /** @param x Outer radius of inner honeycomb */
  void SetInnerHoneyHighR(Double_t x) { fInnerHoneyHighR = x; }
  /** @param x Inner radius of outer honeycomb */
  void SetOuterHoneyLowR(Double_t x) { fOuterHoneyLowR = x; }
  /** @param x Outer radius of outer honeycomb */
  void SetOuterHoneyHighR(Double_t x) { fOuterHoneyHighR = x; }
    
  /** @return Detector number */
  Int_t GetId() const { return fId; }
  /** @return Position of outer ring along z */
  Double_t GetInnerZ() const { return fInnerZ; }
  /** @return Position of outer ring along z */
  Double_t GetOuterZ() const { return fOuterZ; }
  /** @return Inner radius of inner honeycomb */
  Double_t GetInnerHoneyLowR() const { return fInnerHoneyLowR; }
  /** @return Outer radius of inner honeycomb */
  Double_t GetInnerHoneyHighR() const { return fInnerHoneyHighR; }
  /** @return Inner radius of outer honeycomb */
  Double_t GetOuterHoneyLowR() const { return fOuterHoneyLowR; }
  /** @return Outer radius of outer honeycomb */
  Double_t GetOuterHoneyHighR() const { return fOuterHoneyHighR; }
    
  /** @return Inner ring information */
  AliFMDRing* GetInner() const { return fInner; }
  /** @return Outer ring information */
  AliFMDRing* GetOuter() const { return fOuter; }
  /** @param id Id of ring to get 
      @return Pointer to ring, 0 on failure */
  AliFMDRing* GetRing(Char_t id) const;
  /** @param id Id of ring to get 
      @return Z position of ring or 0 on failure */
  Double_t GetRingZ(Char_t id) const;
  
  /** Translate detector coordinates (detector, ring, sector, strip)
      to spatial coordinates (x, y, z) in the master reference frame
      of ALICE.  The member function uses the transformations
      previously obtained from the TGeoManager.
      @param ring   Ring id
      @param sector Sector number
      @param strip  Strip number
      @param x      On return, X coordinate 
      @param y      On return, Y coordinate 
      @param z      On return, Z coordinate  */
  void Detector2XYZ(Char_t ring, UShort_t sector, UShort_t strip, 
		    Double_t& x, Double_t& y, Double_t& z) const;
  /** Translate spatial coordinates (x,y,z) in the master reference
      frame of ALICE to the detector coordinates (detector, ring,
      sector, strip).  Note, that if this method is to be used in
      reconstruction or the like, then the input z-coordinate should
      be corrected for the events interactions points z-coordinate,
      like  
      @code 
      geom->XYZ2Detector(x,y,z-ipz,d,r,s,t);
      @endcode
      @param x       X coordinate
      @param y 	     Y coordinate
      @param z 	     Z coordinate
      @param ring    On return, Ring id		   
      @param sector  On return, Sector number	   
      @param strip   On return, Strip number	   
      @return @c  false of (@a x, @a y, @a z) is not within this
      detector.  */
  Bool_t XYZ2Detector(Double_t x, Double_t y, Double_t z, 
		      Char_t& ring, UShort_t& sector, UShort_t& strip) const;

  /** Declare alignable volumes */
  virtual void SetAlignableVolumes() const;
   /** Get transformation matrix for a sector in a ring 
      @param ring   Ring id
      @param sector Sector numberr 
      @return Matrix on success, 0 otherwise */
  TGeoMatrix*   FindTransform(Char_t ring, UShort_t sector) const;
protected:
  /** Check if we have all transformations for a ring 
      @param ring Ring to check for 
      @return @c true if we got all transforms  */
  Bool_t        HasAllTransforms(Char_t ring) const;
 
  Int_t		fId;			// Detector number
  Double_t	fInnerZ;		// Position of outer ring along z
  Double_t	fOuterZ;		// Position of outer ring along z
  Double_t	fInnerHoneyLowR;	// Inner radius of inner honeycomb
  Double_t	fInnerHoneyHighR;	// Outer radius of inner honeycomb
  Double_t	fOuterHoneyLowR;	// Inner radius of outer honeycomb
  Double_t	fOuterHoneyHighR;	// Outer radius of outer honeycomb
  AliFMDRing*	fInner;			// Pointer to inner ring information
  AliFMDRing*	fOuter;			// Pointer to outer ring information
  TObjArray*    fInnerTransforms;       // List of inner module global
  TObjArray*    fOuterTransforms;       // List of outer module global

  ClassDef(AliFMDDetector, 2); // 
};

#endif
//____________________________________________________________________
//
// Local Variables:
//   mode: C++
// End:
//
// EOF
//
 AliFMDDetector.h:1
 AliFMDDetector.h:2
 AliFMDDetector.h:3
 AliFMDDetector.h:4
 AliFMDDetector.h:5
 AliFMDDetector.h:6
 AliFMDDetector.h:7
 AliFMDDetector.h:8
 AliFMDDetector.h:9
 AliFMDDetector.h:10
 AliFMDDetector.h:11
 AliFMDDetector.h:12
 AliFMDDetector.h:13
 AliFMDDetector.h:14
 AliFMDDetector.h:15
 AliFMDDetector.h:16
 AliFMDDetector.h:17
 AliFMDDetector.h:18
 AliFMDDetector.h:19
 AliFMDDetector.h:20
 AliFMDDetector.h:21
 AliFMDDetector.h:22
 AliFMDDetector.h:23
 AliFMDDetector.h:24
 AliFMDDetector.h:25
 AliFMDDetector.h:26
 AliFMDDetector.h:27
 AliFMDDetector.h:28
 AliFMDDetector.h:29
 AliFMDDetector.h:30
 AliFMDDetector.h:31
 AliFMDDetector.h:32
 AliFMDDetector.h:33
 AliFMDDetector.h:34
 AliFMDDetector.h:35
 AliFMDDetector.h:36
 AliFMDDetector.h:37
 AliFMDDetector.h:38
 AliFMDDetector.h:39
 AliFMDDetector.h:40
 AliFMDDetector.h:41
 AliFMDDetector.h:42
 AliFMDDetector.h:43
 AliFMDDetector.h:44
 AliFMDDetector.h:45
 AliFMDDetector.h:46
 AliFMDDetector.h:47
 AliFMDDetector.h:48
 AliFMDDetector.h:49
 AliFMDDetector.h:50
 AliFMDDetector.h:51
 AliFMDDetector.h:52
 AliFMDDetector.h:53
 AliFMDDetector.h:54
 AliFMDDetector.h:55
 AliFMDDetector.h:56
 AliFMDDetector.h:57
 AliFMDDetector.h:58
 AliFMDDetector.h:59
 AliFMDDetector.h:60
 AliFMDDetector.h:61
 AliFMDDetector.h:62
 AliFMDDetector.h:63
 AliFMDDetector.h:64
 AliFMDDetector.h:65
 AliFMDDetector.h:66
 AliFMDDetector.h:67
 AliFMDDetector.h:68
 AliFMDDetector.h:69
 AliFMDDetector.h:70
 AliFMDDetector.h:71
 AliFMDDetector.h:72
 AliFMDDetector.h:73
 AliFMDDetector.h:74
 AliFMDDetector.h:75
 AliFMDDetector.h:76
 AliFMDDetector.h:77
 AliFMDDetector.h:78
 AliFMDDetector.h:79
 AliFMDDetector.h:80
 AliFMDDetector.h:81
 AliFMDDetector.h:82
 AliFMDDetector.h:83
 AliFMDDetector.h:84
 AliFMDDetector.h:85
 AliFMDDetector.h:86
 AliFMDDetector.h:87
 AliFMDDetector.h:88
 AliFMDDetector.h:89
 AliFMDDetector.h:90
 AliFMDDetector.h:91
 AliFMDDetector.h:92
 AliFMDDetector.h:93
 AliFMDDetector.h:94
 AliFMDDetector.h:95
 AliFMDDetector.h:96
 AliFMDDetector.h:97
 AliFMDDetector.h:98
 AliFMDDetector.h:99
 AliFMDDetector.h:100
 AliFMDDetector.h:101
 AliFMDDetector.h:102
 AliFMDDetector.h:103
 AliFMDDetector.h:104
 AliFMDDetector.h:105
 AliFMDDetector.h:106
 AliFMDDetector.h:107
 AliFMDDetector.h:108
 AliFMDDetector.h:109
 AliFMDDetector.h:110
 AliFMDDetector.h:111
 AliFMDDetector.h:112
 AliFMDDetector.h:113
 AliFMDDetector.h:114
 AliFMDDetector.h:115
 AliFMDDetector.h:116
 AliFMDDetector.h:117
 AliFMDDetector.h:118
 AliFMDDetector.h:119
 AliFMDDetector.h:120
 AliFMDDetector.h:121
 AliFMDDetector.h:122
 AliFMDDetector.h:123
 AliFMDDetector.h:124
 AliFMDDetector.h:125
 AliFMDDetector.h:126
 AliFMDDetector.h:127
 AliFMDDetector.h:128
 AliFMDDetector.h:129
 AliFMDDetector.h:130
 AliFMDDetector.h:131
 AliFMDDetector.h:132
 AliFMDDetector.h:133
 AliFMDDetector.h:134
 AliFMDDetector.h:135
 AliFMDDetector.h:136
 AliFMDDetector.h:137
 AliFMDDetector.h:138
 AliFMDDetector.h:139
 AliFMDDetector.h:140
 AliFMDDetector.h:141
 AliFMDDetector.h:142
 AliFMDDetector.h:143
 AliFMDDetector.h:144
 AliFMDDetector.h:145
 AliFMDDetector.h:146
 AliFMDDetector.h:147
 AliFMDDetector.h:148
 AliFMDDetector.h:149
 AliFMDDetector.h:150
 AliFMDDetector.h:151
 AliFMDDetector.h:152
 AliFMDDetector.h:153
 AliFMDDetector.h:154
 AliFMDDetector.h:155
 AliFMDDetector.h:156
 AliFMDDetector.h:157
 AliFMDDetector.h:158
 AliFMDDetector.h:159
 AliFMDDetector.h:160
 AliFMDDetector.h:161
 AliFMDDetector.h:162
 AliFMDDetector.h:163
 AliFMDDetector.h:164
 AliFMDDetector.h:165
 AliFMDDetector.h:166
 AliFMDDetector.h:167