StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StKinkVertex.cxx
1 /***************************************************************************
2  *
3  * $Id: StKinkVertex.cxx,v 2.10 2009/11/23 16:34:06 fisyak Exp $
4  *
5  * Author: Thomas Ullrich, Sep 1999
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StKinkVertex.cxx,v $
13  * Revision 2.10 2009/11/23 16:34:06 fisyak
14  * Cleanup, remove dependence on dst tables, clean up software monitors
15  *
16  * Revision 2.9 2004/07/15 16:36:24 ullrich
17  * Removed all clone() declerations and definitions. Use StObject::clone() only.
18  *
19  * Revision 2.8 2001/07/13 16:25:20 perev
20  * last static array fixed
21  *
22  * Revision 2.7 2001/05/30 17:45:54 perev
23  * StEvent branching
24  *
25  * Revision 2.6 2001/04/05 04:00:51 ullrich
26  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
27  *
28  * Revision 2.5 2001/03/24 03:34:51 perev
29  * clone() -> clone() const
30  *
31  * Revision 2.4 1999/12/21 15:08:57 ullrich
32  * Modified to cope with new compiler version on Sun (CC5.0).
33  *
34  * Revision 2.3 1999/10/28 22:25:53 ullrich
35  * Adapted new StArray version. First version to compile on Linux and Sun.
36  *
37  * Revision 2.2 1999/10/14 11:07:57 ullrich
38  * Fixed geantIdDaughter(). Was returning parent not daughter Id.
39  *
40  * Revision 2.1 1999/10/13 19:44:51 ullrich
41  * Initial Revision
42  *
43  **************************************************************************/
44 #include <algorithm>
45 #include "TClass.h"
46 #include "TFile.h"
47 #include "StKinkVertex.h"
48 #include "StParticleTable.hh"
49 #include "StTrack.h"
50 #if !defined(ST_NO_NAMESPACES)
51 using std::fill_n;
52 using std::copy;
53 #endif
54 
55 ClassImp(StKinkVertex)
56 
57 static const char rcsid[] = "$Id: StKinkVertex.cxx,v 2.10 2009/11/23 16:34:06 fisyak Exp $";
58 
60 {
61  mType = kKinkVtxId;
62  mDaughter = 0;
63  mParentGeantId = 0;
64  mDaughterGeantId = 0;
65  mDcaParentDaughter = 0;
66  mDcaDaughterPrimaryVertex = 0;
67  mDcaParentPrimaryVertex = 0;
68  mHitDistanceParentDaughter = 0;
69  mHitDistanceParentVertex = 0;
70  fill_n(mDeltaEnergy, 3, 0);
71  mDecayAngle = 0;
72  mDecayAngleCM = 0;
73 }
74 
75 StKinkVertex::~StKinkVertex() {/* noop */}
76 
77 StVertexId
78 StKinkVertex::type() const { return kKinkVtxId; }
79 
80 unsigned int
81 StKinkVertex::numberOfDaughters() const { return mDaughter ? 1 : 0; }
82 
83 StTrack*
84 StKinkVertex::daughter(unsigned int i)
85 {
86  return i==0 ? (StTrack*)mDaughter : 0;
87 }
88 
89 const StTrack*
90 StKinkVertex::daughter(unsigned int i) const
91 {
92  return i==0 ? (const StTrack*)mDaughter : 0;
93 }
94 
95 StPtrVecTrack
96 StKinkVertex::daughters(StTrackFilter& filter)
97 {
98  StPtrVecTrack vec;
99  if (filter(mDaughter)) vec.push_back(mDaughter);
100  return vec;
101 }
102 
104 StKinkVertex::pidParent() const
105 {
106  return StParticleTable::instance()->findParticleByGeantId(mParentGeantId);
107 }
108 
110 StKinkVertex::pidDaughter() const
111 {
112  return StParticleTable::instance()->findParticleByGeantId(mDaughterGeantId);
113 }
114 
115 unsigned short
116 StKinkVertex::geantIdParent() const { return mParentGeantId; }
117 
118 unsigned short
119 StKinkVertex::geantIdDaughter() const { return mDaughterGeantId; }
120 
121 float
122 StKinkVertex::dcaParentDaughter() const { return mDcaParentDaughter; }
123 
124 float
125 StKinkVertex::dcaDaughterPrimaryVertex() const { return mDcaDaughterPrimaryVertex; }
126 
127 float
128 StKinkVertex::dcaParentPrimaryVertex() const { return mDcaParentPrimaryVertex; }
129 
130 float
131 StKinkVertex::hitDistanceParentDaughter() const { return mHitDistanceParentDaughter; }
132 
133 float
134 StKinkVertex::hitDistanceParentVertex() const { return mHitDistanceParentVertex; }
135 
136 float
137 StKinkVertex::dE(unsigned int i) const
138 {
139  if (i < 3)
140  return mDeltaEnergy[i];
141  else
142  return 0;
143 }
144 
145 float
146 StKinkVertex::decayAngle() const { return mDecayAngle; }
147 
148 float
149 StKinkVertex::decayAngleCM() const { return mDecayAngleCM; }
150 
151 const StThreeVectorF&
152 StKinkVertex::parentMomentum() const { return mParentMomentum; }
153 
155 StKinkVertex::parentMomentum() { return mParentMomentum; }
156 
157 const StThreeVectorF&
158 StKinkVertex::daughterMomentum() const { return mDaughterMomentum; }
159 
161 StKinkVertex::daughterMomentum() { return mDaughterMomentum; }
162 
163 void
164 StKinkVertex::setGeantIdParent(unsigned short val) { mParentGeantId = val; }
165 
166 void
167 StKinkVertex::setGeantIdDaughter(unsigned short val) { mDaughterGeantId = val; }
168 
169 void
170 StKinkVertex::setDcaParentDaughter(float val) { mDcaParentDaughter = val; }
171 
172 void
173 StKinkVertex::setDcaDaughterPrimaryVertex(float val) { mDcaDaughterPrimaryVertex = val; }
174 
175 void
176 StKinkVertex::setDcaParentPrimaryVertex(float val) { mDcaParentPrimaryVertex = val; }
177 
178 void
179 StKinkVertex::setHitDistanceParentDaughter(float val) { mHitDistanceParentDaughter = val; }
180 
181 void
182 StKinkVertex::setHitDistanceParentVertex(float val) { mHitDistanceParentVertex = val; }
183 
184 void
185 StKinkVertex::setdE(unsigned int i, float val)
186 {
187  if (i < 3) mDeltaEnergy[i] = val;
188 }
189 
190 void
191 StKinkVertex::setDecayAngle(float val) { mDecayAngle = val; }
192 
193 void
194 StKinkVertex::setDecayAngleCM(float val) { mDecayAngleCM = val; }
195 
196 void
197 StKinkVertex::setParentMomentum(const StThreeVectorF& val) { mParentMomentum = val; }
198 
199 void
200 StKinkVertex::setDaughterMomentum(const StThreeVectorF& val) { mDaughterMomentum = val; }
201 
202 void
203 StKinkVertex::addDaughter(StTrack* val)
204 {
205  if (val) mDaughter = val;
206 }
207 
208 void
209 StKinkVertex::removeDaughter(StTrack* val)
210 {
211  if (mDaughter == val) mDaughter = 0;
212 }
213 
214 void StKinkVertex::Streamer(TBuffer &R__b)
215 {
216  // Stream an object of class StKinkVertex.
217 
218  if (R__b.IsReading()) {
219  UInt_t R__s, R__c;
220  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
221  if (R__v > 1) {
222  Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
223  return;
224  }
225  //====process old versions before automatic schema evolution
226  StVertex::Streamer(R__b);
227 // R__b >> mDaughter;
228  R__b >> (StTrack*&)mDaughter;
229 
230  R__b >> mParentGeantId;
231  R__b >> mDaughterGeantId;
232  R__b >> mDcaParentDaughter;
233  R__b >> mDcaDaughterPrimaryVertex;
234  R__b >> mDcaParentPrimaryVertex;
235  R__b >> mHitDistanceParentDaughter;
236  R__b >> mHitDistanceParentVertex;
237 
238  Int_t dumy;
239  if (gFile && gFile->GetVersion() < 30000) {R__b >> dumy;}
240 
241  R__b.ReadFastArray(mDeltaEnergy,3);
242  R__b >> mDecayAngle;
243  R__b >> mDecayAngleCM;
244  mParentMomentum.Streamer(R__b);
245  mDaughterMomentum.Streamer(R__b);
246  R__b.CheckByteCount(R__s, R__c, Class());
247  //====end of old versions
248 
249  } else {
250  Class()->WriteBuffer(R__b,this);
251  }
252 }