Public Member Functions | Private Member Functions | List of all members
util::LArPropTest Class Reference
Inheritance diagram for util::LArPropTest:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 LArPropTest (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void beginJob () override
 
void analyze (const art::Event &evt) override
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 23 of file LArPropTest_module.cc.

Constructor & Destructor Documentation

util::LArPropTest::LArPropTest ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 34 of file LArPropTest_module.cc.

34 : EDAnalyzer(pset) {}
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25

Member Function Documentation

void util::LArPropTest::analyze ( const art::Event evt)
overrideprivate

Definition at line 130 of file LArPropTest_module.cc.

131  {}
void util::LArPropTest::beginJob ( )
overrideprivatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 37 of file LArPropTest_module.cc.

38  {
39  // Make sure assert is enabled.
40 
41  bool assert_flag = false;
42  assert((assert_flag = true, assert_flag));
43  if (!assert_flag) {
44  std::cerr << "Assert is disabled" << std::endl;
45  abort();
46  }
47 
48  // Get services.
49 
50  detinfo::LArProperties const* larprop = lar::providerFrom<detinfo::LArPropertiesService>();
51  auto const detprop =
53 
54  // Test (default) accessors.
55 
56  std::cout << "Density = " << detprop.Density() << " g/cm^3" << std::endl;
57  std::cout << "Drift velocity = " << detprop.DriftVelocity() << " cm/usec" << std::endl;
58  std::cout << "Efield = " << detprop.Efield() << " kV/cm" << std::endl;
59  std::cout << "Temperature = " << detprop.Temperature() << " Kelvin" << std::endl;
60  std::cout << "Electron lifetime = " << detprop.ElectronLifetime() << " usec" << std::endl;
61  std::cout << "Radiation Length = " << larprop->RadiationLength() << " g/cm^2" << std::endl;
62  std::cout << "Radiation Length = " << larprop->RadiationLength() / detprop.Density() << " cm"
63  << std::endl;
64 
65  // Make sure default values are acting correctly.
66 
67  assert(detprop.Density() == detprop.Density(detprop.Temperature()));
68  assert(detprop.Density() != detprop.Density(detprop.Temperature() + 0.1));
69  assert(detprop.DriftVelocity() == detprop.DriftVelocity(detprop.Efield()));
70  assert(detprop.DriftVelocity() ==
71  detprop.DriftVelocity(detprop.Efield(), detprop.Temperature()));
72 
73  // Drift velocity vs. electric field.
74 
75  std::cout << "\nDrift Velocity vs. Electric Field.\n"
76  << " E (kV/cm) v (cm/us)" << std::fixed << std::endl;
77  for (int i = 0; i < 3; ++i) {
78  double e = 0.5;
79  if (i == 1)
80  e = 0.666667;
81  else if (i == 2)
82  e = 0.8;
83  double v = detprop.DriftVelocity(e);
84  std::cout << std::setprecision(3) << std::setw(15) << e << std::setprecision(4)
85  << std::setw(15) << v << std::endl;
86  }
87 
88  // dE/dx.
89 
90  std::cout
91  << "\nCompare "
92  "http://pdg.lbl.gov/2011/AtomicNuclearProperties/MUON_ELOSS_TABLES/muonloss_289.dat\n"
93  << std::endl;
94 
95  double mass = 0.10565839; // Muon.
96  double fact[16] = {
97  1.0, 1.2, 1.4, 1.7, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0};
98 
99  std::ios_base::fmtflags flags = std::cout.flags();
100  std::cout << " T p Ionization dE/dx|_R\n"
101  << " [MeV] [MeV/c] ---[MeV cm^2/g]----\n"
102  << std::scientific << std::setprecision(3);
103 
104  // Loop over kinetic energy.
105 
106  for (double tbase = 1.; tbase <= 1.e9; tbase *= 10.) {
107  for (int i = 0; i < 16; ++i) {
108 
109  // T in MeV.
110 
111  double t = tbase * fact[i];
112  if (t > 1.e9) break;
113 
114  // Calculate momentum in GeV/C
115 
116  double p = std::sqrt(1.e-6 * t * t + 2.e-3 * t * mass);
117 
118  // Calculate restricted and unrestricted dE/dx.
119 
120  double dedxr = detprop.Eloss(p, mass, 0.05) / detprop.Density(); // Restricted.
121  double dedx = detprop.Eloss(p, mass, 0.) / detprop.Density(); // Unrestricted.
122  std::cout << std::setw(10) << t << std::setw(10) << 1000. * p << std::setw(10) << dedx
123  << std::setw(10) << dedxr << std::endl;
124  }
125  }
126  std::cout.flags(flags);
127  }
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
const double e
p
Definition: test.py:223
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
virtual double RadiationLength() const =0
int flags() const
Definition: qtextstream.h:232
QTextStream & endl(QTextStream &s)

The documentation for this class was generated from the following file: