Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGDMLMatrix.h
Go to the documentation of this file.
1 // @(#)root/gdml:$Id$
2 // Author: Andrei Gheata 05/12/2018
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGDMLMATRIX
13 #define ROOT_TGDMLMATRIX
14 
15 #include <TNamed.h>
16 
17 
18 ////////////////////////////////////////////////////////////////////////////
19 // //
20 // TGDMLProperty - A property with a name and a reference name pointing //
21 // to a GDML matrix object //
22 ////////////////////////////////////////////////////////////////////////////
23 
24 typedef TNamed TGDMLProperty;
25 
26 ////////////////////////////////////////////////////////////////////////////
27 // //
28 // TGDMLMatrix - A matrix used for GDML parsing, the objects have to be //
29 // exposed via TGeoManager interfcace to be able to construct optical //
30 // surfaces. //
31 // //
32 ////////////////////////////////////////////////////////////////////////////
33 
34 class TGDMLMatrix : public TNamed {
35 public:
36  TGDMLMatrix() {}
37  TGDMLMatrix(const char *name, size_t rows,size_t cols);
38  TGDMLMatrix(const TGDMLMatrix& rhs);
39  TGDMLMatrix& operator=(const TGDMLMatrix& rhs);
40  ~TGDMLMatrix() { delete [] fMatrix; }
41 
42  void Set(size_t r, size_t c, Double_t a);
43  Double_t Get(size_t r, size_t c) const;
44  size_t GetRows() const { return fNrows; }
45  size_t GetCols() const { return fNcols; }
46  void SetMatrixAsString(const char *mat) { fTitle = mat; }
47  const char *GetMatrixAsString() const { return fTitle.Data(); }
48 
49  void Print(Option_t *option="") const;
50 
51  private:
52 
53  Int_t fNelem = 0; // Number of elements
54  size_t fNrows = 0; // Number of rows
55  size_t fNcols = 0; // Number of columns
56  Double_t *fMatrix = nullptr; // [fNelem] Matrix elements
57 
58  ClassDef(TGDMLMatrix, 1) // Class representing a matrix used temporary for GDML parsing
59 };
60 
61 #endif /* ROOT_TGDMLMATRIX */