#pragma implementation
#include "hevent.h"
#include "heventheader.h"
#include "hdetector.h"
#include "hratreeext.h"
#include "hcategory.h"
#include "hmatrixcategory.h"
#include "hlinearcategory.h"
#include "hlinearcatiter.h"
#include "hlocation.h"
#include "hiterator.h"
#include "hdebug.h"
#include "hades.h"
#include <hpidtrackcand.h>
#include <hpidphysicsconstants.h>
#include "hypinfodef.h"
#include "hhypkine.h"
#include "hhypcomb.h"
#include <iostream>
using namespace std;
ClassImp(HHypKine)
HHypKine::HHypKine(Int_t Ncomb, Int_t Npart)
{
clear();
ncomb = Ncomb;
npart = Npart;
prepareHypKine();
}
HHypKine::HHypKine(HHypKine *src)
{
clear();
ncomb = src->getNcomb();
npart = src->getNpart();
pid=src->getArrayPid();
px=src->getArrayPx();
py=src->getArrayPy();
pz=src->getArrayPz();
}
HHypKine::HHypKine(Int_t Idx_HypComb)
{
HHypComb *p_hypcomb = NULL;
HPidTrackCand *pTrackCand = NULL;
HCategory *combCat = gHades->getCurrentEvent()->getCategory(catHypComb);
HCategory *pidpartCat = gHades->getCurrentEvent()->getCategory(catPidTrackCand);
if ((combCat != 0) && (pidpartCat != NULL)) {
p_hypcomb = (HHypComb *) combCat->getObject(Idx_HypComb);
if (p_hypcomb != NULL) {
setNcomb(p_hypcomb->getNcomb());
setNpart(p_hypcomb->getNpart());
prepareHypKine();
for (Int_t icomb = 0; icomb < (p_hypcomb->getNcomb()); icomb++) {
for (Int_t ipart = 0; ipart < (p_hypcomb->getNpart()); ipart++) {
Int_t idx;
idx=p_hypcomb->getIdxPidTrackCand(icomb, ipart);
if( idx>=0){
pTrackCand =
(HPidTrackCand *) pidpartCat->getObject(idx);
if (pTrackCand != NULL) {
setPid(icomb, ipart, p_hypcomb->getPid(icomb, ipart));
TVector3 Vect3;
Vect3.SetMagThetaPhi(
pTrackCand->getTrackData()->getMomenta(ALG_RUNGEKUTTA),
pTrackCand->getTrackData()->getRKTheta()*TMath::DegToRad(),
pTrackCand->getTrackData()->getRKPhi()*TMath::DegToRad()
);
setMomentum(icomb, ipart, Vect3);
}
else {
cout << "ERROR: HHypKine::HHypKine (pTrackCand is NULL) \n";
}
}else{
}
}
}
} else {
cout << "\n Error : HHypKine::HHypKine ( p_hypcomb set to NULL ) \n";
}
}
}
Bool_t HHypKine::clear()
{
ncomb = 0;
npart = 0;
return kTRUE;
}
void HHypKine::Clear(Option_t *opt)
{
px.Set(0);
py.Set(0);
pz.Set(0);
pid.Set(0);
}
Bool_t HHypKine::setNcomb(Int_t Ncomb)
{
ncomb = Ncomb;
return kTRUE;
}
Int_t HHypKine::getNcomb()
{
return ncomb;
}
Bool_t HHypKine::setNpart(Int_t Npart)
{
npart = Npart;
return kTRUE;
}
Int_t HHypKine::getNpart()
{
return npart;
}
Bool_t HHypKine::prepareHypKine()
{
if ((ncomb > 0) && (npart > 0)) {
pid.Set(ncomb * npart);
px.Set(ncomb * npart);
py.Set(ncomb * npart);
pz.Set(ncomb * npart);
return kTRUE;
} else {
cout << "\tError: ncomb || npart are <=0 !!!\n";
return kFALSE;
}
}
Bool_t HHypKine::setTLorentzVector(Int_t Icomb, Int_t Ipart,
TLorentzVector Vect)
{
if ((Icomb < getNcomb()) && (Ipart < getNpart())) {
px[Icomb * npart + Ipart] = Vect.Px();
py[Icomb * npart + Ipart] = Vect.Py();
pz[Icomb * npart + Ipart] = Vect.Pz();
return kTRUE;
} else {
cout <<
"\n Error : HHypKine::setTLorentzVector ( Icomb or Ipart out of range )\n";
return kFALSE;
}
}
Bool_t HHypKine::setMomentum(Int_t Icomb, Int_t Ipart, TVector3 vect)
{
if ((Icomb < getNcomb()) && (Ipart < getNpart())) {
px[Icomb * npart + Ipart] = vect.Px();
py[Icomb * npart + Ipart] = vect.Py();
pz[Icomb * npart + Ipart] = vect.Pz();
return kTRUE;
} else {
cout <<
"\n Error : HHypKine::setMomentum ( Icomb or Ipart out of range )\n";
return kFALSE;
}
}
TLorentzVector HHypKine::getTLorentzVector(Int_t Icomb, Int_t Ipart)
{
TLorentzVector Vect;
if ((Icomb < getNcomb()) && (Ipart < getNpart())) {
Double_t Mass = HPidPhysicsConstants::mass(getPid(Icomb, Ipart));
TVector3 Vect3;
Vect3.SetXYZ(px[Icomb * npart + Ipart], py[Icomb * npart + Ipart],
pz[Icomb * npart + Ipart]);
Vect.SetVectM(Vect3, Mass);
} else {
cout <<
"\n Error : HHypKine::getTLorentzVector ( Icomb or Ipart out of range )\n";
}
return Vect;
}
TVector3 HHypKine::getMomentum(Int_t Icomb, Int_t Ipart)
{
TVector3 Vect3;
if ((Icomb < getNcomb()) && (Ipart < getNpart())) {
Vect3.SetXYZ(px[Icomb * npart + Ipart], py[Icomb * npart + Ipart],
pz[Icomb * npart + Ipart]);
} else {
cout <<
"\n Error : HHypKine::getMomentum ( Icomb or Ipart out of range )\n";
}
return Vect3;
}
Bool_t HHypKine::setPid(Int_t Icomb, Int_t Ipart, Int_t Pid)
{
if ((Icomb < getNcomb()) && (Ipart < getNpart())) {
pid[Icomb * npart + Ipart] = Pid;
return kTRUE;
} else {
cout << "\n Error : HHypKine::setPid ( Icomb or Ipart out of range )\n";
return kFALSE;
}
}
Int_t HHypKine::getPid(Int_t Icomb, Int_t Ipart)
{
if ((Icomb < getNcomb()) && (Ipart < getNpart())) {
return pid[Icomb * npart + Ipart];
} else {
cout << "\n Error : HHypKine::getPid ( Icomb or Ipart out of range )\n";
return -1;
}
}
Bool_t HHypKine::print()
{
return kTRUE;
}
HCategory *HHypKine::buildLinearCat(const Text_t * classname)
{
HLinearCategory *category = NULL;
Int_t size = 1000;
category = new HLinearCategory(classname, size);
category->setDynamicObjects(kTRUE);
return category;
}
void HHypKine::Streamer(TBuffer & R__b)
{
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion();
if (R__v != 1) {
cout << "HHypKine::Streamer: version is not 1" << endl;
}
TObject::Streamer(R__b);
R__b >> ncomb;
R__b >> npart;
pid.Set(ncomb*npart);
px.Set(ncomb*npart);
py.Set(ncomb*npart);
pz.Set(ncomb*npart);
for (Int_t i = 0; i < pid.GetSize(); i++) {
R__b >> pid[i];
R__b >> px[i];
R__b >> py[i];
R__b >> pz[i];
}
} else {
R__b.WriteVersion(HHypKine::IsA());
TObject::Streamer(R__b);
R__b << ncomb;
R__b << npart;
for (Int_t i = 0; i < pid.GetSize(); i++) {
R__b << pid[i];
R__b << px[i];
R__b << py[i];
R__b << pz[i];
}
}
}
Last change: Sat May 22 12:57:45 2010
Last generated: 2010-05-22 12:57
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.