All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestGeneratedEventTimestamp_module.cc
Go to the documentation of this file.
1 /**
2  * @file TestGeneratedEventTimestamp_module.cc
3  * @brief Test for GeneratedEventTimestamp
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date February 23, 2015
6  *
7  * Generated using artmod from cetpkgsupport v1_08_02.
8  */
9 
10 // CLHEP libraries
11 #include "CLHEP/Random/RandomEngine.h"
12 
13 // framework libraries
14 #include "messagefacility/MessageLogger/MessageLogger.h"
15 #include "canvas/Persistency/Provenance/Timestamp.h"
16 #include "art/Framework/Core/EDAnalyzer.h"
17 #include "art/Framework/Core/ModuleMacros.h"
18 #include "art/Framework/Principal/Event.h"
19 #include "art/Framework/Services/Registry/ServiceHandle.h"
20 namespace fhicl { class ParameterSet; }
21 
22 // artextensions libraries
23 #include "nurandom/RandomUtils/NuRandomService.h"
24 
25 class TestGeneratedEventTimestamp: public art::EDAnalyzer {
26  public:
27  explicit TestGeneratedEventTimestamp(fhicl::ParameterSet const& pset);
28 
29 private:
30  void analyze(art::Event const & e) override;
31  CLHEP::HepRandomEngine& fEngine;
32  CLHEP::HepRandomEngine& fAuxEngine;
33 }; // class TestGeneratedEventTimestamp
34 
35 
36 //------------------------------------------------------------------------------
38  (fhicl::ParameterSet const& pset)
39  : EDAnalyzer(pset)
40  // create two random engines; obtain the random seed from NuRandomService,
41  // unless overridden in configuration with key "Seed" and "AuxSeed"
42  , fEngine(art::ServiceHandle<rndm::NuRandomService>{}->createEngine(*this, pset, "Seed"))
43  , fAuxEngine(art::ServiceHandle<rndm::NuRandomService>{}->createEngine(*this, "HepJamesRandom", "aux", pset, "AuxSeed"))
44 {}
45 
46 
47 //------------------------------------------------------------------------------
48 void TestGeneratedEventTimestamp::analyze(art::Event const& event)
49 {
50  mf::LogInfo("TestGeneratedEventTimestamp")
51  << "Event time stamp: " << event.time().value()
52  << "\nRandom seeds: " << fEngine.getSeed() << " (main), "
53  << fAuxEngine.getSeed() << " (aux)";
54  }
55 
56 
57 DEFINE_ART_MODULE(TestGeneratedEventTimestamp)
TestGeneratedEventTimestamp(fhicl::ParameterSet const &pset)
void analyze(art::Event const &e) override
fEngine(art::ServiceHandle< rndm::NuRandomService >() ->createEngine(*this, pset,"Seed"))
do i e
createEngine fAuxEngine(art::ServiceHandle< rndm::NuRandomService >{}->createEngine(*this,"HepJamesRandom","aux", pset,"AuxSeed"))