CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtJetSet Class Reference

#include <EvtJetSet.hh>

+ Inheritance diagram for EvtJetSet:

Public Member Functions

 EvtJetSet ()
 
virtual ~EvtJetSet ()
 
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 ()
 

Static Public Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 32 of file EvtJetSet.hh.

Constructor & Destructor Documentation

◆ EvtJetSet()

EvtJetSet::EvtJetSet ( )

Definition at line 74 of file EvtJetSet.cc.

74{}

Referenced by clone().

◆ ~EvtJetSet()

EvtJetSet::~EvtJetSet ( )
virtual

Definition at line 76 of file EvtJetSet.cc.

76 {
77
78
79 int i;
80
81
82 //the deletion of commands is really uggly!
83
84 if (njetsetdecays==0) {
85 delete [] commands;
86 commands=0;
87 return;
88 }
89
90 for(i=0;i<njetsetdecays;i++){
91 if (jetsetdecays[i]==this){
92 jetsetdecays[i]=jetsetdecays[njetsetdecays-1];
93 njetsetdecays--;
94 if (njetsetdecays==0) {
95 delete [] commands;
96 commands=0;
97 }
98 return;
99 }
100 }
101
102 report(ERROR,"EvtGen") << "Error in destroying JetSet model!"<<endl;
103
104}
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:36
@ ERROR
Definition EvtReport.hh:49

Member Function Documentation

◆ clone()

EvtDecayBase * EvtJetSet::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 113 of file EvtJetSet.cc.

113 {
114
115 return new EvtJetSet;
116
117}

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 157 of file EvtJetSet.cc.

157 {
158
159 if (ncommand==lcommand){
160
161 lcommand=10+2*lcommand;
162
163 std::string* newcommands=new std::string[lcommand];
164
165 int i;
166
167 for(i=0;i<ncommand;i++){
168 newcommands[i]=commands[i];
169 }
170
171 delete [] commands;
172
173 commands=newcommands;
174
175 }
176
177 commands[ncommand]=cmd;
178
179 ncommand++;
180
181}

◆ commandName()

std::string EvtJetSet::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 150 of file EvtJetSet.cc.

150 {
151
152 return std::string("JetSetPar");
153
154}

◆ decay()

void EvtJetSet::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 185 of file EvtJetSet.cc.

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

◆ getName()

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

Implements EvtDecayBase.

Definition at line 107 of file EvtJetSet.cc.

107 {
108
109 model_name="JETSET";
110
111}

◆ init()

void EvtJetSet::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 127 of file EvtJetSet.cc.

127 {
128
129 checkNArg(1);
130
131
132 if (getParentId().isAlias()){
133
134 report(ERROR,"EvtGen") << "EvtJetSet finds that you are decaying the"<<endl
135 << " aliased particle "
136 << EvtPDL::name(getParentId()).c_str()
137 << " with the JetSet model"<<endl
138 << " this does not work, please modify decay table."
139 << endl;
140 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
141 ::abort();
142
143 }
144
145 store(this);
146
147}
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)

◆ initProbMax()

void EvtJetSet::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 120 of file EvtJetSet.cc.

120 {
121
122 noProbMax();
123
124}

◆ jetSetInit()

void EvtJetSet::jetSetInit ( )
static

Definition at line 785 of file EvtJetSet.cc.

785 {
786
787 static int first=1;
788
789 if (first){
790
791 first=0;
792
793 report(INFO,"EvtGen") << "Will initialize JetSet."<<endl;
794
795 char fname[200];
796
797 char hostBuffer[100];
798
799 if ( gethostname( hostBuffer, 100 ) != 0 ){
800 report(ERROR,"EvtGen") << " couldn't get hostname." << endl;
801 strncpy( hostBuffer, "hostnameNotFound", 100 );
802 }
803
804 char pid[100];
805
806 int thePid=getpid();
807
808 if ( sprintf( pid, "%d", thePid ) == 0 ){
809 report(ERROR,"EvtGen") << " couldn't get process ID." << endl;
810 strncpy( pid, "666", 100 );
811 }
812
813 strcpy(fname,"jet.d-");
814 strcat(fname,hostBuffer);
815 strcat(fname,"-");
816 strcat(fname,pid);
817
818 MakeJetSetFile(fname);
819 evtjetsetinit_(fname,strlen(fname));
820
821 if (0==getenv("EVTSAVEJETD")){
822 char delcmd[300];
823 strcpy(delcmd,"rm -f ");
824 strcat(delcmd,fname);
825 system(delcmd);
826 }
827
828 int i;
829
830 for(i=0;i<ncommand;i++){
831 lugive_(commands[i].c_str(),strlen(commands[i].c_str()));
832
833 }
834
835 report(INFO,"EvtGen") << "Done initializing JetSet."<<endl;
836
837
838 }
839
840}
void lugive_(const char *cnfgstr, int length)
void evtjetsetinit_(char *fname, int len)
char * c_str(Index i)
Index first(Pair i)

Referenced by decay(), and EvtJscont::decay().


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