BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtTauola Class Reference

#include <EvtTauola.hh>

+ Inheritance diagram for EvtTauola:

Public Member Functions

 EvtTauola ()
 
virtual ~EvtTauola ()
 
void getName (std::string &name)
 
EvtDecayBaseclone ()
 
void decay (EvtParticle *p)
 
std::string commandName ()
 
void command (std::string cmd)
 
void init ()
 
void initProbMax ()
 
- 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
virtual void getName (std::string &name)=0
 
virtual void decay (EvtParticle *p)=0
 
virtual void makeDecay (EvtParticle *p)=0
 
virtual EvtDecayBaseclone ()=0
 
virtual void init ()
 
virtual void initProbMax ()
 
virtual std::string commandName ()
 
virtual void command (std::string cmd)
 
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 ()
 

Additional Inherited Members

- 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)
 
- Protected Member Functions inherited from EvtDecayBase
bool daugsDecayedByParentModel ()
 
- Protected Attributes inherited from EvtDecayBase
bool _daugsDecayedByParentModel
 

Detailed Description

Definition at line 33 of file EvtTauola.hh.

Constructor & Destructor Documentation

◆ EvtTauola()

EvtTauola::EvtTauola ( )

Definition at line 64 of file EvtTauola.cc.

64{}

Referenced by clone().

◆ ~EvtTauola()

EvtTauola::~EvtTauola ( )
virtual

Definition at line 66 of file EvtTauola.cc.

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

Member Function Documentation

◆ clone()

EvtDecayBase * EvtTauola::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 103 of file EvtTauola.cc.

103 {
104
105 return new EvtTauola;
106
107}

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 147 of file EvtTauola.cc.

147 {
148
149 if (ncommand==lcommand){
150
151 lcommand=10+2*lcommand;
152
153 std::string* newcommands=new std::string[lcommand];
154
155 int i;
156
157 for(i=0;i<ncommand;i++){
158 newcommands[i]=commands[i];
159 }
160
161 delete [] commands;
162
163 commands=newcommands;
164
165 }
166
167 commands[ncommand]=cmd;
168
169 ncommand++;
170
171}

◆ commandName()

std::string EvtTauola::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 141 of file EvtTauola.cc.

141 {
142
143 return std::string("TauolaPar");
144
145}

◆ decay()

void EvtTauola::decay ( EvtParticle p)
virtual

Implements EvtDecayBase.

Definition at line 175 of file EvtTauola.cc.

175 {
176
177 static int iniflag=0;
178
179 static EvtId STRNG=EvtPDL::getId("string");
180
181 int istdheppar=EvtPDL::getStdHep(p->getId());
182
183/*
184 if (pycomp_(&istdheppar)==0){
185 report(ERROR,"EvtGen") << "Tauola can not decay:"
186 <<EvtPDL::name(p->getId()).c_str()<<endl;
187 return;
188 }
189*/
190
191 EvtVector4R p4[20];
192
193
194 int i,more;
195 int idtau=EvtPDL::getStdHep(p->getId());
196 int ndaugjs;
197 static int kf[20];
198 EvtId evtnumstable[20],evtnumparton[20];
199 int stableindex[20],partonindex[20];
200 int numstable;
201 int numparton;
202 static int km[20];
203 EvtId type[MAX_DAUG];
204
205 static double px[20],py[20],pz[20],e[20];
206
207 // std::cout<<"cc: inifag,idtau,taup,polt"<<iniflag<<"; "<<idtau<<"; "<<taup[0]<<"; "<<polt[3]<<endl;
208 if (iniflag==0) dectes_(&iniflag,&idtau,&ndaugjs,kf,km,px,py,pz,e);
209 //std::cout<<"Tauola initialized"<<endl;
210 if ( p->getNDaug() != 0 ) { p->deleteDaughters(true);}
211
212 int count=0;
213
214 do{
215 //report(INFO,"EvtGen") << "calling tauola " << idtau<< " " << mp <<endl;
216 iniflag=iniflag+1; //to count the event number
217 dectes_(&iniflag,&idtau,&ndaugjs,kf,km,px,py,pz,e);
218
219 numstable=0;
220 numparton=0;
221 // report(INFO,"EvtGen") << "found some daughters " << ndaugjs << endl;
222 for(i=0;i<ndaugjs;i++){
223 //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
224
225 if (EvtPDL::evtIdFromStdHep(kf[i])==EvtId(-1,-1)) {
226 report(ERROR,"EvtGen") << "Tauola returned particle:"<<kf[i]<<endl;
227 report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
228 report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
229 report(ERROR,"EvtGen") << "The decay was of particle:"<<idtau<<endl;
230
231 }
232
233 //sort out the partons
234 if (abs(kf[i])<=6||kf[i]==21){
235 partonindex[numparton]=i;
236 evtnumparton[numparton]=EvtPDL::evtIdFromStdHep(kf[i]);
237 numparton++;
238 }
239 else{
240 stableindex[numstable]=i;
241 evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(kf[i]);
242 numstable++;
243 }
244
245
246 // have to protect against negative mass^2 for massless particles
247 // i.e. neutrinos and photons.
248 // this is uggly but I need to fix it right now....
249
250 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
251
252 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000001;
253
254 }
255
256 p4[i].set(e[i],px[i],py[i],pz[i]);
257
258
259 }
260
261 int channel=EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
262
263
264 more=(channel!=-1);
265
266
267 count++;
268
269 }while( more && (count<10000) );
270
271 if (count>9999) {
272 report(INFO,"EvtGen") << "Too many loops in EvtTauola!!!"<<endl;
273 report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
274 for(i=0;i<numstable;i++){
275 report(INFO,"EvtGen") << "Daug("<<i<<")"<<EvtPDL::name(evtnumstable[i]).c_str()<<endl;
276 }
277
278 }
279
280
281
282 if (numparton==0){
283
284 p->makeDaughters(numstable,evtnumstable);
285 int ndaugFound=0;
286 for(i=0;i<numstable;i++){
287 p->getDaug(i)->init(evtnumstable[i],p4[stableindex[i]]);
288 ndaugFound++;
289 }
290 if ( ndaugFound == 0 ) {
291 report(ERROR,"EvtGen") << "Tauola has failed to do a decay ";
292 report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass()<<endl;
293 assert(0);
294 }
295
296 fixPolarizations(p);
297
298 return ;
299
300 }
301 else{
302
303 //have partons in TAUOLA
304
305 EvtVector4R p4string(0.0,0.0,0.0,0.0);
306
307 for(i=0;i<numparton;i++){
308 p4string+=p4[partonindex[i]];
309 }
310
311 int nprimary=1;
312 type[0]=STRNG;
313 for(i=0;i<numstable;i++){
314 if (km[stableindex[i]]==0){
315 type[nprimary++]=evtnumstable[i];
316 }
317 }
318
319 p->makeDaughters(nprimary,type);
320
321 p->getDaug(0)->init(STRNG,p4string);
322
323 EvtVector4R p4partons[10];
324
325 for(i=0;i<numparton;i++){
326 p4partons[i]=p4[partonindex[i]];
327 }
328
329 ((EvtStringParticle*)p->getDaug(0))->initPartons(numparton,p4partons,evtnumparton);
330
331
332
333 nprimary=1;
334
335 for(i=0;i<numstable;i++){
336
337 if (km[stableindex[i]]==0){
338 p->getDaug(nprimary++)->init(evtnumstable[i],p4[stableindex[i]]);
339 }
340 }
341
342
343 int nsecond=0;
344 for(i=0;i<numstable;i++){
345 if (km[stableindex[i]]!=0){
346 type[nsecond++]=evtnumstable[i];
347 }
348 }
349
350
351 p->getDaug(0)->makeDaughters(nsecond,type);
352
353 EvtVector4R p4stringboost(p4string.get(0),-p4string.get(1),
354 -p4string.get(2),-p4string.get(3));
355
356 nsecond=0;
357 for(i=0;i<numstable;i++){
358 if (km[stableindex[i]]!=0){
359 p4[stableindex[i]]=boostTo(p4[stableindex[i]],p4stringboost);
360 p->getDaug(0)->getDaug(nsecond)->init(evtnumstable[i],p4[stableindex[i]]);
361 p->getDaug(0)->getDaug(nsecond)->setDiagonalSpinDensity();
362 p->getDaug(0)->getDaug(nsecond)->decay();
363 nsecond++;
364 }
365 }
366
367 if ( nsecond == 0 ) {
368 report(ERROR,"EvtGen") << "Jetset has failed to do a decay ";
369 report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass() <<endl;
370 assert(0);
371 }
372
373 fixPolarizations(p);
374
375 return ;
376
377 }
378
379}
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
const int MAX_DAUG
Definition: EvtParticle.hh:38
DOUBLE_PRECISION count[3]
@ INFO
Definition: EvtReport.hh:52
void dectes_(int *, int *, int *, int *, int *, double *, double *, double *, double *)
EvtId getParentId()
Definition: EvtDecayBase.hh:60
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
Definition: EvtId.hh:27
static int getStdHep(EvtId id)
Definition: EvtPDL.hh:56
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
void decay()
Definition: EvtParticle.cc:404
EvtId getId() const
Definition: EvtParticle.cc:113
void setDiagonalSpinDensity()
Definition: EvtParticle.cc:133
int getNDaug() const
Definition: EvtParticle.cc:125
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
void deleteDaughters(bool keepChannel=false)
Definition: EvtParticle.cc:540
double mass() const
Definition: EvtParticle.cc:127
void set(int i, double d)
Definition: EvtVector4R.hh:183

◆ getName()

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

Implements EvtDecayBase.

Definition at line 97 of file EvtTauola.cc.

97 {
98
99 model_name="TAUOLA";
100
101}

◆ init()

void EvtTauola::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 117 of file EvtTauola.cc.

117 {
118
119// checkNArg(1);
120
121
122 if (getParentId().isAlias()){
123
124 report(ERROR,"EvtGen") << "EvtTauola finds that you are decaying the"<<endl
125 << " aliased particle "
126 << EvtPDL::name(getParentId()).c_str()
127 << " with the Tauola model"<<endl
128 << " this does not work, please modify decay table."
129 << endl;
130 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
131 ::abort();
132
133 }
134
135 store(this);
136 // std::cout<<"Tauola initialization"<<std::endl;
137
138}

◆ initProbMax()

void EvtTauola::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 110 of file EvtTauola.cc.

110 {
111
112 noProbMax();
113
114}
void noProbMax()

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