Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaPhotoReaction.cxx
Go to the documentation of this file.
1//*-- Author: LEDEX collaboration June 2006
2
3// THaPhotoReaction
4//
5// This module calculates the energy of an incident REAL photon
6// in a deuteron photodisintegration reaction g(d,p)n from the detected
7// proton energy. It also calculates the CM scattering angle of the
8// detected proton (used for Wigner rotation calculations)
9//
10
11#include "THaPhotoReaction.h"
12#include "THaTrackingModule.h"
13#include "THaBeam.h"
14#include "VarDef.h"
15#include "TMath.h"
16
17using namespace std;
18
19//FIXME: Assume deuterium target for now
20static const Double_t target_mass = 1.87561;
21
22//_____________________________________________________________________________
23THaPhotoReaction::THaPhotoReaction( const char* name, const char* description,
24 const char* spectro )
25// Double target_mass )
26 : THaPhysicsModule(name,description),
27 fEGamma(kBig), fScatAngle(kBig), fScatAngleCM(kBig), fMA(target_mass),
28 fSpectroName(spectro), fSpectro(nullptr), fBeam(nullptr)
29{
30 // Standard constructor. Assume an ideal beam along z_lab.
31}
32
33//_____________________________________________________________________________
34THaPhotoReaction::THaPhotoReaction( const char* name, const char* description,
35 const char* spectro, const char* beam )
36// Double_t target_mass )
37 : THaPhysicsModule(name,description),
38 fEGamma(kBig), fScatAngle(kBig), fScatAngleCM(kBig), fMA(target_mass),
39 fSpectroName(spectro), fBeamName(beam), fSpectro(nullptr), fBeam(nullptr)
40{
41 // Constructor with specification of optional beam module.
42}
43
44
45//_____________________________________________________________________________
47{
48 // Destructor
49
51}
52
53//_____________________________________________________________________________
55{
56 // Clear physics variables in preparation for next event
57
60}
61
62//_____________________________________________________________________________
64{
65 // Define/delete global variables.
66
67 RVarDef vars[] = {
68 { "EGamma", "Real Brem. Photon Energy (GeV)", "fEGamma"},
69 { "angle", "Scattering Angle (rad)", "fScatAngle"},
70 { "angle_cm", "Scattering Angle(rad) in CM", "fScatAngleCM"},
71 { nullptr }
72 };
73 return DefineVarsFromList( vars, mode );
74}
75
76//_____________________________________________________________________________
78{
79 // Initialize the module. Do standard initialization, then
80 // locate the spectrometer apparatus named in fSpectroName and save
81 // pointer to it.
82
83 fSpectro = dynamic_cast<THaTrackingModule*>
84 ( FindModule( fSpectroName.Data(), "THaTrackingModule"));
85 if( !fSpectro )
86 return fStatus;
87
88 // Optional beam apparatus
89 if( fBeamName.Length() > 0 ) {
90 fBeam = dynamic_cast<THaBeamModule*>
91 ( FindModule( fBeamName.Data(), "THaBeamModule") );
92 if( !fBeam )
93 return fStatus;
94 }
95
96 // Standard initialization. Calls this object's DefineVariables().
97 THaPhysicsModule::Init( run_time );
98
99 return fStatus;
100}
101
102//_____________________________________________________________________________
104{
105 const Double_t Mn = 0.939565;
106 const Double_t Mp = 0.938272;
107
108 // This Procedure calculates the energy of the (REAL)
109 // photon from the detected proton momentum
110
111 if( !IsOK() || !gHaRun ) return -1;
112
113 // Get tracking info of detected proton
115 if( !trkifo || !trkifo->IsOK() ) return 1;
116
117 // Two relevant 4-vectors here:
118 // fP0 = incident photon
119 // fP1 = detected proton
120
121 // Direction of incident gamma assumed along the beam
122 TVector3 p0(0.,0.,1.);
123 if( fBeam )
124 p0 = (fBeam->GetBeamInfo()->GetPvect()).Unit();
125
126 fP1.SetVectM( trkifo->GetPvect(), Mp );
127
128 fScatAngle = p0.Angle( fP1.Vect() );
129
130 // Calculate E_gamma from energy conservation
131 Double_t E1 = fP1.E();
132 Double_t Ein2 = fMA*fMA+Mp*Mp-Mn*Mn-2*fMA*E1;
133 fEGamma = 0.5*Ein2/(E1-fMA-fP1.Z());
134
135 // FIXME: this is not correct if the beam is not along z_lab
136 // FIXME: use Boost() & Angle()
137 double betacm = fEGamma/(fEGamma+fMA);
138 double gammacm = 1./(sqrt(1-betacm*betacm));
139 double pzcm = fP1.Z()*gammacm-E1*betacm*gammacm;
140 fScatAngleCM = acos( pzcm/sqrt( pow(pzcm,2)+
141 pow(fP1.X(),2)+
142 pow(fP1.Y(),2)
143 )
144 );
145
146 fDataValid = true;
147
148 return 0;
149}
150
151//_____________________________________________________________________________
152// Int_t THaPhotoReaction::ReadRunDatabase( const TDatime& date )
153// {
154
155// Int_t err = THaPhysicsModule::ReadRunDatabase( date );
156// if( err ) return err;
157
158// if ( fMA > 0.0 )
159// return kOK;
160
161// FILE* f = OpenRunDBFile( date );
162// if( !f ) return kFileError;
163
164// if( fMA <= 0.0 ) {
165// TString name(fPrefix), tag("MA"); name += tag;
166// Int_t st = LoadDBvalue( f, date, name.Data(), fMA );
167// if( st )
168// LoadDBvalue( f, date, tag.Data(), fMA );
169// if( fMA <= 0.0 ) fMA = 0.938;
170// }
171
172// fclose(f);
173// return kOK;
174// }
175
176//_____________________________________________________________________________
177// void THaPhotoReaction::SetTargetMass( Double_t m )
178// {
179// if( !IsInit())
180// fMA = m;
181// else
182// PrintInitError("SetTargetMass()");
183// }
184
185//_____________________________________________________________________________
186void THaPhotoReaction::SetSpectrometer( const char* name )
187{
188 if( !IsInit())
190 else
191 PrintInitError("SetSpectrometer()");
192}
193
194//_____________________________________________________________________________
195void THaPhotoReaction::SetBeam( const char* name )
196{
197 if( !IsInit())
198 fBeamName = name;
199 else
200 PrintInitError("SetBeam()");
201}
202
204
int Int_t
const Data_t kBig
Definition DataType.h:15
double Double_t
const char Option_t
Option_t Option_t TPoint TPoint const char mode
char name[80]
R__EXTERN class THaRunBase * gHaRun
Definition THaGlobals.h:16
static const Double_t target_mass
static const Double_t Mp
static Int_t DefineVarsFromList(const void *list, EType type, EMode mode, const char *def_prefix, const TObject *obj, const char *prefix, const char *here, const char *comment_subst="")
THaAnalysisObject * FindModule(const char *name, const char *classname, bool do_error=true)
Bool_t IsOK() const
Bool_t IsInit() const
const TVector3 & GetPvect() const
Definition THaBeamInfo.h:56
THaBeamInfo * GetBeamInfo()
virtual Int_t Process(const THaEvData &)
TLorentzVector fP1
virtual Int_t DefineVariables(EMode mode=kDefine)
virtual void Clear(Option_t *opt="")
THaPhotoReaction(const char *name, const char *description, const char *spectro="")
THaBeamModule * fBeam
THaTrackingModule * fSpectro
void SetBeam(const char *name)
void SetSpectrometer(const char *name)
void PrintInitError(const char *here)
virtual void Clear(Option_t *opt="")
const TVector3 & GetPvect() const
Bool_t IsOK() const
THaTrackInfo * GetTrackInfo()
Double_t Y() const
TVector3 Vect() const
Double_t X() const
Double_t E() const
void SetVectM(const TVector3 &spatial, Double_t mass)
Double_t Z() const
Ssiz_t Length() const
const char * Data() const
Double_t Angle(const TVector3 &) const
SVector< T, D > Unit(const SVector< T, D > &rhs)
RVec< PromoteTypes< T0, T1 > > pow(const RVec< T0 > &v, const T1 &y)
RVec< PromoteType< T > > acos(const RVec< T > &v)
Expr< UnaryOp< Sqrt< T >, Expr< A, T, D, D2, R >, T >, T, D, D2, R > sqrt(const Expr< A, T, D, D2, R > &rhs)
STL namespace.
ClassImp(TPyArg)