]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenModels/EvtBtoXsgamma.cpp
Fix bug in building local list of valid files.
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenModels / EvtBtoXsgamma.cpp
1 //--------------------------------------------------------------------------
2 //
3 // Environment:
4 //      This software is part of the EvtGen package developed jointly
5 //      for the BaBar and CLEO collaborations.  If you use all or part
6 //      of it, please give an appropriate acknowledgement.
7 //
8 // Module: EvtBtoXsgamma.cc
9 //
10 // Description: Routine to perform two-body non-resonant B->Xs,gamma decays.
11 //              Set the first input parameter to 1 to use the Ali-Greub model,
12 //              or 2 to use the Kagan-Neubert model.
13 //
14 // Modification history:
15 //
16 //    Mark Ian Williams       July 20, 2000       Module created
17 //    Mark Ian Williams       July 21, 2000       Module works
18 //    Mark Ian Williams       July 25, 2000       Works for all Xs modes
19 //    Mark Ian Williams       Aug  09, 2000       New values for mass minima
20 //    Mark Ian Williams       Sept 06, 2000       14 parameter M_Xs function
21 //    Mark Ian Williams       Sept 07, 2000       18 parameter M_Xs function
22 //    Mark Ian Williams       Sept 07, 2000       Tidied up the code
23 //    Mark Ian Williams       Sept 10, 2000       Updated parameters
24 //    Mark Ian Williams       Sept 11, 2000       Finalised code
25 //    Jane Tinslay            March 21, 2001      Re-worked so that you can choose
26 //                                                between the Ali-Greub and Kagan-Neubert
27 //                                                Modules.                          
28 //------------------------------------------------------------------------
29 //
30
31 #include "EvtGenBase/EvtPatches.hh"
32 #include <stdlib.h>
33 #include "EvtGenBase/EvtParticle.hh"
34 #include "EvtGenBase/EvtGenKine.hh"
35 #include "EvtGenBase/EvtPDL.hh"
36 #include "EvtGenBase/EvtReport.hh"
37 #include "EvtGenModels/EvtBtoXsgamma.hh"
38 #include <string>
39 #include "EvtGenBase/EvtConst.hh"
40 #include "EvtGenModels/EvtBtoXsgammaAliGreub.hh"
41 #include "EvtGenModels/EvtBtoXsgammaKagan.hh"
42 #include "EvtGenModels/EvtBtoXsgammaFixedMass.hh"
43 #include "EvtGenModels/EvtBtoXsgammaFlatEnergy.hh"
44 using std::endl;
45
46 EvtBtoXsgamma::~EvtBtoXsgamma() {
47
48   delete _model; _model=0;
49
50 }
51
52 std::string EvtBtoXsgamma::getName(){
53
54   return "BTOXSGAMMA";     
55
56 }
57
58 EvtDecayBase* EvtBtoXsgamma::clone(){
59
60   return new EvtBtoXsgamma;
61
62 }
63
64 void EvtBtoXsgamma::init(){
65   //Arguments:
66   // 0: Ali-Greub model = 1, Kagan model = 2
67  //No more arguments for Ali-Greub model
68   // 1:
69   // 2:
70   // 3:
71
72   // check that at least one b->sg model has been selected
73   if (getNArg() == 0) {
74     
75     report(ERROR,"EvtGen") << "EvtBtoXsgamma generator expected "
76                            << " at least 1 argument but found: "<<getNArg()<<endl;
77     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
78     ::abort();
79   }    
80 }
81
82 void EvtBtoXsgamma::initProbMax(){
83
84   noProbMax();
85
86 }
87
88 void EvtBtoXsgamma::decay( EvtParticle *p ){
89
90   //initialize here. -- its too damn slow otherwise.
91
92   if ( _model == 0 ) {
93     
94     if (getArg(0) == 1) _model = new EvtBtoXsgammaAliGreub();
95     else if (getArg(0) == 2) _model = new EvtBtoXsgammaKagan();
96     else if (getArg(0) == 3) _model = new EvtBtoXsgammaFixedMass();
97     else if (getArg(0) == 4) _model = new EvtBtoXsgammaFlatEnergy();
98     else{
99       report(ERROR,"EvtGen") << "No valid EvtBtoXsgamma generator model selected "
100                              << "Set arg(0) to 1 for Ali-Greub model or 2 for "
101                              <<" Kagan model or 3 for a fixed mass"<<endl;
102       report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
103       ::abort();
104       
105     }
106     _model->init(getNArg(),getArgs());
107   }
108
109
110   //  if ( p->getNDaug() != 0 ) {
111     //Will end up here because maxrate multiplies by 1.2
112   //  report(DEBUG,"EvtGen") << "In EvtBtoXsgamma: X_s daughters should not be here!"<<endl;
113   //  return;
114   //}
115
116   double m_b;
117   int i;
118   p->makeDaughters(getNDaug(),getDaugs());
119   EvtParticle *pdaug[MAX_DAUG];
120
121   for(i=0;i<getNDaug();i++){
122      pdaug[i]=p->getDaug(i);   
123   }
124
125   static EvtVector4R p4[MAX_DAUG];
126   static double mass[MAX_DAUG];
127
128   m_b = p->mass();
129
130   mass[1] = EvtPDL::getMass(getDaug(1));
131  
132   int Xscode = EvtPDL::getStdHep(getDaug(0));
133    
134   mass[0] = _model->GetMass(Xscode);
135
136   EvtGenKine::PhaseSpace( getNDaug(), mass, p4, m_b );
137
138   for(i=0;i<getNDaug();i++){
139      pdaug[i]->init( getDaugs()[i], p4[i] );
140   }
141
142 }
143