StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TrackToJetIndex.h
1 // -*- mode: c++;-*-
2 // $Id: TrackToJetIndex.h,v 1.10 2012/06/11 14:57:05 fisyak Exp $
3 #ifndef TRACKTOJETINDEX_H
4 #define TRACKTOJETINDEX_H
5 
6 class StJet;
7 
8 #include "TLorentzVector.h"
9 #include "TRef.h"
10 
11 #include <ostream>
12 #include <string>
13 
14 #ifndef StEnumerations_hh
15 #define StEnumerations_hh
16 
17 #define kUnknownIdentifier 0
18 #define kTpcIdentifier 1
19 #define kBarrelEmcTowerIdentifier 9
20 #define kEndcapEmcTowerIdentifier 13
21 
22 enum StDetectorId {
23  kUnknownId = kUnknownIdentifier,
24  kTpcId = kTpcIdentifier,
25  kBarrelEmcTowerId = kBarrelEmcTowerIdentifier,
26  kEndcapEmcTowerId = kEndcapEmcTowerIdentifier,
27 };
28 
29 #endif // StEnumerations_hh
30 
31 class TrackToJetIndex : public TLorentzVector
32 {
33 public:
34  TrackToJetIndex(int jetIndex = -1, int trackIndex = -1, StDetectorId detId = kUnknownId, StJet* jet = 0);
35 
36  int jetIndex() const { return mJetIndex; }
37  int trackIndex() const {return mTrackIndex; }
38  StJet* jet() const { return (StJet*)mJet.GetObject(); }
39 
40  short trackId() const { return mTrackId; }
41  StDetectorId detectorId() const { return mDetId ; }
42  short flag() const { return mFlag; }
43  short charge() const { return mCharge; }
44  unsigned short nHits() const { return mNhits; } //< Return total number of hits on track.
45  unsigned short nHitsPoss() const { return mNhitsPoss; } //< Return number of possible hits on track.
46  unsigned short nHitsDedx() const { return mNhitsDedx; } //< Return number of hits used for dEdx.
47  unsigned short nHitsFit() const { return mNhitsFit; } //< Return total number of hits used in fit.
48  double nSigmaPion() const { return mNsigmaPion; } //< Rdistance to the calculated dE/dx band for pions in units of sigma.
49  double nSigmaElectron() const { return mNsigmaElectron; }
50  double nSigmaKaon() const { return mNsigmaKaon; }
51  double nSigmaProton() const { return mNsigmaProton; }
52  double Tdca() const { return mTdca; }
53  double Tdcaz() const { return mTdcaz; }
54  double Tdcaxy() const { return mTdcaxy; }
55  double etaext() const { return metaext; }
56  double phiext() const { return mphiext; }
57  double dEdx() const { return mdEdx; }
58  double jt() const { return localMomentum().Perp(); }
59  double ps() const { return localMomentum().Px (); }
60  double pn() const { return localMomentum().Py (); }
61  double pl() const { return localMomentum().Pz (); }
62  double frag() const;
63 
64  TVector3 momentum() const { return Vect(); }
65  TVector3 localMomentum() const;
66 
67  // For particle jets
68  short id () const { return trackIndex(); } // line in Pythia record
69  short pdg () const { return trackId(); } // PDG code
70  short status() const { return flag(); } // 1=stable, 2=unstable, 3=incoming parton
71 
72  void setJetIndex(int n) { mJetIndex = n; }
73  void setTrackIndex(int n) { mTrackIndex = n; }
74  void setDetectorId(StDetectorId v) { mDetId = v; }
75  void setFlag(short v) { mFlag = v; }
76  void setCharge(short v) { mCharge = v; }
77  void setNhits(unsigned short v) { mNhits = v; }
78  void setNhitsPoss(unsigned short v) { mNhitsPoss = v; }
79  void setNhitsDedx(unsigned short v) { mNhitsDedx = v; }
80  void setNhitsFit(unsigned short v) { mNhitsFit = v; }
81  void setNsigmaPion(double v) { mNsigmaPion = v; }
82  void setNsigmaElectron(double v) { mNsigmaElectron = v; }
83  void setNsigmaKaon(double v) { mNsigmaKaon = v; }
84  void setNsigmaProton(double v) { mNsigmaProton = v; }
85  void setTdca(double v) { mTdca = v; }
86  void setTdcaz(double v) { mTdcaz = v; }
87  void setTdcaxy(double v) { mTdcaxy = v; }
88  void setetaext(double v) { metaext = v; }
89  void setphiext(double v) { mphiext = v; }
90  void setdEdx(double v) { mdEdx = v; }
91  void setTrackId(int v) { mTrackId = v; }
92 
93  // For particle jets
94  void setId(short v) { setTrackIndex(v); }
95  void setPdg(short v) { setTrackId(v); }
96  void setStatus(short v) { setFlag(v); }
97 
98 private:
99  int mJetIndex;
100  int mTrackIndex;
101  StDetectorId mDetId;
102  short mFlag;
103  short mCharge;
104  unsigned short mNhits;
105  unsigned short mNhitsPoss;
106  unsigned short mNhitsDedx;
107  unsigned short mNhitsFit;
108  double mNsigmaPion;
109  double mNsigmaElectron;
110  double mNsigmaKaon;
111  double mNsigmaProton;
112  double mTdca; //jan 27, 2007
113  double mTdcaz; //jan 27, 2007
114  double mTdcaxy; //jan 27, 2007
115  double metaext;
116  double mphiext;
117  double mdEdx;
118  short mTrackId;
119  TRef mJet;
120 
121  ClassDef(TrackToJetIndex, 6);
122 };
123 
124 inline std::ostream& operator<<(std::ostream& os, const TrackToJetIndex& t)
125 {
126  std::string idstring;
127  StDetectorId mDetId = t.detectorId();
128  if (mDetId==kTpcId) {
129  idstring = "kTpcId";
130  }
131  else if (mDetId==kBarrelEmcTowerId) {
132  idstring = "kBarrelEmcTowerId";
133  }
134  else if (mDetId==kEndcapEmcTowerId) {
135  idstring = "kEndcapEmcTowerId";
136  }
137  else {
138  idstring = "kUnknown";
139  }
140 
141  return os <<"jetIndex:\t"<<t.jetIndex()<<"\ttrackIndex:\t"<<t.trackIndex()<<"\tdetId:\t"<<t.detectorId()<<"\t"<<idstring;
142 }
143 
144 #endif // TRACKTOJETINDEX_H
Definition: StJet.h:91