TargetCount.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "TGeoManager.h"
4 #include "TVector3.h"
5 #include "TH1D.h"
6 
7 namespace ana
8 {
9  /// Count number of targets within the main part of the ND (vSuperBlockND)
11  {
12  public:
13  /// \param Z Count instances of this element. -1 = all elements
14  TargetCount(int Z = -1);
15 
16  /// Count the number of nuclear targets of atomic number Z, and
17  /// inside the fiducial bounds specified by min and max
18  /// The method works by random-polling and is based on
19  /// calculateMassesLong function in Geometry service
20  /// \param Z Count instances of this element. -1 = all elements
21  /// \param npoints is the number of samples in the random poll
22  /// This value should be 1e6 or more.
23  TargetCount(const TVector3& min,
24  const TVector3& max,
25  const int npoints,
26  int Z = -1);
27 
28  /// Mass in kg
29  double Mass() const {return fMass;}
30  /// Number of nucleons (mass * avogadro's number)
31  double NNucleons() const {return fNNucleons;}
32  /// Number of nuclei, optionally restricted to a particular element or isotope
33  double NNuclei(int Z=-1, int A=-1) const;
34  /// Fractional error on mass or number of nucleons
35  double ErrorFraction() const {return fErrorFrac;}
36  /// Map of mass for each Z
37  std::map<int, double> ZMassMap() const {return fZMassMap;}
38 
39  protected:
40  int SetupGeoManager();
41  TGeoManager* fGeoManager;
42  double fMass;
43  double fErrorFrac;
44  double fNNucleons;
45 
46  std::map<int, double> fZMassMap;
47  std::map<int, std::map<int, double>> fZIsotopeMassMap;
48  std::map<std::string, double> kMassError;
49 
50  double CountMass(int Z, TVector3 min , TVector3 max, int npoints, double& errofrac);
51  double CountMass(const TGeoVolume* vol, int Z, double& errorfrac);
52 
53 
54  };
55 }
TGeoManager * fGeoManager
Definition: TargetCount.h:41
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::map< int, double > ZMassMap() const
Map of mass for each Z.
Definition: TargetCount.h:37
std::map< int, double > fZMassMap
Definition: TargetCount.h:46
std::map< int, std::map< int, double > > fZIsotopeMassMap
Definition: TargetCount.h:47
double NNucleons() const
Number of nucleons (mass * avogadro&#39;s number)
Definition: TargetCount.h:31
std::map< std::string, double > kMassError
Definition: TargetCount.h:48
Float_t Z
Definition: plot.C:38
double NNuclei(int Z=-1, int A=-1) const
Number of nuclei, optionally restricted to a particular element or isotope.
double CountMass(int Z, TVector3 min, TVector3 max, int npoints, double &errofrac)
Definition: TargetCount.cxx:66
double ErrorFraction() const
Fractional error on mass or number of nucleons.
Definition: TargetCount.h:35
TargetCount(int Z=-1)
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
static const double A
Definition: Units.h:82
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
Count number of targets within the main part of the ND (vSuperBlockND)
Definition: TargetCount.h:10
double Mass() const
Mass in kg.
Definition: TargetCount.h:29