35 CombinedCBInvJigsaw::CombinedCBInvJigsaw(
const std::string& sname,
36 const std::string& stitle,
38 : InvisibleJigsaw(sname, stitle, 2*N_CBjigsaw, 2*N_CBjigsaw),
41 m_InvMassDependancy =
true;
44 CombinedCBInvJigsaw::~CombinedCBInvJigsaw() {}
46 void CombinedCBInvJigsaw::AddJigsaw(
const ContraBoostInvJigsaw& jigsaw,
int ijigsaw){
48 if(ijigsaw < 0 || ijigsaw >= m_NCB)
return;
50 AddInvisibleFrames(jigsaw.GetChildFrames(0), 2*ijigsaw+0);
51 AddInvisibleFrames(jigsaw.GetChildFrames(1), 2*ijigsaw+1);
52 AddVisibleFrames(jigsaw.GetDependancyFrames(0), 2*ijigsaw+0);
53 AddVisibleFrames(jigsaw.GetDependancyFrames(1), 2*ijigsaw+1);
56 double CombinedCBInvJigsaw::GetMinimumMass()
const {
57 if(m_NCB < 1)
return 0.;
58 if(m_NCB == 1)
return GetCBMinimumMass(0);
62 std::vector<double> Minv2;
63 for(
int i = 0; i < m_NCB; i++){
64 Minv2.push_back(GetCBMinimumMass(i));
69 std::vector<TLorentzVector> Pvis;
70 std::vector<double> Mvis2;
71 for(
int i = 0; i < m_NCB; i++){
72 Pvis.push_back(GetDependancyStates(2*i+0).GetFourVector()+
73 GetDependancyStates(2*i+1).GetFourVector());
74 Mvis2.push_back(Pvis[i].M2());
77 for(
int i = 0; i < m_NCB-1; i++){
78 for(
int j = i+1; j < m_NCB; j++){
79 if(Minv2[i] > Mvis2[i] || Minv2[j] > Mvis2[j]){
80 Mmin2 += std::max(0.,(Pvis[i]+Pvis[j]).M2()-Mvis2[i]-Mvis2[j])*
81 std::max(((Minv2[i] > 0. && Mvis2[i] <= 0.) ? 1. : Minv2[i]/Mvis2[i]),
82 ((Minv2[j] > 0. && Mvis2[j] <= 0.) ? 1. : Minv2[j]/Mvis2[j]));
85 Mmin2 += std::max(0.,(Pvis[i]+Pvis[j]).M2()-Mvis2[i]-Mvis2[j]);
86 Mmin2 += std::max(Minv2[i] - Mvis2[i], Minv2[j] - Mvis2[j])*2.;
91 return sqrt(std::max(0., Mmin2));
94 double CombinedCBInvJigsaw::GetCBMinimumMass(
int i)
const {
98 double Minv1 = GetChildState(2*i+0).GetMinimumMass();
99 double Minv2 = GetChildState(2*i+1).GetMinimumMass();
100 TLorentzVector Pvis1 = GetDependancyStates(2*i+0).GetFourVector();
101 TLorentzVector Pvis2 = GetDependancyStates(2*i+1).GetFourVector();
102 double Mvis1 = std::max(Pvis1.M(), 0.);
103 double Mvis2 = std::max(Pvis2.M(), 0.);
104 double M12 = (Pvis1+Pvis2).M();
106 if(Minv1 < -0.5 && Minv2 < -0.5)
107 return 2.*GetP(M12,Mvis1,Mvis2);
109 Minv1 = std::max(Minv1,0.);
110 Minv2 = std::max(Minv2,0.);
112 double Minvmax = std::max(0.,std::max(Minv1,Minv2));
114 double Mvismin = std::min(Mvis1,Mvis2);
115 double Mvismax = std::max(Mvis1,Mvis2);
117 if(Minv1 < Mvis2 && Minv2 < Mvis1){
118 if(Minvmax <= Mvismin)
119 return sqrt( M12*M12 + 4.*(Minvmax-Mvismin)*(Minvmax+Mvismax) );
123 if(Mvismin <= 0.0 && Minvmax > 0.)
126 return M12*(1.+sqrt(std::max(Minv1*Minv1-Mvis2*Mvis2,
127 Minv2*Minv2-Mvis1*Mvis1))/Mvismin);
130 bool CombinedCBInvJigsaw::AnalyzeEvent(){
132 return SetSpirit(
false);
135 return SetSpirit(
false);
137 TLorentzVector INV = GetParentState().GetFourVector();
138 TLorentzVector VIS(0.,0.,0.,0.);
140 std::vector<TLorentzVector> Pvis[2];
141 for(
int i = 0; i < m_NCB; i++){
142 Pvis[0].push_back( GetDependancyStates(2*i+0).GetFourVector() );
143 Pvis[1].push_back( GetDependancyStates(2*i+1).GetFourVector() );
144 VIS += Pvis[0][i]+Pvis[1][i];
148 TVector3 Boost = (VIS+INV).BoostVector();
149 for(
int i = 0; i < m_NCB; i++){
150 Pvis[0][i].Boost(-Boost);
151 Pvis[1][i].Boost(-Boost);
154 std::vector<double> c[2];
155 std::vector<double> E[2];
156 std::vector<double> mvis[2];
157 std::vector<double> minv[2];
158 std::vector<double> Minv2;
159 double mvismin, minvmax;
160 double m1, m2, k1, k2;
162 double N, sumE, sumcE;
163 for(
int i = 0; i < m_NCB; i++){
164 E[0].push_back(Pvis[0][i].E());
165 E[1].push_back(Pvis[1][i].E());
166 mvis[0].push_back(std::max(0.,Pvis[0][i].M()));
167 mvis[1].push_back(std::max(0.,Pvis[1][i].M()));
168 minv[0].push_back( GetChildState(2*i+0).GetMinimumMass() );
169 minv[1].push_back( GetChildState(2*i+1).GetMinimumMass() );
170 Minv2.push_back( GetCBMinimumMass(i) );
171 Minv2[i] *= Minv2[i];
173 minvmax = std::max(0.,std::max(minv[0][i],minv[1][i]));
174 mvismin = std::min(mvis[0][i],mvis[1][i]);
178 if(minvmax < mvismin){
181 MC2 = 2.*(E[0][i]*E[1][i] + Pvis[0][i].Vect().Dot(Pvis[1][i].Vect()));
182 k1 = (m1+m2)*(m1-m2)*(1.-minvmax/mvismin) + MC2-2*m1*m2 +
183 (m1+m2)*fabs(m1-m2)*minvmax/mvismin;
184 k2 = -(m1+m2)*(m1-m2)*(1.-minvmax/mvismin) + MC2-2*m1*m2 +
185 (m1+m2)*fabs(m1-m2)*minvmax/mvismin;
186 Xbar = sqrt( (k1+k2)*(k1+k2)*(MC2*MC2-4*m1*m1*m2*m2) +
187 16.*minvmax*minvmax*(k1*k1*m1*m1 + k2*k2*m2*m2 + k1*k2*MC2) );
188 K = ( fabs(k1*m1*m1-k2*m2*m2) - 0.5*fabs(k2-k1)*MC2 + 0.5*Xbar )/
189 (k1*k1*m1*m1 + k2*k2*m2*m2 + k1*k2*MC2);
190 c[0][i] = 0.5*(1.+K*k1);
191 c[1][i] = 0.5*(1.+K*k2);
194 sumE = E[0][i] + E[1][i];
195 sumcE = c[0][i]*E[0][i] + c[1][i]*E[1][i];
197 N = (sqrt(sumE*sumE+Minv2[i]-(Pvis[0][i]+Pvis[1][i]).M2())+sumE)/sumcE/2.;
206 for(
int i = 0; i < m_NCB; i++){
207 sumE += E[0][i] + E[1][i];
208 sumcE += c[0][i]*E[0][i] + c[1][i]*E[1][i];
211 N = (sqrt(sumE*sumE + INV.M2() - VIS.M2())+sumE)/sumcE/2.;
214 TLorentzVector INV1, INV2;
216 TVector3 Pinv1, Pinv2;
217 for(
int i = 0; i < m_NCB; i++){
221 Einv1 = (c[0][i]-1.)*E[0][i] + c[1][i]*E[1][i];
222 Einv2 = (c[1][i]-1.)*E[1][i] + c[0][i]*E[0][i];
223 Pinv1 = (c[0][i]-1.)*Pvis[0][i].Vect() - c[1][i]*Pvis[1][i].Vect();
224 Pinv2 = (c[1][i]-1.)*Pvis[1][i].Vect() - c[0][i]*Pvis[0][i].Vect();
226 INV1.SetPxPyPzE(Pinv1.X(),Pinv1.Y(),Pinv1.Z(),Einv1);
227 INV2.SetPxPyPzE(Pinv2.X(),Pinv2.Y(),Pinv2.Z(),Einv2);
229 if(minv[0][i] >= 0. && INV1.M() < minv[0][i])
230 INV1.SetVectM(Pinv1, minv[0][i]);
231 if(minv[1][i] >= 0. && INV2.M() < minv[1][i])
232 INV2.SetVectM(Pinv2, minv[1][i]);
237 GetChildState(2*i+0).SetFourVector(INV1);
238 GetChildState(2*i+1).SetFourVector(INV2);
241 return SetSpirit(
true);