GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LevelScheme.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef GW_LEVELSCHEME_H
24 #define GW_LEVELSCHEME_H
25 #define Gw_LevelScheme GW_LEVELSCHEME_H
26 
27 #ifndef ROOT_TBits
28 #include "TBits.h"
29 #endif
30 
31 #ifndef ROOT_TObject
32 #include <TObject.h>
33 #endif
34 
35 #ifndef ROOT_TList
36 #include <TList.h>
37 #endif
38 
39 #ifndef ROOT_TLatex
40 #include <TLatex.h>
41 #endif
42 
43 #include "GwLogMessage.h"
44 
45 #ifndef GW_LEVEL_H
46 #include "Level.h"
47 #endif
48 
49 #ifndef GW_LINK_H
50 #include "Link.h"
51 #endif
52 
53 #ifndef GW_CASCADE_H
54 #include "Cascade.h"
55 #endif
56 
57 #include <map>
58 
59 class TArrow;
60 namespace Gw {
61 
62  class BaseLevelSchemeReader;
63  class BaseLSPlayer;
82 class LevelScheme : public TObject
83 {
84  friend class BaseLevelSchemeReader;
85  friend class BaseLSPlayer;
86 
87 private:
88 
89  Link* fCLink;
90  Level* fCLevel;
91  Cascade* fCCascade;
92 
93  std::map <Int_t, TBits*> fCoincMap; // map of gamma coincidence
94 
95 
96 protected:
97  TList fLevels; // list of levels
98  TList fLinks; // list of links
99  TList fCascades; // list of cascades
100 
101  TLatex fName; // LevelScheme's name
102  TLatex fReference; // some information concerning the origin of this level scheme
103  TList fTexts; // a list of additional TLatex text to add some comments on the level scheme
104  TList fArrows; // a list of additional TArrow to add some arrows on the level scheme
105 
107 
108 protected:
109 
111  void AddLevel(Level* level);
112 
114  void AddLink(Link* link);
115 
117  void AddCascade(Cascade* Cascade);
118 
120  void AddText(TLatex* latex);
121 
123  void AddArrow(TArrow* arrow);
124 
126  TList& GetLevelList() { return fLevels; }
128  TList& GetLinkList() { return fLinks; }
130  TList& GetCascadeList() { return fCascades; }
132  TList& GetTextList() { return fTexts; }
134  Link* GetCurrentLink() { return fCLink; }
136  Level* GetCurrentLevel() { return fCLevel; }
138  Cascade* GetCurrentCascade() { return fCCascade; }
140  TLatex& GetNameLatex() { return fName; }
142  TLatex& GetRefLatex() { return fReference; }
143 
145  virtual void FillMap();
146 
147 public:
148  LevelScheme();
149  LevelScheme(const Char_t *, Option_t *);
150  virtual ~LevelScheme();
151 
152  virtual void Browse(TBrowser *b);
153 
155  virtual void SetName(const Char_t* name); //*MENU* *ARGS={name=>fName}
156  virtual const char* GetName() const;
158  virtual void SetReference(const Char_t *);
159  virtual const Char_t * GetReference() const;
160 
162  Level* NewLevel(const char* name);
163 
165  Link* NewLink(const char* name);
166 
168  Cascade* NewCascade(const char* name);
169 
171  TLatex* NewText(const char* msg);
172 
174  TArrow* NewArrow(Float_t x1, Float_t y1, Float_t x2, Float_t y2);
175 
177  const TList & GetLevels();
179  const TList & GetLinks();
181  const TList & GetCascades();
183  const TList & GetTexts();
184 
186  void SetCLink(Link* link) { fCLink = link; }
187 
189  const Link* GetCLink() { return fCLink; }
190 
192  void SetCLevel(Level* level) { fCLevel = level; }
193 
195  const Level* GetCLevel() { return fCLevel; }
196 
198  void SetCCascade(Cascade* cascade) { fCCascade = cascade; }
199 
201  const Cascade* GetCCascade() { return fCCascade; }
202 
204  BaseLSPlayer* GetPlayer(Option_t* opt="Graphical");
205 
207 
220  virtual Int_t InitAGS(const Char_t *filename, Option_t *opt = "152Dy");
221 
223 
236  virtual Int_t InitENSDF(const Char_t *, Option_t *);
237 
239 
254  virtual Int_t Import(const Char_t *, Option_t *);
255 
256  virtual void Clear(Option_t *opt = "");
257 
259  virtual void Draw(Option_t *opt = "");
260 
262  virtual void ls(Option_t* option = "all") const ;
263 
265  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
266 
268  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
269 
271  virtual TList* FindLinkInCascade(Link* link) const;
272 
274  virtual TList* FindCLinkInCascade() const;
275 
277  virtual const TList* FindLink(Level* level) const;
278 
280  virtual void SortLevels(Bool_t order = kSortAscending) { fLevels.Sort(order); }
281 
283  virtual TBits* GetBitMap(Link* link);
284 
285 protected:
286 
287  mutable LogMessage fLog;
288 
289 
291  ClassDef(LevelScheme,4); // a level scheme is a list of levels, links and cascades
292 };
293 // inline members
294 inline const TList & LevelScheme::GetLevels() { return fLevels;}
295 inline const TList & LevelScheme::GetLinks() { return fLinks; }
296 inline const TList & LevelScheme::GetCascades() { return fCascades; }
297 inline const TList & LevelScheme::GetTexts() { return fTexts; }
298 inline void LevelScheme::SetName(const Char_t *name) { fName.SetTitle(name); }
299 inline void LevelScheme::SetReference(const Char_t *ref) { fReference.SetTitle(ref); }
300 inline const Char_t * LevelScheme::GetName() const { return fName.GetTitle(); }
301 inline const Char_t * LevelScheme::GetReference() const { return fReference.GetTitle(); }
302 }
303 #endif
A level Scheme.
Definition: LevelScheme.h:82
TLatex & GetNameLatex()
to get Name latex object
Definition: LevelScheme.h:140
TBrowser * b
TList & GetTextList()
to get the list of additional comments
Definition: LevelScheme.h:132
void SetCCascade(Cascade *cascade)
set current cascade
Definition: LevelScheme.h:198
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance to object.
virtual void ls(Option_t *option="all") const
list levels/links
A BaseLevelSchemeReader class to read level scheme files.
virtual TList * FindCLinkInCascade() const
Find the cascades that own the currengt link.
A cascade is a list of links.
Definition: Cascade.h:51
virtual void Browse(TBrowser *b)
virtual Int_t InitAGS(const Char_t *filename, Option_t *opt="152Dy")
BETTER TO USE Import - To init this level scheme with a Radford AGS file.
virtual void Draw(Option_t *opt="")
to draw this level scheme
Level * NewLevel(const char *name)
create new level
const Link * GetCLink()
get current link
Definition: LevelScheme.h:189
virtual TList * FindLinkInCascade(Link *link) const
Find the cascades that own that link.
void SetCLevel(Level *level)
set current level
Definition: LevelScheme.h:192
const Cascade * GetCCascade()
get current cascade
Definition: LevelScheme.h:201
virtual Int_t Import(const Char_t *, Option_t *)
to init this level scheme from an existing formatted file (ENSDF, Radware ..)
BaseLSPlayer * fPlayer
Definition: LevelScheme.h:106
virtual void SetName(const Char_t *name)
set level scheme name.
Definition: LevelScheme.h:298
Base class for a Log message.
Definition: GwLogMessage.h:94
virtual const char * GetName() const
Definition: LevelScheme.h:300
Cascade * GetCurrentCascade()
get current cascade
Definition: LevelScheme.h:138
const TList & GetLinks()
to get the list of links
Definition: LevelScheme.h:295
virtual void Clear(Option_t *opt="")
header file for GwLogMessage.cpp
virtual const Char_t * GetReference() const
Definition: LevelScheme.h:301
const TList & GetTexts()
to get the list of additional comments
Definition: LevelScheme.h:297
TArrow * NewArrow(Float_t x1, Float_t y1, Float_t x2, Float_t y2)
create new arrow
virtual Int_t InitENSDF(const Char_t *, Option_t *)
BETTER TO USE Import - To init this level scheme with a ENSDF file.
LogMessage fLog
Definition: LevelScheme.h:287
Level * GetCurrentLevel()
get current level
Definition: LevelScheme.h:136
const TList & GetCascades()
to get the list of cascades
Definition: LevelScheme.h:296
header file for a general Level
virtual ~LevelScheme()
void AddLevel(Level *level)
level scheme player pointer
void AddText(TLatex *latex)
Add text.
ClassDef(LevelScheme, 4)
log message
header file for a Cascade
void AddLink(Link *link)
Add link.
virtual void SortLevels(Bool_t order=kSortAscending)
Sort levels level.
Definition: LevelScheme.h:280
Cascade * NewCascade(const char *name)
create new cascade
Link * NewLink(const char *name)
create new level
TLatex & GetRefLatex()
to get ref latex object
Definition: LevelScheme.h:142
TList & GetLevelList()
to get the list of levels
Definition: LevelScheme.h:126
const Level * GetCLevel()
get current level
Definition: LevelScheme.h:195
void AddCascade(Cascade *Cascade)
Add cascade.
void AddArrow(TArrow *arrow)
Add arrow.
Link * GetCurrentLink()
get current link
Definition: LevelScheme.h:134
const TList & GetLevels()
to get the list of levels
Definition: LevelScheme.h:294
virtual void SetReference(const Char_t *)
set level scheme reference.
Definition: LevelScheme.h:299
TList & GetCascadeList()
to get the list of cascades
Definition: LevelScheme.h:130
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
to execute an event for this level scheme
virtual TBits * GetBitMap(Link *link)
get bit map coincidence above a given link
void SetCLink(Link *link)
set current link
Definition: LevelScheme.h:186
BaseLSPlayer * GetPlayer(Option_t *opt="Graphical")
Get player.
virtual const TList * FindLink(Level *level) const
Find links attached to level.
TLatex * NewText(const char *msg)
create new text
virtual void FillMap()
Fill map of coincidence.
BaseLSPlayer to work on level scheme.
Definition: BaseLSPlayer.h:106
TList & GetLinkList()
to get the list of links
Definition: LevelScheme.h:128
Base class describing a general level.
Definition: Level.h:53