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

#include <EvtLundCharm.hh>

Inheritance diagram for EvtLundCharm:

Public Member Functions

 EvtLundCharm ()
virtual ~EvtLundCharm ()
void getName (std::string &name)
EvtDecayBaseclone ()
void decay (EvtParticle *p)
std::string commandName ()
void command (std::string cmd)
void init ()
void initProbMax ()
int getTotalEvt ()
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 LundcrmInit (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)

Additional Inherited Members

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

Detailed Description

Definition at line 33 of file EvtLundCharm.hh.

Constructor & Destructor Documentation

◆ EvtLundCharm()

EvtLundCharm::EvtLundCharm ( )

Definition at line 69 of file EvtLundCharm.cc.

69{}

Referenced by clone().

◆ ~EvtLundCharm()

EvtLundCharm::~EvtLundCharm ( )
virtual

Definition at line 71 of file EvtLundCharm.cc.

71 {
72
73 int i;
74
75 // the deletion of commands is really uggly!
76
77 if ( nlundcharmdecays == 0 )
78 {
79 delete[] commands;
80 commands = 0;
81 return;
82 }
83
84 for ( i = 0; i < nlundcharmdecays; i++ )
85 {
86 if ( lundcharmdecays[i] == this )
87 {
88 lundcharmdecays[i] = lundcharmdecays[nlundcharmdecays - 1];
89 nlundcharmdecays--;
90 if ( nlundcharmdecays == 0 )
91 {
92 delete[] commands;
93 commands = 0;
94 }
95 return;
96 }
97 }
98
99 report( ERROR, "EvtGen" ) << "Error in destroying LundCharm model!" << endl;
100}
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49

Member Function Documentation

◆ clone()

EvtDecayBase * EvtLundCharm::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 104 of file EvtLundCharm.cc.

104{ return new EvtLundCharm; }

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 129 of file EvtLundCharm.cc.

129 {
130
131 if ( ncommand == lcommand )
132 {
133
134 lcommand = 10 + 2 * lcommand;
135
136 std::string* newcommands = new std::string[lcommand];
137
138 int i;
139
140 for ( i = 0; i < ncommand; i++ ) { newcommands[i] = commands[i]; }
141
142 delete[] commands;
143
144 commands = newcommands;
145 }
146
147 commands[ncommand] = cmd;
148
149 ncommand++;
150}

◆ commandName()

std::string EvtLundCharm::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 127 of file EvtLundCharm.cc.

127{ return std::string( "LundCharmPar" ); }

◆ decay()

void EvtLundCharm::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 152 of file EvtLundCharm.cc.

152 {
153
154 static int iniflag = 0;
155
156 static EvtId STRNG = EvtPDL::getId( "string" );
157
158 int istdheppar = EvtPDL::getStdHep( p->getId() );
159
160 /*
161 if (pycomp_(&istdheppar)==0){
162 report(ERROR,"EvtGen") << "LundCharm can not decay:"
163 <<EvtPDL::name(p->getId()).c_str()<<endl;
164 return;
165 }
166 */
167
168 // std::cout<<"Lundcharm decaying "<<EvtPDL::name(p->getId())<<" mass:
169 // "<<p->getP4().mass()<<std::endl;
170
171 // no eta_c(2S) in jetset74, so we don't include it in lundcharm
172 if ( istdheppar != 443 && istdheppar != 100443 && istdheppar != 10441 &&
173 istdheppar != 20443 && istdheppar != 445 && istdheppar != 10443 && istdheppar != 441 &&
174 istdheppar != 30443 )
175 {
176 std::cout << "EvtGen: EvtLundCharm cann't not decay the particle pid= " << istdheppar
177 << endl;
178 ::abort();
179 }
180
181 double mp = p->mass();
182 float xmp = mp;
183 double totEn = 0;
184 // std::cout<<"float xmp="<<xmp<<std::endl;
185
186 EvtVector4R p4[50];
187
188 int i, more, pflag;
189 ;
190 int ip = EvtPDL::getStdHep( p->getId() );
191 int ndaugjs;
192 static int kf[100];
193 EvtId evtnumstable[100], evtnumparton[100];
194 int stableindex[100], partonindex[100];
195 int numstable;
196 int numparton;
197 static int km[100];
198 EvtId type[MAX_DAUG];
199
200 static double px[100], py[100], pz[100], e[100];
201 static int myflag;
202 if ( iniflag == 0 )
203 lundcrm_( &iniflag, &istdheppar, &xmp, &ndaugjs, kf, km, px, py, pz, e, &myflag );
204 LundcrmInit( 0 ); // Allow user to set LundCharmPar in decay list
205
206 if ( p->getNDaug() != 0 ) { p->deleteDaughters( true ); }
207
208 string name_parent = EvtPDL::name( p->getId() );
209 double parityi = parityC::getC( name_parent );
210 int count = 0;
211 double totalM = 0;
212 do {
213 // report(INFO,"EvtGen") << "calling lundcharm " << ip<< " " << mp <<endl;
214 iniflag = iniflag + 1; // to count the event number
215 lundcrm_( &iniflag, &istdheppar, &xmp, &ndaugjs, kf, km, px, py, pz, e, &myflag );
216 //-- change myflag to unsigned int
217
218 p->setGeneratorFlag( myflag );
219 // std::cout<<"EvtLundCharm::setGeneratorFalg= "<<myflag<<std::endl;
220 numstable = 0;
221 numparton = 0;
222 // report(INFO,"EvtGen") << "found some daughters " << ndaugjs << endl;
223 totEn = 0;
224 double parityf = 1;
225 for ( i = 0; i < ndaugjs; i++ )
226 {
227 // std::cout<<"ndaugjs,kf,km,px,py,pz,e: "<<i<<", "<<km[i]<<", "<<kf[i]<<", "<<px[i]<<"
228 // ,"<<py[i]<<", "<<pz[i]<<", "<<e[i]<<std::endl; //for debugging
229 totEn += e[i];
230 string name_daugi = EvtPDL::name( EvtPDL::evtIdFromStdHep( kf[i] ) );
231 parityf = parityf * parityC::getC( name_daugi );
232 totalM += EvtPDL::getMeanMass( EvtPDL::evtIdFromStdHep( kf[i] ) );
233 if ( EvtPDL::evtIdFromStdHep( kf[i] ) == EvtId( -1, -1 ) )
234 {
235 report( ERROR, "EvtGen" ) << "LundCharm returned particle:" << kf[i] << endl;
236 report( ERROR, "EvtGen" ) << "This can not be translated to evt number" << endl;
237 report( ERROR, "EvtGen" ) << "and the decay will be rejected!" << endl;
238 report( ERROR, "EvtGen" ) << "The decay was of particle:" << ip << endl;
239 }
240
241 // sort out the partons
242 if ( abs( kf[i] ) <= 6 || kf[i] == 21 )
243 {
244 partonindex[numparton] = i;
245 evtnumparton[numparton] = EvtPDL::evtIdFromStdHep( kf[i] );
246 numparton++;
247 }
248 else
249 {
250 stableindex[numstable] = i;
251 evtnumstable[numstable] = EvtPDL::evtIdFromStdHep( kf[i] );
252 numstable++;
253 }
254
255 // have to protect against negative mass^2 for massless particles
256 // i.e. neutrinos and photons.
257 // this is uggly but I need to fix it right now....
258
259 if ( px[i] * px[i] + py[i] * py[i] + pz[i] * pz[i] >= e[i] * e[i] )
260 { e[i] = sqrt( px[i] * px[i] + py[i] * py[i] + pz[i] * pz[i] ) + 0.0000000001; }
261
262 p4[i].set( e[i], px[i], py[i], pz[i] );
263 }
264
265 int channel = EvtDecayTable::inChannelList( p->getId(), numstable, evtnumstable );
266
267 // Test the branching fraction of lundcharm
268 // the specified decay mode is put as the 0-th channel with specifing mother particle
269 /*
270 if(ip==100443 && channel==0){
271 nevt++;
272 std::cout<<"nevt= "<<nevt<<std::endl;
273 channel=-1;
274 }
275 */
276 // std::cout<<"channel= "<<channel<<std::endl;
277 if ( parityi != 0 && parityf != 0 ) { pflag = ( parityi != parityf ); }
278 else { pflag = 2; }
279
280 bool eck = fabs( xmp - totEn ) > 0.01;
281 // std::cout<<"eck= "<<eck<<", "<<fabs(xmp-totEn)<<std::endl;
282 more = ( channel != -1 || pflag == 1 || eck );
283 // more=(channel!=-1);
284
285 //---debugging
286 // std::cout<<"parentId= "<<istdheppar<<", pflag= "<<pflag<<std::endl;
287 // if(pflag==1) abort();
288
289 count++;
290
291 } while ( more && ( count < 10000 ) );
292
293 /*
294 if(fabs(xmp-totEn)>0.01){
295 std::cout<<"Warning:LUNDCHARM generate incomplet final state, "<<mp<<" "<<totEn<<endl;
296 ::abort();
297 }
298 */
299
300 if ( count > 9999 )
301 {
302 report( INFO, "EvtGen" ) << "Too many loops in EvtLundCharm!!!" << endl;
303 report( INFO, "EvtGen" ) << "Parent:" << EvtPDL::name( getParentId() ).c_str() << endl;
304 for ( i = 0; i < numstable; i++ )
305 {
306 report( INFO, "EvtGen" ) << "Daug(" << i << ")"
307 << EvtPDL::name( evtnumstable[i] ).c_str() << endl;
308 }
309 }
310
311 if ( numparton == 0 )
312 {
313
314 p->makeDaughters( numstable, evtnumstable );
315 int ndaugFound = 0;
316 for ( i = 0; i < numstable; i++ )
317 {
318 p->getDaug( i )->init( evtnumstable[i], p4[stableindex[i]] );
319 ndaugFound++;
320 }
321 if ( ndaugFound == 0 )
322 {
323 report( ERROR, "EvtGen" ) << "Lundcharm has failed to do a decay ";
324 report( ERROR, "EvtGen" ) << EvtPDL::name( p->getId() ).c_str() << " " << p->mass()
325 << endl;
326 assert( 0 );
327 }
328
329 fixPolarizations( p );
330
331 return;
332 }
333 else
334 {
335
336 // have partons in LUNDCHARM
337
338 EvtVector4R p4string( 0.0, 0.0, 0.0, 0.0 );
339
340 for ( i = 0; i < numparton; i++ ) { p4string += p4[partonindex[i]]; }
341
342 int nprimary = 1;
343 type[0] = STRNG;
344 for ( i = 0; i < numstable; i++ )
345 {
346 if ( km[stableindex[i]] == 0 ) { type[nprimary++] = evtnumstable[i]; }
347 }
348
349 p->makeDaughters( nprimary, type );
350
351 p->getDaug( 0 )->init( STRNG, p4string );
352
353 EvtVector4R p4partons[10];
354
355 for ( i = 0; i < numparton; i++ ) { p4partons[i] = p4[partonindex[i]]; }
356
357 ( (EvtStringParticle*)p->getDaug( 0 ) )->initPartons( numparton, p4partons, evtnumparton );
358
359 nprimary = 1;
360
361 for ( i = 0; i < numstable; i++ )
362 {
363
364 if ( km[stableindex[i]] == 0 )
365 { p->getDaug( nprimary++ )->init( evtnumstable[i], p4[stableindex[i]] ); }
366 }
367
368 int nsecond = 0;
369 for ( i = 0; i < numstable; i++ )
370 {
371 if ( km[stableindex[i]] != 0 ) { type[nsecond++] = evtnumstable[i]; }
372 }
373
374 p->getDaug( 0 )->makeDaughters( nsecond, type );
375
376 EvtVector4R p4stringboost( p4string.get( 0 ), -p4string.get( 1 ), -p4string.get( 2 ),
377 -p4string.get( 3 ) );
378
379 nsecond = 0;
380 for ( i = 0; i < numstable; i++ )
381 {
382 if ( km[stableindex[i]] != 0 )
383 {
384 p4[stableindex[i]] = boostTo( p4[stableindex[i]], p4stringboost );
385 p->getDaug( 0 )->getDaug( nsecond )->init( evtnumstable[i], p4[stableindex[i]] );
386 p->getDaug( 0 )->getDaug( nsecond )->setDiagonalSpinDensity();
387 p->getDaug( 0 )->getDaug( nsecond )->decay();
388 nsecond++;
389 }
390 }
391
392 if ( nsecond == 0 )
393 {
394 report( ERROR, "EvtGen" ) << "Jetset has failed to do a decay ";
395 report( ERROR, "EvtGen" ) << EvtPDL::name( p->getId() ).c_str() << " " << p->mass()
396 << endl;
397 assert( 0 );
398 }
399
400 fixPolarizations( p );
401
402 return;
403 }
404}
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
void lundcrm_(int *, int *, float *, int *, int *, int *, double *, double *, double *, double *, int *)
const int MAX_DAUG
DOUBLE_PRECISION count[3]
double mp
@ INFO
Definition EvtReport.hh:52
EvtId getParentId()
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static void LundcrmInit(int f)
static int getStdHep(EvtId id)
Definition EvtPDL.hh:61
static double getMeanMass(EvtId i)
Definition EvtPDL.hh:43
static EvtId evtIdFromStdHep(int stdhep)
Definition EvtPDL.cc:232
static std::string name(EvtId i)
Definition EvtPDL.hh:70
static EvtId getId(const std::string &name)
Definition EvtPDL.cc:272
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtId getId() const
void setGeneratorFlag(int flag)
void setDiagonalSpinDensity()
int getNDaug() const
EvtParticle * getDaug(int i)
void deleteDaughters(bool keepChannel=false)
double mass() const
void set(int i, double d)
static double getC(string parname)
Definition EvtParityC.cc:30

◆ getName()

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

Implements EvtDecayBase.

Definition at line 102 of file EvtLundCharm.cc.

102{ model_name = "LUNDCHARM"; }

◆ getTotalEvt()

int EvtLundCharm::getTotalEvt ( )
inline

Definition at line 49 of file EvtLundCharm.hh.

49{ return nevt; }

◆ init()

void EvtLundCharm::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 108 of file EvtLundCharm.cc.

108 {
109
110 // checkNArg(1);
112
113 if ( getParentId().isAlias() )
114 {
115
116 report( ERROR, "EvtGen" ) << "EvtLundCharm finds that you are decaying the" << endl
117 << " aliased particle " << EvtPDL::name( getParentId() ).c_str()
118 << " with the LundCharm model" << endl
119 << " this does not work, please modify decay table." << endl;
120 report( ERROR, "EvtGen" ) << "Will terminate execution!" << endl;
121 ::abort();
122 }
123
124 store( this );
125}
static void readParityC()
Definition EvtParityC.cc:5

◆ initProbMax()

void EvtLundCharm::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 106 of file EvtLundCharm.cc.

106{ noProbMax(); }

◆ LundcrmInit()

void EvtLundCharm::LundcrmInit ( int f)
static

Definition at line 463 of file EvtLundCharm.cc.

463 {
464
465 static int first = 1;
466 if ( first )
467 {
468
469 first = 0;
470 for ( int i = 0; i < ncommand; i++ )
471 lugive_( commands[i].c_str(), strlen( commands[i].c_str() ) );
472 }
473}
void lugive_(const char *cnfgstr, int length)
char * c_str(Index i)
Index first(Pair i)

Referenced by decay().


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