Fixing memory leaks
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryConstituent.cxx
1 // $Id$
2 //
3 // Class AliMUONGeometryConstituent
4 // -----------------------------
5 // Helper class for definititon of an assembly of volumes.
6 //
7 // Author: Ivana Hrivnacova, IPN Orsay
8
9 #include <TGeoMatrix.h>
10
11 #include "AliMUONGeometryConstituent.h"
12
13 ClassImp(AliMUONGeometryConstituent)
14
15 //______________________________________________________________________________
16 AliMUONGeometryConstituent::AliMUONGeometryConstituent(const TString& name, 
17                                    Int_t copyNo, Int_t npar, Double_t* param)
18   : TNamed(name, name),
19     fCopyNo(copyNo),
20     fNpar(npar),
21     fParam(0)                              
22 {                                   
23   // fTransformation = new TGeoCombiTrans(name);
24            // would be nice to be so simple 
25
26   // Create the constituent transformation
27   fTransformation = new TGeoCombiTrans("");
28
29   // Volume parameters
30   if (npar > 0) {
31     fParam = new Double_t[npar];
32     for (Int_t i=0; i<npar; i++) fParam[i] = param[i];
33   }  
34 }
35
36 //______________________________________________________________________________
37 AliMUONGeometryConstituent::AliMUONGeometryConstituent(const TString& name, 
38                                    Int_t copyNo, const TGeoTranslation& translation,
39                                    Int_t npar, Double_t* param)
40   : TNamed(name, name),
41     fCopyNo(copyNo),
42     fNpar(npar),
43     fParam(0),                             
44     fTransformation(0) 
45 {
46   // Create the constituent transformation
47   fTransformation = new TGeoCombiTrans(translation, TGeoRotation());
48
49   // Volume parameters
50   if (npar > 0) {
51     fParam = new Double_t[npar];
52     for (Int_t i=0; i<npar; i++) fParam[i] = param[i];
53   }  
54 }
55
56                          
57 //______________________________________________________________________________
58 AliMUONGeometryConstituent::AliMUONGeometryConstituent(const TString& name, 
59                                    Int_t copyNo, const TGeoTranslation& translation, 
60                                    const TGeoRotation& rotation, 
61                                    Int_t npar, Double_t* param)
62                                    
63   : TNamed(name, name),
64     fCopyNo(copyNo),
65     fNpar(npar),
66     fParam(0),                             
67     fTransformation(0) 
68 {
69   // Create the constituent transformation
70   fTransformation = new TGeoCombiTrans(translation, rotation);
71
72   // Volume parameters
73   if (npar > 0) {
74     fParam = new Double_t[npar];
75     for (Int_t i=0; i<npar; i++) fParam[i] = param[i];
76   }  
77 }
78
79 //______________________________________________________________________________
80 AliMUONGeometryConstituent::AliMUONGeometryConstituent()
81   : TNamed(),
82     fCopyNo(0),
83     fNpar(0),
84     fParam(0),                             
85     fTransformation(0) 
86 {
87 // Default constructor
88 }
89
90
91 //______________________________________________________________________________
92 AliMUONGeometryConstituent::AliMUONGeometryConstituent(
93                                         const AliMUONGeometryConstituent& rhs)
94   : TNamed(rhs)
95 {
96   Fatal("Copy constructor", 
97         "Copy constructor is not implemented.");
98 }
99
100 //______________________________________________________________________________
101 AliMUONGeometryConstituent::~AliMUONGeometryConstituent() 
102 {
103 //
104   delete fTransformation;
105   delete [] fParam;
106 }
107
108 //______________________________________________________________________________
109 AliMUONGeometryConstituent& 
110 AliMUONGeometryConstituent::operator = (const AliMUONGeometryConstituent& rhs) 
111 {
112   // check assignement to self
113   if (this == &rhs) return *this;
114
115   Fatal("operator=", 
116         "Assignment operator is not implemented.");
117     
118   return *this;  
119 }
120