StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StKinkMuDst.cc
1 /***********************************************************************
2  *
3  * $Id: StKinkMuDst.cc,v 3.12 2008/07/10 16:16:55 genevb Exp $
4  *
5  * Author: Wensheng Deng, Kent State University, 29-Mar-2000
6  *
7  ***********************************************************************
8  *
9  * Description: Kink micro dst class
10  *
11  ***********************************************************************
12  *
13  * $Log: StKinkMuDst.cc,v $
14  * Revision 3.12 2008/07/10 16:16:55 genevb
15  * Allow for marking of bad tracks -> bad secondary vertices
16  *
17  * Revision 3.11 2004/02/12 20:51:41 genevb
18  * Better error messages
19  *
20  * Revision 3.10 2004/02/03 03:49:27 genevb
21  * Added keys (IDs) for Kink parent and daughter
22  *
23  * Revision 3.9 2003/09/02 17:59:04 perev
24  * gcc 3.2 updates + WarnOff
25  *
26  * Revision 3.8 2002/04/30 16:02:47 genevb
27  * Common muDst, improved MC code, better kinks, StrangeCuts now a branch
28  *
29  * Revision 3.7 2001/11/05 23:41:06 genevb
30  * Add more dEdx, B field info, careful of changes to TTree unrolling
31  *
32  * Revision 3.6 2001/05/04 20:15:14 genevb
33  * Common interfaces and reorganization of components, add MC event info
34  *
35  * Revision 3.5 2001/04/25 18:20:17 perev
36  * HPcorrs
37  *
38  * Revision 3.4 2001/02/14 19:37:44 wdeng
39  * Get parent momentum from primary track
40  *
41  * Revision 3.3 2000/09/06 21:09:03 wdeng
42  * Added track charges and total momenta
43  *
44  * Revision 3.2 2000/08/10 01:16:24 genevb
45  * Added number of dedx points
46  *
47  * Revision 3.1 2000/08/09 18:56:18 wdeng
48  * Get parent track lengths from primary tracks.
49  *
50  * Revision 3.0 2000/07/14 12:56:48 genevb
51  * Revision 3 has event multiplicities and dedx information for vertex tracks
52  *
53  * Revision 2.0 2000/06/02 22:11:54 genevb
54  * New version of Strangeness micro DST package
55  *
56  * Revision 1.1 2000/03/30 00:18:08 genevb
57  * Introduction of StKinkMuDst
58  *
59  *
60  ***********************************************************************/
61 #include "StKinkMuDst.hh"
62 #include "StKinkVertex.h"
63 #include "StTrack.h"
64 #include "StTrackGeometry.h"
65 #include "StTrackNode.h"
66 #include "StTrackFitTraits.h"
67 #include "StDedxPidTraits.h"
68 #include "StMessMgr.h"
69 
70 #include <stdlib.h>
71 #include "phys_constants.h"
72 
73 ClassImp(StKinkBase)
74 ClassImp(StKinkMuDst)
75 
77 {}
78 
79 StKinkMuDst::StKinkMuDst(StKinkVertex* kinkVertex) : StKinkBase()
80 {
81  mParentGeantId = kinkVertex->geantIdParent();
82  mDaughterGeantId = kinkVertex->geantIdDaughter();
83  mDcaParentDaughter = kinkVertex->dcaParentDaughter();
84  mDcaDaughterPrimaryVertex = kinkVertex->dcaDaughterPrimaryVertex();
85  mDcaParentPrimaryVertex = kinkVertex->dcaParentPrimaryVertex();
86  mHitDistanceParentDaughter = kinkVertex->hitDistanceParentDaughter();
87  mHitDistanceParentVertex = kinkVertex->hitDistanceParentVertex();
88  mDecayAngle = kinkVertex->decayAngle();
89  StTrack* parent = kinkVertex->parent();
90  if (!parent) gMessMgr->Error("StKinkMuDst: parent missing!");
91  StTrack* daughter = kinkVertex->daughter();
92  if (!daughter) gMessMgr->Error("StKinkMuDst: daughter missing!");
93 
94  StTrack* parentPrimaryTrack = parent->node()->track(primary);
95  if (parentPrimaryTrack && (parentPrimaryTrack->geometry())) {
96  mParentPrimMomentumX = parentPrimaryTrack->geometry()->momentum().x();
97  mParentPrimMomentumY = parentPrimaryTrack->geometry()->momentum().y();
98  mParentPrimMomentumZ = parentPrimaryTrack->geometry()->momentum().z();
99  } else {
100  mParentPrimMomentumX = 999.;
101  mParentPrimMomentumY = 999.;
102  mParentPrimMomentumZ = 999.;
103  }
104  mParentPrimMomentum = ::sqrt( mParentPrimMomentumX*mParentPrimMomentumX +
105  mParentPrimMomentumY*mParentPrimMomentumY +
106  mParentPrimMomentumZ*mParentPrimMomentumZ );
107 
108  const StThreeVectorF parentMom = kinkVertex->parentMomentum();
109  mParentMomentumX = parentMom.x();
110  mParentMomentumY = parentMom.y();
111  mParentMomentumZ = parentMom.z();
112  mParentMomentum = parentMom.mag();
113  if (parent->geometry()) {
114  mParentCharge = parent->geometry()->charge();
115  } else {
116  mParentCharge = 0;
117  gMessMgr->Warning("StKinkMuDst: parent geometry missing!");
118  }
119  mKeyParent = parent->key();
120 
121  const StThreeVectorF daughterMom = kinkVertex->daughterMomentum();
122  mDaughterMomentumX = daughterMom.x();
123  mDaughterMomentumY = daughterMom.y();
124  mDaughterMomentumZ = daughterMom.z();
125  mDaughterMomentum = daughterMom.mag();
126  if (daughter->geometry()) {
127  mDaughterCharge = daughter->geometry()->charge();
128  } else {
129  mDaughterCharge = 0;
130  gMessMgr->Warning("StKinkMuDst: daughter geometry missing!");
131  }
132  mKeyDaughter = daughter->key();
133 
134  const StThreeVectorF pos = kinkVertex->position();
135  mPositionX = pos.x();
136  mPositionY = pos.y();
137  mPositionZ = pos.z();
138  mChi2Kink = kinkVertex->chiSquared();
139  mClKink = kinkVertex->probChiSquared();
140 
141  mChi2Parent = parent->fitTraits().chi2(0);
142  mClParent = parent->fitTraits().chi2(1);
143  if (parent->bad()) setParentBad();
144  mDedxParent = 0.;
145  mNumDedxParent = 0;
146  // For now, get the truncated mean dE/dX from the TPC
147  StPtrVecTrackPidTraits pidParent = parent->pidTraits(kTpcId);
148  UInt_t i;
149  for (i=0; i<pidParent.size(); i++) {
150  StDedxPidTraits* pid = (StDedxPidTraits*) pidParent[i];
151  if (pid->method() == kTruncatedMeanId) {
152  mDedxParent = pid->mean();
153  mErrDedxParent = pid->errorOnMean();
154  mNumDedxParent = pid->numberOfPoints() + (100*((int) (pid->length())));
155  break;
156  }
157  }
158 
159  mChi2Daughter = daughter->fitTraits().chi2(0);
160  mClDaughter = daughter->fitTraits().chi2(1);
161  if (daughter->bad()) setDaughterBad();
162  mDedxDaughter = 0.;
163  mNumDedxDaughter = 0;
164  // For now, get the truncated mean dE/dX from the TPC
165  StPtrVecTrackPidTraits pidDaughter = daughter->pidTraits(kTpcId);
166  for (i=0; i<pidDaughter.size(); i++) {
167  StDedxPidTraits* pid = (StDedxPidTraits*) pidDaughter[i];
168  if (pid->method() == kTruncatedMeanId) {
169  mDedxDaughter = pid->mean();
170  mErrDedxDaughter = pid->errorOnMean();
171  mNumDedxDaughter = pid->numberOfPoints() + (100*((int) (pid->length())));
172  break;
173  }
174  }
175 
176  findMinDeltaEnergy(kinkVertex);
177  findDecayLength(kinkVertex);
178  // Pay attention to the calling order
179  findTransverseMomentum();
180  findTransverseMassKaon();
181  findTransverseMassPion();
182  findRapidityKaon();
183  findRapidityPion();
184 }
185 
186 StKinkMuDst::~StKinkMuDst() {/* noop */}
187 
188 void
189 StKinkMuDst::findMinDeltaEnergy(StKinkVertex* kinkVertex)
190 {
191  mMinDeltaEnergy = kinkVertex->dE(0);
192  if( mMinDeltaEnergy > kinkVertex->dE(1) )
193  mMinDeltaEnergy = kinkVertex->dE(1);
194  if( mMinDeltaEnergy > kinkVertex->dE(2) )
195  mMinDeltaEnergy = kinkVertex->dE(2);
196 }
197 
198 void
199 StKinkMuDst::findDecayLength(StKinkVertex* kinkVertex)
200 {
201  StTrack* parentPrimaryTrack =
202  kinkVertex->parent()->node()->track(primary);
203  if( parentPrimaryTrack ) {
204  mDecayLength = parentPrimaryTrack->length();
205  } else {
206  mDecayLength = 999.;
207  }
208 }
209 
210 void
211 StKinkMuDst::findTransverseMomentum()
212 {
213  mTransverseMomentum =
214  ::sqrt( mParentMomentumX * mParentMomentumX
215  + mParentMomentumY * mParentMomentumY );
216 }
217 
218 void
219 StKinkMuDst::findTransverseMassKaon()
220 {
221  mTransverseMassKaon =
222  ::sqrt( M_KAON_PLUS * M_KAON_PLUS
223  + mTransverseMomentum * mTransverseMomentum );
224 }
225 
226 void
227 StKinkMuDst::findTransverseMassPion()
228 {
229  mTransverseMassPion =
230  ::sqrt( M_PION_PLUS * M_PION_PLUS
231  + mTransverseMomentum * mTransverseMomentum );
232 }
233 
234 void
235 StKinkMuDst::findRapidityKaon()
236 {
237  Float_t mTotalEnergy =
238  ::sqrt( M_KAON_PLUS * M_KAON_PLUS
239  + mParentMomentumX * mParentMomentumX
240  + mParentMomentumY * mParentMomentumY
241  + mParentMomentumZ * mParentMomentumZ );
242 
243  mRapidityKaon =
244  ::log( (mTotalEnergy + mParentMomentumZ)/mTransverseMassKaon );
245 }
246 
247 void
248 StKinkMuDst::findRapidityPion()
249 {
250  Float_t mTotalEnergy =
251  ::sqrt( M_PION_PLUS * M_PION_PLUS
252  + mParentMomentumX * mParentMomentumX
253  + mParentMomentumY * mParentMomentumY
254  + mParentMomentumZ * mParentMomentumZ );
255 
256  mRapidityPion =
257  ::log( (mTotalEnergy + mParentMomentumZ)/mTransverseMassPion );
258 }
259 
virtual void setDaughterBad()
Set the daughter as bad.
Definition: StKinkI.hh:120
virtual void setParentBad()
Set the parent as bad.
Definition: StKinkI.hh:118