Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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:
25  TGeoRegionCut() {}
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:
42  TGeoRegion() {}
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