Ejemplo n.º 1
0
	void Boost(Double_t CM[4],Double_t Sign,Double_t ZHad[4],
			Double_t XZMomentum[4],Int_t NumPart,TObjArray &InputCandList, 
			TObjArray &OutputCandList,Int_t Scheme)
	{
	// Boost method
	// Corresponds to old DKTFRAM subroutine 
	
	// Rotation matrix
	Double_t RMatrix[4][4],HelpMatrix[4][4];
	Double_t OldVector[4], NewVector[4];
	
	// Declare 4-vector for input and output of boost
	Double_t Cand4Vec[4], FinalCand4Vec[4];
	
	// Loop. vars
	Int_t iCol, jLin, iParticle;
	
	// Init matrix RMatrix with id.
	for (iCol = 0;iCol<4;iCol++)
	for (jLin = 0;jLin < 4;jLin++)
	{
		if (iCol != jLin)
		RMatrix[iCol][jLin] = 0;
		else RMatrix[iCol][jLin] = 1;
	}
	
	// Do a Lorentz boost to/from cm frame of XXXX
	Dijets::LorentzBoost(RMatrix,CM,0);
	
	//for (iCol = 0;iCol<4;iCol++)
	//for (jLin = 0;jLin < 4;jLin++)
	// {
	//cout << "rmatrix2 = " << iCol << ' ' << jLin << ' ' << RMatrix[iCol][jLin] << endl;
	// }
	
	// Find rotation to put boosted Z on the (sign) z axis
	if (Sign!=0.)
	{
	for (jLin = 0;jLin<4;jLin++)
		{
		OldVector[jLin] = 0.;
		for (iCol = 0;iCol < 4;iCol++)
		OldVector[jLin] += RMatrix[jLin][iCol]*ZHad[iCol]; 
		}
	
	//cout << "old1 = " 
	//  << OldVector[0] << ' ' 
	//  << OldVector[1] << ' ' 
	//  << OldVector[2] << ' ' 
	//  << OldVector[3] << ' ' 
	//  << endl;
	
	// Check if not 0 and fill in new vector
	if (OldVector[0]!=0. || OldVector[1]!=0. || OldVector[2]!=0.)
		{
		NewVector[0] = 0.;
		NewVector[1] = 0.;
		NewVector[2] = Sign;
		NewVector[3] = fabs(Sign);
		//cout << "new1 = " 
		//   << NewVector[0] << ' ' 
		//   << NewVector[1] << ' ' 
		//   << NewVector[2] << ' ' 
		//   << NewVector[3] << endl;
		Dijets::RRot(RMatrix,OldVector,NewVector);
	
		// Find rotation to put boosted Z and rotated XZMomentum into XZ-plane
		// fix here
		for (jLin = 0;jLin<4;jLin++)
		{
		OldVector[jLin] = 0.;
		for (iCol = 0;iCol < 4;iCol++)
			OldVector[jLin] += RMatrix[jLin][iCol]*XZMomentum[iCol]; 
		}
	
		/*
		for (jLin = 0;jLin<4;jLin++)
		{
		cout << " rmat = " 
		<< RMatrix[jLin][0] << ' '
		<< RMatrix[jLin][1] << ' '
		<< RMatrix[jLin][2] << ' '
		<< RMatrix[jLin][3] << endl;
		}
		cout << "xzmomentum = " 
		<<  XZMomentum[0] << ' '
		<<  XZMomentum[1] << ' '
		<<  XZMomentum[2] << ' '
		<<  XZMomentum[3] << endl;
		cout << "old2 = " 
		<< OldVector[0] << ' ' 
		<< OldVector[1] << ' ' 
		<< OldVector[2] << ' ' 
		<< OldVector[3] << ' ' 
		<< endl;
		*/
	
		// check if not negative
		if (OldVector[0]!=0. || OldVector[1]!=0.)
		{
		NewVector[0] = 1.;
		NewVector[1] = 0.;
		NewVector[2] = 0.;
		NewVector[3] = 1.;
		OldVector[2] = 0.;
		/*cout << "new2 = " 
			<< NewVector[0] << ' ' 
			<< NewVector[1] << ' ' 
			<< NewVector[2] << ' ' 
			<< NewVector[3] << ' ' 
			<< OldVector[0] << ' ' 
			<< OldVector[1] << ' ' 
			<< OldVector[2] << ' ' 
			<< OldVector[3] << ' ' 
			<< endl; */
		
		//---NOTE THAT A POTENTIALLY AWKWARD SPECIAL CASE IS AVERTED, BECAUSE IF
		//   OLD AND NEW ARE EXACTLY BACK-TO-BACK, THE ROTATION AXIS IS UNDEFINED
		//   BUT IN THAT CASE DKTRROT WILL USE THE Z AXIS, AS REQUIRED
		Dijets::RRot(RMatrix, OldVector, NewVector);
	
		}
		} 
	}
	
	// Invert the transformation if necessary
	if (Scheme==2)
	{
	Dijets::MatrixInv(RMatrix,HelpMatrix);
	for (iCol = 0;iCol<4;iCol++)
		for (jLin = 0;jLin < 4;jLin++)
		RMatrix[iCol][jLin] = HelpMatrix[iCol][jLin];
	}
	
	// Clear output list
	OutputCandList.Clear();
	
	// Apply the result for all vectors
	for (iParticle=0;iParticle<NumPart;iParticle++)
	{
	// get actual 4-vector candidate
	// For Energy --> mass assumption = 0 => massless
	TLorentzVector Candidate;
	if(InputCandList.At(iParticle)->InheritsFrom(TLorentzVector::Class()))
		{
		Candidate = *((TLorentzVector*)InputCandList.At(iParticle));
		}
	else
		{
		cout << "ERROR in Boost: InputCand of unknown type !" << endl; 
		}
	
	Cand4Vec[0] = Candidate.X();
	Cand4Vec[1] = Candidate.Y();
	Cand4Vec[2] = Candidate.Z();
	Cand4Vec[3] = Candidate.T();
	/*   if(m_Debug > 1) */
	/* 	cout << "Cand = "  */
	/* 	     << Cand4Vec[0] << ' ' << Cand4Vec[1] << ' ' */
	/* 	     << Cand4Vec[2] << ' ' << Cand4Vec[3] << endl; */
	
	// Boost Cand4Vec --> FinalCand4Vec
	for (jLin = 0;jLin < 4;jLin++)
		{
		FinalCand4Vec[jLin] = 0.;
		for (iCol = 0;iCol<4;iCol++)
		FinalCand4Vec[jLin] += RMatrix[jLin][iCol]*Cand4Vec[iCol]; 
		}
	
	//cout << "Final= " 
	//   << FinalCand4Vec[0] << ' '
	//   << FinalCand4Vec[1] << ' '
	//   << FinalCand4Vec[2] << ' '
	//   << FinalCand4Vec[3] 
	//   << endl;
	
	// Create particle with boosted 4-vector 
	TLorentzVector* Cand5 = new TLorentzVector( FinalCand4Vec[0],
							FinalCand4Vec[1],
							FinalCand4Vec[2],
							FinalCand4Vec[3]);
	OutputCandList.Add(Cand5);
// 	delete Cand5;
	// Fill in outputlist
	/* if(m_Debug > 1)  */
	/* 	{ */
	/* 	  cout << "-------- Output particle list (Boost) --------" << endl; */
	/* 	  cout << ((TLorentzVector*)Cand5)->Px() << ' ' */
	/* 	       << ((TLorentzVector*)Cand5)->Py() << ' ' */
	/* 	       << ((TLorentzVector*)Cand5)->Pz() << ' ' */
	/* 	       << ((TLorentzVector*)Cand5)->E()  */
	/* 	       << endl; */
	/* 	} */
	}  
	}