StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gl3Event.h
1 //:>------------------------------------------------------------------
2 //: FILE: gl3Event.h
3 //: HISTORY:
4 //: 3dec1999 version 1.00
5 //: 3feb2000 add sector to addTracks of type 3
6 //: 6jul2000 add St_l3_Coordinate_Transformer
7 //: 17jul2000 move glR3HistoContainer to gl3Conductor
8 //: 10aug2000 remove bField, to be kept in one place only (in FtfPara para)
9 //: 13aug2000 replace trackMerging with maxSectorNForTrackMerging
10 //:<------------------------------------------------------------------
11 #ifndef GL3EVENT
12 #define GL3EVENT
13 
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <string.h>
17 #include <math.h>
18 
19 /* #include <sys/types.h> */
20 /* #include <netinet/in.h> */
21 /* #include <sys/socket.h> */
22 /* #include <sys/wait.h> */
23 /* #include <unistd.h> */
24 /* #include <fcntl.h> */
25 
26 #include "Stl3Util/base/St_l3_Coordinates.h"
27 #include "Stl3Util/base/St_l3_Coordinate_Transformer.h"
28 
29 // DIFFERENT INCLUDE STATEMENTS FOR ON-/OFFLINE
30 
31 // online
32 //#include "daqFormats.h"
33 //#include "trgStructures.h"
34 
35 // offline
36 #include "Stl3Util/foreign/daqFormats.h"
37 #include "StDaqLib/TRG/trgStructures.h"
38 
39 //#include "l3GeneralHeaders.h"
40 #include "Stl3Util/ftf/FtfGeneral.h"
41 #include "Stl3Util/ftf/FtfPara.h"
42 
43 #include "Stl3Util/gl3/gl3Track.h"
44 #include "Stl3Util/gl3/gl3Hit.h"
45 #include "Stl3Util/gl3/gl3Sector.h"
46 #include "Stl3Util/gl3/gl3Histo.h"
47 
48 
49 
50 class gl3Event {
51  public:
52 
53  gl3Event(int mxHits=500000, int mxTracks=20000,
54  St_l3_Coordinate_Transformer* inTrans=0 );
55 
56  ~gl3Event( );
57 
58  int setup ( int mHits=600000, int mTracks = 20000 );
59  int resetEvent ( );
60 
61  short getBusy ( ) { return busy; };
62  gl3Track* getTrack ( int n );
63  gl3Hit* getHit ( int n );
64  gl3Sector* getSector ( int n );
65 
66  int getNTracks ( ) { return nTracks; };
67  int getNMergedTracks ( ) { return nMergedTracks; };
68  int getNBadTracks ( ) { return nBadTracks; };
69  int getNHits ( ) { return nHits ; };
70 
71  St_l3_xyz_Coordinate getVertex() {return vertex;};
72 
73  St_l3_Coordinate_Transformer* getCoordinateTransformer()
74  { return coordinateTransformer; };
75 
76  int getTrgCmd();
77  int getTrgWord();
78  int getCTB(int n);
79  int getZDC(int n);
80 
81  void setHitProcessing ( int hitPro )
82  { hitProcessing = hitPro; };
83 
84  void setMaxSectorNForTrackMerging ( int _in )
85  { maxSectorNForTrackMerging = _in; };
86 
87  void setBField ( float _bField )
88  {
89  para.bField = _bField;
90  para.bFieldPolarity = int(_bField/fabs(_bField));
91  };
92 
93  void setCoordinateTransformer ( St_l3_Coordinate_Transformer* in )
94  { coordinateTransformer = in; };
95 
96  int readEventDescriptor ( EventDescriptor *descr);
97  int readL3Data (L3_P* buffer);
98  int readTrgData (TrgSumData* trgSum, RawTrgDet* rawTrg);
99 
100  int readSectorHits ( char* buffer, int nSectorTracks );
101  int readSectorTracks ( char* buffer );
102  void addTracks ( short sector, int nTracks, local_track* track );
103  void makeVertex ();
104 
105  int fillTracks ( int maxBytes, char* buffer, unsigned int token );
106 
107  int nMergableTracks;
108 
109 
110 private:
111  static const int NSECTORS = 24;
112 
113  int hitProcessing; // 0=does read hits
114  // 1=reassigns trackId in hits to
115  // pass that info downstream
116  // 2=full hit unpacking for module use
117  gl3Hit* hit;
118  gl3Track* track;
119  int* trackIndex; // to keep track of relation ship between
120  // orig. tracks and final tracks
121  int busy;
122  int maxSectorNForTrackMerging;
123  int maxTracks;
124  int maxTracksSector;
125  int nTracks;
126  int maxHits;
127  int nHits;
128  int nMergedTracks;
129  int nBadTracks;
130 
131  struct trgDataType {
132  int trgCmd;
133  int trgWord;
134  int ZDC[16];
135  int CTB[240];
136  } trgData;
137 
138 
139  St_l3_Coordinate_Transformer* coordinateTransformer;
140 
141  FtfPara para;
142  FtfContainer* trackContainer;
143  gl3Sector sectorInfo[NSECTORS];
144 
145  // ******************************************************************
146  // ol'fuckin vertex stuff
147  // JB 07/03/01
148  // ******************************************************************
149 
150  int minNoOfHitsOnTrackUsedForVertexCalc;
151  double minMomUsedForVertexCalc;
152 
153  // nice weighted mean helper function, cause we DON'T want to fit!
154  double getWeightedMean(gl3Histo* hist, double sigmaWidthBins);
155 
156  // histos used for the vertex determination
157  gl3Histo* hVz ;
158  gl3Histo* hVx ;
159  gl3Histo* hVy ;
160 
161  // 3d coordinate
163 };
164 #endif
165 
Definition: gl3Hit.h:24