Logo ROOT   6.14/05
Reference Guide
TGeoRegion.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 18/10/17
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TGeoRegion
12 #define ROOT_TGeoRegion
13 
14 #include "TNamed.h"
15 
16 #include "TObjArray.h"
17 
18 #include "TGeoVolume.h"
19 
20 class TGeoRegionCut : public TNamed {
21 protected:
22  Double_t fCut{0.}; // Cut value
23 
24 public:
26  TGeoRegionCut(const char *name, Double_t cut) : TNamed(name, ""), fCut(cut) {}
27 
28  virtual ~TGeoRegionCut() {}
29 
30  Double_t GetCut() const { return fCut; }
31  void SetCut(Double_t cut) { fCut = cut; }
32 
33  ClassDef(TGeoRegionCut, 1) // A region cut
34 };
35 
36 class TGeoRegion : public TNamed {
37 protected:
38  TObjArray fVolumes; // list of volumes in this region
39  TObjArray fCuts; // list of cuts for the region
40 
41 public:
43  TGeoRegion(const char *name, const char *title = "") : TNamed(name, title) {}
44  TGeoRegion(const TGeoRegion &other);
45  TGeoRegion &operator=(const TGeoRegion &other);
46  virtual ~TGeoRegion();
47 
48  // Volume accessors
49  void AddVolume(TGeoVolume *vol) { fVolumes.Add(vol); }
50  bool AddVolume(const char *name);
51  int GetNvolumes() const { return fVolumes.GetEntriesFast(); }
52  TGeoVolume *GetVolume(int i) const { return (TGeoVolume *)fVolumes.At(i); }
53 
54  // Cuts accessors
55  void AddCut(const char *name, Double_t cut);
56  void AddCut(const TGeoRegionCut &regioncut);
57  int GetNcuts() const { return fCuts.GetEntriesFast(); }
58  TGeoRegionCut *GetCut(int i) const { return (TGeoRegionCut *)fCuts.At(i); }
59 
60  virtual void Print(Option_t *option = "") const; // *MENU*
61 
62  ClassDef(TGeoRegion, 1) // Region wrapper class
63 };
64 
65 #endif
An array of TObjects.
Definition: TObjArray.h:37
void SetCut(Double_t cut)
Definition: TGeoRegion.h:31
TObjArray fCuts
Definition: TGeoRegion.h:39
Double_t GetCut() const
Definition: TGeoRegion.h:30
const char Option_t
Definition: RtypesCore.h:62
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
TGeoRegionCut * GetCut(int i) const
Definition: TGeoRegion.h:58
Double_t fCut
Definition: TGeoRegion.h:22
TObject * At(Int_t idx) const
Definition: TObjArray.h:165
#define ClassDef(name, id)
Definition: Rtypes.h:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual ~TGeoRegionCut()
Definition: TGeoRegion.h:28
int GetNcuts() const
Definition: TGeoRegion.h:57
virtual void Print(Option_t *option="") const
Print TNamed name and title.
Definition: TNamed.cxx:128
TGeoRegion(const char *name, const char *title="")
Definition: TGeoRegion.h:43
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:51
Regions are groups of volumes having a common set of user tracking cuts.
Definition: TGeoRegion.h:36
int GetNvolumes() const
Definition: TGeoRegion.h:51
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
TObjArray fVolumes
Definition: TGeoRegion.h:38
TGeoVolume * GetVolume(int i) const
Definition: TGeoRegion.h:52
double Double_t
Definition: RtypesCore.h:55
void AddVolume(TGeoVolume *vol)
Definition: TGeoRegion.h:49
TGeoRegionCut(const char *name, Double_t cut)
Definition: TGeoRegion.h:26
void Add(TObject *obj)
Definition: TObjArray.h:73
char name[80]
Definition: TGX11.cxx:109