StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StKinkMaker.cxx
1 
10 #include <iostream>
11 #include <cstdlib>
12 #include <cstring>
13 #include "StMemStat.h"
14 #include "StKinkMaker.h"
15 #include "StKinkLocalTrack.hh"
16 #include "StTrackGeometry.h"
17 #include "StV0FinderMaker.h"
18 #include "StEvent/StEventTypes.h"
19 #include "StEvent.h"
20 #include "TMath.h"
21 #include "StTrack.h"
22 #include "tables/St_tkf_tkfpar_Table.h"
23 #include "StMessMgr.h"
24 
25 #include "math_constants.h"
26 #include "phys_constants.h"
27 #include "TVector2.h"
28 #include "StThreeVectorF.hh"
29 #include "TObjArray.h"
30 #include "SystemOfUnits.h"
31 
32 
33 #if !defined(ST_NO_NAMESPACES)
34 using namespace units;
35 #endif
36 
37 const double kaonMass= M_KAON_PLUS;
38 const double pionMass= M_PION_PLUS;
39 const double muonMass= M_MUON_PLUS;
40 const double pi0Mass= M_PION_0;
41 
42 const double kaonToMuonQ= 0.236;
43 const double kaonToPionQ= 0.205;
44 const double pionToMuonQ= 0.030;
45 
46 const int MAXNUMOFTRACKS= 10000;
47 const int SIZETRKIDCHECK= 1000;
48 
49 
50 //=======================================================================
51  StKinkMaker::StKinkMaker(const char *name):StMaker(name),m_tkfpar(0)
52 {
53  mTrack1 = 0;
54  mTrack2 = 0;
55  mGlobalTrks = 0;
56  mParentTrackCandidate=0;
57  mDaughterTrackCandidate=0;
58  mDaughterTrackUnic=0;
59  mUseTracker = kTrackerUseBOTH;
60  event = 0;
61  kinkVertex = 0;
62  mBfield = -2.; // arbitrary value, normalized after ...neat (gene)
63 }
64 //=======================================================================
65 StKinkMaker::~StKinkMaker(){
66 }
67 
68 //======================================================================
69 
79 
80  // m_Mode -> SetTrackerUsage()
81  if (m_Mode == 1) SetTrackerUsage(kTrackerUseTPT);
82  else if (m_Mode == 2) SetTrackerUsage(kTrackerUseITTF);
83  else if (m_Mode == 3) SetTrackerUsage(kTrackerUseBOTH);
84 
85 
86  return StMaker::Init();
87 }
88 //=============================================================================
89 Int_t StKinkMaker::InitRun(int runumber) {
90  m_tkfpar = (St_tkf_tkfpar*) GetDataBase("Calibrations/tracker/tkf_tkfpar");
91  if (!m_tkfpar) {
92  gMessMgr->Error(
93  "StKinkMaker::InitRun() : could not find tkf_tkfpar in database.");
94  return kStErr;
95  }
96  return StMaker::InitRun(runumber);
97  }
98 //=============================================================================
99 Int_t StKinkMaker::Make(){//called for each event
100 
101 
102  //******* variables
103  unsigned short nNodes,i,j;
104  int cutLast=0;
105  StKinkLocalTrack* tempTrack;
106  TObjArray trackArray(MAXNUMOFTRACKS);trackArray.SetOwner();
107 
108  tkf_tkfpar_st *tkfpar = m_tkfpar->GetTable();
109  gMessMgr->Info()<<"StKinkMaker: impact parameter"<<tkfpar->impactCut<<endm;
110  StThreeVectorF p,start,end;
111 
112  //******* GET
113  //### event
114  event = (StEvent*)GetInputDS("StEvent");
115  if (!event){
116  gMessMgr->Warning("StKinkMaker:no StEvent;skip event");
117  return kStWarn;
118  }
119 
120  //### primary vertex
121  StPrimaryVertex* vrtx=event->primaryVertex();
122  if (!vrtx){
123  gMessMgr->Warning("StKinkMaker:no primary vertex;skip event");
124  return kStWarn;
125  }
126  mEventVertex = vrtx->position(); //StThreeVectorD
127 
128  //### global tracks to use
129  StSPtrVecTrackNode& theNodes = event->trackNodes();
130  nNodes = theNodes.size();
131  mGlobalTrks=0;
132  for (i=0;i<nNodes;i++){
133  int nj = theNodes[i]->entries(global);
134  for (j=0; j<nj;j++){
135  StTrack* trk = theNodes[i]->track(global,j);
136  if( !acceptTrack(trk) )continue;
137 
138  //******* find the magnetic field
139  StTrackGeometry* trkGeom = trk->geometry();
140  if(!trkGeom) continue; //ignore the track if it has no geometry
141 
142  if(!mGlobalTrks)//calculate mBfield only for the first global trk from the event
143  {
144 
145  StThreeVectorD p11 = trk->geometry()->momentum();
146  StThreeVectorD p22 = trk->geometry()->helix().momentum(mBfield);
147 
148  if (fabs(p22.x()) > 1.e-20) mBfield *= p11.x()/p22.x();
149  else if (fabs(p22.y()) > 1.e-20) mBfield *= p11.y()/p22.y();
150  else continue;
151 
152  if (fabs(mBfield) < 1.e-20) return kStWarn;
153  }
154  mGlobalTrks++;
155  //### cut: fiducial volume
156 
157  Float_t trkStartRadius2D = trk->geometry()->origin().perp();
158  Float_t trkEndRadius2D = trk->outerGeometry()->origin().perp();
159  if (trkStartRadius2D < tkfpar->vertexRMin2D && //cut [133,179]
160  trkEndRadius2D > tkfpar->vertexRMax2D )
161  { continue;}
162  if (trkStartRadius2D < tkfpar->vertexRMax2D ||
163  trkEndRadius2D > tkfpar->vertexRMin2D ){
164  tempTrack = new StKinkLocalTrack(trk);
165  trackArray.Add(tempTrack);//keep the track if ok
166 
167  }
168  }//for each track in the node
169  } //for each node
170  //***************************************************************************************
171  // cout<<" magnetic field="<<mBfield<<endl;
172  //******* erase existing kinks; because everything runs in chain, the tkf makes its own kinks
173  StSPtrVecKinkVertex& kinkVertices = event->kinkVertices();
174  /* StMemStat memStat("kinkVertices");
175  kinkVertices.getEntries();
176  cout<<"memory used"<< memStat.Used();
177  */
178  kinkVertices.erase(kinkVertices.begin(),kinkVertices.end());
179  // kinkVertices.getEntries();
180  //cout<<"memory used"<< memStat.Used();
181  // StSPtrVecKinkVertex kinkVertices2;
182  //kinkVertices = kinkVertices2;
183 
184 //******* sorts by the trkStartRadius2D==>the potential parent trk, with
185  //smaller radius will be ahead of the potential daughters
186  if (trackArray.GetEntries() > 0) trackArray.Sort();
187  Int_t kinkCandidate=0;
188  Int_t cutPPt=0,cutPImpact=0,initial=0;
189 
190  int ni=trackArray.GetEntries();
191  for (i=0;i<ni;i++){//parent
192  initial++;
193  mTrack1 = (StKinkLocalTrack*)trackArray.At(i);
194  mParentTrackCandidate = mTrack1->trackBack();
195  StTrackGeometry* myParentGeometry1 = mParentTrackCandidate->geometry(); //first point
196  StTrackGeometry* myParentGeometry11 = mParentTrackCandidate->outerGeometry();//last point
197  StPhysicalHelixD parentHelix = myParentGeometry1->helix();
198  double parentPtot = myParentGeometry11->momentum().mag();
199  double parentPt = myParentGeometry11->momentum().perp();
200 
201  //### cut pT parent minimum = 0.2 Gev/c
202  if (myParentGeometry1->momentum().perp() < tkfpar->parentPtMin ) continue;
203  cutPPt++;
204 
205  //### cut : impact parameter parent
206  mParentImpact = parentHelix.distance(mEventVertex);
207  if (mParentImpact > tkfpar->impactCut ) continue;
208  cutPImpact++;
209  Int_t foundDaughters = 0;
210  int nj = trackArray.GetLast()+1;
211  for (j=i+1;j<nj;j++ ){//daughter
212  mTrack2 = (StKinkLocalTrack*)trackArray.At(j);
213  mDaughterTrackCandidate = mTrack2->trackBack();
214  StTrackGeometry* myDaughterGeometry1 = mDaughterTrackCandidate->geometry();//first point
215  StPhysicalHelixD daughterHelix = myDaughterGeometry1->helix();
216  double daughterPtot = myDaughterGeometry1->momentum().mag();
217  double daughterPt = myDaughterGeometry1->momentum().perp();
218 
219  //### cut: same charge
220  if (myParentGeometry1->charge() != myDaughterGeometry1->charge() ) continue;
221 
222  //### cut:low lim fiducial volume = 133cm
223  if (myDaughterGeometry1->origin().perp() < tkfpar->vertexRMin2D ) continue;
224 
225  //### cut:daughter impact parameter >2cm
226  mDaughterImpact = daughterHelix.distance(mEventVertex);
227  if (mDaughterImpact < mParentImpact) continue;
228 
229  //### cut:last_pt-first_pt < 14 (radial) and < 20 (z)
230  if (fabs(myDaughterGeometry1->origin().perp() - myParentGeometry11->origin().perp())
231  > tkfpar->parentLastDaughterStart2D ) continue;
232  if (fabs(myDaughterGeometry1->origin().z() - myParentGeometry11->origin().z())
233  > tkfpar->parentLastDaughterStartZ ) continue;
234  cutLast++;
235 
236 
237  //##############################################################
238  //2D method (gets 3D aproximation after two 2D solution //
239  // ***** START DETERMINATION 2D DCA .... good luck //
240  //###############################################################
241  //kink vertex; look at the intersection pts in 2d of the 2helices
242  pairD paths,path2,paths1; // helix pathLength vars;
243  TVector2 r1,r2,xc1 ,xc2,tmp2V; // for 2D helices projections
244  StThreeVectorD x1,x2,p1,p2,x1i,x2j ;//position and momentum at 2d dca
245  double separation,dxc; // helix circle params
246  double dca_12,dca_12tmp; // 2D dca ... helpers
247  double rad_1,rad_2;//radii of the projected helices
248  double distanceOne,distanceTwo;
249 
250  //### parent
251  xc1.Set(parentHelix.xcenter(),parentHelix.ycenter());//center of parent helix circle
252  r1.Set(parentHelix.origin().x(),parentHelix.origin().y());//first pt of the helix
253  r1 -= xc1;//distance
254  rad_1 = r1.Mod();//sqrt(x*x+y*y) length of the radius
255  //### daughter
256  xc2.Set(daughterHelix.xcenter(),daughterHelix.ycenter());//center of daughter helix circle
257  r2.Set(daughterHelix.origin().x(),daughterHelix.origin().y());//first pt on the helix
258  r2 -= xc2;//distance
259  rad_2 = r2.Mod();//sqrt(x*x+y*y) length of the radius
260 
261  tmp2V = xc1 - xc2;//distance between centers
262  dxc = tmp2V.Mod();//length =O1O2
263  separation = dxc - (rad_1+rad_2);//O1O2-(r1+r2)
264 
265  distanceOne = 0;
266  dca_12 = -9999;
267  dca_12tmp = -9999;
268  if (dxc==0)continue;
269  if (separation < 0){
270  if (dxc <= TMath::Abs(rad_1-rad_2)){//one helix circle, completely inside the other
271  double why = xc1.Y()-((rad_1+rad_2+dxc)*0.5 * (xc1.Y()-xc2.Y()))/dxc;
272  double ecs = xc1.X()-((rad_1+rad_2+dxc)*0.5 * (xc1.X()-xc2.X()))/dxc;
273  paths.first = parentHelix.pathLength(ecs,why);
274  paths.second = daughterHelix.pathLength(ecs,why);
275  x1 = parentHelix.at(paths.first);
276  x2 = daughterHelix.at(paths.second);
277  dca_12=x1.z()-x2.z();
278  }else {//2 intersection points=>2 solution, process those who aren't nan
279  //paths containes the path lengths for this solution with
280  //that for track 1 stores in 'first', and the track2 stored in 'second'
281  path2 = parentHelix.pathLength(rad_2,xc2.X(),xc2.Y());
282  if (!std::isnan(path2.first)){
283  paths.first = path2.first;
284  x1 = parentHelix.at(paths.first);
285  paths.second = daughterHelix.pathLength(x1.x(),x1.y());
286  x2 = daughterHelix.at(paths.second);
287  dca_12 = x1.z()-x2.z();
288  distanceOne = (x1-myDaughterGeometry1->origin()).mag();
289  }
290  if ((!std::isnan(path2.second))&&(path2.second!=path2.first))
291  { paths1.first = path2.second;
292  x1i = parentHelix.at(paths1.first);
293  paths1.second = daughterHelix.pathLength(x1i.x(),x1i.y());
294  x2j = daughterHelix.at(paths1.second);
295  distanceTwo = (x2j-myDaughterGeometry1->origin()).mag();
296  dca_12tmp = x1i.z()-x2j.z();
297 
298  if( distanceTwo < distanceOne){
299 
300  //second solution is better
301  dca_12 = dca_12tmp;
302  x1 = x1i;
303  x2 = x2j;
304  paths = paths1;
305  }//distance
306 
307  }else if (std::isnan(path2.second))//no solution
308  { continue;}
309  }
310 
311  }else if(separation==0){
312  double why = xc1.Y()-(rad_1 * (xc1.Y()-xc2.Y()))/dxc;
313  double ecs = xc1.X()-(rad_1 * (xc1.X()-xc2.X()))/dxc;
314  paths.first = parentHelix.pathLength(ecs,why);
315  paths.second = daughterHelix.pathLength(ecs,why);
316  x1 = parentHelix.at(paths.first);
317  x2 = daughterHelix.at(paths.second);
318  dca_12=x1.z()-x2.z();
319  }else if ((separation < tkfpar->dcaParentDaughterMax)){
320  //helix circles are close, but not overlapping
321  //find dca to point halfway between circle centers
322  tmp2V = (xc1 + xc2) * 0.5;
323  paths.first = parentHelix.pathLength(tmp2V.X(),tmp2V.Y());
324  paths.second = daughterHelix.pathLength(tmp2V.X(),tmp2V.Y());
325  x1 = parentHelix.at(paths.first);
326  x2 = daughterHelix.at(paths.second);
327  dca_12=x1.z()-x2.z();
328  // cout << "3rd case :xtarget = " << x1.x() << "\ty target =" << x1.y()<<endl;
329  }else {continue ;}//helix circle too far apart
330 
331 //### cut: kink vertex in fiducial volume [133,179]
332  if ((x1.perp() > tkfpar->vertexRMax2D)|| (x1.perp() < tkfpar->vertexRMin2D) ) continue;
333  if ((x2.perp() > tkfpar->vertexRMax2D)|| (x2.perp() < tkfpar->vertexRMin2D) ) continue;
334 //### cut: projectPointZDiff (2cm)
335  if (fabs(dca_12) > tkfpar->projectPointZDiff) continue;
336 
337 //at this point, dca_12 can be used in 3D calculation of the dca
338  //###############################################################
339  //DONE @D DCA < START 3D DCA FINDING# //
340  //##############################################################
341 
342  //### momentum of the 2 tracks , at the inters pt
343  mParentMoment = parentHelix.momentumAt(paths.first, mBfield);
344  mDaughterMoment = daughterHelix.momentumAt(paths.second, mBfield);
345 
346  //### cut: decay angle > 1
347  mDecayAngle = (1./degree) * mParentMoment.angle(mDaughterMoment);
348  if (mDecayAngle<tkfpar->thetaMin) continue;
349 
350 //### 3D dca between parent and daughter (comes out square)
351  StThreeVectorD temp3V;
352  double cos12,sin2_12,t1,t2; // 3D dca calculation vars
353  double temp;
354 
355  p1 = mParentMoment/parentPtot;
356  p2 = mDaughterMoment/daughterPtot;
357 
358  cos12 = p1.dot(p2);
359  sin2_12 = (1.0 - cos12)*(1.- cos12);
360  if( sin2_12){
361  temp = dca_12/sin2_12;
362  t1 = (-p1.z()+p2.z()*cos12)*temp;
363  t2 = ( p2.z()-p1.z()*cos12)*temp;
364 
365  temp = rad_1*(parentPtot/parentPt);
366  temp *= sin(t1/temp);
367  x1i = x1 + p1.pseudoProduct(temp,temp,t1);
368 
369  temp = rad_2*(daughterPtot/daughterPt);
370  temp *= sin(t2/temp);
371  x2j = x2 + p2.pseudoProduct(temp,temp,t2);
372 
373  dca_12tmp = (x1i - x2j).mag2();
374  dca_12 *= dca_12;
375 
376  if( dca_12tmp < dca_12){
377  paths.first = parentHelix.pathLength(x1i.x(),x1i.y());
378  paths.second = daughterHelix.pathLength(x2j.x(),x2j.y());
379  x1i = parentHelix.at(paths.first);
380  x2j = daughterHelix.at(paths.second);
381  dca_12tmp = (x1i - x2j).mag2();
382  if( dca_12tmp < dca_12){
383  x1 = x1i;
384  x2 = x2j;
385  mParentMoment = parentHelix.momentumAt(paths.first, mBfield);
386  mDaughterMoment = daughterHelix.momentumAt(paths.second,mBfield);
387  dca_12 = dca_12tmp;
388  }
389  }
390  }
391 
392 
393  //############ end 3D DCA CALCUALTION
394  mDca = sqrt(dca_12);
395 
396 
397  //###cut: 3D dca < .5
398  if (mDca>(tkfpar->dcaParentDaughterMax) ) continue;
399  // cout << " dca is = " << mDca;
400  //cutDca++;
401 
402  mKinkVertex = (x1 + x2) * 0.5;//vertex position
403  Float_t dx,dy;
404  dx = mKinkVertex.x() - myParentGeometry11->origin().x();
405  dy = mKinkVertex.y() - myParentGeometry11->origin().y();
406  Float_t distanceKinkParent2D = sqrt(dx*dx+dy*dy );
407  dx = mKinkVertex.x() - myDaughterGeometry1->origin().x();
408  dy = mKinkVertex.y() - myDaughterGeometry1->origin().y();
409  Float_t distanceKinkDaughter2D = sqrt(dx*dx+dy*dy );
410  Float_t distanceKinkParentZ = mKinkVertex.z() - myParentGeometry11->origin().z();
411  Float_t distanceKinkDaughterZ = mKinkVertex.z() - myDaughterGeometry1->origin().z();
412 
413  //cut: distance kink track :radial<14, z<20
414  if (distanceKinkParent2D > tkfpar->distanceKinkParent2D ) continue;
415  if (distanceKinkDaughter2D > tkfpar->distanceKinkDaughter2D ) continue;
416  if (distanceKinkParentZ > tkfpar->distanceKinkParentZ ) continue;
417  if (distanceKinkDaughterZ > tkfpar->distanceKinkDaughterZ ) continue;
418  foundDaughters++;
419  mDaughterTrackUnic = myDaughterGeometry1;
420  }//loop j.. daughters
421  if(foundDaughters!=1)continue;//if found more than 1 daugthers for one parent track,ignore it
422 
423  kinkCandidate++;
424  FillEvent(mDaughterTrackUnic,myParentGeometry11);
425  kinkVertices.push_back(kinkVertex);
426  // cout<<"foundDaugthers" <<foundDaughters<<endl;
427 
428  }//loop i .. parents
429  // trackArray.Delete();
430  gMessMgr->Info() << "StKinkMaker:: Found " << kinkCandidate << " kink candidates " << endm;
431 
432  //========================================================================
433  // Look for kinks in which 2 different parents are sharing the same daughter
434  // mark the coresonding kink vertices by changing the decayAngle value
435  // the new decay angle is [old*100+99]
436  // make the vertex found zombie ???!!!
437 
438  if(kinkVertices.size()>1) Crop();
439  return kStOK;
440 }
441 
442 //######################### DONE!!! ###############################################
443 
444 
446 void StKinkMaker::FillEvent(StTrackGeometry *myDaughterGeometry1,StTrackGeometry *myParentGeometry11){
447 
448  kinkVertex = new StKinkVertex();
449  StThreeVectorF pMomMinusdMom = mParentMoment - mDaughterMoment;
450  Float_t deltaKaonMuon = fabs(sqrt(mParentMoment.mag2() + kaonMass*kaonMass) -
451  sqrt(mDaughterMoment.mag2() + muonMass*muonMass) -
452  pMomMinusdMom.mag());
453  Float_t deltaKaonPion = fabs(sqrt(mParentMoment.mag2() + kaonMass*kaonMass) -
454  sqrt(mDaughterMoment.mag2() + pionMass*pionMass) -
455  sqrt(pMomMinusdMom.mag2() + pi0Mass*pi0Mass));
456  Float_t deltaPionMuon = fabs(sqrt(mParentMoment.mag2() + pionMass*pionMass) -
457  sqrt(mDaughterMoment.mag2() + muonMass*muonMass) -
458  pMomMinusdMom.mag());
459  //K-/+=>pi+/- + pi0
460  if ((deltaKaonPion < deltaKaonMuon) && (deltaKaonPion < deltaPionMuon) ){
461  Float_t asinArg = (mDaughterMoment.mag() / kaonToPionQ) * sin(mDecayAngle*degree);//sin(theta_cm)
462  if (fabs(asinArg) < 1. ) {
463  kinkVertex->setDecayAngleCM(float((1./degree) * asin(asinArg)));
464  }
465  else {
466  kinkVertex->setDecayAngleCM(999.) ;
467  }
468  if( myParentGeometry11->charge() > 0 ){ //parent K+
469  kinkVertex->setGeantIdDaughter(8);//daughter is pi+
470  kinkVertex->setGeantIdParent(11);
471  }
472  else {// parent K-
473  kinkVertex->setGeantIdDaughter(9);//daughter pi-
474  kinkVertex->setGeantIdParent(12);
475  }
476  } //K-/+=>mu+/- + (anti)neutrino
477  else if ((deltaKaonMuon < deltaKaonPion) && (deltaKaonMuon < deltaPionMuon) ) {
478  Float_t asinArg = (mDaughterMoment.mag() / kaonToMuonQ) * sin(mDecayAngle*degree);
479  if (fabs(asinArg) < 1. ) {
480  kinkVertex->setDecayAngleCM( (1./degree) * asin(asinArg) );
481  }
482  else {
483  kinkVertex->setDecayAngleCM( 999.) ;
484  }
485  if( myParentGeometry11->charge() > 0 ){ //parent K+
486  kinkVertex->setGeantIdDaughter(5);//daughter mu +
487  kinkVertex->setGeantIdParent(11);
488  }
489  else {//parent K-
490  kinkVertex->setGeantIdDaughter(6);//daughter mu-
491  kinkVertex->setGeantIdParent(12);
492  }
493  } else { //pi+/-=>mu+/- + (anti)neutrino
494  Float_t asinArg = (mDaughterMoment.mag() / pionToMuonQ) * sin(mDecayAngle*degree);
495  if( fabs(asinArg) < 1. ) {
496  kinkVertex->setDecayAngleCM( (1./degree) * asin(asinArg) );
497  }
498  else {
499  kinkVertex->setDecayAngleCM( 999.) ;
500  }
501  if (myParentGeometry11->charge() > 0 ){ //parent pi+
502  kinkVertex->setGeantIdDaughter(5);//daughter mu+
503  kinkVertex->setGeantIdParent(8);
504  }
505  else {//parent pi-
506  kinkVertex->setGeantIdDaughter(6);//daughter mu-
507  kinkVertex->setGeantIdParent(9);
508  }
509  }
510 
511  kinkVertex->setDcaParentDaughter(mDca);
512  kinkVertex->setDcaDaughterPrimaryVertex(mDaughterImpact);//dca daughter from event vertex
513  kinkVertex->setDcaParentPrimaryVertex(mParentImpact);//dca parent from event vertex
514 
515  //distance last point parent - first pt daughter
516  kinkVertex->setHitDistanceParentDaughter( (myDaughterGeometry1->origin() - myParentGeometry11->origin()).mag() );
517 
518  //distance last point parent primary vertex
519  kinkVertex->setHitDistanceParentVertex(sqrt( pow(mKinkVertex.x() - myParentGeometry11->origin().x(), 2) +
520  pow(mKinkVertex.y() - myParentGeometry11->origin().y(), 2) +
521  pow(mKinkVertex.z() - myParentGeometry11->origin().z(), 2)) );
522 
523  //set dE-delta enrgy for different deay hypotheses
524  kinkVertex->setdE(1,deltaKaonMuon);//dE for K->mu + (anti)neutrino
525  kinkVertex->setdE(2,deltaKaonPion);//dE for K->pi+pi0
526  kinkVertex->setdE(3,deltaPionMuon);//dE for pi->mu +(anti)neutrino
527 
528  //set momentum
529  kinkVertex->setParentMomentum(mParentMoment);
530  kinkVertex->setDaughterMomentum(mDaughterMoment);
531  kinkVertex->setParent(mParentTrackCandidate);
532 
533  //set dcay angle
534  kinkVertex->setDecayAngle(mDecayAngle);
535 
536  //add daughter
537  kinkVertex->addDaughter(mDaughterTrackCandidate);
538 
539  //set kinkVertex position
540  kinkVertex->setPosition(mKinkVertex);
541 }
542 
543 
559 {
560  //cout << "DEBUG Track [" << trk->fittingMethod() << "] [" << trk->flag() << "] FitIds ["
561  // << kKalmanFitId << "] [" << kITKalmanFitId << "] selector [" << mUseTracker << "]" << endl;
562 
563  // cut on flag
564  if (trk->flag() <= 0) return false;
565 
566  // on fittingMethod()
567  if (
568  //( trk->fittingMethod() == kHelix3DIdentifier && (mUseTracker == kTrackerUseTPT || mUseTracker == kTrackerUseBOTH) ) ||
569  ( trk->fittingMethod() != kITKalmanFitId && (mUseTracker == kTrackerUseTPT || mUseTracker == kTrackerUseBOTH) ) ||
570  ( trk->fittingMethod() == kITKalmanFitId && (mUseTracker == kTrackerUseITTF || mUseTracker == kTrackerUseBOTH) ) ){
571  return true;
572  } else {
573  return false;
574  }
575 
576 }
577 
578 
596 {
597  mUseTracker=opt;
598  gMessMgr->Info() << "StKinkMaker::SetTrackerUsage : Setting option to " << mUseTracker << endm;
599 }
600 
601 void StKinkMaker::Crop(){
602  // Loop over kinks and remove (makeZombie() )+ change the decay angle for those that have one daughter sharing two different parents
603  gMessMgr->Info()<<"StKinkMaker::Crop() : Starting ...."<<endm;
604  event = (StEvent *)GetInputDS("StEvent");
605  StSPtrVecKinkVertex& kinkVertices = event->kinkVertices();
606  StKinkVertex* kinkVtxPtr1 = 0;//new StKinkVertex();
607  StKinkVertex* kinkVtxPtr2 = 0;// new StKinkVertex();
608  StTrack* daughterTrk1 = 0;
609  StTrack* daughterTrk2 = 0;
610  int iKinks = kinkVertices.size();
612  // take pairs of consecutive kink vertices and check for same track key() for daugther
613  for(Int_t ikv1=0; ikv1<iKinks-1; ikv1++) {//first kink vertex from teh container
614  kinkVtxPtr1 = kinkVertices[ikv1];
615  daughterTrk1=kinkVtxPtr1->daughter();
616  // gMessMgr->Info()<<"###########StKinkMaker:daughter1->key()"<<daughterTrk1->key()<<endm;
617  for(Int_t ikv2=ikv1+1; ikv2<iKinks; ikv2++) {//next kink vertex in the container
618 
619  kinkVtxPtr2 = kinkVertices[ikv2];
620  daughterTrk2=kinkVtxPtr2->daughter();
621  // gMessMgr->Info()<<"###########StKinkMaker: daughter2->key()"<<daughterTrk2->key()<<endm;
622  if(daughterTrk1->key() == daughterTrk2->key()) {
623  float decAngKinkVtx1 = kinkVtxPtr1->decayAngle();
624  float decAngKinkVtx2 = kinkVtxPtr2->decayAngle();
625  kinkVtxPtr1->setDecayAngle(decAngKinkVtx1*100+99);
626  kinkVtxPtr2->setDecayAngle(decAngKinkVtx2*100+99);
627  }
628 
629  }//second vertex loop
630  }//first vtx loop
631 
633  // make Zombie the kink vertices with problems
634  // for(int ikv=iKinks-1;ikv>=0;ikv--){
635 // kinkVertex = kinkVertices[ikv];
636 // if( (kinkVertex->geantIdDaughter()%100) == 99){
637 
638 // kinkVertex->makeZombie();
639 // // gMessMgr->Info()<<"###########StKinkMaker: AFTER "<<kinkVertex->decayAngle()%100<<endm;
640 // iKinks--;
641 // }
642 // }
643 
644 // gMessMgr->Info()<<"StKinkMaker::Crop() : saving "<< iKinks << " Kink Candidates" <<endm;
645 
646 
647 }
Int_t m_Mode
counters
Definition: StMaker.h:81
auxiliary class for the kink finder
virtual Int_t Init()
Definition: StKinkMaker.cxx:78
virtual void SetTrackerUsage(Int_t opt=0)
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
Definition: StHelix.cc:240
virtual Int_t Make()
Definition: StKinkMaker.cxx:99
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
Definition: StHelix.cc:351
double ycenter() const
x-center of circle in xy-plane
Definition: StHelix.cc:215
void FillEvent(StTrackGeometry *myDaughterGeometry1, StTrackGeometry *myParentGeometry11)
Event filling.
const StThreeVector< double > & origin() const
-sign(q*B);
Definition: StHelix.hh:224
Definition: Stypes.h:42
Definition: Stypes.h:40
Definition: Stypes.h:44
double xcenter() const
aziumth in xy-plane measured from ring center
Definition: StHelix.cc:207
bool acceptTrack(StTrack *)