StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTrackList.h
1 // -*- mode: c++;-*-
2 // $Id: StjTrackList.h,v 1.6 2016/01/06 22:00:17 gdwebb Exp $
3 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
4 #ifndef STJTRACKLIST_H
5 #define STJTRACKLIST_H
6 
7 #include <ostream>
8 #include <vector>
9 #include "TObject.h"
10 #include "TVector3.h"
11 
12 class StjTrack : public TObject {
13 public:
14  virtual ~StjTrack() {}
15  int runNumber;
16  int eventId;
17  int detectorId; // 1: TPC
18  double pt;
19  double eta;
20  double phi;
21  short flag;
22  unsigned short nHits;
23  short charge;
24  unsigned short nHitsPoss;
25  unsigned short nHitsDedx;
26  unsigned short nHitsFit;
27  double nSigmaPion;
28  double nSigmaKaon;
29  double nSigmaProton;
30  double nSigmaElectron;
31  double Tdca;
32  double dcaX;
33  double dcaY;
34  double dcaZ;
35  double dcaD;
36  double chi2;
37  double chi2prob;
38  double BField;
39  double bemcRadius;
40  double vertexZ;
41  int exitDetectorId; // 9: BEMC, 13: EEMC
42  int exitTowerId;
43  double exitEta;
44  double exitPhi;
45  double dEdx;
46  double beta;
47  int trackIndex;
48  short id;
49  int idTruth;
50  int qaTruth;
51  TVector3 firstPoint;
52  TVector3 lastPoint;
53 
54  int btofTrayId;
55  double nSigmaTofPion;
56  double nSigmaTofKaon;
57  double nSigmaTofProton;
58  double nSigmaTofElectron;
59 
60  ClassDef(StjTrack,6);
61 };
62 
63 typedef std::vector<StjTrack> StjTrackList;
64 
65 inline bool operator==(const StjTrack& v1, const StjTrack& v2)
66 {
67  if(v1.runNumber != v2.runNumber) return false;
68  if(v1.eventId != v2.eventId) return false;
69  if(v1.detectorId != v2.detectorId) return false;
70  if(v1.pt != v2.pt) return false;
71  if(v1.eta != v2.eta) return false;
72  if(v1.phi != v2.phi) return false;
73  if(v1.flag != v2.flag) return false;
74  if(v1.nHits != v2.nHits) return false;
75  if(v1.charge != v2.charge) return false;
76  if(v1.nHitsPoss != v2.nHitsPoss) return false;
77  if(v1.nHitsDedx != v2.nHitsDedx) return false;
78  if(v1.nHitsFit != v2.nHitsFit) return false;
79  if(v1.nSigmaPion != v2.nSigmaPion) return false;
80  if(v1.Tdca != v2.Tdca) return false;
81  if(v1.dcaX != v2.dcaX) return false;
82  if(v1.dcaY != v2.dcaY) return false;
83  if(v1.dcaZ != v2.dcaZ) return false;
84  if(v1.dcaD != v2.dcaD) return false;
85  if(v1.chi2 != v2.chi2) return false;
86  if(v1.chi2prob != v2.chi2prob) return false;
87  if(v1.BField != v2.BField) return false;
88  if(v1.bemcRadius != v2.bemcRadius) return false;
89  if(v1.exitDetectorId != v2.exitDetectorId) return false;
90  if(v1.exitTowerId != v2.exitTowerId) return false;
91  if(v1.exitEta != v2.exitEta) return false;
92  if(v1.exitPhi != v2.exitPhi) return false;
93  if(v1.dEdx != v2.dEdx) return false;
94  if(v1.beta != v2.beta) return false;
95  if(v1.trackIndex != v2.trackIndex) return false;
96  if(v1.id != v2.id) return false;
97  if(v1.firstPoint != v2.firstPoint) return false;
98  if(v1.lastPoint != v2.lastPoint) return false;
99  if(v1.btofTrayId != v2.btofTrayId) return false;
100  if(v1.nSigmaTofPion != v2.nSigmaTofPion) return false;
101  if(v1.nSigmaTofKaon != v2.nSigmaTofKaon) return false;
102  if(v1.nSigmaTofProton != v2.nSigmaTofProton) return false;
103  if(v1.nSigmaTofElectron != v2.nSigmaTofElectron) return false;
104  if(v1.idTruth != v2.idTruth) return false;
105  if(v1.qaTruth != v2.qaTruth) return false;
106  return true;
107 }
108 
109 inline bool operator!=(const StjTrack& v1, const StjTrack& v2)
110 {
111  return(!(v1 == v2));
112 }
113 
114 inline bool operator==(const StjTrackList& v1, const StjTrackList& v2){
115  if(v1.size() != v2.size()) return false;
116  for(size_t i = 0; i < v1.size(); ++i) if(v1[i] != v2[i]) return false;
117  return true;
118 }
119 
120 
121 inline std::ostream& operator<<(std::ostream& out, const StjTrack& v)
122 {
123  out << "trackId: " << v.id << ", pt: " << v.pt << ", .... ";
124  return out;
125 }
126 
127 inline std::ostream& operator<<(std::ostream& out, const StjTrackList& v)
128 {
129  out << "TrackList size: " << v.size();
130  return out;
131 }
132 
133 #endif // STJTRACKLIST_H