BOSS 7.1.2
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 34 of file EvtLundCharm.hh.

Constructor & Destructor Documentation

◆ EvtLundCharm()

EvtLundCharm::EvtLundCharm ( )

Definition at line 72 of file EvtLundCharm.cc.

72{}

Referenced by clone().

◆ ~EvtLundCharm()

EvtLundCharm::~EvtLundCharm ( )
virtual

Definition at line 74 of file EvtLundCharm.cc.

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

Member Function Documentation

◆ clone()

EvtDecayBase * EvtLundCharm::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 111 of file EvtLundCharm.cc.

111 {
112
113 return new EvtLundCharm;
114
115}

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 154 of file EvtLundCharm.cc.

154 {
155
156 if (ncommand==lcommand){
157
158 lcommand=10+2*lcommand;
159
160 std::string* newcommands=new std::string[lcommand];
161
162 int i;
163
164 for(i=0;i<ncommand;i++){
165 newcommands[i]=commands[i];
166 }
167
168 delete [] commands;
169
170 commands=newcommands;
171
172 }
173
174 commands[ncommand]=cmd;
175
176 ncommand++;
177
178
179}

◆ commandName()

std::string EvtLundCharm::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 148 of file EvtLundCharm.cc.

148 {
149
150 return std::string("LundCharmPar");
151
152}

◆ decay()

void EvtLundCharm::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 183 of file EvtLundCharm.cc.

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

◆ getName()

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

Implements EvtDecayBase.

Definition at line 105 of file EvtLundCharm.cc.

105 {
106
107 model_name="LUNDCHARM";
108
109}

◆ getTotalEvt()

int EvtLundCharm::getTotalEvt ( )
inline

Definition at line 51 of file EvtLundCharm.hh.

51{return nevt;}

◆ init()

void EvtLundCharm::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 125 of file EvtLundCharm.cc.

125 {
126
127// checkNArg(1);
129
130 if (getParentId().isAlias()){
131
132 report(ERROR,"EvtGen") << "EvtLundCharm finds that you are decaying the"<<endl
133 << " aliased particle "
134 << EvtPDL::name(getParentId()).c_str()
135 << " with the LundCharm model"<<endl
136 << " this does not work, please modify decay table."
137 << endl;
138 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
139 ::abort();
140
141 }
142
143 store(this);
144
145}
static void readParityC()
Definition EvtParityC.cc:6

◆ initProbMax()

void EvtLundCharm::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 118 of file EvtLundCharm.cc.

118 {
119
120 noProbMax();
121
122}

◆ LundcrmInit()

void EvtLundCharm::LundcrmInit ( int f)
static

Definition at line 500 of file EvtLundCharm.cc.

500 {
501
502 static int first=1;
503 if (first){
504
505 first=0;
506 for(int i=0;i<ncommand;i++)
507 lugive_(commands[i].c_str(),strlen(commands[i].c_str()));
508 }
509
510
511}
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: