44using std::resetiosflags;
45using std::setiosflags;
48int EvtOpenCharm::nOpencharmdecays = 0;
50int EvtOpenCharm::ntable = 0;
52int EvtOpenCharm::ncommand = 0;
53int EvtOpenCharm::lcommand = 0;
54std::string* EvtOpenCharm::commands = 0;
55int EvtOpenCharm::nevt = 0;
58std::vector<EvtId> EvtOpenCharm::mypar;
59std::vector<int> EvtOpenCharm::vmode;
60std::vector<double> EvtOpenCharm::Vcms;
70 if ( nOpencharmdecays == 0 )
77 for ( i = 0; i < nOpencharmdecays; i++ )
79 if ( Opencharmdecays[i] ==
this )
81 Opencharmdecays[i] = Opencharmdecays[nOpencharmdecays - 1];
83 if ( nOpencharmdecays == 0 )
92 report(
ERROR,
"EvtGen" ) <<
"Error in destroying OpenCharm model!" << endl;
108 report(
ERROR,
"EvtGen" ) <<
"EvtOpenCharm finds that you are decaying the" << endl
110 <<
" with the OpenCharm model" << endl
111 <<
" this does not work, please modify decay table." << endl;
112 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
123 if ( ncommand == lcommand )
126 lcommand = 10 + 2 * lcommand;
128 std::string* newcommands =
new std::string[lcommand];
132 for ( i = 0; i < ncommand; i++ ) { newcommands[i] = commands[i]; }
136 commands = newcommands;
139 commands[ncommand] = cmd;
148 if ( istdheppar != 9000443 && istdheppar != 9010443 && istdheppar != 9030443 &&
149 istdheppar != 9020443 )
151 std::cout <<
"EvtGen: EvtOpenCharm cann't not decay the particle pid= " << istdheppar
185 std::vector<EvtVector4R> v_p4 = theIni.
getDaugP4();
186 std::vector<EvtId> Vid = theIni.
getDaugId();
187 ndaugjs = Vid.size();
191 for (
int i = 0; i < ndaugjs; i++ ) { myId[i] = Vid[i]; }
196 for (
int i = 0; i < ndaugjs; i++ )
206 for ( i = 0; i < ndaugjs; i++ )
214 report(
ERROR,
"EvtGen" ) <<
"This can not be translated to evt number" << endl;
215 report(
ERROR,
"EvtGen" ) <<
"and the decay will be rejected!" << endl;
216 report(
ERROR,
"EvtGen" ) <<
"The decay was of particle:" << ip << endl;
222 more = ( channel != -1 );
227 }
while ( more && (
count < 10000 ) );
229 if ( fabs( xmp - totEn ) > 0.01 )
231 std::cout <<
"Warning:OPENCHARM generate incomplet final state, " <<
mp <<
" " << totEn
238 report(
INFO,
"EvtGen" ) <<
"Too many loops in EvtOpenCharm!!!" << endl;
242 fixPolarizations( p );
247void EvtOpenCharm::fixPolarizations(
EvtParticle* p ) {
262 for ( i = 0; i < ndaug; i++ )
265 bool bflag = ( idp == Jpsi || idp == psip || idp == psipp || idp == psi_a ||
266 idp == psi_b || idp == psi_c );
273 rho.
Set( 0, 0, 0.5 );
274 rho.
Set( 0, 1, 0.0 );
275 rho.
Set( 0, 2, 0.0 );
277 rho.
Set( 1, 0, 0.0 );
278 rho.
Set( 1, 1, 1.0 );
279 rho.
Set( 1, 2, 0.0 );
281 rho.
Set( 2, 0, 0.0 );
282 rho.
Set( 2, 1, 0.0 );
283 rho.
Set( 2, 2, 0.5 );
287 double alpha = atan2( p4Psi.
get( 2 ), p4Psi.
get( 1 ) );
288 double beta = acos( p4Psi.
get( 3 ) / p4Psi.
d3mag() );
298 if ( nOpencharmdecays == ntable )
303 for ( i = 0; i < ntable; i++ ) { newOpencharmdecays[i] = Opencharmdecays[i]; }
304 ntable = 2 * ntable + 10;
305 delete[] Opencharmdecays;
306 Opencharmdecays = newOpencharmdecays;
309 Opencharmdecays[nOpencharmdecays++] = jsdecay;
315 for (
int i = 0; i < mypar.size(); i++ )
317 if ( myid == mypar[i] )
327 for (
int i = 0; i < mypar.size(); i++ )
329 if ( myid == mypar[i] )
335 std::cout <<
"EvtOpenCharm::which_mode() fails to find element" << std::endl;
EvtDecayBase * EvtDecayBasePtr
EvtDecayBase * EvtDecayBasePtr
DOUBLE_PRECISION count[3]
ostream & report(Severity severity, const char *facility)
void setDaughterSpinDensity(int daughter)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
int which_mode(EvtId myid)
std::string commandName()
void command(std::string cmd)
static void OpencrmInit(int f)
void getName(std::string &name)
bool isbelong(EvtId myid)
void decay(EvtParticle *p)
static int getStdHep(EvtId id)
static std::string name(EvtId i)
static EvtId getId(const std::string &name)
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void setGeneratorFlag(int flag)
const EvtVector4R & getP4() const
EvtParticle * getDaug(int i)
void PHSPDecay(EvtParticle *par)
std::vector< EvtVector4R > getDaugP4()
std::vector< EvtId > getDaugId()
void Set(int i, int j, const EvtComplex &rhoij)