Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoOpticalSurface.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 05/12/18
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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/** \class TGeoOpticalSurface
13\ingroup Geometry_classes
14
15This is a wrapper class to G4OpticalSurface
16*/
17
18#include "TGeoOpticalSurface.h"
19
20#include <string>
21
22#include "TGeoManager.h"
23#include "TGeoVolume.h"
24#include "TGeoNode.h"
25#include "TGDMLMatrix.h"
26
27
28//_____________________________________________________________________________
31 : TNamed(name, ""), fType(type), fModel(model), fFinish(finish), fValue(value)
32{
33 // Constructor
35 if (model == kMglisur) {
36 fPolish = value;
37 fSigmaAlpha = 0.0;
38 } else if (model == kMunified || model == kMLUT || model == kMdichroic || model == kMDAVIS) {
40 fPolish = 0.0;
41 } else {
42 Fatal("TGeoOpticalSurface::TGeoOpticalSurface()", "Constructor called with INVALID model.");
43 }
44}
45
46//_____________________________________________________________________________
48{
49 // Convert string to optical surface type
51 TString stype(name);
52 if ((stype == "dielectric_metal") || (stype == "0")) {
54 } else if ((stype == "dielectric_dielectric") || (stype == "1")) {
56 } else if ((stype == "dielectric_LUT") || (stype == "2")) {
58 } else if ((stype == "dielectric_dichroic") || (stype == "3")) {
60 } else if ((stype == "firsov") || (stype == "4")) {
61 type = kTfirsov;
62 } else {
63 type = kTx_ray;
64 }
65 return type;
66}
67
68//_____________________________________________________________________________
70{
71 // Convert surface type to string
72 switch (type) {
73 case kTdielectric_metal: return "dielectric_metal";
74 case kTdielectric_dielectric: return "dielectric_dielectric";
75 case kTdielectric_LUT: return "dielectric_LUT";
76 case kTdielectric_dichroic: return "dielectric_dichroic";
77 case kTfirsov: return "firsov";
78 case kTx_ray: return "x_ray";
80 }
81
82 return "unhandled surface type";
83}
84
85//_____________________________________________________________________________
87{
88
89 // Convert string to optical surface type
91 ESurfaceModel model;
92 if ((smodel == "glisur") || (smodel == "0")) {
93 model = kMglisur;
94 } else if ((smodel == "unified") || (smodel == "1")) {
95 model = kMunified;
96 } else if ((smodel == "LUT") || (smodel == "2")) {
97 model = kMLUT;
98 } else {
99 model = kMdichroic;
100 }
101 return model;
102}
103
104//_____________________________________________________________________________
106{
107 // Convert optical surface model to string
108 switch (model) {
109 case kMglisur: return "glisur";
110 case kMunified: return "unified";
111 case kMLUT: return "LUT";
112 case kMdichroic: return "dichoic";
113 case kMDAVIS:;
114 }
115
116 return "unhandled model type";
117}
118
119//_____________________________________________________________________________
121{
122 // Convert surface finish to string
124 ESurfaceFinish finish;
125 if ((sfinish == "polished") || (sfinish == "0")) {
126 finish = kFpolished;
127 } else if ((sfinish == "polishedfrontpainted") || (sfinish == "1")) {
128 finish = kFpolishedfrontpainted;
129 } else if ((sfinish == "polishedbackpainted") || (sfinish == "2")) {
130 finish = kFpolishedbackpainted;
131 } else if ((sfinish == "ground") || (sfinish == "3")) {
132 finish = kFground;
133 } else if ((sfinish == "groundfrontpainted") || (sfinish == "4")) {
134 finish = kFgroundfrontpainted;
135 } else if ((sfinish == "groundbackpainted") || (sfinish == "5")) {
136 finish = kFgroundbackpainted;
137 } else if ((sfinish == "polishedlumirrorair") || (sfinish == "6")) {
138 finish = kFpolishedlumirrorair;
139 } else if ((sfinish == "polishedlumirrorglue") || (sfinish == "7")) {
140 finish = kFpolishedlumirrorglue;
141 } else if ((sfinish == "polishedair") || (sfinish == "8")) {
142 finish = kFpolishedair;
143 } else if ((sfinish == "polishedteflonair") || (sfinish == "9")) {
144 finish = kFpolishedteflonair;
145 } else if ((sfinish == "polishedtioair") || (sfinish == "10")) {
146 finish = kFpolishedtioair;
147 } else if ((sfinish == "polishedtyvekair") || (sfinish == "11")) {
148 finish = kFpolishedtyvekair;
149 } else if ((sfinish == "polishedvm2000air") || (sfinish == "12")) {
150 finish = kFpolishedvm2000air;
151 } else if ((sfinish == "polishedvm2000glue") || (sfinish == "13")) {
152 finish = kFpolishedvm2000glue;
153 } else if ((sfinish == "etchedlumirrorair") || (sfinish == "14")) {
154 finish = kFetchedlumirrorair;
155 } else if ((sfinish == "etchedlumirrorglue") || (sfinish == "15")) {
156 finish = kFetchedlumirrorglue;
157 } else if ((sfinish == "etchedair") || (sfinish == "16")) {
158 finish = kFetchedair;
159 } else if ((sfinish == "etchedteflonair") || (sfinish == "17")) {
160 finish = kFetchedteflonair;
161 } else if ((sfinish == "etchedtioair") || (sfinish == "18")) {
162 finish = kFetchedtioair;
163 } else if ((sfinish == "etchedtyvekair") || (sfinish == "19")) {
164 finish = kFetchedtyvekair;
165 } else if ((sfinish == "etchedvm2000air") || (sfinish == "20")) {
166 finish = kFetchedvm2000air;
167 } else if ((sfinish == "etchedvm2000glue") || (sfinish == "21")) {
168 finish = kFetchedvm2000glue;
169 } else if ((sfinish == "groundlumirrorair") || (sfinish == "22")) {
170 finish = kFgroundlumirrorair;
171 } else if ((sfinish == "groundlumirrorglue") || (sfinish == "23")) {
172 finish = kFgroundlumirrorglue;
173 } else if ((sfinish == "groundair") || (sfinish == "24")) {
174 finish = kFgroundair;
175 } else if ((sfinish == "groundteflonair") || (sfinish == "25")) {
176 finish = kFgroundteflonair;
177 } else if ((sfinish == "groundtioair") || (sfinish == "26")) {
178 finish = kFgroundtioair;
179 } else if ((sfinish == "groundtyvekair") || (sfinish == "27")) {
180 finish = kFgroundtyvekair;
181 } else if ((sfinish == "groundvm2000air") || (sfinish == "28")) {
182 finish = kFgroundvm2000air;
183 } else {
184 finish = kFgroundvm2000glue;
185 }
186
187 return finish;
188}
189
190//_____________________________________________________________________________
192{
193 switch (finish) {
194 case kFpolished: return "polished";
195 case kFpolishedfrontpainted: return "polishedfrontpainted";
196 case kFpolishedbackpainted: return "polishedbackpainted";
197
198 case kFground: return "ground";
199 case kFgroundfrontpainted: return "groundfrontpainted";
200 case kFgroundbackpainted: return "groundbackpainted";
201
202 case kFpolishedlumirrorair: return "polishedlumirrorair";
203 case kFpolishedlumirrorglue: return "polishedlumirrorglue";
204 case kFpolishedair: return "polishedair";
205 case kFpolishedteflonair: return "polishedteflonair";
206 case kFpolishedtioair: return "polishedtioair";
207 case kFpolishedtyvekair: return "polishedtyvekair";
208 case kFpolishedvm2000air: return "polishedvm2000air";
209 case kFpolishedvm2000glue: return "polishedvm2000glue";
210
211 case kFetchedlumirrorair: return "etchedlumirrorair";
212 case kFetchedlumirrorglue: return "etchedlumirrorglue";
213 case kFetchedair: return "etchedair";
214 case kFetchedteflonair: return "etchedteflonair";
215 case kFetchedtioair: return "etchedtioair";
216 case kFetchedtyvekair: return "etchedtyvekair";
217 case kFetchedvm2000air: return "etchedvm2000air";
218 case kFetchedvm2000glue: return "etchedvm2000glue";
219
220 case kFgroundlumirrorair: return "groundlumirrorair";
221 case kFgroundlumirrorglue: return "groundlumirrorglue";
222 case kFgroundair: return "groundair";
223 case kFgroundteflonair: return "groundteflonair";
224 case kFgroundtioair: return "groundtioair";
225 case kFgroundtyvekair: return "groundtyvekair";
226 case kFgroundvm2000air: return "groundvm2000air";
227 case kFgroundvm2000glue: return "groundvm2000glue";
228 case kFRough_LUT:
230 case kFRoughESR_LUT:
232 case kFPolished_LUT:
236 case kFDetector_LUT:;
237 }
238
239 return "unhandled model finish";
240}
241
242//_____________________________________________________________________________
244{
245 // Find reference for a given property
247 return (prop) ? prop->GetTitle() : nullptr;
248}
249
250//_____________________________________________________________________________
252{
253 // Find reference for a given property
255 if (!prop)
256 return nullptr;
257 return gGeoManager->GetGDMLMatrix(prop->GetTitle());
258}
259
260//_____________________________________________________________________________
262{
263 // Find reference for a given property
265 if (!prop)
266 return nullptr;
267 return gGeoManager->GetGDMLMatrix(prop->GetTitle());
268}
269
270//_____________________________________________________________________________
272{
273 // Find reference for a given constant property
275 return (prop) ? prop->GetTitle() : nullptr;
276}
277
278//_____________________________________________________________________________
280{
281 // Find reference for a given constant property
283 if (!prop) {
284 if (err)
285 *err = kTRUE;
286 return 0.;
287 }
288 return gGeoManager->GetProperty(prop->GetTitle(), err);
289}
290
291//_____________________________________________________________________________
293{
294 // Find reference for a given constant property
296 if (!prop) {
297 if (err)
298 *err = kTRUE;
299 return 0.;
300 }
301 return gGeoManager->GetProperty(prop->GetTitle(), err);
302}
303
304//_____________________________________________________________________________
305bool TGeoOpticalSurface::AddProperty(const char *property, const char *ref)
306{
309 Error("AddProperty", "Property %s already added to optical surface %s", property, GetName());
310 return false;
311 }
313 return true;
314}
315
316//_____________________________________________________________________________
318{
321 Error("AddConstProperty", "Constant property %s already added to material %s", property, GetName());
322 return false;
323 }
325 return true;
326}
327
328//_____________________________________________________________________________
330{
331 // Print info about this optical surface
332 printf("*** opticalsurface: %s type: %s model: %s finish: %s value = %g\n", GetName(),
335 if (fProperties.GetSize()) {
336 TIter next(&fProperties);
338 while ((property = (TNamed *)next()))
339 printf(" property: %s ref: %s\n", property->GetName(), property->GetTitle());
340 }
342 TIter next(&fConstProperties);
344 Bool_t err;
345 while ((property = (TNamed *)next())) {
346 Double_t value = this->GetConstProperty(property->GetName(), &err);
347 printf(" constant: %s ref: %s value: %g\n",
348 property->GetName(), property->GetTitle(), value);
349 }
350 }
351}
352
353
354//_____________________________________________________________________________
356{
357 // Print info about this optical surface
358 if (!fVolume) {
359 Error("Print", "Skin surface %s: volume not set", GetName());
360 return;
361 }
362 printf("*** skinsurface: %s surfaceproperty: %s volumeref: %s \n", GetName(), GetTitle(), fVolume->GetName());
363}
364
365
366//_____________________________________________________________________________
368{
369 // Print info about this optical surface
370 if (!fNode1 || !fNode2) {
371 Error("Print", "Border surface %s: nodes not set", GetName());
372 return;
373 }
374 printf("*** bordersurface: %s surfaceproperty: %s physvolref: %s %s \n", GetName(), GetTitle(),
376}
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
This class is used in the process of reading and writing the GDML "matrix" tag.
Definition TGDMLMatrix.h:33
TGeoNode const * fNode2
TGeoNode const * fNode1
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
Double_t GetProperty(const char *name, Bool_t *error=nullptr) const
Get a user-defined property.
TGDMLMatrix * GetGDMLMatrix(const char *name) const
Get GDML matrix with a given name;.
static ESurfaceType StringToType(const char *type)
bool AddProperty(const char *property, const char *ref)
static const char * ModelToString(ESurfaceModel model)
static const char * TypeToString(ESurfaceType type)
const char * GetConstPropertyRef(const char *property) const
static ESurfaceFinish StringToFinish(const char *finish)
TGDMLMatrix * GetProperty(const char *name) const
static const char * FinishToString(ESurfaceFinish finish)
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
bool AddConstProperty(const char *property, const char *ref)
Double_t GetConstProperty(const char *property, Bool_t *error=nullptr) const
static ESurfaceModel StringToModel(const char *model)
const char * GetPropertyRef(const char *property)
TGeoVolume const * fVolume
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:575
void Add(TObject *obj) override
Definition TList.h:81
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:354
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
TNamed()
Definition TNamed.h:38
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1099
Basic string class.
Definition TString.h:138