StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StXiVertex.cxx
1 /***************************************************************************
2  *
3  * $Id: StXiVertex.cxx,v 2.11 2009/11/23 16:34:08 fisyak Exp $
4  *
5  * Author: Gene Van Buren, Feb 1999, revised Thomas Ullrich Sep 99
6  ***************************************************************************
7  *
8  * Description: vertex class for cascades
9  *
10  ***************************************************************************
11  *
12  * $Log: StXiVertex.cxx,v $
13  * Revision 2.11 2009/11/23 16:34:08 fisyak
14  * Cleanup, remove dependence on dst tables, clean up software monitors
15  *
16  * Revision 2.10 2004/07/15 16:36:26 ullrich
17  * Removed all clone() declerations and definitions. Use StObject::clone() only.
18  *
19  * Revision 2.9 2003/09/02 17:58:06 perev
20  * gcc 3.2 updates + WarnOff
21  *
22  * Revision 2.8 2003/01/24 22:30:05 genevb
23  * Allow for signed DCA of Xi to PrimVertex
24  *
25  * Revision 2.7 2001/06/10 21:03:32 perev
26  * Solaris: consting
27  *
28  * Revision 2.6 2001/06/05 21:58:26 perev
29  * HPcorr
30  *
31  * Revision 2.5 2001/05/30 17:45:55 perev
32  * StEvent branching
33  *
34  * Revision 2.4 2001/04/05 04:00:59 ullrich
35  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
36  *
37  * Revision 2.3 2001/03/24 03:35:01 perev
38  * clone() -> clone() const
39  *
40  * Revision 2.2 1999/11/04 13:31:17 ullrich
41  * Changed order of constructor arguments
42  *
43  * Revision 2.1 1999/10/28 22:28:15 ullrich
44  * Adapted new StArray version. First version to compile on Linux and Sun.
45  *
46  * Revision 2.0 1999/10/12 18:43:34 ullrich
47  * Completely Revised for New Version
48  *
49  **************************************************************************/
50 #include <Stiostream.h>
51 #include "TClass.h"
52 #include "StXiVertex.h"
53 #include "StV0Vertex.h"
54 #include "StTrack.h"
55 #include "StTrackGeometry.h"
56 
57 static const char rcsid[] = "$Id: StXiVertex.cxx,v 2.11 2009/11/23 16:34:08 fisyak Exp $";
58 
59 ClassImp(StXiVertex)
60 
62 {
63  mType = kXiVtxId;
64  mDaughter = 0;
65  mDcaBachelorToPrimaryVertex = 0;
66  mDcaDaughters = 0;
67  mDcaParentToPrimaryVertex = 0;
68  mV0Vertex = 0;
69 }
70 
71 StXiVertex::~StXiVertex() { /* noop */ }
72 
73 StVertexId
74 StXiVertex::type() const { return kXiVtxId; }
75 
76 unsigned int
77 StXiVertex::numberOfDaughters() const { return mDaughter ? 1 : 0;}
78 
79 StTrack*
80 StXiVertex::daughter(unsigned int i)
81 {
82  return i == 0 ? (StTrack*)mDaughter : 0;
83 }
84 
85 const StTrack*
86 StXiVertex::daughter(unsigned int i) const
87 {
88  return i == 0 ? (const StTrack*)mDaughter : 0;
89 }
90 
91 StPtrVecTrack
92 StXiVertex::daughters(StTrackFilter& filter)
93 {
94  StPtrVecTrack vec;
95  if (filter(mDaughter)) vec.push_back(mDaughter);
96  return vec;
97 }
98 
99 float
100 StXiVertex::dcaV0ToPrimaryVertex() const
101 {
102  if (mV0Vertex)
103  return mV0Vertex->dcaParentToPrimaryVertex();
104  else
105  return 0;
106 }
107 
109 StXiVertex::momentumOfV0() const
110 {
111  if (mV0Vertex) {
112  const StThreeVectorF& nMom = mV0Vertex->momentumOfDaughter(negative);
113  const StThreeVectorF& pMom = mV0Vertex->momentumOfDaughter(positive);
114  return (nMom + pMom);
115  }
116  else
117  return StThreeVectorF();
118 }
119 
120 float
121 StXiVertex::dcaBachelorToPrimaryVertex () const
122 {
123  return mDcaBachelorToPrimaryVertex;
124 }
125 
126 const StThreeVectorF&
127 StXiVertex::momentumOfBachelor() const { return mMomentumOfBachelor; }
128 
130 StXiVertex::momentum() const
131 {
132  return mMomentumOfBachelor + momentumOfV0();
133 }
134 
135 float
136 StXiVertex::dcaDaughters() const { return mDcaDaughters; }
137 
138 float
139 StXiVertex::dcaParentToPrimaryVertex() const { return TMath::Abs(mDcaParentToPrimaryVertex); }
140 
141 float
142 StXiVertex::signedDcaParentToPrimaryVertex() const { return mDcaParentToPrimaryVertex; }
143 
144 StV0Vertex*
145 StXiVertex::v0Vertex() { return mV0Vertex; }
146 
147 StTrack*
148 StXiVertex::bachelor() { return mDaughter; }
149 
150 void
151 StXiVertex::setDcaBachelorToPrimaryVertex(float val)
152 {
153  mDcaBachelorToPrimaryVertex = val;
154 }
155 
156 double
157 StXiVertex::chargeOfBachelor()
158 {
159  StTrack* b = bachelor();
160  return b ? b->geometry()->charge() : 0;
161 }
162 
163 void
164 StXiVertex::setMomentumOfBachelor(const StThreeVectorF& v)
165 {
166  mMomentumOfBachelor = v;
167 }
168 
169 void
170 StXiVertex::setDcaDaughters(float val) { mDcaDaughters = val; }
171 
172 void
173 StXiVertex::setDcaParentToPrimaryVertex(float val) { mDcaParentToPrimaryVertex = val; }
174 
175 void
176 StXiVertex::setV0Vertex(StV0Vertex* v0vtx)
177 {
178  mV0Vertex = v0vtx;
179 }
180 
181 void
182 StXiVertex::addDaughter(StTrack* track) { mDaughter = track; }
183 
184 
185 void
186 StXiVertex::removeDaughter(StTrack* track)
187 {
188  if (track == mDaughter) mDaughter = 0;
189 }
190 
191 void StXiVertex::Streamer(TBuffer &R__b)
192 {
193  // Stream an object of class .
194 
195  if (R__b.IsReading()) {
196  UInt_t R__s, R__c;
197  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
198  if (R__v > 1) {
199  Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
200  return;
201  }
202  //====process old versions before automatic schema evolution
203  StVertex::Streamer(R__b);
204  R__b >> (StTrack*&)mDaughter;
205  R__b >> mDcaBachelorToPrimaryVertex;
206  mMomentumOfBachelor.Streamer(R__b);
207  R__b >> mDcaDaughters;
208  R__b >> mDcaParentToPrimaryVertex;
209  R__b >> (StV0Vertex*&)mV0Vertex;
210 
211  R__b.CheckByteCount(R__s, R__c, Class());
212  //====end of old versions
213 
214  } else {
215  Class()->WriteBuffer(R__b,this);
216  }
217 }
218 
219 
220 
221