All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PtrMakerAnalyzer_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: PtrMakerAnalyzer
3 // Plugin Type: analyzer (art v2_05_00)
4 // File: PtrMakerAnalyzer_module.cc
5 //
6 // Generated at Wed Nov 23 21:29:25 2016 by Saba Sehrish using cetskelgen
7 // from cetlib version v1_21_00.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include "art/Framework/Core/EDAnalyzer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "fhiclcpp/ParameterSet.h"
15 
16 class PtrMakerAnalyzer : public art::EDAnalyzer {
17 public:
18  typedef art::PtrVector<int> intptrvector_t;
19 
20  explicit PtrMakerAnalyzer(fhicl::ParameterSet const & p);
21  // The compiler-generated destructor is fine for non-base
22  // classes without bare pointers or other resource use.
23 
24  // Plugins should not be copied or assigned.
25  PtrMakerAnalyzer(PtrMakerAnalyzer const &) = delete;
27  PtrMakerAnalyzer & operator = (PtrMakerAnalyzer const &) = delete;
29 
30  // Required functions.
31  void analyze(art::Event const & e) override;
32 
33 private:
34  std::string fInputLabel;
35  int nvalues;
36 
37 };
38 
39 
40 PtrMakerAnalyzer::PtrMakerAnalyzer(fhicl::ParameterSet const & p)
41  : EDAnalyzer(p)
42  , fInputLabel(p.get<std::string>("input_label"))
43  , nvalues (p.get<int> ("nvalues"))
44 {}
45 
46 void PtrMakerAnalyzer::analyze(art::Event const & e)
47 {
48  std::cerr << "PtrMakerAnalyzer is running\n";
49  art::Handle<intptrvector_t> h;
50  e.getByLabel(fInputLabel, h);
51  size_t sz = h->size();
52  if( sz != (size_t)nvalues ) {
53  throw cet::exception("SizeMismatch")
54  << "Expected a PtrVector of size " << nvalues
55  << " but the obtained size is " << sz
56  << '\n';
57  }
58 
59  int eid = e.id().event();
60 
61  //now check the values
63  for (int i = 0; i < nvalues; ++i) {
64  assert(*local[i] == eid*i);
65  }
66 }
67 
68 DEFINE_ART_MODULE(PtrMakerAnalyzer)
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
BEGIN_PROLOG could also be cerr
pdgs p
Definition: selectors.fcl:22
PtrMakerAnalyzer(fhicl::ParameterSet const &p)
while getopts h
then local
PtrMakerAnalyzer & operator=(PtrMakerAnalyzer const &)=delete
do i e
void analyze(art::Event const &e) override
art::PtrVector< int > intptrvector_t