BOSS 8.0.0
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
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 59 of file EvtTauola.cc.

59{}

Referenced by clone().

◆ ~EvtTauola()

EvtTauola::~EvtTauola ( )
virtual

Definition at line 61 of file EvtTauola.cc.

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

Member Function Documentation

◆ clone()

EvtDecayBase * EvtTauola::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 94 of file EvtTauola.cc.

94{ return new EvtTauola; }

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 119 of file EvtTauola.cc.

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

◆ commandName()

std::string EvtTauola::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 117 of file EvtTauola.cc.

117{ return std::string( "TauolaPar" ); }

◆ decay()

void EvtTauola::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 142 of file EvtTauola.cc.

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

◆ getName()

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

Implements EvtDecayBase.

Definition at line 92 of file EvtTauola.cc.

92{ model_name = "TAUOLA"; }

◆ init()

void EvtTauola::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 98 of file EvtTauola.cc.

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

◆ initProbMax()

void EvtTauola::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 96 of file EvtTauola.cc.

96{ noProbMax(); }

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