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

Public Member Functions

 WebReaderTest (fhicl::ParameterSet const &p)
 
 WebReaderTest (WebReaderTest const &)=delete
 
 WebReaderTest (WebReaderTest &&)=delete
 
WebReaderTestoperator= (WebReaderTest const &)=delete
 
WebReaderTestoperator= (WebReaderTest &&)=delete
 
void analyze (art::Event const &e) override
 
- 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 Attributes

TGraph * gPed
 

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 33 of file WebReaderTest_module.cc.

Constructor & Destructor Documentation

WebReaderTest::WebReaderTest ( fhicl::ParameterSet const &  p)
explicit

Definition at line 55 of file WebReaderTest_module.cc.

56  : EDAnalyzer(p)
57  , gPed(nullptr)
58 {}
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
WebReaderTest::WebReaderTest ( WebReaderTest const &  )
delete
WebReaderTest::WebReaderTest ( WebReaderTest &&  )
delete

Member Function Documentation

void WebReaderTest::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 61 of file WebReaderTest_module.cc.

62 {
63  // Do it only once in the lifetime
64  if(!gPed) {
65 
66  // Let's retrieve ch==0 parameter "mean" from "kazu_pedestal"
67  const std::string folder ("kazu_pedestal");
68  const unsigned int ch = 0;
69  const std::string param ("mean");
70  int param_index = -1;
71 
72  // We sample over 100 time stamps, store values (time & mean value) in vector containers
73  const size_t npoints=100;
74  std::vector<double> xarray, yarray;
75  xarray.reserve(npoints);
76  yarray.reserve(npoints);
77  double ymax = std::numeric_limits<double>::min();
78  double ymin = std::numeric_limits<double>::max();
79 
80  // Loop over known time range in which data exists
81  TTimeStamp start (2015,2,6,0,0,1,0,false);
82  TTimeStamp end (2015,2,6,1,0,1,0,false);
83  TTimeStamp now (start);
84 
85  // Now create DBI instance and loop over sampling points
87  auto& db = db_handle->GetWebReader<double>();
88 
89  int period = (int)( (end.GetSec() - start.GetSec()) / (double)(npoints) );
90  for(size_t i=0; i<npoints; ++i) {
91 
92  // Set time for "now"
93  now.SetSec( now.GetSec() + period );
94 
95  // Request Snapshot for "now"
96  auto snapshot = db.Request(folder,now);
97 
98  // Retrieve a specific channel data
99  auto ch_data = snapshot.ChData(ch);
100 
101  // If param_index is unset, figure out (only once) for fast index access
102  if( param_index < 0 ) param_index = snapshot.Name2Index(param);
103 
104  // Retrieve a mean value
105  auto val = ch_data[ param_index ];
106 
107  // Record
108  xarray.push_back( now.GetSec() );
109  yarray.push_back( val );
110 
111  // Record min/max for plotting purpose
112  if( val > ymax ) ymax = val;
113  if( val < ymin ) ymin = val;
114  }
115 
116  // Decorate min/max
117  ymax *= 1.2;
118  ymin *= 1.2;
119  if( !ymax && !ymin ) { ymax=1; ymin=-1; }
120 
121  // Plot in TGraph
122  // Store in a histogram
124  gPed = fs->make<TGraph>(npoints,&xarray[0],&yarray[0]);
125  gPed->SetName("gPed");
126  gPed->SetTitle("Pedestal Mean Value Over Time; ;Pedestal Mean");
127  gPed->GetXaxis()->SetTimeDisplay(1);
128  gPed->GetXaxis()->SetNdivisions(-503);
129  gPed->GetXaxis()->SetTimeFormat("%Y-%m-%d %H:%M");
130  gPed->GetXaxis()->SetTimeOffset(0,"gmt");
131  gPed->GetXaxis()->SetRangeUser(start.GetSec(),end.GetSec());
132  gPed->SetMarkerStyle(22);
133  gPed->SetMarkerSize(1);
134  gPed->SetMaximum(ymax);
135  gPed->SetMinimum(ymin);
136 
137  TCanvas c("c","",600,500);
138  gPed->Draw("APL");
139  c.SaveAs("gPed.gif");
140  }
141 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::string string
Definition: nybbler.cc:12
static constexpr double fs
Definition: Units.h:100
WebReader< T > & GetWebReader()
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
WebReaderTest& WebReaderTest::operator= ( WebReaderTest const &  )
delete
WebReaderTest& WebReaderTest::operator= ( WebReaderTest &&  )
delete

Member Data Documentation

TGraph* WebReaderTest::gPed
private

Definition at line 51 of file WebReaderTest_module.cc.


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