ROOT logo
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

// $Id$

/// \ingroup geometry
/// \class AliMUONGeometryEnvelopeStore
/// \brief Store for temporary volumes envelopes
///
/// Class for definititon of the temporary volume envelopes
/// used in geometry construction
///
/// \author Ivana Hrivnacova, IPN Orsay

#ifndef ALI_MUON_GEOMETRY_ENVELOPE_STORE_H
#define ALI_MUON_GEOMETRY_ENVELOPE_STORE_H

#include <TObject.h>
#include <TGeoMatrix.h>

class TGeoTranslation;
class TGeoRotation;
class TGeoCombiTrans;
class TObjArray;
class TArrayI;
class TString;

class AliMUONChamber;
class AliMUONGeometryEnvelope;
class AliMpExMap;

class AliMUONGeometryEnvelopeStore : public TObject
{
  public:
    AliMUONGeometryEnvelopeStore(AliMpExMap* detElements);
    AliMUONGeometryEnvelopeStore();
    virtual ~AliMUONGeometryEnvelopeStore();

    // methods
        
          // adding virtual envelopes 	
          // (not placed in MC geometry, only logical assembly of volumes,
	  //  cannot have more copies)	
    void  AddEnvelope(const TString& name, Int_t id, 
                      Bool_t isVirtual, const char* only="ONLY"); 
    void  AddEnvelope(const TString& name, Int_t id,  
                      Bool_t isVirtual,
                      const TGeoTranslation& translation, 
		      const char* only="ONLY"); 
    void  AddEnvelope(const TString& name, Int_t id, 
                      Bool_t isVirtual, 
                      const TGeoTranslation& translation, 
		      const TGeoRotation& rotation,
		      const char* only="ONLY");
    void  AddEnvelope(const TString& name, Int_t id,  
                      Bool_t isVirtual,
                      const TGeoCombiTrans& transform,
		      const char* only="ONLY");
		      
          // adding non-virtual envelopes 	
          // (placed in MC geometry with transformation composed
	  //  of transformation of chamber and their transformation, 
	  //  can have more copies )	
    void  AddEnvelope(const TString& name, Int_t id, 
                      Int_t copyNo, const char* only="ONLY"); 
    void  AddEnvelope(const TString& name, Int_t id, 
                      Int_t copyNo, 
                      const TGeoTranslation& translation,
		      const char* only="ONLY"); 
    void  AddEnvelope(const TString& name,  Int_t id, 
                      Int_t copyNo,
                      const TGeoTranslation& translation, 
		      const TGeoRotation& rotation,
		      const char* only="ONLY");
    void  AddEnvelope(const TString& name,  Int_t id, 
                      Int_t copyNo, 
                      const TGeoCombiTrans& transform,
		      const char* only="ONLY");

          // adding constituents to virtual envelopes 	
          // (placed in MC geometry with transformation composed
	  //  of transformation of chamber, envelope and their own
	  //  transformation )	
    void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
                      Int_t copyNo); 
    void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
                      Int_t copyNo, const TGeoTranslation& translation); 
    void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
                      Int_t copyNo, const TGeoTranslation& translation, 
		      const TGeoRotation& rotation);
    void  AddEnvelopeConstituent(const TString& name, const TString& envName, 
                      Int_t copyNo, const TGeoCombiTrans& transform);
		      		      
          // adding constituents to virtual envelopes with specified shape
	  // parameters
          // (placed in MC geometry with transformation composed
	  //  of transformation of chamber, envelope and their own
	  //  transformation )	
    void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
                      Int_t copyNo, Int_t npar, Double_t* param); 
    void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
                      Int_t copyNo, const TGeoTranslation& translation,
		      Int_t npar, Double_t* param); 
    void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
                      Int_t copyNo, const TGeoTranslation& translation, 
		      const TGeoRotation& rotation, Int_t npar, Double_t* param);
    void  AddEnvelopeConstituentParam(const TString& name, const TString& envName, 
                      Int_t copyNo, const TGeoCombiTrans& transform,
		      Int_t npar, Double_t* param);
		      		      
    void  SetDebug(Bool_t debug);
    void  SetReferenceFrame(const TGeoCombiTrans& referenceFrame);

    // Alignement
    virtual Bool_t  GetAlign() const;
    virtual void    SetAlign(Bool_t align);
 
    // get methods
    const TObjArray*  GetEnvelopes() const;
    Int_t             GetNofDetElements() const;

    AliMUONGeometryEnvelope* FindEnvelope(const TString& name) const;

  protected:
    /// Not implemented
    AliMUONGeometryEnvelopeStore(const AliMUONGeometryEnvelopeStore& rhs);
    /// Not implemented
    AliMUONGeometryEnvelopeStore& operator = (const AliMUONGeometryEnvelopeStore& rhs);

  private:
    // methods
    TGeoHMatrix ConvertDETransform(const TGeoHMatrix& transform) const;
    Bool_t AlignEnvelope(AliMUONGeometryEnvelope* envelope) const;
 
    // data members
    TObjArray*   fEnvelopes; ///< \brief the envelopes names and transformations
		             /// wrt to the chamber position in mother volume                                 
    AliMpExMap*  fDetElements; ///< \brief detection elements
                               /// used for alignement of envelopes
    TGeoCombiTrans fReferenceFrame; ///< \brief the transformation from the builder 
                                    /// reference frame to that of the transform 
				    /// data files
    Bool_t      fDebug;     ///< Switch for debugging  \deprecated - use AliLog instead
    Bool_t      fAlign;     ///< option to read transformations from a file
 
  ClassDef(AliMUONGeometryEnvelopeStore,2) // Geometry envelope store
};

// inline functions

/// Set debug option
/// \deprecated - use AliLog instead
inline void  AliMUONGeometryEnvelopeStore::SetDebug(Bool_t debug)
{ fDebug = debug; }

/// Return align option - if true, transformations are read from a file
inline Bool_t  AliMUONGeometryEnvelopeStore::GetAlign() const
{ return fAlign; }

/// Set align option - if true, transformations are read from a file
inline void AliMUONGeometryEnvelopeStore::SetAlign(Bool_t align)
{ fAlign = align; }

/// Return the array of the envelopes names and transformations
/// wrt to the chamber position in mother volume
inline const TObjArray* AliMUONGeometryEnvelopeStore::GetEnvelopes() const
{ return fEnvelopes; }

/// Set the transformation from the builder reference frame to that of the transform 
/// data files
inline void 
AliMUONGeometryEnvelopeStore::SetReferenceFrame(const TGeoCombiTrans& referenceFrame)
{ fReferenceFrame = referenceFrame; }

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