// ------------------------------------------------------------------------- // ----- CbmGeanePro source file ----- // ----- Created 08/12/06 by M. Al-Turany ----- // ------------------------------------------------------------------------- #include "CbmGeanePro.h" #include "TGeant3TGeo.h" #include "TVector3.h" #include "TArrayD.h" #include #include "TDatabasePDG.h" #include "CbmTrackParP.h" #include "CbmTrackParH.h" #include "TMatrixFSym.h" #include "CbmRunAna.h" #include "CbmField.h" using namespace std; // ----- Default constructor ------------------------------------------- CbmGeanePro::CbmGeanePro() : TNamed("Geane", "Propagate Tracks") { gMC3 = (TGeant3*) gMC; nepred=1; fdbPDG= TDatabasePDG::Instance(); fErrorMat= new TArrayD(15); afErtrio=gMC3->fErtrio; Pos=TVector3(0, 0 , 0); PosErr = TVector3(0,0,0); Mom=TVector3(0,0,0); fTrkPar= new CbmTrackPar(); ProMode=0; CbmRunAna *fRun= CbmRunAna::Instance(); fField= fRun->GetField(); } // ----- Destructor ---------------------------------------------------- CbmGeanePro::~CbmGeanePro() { } Bool_t CbmGeanePro::Propagate(CbmTrackParH *TParam, CbmTrackParH *TEnd, Int_t PDG) { // cout << "CbmGeanePro::Propagate(CbmTrackParH *TParam, CbmTrackParH &TEnd, Int_t PDG)" << endl; /**Propagate a helix track and return a helix*/ Bool_t NeedSDSC=kFALSE; Float_t ch; // CHARGE OF PARTICLE Double_t fCov[15], fCovOut[15]; TParam->GetCov(fCov); Init(TParam); Double_t Q = TParam->GetQ(); if (Q!=0)ch= Q/TMath::Abs(Q); if (ProMode==2){ //Propagate to Volume /** We have the right representation go further*/ for(Int_t i=0;i<15;i++) { ein[i]=fCov[i]; //cout << "ein " << ein[i] << endl; } Int_t option; if(VEnter)option =1; else option =2; gMC3->Eufilv(1, ein, (Char_t *)VName.Data(), &VCopyNo, &option); }else if(ProMode ==3){ cout << "Propagate Helix parameter to Plane is not implimented yet" << endl; return kFALSE; } /**Propagate */ Propagate(PDG); for(Int_t i=0;i<15;i++) { fCovOut[i]=afErtrio->errout[i]; } TEnd->SetTrackPar(x2[0], x2[1], x2[2],p2[0],p2[1],p2[2], ch ,fCovOut ); return kTRUE; } Bool_t CbmGeanePro::Propagate(CbmTrackParP *TStart, CbmTrackParH *TEnd, Int_t PDG) { cout << "CbmGeanePro::Propagate(CbmTrackParP *TParam, CbmTrackParH &TEnd, Int_t PDG)" << endl; } Bool_t CbmGeanePro::Propagate(CbmTrackParP *TStart, CbmTrackParP *TEnd, Int_t PDG) { // cout << "CbmGeanePro::Propagate(CbmTrackParP *TParam, CbmTrackParP &TEnd, Int_t PDG)" << endl; /**Propagate a parabola track and eturn a parabola */ Float_t ch; // CHARGE OF PARTICLE Double_t fCov[15], fCovOut[15]; TStart->GetCov(fCov); Init(TStart); Double_t Q = TStart->GetQ() ; if (Q!=0)ch= Q/TMath::Abs(Q); if (ProMode==2){ //Propagate to Volume cout << "Propagate Parabola parameter to Volume is not implimented yet" << endl; return kFALSE; }else if(ProMode ==3){ /** We have the right representation go further*/ for(Int_t i=0;i<15;i++) { ein[i]=fCov[i]; // cout << "ein " << ein[i] << endl; } gMC3->Eufilp(nepred, ein, pli, plo); } /**Propagate */ Propagate(PDG); for(Int_t i=0;i<15;i++) { fCovOut[i]=afErtrio->errout[i]; } TEnd->SetTrackPar(x2[0], x2[1], x2[2],p2[0],p2[1],p2[2], ch ,fCovOut ); return kTRUE; } Bool_t CbmGeanePro::Propagate(CbmTrackParH *TStart, CbmTrackParP *TEnd, Int_t PDG) { cout << "CbmGeanePro::Propagate(CbmTrackParH *TParam, CbmTrackParP &TEnd, Int_t PDG)" << endl; } void CbmGeanePro::Propagate(Int_t PDG) { GeantCode=fdbPDG->ConvertPdgToGeant3(PDG); cout << " x1 before " << x1[0] << " "<< x1[1]<< " " << x1[2] << endl; cout << " x2 before " << x2[0] << " "<< x2[1]<< " " << x2[2] << endl; cout << " p1 before " << p1[0] << " "<< p1[1]<< " " << p1[2] << endl; cout << " p2 before " << p2[0] << " "<< p2[1]<< " " << p2[2] << endl; /* for(Int_t i=0;i<15;i++) { afErtrio->ertrsp[i] =0; } */ gMC3->Ertrak(x1,p1,x2,p2,GeantCode, fPropOption.Data()); /* cout << " x1 " << x1[0] << " "<< x1[1]<< " " << x1[2] << endl; cout << " x2 " << x2[0] << " "<< x2[1]<< " " << x2[2] << endl; cout << " p1 " << p1[0] << " "<< p1[1]<< " " << p1[2] << endl; cout << " p2 " << p2[0] << " "<< p2[1]<< " " << p2[2] << endl; cout << "GeantCode " << GeantCode << " PDG " << PDG << " fPropOption " << fPropOption.Data() << endl; for(Int_t i=0;i<15;i++) { //fCovOut[i]=afErtrio->errout[i]; cout << "CbmGeanePro::Propagate " << "errout[" << i << "] = " << (Float_t) afErtrio->errout[i] << endl; } */ } void CbmGeanePro::Init(CbmTrackPar *TParam) { x1[0]=TParam->GetX(); x1[1]=TParam->GetY(); x1[2]=TParam->GetZ(); p1[0]=TParam->GetPx(); p1[1]=TParam->GetPy(); p1[2]=TParam->GetPz(); // cout << " Init(CbmTrackPar *TParam) p1 " << p1[0] << " "<< p1[1]<< " " << p1[2] << endl; x2[0]=0; x2[1]=0; x2[2]=0; p2[0]=0; p2[1]=0; p2[2]=0; } Bool_t CbmGeanePro::PropagateFromPlane(TVector3 &v1, TVector3 &v2) { TVector3 v1u=v1.Unit(); TVector3 v2u=v2.Unit(); pli[0]=v1u.X(); pli[1]=v1u.Y(); pli[2]=v1u.Z(); pli[3]=v2u.X(); pli[4]=v2u.Y(); pli[5]=v2u.Z(); return kTRUE; } Bool_t CbmGeanePro::PropagateToPlane(TVector3 &v0, TVector3 &v1, TVector3 &v2) { for(Int_t i=0;i<15;i++) ein[i]=0.00; TVector3 v1u=v1.Unit(); TVector3 v2u=v2.Unit(); plo[0]=v1u.X(); plo[1]=v1u.Y(); plo[2]=v1u.Z(); plo[3]=v2u.X(); plo[4]=v2u.Y(); plo[5]=v2u.Z(); plo[6]=v0.X(); plo[7]=v0.Y(); plo[8]=v0.Z(); TVector3 v3=v2u.Cross(v1u); plo[9]=v3(0); plo[10]=v3(1); plo[11]=v3(2); fPropOption="P"; ProMode=3; //need errors in representation 3 (SD)(see Geane doc) // gMC3->Eufilp(nepred, ein, pli, plo); return kTRUE; } Bool_t CbmGeanePro::PropagateToVolume(TString VolName, Int_t CopyNo , Int_t option) { for(Int_t i=0;i<15;i++) ein[i]=0.00; VName= VolName; VCopyNo= CopyNo; if(option==1)VEnter=kTRUE; else VEnter=kFALSE; fPropOption="V"; ProMode=2; //need errors in representation 1 (SC) (see Geane doc) return kTRUE; } Bool_t CbmGeanePro::PropagateToLength(Float_t length) { Float_t xlf[1]; xlf[0]=length; fPropOption="L"; ProMode=1; //need errors in representation 1 (SC)(see Geane doc) gMC3->Eufill(nepred, ein,xlf); return kTRUE; } ClassImp(CbmGeanePro)