ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

// $Id$

//-----------------------------------------------------------------------------
// Class AliMUONGeometryEnvelope
// -----------------------------
// Helper class for definititon of an assembly of volumes.
// Author: Ivana Hrivnacova, IPN Orsay
// 23/01/2004
//-----------------------------------------------------------------------------

#include <TGeoMatrix.h>
#include <TString.h>
#include <TObjArray.h>

#include "AliMUONGeometryEnvelope.h"
#include "AliMUONGeometryConstituent.h"
#include "AliLog.h"

/// \cond CLASSIMP
ClassImp(AliMUONGeometryEnvelope)
/// \endcond

//______________________________________________________________________________
AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name, 
                                                 Int_t id, 
                                                 Bool_t isVirtual,
						 const char* only)
 : TNamed(name, name),
   fIsVirtual(isVirtual),
   fIsMANY(false),
   fCopyNo(1),
   fTransformation(0),
   fConstituents(0)
{
/// Standard constructor

  if (TString(only) == TString("MANY")) fIsMANY = true;

  // Create the envelope transformation
  fTransformation = new TGeoCombiTrans("");
  fConstituents = new TObjArray(20);
  
  // Set id
  SetUniqueID(id);
}


//______________________________________________________________________________
AliMUONGeometryEnvelope::AliMUONGeometryEnvelope(const TString& name,   
                                                 Int_t id,
                                                 Int_t copyNo, 
						 const char* only)
 : TNamed(name, name),
   fIsVirtual(false),
   fIsMANY(false),
   fCopyNo(copyNo),
   fTransformation(0),
   fConstituents(0)
{
/// Standard constructor for a non virtual enevelope with a specified copy 
/// number

  if (TString(only) == TString("MANY")) fIsMANY = true;

  // Create the envelope transformation
  fTransformation = new TGeoCombiTrans("");
  fConstituents = new TObjArray(20);
  
  // Set id
  SetUniqueID(id);
}


//______________________________________________________________________________
AliMUONGeometryEnvelope::AliMUONGeometryEnvelope()
 : TNamed(),
   fIsVirtual(0),
   fIsMANY(false),
   fCopyNo(0),
   fTransformation(0),
   fConstituents(0)
{
/// Default constructor
}

//______________________________________________________________________________
AliMUONGeometryEnvelope::~AliMUONGeometryEnvelope() 
{
/// Destructor

  // Add deleting rotation matrices 
  
  delete fTransformation;
  
  if (fConstituents) {
    fConstituents->Delete();
    delete fConstituents;
  }  
}

//
// public methods
//

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo) 
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents->Add(new AliMUONGeometryConstituent(name, copyNo, 0, 0));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo, 
                                          const TGeoTranslation& translation)
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents
    ->Add(new AliMUONGeometryConstituent(name, copyNo, translation, 0, 0));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
                                          const TGeoTranslation& translation,
		                          const TGeoRotation& rotation)
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents
    ->Add(new AliMUONGeometryConstituent(
                     name, copyNo, translation, rotation, 0, 0));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituent(const TString& name, Int_t copyNo,
                                          const TGeoCombiTrans& transform )
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents
    ->Add(new AliMUONGeometryConstituent(
                     name, copyNo, transform, 0, 0));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
                                  Int_t copyNo, Int_t npar, Double_t* param) 
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents
    ->Add(new AliMUONGeometryConstituent(name, copyNo, npar, param));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
                                  Int_t copyNo, const TGeoTranslation& translation,
				  Int_t npar, Double_t* param)
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents
    ->Add(new AliMUONGeometryConstituent(
                     name, copyNo, translation, npar, param));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
                                  Int_t copyNo, const TGeoTranslation& translation,
		                  const TGeoRotation& rotation, 
				  Int_t npar, Double_t* param)
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents
    ->Add(new AliMUONGeometryConstituent(
                     name, copyNo, translation, rotation, npar, param));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::AddConstituentParam(const TString& name, 
                                  Int_t copyNo, 
				  const TGeoCombiTrans& transform, 
				  Int_t npar, Double_t* param)
{
/// Add the volume with the specified name and transformation
/// to the list of envelopes.

  fConstituents
    ->Add(new AliMUONGeometryConstituent(
                     name, copyNo, transform, npar, param));
}

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::SetTranslation(const TGeoTranslation& translation)
{
/// Set the envelope position

  fTransformation
    ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
}  

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::SetRotation(const TGeoRotation& rotation)
{
/// Set the envelope rotation

  TGeoRotation* rot = new TGeoRotation();
  rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));

  fTransformation->SetRotation(rot);
}  

//______________________________________________________________________________
void  AliMUONGeometryEnvelope::SetTransform(const TGeoCombiTrans& transform)
{
/// Set the envelope transformation

  fTransformation
    ->SetTranslation(const_cast<Double_t*>(transform.GetTranslation()));

  TGeoRotation* rot = new TGeoRotation();
  rot->SetMatrix(const_cast<Double_t*>(transform.GetRotationMatrix()));

  fTransformation->SetRotation(rot);
}  
 AliMUONGeometryEnvelope.cxx:1
 AliMUONGeometryEnvelope.cxx:2
 AliMUONGeometryEnvelope.cxx:3
 AliMUONGeometryEnvelope.cxx:4
 AliMUONGeometryEnvelope.cxx:5
 AliMUONGeometryEnvelope.cxx:6
 AliMUONGeometryEnvelope.cxx:7
 AliMUONGeometryEnvelope.cxx:8
 AliMUONGeometryEnvelope.cxx:9
 AliMUONGeometryEnvelope.cxx:10
 AliMUONGeometryEnvelope.cxx:11
 AliMUONGeometryEnvelope.cxx:12
 AliMUONGeometryEnvelope.cxx:13
 AliMUONGeometryEnvelope.cxx:14
 AliMUONGeometryEnvelope.cxx:15
 AliMUONGeometryEnvelope.cxx:16
 AliMUONGeometryEnvelope.cxx:17
 AliMUONGeometryEnvelope.cxx:18
 AliMUONGeometryEnvelope.cxx:19
 AliMUONGeometryEnvelope.cxx:20
 AliMUONGeometryEnvelope.cxx:21
 AliMUONGeometryEnvelope.cxx:22
 AliMUONGeometryEnvelope.cxx:23
 AliMUONGeometryEnvelope.cxx:24
 AliMUONGeometryEnvelope.cxx:25
 AliMUONGeometryEnvelope.cxx:26
 AliMUONGeometryEnvelope.cxx:27
 AliMUONGeometryEnvelope.cxx:28
 AliMUONGeometryEnvelope.cxx:29
 AliMUONGeometryEnvelope.cxx:30
 AliMUONGeometryEnvelope.cxx:31
 AliMUONGeometryEnvelope.cxx:32
 AliMUONGeometryEnvelope.cxx:33
 AliMUONGeometryEnvelope.cxx:34
 AliMUONGeometryEnvelope.cxx:35
 AliMUONGeometryEnvelope.cxx:36
 AliMUONGeometryEnvelope.cxx:37
 AliMUONGeometryEnvelope.cxx:38
 AliMUONGeometryEnvelope.cxx:39
 AliMUONGeometryEnvelope.cxx:40
 AliMUONGeometryEnvelope.cxx:41
 AliMUONGeometryEnvelope.cxx:42
 AliMUONGeometryEnvelope.cxx:43
 AliMUONGeometryEnvelope.cxx:44
 AliMUONGeometryEnvelope.cxx:45
 AliMUONGeometryEnvelope.cxx:46
 AliMUONGeometryEnvelope.cxx:47
 AliMUONGeometryEnvelope.cxx:48
 AliMUONGeometryEnvelope.cxx:49
 AliMUONGeometryEnvelope.cxx:50
 AliMUONGeometryEnvelope.cxx:51
 AliMUONGeometryEnvelope.cxx:52
 AliMUONGeometryEnvelope.cxx:53
 AliMUONGeometryEnvelope.cxx:54
 AliMUONGeometryEnvelope.cxx:55
 AliMUONGeometryEnvelope.cxx:56
 AliMUONGeometryEnvelope.cxx:57
 AliMUONGeometryEnvelope.cxx:58
 AliMUONGeometryEnvelope.cxx:59
 AliMUONGeometryEnvelope.cxx:60
 AliMUONGeometryEnvelope.cxx:61
 AliMUONGeometryEnvelope.cxx:62
 AliMUONGeometryEnvelope.cxx:63
 AliMUONGeometryEnvelope.cxx:64
 AliMUONGeometryEnvelope.cxx:65
 AliMUONGeometryEnvelope.cxx:66
 AliMUONGeometryEnvelope.cxx:67
 AliMUONGeometryEnvelope.cxx:68
 AliMUONGeometryEnvelope.cxx:69
 AliMUONGeometryEnvelope.cxx:70
 AliMUONGeometryEnvelope.cxx:71
 AliMUONGeometryEnvelope.cxx:72
 AliMUONGeometryEnvelope.cxx:73
 AliMUONGeometryEnvelope.cxx:74
 AliMUONGeometryEnvelope.cxx:75
 AliMUONGeometryEnvelope.cxx:76
 AliMUONGeometryEnvelope.cxx:77
 AliMUONGeometryEnvelope.cxx:78
 AliMUONGeometryEnvelope.cxx:79
 AliMUONGeometryEnvelope.cxx:80
 AliMUONGeometryEnvelope.cxx:81
 AliMUONGeometryEnvelope.cxx:82
 AliMUONGeometryEnvelope.cxx:83
 AliMUONGeometryEnvelope.cxx:84
 AliMUONGeometryEnvelope.cxx:85
 AliMUONGeometryEnvelope.cxx:86
 AliMUONGeometryEnvelope.cxx:87
 AliMUONGeometryEnvelope.cxx:88
 AliMUONGeometryEnvelope.cxx:89
 AliMUONGeometryEnvelope.cxx:90
 AliMUONGeometryEnvelope.cxx:91
 AliMUONGeometryEnvelope.cxx:92
 AliMUONGeometryEnvelope.cxx:93
 AliMUONGeometryEnvelope.cxx:94
 AliMUONGeometryEnvelope.cxx:95
 AliMUONGeometryEnvelope.cxx:96
 AliMUONGeometryEnvelope.cxx:97
 AliMUONGeometryEnvelope.cxx:98
 AliMUONGeometryEnvelope.cxx:99
 AliMUONGeometryEnvelope.cxx:100
 AliMUONGeometryEnvelope.cxx:101
 AliMUONGeometryEnvelope.cxx:102
 AliMUONGeometryEnvelope.cxx:103
 AliMUONGeometryEnvelope.cxx:104
 AliMUONGeometryEnvelope.cxx:105
 AliMUONGeometryEnvelope.cxx:106
 AliMUONGeometryEnvelope.cxx:107
 AliMUONGeometryEnvelope.cxx:108
 AliMUONGeometryEnvelope.cxx:109
 AliMUONGeometryEnvelope.cxx:110
 AliMUONGeometryEnvelope.cxx:111
 AliMUONGeometryEnvelope.cxx:112
 AliMUONGeometryEnvelope.cxx:113
 AliMUONGeometryEnvelope.cxx:114
 AliMUONGeometryEnvelope.cxx:115
 AliMUONGeometryEnvelope.cxx:116
 AliMUONGeometryEnvelope.cxx:117
 AliMUONGeometryEnvelope.cxx:118
 AliMUONGeometryEnvelope.cxx:119
 AliMUONGeometryEnvelope.cxx:120
 AliMUONGeometryEnvelope.cxx:121
 AliMUONGeometryEnvelope.cxx:122
 AliMUONGeometryEnvelope.cxx:123
 AliMUONGeometryEnvelope.cxx:124
 AliMUONGeometryEnvelope.cxx:125
 AliMUONGeometryEnvelope.cxx:126
 AliMUONGeometryEnvelope.cxx:127
 AliMUONGeometryEnvelope.cxx:128
 AliMUONGeometryEnvelope.cxx:129
 AliMUONGeometryEnvelope.cxx:130
 AliMUONGeometryEnvelope.cxx:131
 AliMUONGeometryEnvelope.cxx:132
 AliMUONGeometryEnvelope.cxx:133
 AliMUONGeometryEnvelope.cxx:134
 AliMUONGeometryEnvelope.cxx:135
 AliMUONGeometryEnvelope.cxx:136
 AliMUONGeometryEnvelope.cxx:137
 AliMUONGeometryEnvelope.cxx:138
 AliMUONGeometryEnvelope.cxx:139
 AliMUONGeometryEnvelope.cxx:140
 AliMUONGeometryEnvelope.cxx:141
 AliMUONGeometryEnvelope.cxx:142
 AliMUONGeometryEnvelope.cxx:143
 AliMUONGeometryEnvelope.cxx:144
 AliMUONGeometryEnvelope.cxx:145
 AliMUONGeometryEnvelope.cxx:146
 AliMUONGeometryEnvelope.cxx:147
 AliMUONGeometryEnvelope.cxx:148
 AliMUONGeometryEnvelope.cxx:149
 AliMUONGeometryEnvelope.cxx:150
 AliMUONGeometryEnvelope.cxx:151
 AliMUONGeometryEnvelope.cxx:152
 AliMUONGeometryEnvelope.cxx:153
 AliMUONGeometryEnvelope.cxx:154
 AliMUONGeometryEnvelope.cxx:155
 AliMUONGeometryEnvelope.cxx:156
 AliMUONGeometryEnvelope.cxx:157
 AliMUONGeometryEnvelope.cxx:158
 AliMUONGeometryEnvelope.cxx:159
 AliMUONGeometryEnvelope.cxx:160
 AliMUONGeometryEnvelope.cxx:161
 AliMUONGeometryEnvelope.cxx:162
 AliMUONGeometryEnvelope.cxx:163
 AliMUONGeometryEnvelope.cxx:164
 AliMUONGeometryEnvelope.cxx:165
 AliMUONGeometryEnvelope.cxx:166
 AliMUONGeometryEnvelope.cxx:167
 AliMUONGeometryEnvelope.cxx:168
 AliMUONGeometryEnvelope.cxx:169
 AliMUONGeometryEnvelope.cxx:170
 AliMUONGeometryEnvelope.cxx:171
 AliMUONGeometryEnvelope.cxx:172
 AliMUONGeometryEnvelope.cxx:173
 AliMUONGeometryEnvelope.cxx:174
 AliMUONGeometryEnvelope.cxx:175
 AliMUONGeometryEnvelope.cxx:176
 AliMUONGeometryEnvelope.cxx:177
 AliMUONGeometryEnvelope.cxx:178
 AliMUONGeometryEnvelope.cxx:179
 AliMUONGeometryEnvelope.cxx:180
 AliMUONGeometryEnvelope.cxx:181
 AliMUONGeometryEnvelope.cxx:182
 AliMUONGeometryEnvelope.cxx:183
 AliMUONGeometryEnvelope.cxx:184
 AliMUONGeometryEnvelope.cxx:185
 AliMUONGeometryEnvelope.cxx:186
 AliMUONGeometryEnvelope.cxx:187
 AliMUONGeometryEnvelope.cxx:188
 AliMUONGeometryEnvelope.cxx:189
 AliMUONGeometryEnvelope.cxx:190
 AliMUONGeometryEnvelope.cxx:191
 AliMUONGeometryEnvelope.cxx:192
 AliMUONGeometryEnvelope.cxx:193
 AliMUONGeometryEnvelope.cxx:194
 AliMUONGeometryEnvelope.cxx:195
 AliMUONGeometryEnvelope.cxx:196
 AliMUONGeometryEnvelope.cxx:197
 AliMUONGeometryEnvelope.cxx:198
 AliMUONGeometryEnvelope.cxx:199
 AliMUONGeometryEnvelope.cxx:200
 AliMUONGeometryEnvelope.cxx:201
 AliMUONGeometryEnvelope.cxx:202
 AliMUONGeometryEnvelope.cxx:203
 AliMUONGeometryEnvelope.cxx:204
 AliMUONGeometryEnvelope.cxx:205
 AliMUONGeometryEnvelope.cxx:206
 AliMUONGeometryEnvelope.cxx:207
 AliMUONGeometryEnvelope.cxx:208
 AliMUONGeometryEnvelope.cxx:209
 AliMUONGeometryEnvelope.cxx:210
 AliMUONGeometryEnvelope.cxx:211
 AliMUONGeometryEnvelope.cxx:212
 AliMUONGeometryEnvelope.cxx:213
 AliMUONGeometryEnvelope.cxx:214
 AliMUONGeometryEnvelope.cxx:215
 AliMUONGeometryEnvelope.cxx:216
 AliMUONGeometryEnvelope.cxx:217
 AliMUONGeometryEnvelope.cxx:218
 AliMUONGeometryEnvelope.cxx:219
 AliMUONGeometryEnvelope.cxx:220
 AliMUONGeometryEnvelope.cxx:221
 AliMUONGeometryEnvelope.cxx:222
 AliMUONGeometryEnvelope.cxx:223
 AliMUONGeometryEnvelope.cxx:224
 AliMUONGeometryEnvelope.cxx:225
 AliMUONGeometryEnvelope.cxx:226
 AliMUONGeometryEnvelope.cxx:227
 AliMUONGeometryEnvelope.cxx:228
 AliMUONGeometryEnvelope.cxx:229
 AliMUONGeometryEnvelope.cxx:230
 AliMUONGeometryEnvelope.cxx:231
 AliMUONGeometryEnvelope.cxx:232
 AliMUONGeometryEnvelope.cxx:233
 AliMUONGeometryEnvelope.cxx:234
 AliMUONGeometryEnvelope.cxx:235
 AliMUONGeometryEnvelope.cxx:236
 AliMUONGeometryEnvelope.cxx:237
 AliMUONGeometryEnvelope.cxx:238
 AliMUONGeometryEnvelope.cxx:239
 AliMUONGeometryEnvelope.cxx:240
 AliMUONGeometryEnvelope.cxx:241
 AliMUONGeometryEnvelope.cxx:242
 AliMUONGeometryEnvelope.cxx:243
 AliMUONGeometryEnvelope.cxx:244
 AliMUONGeometryEnvelope.cxx:245
 AliMUONGeometryEnvelope.cxx:246
 AliMUONGeometryEnvelope.cxx:247
 AliMUONGeometryEnvelope.cxx:248
 AliMUONGeometryEnvelope.cxx:249