StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
LaserEvent.h
1 //$Id: LaserEvent.h,v 1.10 2014/03/13 21:59:44 fisyak Exp $
2 //$Log: LaserEvent.h,v $
3 //Revision 1.10 2014/03/13 21:59:44 fisyak
4 //add cluster position in Local Sector Coordinate System
5 //
6 //Revision 1.9 2014/02/13 18:21:28 fisyak
7 //Add protection against cicling in fitting
8 //
9 //Revision 1.8 2011/05/27 18:25:32 genevb
10 //Propagate StTrack::key => Int_t to other codes
11 //
12 //Revision 1.7 2008/06/02 13:48:03 fisyak
13 //Add t0 handlers for Tpx/Tpc time offsets
14 //
15 //Revision 1.6 2007/12/10 19:54:02 fisyak
16 //Add Id and Log, correct spelling error in README
17 //
18 #ifndef Laser_Event
19 #define Laser_Event
20 // //
22 // LaserEvent //
23 // //
24 // Description of a TTree file for Laser Event analysis //
25 // Works also for Cosmic Ray data //
26 // Each event has a header and TClonesArrays of tracks
27 // hits that are on tracks carry the track Id and some track properties //
28 // //
30 
31 #include "TObject.h"
32 #include "TClonesArray.h"
33 #include "TMath.h"
34 #include "LaserBeams.h"
35 #include "Stiostream.h"
36 #include "StThreeVectorF.hh"
37 #include "StHelixModel.h"
38 #include "StDcaGeometry.h"
39 #include "TString.h"
40 #include "TGeoMatrix.h"
41 #if defined(__CINT__) || defined(__CLING__)
42 class StPrimaryVertex;
43 class StTrack;
44 class StTpcHit;
45 #else
46 #include "StPrimaryVertex.h"
47 #include "StTrack.h"
48 #include "StTpcHit.h"
49 #endif
50 class LaserRaft : public TObject {
51  public:
52  LaserRaft() {}
53  Int_t Sector, Raft, Bundle, Mirror;
54  StThreeVectorD XyzL, dirL; // in TPC
55  StThreeVectorD XyzU, dirU; // in Raft
56  StThreeVectorD XyzB, dirB; // in Bundle
57 
58  Double_t Theta, Phi; // [rad]
59  // Double_t psi, dpsi, tanl, dtanl, xl, dxL, yl, dyL, zl, dzl;
60  Char_t *Name;
61  virtual void Print(const Option_t* opt="") const {
62  if (opt) {}
63  cout << Form("Raft:%2i,%2i,%1i,%1i,%9.4f,%9.4f",
64  Sector, Raft, Bundle, Mirror, Theta, Phi) << endl;
65  cout << " XyzL: " << XyzL << " U: " << XyzU << " B: " << XyzB << endl;
66  cout << " dirL: " << dirL << " U: " << dirU << " B: " << dirB << endl;
67  }
68  ClassDef(LaserRaft,1)
69 };
70 class FitDV : public TObject {
71  public:
72  FitDV() {Clear();}
73  virtual ~FitDV() {}
74  void Clear(Option_t *opt="") {if (opt) {}; memset(first, 0, last - first); chisq = -1;}
75  Char_t first[1];
76  Int_t N;
77  Int_t Sector;
78  Int_t Bundle[42];
79  Int_t Mirror[42];
80  Double32_t offset;
81  Double32_t slope;
82  Double32_t doffset;
83  Double32_t dslope;
84  Double32_t chisq;
85  Double32_t X[42];
86  Double32_t Y[42];
87  Double32_t Prob;
88  Int_t ndf;
89  Int_t Flag[42];
90  Char_t last[1];
91  virtual void Print(const Option_t* opt="") const {
92  if (opt) {}
93  cout << Form("FitDV:%5i,%2i,%9.4f,%9.4f,%9.4f,%9.4f,%9.4f",
94  N, Sector, offset, slope, doffset, dslope, chisq)
95  << endl;
96 
97  }
98  ClassDef(FitDV,1)
99 };
100 
101 class LaserB {
102  public:
103  LaserB(const LaserRaft &laser);
104  LaserB() : IsValid(1), Sector(0), Raft(0), Bundle(0), Mirror(0),
105  Theta(0), Phi(0), ThetaG(0), PhiG(0) {}
106  virtual ~LaserB() {}
107  Int_t IsValid;
108  Int_t Sector, Raft, Bundle, Mirror;
109  StThreeVectorD XyzG; // [cm] in GCS
110  StThreeVectorD XyzL; // [cm] in TPC
111  StThreeVectorD XyzS; // [cm] in TPC super Sector
112  StThreeVectorD XyzU; // [cm] in raft
113  StThreeVectorD XyzB; // [cm] in bundle
114  StThreeVectorD dirG;
115  StThreeVectorD dirL;
116  StThreeVectorD dirS;
117  StThreeVectorD dirU;
118  StThreeVectorD dirB;
119  Double_t Theta, Phi;
120  Double_t ThetaG, PhiG; // in GCS
121  virtual void Print(const Option_t* opt="") const {
122  if (opt) {}
123  cout << "LaserB:" << IsValid << " S/R/B/M = " << Sector << "/" << Raft << "/" << Bundle << "/" << Mirror
124  << " xyz B:" << XyzB << " U: " << XyzU << " L: " << XyzL << " G: " << XyzG << endl;
125  cout << "\tdir B:" << dirB << " U: " << dirU << " L: " << dirL << " G: " << dirG << endl;
126  cout << "\tTheta L: " << Theta << " G: " << ThetaG << " Phi L: " << Phi << " G: " << PhiG
127  << endl;
128  }
129  ClassDef(LaserB,3)
130 };
131 
132 class EventHeader {
133 
134  public:
135  Int_t fEvtNum;
136  Int_t fRun;
137  Int_t fDate;
138  Int_t fTime;
139  Float_t ftZero;
140  Float_t fDriVel;
141  public:
142  Float_t fDriVelWest;
143  Float_t fDriVelEast;
144  public:
145  Float_t fClock;
146  Float_t fTrigger;
147  Float_t fDriftDistance;
148  Float_t fInnerSectorzOffset;
149  Float_t fOuterSectorzOffset;
150  Float_t ftriggerTimeOffset;
151  Float_t fOnlClock;
152  Float_t fBField;
153  public:
154  Float_t fScaleY;
155 public:
156  EventHeader() : fEvtNum(0), fRun(0), fDate(0), fTime(0), fOnlClock(0), fBField(0), fScaleY(0) { }
157  virtual ~EventHeader() { }
158  void Set(Int_t i, Int_t r, Int_t d, Int_t t) { fEvtNum = i; fRun = r; fDate = d; fTime = t; }
159  void SetE(Float_t tz, Float_t dv, Float_t ck) {
160  ftZero = tz; fDriVel = dv; fClock = ck; }
161  void SetE(Float_t tz, Float_t dv, Float_t ck, Float_t tg) {
162  ftZero = tz; fDriVel = dv; fClock = ck; fTrigger = tg; }
163  void SetDriftDistance(Double_t p) {fDriftDistance = p;}
164  void SetInnerSectorzOffset(Double_t p) {fInnerSectorzOffset= p;}
165  void SetOuterSectorzOffset(Double_t p) {fOuterSectorzOffset= p;}
166  void SettriggerTimeOffset(Double_t p) {ftriggerTimeOffset= p;}
167  void SetOnlClock(Double_t p) {fOnlClock = p;}
168  void SetBField(Float_t p) {fBField = p;}
169  Int_t GetEvtNum() const { return fEvtNum; }
170  Int_t GetRun() const { return fRun; }
171  Int_t GetDate() const { return fDate; }
172  Int_t GetTime() const { return fTime; }
173  Float_t tZeor() {return ftZero;}
174  Float_t DriftVel() {return fDriVel;}
175  Float_t Clock() {return fClock;}
176  Float_t OnlClock() {return fOnlClock;}
177  Float_t Trigger() {return fTrigger;}
178  Float_t DriftDistance() {return fDriftDistance;}
179  Float_t InnerSectorzOffset() {return fInnerSectorzOffset;}
180  Float_t OuterSectorzOffset() {return fOuterSectorzOffset;}
181  Float_t triggerTimeOffset() {return ftriggerTimeOffset;}
182  Float_t GetBField() {return fBField;}
183 
184  ClassDef(EventHeader,3) //Event Header
185 };
186 class Vertex : public TObject {
187  public:
189  virtual ~Vertex() {}
190  StVertexId mType;
191  Int_t WestEast; // = 1 for West and 2 for East, 0 - undefined
192  StThreeVectorD Xyz;
193  StThreeVectorD XyzL; // Tpc Local
194  UInt_t numberOfDaughter;
195  virtual void Print(const Option_t* opt="") const {
196  if (opt) {}
197  cout << "Vertex: WE = " << WestEast << " XYZ L: " << XyzL << " G: " << Xyz << " Nd " << numberOfDaughter << endl;
198  }
199  ClassDef(Vertex,1)
200 };
201 class Hit : public TObject {
202  public:
203  Hit(StTpcHit *tpcHit=0, Int_t trackKey=0);
204  virtual ~Hit() {}
205  UShort_t sector;
206  UShort_t row;
207  Float_t charge;
208  UInt_t flag;
209  Int_t usedInFit;
210  StThreeVectorF xyz;
211  StThreeVectorF xyzL; // Tpc Local Sector
212  StThreeVectorF xyzS; // Tpc Super Sector
213  StThreeVectorF xyzTpcL; // Tpc Local
214  Float_t pad;
215  Float_t tbk;
216  Int_t trackKey;
217  Int_t adc;
218  // StTpcHit *hit;
219  ClassDef(Hit,8)
220 };
221 class Track : public TObject {
222  public:
223  Int_t Flag;// 0 there no is match between track and laser; 1 if it is matched, 2 primary track
224  // StVertex
225  StVertexId mType;
227  // StTrack
228  Int_t mSector;
229  Int_t mKey;
230  Short_t mFlag;
231  UShort_t mNumberOfPossiblePointsTpc;
232  Float_t mImpactParameter;
233  Float_t mLength;
234  // StTrackFitTraits
235  UShort_t mNumberOfFitPointsTpc;
236  UShort_t mPrimaryVertexUsedInFit;
237 #if 1
238  Int_t fNdEdx; // Number of points used in dE/dx calc
239  Float_t fdEdx;
240 #endif
241  StHelixModel fgeoIn;
242  StHelixModel fgeoOut;
243  StDcaGeometry fDca;
244  Double32_t fpTInv;
245  Double32_t fTheta;
246  Double32_t fPhi;
247  StThreeVectorD XyzP; // laser prediction on the mirror in GCS
248  StThreeVectorD XyzPL;// laser prediction on the mirror in TPC CS
249  StThreeVectorD XyzPU;// laser in raft coordinate system
250  StThreeVectorD XyzPB;// laser in raft coordinate system
251  StThreeVectorD XyzPM;// laser in raft coordinate system
252  StThreeVectorD dirP; // laser prediction on the mirror in GCS
253  StThreeVectorD dirPL;// laser prediction on the mirror in TPC CS
254  StThreeVectorD dirPU;// laser in raft coordinate system
255  StThreeVectorD dirPB;
256  StThreeVectorD dirPM;
257  StThreeVectorD dU;
258  Double32_t thePath;
259  LaserB Laser;
260  Double32_t dPhi;
261  Double32_t dTheta;
262 #if 0
263  FitDV fit;
264 #endif
265  Double32_t zLastHit;
266  public:
267  Track() {};
268  Track(Int_t sector, StTrack *track, LaserB *laser = 0, Double_t z=0);
269  virtual ~Track() { }
270  Int_t Matched();
271  void SetPredictions(TGeoHMatrix *Raft2Tpc = 0, TGeoHMatrix *Bundle2Tpc = 0, TGeoHMatrix *Mirror2Tpc = 0);
272  virtual void Print(const Option_t* opt="") const {
273  if (opt) {}
274  cout << "Track F: " << Flag << " Vtx: " << Vertex << " Sec/Key = " << mSector << "/" << mKey << endl;
275  cout << "\tgeoIn pxyz " << fgeoIn.momentum() << " geoIn xyz " << fgeoIn.origin() << endl;
276  cout << "\tgeoOut pxyz " << fgeoOut.momentum() << " geoOut xyz " << fgeoOut.origin() << endl;
277  cout << "\tTheta " << fTheta << " Phi " << fPhi << endl;
278  cout << "\tXyzP M " << XyzPM << " B: " << XyzPB << " U: " << XyzPU << " L: " << XyzPL << " G: " << XyzP << endl;
279  cout << "\tdirP M " << dirPM << " B: " << dirPB << " U: " << dirPU << " L: " << dirPL << " G: " << dirP << endl;
280  cout << "\tdU : " << dU << endl;
281  Laser.Print();
282  cout << "\tdTheta " << dTheta << " dPhi " << dPhi << endl;
283  }
284  ClassDef(Track,3)
285 };
286 class LaserEvent : public TObject {
287 
288 private:
289  Int_t fNtrack;
290  Int_t fNhit;
291  Int_t fNvertex;
292  EventHeader fEvtHdr;
293  TClonesArray *fVertices; //->
294  TClonesArray *fTracks; //->
295  TClonesArray *fHits; //->
296  TClonesArray *fFit; //->
297  public:
298  TClonesArray *Vertices(){return fVertices;}
299  TClonesArray *Tracks() {return fTracks;}
300  TClonesArray *Hits() {return fHits;}
301  TClonesArray *Fit() {return fFit;}
302 
303  private:
304  static TClonesArray *fgTracks;
305  static TClonesArray *fgHits;
306  static TClonesArray *fgVertices;
307  static TClonesArray *fgFit;
308  public:
309  LaserEvent();
310  virtual ~LaserEvent();
311  void Clear(Option_t *option ="");
312  static void Reset();
313  void SetNtrack(Int_t n) { fNtrack = n; }
314  void SetNhit(Int_t n) { fNhit = n; }
315  void SetHeader(Int_t i, Int_t run, Int_t date, Int_t time);
316  void SetHeader(Int_t i, Int_t run, Int_t date, Int_t time,
317  Float_t tzero, Float_t drivel, Float_t clock);
318  void SetHeader(Int_t i, Int_t run, Int_t date, Int_t time,
319  Float_t tzero, Float_t drivel, Float_t clock, Float_t trigger);
320  void SetDVWest(Float_t dv) {fEvtHdr.fDriVelWest = dv;}
321  void SetDVEast(Float_t dv) {fEvtHdr.fDriVelEast = dv;}
322  void SetScaleY(Float_t sY) {fEvtHdr.fScaleY = sY;}
323  Vertex *AddVertex(StPrimaryVertex *vertex = 0);
324  Track *AddTrack(Int_t sector = 0, StTrack *track = 0, LaserB *laser = 0, Double_t zLastHit=0);
325  Hit *AddHit(StTpcHit *tpcHit = 0, Int_t trackKey = 0);
326  void AddTrackFit(Track *t = 0);
327  Int_t GetNtrack() const { return fNtrack; }
328  Int_t GetNhit() const { return fNhit; }
329  EventHeader *GetHeader() { return &fEvtHdr; }
330  TClonesArray *GetTracks() const { return fTracks; }
331  TClonesArray *GetHits() const { return fHits; }
332  ClassDef(LaserEvent,2) //LaserEvent structure
333 };
334 
335 #endif
bool fit()
Perform linear fits in zx- and zy-plane.
Definition: Track.cc:26
C++ STL includes.
Definition: AgUStep.h:47