BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
CDChargedVisible.cc
Go to the documentation of this file.
1#ifndef CLEODCHAIN_CDCHARGEDVISIBLE_CC
2#define CLEODCHAIN_CDCHARGEDVISIBLE_CC
3// -*- C++ -*-
4//
5// Package: CleoDChain
6// Module: CDChargedVisible
7//
8// Description: Implementation of candidate for visible charged particles
9//
10// Implimentation:
11// <Notes on implimentation>
12//
13// Author: Simon Patton
14// Created: Tue Mar 18 13:23:11 EST 1997
15// $Id: CDChargedVisible.cc,v 1.4 2009/10/28 08:23:22 petez Exp $
16//
17// Revision history
18//
19// $Log: CDChargedVisible.cc,v $
20// Revision 1.4 2009/10/28 08:23:22 petez
21// see ChangeLog for changes to KinematicData and CDChargedVisible
22//
23// Revision 1.3 2009/06/22 14:55:48 zoujh
24// See ChangeLog
25//
26// Revision 1.2 2009/03/09 20:00:43 chunlei
27// get charge and momentum from KalTrack helix information
28//
29// Revision 1.1.1.1 2009/03/03 06:05:56 maqm
30// first import of BesDChain
31//
32// Revision 1.3 2004/03/05 22:01:54 chengp
33// implemented Monte Carlo matching
34//
35// Revision 1.2 2001/04/25 12:52:17 ajm36
36// plugged memory leak in ctor for pi0's, k shorts, etas
37//
38// Revision 1.1 2001/04/11 13:19:35 urner
39// transition to files with CD prefix. Addition of new files
40//
41// Revision 1.3 2001/04/03 17:26:46 cdj
42// moved builtFromCDCharged to builtFromTrack
43//
44// Revision 1.2 2001/03/23 23:05:42 urner
45// added pi0 eta and CDKs decay lists
46//
47// Revision 1.1.1.1 2000/12/18 22:17:27 cdj
48// imported CleoDChain
49//
50// Revision 1.11 1998/05/01 20:30:21 sjp
51// Modified include path for new placement of CO classes
52//
53// Revision 1.10 1998/05/01 20:21:35 sjp
54// Added necessary string include
55//
56// Revision 1.9 1998/04/21 05:18:23 sjp
57// Modified to use CDMud
58//
59// Revision 1.8 1998/04/17 18:50:24 sjp
60// Modifed to use latest CLEO types
61//
62// Revision 1.7 1997/12/23 21:54:54 sjp
63// Modified package to be completely templated
64//
65// Revision 1.6 1997/09/03 14:58:47 sjp
66// Use new report.h and KTKinematicData
67//
68// Revision 1.5 1997/08/29 17:01:24 sjp
69// Modified to handle new Cairn Templated classes
70//
71// Revision 1.4 1997/08/19 20:41:47 sjp
72// Updated to use <package>/<file>.h include structure.
73// (Note: This version of the code has not been compiled)
74//
75// Revision 1.3 1997/01/31 20:10:24 sjp
76// Modified to use the new `bug' include files
77//
78// Revision 1.2 1997/01/21 20:30:30 sjp
79// Changed CPP flags and include because of library reorganization
80//
81// Revision 1.1 1996/11/04 17:15:04 sjp
82// Replacement for CHargedHypothesis Class
83//
84
85// system include files
86#include <string>
87
88// user include files
92//zoujh: ...
93//#include "AnalEvent/BStableParticle.h"
94
96#include "BesDChain/CDMud.h"
97
99
101
102//
103// constructors and destructor
104//
105
106template < DBCandidate::Hypo H >
108 CDCandidate( CDMud< EvtRecTrack >::get( aVisible ) ) ,
109 m_visibleEvidence( aVisible )
110{
111}
112
113//zoujh: ...
114/*
115template < DBCandidate::Hypo H >
116CDChargedVisible<H>::CDChargedVisible( BPion* aPion ) :
117 CDCandidate( CDMud< EvtRecTrack >::get( aPion->pionTrk()->bTrack()->dstTrack() ) ),
118 m_visibleEvidence( aPion->pionTrk()->bTrack()->dstTrack() )
119{
120}
121
122template < DBCandidate::Hypo H >
123CDChargedVisible<H>::CDChargedVisible( BKaon* aKaon ) :
124 CDCandidate( CDMud< EvtRecTrack >::get( aKaon->kaonTrk()->bTrack()->dstTrack() ) ),
125 m_visibleEvidence( aKaon->kaonTrk()->bTrack()->dstTrack() )
126{
127}
128*/
129
130//------ Constructor -----
131// copy constructor
132//
133template < DBCandidate::Hypo H >
135 CDCandidate( aOtherCDChargedHypo ) ,
136 m_visibleEvidence( aOtherCDChargedHypo.m_visibleEvidence )
137{
138}
139
140//------ Destructor -----
141//
142
143template < DBCandidate::Hypo H >
145{
146}
147
148//
149// assignment operators
150//
151
152//
153// member functions
154//
155
156//
157// const member functions
158//
159
160template < DBCandidate::Hypo H >
162{
163 return ( 0 != m_visibleEvidence ) ;
164}
165
166template < DBCandidate::Hypo H >
168{
169 return m_visibleEvidence;
170}
171
172
173//------ defaultKinematicData -----
174// create the kinematicData for this CDCandidate
175//
176
177template < DBCandidate::Hypo H >
179{
180 KinematicData* tmp = new KinematicData();
181
182 double mass = DBCandidate::mass( static_cast<DBCandidate::Hypo>(H) );
183
184 // original set, can be used again once kalTrack has charge and momentum available in memory
185 /*
186 if ( (const_cast<EvtRecTrack*>(m_visibleEvidence))->isMdcKalTrackValid() ) {
187 RecMdcKalTrack* mdcKalTrack = (const_cast<EvtRecTrack*>(m_visibleEvidence))->mdcKalTrack();
188
189 mdcKalTrack->setPidType( static_cast<RecMdcKalTrack::PidType>
190 (static_cast<DBCandidate::Hypo>(H) - 1) );
191
192 tmp->setCharge( mdcKalTrack->charge() );
193 //tmp->setMass( DBCandidate::mass( static_cast<DBCandidate::Hypo>(H) ) );
194 tmp->setMomentum( Hep3Vector(mdcKalTrack->px(), mdcKalTrack->py(), mdcKalTrack->pz()) );
195 }
196 */
197 //get momentume and chage from helix information directly
198
199 if ( (const_cast<EvtRecTrack*>(m_visibleEvidence))->isMdcKalTrackValid() ) {
200 RecMdcKalTrack* mdcKalTrack = (const_cast<EvtRecTrack*>(m_visibleEvidence))->mdcKalTrack();
201
202 mdcKalTrack->setPidType( static_cast<RecMdcKalTrack::PidType>
203 (static_cast<DBCandidate::Hypo>(H) - 1) );
204
205 int pid=static_cast<DBCandidate::Hypo>(H) - 1;
206
207 HepVector zhelix;
208 if(pid==0)
209 zhelix=mdcKalTrack->getZHelixE();
210 else if(pid==1)
211 zhelix=mdcKalTrack->getZHelixMu();
212 else if(pid==2)
213 zhelix=mdcKalTrack->getZHelix();
214 else if(pid==3)
215 zhelix=mdcKalTrack->getZHelixK();
216 else
217 zhelix=mdcKalTrack->getZHelixP();
218
219
220 double dr(0),phi0(0),kappa(0),dz(0),tanl(0);
221 dr=zhelix[0];
222 phi0=zhelix[1];
223 kappa=zhelix[2];
224 dz=zhelix[3];
225 tanl=zhelix[4];
226
227 int charge=0;
228
229 if (kappa > 0.0000000001)
230 charge = 1;
231 else if (kappa < -0.0000000001)
232 charge = -1;
233
234 double pxy=0;
235 if(kappa!=0) pxy = 1.0/fabs(kappa);
236
237 double px = pxy * (-sin(phi0));
238 double py = pxy * cos(phi0);
239 double pz = pxy * tanl;
240
241 double e = sqrt( pxy*pxy + pz*pz + mass*mass );
242
243 tmp->setCharge( charge );
244 //tmp->setMass( DBCandidate::mass( static_cast<DBCandidate::Hypo>(H) ) );
245 tmp->setP4( HepLorentzVector(px, py, pz, e));
246 }
247
248 else {
249 RecMdcTrack* mdcTrack = (const_cast<EvtRecTrack*>(m_visibleEvidence))->mdcTrack();
250 tmp->setCharge( mdcTrack->charge() );
251 double e = sqrt( mass*mass + mdcTrack->p3().mag2() );
252 tmp->setP4( HepLorentzVector(mdcTrack->p3(), e) );
253 }
254
255 return tmp;
256}
257
258#endif /* CLEODCHAIN_CDCHARGEDVISIBLE_CC */
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
double mass
virtual ~CDChargedVisible()
virtual bool builtFromTrack() const
virtual const EvtRecTrack * track() const
virtual DecayChain::KinematicData * defaultKinematicData() const
Definition: CDMud.h:45
static double mass(DBCandidate::Hypo aHypo)
Definition: DBCandidate.cxx:73
void setCharge(const int aCharge)
void setP4(const HepLorentzVector &aMomentum)
static void setPidType(PidType pidType)
const int charge() const
Definition: DstMdcTrack.h:53
const Hep3Vector p3() const
Definition: DstMdcTrack.h:43
const HepVector & getZHelix() const
HepVector & getZHelixP()
HepVector & getZHelixK()
HepVector & getZHelixE()
HepVector & getZHelixMu()
IMPLICIT REAL *A H
Definition: myXsection.h:1