FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairGeoAssembly.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 //*-- AUTHOR : M. Al-Turany 21/04/2009
9 
11 //
12 // FairGeoAssmebly
13 //
14 // class for the shape Assembly
16 #include "FairGeoAssembly.h"
17 
18 #include "FairGeoTransform.h" // for FairGeoTransform
19 #include "FairGeoVector.h" // for FairGeoVector
20 #include "FairGeoVolume.h" // for FairGeoVolume
21 
22 #include <TArrayD.h> // for TArrayD
23 #include <TString.h> // for TString
24 #include <fstream>
25 #include <ostream> // for fstream, etc
26 #include <stdio.h> // for printf, sprintf
27 #include <string.h> // for strlen
28 
30 
33 {
34  // constructor
35  fName = "ASSEMBLY";
36  nPoints = 0;
37  nParam = 0;
38  param = new TArrayD(nParam);
39 }
40 
42 {
43  // destructor
44  if (param) {
45  delete param;
46  param = 0;
47  }
48  if (center) {
49  delete center;
50  center = 0;
51  }
52  if (position) {
53  delete position;
54  position = 0;
55  }
56 }
57 
59 {
60 
61  // Assemblies has no parameters so just return 1;
62  return 1;
63 }
64 
66 {
67  // nothing to calculate
68 
69  return param;
70 }
71 
72 Bool_t FairGeoAssembly::writePoints(std::fstream* pFile, FairGeoVolume* volu)
73 {
74  // writes the 4 'points' decribed above to ascii file
75  if (!pFile) {
76  return kFALSE;
77  }
78  Text_t buf[155];
79  for (Int_t i = 0; i < nPoints; i++) {
80  FairGeoVector& v = *(volu->getPoint(i));
81  sprintf(buf, "%9.3f\n", v(0));
82  pFile->write(buf, strlen(buf));
83  }
84  return kTRUE;
85 }
86 
88 {
89  // prints volume points to screen
90  for (Int_t i = 0; i < nPoints; i++) {
91  FairGeoVector& v = *(volu->getPoint(i));
92  printf("%9.3f\n", v(0));
93  }
94 }
95 
97 {
98  // calls the function posInMother(...) to calculate the position of the
99  // volume in its mother
100  Double_t t[3] = {0., 0., 0.};
102  posInMother(dTC, mTR);
103 }
void posInMother(const FairGeoTransform &, const FairGeoTransform &)
void setTransVector(const FairGeoVector &t)
TArrayD * calcVoluParam(FairGeoVolume *)
Bool_t writePoints(std::fstream *, FairGeoVolume *)
FairGeoTransform * center
ClassImp(FairEventBuilder)
void printPoints(FairGeoVolume *volu)
Int_t readPoints(std::fstream *pFile, FairGeoVolume *volu)
FairGeoVector * getPoint(const Int_t n)
Definition: FairGeoVolume.h:85
void calcVoluPosition(FairGeoVolume *, const FairGeoTransform &, const FairGeoTransform &)
FairGeoTransform * position