29 ClassImp(TPythia6Decayer);
 
   31 TPythia6Decayer* TPythia6Decayer::fgInstance = 0;
 
   36 TPythia6Decayer* TPythia6Decayer::Instance()
 
   38    if (!fgInstance) fgInstance = 
new TPythia6Decayer;
 
   45 TPythia6Decayer::TPythia6Decayer()
 
   55 void TPythia6Decayer::Init()
 
   57    static Bool_t init = kFALSE;
 
   66 void TPythia6Decayer::Decay(Int_t idpart, TLorentzVector* p)
 
   69    TPythia6::Instance()->Py1ent(0, idpart, p->Energy(), p->Theta(), p->Phi());
 
   70    TPythia6::Instance()->GetPrimaries();
 
   77 Int_t TPythia6Decayer::ImportParticles(TClonesArray *particles)
 
   79    return TPythia6::Instance()->ImportParticles(particles,
"All");
 
   85 void TPythia6Decayer::SetForceDecay(Int_t type)
 
   87    if (type > kMaxDecay) {
 
   88       Warning(
"SetForceDecay", 
"Invalid decay mode: %d", type);
 
   91    fDecay = EDecayType(type);
 
   97 void TPythia6Decayer::ForceDecay()
 
   99    EDecayType decay=fDecay;
 
  100    TPythia6::Instance()->SetMSTJ(21,2);
 
  101    if (decay == kNoDecayHeavy) 
return;
 
  112       products[2] = 100443;
 
  116       ForceParticleDecay(  511, products, mult, 3);
 
  117       ForceParticleDecay(  521, products, mult, 3);
 
  118       ForceParticleDecay(  531, products, mult, 3);
 
  119       ForceParticleDecay( 5122, products, mult, 3);
 
  120       ForceParticleDecay( 5132, products, mult, 3);
 
  121       ForceParticleDecay( 5232, products, mult, 3);
 
  122       ForceParticleDecay( 5332, products, mult, 3);
 
  123       ForceParticleDecay( 100443, 443, 1);  
 
  124       ForceParticleDecay(    443,  13, 2);  
 
  126       ForceParticleDecay(  411,13,1); 
 
  127       ForceParticleDecay(  421,13,1); 
 
  128       ForceParticleDecay(  431,13,1); 
 
  129       ForceParticleDecay( 4122,13,1); 
 
  130       ForceParticleDecay( 4132,13,1); 
 
  131       ForceParticleDecay( 4232,13,1); 
 
  132       ForceParticleDecay( 4332,13,1); 
 
  135       ForceParticleDecay(  411,13,1); 
 
  136       ForceParticleDecay(  421,13,1); 
 
  137       ForceParticleDecay(  431,13,1); 
 
  138       ForceParticleDecay( 4122,13,1); 
 
  139       ForceParticleDecay( 4132,13,1); 
 
  140       ForceParticleDecay( 4232,13,1); 
 
  141       ForceParticleDecay( 4332,13,1); 
 
  142       ForceParticleDecay(  511,13,1); 
 
  143       ForceParticleDecay(  521,13,1); 
 
  144       ForceParticleDecay(  531,13,1); 
 
  145       ForceParticleDecay( 5122,13,1); 
 
  146       ForceParticleDecay( 5132,13,1); 
 
  147       ForceParticleDecay( 5232,13,1); 
 
  148       ForceParticleDecay( 5332,13,1); 
 
  151       ForceParticleDecay(  113,13,2); 
 
  152       ForceParticleDecay(  221,13,2); 
 
  153       ForceParticleDecay(  223,13,2); 
 
  154       ForceParticleDecay(  333,13,2); 
 
  155       ForceParticleDecay(  443,13,2); 
 
  156       ForceParticleDecay(100443,13,2);
 
  157       ForceParticleDecay(  553,13,2); 
 
  158       ForceParticleDecay(100553,13,2);
 
  159       ForceParticleDecay(200553,13,2);
 
  161    case kSemiElectronic:
 
  162       ForceParticleDecay(  411,11,1); 
 
  163       ForceParticleDecay(  421,11,1); 
 
  164       ForceParticleDecay(  431,11,1); 
 
  165       ForceParticleDecay( 4122,11,1); 
 
  166       ForceParticleDecay( 4132,11,1); 
 
  167       ForceParticleDecay( 4232,11,1); 
 
  168       ForceParticleDecay( 4332,11,1); 
 
  169       ForceParticleDecay(  511,11,1); 
 
  170       ForceParticleDecay(  521,11,1); 
 
  171       ForceParticleDecay(  531,11,1); 
 
  172       ForceParticleDecay( 5122,11,1); 
 
  173       ForceParticleDecay( 5132,11,1); 
 
  174       ForceParticleDecay( 5232,11,1); 
 
  175       ForceParticleDecay( 5332,11,1); 
 
  178       ForceParticleDecay(  113,11,2); 
 
  179       ForceParticleDecay(  333,11,2); 
 
  180       ForceParticleDecay(  221,11,2); 
 
  181       ForceParticleDecay(  223,11,2); 
 
  182       ForceParticleDecay(  443,11,2); 
 
  183       ForceParticleDecay(100443,11,2);
 
  184       ForceParticleDecay(  553,11,2); 
 
  185       ForceParticleDecay(100553,11,2);
 
  186       ForceParticleDecay(200553,11,2);
 
  191       products[1] = 100443;
 
  195       ForceParticleDecay(  511, products, mult, 2); 
 
  196       ForceParticleDecay(  521, products, mult, 2); 
 
  197       ForceParticleDecay(  531, products, mult, 2); 
 
  198       ForceParticleDecay( 5122, products, mult, 2); 
 
  199       ForceParticleDecay( 100443, 443, 1);          
 
  200       ForceParticleDecay(    443,13,2);             
 
  202    case kBPsiPrimeDiMuon:
 
  203       ForceParticleDecay(  511,100443,1); 
 
  204       ForceParticleDecay(  521,100443,1); 
 
  205       ForceParticleDecay(  531,100443,1); 
 
  206       ForceParticleDecay( 5122,100443,1); 
 
  207       ForceParticleDecay(100443,13,2);    
 
  209    case kBJpsiDiElectron:
 
  210       ForceParticleDecay(  511,443,1); 
 
  211       ForceParticleDecay(  521,443,1); 
 
  212       ForceParticleDecay(  531,443,1); 
 
  213       ForceParticleDecay( 5122,443,1); 
 
  214       ForceParticleDecay(  443,11,2);  
 
  217       ForceParticleDecay(  511,443,1); 
 
  218       ForceParticleDecay(  521,443,1); 
 
  219       ForceParticleDecay(  531,443,1); 
 
  220       ForceParticleDecay( 5122,443,1); 
 
  222    case kBPsiPrimeDiElectron:
 
  223       ForceParticleDecay(  511,100443,1); 
 
  224       ForceParticleDecay(  521,100443,1); 
 
  225       ForceParticleDecay(  531,100443,1); 
 
  226       ForceParticleDecay( 5122,100443,1); 
 
  227       ForceParticleDecay(100443,11,2);   
 
  230       ForceParticleDecay(211,13,1); 
 
  233       ForceParticleDecay(321,13,1); 
 
  236       ForceParticleDecay(  24, 13,1); 
 
  239       ForceParticleDecay(   24, 4,1); 
 
  241    case kWToCharmToMuon:
 
  242       ForceParticleDecay(   24, 4,1); 
 
  243       ForceParticleDecay(  411,13,1); 
 
  244       ForceParticleDecay(  421,13,1); 
 
  245       ForceParticleDecay(  431,13,1); 
 
  246       ForceParticleDecay( 4122,13,1); 
 
  247       ForceParticleDecay( 4132,13,1); 
 
  248       ForceParticleDecay( 4232,13,1); 
 
  249       ForceParticleDecay( 4332,13,1); 
 
  252       ForceParticleDecay(  23, 13,2); 
 
  258       ForceParticleDecay(333,321,2); 
 
  265       TPythia6::Instance()->SetMSTJ(21,0);
 
  267    case kNoDecayHeavy: 
break; 
 
  268    case kMaxDecay: 
break;
 
  276 Float_t TPythia6Decayer::GetPartialBranchingRatio(Int_t ipart)
 
  278    Int_t kc = TPythia6::Instance()->Pycomp(TMath::Abs(ipart));
 
  286 Float_t TPythia6Decayer::GetLifetime(Int_t kf)
 
  288    Int_t kc=TPythia6::Instance()->Pycomp(TMath::Abs(kf));
 
  289    return TPythia6::Instance()->GetPMAS(kc,4) * 3.3333e-12;
 
  297 void TPythia6Decayer::ReadDecayTable()
 
  299    if (fDecayTableFile.IsNull()) {
 
  300       Warning(
"ReadDecayTable", 
"No file set");
 
  304    TPythia6::Instance()->OpenFortranFile(lun,
 
  305                                          const_cast<char*>(fDecayTableFile.Data()));
 
  306    TPythia6::Instance()->Pyupda(3,lun);
 
  307    TPythia6::Instance()->CloseFortranFile(lun);
 
  332 void PrintPDG(TParticlePDG* pdg)
 
  334    TParticlePDG* anti = pdg->AntiParticle();
 
  335    const char* antiName = (anti ? anti->GetName() : 
"");
 
  337    switch (TMath::Abs(pdg->PdgCode())) {
 
  338       case 1: 
case 2: 
case 3: 
case 4: 
case 5: 
case 6: 
case 7: 
case 8: 
 
  343       case 2101: 
case 2103: 
case 2203:
 
  344       case 3101: 
case 3103: 
case 3201: 
case 3203: 
case 3303:
 
  345       case 4101: 
case 4103: 
case 4201: 
case 4203: 
case 4301: 
case 4303: 
case 4403:
 
  346       case 5101: 
case 5103: 
case 5201: 
case 5203: 
case 5301: 
case 5303: 
case 5401:
 
  347       case 5403: 
case 5503:
 
  350       case 1000001: 
case 1000002: 
case 1000003: 
case 1000004: 
case 1000005:
 
  355       case 2000001: 
case 2000002: 
case 2000003: 
case 2000004: 
case 2000005:
 
  358       case 3000331: 
case 3100021: 
case 3200111: 
case 3100113: 
case 3200113:
 
  359       case 3300113: 
case 3400113:
 
  362       case 4000001: 
case 4000002:
 
  364       case 9900443: 
case 9900441: 
case 9910441: 
case 9900553: 
case 9900551:
 
  368    std::cout << std::right
 
  369              << 
" " << std::setw(9) << pdg->PdgCode()
 
  370              << 
"  " << std::left   << std::setw(16) << pdg->GetName()
 
  371              << 
"  " << std::setw(16) << antiName
 
  373              << std::setw(3) << Int_t(pdg->Charge())
 
  374              << std::setw(3) << color
 
  375              << std::setw(3) << (anti ? 1 : 0)
 
  376              << std::fixed   << std::setprecision(5)
 
  377              << std::setw(12) << pdg->Mass()
 
  378              << std::setw(12) << pdg->Width()
 
  379              << std::setw(12) << 0 
 
  381              << 
" " << std::setw(13) << pdg->Lifetime()
 
  383              << std::setw(3) << pdg->Stable()
 
  389    TDatabasePDG* pdgDB = TDatabasePDG::Instance();
 
  390    pdgDB->ReadPDGTable();
 
  391    const THashList*    pdgs  = pdgDB->ParticleList();
 
  392    TParticlePDG*       pdg   = 0;
 
  394    while ((pdg = static_cast<TParticlePDG*>(nextPDG()))) {
 
  398       TObjArray*     decays = pdg->DecayList();
 
  399       TDecayChannel* decay  = 0;
 
  400       TIter          nextDecay(decays);
 
  401       while ((decay = static_cast<TDecayChannel*>(nextDecay()))) {
 
  473 void TPythia6Decayer::WriteDecayTable()
 
  475    if (fDecayTableFile.IsNull()) {
 
  476       Warning(
"ReadDecayTable", 
"No file set");
 
  480    TPythia6::Instance()->OpenFortranFile(lun,
 
  481                                          const_cast<char*>(fDecayTableFile.Data()));
 
  482    TPythia6::Instance()->Pyupda(1,lun);
 
  483    TPythia6::Instance()->CloseFortranFile(lun);
 
  489 Int_t TPythia6Decayer::CountProducts(Int_t channel, Int_t particle)
 
  492    for (Int_t i = 1; i <= 5; i++)
 
  493       if (TMath::Abs(TPythia6::Instance()->GetKFDP(channel,i)) == particle) np++;
 
  500 void TPythia6Decayer::ForceHadronicD()
 
  502    const Int_t kNHadrons = 4;
 
  504    Int_t hadron[kNHadrons] = {411,  421, 431, 4112};
 
  508    Int_t iKstarbar0  = -313;
 
  509    Int_t products[2] = {kKPlus, kPiMinus}, mult[2] = {1, 1};
 
  510    ForceParticleDecay(iKstar0, products, mult, 2);
 
  514    ForceParticleDecay(iPhi,kKPlus,2); 
 
  516    Int_t decayP1[kNHadrons][3] = {
 
  517       {kKMinus, kPiPlus,    kPiPlus},
 
  518       {kKMinus, kPiPlus,    0      },
 
  519       {kKPlus , iKstarbar0, 0     },
 
  522    Int_t decayP2[kNHadrons][3] = {
 
  523       {iKstarbar0, kPiPlus, 0   },
 
  525       {iPhi      , kPiPlus, 0  },
 
  529    TPythia6* pyth = TPythia6::Instance();
 
  530    for (Int_t ihadron = 0; ihadron < kNHadrons; ihadron++) {
 
  531       Int_t kc = pyth->Pycomp(hadron[ihadron]);
 
  532       pyth->SetMDCY(kc,1,1);
 
  533       Int_t ifirst = pyth->GetMDCY(kc,2);
 
  534       Int_t ilast  = ifirst + pyth->GetMDCY(kc,3)-1;
 
  536       for (channel = ifirst; channel <= ilast; channel++) {
 
  537          if ((pyth->GetKFDP(channel,1) == decayP1[ihadron][0] &&
 
  538             pyth->GetKFDP(channel,2) == decayP1[ihadron][1] &&
 
  539             pyth->GetKFDP(channel,3) == decayP1[ihadron][2] &&
 
  540             pyth->GetKFDP(channel,4) == 0) ||
 
  541            (pyth->GetKFDP(channel,1) == decayP2[ihadron][0] &&
 
  542             pyth->GetKFDP(channel,2) == decayP2[ihadron][1] &&
 
  543             pyth->GetKFDP(channel,3) == decayP2[ihadron][2] &&
 
  544             pyth->GetKFDP(channel,4) == 0)) {
 
  545             pyth->SetMDME(channel,1,1);
 
  547             pyth->SetMDME(channel,1,0);
 
  548             fBraPart[kc] -= pyth->GetBRAT(channel);
 
  558 void TPythia6Decayer::ForceParticleDecay(Int_t particle, Int_t product, Int_t mult)
 
  560    TPythia6* pyth = TPythia6::Instance();
 
  562    Int_t kc =  pyth->Pycomp(particle);
 
  563    pyth->SetMDCY(kc,1,1);
 
  565    Int_t ifirst = pyth->GetMDCY(kc,2);
 
  566    Int_t ilast  = ifirst + pyth->GetMDCY(kc,3)-1;
 
  571    for (Int_t channel= ifirst; channel <= ilast; channel++) {
 
  572       if (CountProducts(channel,product) >= mult) {
 
  573          pyth->SetMDME(channel,1,1);
 
  575          pyth->SetMDME(channel,1,0);
 
  576          fBraPart[kc]-=pyth->GetBRAT(channel);
 
  585 void TPythia6Decayer::ForceParticleDecay(Int_t particle, Int_t* products,
 
  586                                          Int_t* mult, Int_t npart)
 
  588    TPythia6* pyth = TPythia6::Instance();
 
  590    Int_t kc     = pyth->Pycomp(particle);
 
  591    pyth->SetMDCY(kc,1,1);
 
  592    Int_t ifirst = pyth->GetMDCY(kc,2);
 
  593    Int_t ilast  = ifirst+pyth->GetMDCY(kc,3)-1;
 
  597    for (Int_t channel = ifirst; channel <= ilast; channel++) {
 
  599       for (Int_t i = 0; i < npart; i++)
 
  600          nprod += (CountProducts(channel, products[i]) >= mult[i]);
 
  602          pyth->SetMDME(channel,1,1);
 
  604          pyth->SetMDME(channel,1,0);
 
  605          fBraPart[kc] -= pyth->GetBRAT(channel);
 
  613 void TPythia6Decayer::ForceOmega()
 
  615    TPythia6* pyth = TPythia6::Instance();
 
  617    Int_t kc     = pyth->Pycomp(3334);
 
  618    pyth->SetMDCY(kc,1,1);
 
  619    Int_t ifirst = pyth->GetMDCY(kc,2);
 
  620    Int_t ilast  = ifirst + pyth->GetMDCY(kc,3)-1;
 
  621    for (Int_t channel = ifirst; channel <= ilast; channel++) {
 
  622       if (pyth->GetKFDP(channel,1) == kLambda0 &&
 
  623          pyth->GetKFDP(channel,2) == kKMinus  &&
 
  624          pyth->GetKFDP(channel,3) == 0)
 
  625          pyth->SetMDME(channel,1,1);
 
  627          pyth->SetMDME(channel,1,0);