88ef8c537e5c395f6ff15f868fa4699ec669ce04
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryConstituent.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17 //
18 // Class AliMUONGeometryConstituent
19 // -----------------------------
20 // Helper class for definititon of an assembly of volumes.
21 // Author: Ivana Hrivnacova, IPN Orsay
22 // 23/01/2004
23
24 #include <TGeoMatrix.h>
25
26 #include "AliMUONGeometryConstituent.h"
27 #include "AliLog.h"
28
29 ClassImp(AliMUONGeometryConstituent)
30
31 //______________________________________________________________________________
32 AliMUONGeometryConstituent::AliMUONGeometryConstituent(const TString& name, 
33                                    Int_t copyNo, Int_t npar, Double_t* param)
34   : TNamed(name, name),
35     fCopyNo(copyNo),
36     fNpar(npar),
37     fParam(0)                              
38 {                                   
39 /// Standard constructor for a constituent without translation & rotation
40
41   // fTransformation = new TGeoCombiTrans(name);
42            // would be nice to be so simple 
43
44   // Create the constituent transformation
45   fTransformation = new TGeoCombiTrans("");
46
47   // Volume parameters
48   if (npar > 0) {
49     fParam = new Double_t[npar];
50     for (Int_t i=0; i<npar; i++) fParam[i] = param[i];
51   }  
52 }
53
54 //______________________________________________________________________________
55 AliMUONGeometryConstituent::AliMUONGeometryConstituent(const TString& name, 
56                                    Int_t copyNo, const TGeoTranslation& translation,
57                                    Int_t npar, Double_t* param)
58   : TNamed(name, name),
59     fCopyNo(copyNo),
60     fNpar(npar),
61     fParam(0),                             
62     fTransformation(0) 
63 {
64 /// Standard constructor for a constituent with translation
65
66   // Create the constituent transformation
67   fTransformation = new TGeoCombiTrans(translation, TGeoRotation());
68
69   // Volume parameters
70   if (npar > 0) {
71     fParam = new Double_t[npar];
72     for (Int_t i=0; i<npar; i++) fParam[i] = param[i];
73   }  
74 }
75
76                          
77 //______________________________________________________________________________
78 AliMUONGeometryConstituent::AliMUONGeometryConstituent(const TString& name, 
79                                    Int_t copyNo, const TGeoTranslation& translation, 
80                                    const TGeoRotation& rotation, 
81                                    Int_t npar, Double_t* param)
82                                    
83   : TNamed(name, name),
84     fCopyNo(copyNo),
85     fNpar(npar),
86     fParam(0),                             
87     fTransformation(0) 
88 {
89 /// Standard constructor for a constituent with translation and rotation
90
91   // Create the constituent transformation
92   fTransformation = new TGeoCombiTrans(translation, rotation);
93
94   // Volume parameters
95   if (npar > 0) {
96     fParam = new Double_t[npar];
97     for (Int_t i=0; i<npar; i++) fParam[i] = param[i];
98   }  
99 }
100
101 //______________________________________________________________________________
102 AliMUONGeometryConstituent::AliMUONGeometryConstituent(const TString& name, 
103                                    Int_t copyNo, 
104                                    const TGeoCombiTrans& transform, 
105                                    Int_t npar, Double_t* param)
106                                    
107   : TNamed(name, name),
108     fCopyNo(copyNo),
109     fNpar(npar),
110     fParam(0),                             
111     fTransformation(0) 
112 {
113 /// Standard constructor for a constituent with translation and rotation
114 /// defined via TGeoCombiTrans
115
116   // Create the constituent transformation
117   fTransformation = new TGeoCombiTrans(transform);
118
119   // Volume parameters
120   if (npar > 0) {
121     fParam = new Double_t[npar];
122     for (Int_t i=0; i<npar; i++) fParam[i] = param[i];
123   }  
124 }
125
126 //______________________________________________________________________________
127 AliMUONGeometryConstituent::AliMUONGeometryConstituent()
128   : TNamed(),
129     fCopyNo(0),
130     fNpar(0),
131     fParam(0),                             
132     fTransformation(0) 
133 {
134 /// Default constructor
135 }
136
137
138 //______________________________________________________________________________
139 AliMUONGeometryConstituent::AliMUONGeometryConstituent(
140                                         const AliMUONGeometryConstituent& rhs)
141   : TNamed(rhs)
142 {
143 /// Protected copy constructor
144
145   AliFatal("Copy constructor is not implemented.");
146 }
147
148 //______________________________________________________________________________
149 AliMUONGeometryConstituent::~AliMUONGeometryConstituent() 
150 {
151 /// Destructor
152
153   delete fTransformation;
154   delete [] fParam;
155 }
156
157 //______________________________________________________________________________
158 AliMUONGeometryConstituent& 
159 AliMUONGeometryConstituent::operator = (const AliMUONGeometryConstituent& rhs) 
160 {
161 /// Protected assignment operator
162
163   // check assignement to self
164   if (this == &rhs) return *this;
165
166   AliFatal("Assignment operator is not implemented.");
167     
168   return *this;  
169 }
170