BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtDecayTag.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of models developed at BES collaboration
5// based on the EvtGen framework. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/BesCopyright
9// Copyright (A) 2006 Ping Rong-Gang @IHEP
10//
11// Module: EvtDecayTag.cc
12//
13// Description: Class to deal with the decay tag, e.g. the decay mode and multiplicity
14//
15// Modification history:
16//
17// Ping R.-G. December, 2011-Jan Module created
18//
19//------------------------------------------------------------------------
20//
21
22#include "EvtDecayTag.hh"
23#include <iostream>
24
25using std::endl;
26using std::fstream;
27
29
30 int ndaug = par->getNDaug();
31 if ( ndaug < 2 )
32 {
33 EvtId id = par->getId();
34 int theTag = TagIndex( id );
35 _multiplicity[theTag]++;
36 }
37 else
38 {
39 //--
40 if ( par == root_par )
41 {
42 int theMode = root_par->getChannel();
43 _nmode.push_back( theMode );
44 }
45 //--
46 int ND = 0;
47 EvtParticle* theD;
48 for ( int i = 0; i < ndaug; i++ )
49 {
50 EvtParticle* theDaug = par->getDaug( i );
51 if ( par == root_par && theDaug->getNDaug() != 0 )
52 {
53 int theMode = theDaug->getChannel();
54 _nmode.push_back( theMode );
55 ND++;
56 theD = theDaug;
57 }
58
59 int id = EvtPDL::getStdHep( theDaug->getId() );
60 if ( id == 310 ) _multiplicity[6]++; // Ks
61 if ( id == 3122 ) _multiplicity[7]++; // Lambda or Lambdabar
62 makeTag( theDaug );
63 }
64 //-- for root particle decays into only one unstable particle, the flag1 further tag the
65 // third decay
66 if ( ND == 1 )
67 {
68 int NDD = theD->getNDaug();
69 for ( int i = 0; i < NDD; i++ )
70 {
71 EvtParticle* theDD = theD->getDaug( i );
72 if ( theDD->getNDaug() != 0 )
73 {
74 int ndd = theDD->getChannel();
75 _nmode.push_back( ndd );
76 break;
77 }
78 }
79 }
80 //-------------------
81 }
82}
83
85 /**
86 * gamma : 0
87 * e+/e- : 1
88 * mu+/- : 2
89 * pi+/- : 3
90 * K+/- : 4
91 * p+/- : 5
92 * Ks : 6
93 * Lambda: 7
94 * others: 8
95 **/
96
97 int id = EvtPDL::getStdHep( pid );
98 int absid = fabs( id );
99 if ( absid == 22 ) { return 0; } // photon
100 else if ( absid == 11 ) { return 1; } // electron
101 else if ( absid == 13 ) { return 2; } // muon
102 else if ( absid == 211 ) { return 3; } // pion
103 else if ( absid == 321 ) { return 4; } // Kaon
104 else if ( absid == 2212 ) { return 5; } // pronton / anti-proton
105 else if ( absid == 310 ) { return 6; } // Ks
106 else if ( absid == 3122 ) { return 7; } // Lambda / Lambdabar
107 else { return 8; }
108}
109
111 // get ConExc 74110 mode selected index
112 std::vector<int> intFlag = root_par->getIntFlag();
113 if ( intFlag.size() > 0 )
114 {
115 if ( intFlag[0] == 74110 || intFlag[0] == -100 ) return intFlag[1];
116 }
117
118 /**
119 * coding root_parent_mode * 10^9 + daug_0*10^6 + daug_1*10^3
120 **/
121 double seg0, seg1, seg2;
122
123 int three = 1000;
124 int six = 1000000;
125 int themode = 1000000000;
126 //---debugging
127 // for(int im=0;im<_nmode.size();im++){std::cout<<"_nmode["<<im<<"]"<<_nmode[im]<<endl;;}
128
129 if ( _nmode.size() == 1 )
130 {
131 themode += _nmode[0] * six;
132 return themode;
133 }
134 else if ( _nmode.size() == 2 )
135 {
136 seg0 = _nmode[0] * six;
137 seg1 = _nmode[1] * three;
138 themode += seg0 + seg1;
139 return themode;
140 }
141 else if ( _nmode.size() >= 3 )
142 {
143 seg0 = _nmode[0] * six;
144 seg1 = _nmode[1] * three;
145 seg2 = _nmode[2];
146 themode += seg0 + seg1 + seg2;
147 return themode;
148 }
149
150 return 0; // pingrg
151}
152
154 /**
155 * 10 digit in the order: N_gamma, N_gamma, N_e, N_mu, N_pi,
156 * N_Kaon, N_p, N_Ks, N_Lambda,DecayType
157 **/
158 int thetag = 0;
159 for ( int i = 1; i < 9; i++ )
160 {
161 if ( _multiplicity[i] > 9 ) return 0;
162 }
163 for ( int i = 0; i < 9; i++ )
164 {
165 int ndx = 8 - i;
166 int dig = pow( 10, ndx );
167 thetag += dig * _multiplicity[i];
168 }
169 return thetag;
170}
171
172int EvtDecayTag::getHdrdBase( int index ) {
173 int ten = 10;
174 int base;
175 if ( index == 0 || index >= 100 && index < 1000 ) { return index; }
176 else
177 {
178 base = index * ten;
179 return getHdrdBase( base );
180 }
181}
void makeTag(EvtParticle *par)
int getHdrdBase(int index)
int TagIndex(EvtId pid)
Definition EvtId.hh:27
static int getStdHep(EvtId id)
Definition EvtPDL.hh:61
EvtId getId() const
int getNDaug() const
EvtParticle * getDaug(int i)
int getChannel() const