BmnRoot
Loading...
Searching...
No Matches
CbmStsSensorFactory.cxx
Go to the documentation of this file.
1
6#include <iomanip>
7
8#include "TGeoManager.h"
9
10#include "FairLogger.h"
11
13
14
15// ----- Initialisation of static singleton pointer --------------------
16CbmStsSensorFactory* CbmStsSensorFactory::fgInstance = NULL;
17// -------------------------------------------------------------------------
18
19
20
21// ----- Constructor (private) -----------------------------------------
22CbmStsSensorFactory::CbmStsSensorFactory()
23 : TNamed("StsSensorFactory", ""),
24 fSensors()
25{
26 Int_t nSensors = DefineSensors();
27 LOG(info) << GetName() << ": " << nSensors << " sensors created.";
28}
29// -------------------------------------------------------------------------
30
31
32
33// ----- Create sensor volume (private) --------------------------------
34Bool_t CbmStsSensorFactory::CreateSensor(TString& name, TString& material,
35 Double_t xSize, Double_t ySize,
36 Double_t thickness,
37 EColor color) {
38
39 // --- Check presence of TGeoManager
40 if ( ! gGeoManager ) {
41 LOG(error) << GetName() << ": no TGeoManager present!";
42 return kFALSE;
43 }
44
45 // --- Check presence of material
46 TGeoMedium* medium = gGeoManager->GetMedium(material.Data());
47 if ( ! medium ) {
48 LOG(error) << GetName() << ": medium " << material << " not found!";
49 return kFALSE;
50 }
51
52 // --- Construct the sensor volume
53 TGeoVolume* sensor = gGeoManager->MakeBox(name, medium,
54 xSize/2., ySize/2, thickness/2.);
55 sensor->SetLineColor(color);
56 fSensors.push_back(sensor);
57 LOG(info) << GetName() << ": creating sensor "
58 << std::setw(10) << name
59 << ", material " << std::setw(10) << material
60 << ", size (" << std::fixed << std::setprecision(5) << xSize
61 << ", " << ySize << ", " << thickness << ") cm";
62 return kTRUE;
63
64}
65// -------------------------------------------------------------------------
66
67
68
69// ----- Sensor type definition (private) ------------------------------
71
72 // --- Sensor counter
73 Int_t nSensors = 0;
74
75 // --- Check presence of TGeoManager
76 if ( ! gGeoManager ) {
77 LOG(error) << "StsSensorFactory: no TGeoManeger present!";
78 return 0;
79 }
80
81 // --- Sensor properties variables
82 TString sensorName = "";
83 TString material = "";
84 Double_t xSize = 0.;
85 Double_t ySize = 0.;
86 Double_t thickness = 0.;
87 EColor colour = kRed;
88
89 // --- sensor01: Half small sensor (4 cm x 2.2 cm)
90 sensorName = "Sensor01";
91 material = "silicon";
92 xSize = 4.0;
93 ySize = 2.2;
94 thickness = 0.03;
95 colour = kYellow;
96 if ( CreateSensor(sensorName, material, xSize, ySize, thickness, colour) )
97 nSensors++;
98
99 // --- sensor02: small sensor (6.2 cm x 2.2 cm)
100 sensorName = "Sensor02";
101 material = "silicon";
102 xSize = 6.1992;
103 ySize = 2.2;
104 thickness = 0.03;
105 colour = kRed;
106 if ( CreateSensor(sensorName, material, xSize, ySize, thickness, colour) )
107 nSensors++;
108
109 // --- sensor03: medium sensor (6.2 cm x 4.2 cm)
110 sensorName = "Sensor03";
111 material = "silicon";
112 xSize = 6.1992;
113 ySize = 4.2;
114 thickness = 0.03;
115 colour = kGreen;
116 if ( CreateSensor(sensorName, material, xSize, ySize, thickness, colour) )
117 nSensors++;
118
119 // --- sensor04: big sensor (6.2 cm x 6.2 cm)
120 sensorName = "Sensor04";
121 material = "silicon";
122 xSize = 6.1992;
123 ySize = 6.2;
124 thickness = 0.03;
125 colour = kBlue;
126 if ( CreateSensor(sensorName, material, xSize, ySize, thickness, colour) )
127 nSensors++;
128
129 // --- sensor05: "in-hole" sensor (3.1 cm x 3.1 cm)
130 sensorName = "Sensor05";
131 material = "silicon";
132 xSize = 3.1;
133 ySize = 3.1;
134 thickness = 0.03;
135 colour = kYellow;
136 if ( CreateSensor(sensorName, material, xSize, ySize, thickness, colour) )
137 nSensors++;
138
139 // --- sensor06: mini-medium sensor (1.5 cm x 4.2 cm)
140 sensorName = "Sensor06";
141 material = "silicon";
142 xSize = 1.5;
143 ySize = 4.2;
144 thickness = 0.03;
145 colour = kYellow;
146 if ( CreateSensor(sensorName, material, xSize, ySize, thickness, colour) )
147 nSensors++;
148
149
150 return nSensors;
151}
152// -------------------------------------------------------------------------
153
154// ----- Get static instance ---------------------------------------------
156 if ( ! fgInstance ) fgInstance = new CbmStsSensorFactory();
157 return fgInstance;
158}
159// -------------------------------------------------------------------------
Creates available sensor types for STS geometry.
static CbmStsSensorFactory * Instance()
name
Definition setup.py:7