Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcReactionPoint.cxx
Go to the documentation of this file.
1
10#include "THcReactionPoint.h"
11#include "THaSpectrometer.h"
12#include "THaTrack.h"
13#include "THaBeam.h"
14#include "TMath.h"
15#include <cstring>
16#include <cstdio>
17#include <cstdlib>
18#include <iostream>
19#include <fstream>
20
21
22using namespace std;
23
25
26//_____________________________________________________________________________
27THcReactionPoint::THcReactionPoint( const char* name, const char* description,
28 const char* spectro, const char* beam ) :
29THaReactionPoint(name, description, spectro, beam)
30{
31 // Normal constructor.
32
33}
34
35//_____________________________________________________________________________
37{
38 // Destructor
39
41}
42
43//_____________________________________________________________________________
45{
46 // Calculate the vertex coordinates.
47
48 if( !IsOK() ) return -1;
49
50 Int_t ntracks = fSpectro->GetNTracks();
51 if( ntracks == 0 ) return 0;
52
54 if( !tracks ) return -2;
55
56 TVector3 beam_org, beam_ray( 0.0, 0.0, 1.0 );
57 if( fBeam ) {
58 beam_org = fBeam->GetPosition();
59 beam_ray = fBeam->GetDirection();
60 }
61 TVector3 v;
62
63 for( Int_t i = 0; i<ntracks; i++ ) {
64 THaTrack* theTrack = static_cast<THaTrack*>( tracks->At(i) );
65 // Ignore junk tracks
66 if( !theTrack || !theTrack->HasTarget() )
67 continue;
68 TVector3 pointing_off=fSpectro->GetPointingOffset();
71 Double_t ytar_off=theTrack->GetTY()+pointing_off(1);
72 Double_t yptar = theTrack->GetTPhi();
73 Double_t ztarg=(ytar_off-beam_org(0)*(costheta-yptar*sintheta))/(-sintheta-yptar*costheta);
74 v.SetXYZ(beam_org(0),beam_org(1),ztarg);
75 theTrack->SetVertex(v);
76 if( theTrack == fSpectro->GetGoldenTrack() ) {
77 fVertex = theTrack->GetVertex();
79 }
80 }
81 return 0;
82}
83
int Int_t
double Double_t
const Bool_t kTRUE
ClassImp(VDC::AnalyticTTDConv) using namespace std
Bool_t IsOK() const
virtual const TVector3 & GetDirection() const
virtual const TVector3 & GetPosition() const
THaSpectrometer * fSpectro
virtual Int_t DefineVariables(EMode mode=kDefine)
THaTrack * GetGoldenTrack() const
Int_t GetNTracks() const
TClonesArray * GetTracks() const
const TVector3 & GetPointingOffset() const
Double_t GetThetaSph() const
Double_t GetPhiSph() const
TVector3 & GetVertex()
Double_t GetTY() const
Double_t GetTPhi() const
void SetVertex(const TVector3 &vert)
bool HasTarget() const
TVector3 fVertex
Calculate vertex coordinates.
virtual Int_t Process(const THaEvData &)
THcReactionPoint(const char *name, const char *description, const char *spectro="", const char *beam="")
Double_t Cos(Double_t)
Double_t Sin(Double_t)
STL namespace.
v
void tracks()