ValidateDAQ2RawDigit_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \brief DAQ2RawDigit validation
3 /// \author Jarek Nowak
4 /// \date
5 ////////////////////////////////////////////////////////////////////////
6 
7 // C/C++ includes
8 #include <vector>
9 #include <iostream>
10 #include <map>
11 #include <cmath>
12 
13 // ROOT includes
14 #include "TH1.h"
15 
16 // Framework includes
24 
25 // NOvASoft includes
26 #include "RawData/RawDigit.h"
27 
28 
29 namespace validation {
31  public:
32  explicit ValidateDAQ2RawDigit(fhicl::ParameterSet const& pset);
34 
35  void analyze(art::Event const& evt);
36 
37  void reconfigure(const fhicl::ParameterSet& pset);
38 
39 
40  void beginJob();
41  void endJob();
42 
43  private:
44  ///< Sample configurable module parameters
45  std::string fInputModuleLabel; ///> label for module that made the data products you need for this module
46  TH1F* fNDigits;
47  TH1F* fNADC;
48  TH1F* fADC;
49 
50  };
51 }
52 
53 
54 ////////////////////////////////////////////////////////////////////////
55 
56 namespace validation{
57 
59  : EDAnalyzer(pset)
60  {
61  this->reconfigure(pset);
62  mf::LogInfo("Validation") << " Validation::ValidateDAQ2RawDigit()\n";
63  }
64 
65  //......................................................................
67  {
68  }
69 
70  //......................................................................
72  {
73  fInputModuleLabel = pset.get< std::string >("MyInputModuleLabel", "daq");
74  }
75 
76  //......................................................................
78  {
79 
81 
82  fADC = tfs->make<TH1F>("fADC", "ADC; ADC; digits", 1000,0.,1000.);
83  fNADC = tfs->make<TH1F>("fNADC", "NADC; NADC ; Events", 10,0.,10.);
84  fNDigits = tfs->make<TH1F>("fNDigits", "RawDigits; Number of raw digits; Events", 500,0.,5000.);
85  }
86 
87  //......................................................................
89  {
90 
91  // get rawdata::RawDigits from the event
93  evt.getByLabel(fInputModuleLabel, digitcol);
95  fNDigits->Fill(digitcol->size());
96  std::cout<<digitcol->size()<<std::endl;
97  for(unsigned int i = 0; i < digitcol->size(); ++i){
98  art::Ptr<rawdata::RawDigit> dig(digitcol, i);
99  digits.push_back(dig);
100  }
101 
102  // make the collection of ints we want to store
103  std::unique_ptr< std::vector<int> > adccol(new std::vector<int>);
104 
105  // fill a histogram with the size of each MCTruth
106  for(unsigned int i = 0; i < digits.size(); ++i){
107 
108  fNADC->Fill(digits[i]->NADC());
109 
110  for(unsigned int adc = 0; adc < digits[i]->NADC(); ++adc){
111  adccol->push_back( digits[i]->ADC(adc) );
112  fADC->Fill( digits[i]->ADC(adc) );
113  }
114  }
115 
116  return;
117  }
118 
120  {
121  mf::LogInfo("Validation") << " Validation::ValidateDAQ2RawDigit() ---DONE\n";
122 
123  }
124 
125 } //namespace validation
126 
127 
128 ////////////////////////////////////////////////////////////////////////
129 namespace validation
130 {
132 }
void reconfigure(const fhicl::ParameterSet &pset)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
ValidateDAQ2RawDigit(fhicl::ParameterSet const &pset)
DEFINE_ART_MODULE(TestTMapFile)
Class to run in order to validate ChannelInfo.
TH1F * fNDigits
label for module that made the data products you need for this module
std::string fInputModuleLabel
< Sample configurable module parameters
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
T get(std::string const &key) const
Definition: ParameterSet.h:231
int evt
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
size_type size() const
Definition: PtrVector.h:308
OStream cout
Definition: OStream.cxx:6
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Definition: fwd.h:28
enum BeamMode string