StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StuPostScript.h
1 /***************************************************************************
2  *
3  * $Id: StuPostScript.h,v 1.6 2003/09/02 17:58:09 perev Exp $
4  *
5  * Author: Thomas Ullrich, April 2002
6  ***************************************************************************
7  *
8  * Description: PostScript Event Display
9  * The class has only one public static methods write()
10  * which produces an encapsulated PostScript (EPS) file.
11  * There are various options available.
12  *
13  * Syntax:
14  * #include "StuPostScript.h"
15  *
16  * bool StuPostScript::write(const char* filename, const StEvent* event);
17  * bool StuPostScript::write(const char* filename, const StEvent* event,
18  * const char* options);
19  * bool StuPostScript::write(const char* filename, const StEvent* event,
20  * const char* options,
21  * vector<StTrack*>* userTracks);
22  *
23  * filename: the name of the PostScript file. The extension should
24  * be always '.eps'.
25  * event: pointer to an event.
26  * options: character string with options (see below).
27  * userTracks: optional vector of pointers to tracks.
28  * If present only those tracks stored in the vector
29  * are plotted. Note that 'event' is still needed.
30  * This option allows to select and print only certain
31  * tracks.
32  * Return Code: StuPostScript::write() return 'true' if successful
33  * otherwise 'false'.
34  *
35  * Options (case sensitive):
36  * b Black background, white frame.
37  * Otherwise the frame is drawn in black and the
38  * background is white.
39  * p Draw beampipe.
40  * c Use 3 colors to color tracks according to their pt.
41  * red pt>1 GeV/c, green 0.5<pt<1 GeV/c, blue<0.5 GeV/c
42  * C Use color spectra to color tracks according to their.
43  * Blue lowest pt, red highest pt.
44  * f Track drawn with fewer points (factor 4 less).
45  * Helices are approximated by a line trough many points.
46  * With fewer points the helices become slightly more
47  * chiseled but files get considerable smaller.
48  * Still sufficient for most cases.
49  * t Add text (event, run number, trigger etc.) to the plot.
50  * a Plot all global tracks.
51  * Without this option short tracks
52  * (<10 points) get suppressed.
53  * s Plot sideview (zy)
54  * Default is front view (xy)
55  * h Show hits on tracks (circles)
56  * H Show all hits (squares & circles)
57  * Hits on tracks are drawn as circles
58  * otherwise as squares
59  *
60  * StuPostScript writes PS without a dictionary. This makes the produced
61  * files slightly bigger but the code easier to maintain.
62  *
63  * Known Problems: The side view and text are not compatible. It works
64  * but doesn't look nice.
65  ***************************************************************************
66  *
67  * $Log: StuPostScript.h,v $
68  * Revision 1.6 2003/09/02 17:58:09 perev
69  * gcc 3.2 updates + WarnOff
70  *
71  * Revision 1.5 2002/10/11 17:34:15 ullrich
72  * Hits on tracks drawn as circles not diamonds
73  *
74  * Revision 1.4 2002/06/25 02:43:24 ullrich
75  * Added drawing of hits.
76  *
77  * Revision 1.3 2002/04/23 17:26:52 ullrich
78  * More description.
79  *
80  * Revision 1.2 2002/04/23 17:17:10 ullrich
81  * More description.
82  *
83  * Revision 1.1 2002/04/23 03:15:28 ullrich
84  * Initial Revision.
85  *
86  **************************************************************************/
87 #include "StEventTypes.h"
88 #include <Stiostream.h>
89 #include "Stiostream.h"
90 #include <vector>
91 
93 public:
94  StuPostScript();
95  virtual ~StuPostScript();
96 
97  static bool write(const char*, const StEvent*, const char* = 0, vector<StTrack*>* = 0);
98 
99 protected:
100  static void writeHeader(ostream&, const char*);
101  static void writeTrailor(ostream&);
102  static void writeDetectorFrame(ostream&);
103  static void writeTracks(ostream&, const StEvent*);
104  static void writeText(ostream&, const StEvent*);
105  static void writeHits(ostream&, const StEvent*);
106  static void hls2rgb(double, double, double, double&, double &, double &);
107 
108  static bool mBlackBackground;
109  static bool mDrawBeamPipe;
110  static bool mTracksWithManyColors;
111  static bool mTracksWithFewColors;
112  static bool mFewerPointsPerTrack;
113  static bool mAddText;
114  static bool mAllGlobalTracks;
115  static bool mSideView;
116  static bool mShowTrackHits;
117  static bool mShowAllHits;
118  static const int mllx;
119  static const int mlly;
120  static const int murx;
121  static const int mury;
122  static const int mMinFitPoints;
123 
124  static vector<StTrack*> *mUserTracks;
125 };