Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunesw
test
ArtServices
test_DetectorProperties.cxx
Go to the documentation of this file.
1
// test_DetectorProperties.cxx
2
3
// David Adams
4
// September 2015
5
//
6
// This test demonstrates how to configure and use the LArSoft DetectorProperties
7
// service outside the art framework.
8
9
#include "
lardata/DetectorInfoServices/DetectorPropertiesService.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
22
int
test_DetectorPropertiesService
(
string
gname) {
23
const
string
myname =
"test_DetectorPropertiesService: "
;
24
cout << myname <<
"Starting test"
<<
endl
;
25
#ifdef NDEBUG
26
cout << myname <<
"NDEBUG must be off."
<<
endl
;
27
abort();
28
#endif
29
string
line
=
"-----------------------------"
;
30
31
ArtServiceHelper::load_services
(
"prodsingle_dune35t.fcl"
,
ArtServiceHelper::FileOnPath
);
32
33
cout << myname << line <<
endl
;
34
cout << myname <<
"Get DetectorPropertiesService service."
<<
endl
;
35
auto
const
clockData =
art::ServiceHandle<detinfo::DetectorClocksService const>
()->DataForJob();
36
auto
const
detProp =
art::ServiceHandle<detinfo::DetectorPropertiesService const>
()->DataForJob(clockData);
37
38
cout << myname << line <<
endl
;
39
cout << myname <<
"Use DetectorProperties service."
<<
endl
;
40
cout << myname <<
" SamplingRate: "
<<
sampling_rate
(clockData) <<
endl
;
41
cout << myname <<
" ElectronsToADC: "
<< detProp.ElectronsToADC() <<
endl
;
42
43
cout << myname << line <<
endl
;
44
cout <<
"Done."
<<
endl
;
45
return
0;
46
}
47
48
int
main
() {
49
string
gname =
"dune35t4apa_v6"
;
50
test_DetectorPropertiesService
(gname);
51
return
0;
52
}
art::ServiceHandle
Definition:
ServiceHandle.h:37
EngineCreator.h
ArtServiceHelper.h
string
std::string string
Definition:
nybbler.cc:12
main
int main()
Definition:
test_DetectorProperties.cxx:48
ArtServiceHelper::FileOnPath
static constexpr FileOnPath_t FileOnPath
Definition:
ArtServiceHelper.h:113
DetectorPropertiesService.h
test_DetectorPropertiesService
int test_DetectorPropertiesService(string gname)
Definition:
test_DetectorProperties.cxx:22
ArtServiceHelper::load_services
static void load_services(std::string const &config)
Definition:
ArtServiceHelper.cxx:15
ServiceHandle.h
pduneana::line
void line(double t, double *p, double &x, double &y, double &z)
Definition:
PDSPAnalyzer_module.cc:4741
detinfo::sampling_rate
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
Definition:
DetectorClocksData.h:643
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11