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 l3CoordinateTransformer
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 #ifndef TRG_VERSION
15 #define TRG_VERSION 0x32
16 #endif
17 
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <math.h>
22 
23 #include "l3Coordinates.h"
24 #include "l3CoordinateTransformer.h"
25 
26 #include "sizes.h"
27 #include "daqFormats.h"
28 //#include "trgStructures.h"
29 
30 #include "l3TrgReader.h"
31 
32 //#include "l3GeneralHeaders.h"
33 #include "FtfGeneral.h"
34 #include "gl3Track.h"
35 #include "gl3Hit.h"
36 #include "gl3Sector.h"
37 #include "FtfPara.h"
38 #include "gl3LMVertexFinder.h"
39 #include "gl3Histo.h"
40 
41 #include "gl3EMC.h"
42 #ifdef OLD_DAQ_READER
43 #include <evpReader.hh>
44 #else /* OLD_DAQ_READER */
45 #include <DAQ_READER/daqReader.h>
46 #endif /* OLD_DAQ_READER */
47 #include "sizes.h"
48 
49 #define GL3_READ_TPC_TRACKS 0x01
50 #define GL3_READ_TPC_CLUSTERS 0x02
51 #define GL3_READ_ALL 0xffff
52 
53 class gl3Event {
54  public:
55 
57  l3EmcCalibration* inBemcCalibint,
58  l3EmcCalibration* inEemcCalibint,
59  int mxHits=szGL3_default_mHits, int mxTracks=szGL3_default_mTracks);
60 
61  ~gl3Event( );
62 
63  int setup ( int mHits=szGL3_default_mHits, int mTracks = szGL3_default_mTracks);
64  int resetEvent ( );
65 
66  // bField is taken from the datafile
67  // if the datafile sc bank is invalid,
68  // defaultbField is used.
69  //
70  // if bField is set != 1000
71  // then it overrides the value in the datafile
72  //
73  int readFromEvpReader(daqReader *rdr,
74  float bField=1000);
75 
76  void readClustersFromEvpReader(daqReader *rdr, int sector);
77  int readITPCClustersFromEvpReader(daqReader *rdr, int sector);
78 
79  int sectorFirstHit[25];
80 
81  short getBusy ( ) { return busy; };
82  gl3Track* getTrack ( int n );
83  gl3Hit* getHit ( int n );
84  gl3Sector* getSector ( int n );
85 
86  int getNTracks ( ) { return nTracks; };
87  int getNMergedTracks ( ) { return nMergedTracks; };
88  int getNBadTracks ( ) { return nBadTracks; };
89  int getNHits ( ) { return nHits ; };
90 
91  l3TrgReader *getTrgData() { return &trgData; };
92 
93  l3xyzCoordinate getVertex() {return vertex;};
94  l3xyzCoordinate getLMVertex() {return lmVertex;};
95 
96  l3CoordinateTransformer* getCoordinateTransformer()
97  { return coordinateTransformer; };
98 
99  int getTrgCmd();
100  int getTrgWord();
101  int getCTB(int n);
102  int getZDC(int n);
103  double getZDCVertex();
104 
105  int getToken() { return trgData.token; };
106  void setToken(int tk) {trgData.token = tk;};
107 
108 
109  unsigned int getBXingLo();
110  unsigned int getBXingHi();
111  unsigned long long getBXing();
112 
113  void setHitProcessing ( int hitPro ) { hitProcessing = hitPro; };
114  void setVertexFinderMethod ( int _in ) { vertexFinder = _in; };
115  void setLMVertexFinder ( gl3LMVertexFinder* _in ) { lmv = _in; };
116 
117  void setMaxSectorNForTrackMerging ( int _in )
118  { maxSectorNForTrackMerging = _in; };
119 
120  void setBField ( float _bField )
121  {
122  para.bField = fabs(_bField);
123  para.bFieldPolarity = int(_bField/fabs(_bField));
124  };
125 
126  void setCoordinateTransformer ( l3CoordinateTransformer* in )
127  { coordinateTransformer = in; };
128 
129 
130  //int readEventDescriptor ( EventDescriptor *descr);
131  int readL3Data (L3_P* buffer);
132 
133 /* #if ( FORMAT_VERSION == 0x12 ) */
134 /* int readEventDescriptor ( EventDescriptor *descr); */
135 /* int readTrgData (TrgSumData* trgSum, RawTrgDet* rawTrg); */
136 /* #elif ( FORMAT_VERSION == 0x20 ) */
137 /* int readEventDescriptor ( EvtDescData *descr); */
138 /* int readTrgData (TrgSumData* trgSum, RawTrgDet* rawTrg); */
139 /* #endif */
140 
141  int finalizeReconstruction();
142 
143  int readSectorHits ( char* buffer, int nSectorTracks );
144  int readSectorTracks ( char* buffer );
145 
146 
147  void addTracks ( short sector, int nTracks, local_track* track );
148  int makeVertex ();
149 
150  int fillTracks ( int maxBytes, char* buffer, unsigned int token );
151 
152  int nMergableTracks;
153 
154  gl3EMC emc;
155 
156  public:
157 
158  // ############################################################
159  // # Control parameters
160  // ############################################################
161  int hitProcessing; // 0=does read hits
162  // 1=reassigns trackId in hits to
163  // pass that info downstream
164  // 2=full hit unpacking for module use
165 
166  int vertexFinder; // which vertex finder to run:
167  // 0: none
168  // 1: default (internal) (author: Jens Berger)
169  // 2: low mult vertex finder (author: Jan
170  // Balewski)
171  // 3: both
172 
173 
174  // Parameters for the internal vertex finder (Jens Berger)
175  int minNoOfHitsOnTrackUsedForVertexCalc;
176  double minMomUsedForVertexCalc;
177 
178 
179  // ############################################################
180  // # Data structures
181  // ############################################################
182 
183  gl3Hit* hit;
184  gl3Track* track;
185  int* trackIndex; // to keep track of relationship between
186  // orig. tracks and final tracks
187  int busy;
188  int maxSectorNForTrackMerging;
189  int maxTracks;
190  int maxTracksSector;
191  int nTracks;
192  int maxHits;
193  int nHits;
194  int nMergedTracks;
195  int nBadTracks;
196 
197  // trigger
198 /* struct { */
199 /* int token; */
200 /* unsigned int trgCmd; */
201 /* unsigned int trgWord; */
202 /* unsigned int ZDC[16]; */
203 /* unsigned int CTB[256]; */
204 /* unsigned int bx_hi, bx_lo; */
205 /* } trgData; */
206 
207  l3TrgReader trgData;
208 
209  // vertex calc results
210  l3xyzCoordinate vertex, lmVertex;
211 
212  // ############################################################
213  // # Other stuff
214  // ############################################################
215 
216  FtfPara para;
217  FtfContainer* trackContainer;
218  gl3Sector sectorInfo[24];
219 
220  // histos used for the vertex determination
221  gl3Histo* hVz ;
222  gl3Histo* hVx ;
223  gl3Histo* hVy ;
224 
225  // Helper objects
226  l3CoordinateTransformer* coordinateTransformer;
227  gl3LMVertexFinder *lmv;
228 
229  static const int nSectors = 24;
230 
231 };
232 #endif
233 
int readFromEvpReader(daqReader *rdr, float bField=1000)
Definition: gl3Event.cxx:31
Definition: gl3Hit.h:24
Definition: gl3EMC.h:54