FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MyPipe.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 
9 // -------------------------------------------------------------------------
10 // ----- MyPipe file -----
11 // ----- Created by M. Al-Turany June 2014 -----
12 // -------------------------------------------------------------------------
13 
14 #include "MyPipe.h"
15 
16 #include <TGeoManager.h>
17 #include <TGeoMaterial.h>
18 #include <TGeoMedium.h>
19 #include <TGeoPcon.h>
20 #include <TGeoTube.h>
21 #include <TList.h>
22 #include <TObjArray.h>
23 
26  : FairModule()
27 {}
28 
29 MyPipe::MyPipe(const char* name, const char* title)
30  : FairModule(name, title)
31 {}
32 
33 MyPipe::MyPipe(const MyPipe& right)
34  : FairModule(right)
35 {}
36 
37 // ----- ConstructGeometry --------------------------------------------------
39 {
40  TGeoVolume* top = gGeoManager->GetTopVolume();
41 
42  TGeoMedium* Carbon = gGeoManager->GetMedium("C");
43  if (Carbon == 0) {
44  TGeoMaterial* matCarbon = new TGeoMaterial("C", 12.011, 6.0, 2.265);
45  Carbon = new TGeoMedium("C", 3, matCarbon);
46  }
47 
48  TGeoMaterial* matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0);
49  TGeoMedium* Vacuum = new TGeoMedium("Vacuum", 4, matVacuum);
50 
51  Int_t nSects = 2;
52  Double_t z[] = {-100, 300}; // in cm
53  Double_t r[] = {2.5, 2.5}; // in cm
54  Double_t Thickness = 0.05; // thickness of beam pipe [cm]
55  TGeoPcon* shape = new TGeoPcon(0., 360., nSects);
56  for (Int_t iSect = 0; iSect < nSects; iSect++) {
57  shape->DefineSection(iSect, z[iSect], r[iSect], r[iSect] + Thickness);
58  }
59 
60  // ---> Volume
61  TGeoVolume* pipe = new TGeoVolume("MyPipe", shape, Carbon);
62 
63  // --Now create the same but diameter less by Thikness and vacuum instead of Carbon
64  TGeoPcon* Vshape = new TGeoPcon(0., 360., nSects);
65  for (Int_t iSect = 0; iSect < nSects; iSect++) {
66  Vshape->DefineSection(iSect, z[iSect], r[iSect], r[iSect]);
67  }
68 
69  // ---> Volume
70  TGeoVolume* Vpipe = new TGeoVolume("MyPipe", shape, Vacuum);
71 
72  top->AddNode(pipe, 1);
73  top->AddNode(Vpipe, 1);
74 }
75 // ----------------------------------------------------------------------------
76 
77 FairModule* MyPipe::CloneModule() const { return new MyPipe(*this); }
78 
virtual void ConstructGeometry()
Definition: MyPipe.cxx:38
ClassImp(FairEventBuilder)
virtual FairModule * CloneModule() const
Definition: MyPipe.cxx:77
Definition: MyPipe.h:19
virtual ~MyPipe()
Definition: MyPipe.cxx:24
MyPipe()
Definition: MyPipe.cxx:25