HitsAna_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: HitsAna
3 // Module Type: analyzer
4 // File: HitsAna_module.cc
5 //
6 // Generated at Thu Feb 23 14:44:41 2017 by Andrey Sheshukov using artmod
7 // from cetpkgsupport v1_10_02.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/ParameterSet.h"
21 
23 #include "TTree.h"
24 
25 #include <limits>
26 #include <iomanip>
27 
28 namespace novaddt {
29  class HitsAna;
30 }
31 
32 class novaddt::HitsAna : public art::EDAnalyzer {
33 public:
34  explicit HitsAna(fhicl::ParameterSet const & p);
35  // The destructor generated by the compiler is fine for classes
36  // without bare pointers or other resource use.
37 
38  // Plugins should not be copied or assigned.
39  HitsAna(HitsAna const &) = delete;
40  HitsAna(HitsAna &&) = delete;
41  HitsAna & operator = (HitsAna const &) = delete;
42  HitsAna & operator = (HitsAna &&) = delete;
43 
44  void analyze(art::Event const & e) override;
45  void clearHits();
46  void addHit(const novaddt::DAQHit& );
47 private:
48 
49  // Declare member data here.
51 
52  std::vector<novaddt::TDC::value_type> fTime;
53  std::vector<novaddt::ADC::value_type> fADC;
54  std::vector<novaddt::Plane::value_type> fPlane;
55  std::vector<novaddt::Cell::value_type> fCell;
56  std::vector<novaddt::View::value_type> fView;
57  TTree* fTree;
59 };
60 
61 
63  :
64  EDAnalyzer(p),
65  fHitsTag(p.get<std::string>("hits_tag"))
66 {
68  fTree=tfs->make<TTree>("Hits","Hits analysis tree");
69  fTree->Branch("tdc",&fTime);
70  fTree->Branch("adc",&fADC);
71  fTree->Branch("plane",&fPlane);
72  fTree->Branch("cell",&fCell);
73  fTree->Branch("view",&fView);
74 }
75 
77  fTime.clear();
78  fADC.clear();
79  fPlane.clear();
80  fCell.clear();
81  fView.clear();
82 }
83 
85  fTime.push_back(h.TDC().val-fEvtTime);
86  fEvtTime=h.TDC().val;
87  fADC.push_back( h.ADC().val);
88  fPlane.push_back(h.Plane().val);
89  fCell.push_back(h.Cell().val);
90  fView.push_back(h.View().val);
91 }
92 
94 {
96  clearHits();
97  if(!hits->empty()) fEvtTime=hits->front().TDC().val;
98 
99  for(auto& h: *hits){
100  addHit(h);
101  }
102  fTree->Fill();
103  // Implementation of required member function here.
104 }
105 
value_type val
Definition: BaseProducts.h:34
novaddt::Plane const & Plane() const
Definition: DAQHit.h:70
novaddt::TDC const & TDC() const
Definition: DAQHit.h:74
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
std::vector< novaddt::View::value_type > fView
value_type val
Definition: BaseProducts.h:109
DEFINE_ART_MODULE(TestTMapFile)
std::vector< novaddt::ADC::value_type > fADC
std::vector< novaddt::Plane::value_type > fPlane
std::vector< novaddt::TDC::value_type > fTime
HitsAna & operator=(HitsAna const &)=delete
unsigned long long value_type
Definition: BaseProducts.h:32
void hits()
Definition: readHits.C:15
void addHit(const novaddt::DAQHit &)
HitsAna(fhicl::ParameterSet const &p)
novaddt::ADC const & ADC() const
Definition: DAQHit.h:73
novaddt::View const & View() const
Definition: DAQHit.h:72
novaddt::TDC::value_type fEvtTime
value_type val
Definition: BaseProducts.h:84
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
T * make(ARGS...args) const
void analyze(art::Event const &e) override
value_type val
Definition: BaseProducts.h:137
novaddt::Cell const & Cell() const
Definition: DAQHit.h:71
value_type val
Definition: BaseProducts.h:65
std::vector< novaddt::Cell::value_type > fCell
art::InputTag fHitsTag
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Float_t e
Definition: plot.C:35
enum BeamMode string