CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtOpenCharm Class Reference

#include <EvtOpenCharm.hh>

+ Inheritance diagram for EvtOpenCharm:

Public Member Functions

 EvtOpenCharm ()
 
virtual ~EvtOpenCharm ()
 
void getName (std::string &name)
 
EvtDecayBaseclone ()
 
void decay (EvtParticle *p)
 
std::string commandName ()
 
void command (std::string cmd)
 
void init ()
 
void initProbMax ()
 
int getTotalEvt ()
 
bool isbelong (EvtId myid)
 
int which_mode (EvtId myid)
 
- 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 ()
 

Static Public Member Functions

static void OpencrmInit (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)
 

Static Public Attributes

static int myiter = 1
 

Additional Inherited Members

- Protected Member Functions inherited from EvtDecayBase
bool daugsDecayedByParentModel ()
 
- Protected Attributes inherited from EvtDecayBase
bool _daugsDecayedByParentModel
 

Detailed Description

Definition at line 36 of file EvtOpenCharm.hh.

Constructor & Destructor Documentation

◆ EvtOpenCharm()

EvtOpenCharm::EvtOpenCharm ( )

Definition at line 65 of file EvtOpenCharm.cc.

65{}

Referenced by clone().

◆ ~EvtOpenCharm()

EvtOpenCharm::~EvtOpenCharm ( )
virtual

Definition at line 67 of file EvtOpenCharm.cc.

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

Member Function Documentation

◆ clone()

EvtDecayBase * EvtOpenCharm::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 104 of file EvtOpenCharm.cc.

104 {
105
106 return new EvtOpenCharm;
107
108}

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 147 of file EvtOpenCharm.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
172}

◆ commandName()

std::string EvtOpenCharm::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 141 of file EvtOpenCharm.cc.

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

◆ decay()

void EvtOpenCharm::decay ( EvtParticle p)
virtual

Implements EvtDecayBase.

Definition at line 176 of file EvtOpenCharm.cc.

176 {
177
178 int istdheppar=EvtPDL::getStdHep(p->getId());
179
180 if(istdheppar != 9000443 && istdheppar != 9010443 && istdheppar != 9030443 &&istdheppar != 9020443 ){
181 std::cout<<"EvtGen: EvtOpenCharm cann't not decay the particle pid= "<<istdheppar<<endl;
182 ::abort();
183 }
184
185 double mp=p->mass();
186 float xmp=mp;
187 double totEn=0;
188
189 //debugging
190 // std::cout<<"parent "<<EvtPDL::name(p->getId())<<"float xmp="<<xmp<<" "<<p->getP4Lab()<<std::endl;
191
192 EvtVector4R p4[20];
193
194 int i,more;
195 int ip=EvtPDL::getStdHep(p->getId());
196 int ndaugjs;
197
198 static int myflag;
199 EvtPsi3Sdecay theIni;
200 EvtId pid = p->getId();
201
202 static int themode;
203 if(getNArg()==1){ themode = getArg(0); theIni.setMode(themode);}
204
205 int count=0;
206 do{
207
208 theIni.PHSPDecay(p);
209 std::vector<EvtVector4R> v_p4=theIni.getDaugP4();
210 std::vector<EvtId> Vid=theIni.getDaugId();
211 ndaugjs = Vid.size();
212
213 EvtId myId[3];
214
215 for(int i=0;i<ndaugjs;i++){myId[i]=Vid[i];}
216
217
218 if(p->getNDaug()!=0) p->resetNDaug();
219 p->makeDaughters(ndaugjs,myId);
220
221 for(int i=0;i<ndaugjs;i++){
222 // std::cout<<"Vid "<<EvtPDL::name(Vid[i])<<" p4: "<<v_p4[i]<<std::endl;
223 p->getDaug(i)->init(Vid[i],v_p4[i]);
224 }
225
226
227 theMode = theIni.getMode();
228 p->setGeneratorFlag(theMode);
229
230
231 totEn=0;
232 for(i=0;i<ndaugjs;i++){
233 totEn +=p->getDaug(i)->getP4().get(0);
234 if ( p->getDaug(i)->getId() ==EvtId(-1,-1)) {
235 report(ERROR,"EvtGen") << "OpenCharm returned particle:"<<EvtPDL::name( p->getDaug(i)->getId() )<<endl;
236 report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
237 report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
238 report(ERROR,"EvtGen") << "The decay was of particle:"<<ip<<endl;
239
240 }
241
242 }
243 int channel=EvtDecayTable::inChannelList(p->getId(),ndaugjs,myId);
244
245 // std::cout<<"channel= "<<channel<<std::endl;
246 more=(channel!=-1);
247 //if(more){std::cout<<"count= "<<count<<" inchannel= "<<channel<<std::endl;}
248
249 count++;
250
251 }while( more && (count<10000) );
252
253 if(fabs(xmp-totEn)>0.01){
254 std::cout<<"Warning:OPENCHARM generate incomplet final state, "<<mp<<" "<<totEn<<endl;
255 ::abort();
256 }
257
258 if (count>9999) {
259 report(INFO,"EvtGen") << "Too many loops in EvtOpenCharm!!!"<<endl;
260 report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
261 }
262
263 fixPolarizations(p);
264
265 return ;
266
267
268}
@ INFO
Definition: EvtReport.hh:52
double getArg(int j)
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 std::string name(EvtId i)
Definition: EvtPDL.hh:64
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void resetNDaug()
Definition: EvtParticle.hh:255
EvtId getId() const
Definition: EvtParticle.cc:113
void setGeneratorFlag(int flag)
Definition: EvtParticle.hh:141
const EvtVector4R & getP4() const
Definition: EvtParticle.cc:121
int getNDaug() const
Definition: EvtParticle.cc:125
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
double mass() const
Definition: EvtParticle.cc:127
void PHSPDecay(EvtParticle *par)
void setMode(int m)
std::vector< EvtVector4R > getDaugP4()
std::vector< EvtId > getDaugId()
double get(int i) const
Definition: EvtVector4R.hh:179
const double mp
Definition: incllambda.cxx:45
uint32_t count(const node_t &list)
Definition: node.cxx:42

◆ getName()

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

Implements EvtDecayBase.

Definition at line 98 of file EvtOpenCharm.cc.

98 {
99
100 model_name="OPENCHARM";
101
102}

◆ getTotalEvt()

int EvtOpenCharm::getTotalEvt ( )
inline

Definition at line 53 of file EvtOpenCharm.hh.

53{return nevt;}

◆ init()

void EvtOpenCharm::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 118 of file EvtOpenCharm.cc.

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

◆ initProbMax()

void EvtOpenCharm::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 111 of file EvtOpenCharm.cc.

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

◆ isbelong()

bool EvtOpenCharm::isbelong ( EvtId  myid)

Definition at line 343 of file EvtOpenCharm.cc.

343 {
344 for (int i=0;i<mypar.size();i++){
345 if(myid == mypar[i]) {_index = i; return true;}
346 }
347 return false;
348}

◆ OpencrmInit()

void EvtOpenCharm::OpencrmInit ( int  f)
static

Definition at line 339 of file EvtOpenCharm.cc.

339 {
340}

◆ which_mode()

int EvtOpenCharm::which_mode ( EvtId  myid)

Definition at line 350 of file EvtOpenCharm.cc.

350 {
351 for (int i=0;i<mypar.size();i++){
352 if(myid == mypar[i]){
353 _index = i;
354 return i;
355 }
356 }
357 std::cout<<"EvtOpenCharm::which_mode() fails to find element"<<std::endl; abort();
358}

Member Data Documentation

◆ myiter

int EvtOpenCharm::myiter = 1
static

Definition at line 56 of file EvtOpenCharm.hh.


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