6 #include "TauolaEvent.h"
11 int Tauola::m_pdg_id = 15;
12 int Tauola::m_firstDecayMode = 0;
13 int Tauola::m_secondDecayMode = 0;
14 bool Tauola::m_rad =
true;
15 double Tauola::m_rad_cut_off = 0.001;
16 double Tauola::m_iniphy = 0.1;
17 double Tauola::m_higgs_scalar_pseudoscalar_mix = M_PI/4;
18 int Tauola::m_higgs_scalar_pseudoscalar_pdg = 35;
19 int Tauola::m_helPlus = 0;
20 int Tauola::m_helMinus = 0;
21 double Tauola::m_wtEW = 0.0;
22 double Tauola::m_wtEW0 = 0.0;
23 double Tauola::table11A[NS1][NCOS][4][4] = {{{{0.0}}}};
24 double Tauola::table1A [NS1][NCOS][4][4] = {{{{0.0}}}};
25 double Tauola::table2A [NS1][NCOS][4][4] = {{{{0.0}}}};
26 double Tauola::wtable11A[NS1][NCOS] = {{0.0}};
27 double Tauola::wtable1A [NS1][NCOS] = {{0.0}};
28 double Tauola::wtable2A [NS1][NCOS] = {{0.0}};
29 double Tauola::w0table11A[NS1][NCOS] = {{0.0}};
30 double Tauola::w0table1A [NS1][NCOS] = {{0.0}};
31 double Tauola::w0table2A [NS1][NCOS] = {{0.0}};
33 double Tauola::table11B[NS2][NCOS][4][4] = {{{{0.0}}}};
34 double Tauola::table1B [NS2][NCOS][4][4] = {{{{0.0}}}};
35 double Tauola::table2B [NS2][NCOS][4][4] = {{{{0.0}}}};
36 double Tauola::wtable11B[NS2][NCOS] = {{0.0}};
37 double Tauola::wtable1B [NS2][NCOS] = {{0.0}};
38 double Tauola::wtable2B [NS2][NCOS] = {{0.0}};
39 double Tauola::w0table11B[NS2][NCOS] = {{0.0}};
40 double Tauola::w0table1B [NS2][NCOS] = {{0.0}};
41 double Tauola::w0table2B [NS2][NCOS] = {{0.0}};
43 double Tauola::table11C[NS3][NCOS][4][4] = {{{{0.0}}}};
44 double Tauola::table1C [NS3][NCOS][4][4] = {{{{0.0}}}};
45 double Tauola::table2C [NS3][NCOS][4][4] = {{{{0.0}}}};
46 double Tauola::wtable11C[NS3][NCOS] = {{0.0}};
47 double Tauola::wtable1C [NS3][NCOS] = {{0.0}};
48 double Tauola::wtable2C [NS3][NCOS] = {{0.0}};
49 double Tauola::w0table11C[NS3][NCOS] = {{0.0}};
50 double Tauola::w0table1C [NS3][NCOS] = {{0.0}};
51 double Tauola::w0table2C [NS3][NCOS] = {{0.0}};
53 double Tauola::sminA = 0;
54 double Tauola::smaxA = 0;
56 double Tauola::sminB = 0;
57 double Tauola::smaxB = 0;
59 double Tauola::sminC = 0;
60 double Tauola::smaxC = 0;
62 int Tauola::ion[3] = {0};
63 double Tauola::tau_lifetime = .08711;
64 double Tauola::momentum_conservation_threshold = 0.1;
66 Tauola::Particles Tauola::spin_correlation;
69 Tauola::LengthUnits Tauola::lengthUnit = Tauola::DEFAULT_LENGTH;
71 bool Tauola::m_is_using_decay_one =
false;
72 double Tauola::m_decay_one_polarization[3] = {0};
75 int Tauola::buf_incoming_pdg_id = 0;
76 int Tauola::buf_outgoing_pdg_id = 0;
77 double Tauola::buf_invariant_mass_squared = -1.;
78 double Tauola::buf_cosTheta = 0.;
80 double Tauola::buf_R[4][4] = {{0.0}};
82 double (*Tauola::randomDouble)() = Tauola::defaultRandomGenerator;
83 void (*Tauola::redefineTauPlusProperties)(
TauolaParticle *) = defaultRedPlus;
84 void (*Tauola::redefineTauMinusProperties)(
TauolaParticle *) = defaultRedMinus;
92 double Tauola::defaultRandomGenerator(){
93 return rand()*1./RAND_MAX;
97 if(gen==NULL) randomDouble = defaultRandomGenerator;
98 else randomDouble = gen;
104 void Tauola::setRedefineTauMinus(
void (*fun)(
TauolaParticle *) ){
105 redefineTauMinusProperties=fun;
108 void Tauola::setRedefineTauPlus (
void (*fun)(
TauolaParticle *) ){
109 redefineTauPlusProperties=fun;
112 void Tauola::getBornKinematics(
int *incoming_pdg_id,
int *outgoing_pdg_id,
double *invariant_mass_squared,
double *cosTheta){
113 *incoming_pdg_id = buf_incoming_pdg_id;
114 *outgoing_pdg_id = buf_outgoing_pdg_id;
115 *invariant_mass_squared = buf_invariant_mass_squared;
116 *cosTheta = buf_cosTheta;
121 Tauola::momentumUnit = m;
122 Tauola::lengthUnit = l;
131 printf(
" *************************************\n");
132 printf(
" * TAUOLA C++ Interface v1.1.5 *\n");
133 printf(
" *-----------------------------------*\n");
135 printf(
" * (c) Nadia Davidson, (1,2) *\n");
136 printf(
" * Gizo Nanava, (3) *\n");
137 printf(
" * Tomasz Przedzinski,(4) *\n");
138 printf(
" * Elzbieta Richter-Was,(2,4) *\n");
139 printf(
" * Zbigniew Was (2,5) *\n");
141 printf(
" * 1) Unimelb, Melbourne, Australia *\n");
142 printf(
" * 2) INP, Krakow, Poland *\n");
143 printf(
" * 3) University Bonn, Germany *\n");
144 printf(
" * 4) UJ, Krakow, Poland *\n");
145 printf(
" * 5) CERN, Geneva, Switzerland *\n");
146 printf(
" *************************************\n");
149 spin_correlation.setAll(
true);
152 f_interface_tauolaInitialize(m_pdg_id,m_firstDecayMode,
153 m_secondDecayMode,m_rad,
154 m_rad_cut_off, m_iniphy);
159 cout<<
"Reading SANC input files."<<endl;
161 ifstream f(
"table1-1.txt");
164 cout<<
"File 'table1-1.txt' missing... skipped."<<endl;
169 cout<<
"Reading file 'table1-1.txt'..."<<endl;
171 int dbuf1,dbuf2,dbuf3,dbufcos;
172 f>>buf>>dbuf1>>dbuf2>>dbuf3>>dbufcos;
175 if(dbuf1!=NS1 || dbuf2!=NS2 || dbuf3!=NS3 || dbufcos!=NCOS) {
176 cout<<
"mismatched NS1= "<<dbuf1 <<
" <--> "<<NS1<<endl;
177 cout<<
" NS2= "<<dbuf2 <<
" <--> "<<NS2<<endl;
178 cout<<
" NS3= "<<dbuf3 <<
" <--> "<<NS3<<endl;
179 cout<<
" NCOS= "<<dbufcos<<
" <--> "<<NCOS<<endl;
183 double buf1,buf2,buf3,buf4,buf5,buf6;
184 f>>buf>>buf1>>buf2>>buf3>>buf4>>buf5>>buf6;
197 if(buf1!=sminA || buf2!=smaxA || buf3!=sminB || buf4!=smaxB || buf5!=sminC || buf6!=smaxC) {
198 cout<<
"mismatched sminA= "<<buf1<<
" <--> "<<sminA<<endl;
199 cout<<
" smaxA= "<<buf2<<
" <--> "<<smaxA<<endl;
200 cout<<
" sminB= "<<buf3<<
" <--> "<<sminB<<endl;
201 cout<<
" smaxB= "<<buf4<<
" <--> "<<smaxB<<endl;
202 cout<<
" sminC= "<<buf5<<
" <--> "<<sminC<<endl;
203 cout<<
" smaxC= "<<buf6<<
" <--> "<<smaxC<<endl;
211 if(strcmp(head,
"BeginRange1")==0)
break;
216 for (
int i=0;i<NS1;i++){
217 for (
int j=0;j<NCOS;j++){
218 for (
int k=0;k<4;k++){
219 for (
int l=0;l<4;l++){
220 f>>table1A[i][j][k][l];
231 if(strcmp(buf.c_str(),
"BeginRange2")==0)
break;
235 for (
int i=0;i<NS2;i++){
236 for (
int j=0;j<NCOS;j++){
237 for (
int k=0;k<4;k++){
238 for (
int l=0;l<4;l++){
239 f>>table1B[i][j][k][l];
250 if(strcmp(buf.c_str(),
"BeginRange3")==0)
break;
254 for (
int i=0;i<NS3;i++){
255 for (
int j=0;j<NCOS;j++){
256 for (
int k=0;k<4;k++){
257 for (
int l=0;l<4;l++){
258 f>>table1C[i][j][k][l];
268 if(buf.size() == 0 || strcmp(buf.c_str(),
"End") != 0){
269 cout<<
"...incorrect file version or file incomplete/damaged!"<<endl;
272 table1A[0][0][0][0] = table1B[0][0][0][0] = table1C[0][0][0][0] = 0.0;
277 f.open(
"table2-2.txt");
280 cout<<
"File 'table2-2.txt' missing... skipped."<<endl;
285 cout<<
"Reading file 'table2-2.txt'..."<<endl;
287 int dbuf1,dbuf2,dbuf3,dbufcos;
288 f>>buf>>dbuf1>>dbuf2>>dbuf3>>dbufcos;
291 if(dbuf1!=NS1 || dbuf2!=NS2 || dbuf3!=NS3 || dbufcos!=NCOS) {
292 cout<<
"mismatched NS1= "<<dbuf1<<
" <--> "<<NS1<<endl;
293 cout<<
" NS2= "<<dbuf2<<
" <--> "<<NS2<<endl;
294 cout<<
" NS3= "<<dbuf3<<
" <--> "<<NS3<<endl;
295 cout<<
" NCOS= "<<dbufcos<<
" <--> "<<NCOS<<endl;
299 double buf1,buf2,buf3,buf4,buf5,buf6;
300 f>>buf>>buf1>>buf2>>buf3>>buf4>>buf5>>buf6;
314 if(buf1!=sminA || buf2!=smaxA || buf3!=sminB || buf4!=smaxB || buf5!=sminC || buf6!=smaxC) {
315 cout<<
"mismatched sminA= "<<buf1<<
" <--> "<<sminA<<endl;
316 cout<<
" smaxA= "<<buf2<<
" <--> "<<smaxA<<endl;
317 cout<<
" sminB= "<<buf3<<
" <--> "<<sminB<<endl;
318 cout<<
" smaxB= "<<buf4<<
" <--> "<<smaxB<<endl;
319 cout<<
" sminC= "<<buf5<<
" <--> "<<sminC<<endl;
320 cout<<
" smaxC= "<<buf6<<
" <--> "<<smaxC<<endl;
328 if(strcmp(head,
"BeginRange1")==0)
break;
333 for (
int i=0;i<NS1;i++){
334 for (
int j=0;j<NCOS;j++){
335 for (
int k=0;k<4;k++){
336 for (
int l=0;l<4;l++){
337 f>>table2A[i][j][k][l];
348 if(strcmp(buf.c_str(),
"BeginRange2")==0)
break;
352 for (
int i=0;i<NS2;i++){
353 for (
int j=0;j<NCOS;j++){
354 for (
int k=0;k<4;k++){
355 for (
int l=0;l<4;l++){
356 f>>table2B[i][j][k][l];
367 if(strcmp(buf.c_str(),
"BeginRange3")==0)
break;
371 for (
int i=0;i<NS3;i++){
372 for (
int j=0;j<NCOS;j++){
373 for (
int k=0;k<4;k++){
374 for (
int l=0;l<4;l++){
375 f>>table2C[i][j][k][l];
385 if(buf.size()==0 || strcmp(buf.c_str(),
"End")!=0){
386 cout<<
"...incorrect file version or file incomplete/damaged!"<<endl;
389 table2A[0][0][0][0] = table2B[0][0][0][0] = table2C[0][0][0][0] = 0.0;
394 f.open(
"table11-11.txt");
397 cout<<
"File 'table11-11.txt' missing... skipped."<<endl;
402 cout<<
"Reading file 'table11-11.txt'..."<<endl;
404 int dbuf1,dbuf2,dbuf3,dbufcos;
405 f>>buf>>dbuf1>>dbuf2>>dbuf3>>dbufcos;
408 if(dbuf1!=NS1 || dbuf2!=NS2 || dbuf3!=NS3 || dbufcos!=NCOS) {
409 cout<<
"mismatched NS1= "<<dbuf1<<
" <--> "<<NS1<<endl;
410 cout<<
" NS2= "<<dbuf2<<
" <--> "<<NS2<<endl;
411 cout<<
" NS3= "<<dbuf3<<
" <--> "<<NS3<<endl;
412 cout<<
" NCOS= "<<dbufcos<<
" <--> "<<NCOS<<endl;
416 double buf1,buf2,buf3,buf4,buf5,buf6;
417 f>>buf>>buf1>>buf2>>buf3>>buf4>>buf5>>buf6;
431 if(buf1!=sminA || buf2!=smaxA || buf3!=sminB || buf4!=smaxB || buf5!=sminC || buf6!=smaxC) {
432 cout<<
"mismatched sminA= "<<buf1<<
" <--> "<<sminA<<endl;
433 cout<<
" smaxA= "<<buf2<<
" <--> "<<smaxA<<endl;
434 cout<<
" sminB= "<<buf3<<
" <--> "<<sminB<<endl;
435 cout<<
" smaxB= "<<buf4<<
" <--> "<<smaxB<<endl;
436 cout<<
" sminC= "<<buf5<<
" <--> "<<sminC<<endl;
437 cout<<
" smaxC= "<<buf6<<
" <--> "<<smaxC<<endl;
445 if(strcmp(head,
"BeginRange1")==0)
break;
450 for (
int i=0;i<NS1;i++){
451 for (
int j=0;j<NCOS;j++){
452 for (
int k=0;k<4;k++){
453 for (
int l=0;l<4;l++){
454 f>>table11A[i][j][k][l];
465 if(strcmp(buf.c_str(),
"BeginRange2")==0)
break;
469 for (
int i=0;i<NS2;i++){
470 for (
int j=0;j<NCOS;j++){
471 for (
int k=0;k<4;k++){
472 for (
int l=0;l<4;l++){
473 f>>table11B[i][j][k][l];
484 if(strcmp(buf.c_str(),
"BeginRange3")==0)
break;
488 for (
int i=0;i<NS3;i++){
489 for (
int j=0;j<NCOS;j++){
490 for (
int k=0;k<4;k++){
491 for (
int l=0;l<4;l++){
492 f>>table11C[i][j][k][l];
501 if(buf.size()==0 || strcmp(buf.c_str(),
"End")!=0){
502 cout<<
"...incorrect file version or file incomplete/damaged!"<<endl;
505 table11A[0][0][0][0] = table11B[0][0][0][0] = table11C[0][0][0][0] = 0.0;
517 if(polx*polx+poly*poly+polz*polz>1)
519 Log::Warning()<<
"decayOne(): ignoring wrong polarization vector: "<<polx<<
" "<<poly<<
" "<<polz<<endl;
524 m_is_using_decay_one =
true;
526 m_decay_one_polarization[0] = polx;
527 m_decay_one_polarization[1] = poly;
528 m_decay_one_polarization[2] = polz;
536 m_is_using_decay_one =
false;
541 std::vector<TauolaParticle *> list;
550 m_is_using_decay_one =
false;
555 Log::Warning() <<
"Deprecated routine 'Tauola::initialise'"<<endl;
556 Log::Warning(0)<<
"Use 'Tauola::initialize' instead."<<endl;
566 return m_is_using_decay_one;
571 return (
bool) m_decay_one_boost_routine;
576 m_decay_one_boost_routine=boost;
581 m_decay_one_boost_routine(mother,target);
586 return m_decay_one_polarization;
594 return abs(m_pdg_id);
598 m_firstDecayMode=firstDecayMode;
602 m_secondDecayMode=secondDecayMode;
610 m_rad_cut_off=rad_cut_off;
620 Log::Warning() <<
"Deprecated routine 'Tauola::setInitialisePhy'"<<endl;
621 Log::Warning(0)<<
"Use 'Tauola::setInitializePhy' instead."<<endl;
632 Log::Warning()<<
"setTauBr(): run Tauola::initialize() first."<<endl;
633 else if(i<1 || i>taubra_.nchan || value<0.)
634 Log::Warning()<<
"setTauBr(): Invalid input. Value must be >= 0 and 0 < i <= "<<taubra_.nchan<<endl;
635 else taubra_.gamprt[i-1]=(float)value;
638 void Tauola::setTaukle(
double bra1,
double brk0,
double brk0b,
double brks)
640 if(bra1<0 || bra1>1 || brk0<0 ||brk0>1 || brk0b<0 || brk0b>1 || brks<0 ||brks>1)
642 Log::Warning()<<
"setTaukle(): variables must be in range [0,1]. Ignored."<<endl;
645 taukle_.bra1 =(float)bra1;
646 taukle_.brk0 =(float)brk0;
647 taukle_.brk0b=(float)brk0b;
648 taukle_.brks =(float)brks;
652 return f_getTauMass();
655 double Tauola::getHiggsScalarPseudoscalarMixingAngle(){
656 return m_higgs_scalar_pseudoscalar_mix;
660 return m_higgs_scalar_pseudoscalar_pdg;
665 m_higgs_scalar_pseudoscalar_mix=angle;
672 if (particleCharge(pdg_code)!=0.0){
673 Log::Warning()<<
"You want to use spin correlations of Higgs for particle of PDGID= "<<pdg_code<<endl
674 <<
"This particle has charge="<<particleCharge(pdg_code)<<endl;
675 Log::Fatal(
"This choice is not appropriate.",0);
677 m_higgs_scalar_pseudoscalar_pdg=pdg_code;
680 int Tauola::getHelPlus(){
683 int Tauola::getHelMinus(){
686 double Tauola::getEWwt(){
689 double Tauola::getEWwt0(){
692 void Tauola::setEWwt(
double wt,
double wt0)
697 void Tauola::setHelicities(
int minus,
int plus)
702 void Tauola::setEtaK0sPi(
int eta,
int k,
int pi)
709 void Tauola::summary()
714 Log::Info() <<
"Tauola::summary(): We use old TAUOLA FORTRAN printout."<<endl;
715 Log::Info(
false)<<
"As a consequence, there is a mismatch in printed TAUOLA version number."<<endl<<endl;
718 dekay_(&sign_type,pol);
721 void Tauola::fill_val(
int beg,
int end,
double* array,
double value)
723 for (
int i = beg; i < end; i++)
727 double Tauola::particleCharge(
int idhep)
729 static double CHARGE[101] = { 0 };
738 fill_val(0 , 1, CHARGE, 0.0 );
739 fill_val(1 , 2, CHARGE,-0.3333333333);
740 fill_val(2 , 3, CHARGE, 0.6666666667);
741 fill_val(3 , 4, CHARGE,-0.3333333333);
742 fill_val(4 , 5, CHARGE, 0.6666666667);
743 fill_val(5 , 6, CHARGE,-0.3333333333);
744 fill_val(6 , 7, CHARGE, 0.6666666667);
745 fill_val(7 , 8, CHARGE,-0.3333333333);
746 fill_val(8 , 9, CHARGE, 0.6666666667);
747 fill_val(9 , 11, CHARGE, 0.0 );
748 fill_val(11 ,12, CHARGE,-1.0 );
749 fill_val(12 ,13, CHARGE, 0.0 );
750 fill_val(13 ,14, CHARGE,-1.0 );
751 fill_val(14, 15, CHARGE, 0.0 );
752 fill_val(15 ,16, CHARGE,-1.0 );
753 fill_val(16, 17, CHARGE, 0.0 );
754 fill_val(17 ,18, CHARGE,-1.0 );
755 fill_val(18, 24, CHARGE, 0.0 );
756 fill_val(24, 25, CHARGE, 1.0 );
757 fill_val(25, 37, CHARGE, 0.0 );
758 fill_val(37, 38, CHARGE, 1.0 );
759 fill_val(38,101, CHARGE, 0.0 );
762 int idabs=abs(idhep);
767 if (idabs<=100) phoch=CHARGE[idabs];
769 int Q3= idabs/1000 % 10;
770 int Q2= idabs/100 % 10;
771 int Q1= idabs/10 % 10;
775 if(Q2 % 2==0) phoch=CHARGE[Q2]-CHARGE[Q1];
776 else phoch=CHARGE[Q1]-CHARGE[Q2];
781 phoch=CHARGE[Q1]+CHARGE[Q2]+CHARGE[Q3];
786 if (idhep<0.0) phoch=-phoch;
787 if (phoch*phoch<0.000001) phoch=0.0;
static void setInitializePhy(double iniphy)
static void setNewCurrents(int mode)
static void setBoostRoutine(void(*boost)(TauolaParticle *, TauolaParticle *))
static void setOppositeParticleDecayMode(int secondDecayMode)
static void setHiggsScalarPseudoscalarPDG(int pdg_id)
static int getHiggsScalarPseudoscalarPDG()
static void setRadiationCutOff(double rad_cut_off)
static const double * getDecayOnePolarization()
Abstract base class for particle in the event. This class also handles boosting.
static bool isUsingDecayOneBoost()
static void setRadiation(bool rad)
static bool isUsingDecayOne()
static void setRandomGenerator(double(*gen)())
void checkMomentumConservation()
static void setTauBr(int i, double value)
static void setInitialisePhy(double iniphy)
static void Fatal(string text, unsigned short int code=0)
static void decayOne(TauolaParticle *tau, bool undecay=false, double polx=0, double poly=0, double polz=0)
static void setSameParticleDecayMode(int firstDecayMode)
static void setUnits(MomentumUnits m, LengthUnits l)
static int getDecayingParticle()
static void setTauLifetime(double t)
static void setDecayingParticle(int pdg_id)
static void setHiggsScalarPseudoscalarMixingAngle(double angle)
static double getTauMass()
static void decayOneBoost(TauolaParticle *mother, TauolaParticle *target)