BOSS 6.6.4.p03
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 32 of file EvtParticleDecayList.hh.

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

◆ EvtParticleDecayList() [2/2]

EvtParticleDecayList::EvtParticleDecayList ( const EvtParticleDecayList o)

Definition at line 36 of file EvtParticleDecayList.cc.

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

◆ ~EvtParticleDecayList()

EvtParticleDecayList::~EvtParticleDecayList ( )

Definition at line 79 of file EvtParticleDecayList.cc.

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

Member Function Documentation

◆ addMode()

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

Definition at line 245 of file EvtParticleDecayList.cc.

246 {
247
248 EvtParticleDecayPtr* newlist=new EvtParticleDecayPtr[_nmode+1];
249
250 int i;
251 for(i=0;i<_nmode;i++){
252 newlist[i]=_decaylist[i];
253 }
254
255 _rawbrfrsum=brfrsum;
256
257 newlist[_nmode]=new EvtParticleDecay;
258
259 newlist[_nmode]->setDecayModel(decay);
260 newlist[_nmode]->setBrfrSum(brfrsum);
261 newlist[_nmode]->setMassMin(massmin);
262
263 EvtDecayBase *newDec=newlist[_nmode]->getDecayModel();
264 for(i=0;i<_nmode;i++){
265 if ( newDec->matchingDecay(*(newlist[i]->getDecayModel())) ) {
266
267 //sometimes its ok..
268 if ( newDec->getModelName() == "JETSET" || newDec->getModelName() == "PYTHIA" ) continue;
269 if ( newDec->getModelName() == "JSCONT" || newDec->getModelName() == "PYCONT" ) continue;
270 if ( newDec->getModelName() == "PYGAGA" ) continue;
271 report(ERROR,"EvtGen") << "Two matching decays with same parent in decay table\n";
272 report(ERROR,"EvtGen") << "Please fix that\n";
273 report(ERROR,"EvtGen") << "Parent " << EvtPDL::name(newDec->getParentId()).c_str() << endl;
274 for (int j=0; j<newDec->getNDaug(); j++)
275 report(ERROR,"EvtGen") << "Daughter " << EvtPDL::name(newDec->getDaug(j)).c_str() << endl;
276 assert(0);
277 }
278 }
279
280 if (_nmode!=0){
281 delete [] _decaylist;
282 }
283
284 _nmode++;
285
286 _decaylist=newlist;
287
288}
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ ERROR
Definition: EvtReport.hh:49
virtual bool matchingDecay(const EvtDecayBase &other) const
EvtId getDaug(int i)
Definition: EvtDecayBase.hh:66
static std::string name(EvtId i)
Definition: EvtPDL.hh:64

◆ alocateDecay()

void EvtParticleDecayList::alocateDecay ( int  nmode)
inline

Definition at line 59 of file EvtParticleDecayList.hh.

59 {
60 _decaylist= new EvtParticleDecayPtr[nmode];
61 }

◆ finalize()

void EvtParticleDecayList::finalize ( )

Definition at line 291 of file EvtParticleDecayList.cc.

291 {
292
293 if (_nmode>0) {
294 if ( _rawbrfrsum< 0.000001 ) {
295 report(ERROR,"EvtGen") << "Please give me a "
296 << "branching fraction sum greater than 0\n";
297 assert(0);
298 }
299 if (fabs(_rawbrfrsum-1.0)>0.0001) {
300 report(INFO,"EvtGen") <<"Warning, sum of branching fractions for "
301 <<EvtPDL::name(_decaylist[0]->getDecayModel()->getParentId()).c_str()
302 <<" is "<<_rawbrfrsum<<endl;
303 report(INFO,"EvtGen") << "rescaled to one! "<<endl;
304
305 }
306
307 int i;
308
309 for(i=0;i<_nmode;i++){
310 double brfrsum=_decaylist[i]->getBrfrSum()/_rawbrfrsum;
311 _decaylist[i]->setBrfrSum(brfrsum);
312 }
313
314 }
315
316}
@ INFO
Definition: EvtReport.hh:52
EvtDecayBase * getDecayModel(EvtParticle *p)

◆ getDecay()

EvtParticleDecay & EvtParticleDecayList::getDecay ( int  nchannel)

Definition at line 220 of file EvtParticleDecayList.cc.

220 {
221 if (nchannel>=_nmode) {
222 report(ERROR,"EvtGen") <<"Error getting channel:"
223 <<nchannel<<" with only "<<_nmode
224 <<" stored!"<<endl;
225 ::abort();
226 }
227 return *(_decaylist[nchannel]);
228}

Referenced by getDecayModel().

◆ getDecayModel() [1/2]

EvtDecayBase * EvtParticleDecayList::getDecayModel ( EvtParticle p)

Definition at line 113 of file EvtParticleDecayList.cc.

113 {
114
115 if (p->getNDaug()!=0) {
116 assert(p->getChannel()>=0);
117 return getDecay(p->getChannel()).getDecayModel();
118 }
119 if (p->getChannel() >(-1) ) {
120 return getDecay(p->getChannel()).getDecayModel();
121 }
122
123
124 if (getNMode()==0 ) {
125 return 0;
126 }
127 if (getRawBrfrSum()<0.00000001 ) {
128 return 0;
129 }
130
131 if (getNMode()==1) {
132 p->setChannel(0);
133 return getDecay(0).getDecayModel();
134 }
135
136 if (p->getChannel() >(-1)) {
137 report(ERROR,"EvtGen") << "Internal error!!!"<<endl;
138 ::abort();
139 }
140
141 int j;
142
143 for (j=0;j<1000;j++){
144
145 double u=EvtRandom::Flat();
146
147 int i;
148 bool breakL=false;
149 for (i=0;i<getNMode();i++) {
150
151 if ( breakL ) continue;
152 if (u<getDecay(i).getBrfrSum()) {
153 breakL=true;
154 //special case for decay of on particel to another
155 // e.g. K0->K0S
156
157 if (getDecay(i).getDecayModel()->getNDaug()==1 ) {
158 p->setChannel(i);
159 return getDecay(i).getDecayModel();
160 }
161
162 if ( p->hasValidP4() ) {
163 //report(INFO,"EvtGen") << "amazing " << EvtPDL::name(p->getId()) << " " << getDecay(i).getMassMin() << " "<<p->mass() << " " << i << endl;
164 if (getDecay(i).getMassMin() < p->mass() ) {
165 p->setChannel(i);
166 return getDecay(i).getDecayModel();
167 }
168 }
169 else{
170 //Lange apr29-2002 - dont know the mass yet
171 p->setChannel(i);
172 return getDecay(i).getDecayModel();
173 }
174 }
175 }
176 }
177
178 //Ok, we tried 1000 times above to pick a decay channel that is
179 //kinematically allowed! Now we give up and search all channels!
180 //if that fails, the particle will not be decayed!
181
182 int i;
183
184 for (i=0;i<getNMode();i++) {
185
186 if ( getDecay(i).getMassMin() < p->mass() ) {
187 return getDecay(i).getDecayModel();
188 }
189 }
190
191 report(ERROR,"EvtGen") << "Could not decay:"
192 <<EvtPDL::name(p->getId()).c_str()
193 <<" with mass:"<<p->mass()
194 <<" will throw event away! "<<endl;
195
196 // report(ERROR,"EvtGen") << "Will terminate execution."<<endl;
197
198 // ::abort();
200 return 0;
201
202}
EvtParticleDecay & getDecay(int nchannel)
EvtId getId() const
Definition: EvtParticle.cc:113
bool hasValidP4()
Definition: EvtParticle.hh:369
void setChannel(int i)
Definition: EvtParticle.cc:81
int getNDaug() const
Definition: EvtParticle.cc:125
double mass() const
Definition: EvtParticle.cc:127
int getChannel() const
Definition: EvtParticle.cc:123
static double Flat()
Definition: EvtRandom.cc:73
static void setRejectFlag()
Definition: EvtStatus.hh:39

Referenced by finalize().

◆ getDecayModel() [2/2]

EvtDecayBase * EvtParticleDecayList::getDecayModel ( int  imode)
inline

Definition at line 47 of file EvtParticleDecayList.hh.

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

◆ getNMode()

int EvtParticleDecayList::getNMode ( )
inline

Definition at line 42 of file EvtParticleDecayList.hh.

42{return _nmode;}

Referenced by getDecayModel().

◆ getRawBrfrSum()

double EvtParticleDecayList::getRawBrfrSum ( )
inline

Definition at line 52 of file EvtParticleDecayList.hh.

52{return _rawbrfrsum;}

Referenced by getDecayModel().

◆ makeChargeConj()

void EvtParticleDecayList::makeChargeConj ( EvtParticleDecayList conjDecayList)

Definition at line 230 of file EvtParticleDecayList.cc.

230 {
231
232 _rawbrfrsum=conjDecayList->_rawbrfrsum;
233
234 setNMode(conjDecayList->_nmode);
235
236 int i;
237
238 for(i=0;i<_nmode;i++){
239 _decaylist[i]=new EvtParticleDecay;
240 _decaylist[i]->chargeConj(conjDecayList->_decaylist[i]);
241 }
242
243}
void chargeConj(EvtParticleDecay *decay)

◆ printSummary()

void EvtParticleDecayList::printSummary ( )

Definition at line 89 of file EvtParticleDecayList.cc.

89 {
90
91 int i;
92 for(i=0;i<_nmode;i++){
93 _decaylist[i]->printSummary();
94 }
95
96}

◆ removeDecay()

void EvtParticleDecayList::removeDecay ( )

Definition at line 98 of file EvtParticleDecayList.cc.

98 {
99
100 int i;
101 for(i=0;i<_nmode;i++){
102 delete _decaylist[i];
103 }
104
105 delete [] _decaylist;
106 _decaylist=0;
107 _nmode=0;
108 _rawbrfrsum=0.0;
109
110}

◆ removeMode()

void EvtParticleDecayList::removeMode ( EvtDecayBase decay)

Definition at line 317 of file EvtParticleDecayList.cc.

317 {
318 // here we will delete a decay with the same final state particles
319 // and recalculate the branching fractions for the remaining modes
320 int match = -1;
321 int i;
322 double match_bf;
323
324 for(i=0;i<_nmode;i++){
325 if ( decay->matchingDecay(*(_decaylist[i]->getDecayModel())) ) {
326 match = i;
327 }
328 }
329
330 if (match < 0) {
331 report(ERROR,"EvtGen") << " Attempt to remove undefined mode for" << endl
332 << "Parent " << EvtPDL::name(decay->getParentId()).c_str() << endl
333 << "Daughters: ";
334 for (int j=0; j<decay->getNDaug(); j++)
335 report(ERROR,"") << EvtPDL::name(decay->getDaug(j)).c_str() << " ";
336 report(ERROR,"") << endl;
337 ::abort();
338 }
339
340 if (match == 0) {
341 match_bf = _decaylist[match]->getBrfrSum();
342 } else {
343 match_bf = (_decaylist[match]->getBrfrSum()
344 -_decaylist[match-1]->getBrfrSum());
345 }
346
347 double divisor = 1-match_bf;
348 if (divisor < 0.000001 && _nmode > 1) {
349 report(ERROR,"EvtGen") << "Removing requested mode leaves "
350 << EvtPDL::name(decay->getParentId()).c_str()
351 << " with zero sum branching fraction," << endl
352 << "but more than one decay mode remains. Aborting."
353 << endl;
354 ::abort();
355 }
356
357 EvtParticleDecayPtr* newlist=new EvtParticleDecayPtr[_nmode-1];
358
359 for(i=0;i<match;i++){
360 newlist[i]=_decaylist[i];
361 newlist[i]->setBrfrSum(newlist[i]->getBrfrSum()/divisor);
362 }
363 for(i=match+1; i<_nmode; i++) {
364 newlist[i-1]=_decaylist[i];
365 newlist[i-1]->setBrfrSum((newlist[i-1]->getBrfrSum()-match_bf)/divisor);
366 }
367
368
369 delete [] _decaylist;
370
371 _nmode--;
372
373 _decaylist=newlist;
374
375 if (_nmode == 0) {
376 delete [] _decaylist;
377 }
378
379}

◆ setNMode()

void EvtParticleDecayList::setNMode ( int  nmode)

Definition at line 205 of file EvtParticleDecayList.cc.

205 {
206
207 EvtParticleDecayPtr* _decaylist_new= new EvtParticleDecayPtr[nmode];
208
209 if (_nmode!=0){
210 report(ERROR,"EvtGen") << "Error _nmode not equal to zero!!!"<<endl;
211 ::abort();
212 delete [] _decaylist;
213 }
214 _decaylist=_decaylist_new;
215 _nmode=nmode;
216
217}

Referenced by makeChargeConj().

◆ setRawBrfrSum()

void EvtParticleDecayList::setRawBrfrSum ( double  rawbrfrsum)
inline

Definition at line 53 of file EvtParticleDecayList.hh.

53{_rawbrfrsum=rawbrfrsum;}

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