89 std::vector<unsigned int> toRemove;
90 unsigned int n =
m_plist->getListSize();
92 for (
unsigned i = 0; i < n; i++) {
95 std::vector<Particle*> daughtervec = particle->getDaughters();
96 std::vector<const Particle*> selParticles =
m_decaydescriptor.getSelectionParticles(particle);
97 if (selParticles.size() > 1) {
98 B2FATAL(
"Please select only one daughter which will be used as reference to create Btube");
102 if ((daughtervec.at(0))->getArrayIndex() == (selParticles.at(0))->getArrayIndex()) selectindex = 0 ;
104 Particle* tubecreatorB =
const_cast<Particle*
>(particle->getDaughter(selectindex));
105 Particle* otherB =
const_cast<Particle*
>(particle->getDaughter(1 - selectindex));
108 B2FATAL(
"Please perform a vertex fit of the selected B before calling this module");
116 B2DEBUG(10,
"tubecreator B decay vertex: ");
117 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << tubecreatorBCopy->
getVertex().X() <<
"," << std::fixed <<
119 20) << tubecreatorBCopy->
getVertex().Y() <<
"," << std::fixed << std::setprecision(20) << tubecreatorBCopy->
getVertex().Z() <<
"}");
126 toRemove.push_back(particle->getArrayIndex());
128 particle->setVertex(tubecreatorBCopy->
getVertex());
149 Eigen::Matrix<double, 3, 1> tubecreatorBOriginpos(tubecreatorBCopy->
getVertex().X(), tubecreatorBCopy->
getVertex().Y(),
151 ROOT::Math::PxPyPzEVector v4Final = tubecreatorBCopy->
get4Vector();
153 ROOT::Math::PxPyPzEVector vec = T.rotateLabToCms() * v4Final;
154 ROOT::Math::PxPyPzEVector vecNew(-1 * vec.Px(), -1 * vec.Py(), -1 * vec.Pz(), vec.E());
155 ROOT::Math::PxPyPzEVector v4FinalNew = T.rotateCmsToLab() * vecNew;
158 B2DEBUG(10,
"beamspot center :");
159 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) <<
m_BeamSpotCenter.X() <<
"," << std::fixed << std::setprecision(
161 B2DEBUG(10,
"beamspot cov :");
163 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) <<
m_beamSpotCov(0,
164 0) <<
"," << std::fixed << std::setprecision(20) <<
m_beamSpotCov(0,
165 1) <<
"," << std::fixed << std::setprecision(20) <<
m_beamSpotCov(0, 2) <<
"},");
166 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) <<
m_beamSpotCov(1,
167 0) <<
"," << std::fixed << std::setprecision(20) <<
m_beamSpotCov(1,
168 1) <<
"," << std::fixed << std::setprecision(20) <<
m_beamSpotCov(1, 2) <<
"},");
169 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) <<
m_beamSpotCov(2,
170 0) <<
"," << std::fixed << std::setprecision(20) <<
m_beamSpotCov(2,
171 1) <<
"," << std::fixed << std::setprecision(20) <<
m_beamSpotCov(2, 2) <<
"}");
179 double theta = v4FinalNew.Theta();
180 double phi = v4FinalNew.Phi();
182 double st = TMath::Sin(theta);
183 double ct = TMath::Cos(theta);
184 double sp = TMath::Sin(phi);
185 double cp = TMath::Cos(phi);
187 TMatrix r2z(3, 3); r2z(2, 2) = 1;
188 r2z(0, 0) = cp; r2z(0, 1) = -1 * sp;
189 r2z(1, 0) = sp; r2z(1, 1) = cp;
191 TMatrix r2y(3, 3); r2y(1, 1) = 1;
192 r2y(0, 0) = ct; r2y(0, 2) = st;
193 r2y(2, 0) = -1 * st; r2y(2, 2) = ct;
195 TMatrix r2(3, 3); r2.Mult(r2z, r2y);
196 TMatrix r2t(3, 3); r2t.Transpose(r2);
198 TMatrix longerror(3, 3); longerror(2, 2) = 1000;
199 TMatrix longerror_temp(3, 3); longerror_temp.Mult(r2, longerror);
200 TMatrix longerrorRotated(3, 3); longerrorRotated.Mult(longerror_temp, r2t);
204 pvNew += longerrorRotated;
206 TMatrixFSym errNew(7);
207 errNew.SetSub(0, 0, pp);
208 errNew.SetSub(4, 4, pvNew);
211 TMatrixFSym tubeMat(3);
212 tubeMat.SetSub(0, 0, pvNew);
214 TMatrixFSym tubeMatCenterError(3);
215 tubeMatCenterError.SetSub(0, 0, pv);
218 B2DEBUG(10,
"B origin error matrix : ");
219 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << pv(0, 0) <<
"," << std::fixed << std::setprecision(20) << pv(0,
220 1) <<
"," << std::fixed << std::setprecision(20) << pv(0, 2) <<
"},");
221 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << pv(1, 0) <<
"," << std::fixed << std::setprecision(20) << pv(1,
222 1) <<
"," << std::fixed << std::setprecision(20) << pv(1, 2) <<
"},");
223 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << pv(2, 0) <<
"," << std::fixed << std::setprecision(20) << pv(2,
224 1) <<
"," << std::fixed << std::setprecision(20) << pv(2, 2) <<
"}");
226 B2DEBUG(10,
"B tube error matrix : ");
227 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << pvNew(0, 0) <<
"," << std::fixed << std::setprecision(20) << pvNew(0,
228 1) <<
"," << std::fixed << std::setprecision(20) << pvNew(0, 2) <<
"},");
229 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << pvNew(1, 0) <<
"," << std::fixed << std::setprecision(20) << pvNew(1,
230 1) <<
"," << std::fixed << std::setprecision(20) << pvNew(1, 2) <<
"},");
231 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << pvNew(2, 0) <<
"," << std::fixed << std::setprecision(20) << pvNew(2,
232 1) <<
"," << std::fixed << std::setprecision(20) << pvNew(2, 2) <<
"}");
234 B2DEBUG(10,
"B origin ");
235 B2DEBUG(10,
"{" << std::fixed << std::setprecision(20) << tubecreatorBCopy->
getVertex().X() <<
"," << std::fixed <<
237 20) << tubecreatorBCopy->
getVertex().Y() <<
"," << std::fixed << std::setprecision(20) << tubecreatorBCopy->
getVertex().Z() <<
"}");
254 addextrainfos(tubecreatorB, tubecreatorBCopy, pvNew, v4FinalNew);
260 if (!ok0) toRemove.push_back(particle->getArrayIndex());
262 m_plist->removeParticles(toRemove);
285 daughter->writeExtraInfo(
"TubePosX", copy->getVertex().X());
286 daughter->writeExtraInfo(
"TubePosY", copy->getVertex().Y());
287 daughter->writeExtraInfo(
"TubePosZ", copy->getVertex().Z());
289 daughter->writeExtraInfo(
"TubeCov00", mat(0, 0));
290 daughter->writeExtraInfo(
"TubeCov01", mat(0, 1));
291 daughter->writeExtraInfo(
"TubeCov02", mat(0, 2));
292 daughter->writeExtraInfo(
"TubeCov10", mat(1, 0));
293 daughter->writeExtraInfo(
"TubeCov11", mat(1, 1));
294 daughter->writeExtraInfo(
"TubeCov12", mat(1, 2));
295 daughter->writeExtraInfo(
"TubeCov20", mat(2, 0));
296 daughter->writeExtraInfo(
"TubeCov21", mat(2, 1));
297 daughter->writeExtraInfo(
"TubeCov22", mat(2, 2));
299 daughter->writeExtraInfo(
"TubeDirX", (TLV.Px() / TLV.P()));
300 daughter->writeExtraInfo(
"TubeDirY", (TLV.Py() / TLV.P()));
301 daughter->writeExtraInfo(
"TubeDirZ", (TLV.Pz() / TLV.P()));
302 daughter->writeExtraInfo(
"TubeB_p_estimated", TLV.P());
TMatrixFSym getVertexErrorMatrix() const
Returns the 3x3 position error sub-matrix.
void writeExtraInfo(const std::string &name, const double value)
Sets the user defined extraInfo.
double getPValue() const
Returns chi^2 probability of fit if done or -1.
ROOT::Math::XYZVector getVertex() const
Returns vertex position (POCA for charged, IP for neutral FS particles)
TMatrixFSym getMomentumErrorMatrix() const
Returns the 4x4 momentum error matrix.
void setPValue(double pValue)
Sets chi^2 probability of fit.
Particle * copyParticle(const Particle *original)
Function takes argument Particle and creates a copy of it and copies of all its (grand-)^n-daughters.