Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunesw
test
ArtServices
test_LArProperties.cxx
Go to the documentation of this file.
1
// test_LArProperties.cxx
2
3
// David Adams
4
// September 2015
5
//
6
// This test demonstrates how to configure and use the LArSoft LArProperties
7
// service outside the art framework.
8
9
#include "
lardata/DetectorInfoServices/LArPropertiesServiceStandard.h
"
10
11
#include <string>
12
#include <iostream>
13
#include "
dunecore/ArtSupport/ArtServiceHelper.h
"
14
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
15
#include "
art/Framework/Core/detail/EngineCreator.h
"
16
#include "CLHEP/Random/RandomEngine.h"
17
18
using
std::string
;
19
using
std::cout;
20
using
std::endl
;
21
using
detinfo::LArProperties
;
22
using
detinfo::LArPropertiesService
;
23
24
int
test_LArPropertiesStandard
(
string
gname) {
25
const
string
myname =
"test_LArPropertiesStandardServiceStandard: "
;
26
cout << myname <<
"Starting test"
<<
endl
;
27
#ifdef NDEBUG
28
cout << myname <<
"NDEBUG must be off."
<<
endl
;
29
abort();
30
#endif
31
string
line
=
"-----------------------------"
;
32
33
ArtServiceHelper::load_services
(
"prodsingle_dune35t.fcl"
,
ArtServiceHelper::FileOnPath
);
34
35
cout << myname << line <<
endl
;
36
cout << myname <<
"Get LArPropertiesServiceStandard service."
<<
endl
;
37
const
LArProperties
* plarsrv =
art::ServiceHandle<LArPropertiesService>
()->
provider
();
38
39
cout << myname << line <<
endl
;
40
cout << myname <<
"Use LArPropertiesStandard."
<<
endl
;
41
cout << myname <<
" Atomic number: "
<< plarsrv->
AtomicNumber
() <<
endl
;
42
cout << myname <<
" Radiation length: "
<< plarsrv->
RadiationLength
() <<
endl
;
43
44
cout << myname << line <<
endl
;
45
cout <<
"Done."
<<
endl
;
46
return
0;
47
}
48
49
int
main
() {
50
string
gname =
"dune35t4apa_v6"
;
51
test_LArPropertiesStandard
(gname);
52
return
0;
53
}
detinfo::LArProperties
Definition:
LArProperties.h:20
art::ServiceHandle
Definition:
ServiceHandle.h:37
main
int main()
Definition:
test_LArProperties.cxx:49
EngineCreator.h
ArtServiceHelper.h
string
std::string string
Definition:
nybbler.cc:12
ArtServiceHelper::FileOnPath
static constexpr FileOnPath_t FileOnPath
Definition:
ArtServiceHelper.h:113
RunHistoryService::provider
virtual const provider_type * provider() const override
Definition:
RunHistoryServiceStandard.h:30
ArtServiceHelper::load_services
static void load_services(std::string const &config)
Definition:
ArtServiceHelper.cxx:15
ServiceHandle.h
test_LArPropertiesStandard
int test_LArPropertiesStandard(string gname)
Definition:
test_LArProperties.cxx:24
detinfo::LArProperties::AtomicNumber
virtual double AtomicNumber() const =0
Atomic number of the liquid.
pduneana::line
void line(double t, double *p, double &x, double &y, double &z)
Definition:
PDSPAnalyzer_module.cc:4741
detinfo::LArProperties::RadiationLength
virtual double RadiationLength() const =0
detinfo::LArPropertiesService
Definition:
LArPropertiesService.h:18
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
LArPropertiesServiceStandard.h
Generated by
1.8.11