CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CoreSimTrack.cc
Go to the documentation of this file.
2 
3 const float onethird = 1./3.;
4 const float twothird = 2./3.;
5 const float chg[109] = {
7  -1,0,-1,0,-1,0,-1,0,0,0,
8  0,0, 0,1, 0,0, 0,0,0,0,
9  1,0, 1,2, 0,0, 1,2,0,0,
11  -1,0,-1,0,-1,0, 0,0,0,0,
13  -1,0,-1,0,-1,0, 1,1,0,0,
14  0,0, 0,0, 0,0, 0,0,0,0,
15  0,0, 0,0, 0,0, 0,0,0,0,
16  0,0, 0,0, 0,0, 0,0,0};
17 
18 float CoreSimTrack::charge() const {
19  float hepchg = 0;
20  if(thePID != 0) {
21  int kqa = std::abs(thePID);
22  if(kqa < 10000000) {
23  //... direct translation
24  if(kqa<=100) {hepchg = chg[kqa-1];}
25  //... deuteron or tritium
26  else if(kqa==100 || kqa==101) {hepchg = -1;}
27  //... alpha or He3
28  else if(kqa==102 || kqa==104) {hepchg = -2;}
29  else if(kqa%10 != 0) {
30  int kqx=kqa/1000000%10;
31  int kq3=kqa/1000%10;
32  int kq2=kqa/100%10;
33  int kq1=kqa/10%10;
34  int irt=kqa%10000;
35  if(kqx>0 && irt<100) {
36  hepchg = chg[irt-1];
37  if(kqa==5100061 || kqa==5100062) {hepchg = 2;}
38  } else if(kq3==0) {
39  // Construction from quark content for heavy meson,
40  // diquark, baryon, mesons.
41  hepchg = chg[kq2-1]-chg[kq1-1];
42  //...Strange or beauty mesons.
43  if((kq2==3) || (kq2==5)) {hepchg = chg[kq1-1]-chg[kq2-1];}
44  } else if(kq1 == 0) {
45  //...Diquarks.
46  hepchg = chg[kq3-1] + chg[kq2-1];
47  } else {
48  //...Baryons
49  hepchg = chg[kq3-1]+chg[kq2-1]+chg[kq1-1];
50  }
51  }
52  //... fix sign of charge
53  if(thePID<0) {hepchg = -hepchg;}
54  }
55  }
56  return hepchg;
57 }
58 
59 std::ostream & operator <<(std::ostream & o , const CoreSimTrack& t)
60 {
61  o << t.type() << ", ";
62  o << t.momentum();
63  return o;
64 }
const float chg[109]
Definition: CoreSimTrack.cc:5
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
float charge() const
charge
Definition: CoreSimTrack.cc:18
const float onethird
Definition: CoreSimTrack.cc:3
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const float twothird
Definition: CoreSimTrack.cc:4
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:25
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:22