BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtOpenCharm Class Reference

#include <EvtOpenCharm.hh>

Inheritance diagram for EvtOpenCharm:

Public Member Functions

 EvtOpenCharm ()
virtual ~EvtOpenCharm ()
void getName (std::string &name)
EvtDecayBaseclone ()
void decay (EvtParticle *p)
std::string commandName ()
void command (std::string cmd)
void init ()
void initProbMax ()
int getTotalEvt ()
bool isbelong (EvtId myid)
int which_mode (EvtId myid)
Public Member Functions inherited from EvtDecayIncoherent
void makeDecay (EvtParticle *p)
virtual ~EvtDecayIncoherent ()
void setDaughterSpinDensity (int daughter)
int isDaughterSpinDensitySet (int daughter)
Public Member Functions inherited from EvtDecayBase
double getProbMax (double prob)
double resetProbMax (double prob)
 EvtDecayBase ()
virtual ~EvtDecayBase ()
virtual bool matchingDecay (const EvtDecayBase &other) const
EvtId getParentId ()
double getBranchingFraction ()
void disableCheckQ ()
void checkQ ()
int getNDaug ()
EvtIdgetDaugs ()
EvtId getDaug (int i)
int getNArg ()
int getPHOTOS ()
void setPHOTOS ()
void setVerbose ()
void setSummary ()
double * getArgs ()
std::string * getArgsStr ()
double getArg (int j)
std::string getArgStr (int j)
std::string getModelName ()
int getDSum ()
int summary ()
int verbose ()
void saveDecayInfo (EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
void printSummary ()
void setProbMax (double prbmx)
void noProbMax ()
void checkNArg (int a1, int a2=-1, int a3=-1, int a4=-1)
void checkNDaug (int d1, int d2=-1)
void checkSpinParent (EvtSpinType::spintype sp)
void checkSpinDaughter (int d1, EvtSpinType::spintype sp)
virtual int nRealDaughters ()

Static Public Member Functions

static void OpencrmInit (int f)
Static Public Member Functions inherited from EvtDecayBase
static void findMasses (EvtParticle *p, int ndaugs, EvtId daugs[10], double masses[10])
static void findMass (EvtParticle *p)
static double findMaxMass (EvtParticle *p)

Static Public Attributes

static int myiter = 1

Additional Inherited Members

Protected Member Functions inherited from EvtDecayBase
bool daugsDecayedByParentModel ()
Protected Attributes inherited from EvtDecayBase
bool _daugsDecayedByParentModel

Detailed Description

Definition at line 34 of file EvtOpenCharm.hh.

Constructor & Destructor Documentation

◆ EvtOpenCharm()

EvtOpenCharm::EvtOpenCharm ( )

Definition at line 62 of file EvtOpenCharm.cc.

62{}

Referenced by clone().

◆ ~EvtOpenCharm()

EvtOpenCharm::~EvtOpenCharm ( )
virtual

Definition at line 64 of file EvtOpenCharm.cc.

64 {
65
66 int i;
67
68 // the deletion of commands is really uggly!
69
70 if ( nOpencharmdecays == 0 )
71 {
72 delete[] commands;
73 commands = 0;
74 return;
75 }
76
77 for ( i = 0; i < nOpencharmdecays; i++ )
78 {
79 if ( Opencharmdecays[i] == this )
80 {
81 Opencharmdecays[i] = Opencharmdecays[nOpencharmdecays - 1];
82 nOpencharmdecays--;
83 if ( nOpencharmdecays == 0 )
84 {
85 delete[] commands;
86 commands = 0;
87 }
88 return;
89 }
90 }
91
92 report( ERROR, "EvtGen" ) << "Error in destroying OpenCharm model!" << endl;
93}
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49

Member Function Documentation

◆ clone()

EvtDecayBase * EvtOpenCharm::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 97 of file EvtOpenCharm.cc.

97{ return new EvtOpenCharm; }

◆ command()

void EvtOpenCharm::command ( std::string cmd)
virtual

Reimplemented from EvtDecayBase.

Definition at line 121 of file EvtOpenCharm.cc.

121 {
122
123 if ( ncommand == lcommand )
124 {
125
126 lcommand = 10 + 2 * lcommand;
127
128 std::string* newcommands = new std::string[lcommand];
129
130 int i;
131
132 for ( i = 0; i < ncommand; i++ ) { newcommands[i] = commands[i]; }
133
134 delete[] commands;
135
136 commands = newcommands;
137 }
138
139 commands[ncommand] = cmd;
140
141 ncommand++;
142}

◆ commandName()

std::string EvtOpenCharm::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 119 of file EvtOpenCharm.cc.

119{ return std::string( "OpenCharmPar" ); }

◆ decay()

void EvtOpenCharm::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 144 of file EvtOpenCharm.cc.

144 {
145
146 int istdheppar = EvtPDL::getStdHep( p->getId() );
147
148 if ( istdheppar != 9000443 && istdheppar != 9010443 && istdheppar != 9030443 &&
149 istdheppar != 9020443 )
150 {
151 std::cout << "EvtGen: EvtOpenCharm cann't not decay the particle pid= " << istdheppar
152 << endl;
153 ::abort();
154 }
155
156 double mp = p->mass();
157 float xmp = mp;
158 double totEn = 0;
159
160 // debugging
161 // std::cout<<"parent "<<EvtPDL::name(p->getId())<<"float xmp="<<xmp<<"
162 // "<<p->getP4Lab()<<std::endl;
163
164 EvtVector4R p4[20];
165
166 int i, more;
167 int ip = EvtPDL::getStdHep( p->getId() );
168 int ndaugjs;
169
170 static int myflag;
171 EvtPsi3Sdecay theIni;
172 EvtId pid = p->getId();
173
174 static int themode;
175 if ( getNArg() == 1 )
176 {
177 themode = getArg( 0 );
178 theIni.setMode( themode );
179 }
180
181 int count = 0;
182 do {
183
184 theIni.PHSPDecay( p );
185 std::vector<EvtVector4R> v_p4 = theIni.getDaugP4();
186 std::vector<EvtId> Vid = theIni.getDaugId();
187 ndaugjs = Vid.size();
188
189 EvtId myId[3];
190
191 for ( int i = 0; i < ndaugjs; i++ ) { myId[i] = Vid[i]; }
192
193 if ( p->getNDaug() != 0 ) p->resetNDaug();
194 p->makeDaughters( ndaugjs, myId );
195
196 for ( int i = 0; i < ndaugjs; i++ )
197 {
198 // std::cout<<"Vid "<<EvtPDL::name(Vid[i])<<" p4: "<<v_p4[i]<<std::endl;
199 p->getDaug( i )->init( Vid[i], v_p4[i] );
200 }
201
202 theMode = theIni.getMode();
203 p->setGeneratorFlag( theMode );
204
205 totEn = 0;
206 for ( i = 0; i < ndaugjs; i++ )
207 {
208 totEn += p->getDaug( i )->getP4().get( 0 );
209 if ( p->getDaug( i )->getId() == EvtId( -1, -1 ) )
210 {
211 report( ERROR, "EvtGen" )
212 << "OpenCharm returned particle:" << EvtPDL::name( p->getDaug( i )->getId() )
213 << endl;
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;
217 }
218 }
219 int channel = EvtDecayTable::inChannelList( p->getId(), ndaugjs, myId );
220
221 // std::cout<<"channel= "<<channel<<std::endl;
222 more = ( channel != -1 );
223 // if(more){std::cout<<"count= "<<count<<" inchannel= "<<channel<<std::endl;}
224
225 count++;
226
227 } while ( more && ( count < 10000 ) );
228
229 if ( fabs( xmp - totEn ) > 0.01 )
230 {
231 std::cout << "Warning:OPENCHARM generate incomplet final state, " << mp << " " << totEn
232 << endl;
233 ::abort();
234 }
235
236 if ( count > 9999 )
237 {
238 report( INFO, "EvtGen" ) << "Too many loops in EvtOpenCharm!!!" << endl;
239 report( INFO, "EvtGen" ) << "Parent:" << EvtPDL::name( getParentId() ).c_str() << endl;
240 }
241
242 fixPolarizations( p );
243
244 return;
245}
DOUBLE_PRECISION count[3]
double mp
@ INFO
Definition EvtReport.hh:52
double getArg(int j)
EvtId getParentId()
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static int getStdHep(EvtId id)
Definition EvtPDL.hh:61
static std::string name(EvtId i)
Definition EvtPDL.hh:70
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void resetNDaug()
EvtId getId() const
void setGeneratorFlag(int flag)
const EvtVector4R & getP4() const
int getNDaug() const
EvtParticle * getDaug(int i)
double mass() const
void PHSPDecay(EvtParticle *par)
void setMode(int m)
std::vector< EvtVector4R > getDaugP4()
std::vector< EvtId > getDaugId()
double get(int i) const

◆ getName()

void EvtOpenCharm::getName ( std::string & name)
virtual

Implements EvtDecayBase.

Definition at line 95 of file EvtOpenCharm.cc.

95{ model_name = "OPENCHARM"; }

◆ getTotalEvt()

int EvtOpenCharm::getTotalEvt ( )
inline

Definition at line 50 of file EvtOpenCharm.hh.

50{ return nevt; }

◆ init()

void EvtOpenCharm::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 101 of file EvtOpenCharm.cc.

101 {
102
103 // checkNArg(1);
104
105 if ( getParentId().isAlias() )
106 {
107
108 report( ERROR, "EvtGen" ) << "EvtOpenCharm finds that you are decaying the" << endl
109 << " aliased particle " << EvtPDL::name( getParentId() ).c_str()
110 << " with the OpenCharm model" << endl
111 << " this does not work, please modify decay table." << endl;
112 report( ERROR, "EvtGen" ) << "Will terminate execution!" << endl;
113 ::abort();
114 }
115
116 store( this );
117}

◆ initProbMax()

void EvtOpenCharm::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 99 of file EvtOpenCharm.cc.

99{ noProbMax(); }

◆ isbelong()

bool EvtOpenCharm::isbelong ( EvtId myid)

Definition at line 314 of file EvtOpenCharm.cc.

314 {
315 for ( int i = 0; i < mypar.size(); i++ )
316 {
317 if ( myid == mypar[i] )
318 {
319 _index = i;
320 return true;
321 }
322 }
323 return false;
324}

◆ OpencrmInit()

void EvtOpenCharm::OpencrmInit ( int f)
static

Definition at line 312 of file EvtOpenCharm.cc.

312{}

◆ which_mode()

int EvtOpenCharm::which_mode ( EvtId myid)

Definition at line 326 of file EvtOpenCharm.cc.

326 {
327 for ( int i = 0; i < mypar.size(); i++ )
328 {
329 if ( myid == mypar[i] )
330 {
331 _index = i;
332 return i;
333 }
334 }
335 std::cout << "EvtOpenCharm::which_mode() fails to find element" << std::endl;
336 abort();
337}

Member Data Documentation

◆ myiter

int EvtOpenCharm::myiter = 1
static

Definition at line 53 of file EvtOpenCharm.hh.


The documentation for this class was generated from the following files: