CkovCounterReco_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: CkovCounterReco
3 // Plugin Type: producer (art v2_12_01)
4 // File: CkovCounterReco_module.cc
5 //
6 // Generated at Tue Jun 4 10:10:54 2019 by Dung Phan using cetskelgen
7 // from cetlib version v3_06_00.
8 // Generates cherenkov reco objects from reconstructed BeamlineDigits
9 ////////////////////////////////////////////////////////////////////////
10 
18 #include "fhiclcpp/ParameterSet.h"
26 
29 #include "RawData/RawBeamline.h"
30 #include "Utilities/AssociationUtil.h"
31 
32 #include <iostream>
33 #include <memory>
34 
35 namespace beamlinereco {
36  class CkovCounterReco;
37 }
38 
40 public:
41  explicit CkovCounterReco(fhicl::ParameterSet const & p);
42 
43  void reconfigure(const fhicl::ParameterSet & p);
44  void produce(art::Event & e) override;
45 
46 private:
48 };
49 
50 
52  produces<std::vector<brb::Cherenkov> >();
53  produces<art::Assns<brb::Cherenkov, brb::BeamlineDigit>>();
54 
55  reconfigure(p);
56 }
57 
59  fRecoCkovDigitLabel = p.get<art::InputTag>("RecoCkovDigitLabel");
60 }
61 
63  std::unique_ptr<std::vector<brb::Cherenkov>> ckov_reco(new std::vector<brb::Cherenkov>);
64  std::unique_ptr<art::Assns<brb::Cherenkov, brb::BeamlineDigit>> ckov_assn(new art::Assns<brb::Cherenkov, brb::BeamlineDigit>);
65 
66  // get the reco cherenkov digits
68  std::vector<art::Ptr<brb::BeamlineDigit> > ckovDigits;
69  if (e.getByLabel(fRecoCkovDigitLabel, ckovDigitHandle))
70  art::fill_ptr_vector(ckovDigits, ckovDigitHandle);
71 
72  // if (ckovDigits.size() > 0) std::cout << "Found Ckov hit." << std::endl;
73  for (auto cd : ckovDigits) {
74  brb::Cherenkov ckov;
75  ckov.SetTime(cd->StartTimeInNanoSec());
76  ckov.SetCherenkovHit(true);
77 
78  ckov_reco->push_back(ckov);
79  util::CreateAssn(*this, e, *(ckov_reco.get()), cd, *(ckov_assn.get()), ckov_reco->size()-1);
80  }
81 
82  e.put(std::move(ckov_reco));
83  e.put(std::move(ckov_assn));
84 }
85 
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
void produce(art::Event &e) override
void reconfigure(const fhicl::ParameterSet &p)
void SetCherenkovHit(bool hit)
Definition: Cherenkov.cxx:38
const char * p
Definition: xmltok.h:285
void SetTime(float time)
Definition: Cherenkov.cxx:32
DEFINE_ART_MODULE(TestTMapFile)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
Encapsulation of reconstructed digitizer &#39;hits&#39;. Used for ToF PMTs and SiPMs, and Cherenkov and Muon ...
T get(std::string const &key) const
Definition: ParameterSet.h:231
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Raw data definitions for beamline data used in NOvA test beam experiment.
Encapsulation of &#39;reconstructed&#39; Cherenkov information. Part of beamline reconstruction for NOvA test...
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Float_t e
Definition: plot.C:35
c cd(1)
CkovCounterReco(fhicl::ParameterSet const &p)