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

#include <EvtParticleDecayList.hh>

Public Member Functions

 EvtParticleDecayList ()
 EvtParticleDecayList (const EvtParticleDecayList &o)
 ~EvtParticleDecayList ()
int getNMode ()
void setNMode (int nmode)
EvtDecayBasegetDecayModel (EvtParticle *p)
EvtDecayBasegetDecayModel (int imode)
EvtParticleDecaygetDecay (int nchannel)
double getRawBrfrSum ()
void setRawBrfrSum (double rawbrfrsum)
void makeChargeConj (EvtParticleDecayList *conjDecayList)
void removeDecay ()
void alocateDecay (int nmode)
void removeMode (EvtDecayBase *decay)
void addMode (EvtDecayBase *decay, double brfr, double massmin)
void finalize ()
void printSummary ()

Detailed Description

Definition at line 28 of file EvtParticleDecayList.hh.

Constructor & Destructor Documentation

◆ EvtParticleDecayList() [1/2]

EvtParticleDecayList::EvtParticleDecayList ( )
inline

Definition at line 31 of file EvtParticleDecayList.hh.

31 {
32 _decaylist = 0;
33 _nmode = 0;
34 _rawbrfrsum = 0;
35 }

Referenced by EvtParticleDecayList(), and makeChargeConj().

◆ EvtParticleDecayList() [2/2]

EvtParticleDecayList::EvtParticleDecayList ( const EvtParticleDecayList & o)

Definition at line 35 of file EvtParticleDecayList.cc.

35 {
36 _nmode = o._nmode;
37 _rawbrfrsum = o._rawbrfrsum;
38 _decaylist = new EvtParticleDecayPtr[_nmode];
39
40 int i;
41 for ( i = 0; i < _nmode; i++ )
42 {
43 _decaylist[i] = new EvtParticleDecay;
44
45 EvtDecayBase* tModel = o._decaylist[i]->getDecayModel();
46
47 EvtDecayBase* tModelNew = tModel->clone();
48 if ( tModel->getPHOTOS() ) { tModelNew->setPHOTOS(); }
49 if ( tModel->verbose() ) { tModelNew->setVerbose(); }
50 if ( tModel->summary() ) { tModelNew->setSummary(); }
51 std::vector<std::string> args;
52 int j;
53 for ( j = 0; j < tModel->getNArg(); j++ ) { args.push_back( tModel->getArgStr( j ) ); }
54 tModelNew->saveDecayInfo( tModel->getParentId(), tModel->getNDaug(), tModel->getDaugs(),
55 tModel->getNArg(), args, tModel->getModelName(),
56 tModel->getBranchingFraction() );
57 _decaylist[i]->setDecayModel( tModelNew );
58
59 //_decaylist[i]->setDecayModel(tModel);
60 _decaylist[i]->setBrfrSum( o._decaylist[i]->getBrfrSum() );
61 _decaylist[i]->setMassMin( o._decaylist[i]->getMassMin() );
62 }
63}
EvtParticleDecay * EvtParticleDecayPtr
virtual EvtDecayBase * clone()=0
std::string getModelName()
EvtId getParentId()
void saveDecayInfo(EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
double getBranchingFraction()
EvtId * getDaugs()
void setSummary()
void setVerbose()
std::string getArgStr(int j)
EvtDecayBase * getDecayModel()

◆ ~EvtParticleDecayList()

EvtParticleDecayList::~EvtParticleDecayList ( )

Definition at line 65 of file EvtParticleDecayList.cc.

65 {
66
67 int i;
68 for ( i = 0; i < _nmode; i++ ) { delete _decaylist[i]; }
69
70 if ( _decaylist != 0 ) delete[] _decaylist;
71}

Member Function Documentation

◆ addMode()

void EvtParticleDecayList::addMode ( EvtDecayBase * decay,
double brfr,
double massmin )

Definition at line 221 of file EvtParticleDecayList.cc.

221 {
222
223 EvtParticleDecayPtr* newlist = new EvtParticleDecayPtr[_nmode + 1];
224
225 int i;
226 for ( i = 0; i < _nmode; i++ ) { newlist[i] = _decaylist[i]; }
227
228 _rawbrfrsum = brfrsum;
229
230 newlist[_nmode] = new EvtParticleDecay;
231
232 newlist[_nmode]->setDecayModel( decay );
233 newlist[_nmode]->setBrfrSum( brfrsum );
234 newlist[_nmode]->setMassMin( massmin );
235
236 EvtDecayBase* newDec = newlist[_nmode]->getDecayModel();
237 for ( i = 0; i < _nmode; i++ )
238 {
239 if ( newDec->matchingDecay( *( newlist[i]->getDecayModel() ) ) )
240 {
241
242 // sometimes its ok..
243 if ( newDec->getModelName() == "JETSET" || newDec->getModelName() == "PYTHIA" ) continue;
244 if ( newDec->getModelName() == "JSCONT" || newDec->getModelName() == "PYCONT" ) continue;
245 if ( newDec->getModelName() == "PYGAGA" ) continue;
246 report( ERROR, "EvtGen" ) << "Two matching decays with same parent in decay table\n";
247 report( ERROR, "EvtGen" ) << "Please fix that\n";
248 report( ERROR, "EvtGen" ) << "Parent " << EvtPDL::name( newDec->getParentId() ).c_str()
249 << endl;
250 for ( int j = 0; j < newDec->getNDaug(); j++ )
251 report( ERROR, "EvtGen" )
252 << "Daughter " << EvtPDL::name( newDec->getDaug( j ) ).c_str() << endl;
253 assert( 0 );
254 }
255 }
256
257 if ( _nmode != 0 ) { delete[] _decaylist; }
258
259 _nmode++;
260
261 _decaylist = newlist;
262}
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
virtual bool matchingDecay(const EvtDecayBase &other) const
EvtId getDaug(int i)
static std::string name(EvtId i)
Definition EvtPDL.hh:70
void setDecayModel(EvtDecayBase *decay)
void setMassMin(double massmin)
void setBrfrSum(double brfrsum)

◆ alocateDecay()

void EvtParticleDecayList::alocateDecay ( int nmode)
inline

Definition at line 57 of file EvtParticleDecayList.hh.

57{ _decaylist = new EvtParticleDecayPtr[nmode]; }

◆ finalize()

void EvtParticleDecayList::finalize ( )

Definition at line 264 of file EvtParticleDecayList.cc.

264 {
265
266 if ( _nmode > 0 )
267 {
268 if ( _rawbrfrsum < 0.000001 )
269 {
270 report( ERROR, "EvtGen" ) << "Please give me a "
271 << "branching fraction sum greater than 0\n";
272 assert( 0 );
273 }
274 if ( fabs( _rawbrfrsum - 1.0 ) > 0.0001 )
275 {
276 report( INFO, "EvtGen" )
277 << "Warning, sum of branching fractions for "
278 << EvtPDL::name( _decaylist[0]->getDecayModel()->getParentId() ).c_str() << " is "
279 << _rawbrfrsum << endl;
280 report( INFO, "EvtGen" ) << "rescaled to one! " << endl;
281 }
282
283 int i;
284
285 for ( i = 0; i < _nmode; i++ )
286 {
287 double brfrsum = _decaylist[i]->getBrfrSum() / _rawbrfrsum;
288 _decaylist[i]->setBrfrSum( brfrsum );
289 }
290 }
291}
@ INFO
Definition EvtReport.hh:52
EvtDecayBase * getDecayModel(EvtParticle *p)

◆ getDecay()

EvtParticleDecay & EvtParticleDecayList::getDecay ( int nchannel)

Definition at line 196 of file EvtParticleDecayList.cc.

196 {
197 if ( nchannel >= _nmode )
198 {
199 report( ERROR, "EvtGen" ) << "Error getting channel:" << nchannel << " with only "
200 << _nmode << " stored!" << endl;
201 ::abort();
202 }
203 return *( _decaylist[nchannel] );
204}

Referenced by getDecayModel().

◆ getDecayModel() [1/2]

EvtDecayBase * EvtParticleDecayList::getDecayModel ( EvtParticle * p)

Definition at line 90 of file EvtParticleDecayList.cc.

90 {
91
92 if ( p->getNDaug() != 0 )
93 {
94 assert( p->getChannel() >= 0 );
95 return getDecay( p->getChannel() ).getDecayModel();
96 }
97 if ( p->getChannel() > ( -1 ) ) { return getDecay( p->getChannel() ).getDecayModel(); }
98
99 if ( getNMode() == 0 ) { return 0; }
100 if ( getRawBrfrSum() < 0.00000001 ) { return 0; }
101
102 if ( getNMode() == 1 )
103 {
104 p->setChannel( 0 );
105 return getDecay( 0 ).getDecayModel();
106 }
107
108 if ( p->getChannel() > ( -1 ) )
109 {
110 report( ERROR, "EvtGen" ) << "Internal error!!!" << endl;
111 ::abort();
112 }
113
114 int j;
115
116 for ( j = 0; j < 1000; j++ )
117 {
118
119 double u = EvtRandom::Flat();
120
121 int i;
122 bool breakL = false;
123 for ( i = 0; i < getNMode(); i++ )
124 {
125
126 if ( breakL ) continue;
127 if ( u < getDecay( i ).getBrfrSum() )
128 {
129 breakL = true;
130 // special case for decay of on particel to another
131 // e.g. K0->K0S
132
133 if ( getDecay( i ).getDecayModel()->getNDaug() == 1 )
134 {
135 p->setChannel( i );
136 return getDecay( i ).getDecayModel();
137 }
138
139 if ( p->hasValidP4() )
140 {
141 // report(INFO,"EvtGen") << "amazing " << EvtPDL::name(p->getId()) << " " <<
142 // getDecay(i).getMassMin() << " "<<p->mass() << " " << i << endl;
143 if ( getDecay( i ).getMassMin() < p->mass() )
144 {
145 p->setChannel( i );
146 return getDecay( i ).getDecayModel();
147 }
148 }
149 else
150 {
151 // Lange apr29-2002 - dont know the mass yet
152 p->setChannel( i );
153 return getDecay( i ).getDecayModel();
154 }
155 }
156 }
157 }
158
159 // Ok, we tried 1000 times above to pick a decay channel that is
160 // kinematically allowed! Now we give up and search all channels!
161 // if that fails, the particle will not be decayed!
162
163 int i;
164
165 for ( i = 0; i < getNMode(); i++ )
166 {
167
168 if ( getDecay( i ).getMassMin() < p->mass() ) { return getDecay( i ).getDecayModel(); }
169 }
170
171 report( ERROR, "EvtGen" ) << "Could not decay:" << EvtPDL::name( p->getId() ).c_str()
172 << " with mass:" << p->mass() << " will throw event away! "
173 << endl;
174
175 // report(ERROR,"EvtGen") << "Will terminate execution."<<endl;
176
177 // ::abort();
179 return 0;
180}
EvtParticleDecay & getDecay(int nchannel)
EvtId getId() const
bool hasValidP4()
void setChannel(int i)
int getNDaug() const
double mass() const
int getChannel() const
static double Flat()
Definition EvtRandom.cc:69
static void setRejectFlag()
Definition EvtStatus.hh:36

Referenced by finalize(), and getDecayModel().

◆ getDecayModel() [2/2]

EvtDecayBase * EvtParticleDecayList::getDecayModel ( int imode)
inline

Definition at line 46 of file EvtParticleDecayList.hh.

46{ return _decaylist[imode]->getDecayModel(); }

◆ getNMode()

int EvtParticleDecayList::getNMode ( )
inline

Definition at line 41 of file EvtParticleDecayList.hh.

41{ return _nmode; }

Referenced by getDecayModel().

◆ getRawBrfrSum()

double EvtParticleDecayList::getRawBrfrSum ( )
inline

Definition at line 50 of file EvtParticleDecayList.hh.

50{ return _rawbrfrsum; }

Referenced by getDecayModel().

◆ makeChargeConj()

void EvtParticleDecayList::makeChargeConj ( EvtParticleDecayList * conjDecayList)

Definition at line 206 of file EvtParticleDecayList.cc.

206 {
207
208 _rawbrfrsum = conjDecayList->_rawbrfrsum;
209
210 setNMode( conjDecayList->_nmode );
211
212 int i;
213
214 for ( i = 0; i < _nmode; i++ )
215 {
216 _decaylist[i] = new EvtParticleDecay;
217 _decaylist[i]->chargeConj( conjDecayList->_decaylist[i] );
218 }
219}

◆ printSummary()

void EvtParticleDecayList::printSummary ( )

Definition at line 73 of file EvtParticleDecayList.cc.

73 {
74
75 int i;
76 for ( i = 0; i < _nmode; i++ ) { _decaylist[i]->printSummary(); }
77}

◆ removeDecay()

void EvtParticleDecayList::removeDecay ( )

Definition at line 79 of file EvtParticleDecayList.cc.

79 {
80
81 int i;
82 for ( i = 0; i < _nmode; i++ ) { delete _decaylist[i]; }
83
84 delete[] _decaylist;
85 _decaylist = 0;
86 _nmode = 0;
87 _rawbrfrsum = 0.0;
88}

◆ removeMode()

void EvtParticleDecayList::removeMode ( EvtDecayBase * decay)

Definition at line 292 of file EvtParticleDecayList.cc.

292 {
293 // here we will delete a decay with the same final state particles
294 // and recalculate the branching fractions for the remaining modes
295 int match = -1;
296 int i;
297 double match_bf;
298
299 for ( i = 0; i < _nmode; i++ )
300 {
301 if ( decay->matchingDecay( *( _decaylist[i]->getDecayModel() ) ) ) { match = i; }
302 }
303
304 if ( match < 0 )
305 {
306 report( ERROR, "EvtGen" ) << " Attempt to remove undefined mode for" << endl
307 << "Parent " << EvtPDL::name( decay->getParentId() ).c_str()
308 << endl
309 << "Daughters: ";
310 for ( int j = 0; j < decay->getNDaug(); j++ )
311 report( ERROR, "" ) << EvtPDL::name( decay->getDaug( j ) ).c_str() << " ";
312 report( ERROR, "" ) << endl;
313 ::abort();
314 }
315
316 if ( match == 0 ) { match_bf = _decaylist[match]->getBrfrSum(); }
317 else
318 { match_bf = ( _decaylist[match]->getBrfrSum() - _decaylist[match - 1]->getBrfrSum() ); }
319
320 double divisor = 1 - match_bf;
321 if ( divisor < 0.000001 && _nmode > 1 )
322 {
323 report( ERROR, "EvtGen" ) << "Removing requested mode leaves "
324 << EvtPDL::name( decay->getParentId() ).c_str()
325 << " with zero sum branching fraction," << endl
326 << "but more than one decay mode remains. Aborting." << endl;
327 ::abort();
328 }
329
330 EvtParticleDecayPtr* newlist = new EvtParticleDecayPtr[_nmode - 1];
331
332 for ( i = 0; i < match; i++ )
333 {
334 newlist[i] = _decaylist[i];
335 newlist[i]->setBrfrSum( newlist[i]->getBrfrSum() / divisor );
336 }
337 for ( i = match + 1; i < _nmode; i++ )
338 {
339 newlist[i - 1] = _decaylist[i];
340 newlist[i - 1]->setBrfrSum( ( newlist[i - 1]->getBrfrSum() - match_bf ) / divisor );
341 }
342
343 delete[] _decaylist;
344
345 _nmode--;
346
347 _decaylist = newlist;
348
349 if ( _nmode == 0 ) { delete[] _decaylist; }
350}

◆ setNMode()

void EvtParticleDecayList::setNMode ( int nmode)

Definition at line 182 of file EvtParticleDecayList.cc.

182 {
183
184 EvtParticleDecayPtr* _decaylist_new = new EvtParticleDecayPtr[nmode];
185
186 if ( _nmode != 0 )
187 {
188 report( ERROR, "EvtGen" ) << "Error _nmode not equal to zero!!!" << endl;
189 ::abort();
190 delete[] _decaylist;
191 }
192 _decaylist = _decaylist_new;
193 _nmode = nmode;
194}

Referenced by makeChargeConj().

◆ setRawBrfrSum()

void EvtParticleDecayList::setRawBrfrSum ( double rawbrfrsum)
inline

Definition at line 51 of file EvtParticleDecayList.hh.

51{ _rawbrfrsum = rawbrfrsum; }

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