StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StL3Nuclei.cxx
1 #include "StL3Nuclei.h"
2 #include "StL3RareTrack.h"
3 #include "StEventTypes.h"
4 #include <stdlib.h>
5 
6 ClassImp(StL3Nuclei)
7 
8 StL3Nuclei::StL3Nuclei(float plow, float phigh, int charge, int mass)
9 {
10  pcut[0] = plow;
11  pcut[1] = phigh;
12  chargeToAccept = charge;
13  minMass = mass;
14 }
15 
16 int StL3Nuclei::Accept(StGlobalTrack* trk)
17 {
18  int iret = 0;
19  int chargeOK = 0;
20  int dedxOK = 0;
21  int pOK=0;
22  StL3RareTrack track(trk);
23  if (chargeToAccept==0)
24  chargeOK = 1;
25  else if (chargeToAccept<0 && track.chargesign()<0)
26  chargeOK = 1;
27  else if (chargeToAccept>0 && track.chargesign()>0)
28  chargeOK = 1;
29 
30  float dedxmin;
31  int theCharge = 1;
32  if (abs(chargeToAccept)>1)
33  theCharge = 2;
34  float dedxExp = track.dedxExpected(minMass*0.939, theCharge);
35  dedxmin = 0.6 * dedxExp; // within 40%
36  float dedx = track.dedx();
37 
38  //now I want to elimate tracks that are too close to more common particles.
39  float dedxbad;
40  if (minMass>1)
41  dedxbad = 1.1 * track.dedxExpected((minMass-1)*0.939, theCharge);
42  if (minMass==1)
43  dedxbad = 1.1 * track.dedxExpected(0.494, 1); //not kaon
44  if (dedx>dedxmin && dedx>dedxbad)
45  dedxOK = 1;
46 
47  // now select random tracks
48  float random_number = (float)rand()/(float)RAND_MAX;
49  // cout << "random number = " << random_number << endl;
50  if (random_number<0.005)
51  dedxOK = 1;
52 
53  if (track.p()>pcut[0] && track.p()<pcut[1] && track.npntfit()>20) pOK = 1;
54 
55  iret = chargeOK*dedxOK*pOK;
56  return iret;
57 }
58 void StL3Nuclei::Report(){
59  cout << "StL3Nuclei: charge = " << chargeToAccept << endl;
60  cout << "StL3Nuclei: mass >= " << minMass << endl;
61  cout << "StL3Nuclei: momentum > " << pcut << endl;
62 }