BOSS 8.0.0
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 69 of file EvtJetSet.cc.

69{}

Referenced by clone().

◆ ~EvtJetSet()

EvtJetSet::~EvtJetSet ( )
virtual

Definition at line 71 of file EvtJetSet.cc.

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

Member Function Documentation

◆ clone()

EvtDecayBase * EvtJetSet::clone ( )
virtual

Implements EvtDecayBase.

Definition at line 104 of file EvtJetSet.cc.

104{ return new EvtJetSet; }

◆ command()

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

Reimplemented from EvtDecayBase.

Definition at line 128 of file EvtJetSet.cc.

128 {
129
130 if ( ncommand == lcommand )
131 {
132
133 lcommand = 10 + 2 * lcommand;
134
135 std::string* newcommands = new std::string[lcommand];
136
137 int i;
138
139 for ( i = 0; i < ncommand; i++ ) { newcommands[i] = commands[i]; }
140
141 delete[] commands;
142
143 commands = newcommands;
144 }
145
146 commands[ncommand] = cmd;
147
148 ncommand++;
149}

◆ commandName()

std::string EvtJetSet::commandName ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 126 of file EvtJetSet.cc.

126{ return std::string( "JetSetPar" ); }

◆ decay()

void EvtJetSet::decay ( EvtParticle * p)
virtual

Implements EvtDecayBase.

Definition at line 151 of file EvtJetSet.cc.

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

Implements EvtDecayBase.

Definition at line 102 of file EvtJetSet.cc.

102{ model_name = "JETSET"; }

◆ init()

void EvtJetSet::init ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 108 of file EvtJetSet.cc.

108 {
109
110 checkNArg( 1 );
111
112 if ( getParentId().isAlias() )
113 {
114
115 report( ERROR, "EvtGen" ) << "EvtJetSet finds that you are decaying the" << endl
116 << " aliased particle " << EvtPDL::name( getParentId() ).c_str()
117 << " with the JetSet model" << endl
118 << " this does not work, please modify decay table." << endl;
119 report( ERROR, "EvtGen" ) << "Will terminate execution!" << endl;
120 ::abort();
121 }
122
123 store( this );
124}
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)

◆ initProbMax()

void EvtJetSet::initProbMax ( )
virtual

Reimplemented from EvtDecayBase.

Definition at line 106 of file EvtJetSet.cc.

106{ noProbMax(); }

◆ jetSetInit()

void EvtJetSet::jetSetInit ( )
static

Definition at line 713 of file EvtJetSet.cc.

713 {
714
715 static int first = 1;
716
717 if ( first )
718 {
719
720 first = 0;
721
722 report( INFO, "EvtGen" ) << "Will initialize JetSet." << endl;
723
724 char fname[200];
725
726 char hostBuffer[100];
727
728 if ( gethostname( hostBuffer, 100 ) != 0 )
729 {
730 report( ERROR, "EvtGen" ) << " couldn't get hostname." << endl;
731 strncpy( hostBuffer, "hostnameNotFound", 100 );
732 }
733
734 char pid[100];
735
736 int thePid = getpid();
737
738 if ( sprintf( pid, "%d", thePid ) == 0 )
739 {
740 report( ERROR, "EvtGen" ) << " couldn't get process ID." << endl;
741 strncpy( pid, "666", 100 );
742 }
743
744 strcpy( fname, "jet.d-" );
745 strcat( fname, hostBuffer );
746 strcat( fname, "-" );
747 strcat( fname, pid );
748
749 MakeJetSetFile( fname );
750 evtjetsetinit_( fname, strlen( fname ) );
751
752 if ( 0 == getenv( "EVTSAVEJETD" ) )
753 {
754 char delcmd[300];
755 strcpy( delcmd, "rm -f " );
756 strcat( delcmd, fname );
757 system( delcmd );
758 }
759
760 int i;
761
762 for ( i = 0; i < ncommand; i++ )
763 { lugive_( commands[i].c_str(), strlen( commands[i].c_str() ) ); }
764
765 report( INFO, "EvtGen" ) << "Done initializing JetSet." << endl;
766 }
767}
sprintf(cut, "kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_" "pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
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: