Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SQBeamlineObject.C
Go to the documentation of this file.
1 /*======================================================================================================
2 Author: Abinash Pun, Kun Liu
3 Sep, 2019
4 Goal: Beamline volumes work to import the primary vertex generator of E906 experiment(DPVertexGenerator)
5 from Kun to E1039 experiment in Fun4All framework
6 =======================================================================================================*/
7 
8 #include "SQBeamlineObject.h"
9 #include "TGeoPhysicalConstants.h"
10 #include <TMath.h>
11 #include <TRandom3.h>
12 #include <phool/PHRandomSeed.h>
13 
15 
16 SQBeamlineObject::SQBeamlineObject(const TGeoMaterial* pMaterial)
17 {
18  //std::cout << " beamline material: "<< pMaterial->GetName() << std::endl;
19  nucIntLen = pMaterial->GetIntLen();
20  density = pMaterial->GetDensity();
21 
22 
23  TGeoMixture* pMaterialmix;
24  pMaterialmix = (TGeoMixture*)pMaterial;
25  //pMaterial->Print("");
26  //pMaterialmix->Print(" ");
27 
28  Z=pMaterial->GetZ();
29  A=pMaterial->GetA();
30  N=A-Z;
31 }
32 
34 {
35  return z0 < obj.z0;
36 }
37 
38 std::ostream& operator << (std::ostream& os, const SQBeamlineObject& obj)
39 {
40 
41  os << "Beamline object name " << obj.name << " at " << obj.z_up << " <-- " << obj.z0 << " --> " << obj.z_down << "\n"
42  << " Z = " << obj.Z << ", A = " << obj.A << ", N = " << obj.N << "\n"
43  << " Nuclear inc. len. = " << obj.nucIntLen << ", density = " << obj.density << "\n"
44  << " " << obj.length/obj.nucIntLen*100. << "% interaction length, " << " upstream attenuation = " << 1. - obj.attenuation/obj.attenuationSelf << "\n"
45  << " Attenuation by itself = " << obj.attenuationSelf << ", " << " real attenuation = " << obj.attenuation << "\n"
46  << " Collision prob = " << obj.prob << ", accumulated prob = " << obj.accumulatedProb;
47  return os;
48 
49 }
50 
52 {
53 
54  double returnZ = 0.;
55  unsigned int iseed = PHRandomSeed();
56  gRandom->SetSeed(iseed);
57  returnZ = z_up - nucIntLen*TMath::Log(1. - attenuationSelf*gRandom->Uniform(0,1)); //Todo Fix this place holders
58 
59  return returnZ;
60 }
61 
62 bool SQBeamlineObject::inAcceptance(double x, double y)
63 {
64  return true;
65  //return x*x/1.9/1.9 + y*y/2.1/2.1 < 1.;
66 }
double prob
beam attenuation factor by this object
double nucIntLen
radiusY
double Z
density in g/cm3
double getZ()
get the expotential z distribution
double accumulatedProb
probability of having collision
double attenuationSelf
number of protons, nucleons, neutrons
bool inAcceptance(double x, double y)
check if the beam is in acceptance
double length
the z position of upstram/downstream face and center
double density
nuclear interaction length in cm
std::basic_ostream< E, T > & operator<<(std::basic_ostream< E, T > &os, shared_ptr< Y > const &p)
Definition: shared_ptr.hpp:573
double attenuation
beam attenuation percentage by itself
bool operator<(const SQBeamlineObject &obj) const