Fix bug in building local list of valid files.
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenModels / EvtGenericDalitz.cpp
CommitLineData
0ca57c2f 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// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtGen/EvtGenericDalitz.hh
12//
13// Description: Model to describe a generic dalitz decay
14//
15// Modification history:
16//
17// DCC 16 December, 2011 Module created
18//
19//------------------------------------------------------------------------
20
21#include "EvtGenModels/EvtGenericDalitz.hh"
22#include "EvtGenModels/EvtDalitzTable.hh"
23#include "EvtGenBase/EvtParticle.hh"
24#include "EvtGenBase/EvtDalitzPoint.hh"
25#include "EvtGenBase/EvtPDL.hh"
26
27std::string EvtGenericDalitz::getName() {
28 return "GENERIC_DALITZ";
29}
30
31EvtDecayBase* EvtGenericDalitz::clone() {
32 return new EvtGenericDalitz();
33}
34
35void EvtGenericDalitz::init() {
36
37 checkNArg(1);
38
39 EvtId parnum=getParentId();
40 EvtId d1=getDaug(0);
41 EvtId d2=getDaug(1);
42 EvtId d3=getDaug(2);
43
44 std::vector<EvtDalitzDecayInfo> decays = EvtDalitzTable::getInstance(getArgStr(0))->getDalitzTable(parnum);
45
46 std::vector<EvtDalitzDecayInfo>::iterator i = decays.begin();
47 for( ; i != decays.end(); i++) {
48 EvtId daughter1 = (*i).daughter1();
49 EvtId daughter2 = (*i).daughter2();
50 EvtId daughter3 = (*i).daughter3();
51
52 if(d1 == daughter1 && d2 == daughter2 && d3 == daughter3) {
53 _d1 = 0;
54 _d2 = 1;
55 _d3 = 2;
56 } else if(d1 == daughter1 && d2 == daughter3 && d3 == daughter2) {
57 _d1 = 0;
58 _d2 = 2;
59 _d3 = 1;
60 } else if(d1 == daughter2 && d2 == daughter1 && d3 == daughter3) {
61 _d1 = 1;
62 _d2 = 0;
63 _d3 = 2;
64 } else if(d1 == daughter2 && d2 == daughter3 && d3 == daughter1) {
65 _d1 = 1;
66 _d2 = 2;
67 _d3 = 0;
68 } else if(d1 == daughter3 && d2 == daughter1 && d3 == daughter2) {
69 _d1 = 2;
70 _d2 = 0;
71 _d3 = 1;
72 } else if(d1 == daughter3 && d2 == daughter2 && d3 == daughter1) {
73 _d1 = 2;
74 _d2 = 1;
75 _d3 = 0;
76 } else {
77 continue;
78 }
79
80 _resonances = (*i).getResonances();
81 setProbMax((*i).getProbMax());
82 return;
83 }
84}
85
86void EvtGenericDalitz::decay(EvtParticle *p) {
87
88 p->initializePhaseSpace(getNDaug(),getDaugs());
89
90 EvtVector4R p4_d1 = p->getDaug(_d1)->getP4();
91 EvtVector4R p4_d2 = p->getDaug(_d2)->getP4();
92 EvtVector4R p4_d3 = p->getDaug(_d3)->getP4();
93
94 double mA = p->getDaug(_d1)->mass();
95 double mB = p->getDaug(_d2)->mass();
96 double mC = p->getDaug(_d3)->mass();
97
98 double m2AB = ( p4_d1 + p4_d2 ).mass2();
99 double m2CA = ( p4_d1 + p4_d3 ).mass2();
100 double m2BC = ( p4_d2 + p4_d3 ).mass2();
101
102 EvtDalitzPoint point( mA, mB, mC, m2AB, m2BC, m2CA );
103
104 EvtComplex amp(0,0);
105 std::vector<std::pair<EvtComplex,EvtDalitzReso> >::iterator i = _resonances.begin();
106 for( ; i!= _resonances.end(); i++) {
107 std::pair<EvtComplex,EvtDalitzReso> res = (*i);
108 amp += res.first * res.second.evaluate( point );
109 }
110
111 vertex(amp);
112 return;
113}
114
115std::string EvtGenericDalitz::getParamName(int i) {
116 switch(i) {
117 case 0:
118 return "xmlFile";
119 default:
120 return "";
121 }
122}